better-supabase 0.50.0 → 0.51.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/README.md +14 -0
- package/dist/{activities-C2v_Sq4w.d.ts → activities-CL253DEv.d.ts} +2 -2
- package/dist/{adapter-BzeH7ffo.js → adapter-DBO28HF_.js} +1 -1
- package/dist/{agents-Cekdx8Bz.d.ts → agents-C3l31Csq.d.ts} +33 -2
- package/dist/agents-Cf59iYaF.d.ts +290 -0
- package/dist/agents-lkuM-m6i.js +380 -0
- package/dist/{ai-cache-Pchr6Y4y.js → ai-cache-CnmJIQZG.js} +2 -2
- package/dist/{ai-chat-D2o3jqZ5.d.ts → ai-chat-DwVklsNR.d.ts} +88 -7
- package/dist/{ai-files-B2BWwPoj.js → ai-files-CMDsogDg.js} +3 -2
- package/dist/ai-guardrails-Ckbf-cmW.d.ts +216 -0
- package/dist/{ai-schedules-BOiaFIva.d.ts → ai-schedules-D68hvDoZ.d.ts} +1 -1
- package/dist/ai-sdk/agents/index.d.ts +68 -212
- package/dist/ai-sdk/agents/index.js +103 -300
- package/dist/ai-sdk/batches/index.js +1 -1
- package/dist/ai-sdk/cache/index.js +1 -1
- package/dist/ai-sdk/chat/index.d.ts +2 -2
- package/dist/ai-sdk/chat/index.js +5 -2
- package/dist/ai-sdk/embeddings/index.d.ts +52 -3
- package/dist/ai-sdk/embeddings/index.js +69 -1
- package/dist/ai-sdk/files/index.d.ts +38 -4
- package/dist/ai-sdk/files/index.js +100 -4
- package/dist/ai-sdk/index.d.ts +166 -16
- package/dist/ai-sdk/index.js +394 -21
- package/dist/ai-sdk/mcp/index.d.ts +49 -2
- package/dist/ai-sdk/mcp/index.js +108 -6
- package/dist/ai-sdk/memory/index.d.ts +2 -2
- package/dist/ai-sdk/memory/index.js +7 -2
- package/dist/ai-sdk/react/index.js +2 -2
- package/dist/ai-sdk/react/server.js +1 -1
- package/dist/ai-sdk/workflow/index.d.ts +87 -23
- package/dist/ai-sdk/workflow/index.js +275 -28
- package/dist/ai-sdk/workflow/react/index.d.ts +25 -4
- package/dist/ai-sdk/workflow/react/index.js +71 -16
- package/dist/ai-sdk/workflow/react/server.d.ts +4 -4
- package/dist/{api-CWeCh_j2.d.ts → api-3I8ucZF2.d.ts} +1 -1
- package/dist/{api-DXZh-j0l.js → api-CZGUgEVr.js} +1 -1
- package/dist/{app-tables-ByFny1cL.d.ts → app-tables-qa0wvhw0.d.ts} +1 -1
- package/dist/{approvals-B-WgN6Mf.d.ts → approvals-C7DjllLP.d.ts} +84 -1
- package/dist/{approvals-CMkvP9kT.js → approvals-CfQuk-lJ.js} +84 -8
- package/dist/{assistant-DcxV_seb.js → assistant-BBN9KJPi.js} +108 -26
- package/dist/{assistant-Dy9zwENt.d.ts → assistant-VF3vhPZo.d.ts} +68 -25
- package/dist/astro/index.js +2 -2
- package/dist/{attachments-gjSYzlsQ.js → attachments-Da24yVTB.js} +4 -4
- package/dist/audit-files/index.js +2 -2
- package/dist/{authorization-N4bh4KQS.d.ts → authorization-fXe0XyzB.d.ts} +1 -1
- package/dist/{automations-Ce0jNNIe.js → automations-BKxKPkhr.js} +2 -2
- package/dist/{automations-CCc5RUw-.js → automations-CkwKi84L.js} +2 -1
- package/dist/{bind-ChYzUApb.d.ts → bind-CimlbjXB.d.ts} +3 -3
- package/dist/{block-authors-CjI5VcQz.js → block-authors-Dt82LpCs.js} +1 -1
- package/dist/{block-env-buLS8m9m.d.ts → block-env-D0JCpFzh.d.ts} +4 -4
- package/dist/{block-helpers-CCl3V9ku.js → block-helpers-DApvw3n9.js} +5 -2
- package/dist/{block-hooks-C2_d17_b.js → block-hooks-mazaapv5.js} +1 -1
- package/dist/{block-subjects-ok-uZ1UU.js → block-subjects-CFDmtXvr.js} +1 -1
- package/dist/{block-subjects-rv7V0R6O.js → block-subjects-D3r2SfCb.js} +10 -10
- package/dist/{block-tables-CQHwZ9-v.d.ts → block-tables-CdXRHb2v.d.ts} +1 -1
- package/dist/blocks/access-requests/index.d.ts +1 -1
- package/dist/blocks/access-requests/index.js +2 -2
- package/dist/blocks/accounting/index.d.ts +1 -1
- package/dist/blocks/accounting/index.js +3 -3
- package/dist/blocks/acknowledgements/index.d.ts +1 -1
- package/dist/blocks/acknowledgements/index.js +2 -2
- package/dist/blocks/activities/index.d.ts +5 -13
- package/dist/blocks/activities/index.js +3 -3
- package/dist/blocks/advisories/index.d.ts +1 -1
- package/dist/blocks/advisories/index.js +2 -2
- package/dist/blocks/agent-checkout/index.d.ts +1 -1
- package/dist/blocks/agent-checkout/index.js +2 -2
- package/dist/blocks/agents/index.d.ts +4 -4
- package/dist/blocks/agents/index.js +47 -8
- package/dist/blocks/ai-cache/index.d.ts +1 -1
- package/dist/blocks/ai-cache/index.js +2 -2
- package/dist/blocks/ai-chat/index.d.ts +4 -4
- package/dist/blocks/ai-chat/index.js +76 -8
- package/dist/blocks/ai-evals/index.d.ts +1 -1
- package/dist/blocks/ai-evals/index.js +2 -2
- package/dist/blocks/ai-files/index.d.ts +2 -2
- package/dist/blocks/ai-files/index.js +2 -2
- package/dist/blocks/ai-guardrails/index.d.ts +3 -216
- package/dist/blocks/ai-guardrails/index.js +4 -4
- package/dist/blocks/ai-keys/index.d.ts +1 -1
- package/dist/blocks/ai-keys/index.js +4 -4
- package/dist/blocks/ai-schedules/index.d.ts +2 -2
- package/dist/blocks/ai-schedules/index.js +2 -2
- package/dist/blocks/announcements/index.d.ts +4 -4
- package/dist/blocks/announcements/index.js +2 -2
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/api-keys/index.js +2 -2
- package/dist/blocks/appraisals/index.d.ts +1 -1
- package/dist/blocks/appraisals/index.js +2 -2
- package/dist/blocks/approvals/index.d.ts +2 -2
- package/dist/blocks/approvals/index.js +3 -3
- package/dist/blocks/assets/index.d.ts +2 -2
- package/dist/blocks/assets/index.js +3 -3
- package/dist/blocks/assignment/index.d.ts +1 -1
- package/dist/blocks/assignment/index.js +3 -3
- package/dist/blocks/attachments/index.d.ts +5 -5
- package/dist/blocks/attachments/index.js +3 -3
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/audit/index.js +2 -2
- package/dist/blocks/automations/index.d.ts +4 -4
- package/dist/blocks/automations/index.js +3 -3
- package/dist/blocks/banking/index.d.ts +1 -1
- package/dist/blocks/banking/index.js +3 -3
- package/dist/blocks/billable-time/index.d.ts +1 -1
- package/dist/blocks/billable-time/index.js +3 -3
- package/dist/blocks/billing/index.d.ts +2 -2
- package/dist/blocks/billing/index.js +2 -2
- package/dist/blocks/bookings/index.d.ts +2 -2
- package/dist/blocks/bookings/index.js +2 -2
- package/dist/blocks/bulk/index.d.ts +1 -1
- package/dist/blocks/bulk/index.js +2 -2
- package/dist/blocks/calendar/index.d.ts +3 -3
- package/dist/blocks/calendar/index.js +1 -1
- package/dist/blocks/care/index.d.ts +27 -27
- package/dist/blocks/care/index.js +27 -27
- package/dist/blocks/care-plans/index.d.ts +3 -3
- package/dist/blocks/care-plans/index.js +3 -3
- package/dist/blocks/cases/index.d.ts +3 -3
- package/dist/blocks/cases/index.js +3 -3
- package/dist/blocks/catalog/index.d.ts +2 -2
- package/dist/blocks/catalog/index.js +3 -3
- package/dist/blocks/channels/index.d.ts +1 -1
- package/dist/blocks/channels/index.js +2 -2
- package/dist/blocks/clinical-decision-support/index.d.ts +1 -1
- package/dist/blocks/clinical-decision-support/index.js +2 -2
- package/dist/blocks/cms/index.d.ts +5 -5
- package/dist/blocks/cms/index.js +5 -5
- package/dist/blocks/collaboration/index.d.ts +6 -6
- package/dist/blocks/collaboration/index.js +6 -6
- package/dist/blocks/collections/index.d.ts +1 -1
- package/dist/blocks/collections/index.js +2 -2
- package/dist/blocks/comments/index.d.ts +2 -2
- package/dist/blocks/comments/index.js +3 -3
- package/dist/blocks/commerce/index.d.ts +5 -5
- package/dist/blocks/commerce/index.js +5 -5
- package/dist/blocks/commissions/index.d.ts +1 -1
- package/dist/blocks/commissions/index.js +2 -2
- package/dist/blocks/compliance/index.d.ts +1 -1
- package/dist/blocks/compliance/index.js +2 -2
- package/dist/blocks/connectors/index.d.ts +1 -1
- package/dist/blocks/connectors/index.js +3 -3
- package/dist/blocks/consents/index.d.ts +2 -2
- package/dist/blocks/consents/index.js +3 -3
- package/dist/blocks/contacts/index.d.ts +3 -3
- package/dist/blocks/contacts/index.js +4 -4
- package/dist/blocks/content/index.d.ts +2 -2
- package/dist/blocks/content/index.js +3 -3
- package/dist/blocks/contracts/index.d.ts +1 -1
- package/dist/blocks/contracts/index.js +4 -4
- package/dist/blocks/courses/index.d.ts +3 -3
- package/dist/blocks/courses/index.js +3 -3
- package/dist/blocks/created-by/index.d.ts +2 -2
- package/dist/blocks/crm/index.d.ts +16 -16
- package/dist/blocks/crm/index.js +16 -16
- package/dist/blocks/custom-fields/index.d.ts +1 -1
- package/dist/blocks/custom-fields/index.js +2 -2
- package/dist/blocks/dam/index.d.ts +2 -2
- package/dist/blocks/dam/index.js +4 -4
- package/dist/blocks/data-lifecycle/index.d.ts +2 -2
- package/dist/blocks/data-lifecycle/index.js +3 -3
- package/dist/blocks/deals/index.d.ts +1 -1
- package/dist/blocks/deals/index.js +3 -3
- package/dist/blocks/dispatch/index.d.ts +2 -2
- package/dist/blocks/dispatch/index.js +4 -4
- package/dist/blocks/document-templates/index.d.ts +1 -1
- package/dist/blocks/document-templates/index.js +2 -2
- package/dist/blocks/documents/index.d.ts +1 -1
- package/dist/blocks/documents/index.js +2 -2
- package/dist/blocks/domains/index.d.ts +1 -1
- package/dist/blocks/domains/index.js +3 -3
- package/dist/blocks/donations/index.d.ts +1 -1
- package/dist/blocks/donations/index.js +4 -4
- package/dist/blocks/drive/index.d.ts +5 -5
- package/dist/blocks/drive/index.js +5 -5
- package/dist/blocks/e-prescribing/index.d.ts +1 -1
- package/dist/blocks/e-prescribing/index.js +2 -2
- package/dist/blocks/employees/index.d.ts +1 -1
- package/dist/blocks/employees/index.js +3 -3
- package/dist/blocks/enrichment/index.d.ts +1 -1
- package/dist/blocks/enrichment/index.js +3 -3
- package/dist/blocks/enrollments/index.d.ts +2 -2
- package/dist/blocks/enrollments/index.js +3 -3
- package/dist/blocks/entitlements/index.d.ts +3 -3
- package/dist/blocks/entitlements/index.js +3 -3
- package/dist/blocks/events/index.d.ts +3 -3
- package/dist/blocks/events/index.js +3 -3
- package/dist/blocks/expenses/index.d.ts +1 -1
- package/dist/blocks/expenses/index.js +3 -3
- package/dist/blocks/field-history/index.d.ts +1 -1
- package/dist/blocks/field-history/index.js +3 -3
- package/dist/blocks/filespace/index.d.ts +8 -8
- package/dist/blocks/filespace/index.js +7 -7
- package/dist/blocks/finance/index.d.ts +5 -5
- package/dist/blocks/finance/index.js +5 -5
- package/dist/blocks/flags/index.d.ts +1 -1
- package/dist/blocks/flags/index.js +3 -3
- package/dist/blocks/forecasts/index.d.ts +1 -1
- package/dist/blocks/forecasts/index.js +3 -3
- package/dist/blocks/forms/index.d.ts +3 -3
- package/dist/blocks/forms/index.js +2 -2
- package/dist/blocks/funding/index.d.ts +2 -2
- package/dist/blocks/funding/index.js +3 -3
- package/dist/blocks/goals/index.d.ts +1 -1
- package/dist/blocks/goals/index.js +3 -3
- package/dist/blocks/governance/index.d.ts +4 -4
- package/dist/blocks/governance/index.js +4 -4
- package/dist/blocks/guests/index.d.ts +1 -1
- package/dist/blocks/guests/index.js +3 -3
- package/dist/blocks/hiring/index.d.ts +1 -1
- package/dist/blocks/hiring/index.js +3 -3
- package/dist/blocks/identities/index.d.ts +1 -1
- package/dist/blocks/identities/index.js +2 -2
- package/dist/blocks/imports/index.d.ts +2 -2
- package/dist/blocks/imports/index.js +2 -2
- package/dist/blocks/inbox/index.d.ts +8 -8
- package/dist/blocks/inbox/index.js +3 -3
- package/dist/blocks/incidents/index.d.ts +1 -1
- package/dist/blocks/incidents/index.js +2 -2
- package/dist/blocks/index.d.ts +8 -8
- package/dist/blocks/index.js +4 -4
- package/dist/blocks/inspections/index.d.ts +2 -2
- package/dist/blocks/inspections/index.js +2 -2
- package/dist/blocks/inventory/index.d.ts +1 -1
- package/dist/blocks/inventory/index.js +3 -3
- package/dist/blocks/invoices/index.d.ts +1 -1
- package/dist/blocks/invoices/index.js +3 -3
- package/dist/blocks/knowledge/index.d.ts +3 -3
- package/dist/blocks/knowledge/index.js +4 -4
- package/dist/blocks/lead-scoring/index.d.ts +2 -2
- package/dist/blocks/lead-scoring/index.js +3 -3
- package/dist/blocks/learning/index.d.ts +3 -3
- package/dist/blocks/learning/index.js +3 -3
- package/dist/blocks/leases/index.d.ts +1 -1
- package/dist/blocks/leases/index.js +3 -3
- package/dist/blocks/leave/index.d.ts +1 -1
- package/dist/blocks/leave/index.js +3 -3
- package/dist/blocks/ledger/index.d.ts +1 -1
- package/dist/blocks/ledger/index.js +2 -2
- package/dist/blocks/legal-entities/index.d.ts +2 -2
- package/dist/blocks/legal-entities/index.js +2 -2
- package/dist/blocks/lims/index.d.ts +2 -2
- package/dist/blocks/lims/index.js +2 -2
- package/dist/blocks/mail-sync/index.d.ts +3 -3
- package/dist/blocks/mail-sync/index.js +3 -3
- package/dist/blocks/maintenance/index.d.ts +2 -2
- package/dist/blocks/maintenance/index.js +3 -3
- package/dist/blocks/manufacturing/index.d.ts +2 -2
- package/dist/blocks/manufacturing/index.js +3 -3
- package/dist/blocks/medications/index.d.ts +1 -1
- package/dist/blocks/medications/index.js +3 -3
- package/dist/blocks/meetings/index.d.ts +3 -3
- package/dist/blocks/meetings/index.js +3 -3
- package/dist/blocks/memberships/index.d.ts +2 -2
- package/dist/blocks/memory/index.d.ts +3 -3
- package/dist/blocks/memory/index.js +7 -7
- package/dist/blocks/messaging/index.d.ts +5 -5
- package/dist/blocks/messaging/index.js +3 -3
- package/dist/blocks/metrics/index.d.ts +1 -1
- package/dist/blocks/metrics/index.js +2 -2
- package/dist/blocks/mfa/index.d.ts +2 -2
- package/dist/blocks/moderation/index.d.ts +2 -2
- package/dist/blocks/moderation/index.js +2 -2
- package/dist/blocks/notifications/index.d.ts +5 -5
- package/dist/blocks/notifications/index.js +3 -3
- package/dist/blocks/numbering/index.d.ts +1 -1
- package/dist/blocks/numbering/index.js +1 -1
- package/dist/blocks/oauth-server/index.d.ts +1 -1
- package/dist/blocks/oauth-server/index.js +2 -2
- package/dist/blocks/observations/index.d.ts +2 -2
- package/dist/blocks/observations/index.js +3 -3
- package/dist/blocks/onboarding/index.d.ts +2 -2
- package/dist/blocks/onboarding/index.js +2 -2
- package/dist/blocks/orders/index.d.ts +1 -1
- package/dist/blocks/orders/index.js +4 -4
- package/dist/blocks/organizations/index.d.ts +2 -2
- package/dist/blocks/organizations/index.js +3 -3
- package/dist/blocks/outbox/index.d.ts +1 -1
- package/dist/blocks/outbox/index.js +2 -2
- package/dist/blocks/passes/index.d.ts +2 -2
- package/dist/blocks/passes/index.js +3 -3
- package/dist/blocks/payroll-export/index.d.ts +2 -2
- package/dist/blocks/payroll-export/index.js +3 -3
- package/dist/blocks/people/index.d.ts +7 -7
- package/dist/blocks/people/index.js +7 -7
- package/dist/blocks/periods/index.d.ts +1 -1
- package/dist/blocks/periods/index.js +2 -2
- package/dist/blocks/permissions/index.d.ts +3 -3
- package/dist/blocks/permissions/index.js +2 -2
- package/dist/blocks/pipelines/index.d.ts +1 -1
- package/dist/blocks/pipelines/index.js +3 -3
- package/dist/blocks/posts/index.d.ts +2 -2
- package/dist/blocks/posts/index.js +2 -2
- package/dist/blocks/procurement/index.d.ts +5 -5
- package/dist/blocks/procurement/index.js +5 -5
- package/dist/blocks/profiles/index.d.ts +1 -1
- package/dist/blocks/profiles/index.js +3 -3
- package/dist/blocks/projects/index.d.ts +7 -7
- package/dist/blocks/projects/index.js +7 -7
- package/dist/blocks/promotions/index.d.ts +1 -1
- package/dist/blocks/promotions/index.js +4 -4
- package/dist/blocks/prompts/index.d.ts +1 -1
- package/dist/blocks/prompts/index.js +2 -2
- package/dist/blocks/push/index.d.ts +2 -2
- package/dist/blocks/push/index.js +3 -3
- package/dist/blocks/qualifications/index.d.ts +2 -2
- package/dist/blocks/qualifications/index.js +3 -3
- package/dist/blocks/queue/index.d.ts +96 -3
- package/dist/blocks/queue/index.js +149 -7
- package/dist/blocks/quotes/index.d.ts +1 -1
- package/dist/blocks/quotes/index.js +3 -3
- package/dist/blocks/rank/index.d.ts +1 -1
- package/dist/blocks/rank/index.js +2 -2
- package/dist/blocks/reactions/index.d.ts +4 -4
- package/dist/blocks/reactions/index.js +3 -3
- package/dist/blocks/recruiting/index.d.ts +4 -4
- package/dist/blocks/recruiting/index.js +4 -4
- package/dist/blocks/referrals/index.d.ts +1 -1
- package/dist/blocks/referrals/index.js +2 -2
- package/dist/blocks/relations/index.d.ts +1 -1
- package/dist/blocks/relations/index.js +4 -4
- package/dist/blocks/reminders/index.d.ts +1 -1
- package/dist/blocks/reminders/index.js +1 -1
- package/dist/blocks/reviews/index.d.ts +1 -1
- package/dist/blocks/reviews/index.js +2 -2
- package/dist/blocks/rfqs/index.d.ts +2 -2
- package/dist/blocks/rfqs/index.js +3 -3
- package/dist/blocks/risks/index.d.ts +2 -2
- package/dist/blocks/risks/index.js +2 -2
- package/dist/blocks/saas/index.d.ts +12 -12
- package/dist/blocks/saas/index.js +12 -12
- package/dist/blocks/sales/index.d.ts +1 -1
- package/dist/blocks/sales/index.js +1 -1
- package/dist/blocks/saved-views/index.d.ts +2 -2
- package/dist/blocks/saved-views/index.js +2 -2
- package/dist/blocks/scheduling/index.d.ts +4 -4
- package/dist/blocks/scheduling/index.js +4 -4
- package/dist/blocks/scores/index.d.ts +2 -2
- package/dist/blocks/scores/index.js +3 -3
- package/dist/blocks/search/index.d.ts +4 -4
- package/dist/blocks/search/index.js +2 -2
- package/dist/blocks/security-events/index.d.ts +1 -1
- package/dist/blocks/security-events/index.js +2 -2
- package/dist/blocks/segments/index.d.ts +2 -2
- package/dist/blocks/segments/index.js +3 -3
- package/dist/blocks/sequences/index.d.ts +3 -3
- package/dist/blocks/sequences/index.js +3 -3
- package/dist/blocks/service/index.d.ts +7 -7
- package/dist/blocks/service/index.js +7 -7
- package/dist/blocks/service-accounts/index.d.ts +1 -1
- package/dist/blocks/service-accounts/index.js +2 -2
- package/dist/blocks/sessions/index.d.ts +2 -2
- package/dist/blocks/sessions/index.js +2 -2
- package/dist/blocks/settings/index.d.ts +2 -2
- package/dist/blocks/settings/index.js +3 -3
- package/dist/blocks/share-links/index.d.ts +1 -1
- package/dist/blocks/share-links/index.js +1 -1
- package/dist/blocks/shifts/index.d.ts +2 -2
- package/dist/blocks/shifts/index.js +3 -3
- package/dist/blocks/shipments/index.d.ts +2 -2
- package/dist/blocks/shipments/index.js +4 -4
- package/dist/blocks/signatures/index.d.ts +2 -2
- package/dist/blocks/signatures/index.js +2 -2
- package/dist/blocks/signing-keys/index.d.ts +1 -1
- package/dist/blocks/signing-keys/index.js +2 -2
- package/dist/blocks/sla/index.d.ts +1 -1
- package/dist/blocks/sla/index.js +3 -3
- package/dist/blocks/sso/index.d.ts +1 -1
- package/dist/blocks/sso/index.js +2 -2
- package/dist/blocks/state-machine/index.d.ts +1 -1
- package/dist/blocks/state-machine/index.js +1 -1
- package/dist/blocks/subjects/index.d.ts +2 -2
- package/dist/blocks/subjects/index.js +3 -3
- package/dist/blocks/support/index.d.ts +5 -5
- package/dist/blocks/support/index.js +5 -5
- package/dist/blocks/tags/index.d.ts +2 -2
- package/dist/blocks/tags/index.js +1 -1
- package/dist/blocks/tasks/index.d.ts +2 -2
- package/dist/blocks/tasks/index.js +3 -3
- package/dist/blocks/tax/index.d.ts +2 -2
- package/dist/blocks/tax/index.js +3 -3
- package/dist/blocks/teams/index.d.ts +1 -1
- package/dist/blocks/teams/index.js +1 -1
- package/dist/blocks/templates/index.d.ts +3 -3
- package/dist/blocks/templates/index.js +2 -2
- package/dist/blocks/tills/index.d.ts +1 -1
- package/dist/blocks/tills/index.js +3 -3
- package/dist/blocks/time-tracking/index.d.ts +2 -2
- package/dist/blocks/time-tracking/index.js +2 -2
- package/dist/blocks/timeline/index.d.ts +1 -1
- package/dist/blocks/timeline/index.js +2 -2
- package/dist/blocks/trash/index.d.ts +1 -1
- package/dist/blocks/trash/index.js +2 -2
- package/dist/blocks/undo/index.d.ts +2 -2
- package/dist/blocks/undo/index.js +2 -2
- package/dist/blocks/updated-at/index.d.ts +2 -2
- package/dist/blocks/usage/index.d.ts +3 -3
- package/dist/blocks/usage/index.js +15 -3
- package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
- package/dist/blocks/vercel-marketplace/index.js +2 -2
- package/dist/blocks/versions/index.d.ts +1 -1
- package/dist/blocks/versions/index.js +2 -2
- package/dist/blocks/waitlist/index.d.ts +1 -1
- package/dist/blocks/waitlist/index.js +2 -2
- package/dist/blocks/warehouse/index.d.ts +1 -1
- package/dist/blocks/warehouse/index.js +3 -3
- package/dist/blocks/webhooks/index.d.ts +1 -1
- package/dist/blocks/webhooks/index.js +6 -6
- package/dist/blocks/workflow-editor/index.d.ts +7 -7
- package/dist/blocks/workflow-editor/index.js +3 -3
- package/dist/blocks/workflows/index.d.ts +5 -5
- package/dist/blocks/workflows/index.js +51 -12
- package/dist/{blocks-ERs7xZ7E.d.ts → blocks-DbarkJe1.d.ts} +43 -19
- package/dist/{channel-iJrqCvKh.js → channel-HoCqE6Xb.js} +1 -1
- package/dist/chat-sdk/index.d.ts +549 -131
- package/dist/chat-sdk/index.js +881 -245
- package/dist/claims/index.d.ts +3 -3
- package/dist/cli/{account-D7u3LvNN.js → account-CVomaGBV.js} +1 -1
- package/dist/cli/{account-BGMPSKJs.js → account-Co53476L.js} +1 -1
- package/dist/cli/add-CGR3mLgc.js +1 -0
- package/dist/cli/{add-BhQZHdAv.js → add-Cbuj3vBk.js} +2 -2
- package/dist/cli/{add-yTy1CuMe.js → add-ymWkkPNw.js} +13 -13
- package/dist/cli/{app-table-files-CSZU_cFC.js → app-table-files-DoPmytoG.js} +3 -3
- package/dist/cli/{app-tables-CmY2GVb3.js → app-tables-D1rjtFmq.js} +2 -2
- package/dist/cli/{automations-DKKuC8MW.js → automations-DAMWU5je.js} +1 -1
- package/dist/cli/{backfill-BUNIA-Vt.js → backfill-DgHzYvi5.js} +162 -6
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-BO-v5N1q.js → blocks-CzCYyx9N.js} +2 -2
- package/dist/cli/{blocks-CLaPv7TM.js → blocks-DmIQd43q.js} +1 -1
- package/dist/cli/{cache-VZU4FIOF.js → cache-dmC65uMm.js} +1 -1
- package/dist/cli/{codemod-DgbHI_T7.js → codemod-CzRpopTy.js} +3 -3
- package/dist/cli/{command-bvbsvYpo.js → command-CLlRvLN9.js} +14 -7
- package/dist/cli/{completion-C8zJwfzA.js → completion-4Ta2j6uu.js} +2 -2
- package/dist/cli/{completion-CsGpvIuo.js → completion-BeyJYbyT.js} +2 -2
- package/dist/cli/{completion-GgZmb_t7.js → completion-DwUZqnou.js} +1 -1
- package/dist/cli/{config-C-DXllAX.js → config-DDzGKmmT.js} +32 -1
- package/dist/cli/{config-DyGupd-1.js → config-DPKOp4D5.js} +1 -1
- package/dist/cli/{config-CWQesy6K.js → config-lZB85ksj.js} +1 -1
- package/dist/cli/{content-mapper-5_KpJMOD.js → content-mapper-B6JGZZ-x.js} +2 -2
- package/dist/cli/{db-CVoN3aLl.js → db-XUHrXei6.js} +3 -3
- package/dist/cli/{doctor-BsB5Sg9v.js → doctor-Be-y8dsz.js} +113 -19
- package/dist/cli/{env-Bco8UGR3.js → env-49B92Izr.js} +1 -1
- package/dist/cli/env-BNeYZxBV.js +1 -0
- package/dist/cli/{gen-Dbtv-GLi.js → gen-CMppeGNK.js} +16 -16
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +8 -8
- package/dist/cli/{init-DbxcqUL_.js → init-qbw1o0Dd.js} +10 -10
- package/dist/cli/{keys-CRf_wOFs.js → keys-DPHVpbjn.js} +1 -1
- package/dist/cli/{live-B86Xvfaj.js → live-RZhHZRFj.js} +2 -2
- package/dist/cli/{mcp-BjvRPCNn.js → mcp-DudhybBp.js} +3 -3
- package/dist/cli/{metadata-BCKNATUX.js → metadata-O2AJ-PDA.js} +3 -3
- package/dist/cli/{migrate-Ds8H9Vq6.js → migrate-CiGCX8KP.js} +2 -2
- package/dist/cli/{migration-safety-CVtbyZQ4.js → migration-safety-Cn2z7UC-.js} +11 -2
- package/dist/cli/{migrations-Dob5hF6K.js → migrations-6KOIDi_b.js} +2 -2
- package/dist/cli/{module-migration-BSOn1xPx.js → module-migration-XPQbFJib.js} +2 -2
- package/dist/cli/{moved-btVl2MAQ.js → moved-DV_Edueb.js} +1 -1
- package/dist/cli/{parse-ThNFQ1hP.js → parse-CX-x-r5L.js} +1 -1
- package/dist/cli/powersync-BNWYxuB0.js +1 -0
- package/dist/cli/{powersync-aGKsgFN9.js → powersync-CFOmXWSv.js} +4 -4
- package/dist/cli/{print-scQOZbuq.js → print-BgO62egM.js} +2 -2
- package/dist/cli/{providers-Dr7FyvN1.js → providers-Ciss4nHV.js} +1 -1
- package/dist/cli/{prune-workflows-DguQsnDA.js → prune-workflows-eAi-3R9F.js} +4 -4
- package/dist/cli/{remove-BK_muhLi.js → remove-B-vjuw8U.js} +7 -7
- package/dist/cli/{render-D8KGIoSK.js → render-eYxq_mwL.js} +4 -4
- package/dist/cli/{run-1ZTOS-gb.js → run-CLLVkt9B.js} +2 -2
- package/dist/cli/{run-aWo2fn_x.js → run-Cn0Ay_l6.js} +51 -51
- package/dist/cli/{run-BIAan13C.js → run-VHRy6vLi.js} +9 -9
- package/dist/cli/seed-BqsY5MlO.js +1 -0
- package/dist/cli/{seed-C7eiVpBy.js → seed-DNaRUG_M.js} +4 -4
- package/dist/cli/{shared-d7o6xxEZ.js → shared-CL-Gg-tZ.js} +1 -1
- package/dist/cli/{skills-wZ94Fa8G.js → skills-Bfx3HM5e.js} +1 -1
- package/dist/cli/{snapshot-BmBrjk2b.js → snapshot-BDeHrbby.js} +3 -3
- package/dist/cli/{source-CEPki4I3.js → source-BPCSkEGq.js} +1 -1
- package/dist/cli/{source-args-Deg53QHe.js → source-args-DowOyFq5.js} +1 -1
- package/dist/cli/{spec-BKCoD-Ct.js → spec-BN7JlljA.js} +3 -3
- package/dist/cli/{spec-36lt_pPC.js → spec-CEiZkG-g.js} +1 -1
- package/dist/cli/{sql-layout-BevHhOrq.js → sql-layout-oPEsvcMQ.js} +2 -2
- package/dist/cli/{stack-Dr_oEfmw.js → stack-CwBH6-o8.js} +1 -1
- package/dist/cli/{sync-x1M-Ywqf.js → sync-CgpA7QSy.js} +4 -4
- package/dist/cli/{table-DJiZ_PJP.js → table-BEiSh604.js} +1 -1
- package/dist/cli/{upgrade-BUDxM1EG.js → upgrade-CWx1Pdz2.js} +5 -5
- package/dist/cli/{upgrade-Dqze3aEB.js → upgrade-DPDYkDat.js} +3 -3
- package/dist/cli/{version-CvNMxnwv.js → version-XN1WDU-l.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/{codecs-jdyv13IU.js → codecs-BSDJw_Fn.js} +2 -2
- package/dist/commerce/index.js +2 -2
- package/dist/{compose-DUitDAa_.js → compose-Be6lxp05.js} +1 -1
- package/dist/{composite-CQjoTPwv.js → composite-qffn948S.js} +1 -1
- package/dist/config/index.d.ts +5 -5
- package/dist/config/index.js +4 -4
- package/dist/{config-DYtSlwsi.js → config-DVRBLGIK.js} +3 -3
- package/dist/{config-gJ9FX0jc.js → config-DwPO3Dcs.js} +1 -1
- package/dist/{context-BlLvUNCj.d.ts → context-NgBzQFD8.d.ts} +40 -4
- package/dist/contract/index.d.ts +3 -3
- package/dist/{controller-DfgxFNFx.d.ts → controller-XiTA4O2z.d.ts} +1 -1
- package/dist/{conversion-BzVxeYqk.d.ts → conversion-BYSDK6_r.d.ts} +1 -1
- package/dist/create/index.d.ts +4 -4
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +2 -2
- package/dist/create/lite/index.js +3 -3
- package/dist/{create-blocks-DupJA8Lw.js → create-blocks-X59FRi6t.js} +2 -2
- package/dist/credentials/index.js +3 -3
- package/dist/{deal-forecast-CgzuxYtf.js → deal-forecast-DWwQ_ZL6.js} +2 -2
- package/dist/{define-block-DiW9g10_.d.ts → define-block-DLqYhrYF.d.ts} +3 -3
- package/dist/{delivery-events-DUiTctdo.js → delivery-events-BNBvla4y.js} +1 -1
- package/dist/{drive-CvgLTJA9.d.ts → drive-CnOz5P5H.d.ts} +2 -2
- package/dist/e-invoicing/index.js +1 -1
- package/dist/edge/index.js +3 -3
- package/dist/embeddings-CCPghrsU.js +249 -0
- package/dist/{embeddings-Dm-GSHAi.d.ts → embeddings-DoNwEveb.d.ts} +52 -4
- package/dist/{entitlements-5nbdIitJ.d.ts → entitlements-7iVfWIy8.d.ts} +1 -1
- package/dist/{entitlements-BxZpcgcb.js → entitlements-CE-fFbUR.js} +2 -2
- package/dist/{errors-DCJMVeY7.js → errors-B3EJToP_.js} +72 -19
- package/dist/eve/index.d.ts +4 -4
- package/dist/eve/index.js +2 -2
- package/dist/{eve-DRYPT58Y.d.ts → eve-UQ0RZX-K.d.ts} +2 -2
- package/dist/{executor-COn2O4fg.d.ts → executor-mRSXEFIB.d.ts} +1 -1
- package/dist/expo/index.js +2 -2
- package/dist/{extract-DpiLKlbp.d.ts → extract-4SajsgPj.d.ts} +2 -2
- package/dist/fhir/index.js +1 -1
- package/dist/{field-errors-BCX7RCEc.d.ts → field-errors-B6sHzfiG.d.ts} +5 -5
- package/dist/{flags-oS3Mbyfc.js → flags-CtmDvszx.js} +1 -1
- package/dist/flags-sdk/index.js +5 -3
- package/dist/{framework-D8eW-nTX.js → framework-CD0tHWLN.js} +1 -1
- package/dist/{gateway-DjJYyq6h.d.ts → gateway-BsE1qacd.d.ts} +2 -2
- package/dist/{history-6KiVNWdH.js → history-CoX8QoXr.js} +21 -6
- package/dist/hono/index.js +2 -2
- package/dist/{inbox-BnELyPRZ.d.ts → inbox-i3nEfNHG.d.ts} +21 -1
- package/dist/{index-B8Mjb-KA.d.ts → index---6uF_J0.d.ts} +1 -1
- package/dist/{index-CFT7e_HH.d.ts → index-7-mAsoAB.d.ts} +2 -2
- package/dist/{index-CakXRuAZ.d.ts → index-B2HOIiNe.d.ts} +2 -2
- package/dist/{index-DMlTXcWp.d.ts → index-B9sdIEmz.d.ts} +2 -2
- package/dist/{index-ZI4sMVPT.d.ts → index-BEyOO6xN.d.ts} +2 -2
- package/dist/{index-BB5n8R_s.d.ts → index-BHlGYVat.d.ts} +1 -1
- package/dist/{index-D48wVmDj.d.ts → index-BUGFN7Lu.d.ts} +1 -1
- package/dist/{index-DHwPGqLY.d.ts → index-BaI1DFjU.d.ts} +2 -2
- package/dist/{index-BMYIwvDA.d.ts → index-BjMlZ2la.d.ts} +1 -1
- package/dist/{index-DxmiTJJ5.d.ts → index-BpW3Kn-H.d.ts} +2 -2
- package/dist/{index-CurH6bgW.d.ts → index-C35Mxkfj.d.ts} +1 -1
- package/dist/{index-Bn5v6soX.d.ts → index-CA5xzl6j.d.ts} +1 -1
- package/dist/{index-D5LnplxJ.d.ts → index-CBTA4Hus.d.ts} +6 -6
- package/dist/{index-CdtD8fqI.d.ts → index-CFfFev2y.d.ts} +45 -5
- package/dist/{index-BolFrOMw.d.ts → index-CaUkbhw7.d.ts} +2 -2
- package/dist/{index-BGgGwWcn.d.ts → index-Cfft6iUs.d.ts} +1 -1
- package/dist/{index-BW0aDURc.d.ts → index-CsngKWje.d.ts} +1 -1
- package/dist/{index-BNBFiyOR.d.ts → index-D89tUktw.d.ts} +1 -1
- package/dist/{index-BK8zPigx.d.ts → index-DDIZwUK-.d.ts} +1 -1
- package/dist/{index-BZ1Akcrg.d.ts → index-D_JS5FYo.d.ts} +1 -1
- package/dist/{index-BLL45v55.d.ts → index-Dh-CE1YF.d.ts} +1 -1
- package/dist/{index-DkWXofPH.d.ts → index-Dk039ZLg.d.ts} +1 -1
- package/dist/{index-DZTavebO.d.ts → index-Do2iK7pF.d.ts} +1 -1
- package/dist/{index-IKK8zWTN.d.ts → index-DpQ1JuKa.d.ts} +2 -2
- package/dist/{index-S6axmDQL.d.ts → index-Drjrj8Y5.d.ts} +2 -2
- package/dist/{index-7UV0pNYj.d.ts → index-Dvu6MySL.d.ts} +2 -2
- package/dist/{index-B2C1NczA.d.ts → index-LnDm58TV.d.ts} +4 -4
- package/dist/{index-D25Ry5R9.d.ts → index-P5Xhtrzo.d.ts} +1 -1
- package/dist/{index-CRSNN2v9.d.ts → index-PV91A2_J.d.ts} +8 -8
- package/dist/{index-B1NcZsVD.d.ts → index-VaTlShTa.d.ts} +7 -7
- package/dist/{index-iaMOudmP.d.ts → index-aNW_fYBI.d.ts} +1 -1
- package/dist/{index-Bdg6ee4m.d.ts → index-b5FUPI-5.d.ts} +1 -1
- package/dist/{index-1001GtVL.d.ts → index-hkFhFgRv.d.ts} +1 -1
- package/dist/{index-kidoYhB8.d.ts → index-jaxdP0Qe.d.ts} +1 -1
- package/dist/index-nFxtUFQv.d.ts +11 -0
- package/dist/{index-Bopuqb8z.d.ts → index-oR-iOHLT.d.ts} +4 -4
- package/dist/{index-DplKvjCs.d.ts → index-qPP3ja-K.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{instances-ukDFg8oN.js → instances-CAzvtvlH.js} +119 -8
- package/dist/json-render/index.d.ts +91 -0
- package/dist/json-render/index.js +233 -0
- package/dist/{knowledge-DL1ZnEe7.d.ts → knowledge-CjrMiSnp.d.ts} +59 -9
- package/dist/{knowledge-CQl9LXaZ.js → knowledge-m3IJobAw.js} +22 -10
- package/dist/{manifest-DKY9HGin.js → manifest-12CvUHma.js} +3 -3
- package/dist/{manifest-DI_Vz152.d.ts → manifest-1CNHDf-P.d.ts} +2 -2
- package/dist/{manifest-D8JpSvuE.js → manifest-1X1rpQ-5.js} +3 -3
- package/dist/{manifest-BSQh5dw2.js → manifest-1qVuPpg1.js} +2 -2
- package/dist/{manifest-Cxz4_mWy.d.ts → manifest-279mgqK2.d.ts} +1 -1
- package/dist/{manifest-Cu_4X5Rm.js → manifest-3mRZEFbA.js} +2 -2
- package/dist/{manifest-ppItbSA5.d.ts → manifest-4-J2cBhl.d.ts} +1 -1
- package/dist/{manifest-BhBqFYV4.d.ts → manifest-4Ei8W6XJ.d.ts} +1 -1
- package/dist/{manifest-BEZ8HltH.js → manifest-638tYNw7.js} +2 -2
- package/dist/{manifest-BXNDl7bx.js → manifest-AFBjJxrJ.js} +2 -2
- package/dist/{manifest-B_3_99xa.js → manifest-AI6u-id7.js} +3 -3
- package/dist/{manifest-C95-cClh.js → manifest-B1Xj7ObD.js} +1 -1
- package/dist/{manifest-_qzN4kUG.js → manifest-B2G5B8ty.js} +2 -2
- package/dist/{manifest-CPYEEX6u.js → manifest-B3Fs0ZeU.js} +8 -3
- package/dist/{manifest-DJRHzb6v.js → manifest-B5c8gqof.js} +2 -2
- package/dist/{manifest-Dagm1cVO.d.ts → manifest-BAEYvNSN.d.ts} +1 -1
- package/dist/{manifest-CJByGKJ_.d.ts → manifest-BBCFaNss.d.ts} +1 -1
- package/dist/{manifest-CRXxYu5L.js → manifest-BEyhZ8sV.js} +3 -3
- package/dist/{manifest-ycsWja2O.d.ts → manifest-BFXftMd7.d.ts} +1 -1
- package/dist/{manifest--eIzr9Tj.js → manifest-BFbZ2mZA.js} +2 -2
- package/dist/{manifest-C0f5YJ7x.d.ts → manifest-BFi8-A1w.d.ts} +1 -1
- package/dist/{manifest-DeCjklgV.js → manifest-BHaR8iYx.js} +2 -2
- package/dist/{manifest-BKD8DbQT.js → manifest-BI65KPyR.js} +4 -4
- package/dist/{manifest-DHYr9yD1.js → manifest-BIOzNAsT.js} +2 -2
- package/dist/{manifest-CKxnGCVY.d.ts → manifest-BJ7XyLlV.d.ts} +1 -1
- package/dist/{manifest-DM2T_dN2.js → manifest-BKvawy3P.js} +3 -3
- package/dist/{manifest-C-_0WkGx.d.ts → manifest-BNR_72jF.d.ts} +4 -3
- package/dist/{manifest-BcdRITPc.d.ts → manifest-BOQOTepZ.d.ts} +1 -1
- package/dist/{manifest-DqwQmPZb.js → manifest-BP7YQERu.js} +3 -3
- package/dist/{manifest-C_hIU5kk.js → manifest-BPeoWfAO.js} +3 -3
- package/dist/{manifest-DHt1h5GN.js → manifest-BPpt2s0a.js} +3 -3
- package/dist/{manifest-6MuVEQnP.js → manifest-BQobHp4x.js} +5 -5
- package/dist/{manifest-BgMjraZw.js → manifest-BRgWZzVn.js} +3 -3
- package/dist/{manifest-CCXaDWdN.d.ts → manifest-BS1QA4mT.d.ts} +1 -1
- package/dist/{manifest-JvgqqKRq.js → manifest-BW6RRJXm.js} +2 -2
- package/dist/{manifest-K_42e50M.d.ts → manifest-BWIcNHVs.d.ts} +1 -1
- package/dist/{manifest-Hx3FBHKX.js → manifest-BXIL-A7I.js} +1 -1
- package/dist/{manifest-C3VB7-hM.d.ts → manifest-BaQ-A5Jy.d.ts} +2 -2
- package/dist/{manifest-D3HTgmR3.d.ts → manifest-BaR4cYwY.d.ts} +1 -1
- package/dist/{manifest-DjVqN_iK.d.ts → manifest-Bc1-GptG.d.ts} +1 -1
- package/dist/{manifest-C8Boo7Ps.js → manifest-Bea2AWYl.js} +4 -4
- package/dist/{manifest-1Xiu6zqs.js → manifest-BgKbxGVp.js} +2 -2
- package/dist/{manifest-Dbq6t-bI.d.ts → manifest-BhhX6xjo.d.ts} +1 -1
- package/dist/{manifest-Dm_5DTyx.js → manifest-BhpXYw_3.js} +2 -2
- package/dist/{manifest-BHNrIQ8X.d.ts → manifest-BieAORBI.d.ts} +1 -1
- package/dist/{manifest-D2qeEjrC.d.ts → manifest-Bk69YFI3.d.ts} +1 -1
- package/dist/{manifest-gCNbUW-X.js → manifest-BnJ_9tgk.js} +2 -2
- package/dist/{manifest-1lzhOO0z.d.ts → manifest-BqCQrbSP.d.ts} +2 -2
- package/dist/{manifest-DnZw4JWP.js → manifest-Brv_Pss2.js} +2 -2
- package/dist/{manifest-D7y9_k5i.d.ts → manifest-BuEIqayB.d.ts} +1 -1
- package/dist/{manifest-OS0pwPRn.d.ts → manifest-BxRL6XuJ.d.ts} +1 -1
- package/dist/{manifest-qb_YXiWK.js → manifest-BydKYd32.js} +2 -2
- package/dist/{manifest-FkY_rpfH.js → manifest-C-ROCYHF.js} +5 -5
- package/dist/{manifest-BfAXsd-X.d.ts → manifest-C1JGYvR-.d.ts} +1 -1
- package/dist/{manifest-gGOpzRmJ.d.ts → manifest-C3d7DJiE.d.ts} +1 -1
- package/dist/{manifest-D84UV5p6.js → manifest-C5NzuW_p.js} +2 -2
- package/dist/{manifest-A_VPz6fq.js → manifest-C75gu7oi.js} +2 -2
- package/dist/{manifest-BdmDmQtx.js → manifest-CBj4zlpo.js} +4 -4
- package/dist/{manifest-BKDSuS3x.d.ts → manifest-CFb---rO.d.ts} +2 -2
- package/dist/{manifest-BHhBqtFw.js → manifest-CFq6WJJO.js} +4 -4
- package/dist/{manifest-Bbtt8mb1.d.ts → manifest-CGJ2xLRu.d.ts} +1 -1
- package/dist/{manifest-DpwaOTir.js → manifest-CHheBZjl.js} +3 -3
- package/dist/{manifest-B83YpMlz.d.ts → manifest-CJzK3H3h.d.ts} +1 -1
- package/dist/{manifest-ClbUuESE.js → manifest-CKT1bZoZ.js} +2 -2
- package/dist/{manifest-Cj5IjsCB.js → manifest-CLFmOMSQ.js} +2 -2
- package/dist/{manifest-B9KmOzmT.d.ts → manifest-CMmfdgAG.d.ts} +1 -1
- package/dist/{manifest-Bx_0qkBP.js → manifest-COnvr04R.js} +2 -2
- package/dist/{manifest-mu_UflgB.d.ts → manifest-CR_RHsHu.d.ts} +1 -1
- package/dist/{manifest-BTC6dWdq.d.ts → manifest-CSLqw5qE.d.ts} +1 -1
- package/dist/{manifest-BDGVge5o.js → manifest-CWkdEugm.js} +2 -2
- package/dist/{manifest-DS2PjAgW.js → manifest-CXTVwg4s.js} +3 -3
- package/dist/{manifest-CX8DVTzn.js → manifest-CY-bInzt.js} +3 -3
- package/dist/{manifest-BZP0wKpE.js → manifest-CaZnTLGe.js} +3 -3
- package/dist/{manifest-B4CVN-Kx.js → manifest-CbdezcLS.js} +2 -2
- package/dist/{manifest-B3QwQDTx.js → manifest-Ccjdt-zG.js} +3 -3
- package/dist/{manifest-BW7wdKXA.js → manifest-CdDdPHbV.js} +4 -4
- package/dist/{manifest-cqfeLW8g.js → manifest-CeN-ohYP.js} +2 -2
- package/dist/{manifest-B7MpuCmz.d.ts → manifest-Cge4urPD.d.ts} +1 -1
- package/dist/{manifest-DsYIWD--.js → manifest-CiAp3lJg.js} +2 -2
- package/dist/{manifest-BFJvys4-.js → manifest-CmtXDmOP.js} +3 -3
- package/dist/{manifest-CJb0PtMj.d.ts → manifest-Cq3zIydP.d.ts} +1 -1
- package/dist/{manifest-DLv_WaSF.d.ts → manifest-Cs5-Vi9X.d.ts} +1 -1
- package/dist/{manifest-DwVl4YC4.d.ts → manifest-CsVTMa-G.d.ts} +1 -1
- package/dist/{manifest-DBsPHetA.js → manifest-Ct3CZB2E.js} +2 -2
- package/dist/{manifest--M7GmEPg.d.ts → manifest-CyKD7Hyx.d.ts} +1 -1
- package/dist/{manifest-DNaSpmZ3.js → manifest-Cytb-iJk.js} +2 -2
- package/dist/{manifest-Cj_ZnW6k.js → manifest-D-sJpAJB.js} +3 -3
- package/dist/{manifest-Bpzxyvxc.js → manifest-D0ceE9Zm.js} +3 -3
- package/dist/{manifest-CIJTIKo3.d.ts → manifest-D1FhVaUw.d.ts} +1 -1
- package/dist/{manifest-CLphqjtj.d.ts → manifest-D2URJ82u.d.ts} +1 -1
- package/dist/{manifest-Czv_oJ77.js → manifest-D2r45JYc.js} +2 -2
- package/dist/{manifest-DBJ5nBG9.d.ts → manifest-D3V8Ngw3.d.ts} +1 -1
- package/dist/{manifest-B709eXLx.js → manifest-D5UYH-l1.js} +2 -2
- package/dist/{manifest-DVnOUxy4.js → manifest-D5gmrL5j.js} +6 -6
- package/dist/{manifest-BQwqV6dQ.js → manifest-D6k-MFrE.js} +4 -4
- package/dist/{manifest-BoSzgLUl.js → manifest-D72opuEP.js} +3 -3
- package/dist/{manifest-DJ5nCW5K.js → manifest-D8ljY6Fz.js} +4 -4
- package/dist/{manifest-DemyeI_z.js → manifest-D96KwsqD.js} +4 -4
- package/dist/{manifest-Bz3xNPJL.d.ts → manifest-D9B8QIWz.d.ts} +1 -1
- package/dist/{manifest-BkS073Py.d.ts → manifest-DA0Q62es.d.ts} +1 -1
- package/dist/{manifest-CYNC6a1d.js → manifest-DAu2qpOy.js} +2 -2
- package/dist/{manifest-0vrTq9Uf.d.ts → manifest-DB6dSXpw.d.ts} +1 -1
- package/dist/{manifest-Db-GUsLH.d.ts → manifest-DKY1mHtE.d.ts} +1 -1
- package/dist/{manifest-CQFlAwfU.d.ts → manifest-DOIRQHB8.d.ts} +2 -2
- package/dist/{manifest-0PDfKdtc.js → manifest-DR8po1OZ.js} +4 -4
- package/dist/{manifest-ITF-BpEi.js → manifest-D_RCNlv9.js} +4 -4
- package/dist/{manifest-CR-6QDLZ.d.ts → manifest-D_gWI_Xp.d.ts} +1 -1
- package/dist/{manifest-BR_uGpTd.js → manifest-DaZ7LEOi.js} +2 -2
- package/dist/{manifest-Dz2IkqqY.d.ts → manifest-DfaKFvmO.d.ts} +1 -1
- package/dist/{manifest-DPFn2x18.d.ts → manifest-Dg4rFnjr.d.ts} +1 -1
- package/dist/{manifest-n9XQtQXA.d.ts → manifest-DhYiWMYQ.d.ts} +1 -1
- package/dist/{manifest-BfOHwSNK.js → manifest-DjIq3ZJf.js} +7 -7
- package/dist/{manifest-D7yeYU0f.d.ts → manifest-DnSrbZuv.d.ts} +1 -1
- package/dist/{manifest-D7slgR5H.d.ts → manifest-Do4TvdNR.d.ts} +1 -1
- package/dist/{manifest-DdFl3BYM.d.ts → manifest-Do7f1k9C.d.ts} +1 -1
- package/dist/{manifest--qnXa2lK.js → manifest-Dr-wuvfR.js} +4 -4
- package/dist/{manifest-yPcrAK5N.d.ts → manifest-Dr5yltSj.d.ts} +10 -3
- package/dist/{manifest-CbxMRPGY.js → manifest-DunhKI5K.js} +4 -4
- package/dist/{manifest-C3RDEoAr.d.ts → manifest-Duq5aCrY.d.ts} +1 -1
- package/dist/{manifest-J6kJX8YL.js → manifest-DuwJ7Ya_.js} +3 -3
- package/dist/{manifest-FJi1pYoB.js → manifest-Dxob7J6V.js} +6 -6
- package/dist/{manifest-Dj9AIgTy.d.ts → manifest-DzNmDhoS.d.ts} +1 -1
- package/dist/{manifest-CHsjS47_.d.ts → manifest-FqJtbN5n.d.ts} +1 -1
- package/dist/{manifest-roKO06Ko.d.ts → manifest-I7nR1vhO.d.ts} +1 -1
- package/dist/{manifest-o-EzlFwZ.js → manifest-N-vJi36T.js} +2 -2
- package/dist/{manifest-FAVN8Bg9.js → manifest-UHMLAfCl.js} +2 -2
- package/dist/{manifest-BKegpJgn.d.ts → manifest-VoN5Ae-i.d.ts} +1 -1
- package/dist/{manifest-DDkncgRB.d.ts → manifest-XRDA_p9P.d.ts} +1 -1
- package/dist/{manifest-Di0UrbTw.d.ts → manifest-ZQvywRBI.d.ts} +1 -1
- package/dist/{manifest-COZUTRxz.js → manifest-aWO0h4lZ.js} +3 -3
- package/dist/{manifest-D7R4sM8L.d.ts → manifest-hpPeciuH.d.ts} +1 -1
- package/dist/{manifest-CkYNs6PX.js → manifest-iNt_0t6h.js} +4 -4
- package/dist/{manifest-BAgqRR7p.js → manifest-j5YiEWqV.js} +2 -2
- package/dist/{manifest-D_iJU__f.d.ts → manifest-jRpt7muB.d.ts} +1 -1
- package/dist/{manifest-xD290bNh.js → manifest-jU8fwfLu.js} +3 -3
- package/dist/{manifest-DCC3phPq.js → manifest-nR_d-Ivi.js} +1 -1
- package/dist/{manifest-BRd1q660.d.ts → manifest-nyksTa_6.d.ts} +1 -1
- package/dist/{manifest-CWaCXYgf.js → manifest-p4Yvamix.js} +2 -2
- package/dist/{manifest-BQJV63RV.js → manifest-pKQ4z-dv.js} +1 -1
- package/dist/{manifest-DbjDYuCE.js → manifest-q62slcP6.js} +2 -2
- package/dist/{manifest-UbBXSkXn.d.ts → manifest-uDAAzAlQ.d.ts} +1 -1
- package/dist/{manifest-CtOwRTvP.js → manifest-upxzRaY-.js} +2 -2
- package/dist/{manifest-DW2_P6AT.js → manifest-vaCUz3Wa.js} +3 -3
- package/dist/{manifest-Dqgqm1Zo.js → manifest-vabt4x2a.js} +3 -3
- package/dist/{manifest-Cfvr-BhF.js → manifest-wSbIcOln.js} +19 -7
- package/dist/mapper/bin.js +7 -7
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/{mcp-Bx9wzQw6.js → mcp-D1d_uDNE.js} +2 -2
- package/dist/{message-Cc4bkdNw.d.ts → message-Chvocrom.d.ts} +27 -4
- package/dist/{model-messages-OmbNNuN2.js → model-messages-BgSCTojd.js} +1 -1
- package/dist/{model-messages-CGSUU450.d.ts → model-messages-CK7L1_hV.d.ts} +1 -1
- package/dist/{money-codec-CvUy3_Ep.js → money-codec-lrXaOqi7.js} +1 -1
- package/dist/next/index.d.ts +7 -7
- package/dist/next/index.js +5 -5
- package/dist/{operations-Di203azT.d.ts → operations-BSsNQ81h.d.ts} +1 -1
- package/dist/{options-CyYZvdSy.js → options-BNtLQZrG.js} +2 -1
- package/dist/{options-SOjQVgfS.js → options-BYlcrVVf.js} +1 -0
- package/dist/options-BxOFSs-u.js +4 -0
- package/dist/orpc/index.d.ts +1 -1
- package/dist/orpc/index.js +1 -1
- package/dist/otel/index.d.ts +1 -1
- package/dist/otel/index.js +5 -5
- package/dist/{parse-H3g3kyZa.js → parse-Iz0DTVot.js} +2 -2
- package/dist/{payments-D89SVEgj.js → payments-DjrRAHBY.js} +1 -1
- package/dist/{permissions-C7GgjgTA.d.ts → permissions-CrPkD5Ik.d.ts} +1 -1
- package/dist/{ports-6EMtxwGE.d.ts → ports-Z6S_jGD7.d.ts} +1 -1
- package/dist/powersync/index.d.ts +3 -3
- package/dist/preset/index.d.ts +4 -4
- package/dist/preset/index.js +3 -3
- package/dist/{preset-Be8m6-PH.js → preset-D2dg-EVp.js} +3 -2
- package/dist/{preview-DCndUjk9.js → preview-B7OjoABd.js} +3 -3
- package/dist/{preview-Dlc_7tMK.d.ts → preview-Bgwwuvc9.d.ts} +2 -2
- package/dist/{project-C71Z2pg2.js → project-Dhm0C7OR.js} +5 -5
- package/dist/{provider-DRGTjcBY.js → provider-Bkh8zSHN.js} +1 -1
- package/dist/{push-token-CQnqTZrb.d.ts → push-token-hDDp188w.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/rate-limit/index.d.ts +1 -1
- package/dist/rate-limit/index.js +1 -1
- package/dist/{rate-limit-Bl_jNyAg.d.ts → rate-limit-A_ngDsV_.d.ts} +17 -0
- package/dist/{rate-limit-Df913_w3.js → rate-limit-Jl-5e7s8.js} +30 -10
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/{react-CsgcTKRk.js → react-DIfKgdfV.js} +2 -2
- package/dist/{react-CqOVutZj.js → react-DnOu9xsi.js} +3 -3
- package/dist/react-router/index.js +2 -2
- package/dist/realtime/index.d.ts +3 -3
- package/dist/realtime/index.js +2 -2
- package/dist/{record-form-DqGcUu0C.d.ts → record-form-Bye6v7Sg.d.ts} +1 -1
- package/dist/{recordings-CiYHdFPa.d.ts → recordings-16Flkx9W.d.ts} +1 -1
- package/dist/records/index.d.ts +7 -7
- package/dist/{route-optimizer-DqUyDP78.js → route-optimizer-Ds11cQyM.js} +1 -1
- package/dist/{rows-Ccg381fF.js → rows-DidUYmOx.js} +1 -1
- package/dist/{rows-CTzeKlaI.js → rows-kSV-CDYA.js} +2 -2
- package/dist/runs-CEm5AFQk.js +91 -0
- package/dist/{sales-C8o3E5U3.js → sales-DNuk5v36.js} +7 -7
- package/dist/{sales-lines-COFwijz1.js → sales-lines-mwRnIC9p.js} +3 -3
- package/dist/{sales-shared-DGSptcqA.js → sales-shared-Ca2ZDF6a.js} +1 -1
- package/dist/{sales-variants-D0oxdF-6.js → sales-variants-QTgChYXJ.js} +1 -1
- package/dist/{scores-CQt_G6T-.js → scores-Opsegupn.js} +2 -2
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +4 -4
- package/dist/{settings-B4NApcY7.js → settings-Bf5nmbl-.js} +2 -2
- package/dist/{sign-in-Dd5ljzNG.js → sign-in-BYJboUBW.js} +1 -1
- package/dist/{signing-keys-B2bpJ3eJ.js → signing-keys-sYy92dAx.js} +2 -2
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +2 -2
- package/dist/{spec-pins-D2Q41RiK.d.ts → spec-pins-Bb6V8nR2.d.ts} +1 -1
- package/dist/{spec-pins-BtVFN8wA.js → spec-pins-Dlz8OVqi.js} +1 -1
- package/dist/sql/index.d.ts +6 -6
- package/dist/sql/index.js +3 -3
- package/dist/{sql-DPDvUadH.js → sql-DrlapNYO.js} +3009 -729
- package/dist/{sso-gMj8CIpe.js → sso-RsAYRs9q.js} +2 -2
- package/dist/ssr/index.d.ts +1 -1
- package/dist/{store-DHoKrWYZ.d.ts → store-CGXNwUwi.d.ts} +6 -1
- package/dist/streams/index.d.ts +59 -2
- package/dist/streams/index.js +111 -22
- package/dist/streams/redis/index.d.ts +8 -1
- package/dist/streams/redis/index.js +12 -4
- package/dist/streams/resumable/index.d.ts +68 -0
- package/dist/streams/resumable/index.js +71 -0
- package/dist/{subject-readers-B5YcD7CO.js → subject-readers-DhXR7Tdk.js} +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tax-D_M90sFh.js → tax-Deg3udmG.js} +1 -1
- package/dist/{tee-eneLXtYJ.js → tee-CHLXLuvg.js} +2 -1
- package/dist/{tenant-DHLx2ZkL.d.ts → tenant-DYOUVE8r.d.ts} +1 -1
- package/dist/testing/index.d.ts +13 -12
- package/dist/testing/index.js +60 -15
- package/dist/{timeline-9mP3m30L.d.ts → timeline-DTE4-6Hq.d.ts} +2 -2
- package/dist/{topic-DVr01uhB.js → topic-CLEQ3t6o.js} +25 -2
- package/dist/{topic-BKsRT4gu.d.ts → topic-DrN4Af8U.d.ts} +16 -1
- package/dist/{transport-CS4cVH4S.js → transport-CZBRg-9e.js} +7 -3
- package/dist/{types-Y1Oa950J.d.ts → types-BKtpHTHc.d.ts} +8 -0
- package/dist/{types-B2y4HmKY.d.ts → types-C941lZYk.d.ts} +1 -1
- package/dist/{types-Dp1r6bih.d.ts → types-DTNDqdyT.d.ts} +2 -2
- package/dist/{types-zYtQ5JDy.d.ts → types-D_o60OcA.d.ts} +1 -1
- package/dist/{types-DlG6Uj4P.d.ts → types-DeKSApwU.d.ts} +2 -2
- package/dist/{undo-DNRfstwk.js → undo-BXeYO6gy.js} +2 -2
- package/dist/{usage-CFVOHbUu.d.ts → usage-D7CYIk1m.d.ts} +22 -0
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-M1yL9NiW.d.ts → watch-topic-ClQWiVZ1.d.ts} +1 -1
- package/dist/{webhook-inbox-BamK2_Vw.js → webhook-inbox-B36XJ2eY.js} +25 -2
- package/dist/webmcp/index.d.ts +1 -1
- package/dist/webmcp/index.js +1 -1
- package/dist/workflow-sdk/builder/index.d.ts +3 -3
- package/dist/workflow-sdk/builder/index.js +1 -1
- package/dist/workflow-sdk/index.d.ts +7 -3
- package/dist/workflow-sdk/index.js +16 -74
- package/dist/workflow-sdk/world/index.d.ts +48 -3
- package/dist/workflow-sdk/world/index.js +326 -31
- package/dist/{workflow-sdk-BCNusk7Y.d.ts → workflow-sdk-Bdp_VQ3Q.d.ts} +37 -3
- package/dist/{workflow-sdk-cHlpMyLV.js → workflow-sdk-ID8eoPMe.js} +108 -7
- package/dist/{workflow-sdk-CcoFSLFn.js → workflow-sdk-j7xorOLf.js} +230 -60
- package/dist/{workflows-DjVrHu22.d.ts → workflows-C6fR7YGm.d.ts} +56 -15
- package/dist/yjs/index.d.ts +1 -1
- package/dist/yjs/index.js +1 -1
- package/package.json +41 -11
- package/schemas/ai-message-v2.json +290 -0
- package/schemas/config-v1.json +29 -1
- package/schemas/design-v1.json +45 -0
- package/schemas/doctor-report-v1.json +4 -0
- package/skills/better-supabase/references/ui-recipes.md +77 -0
- package/skills/better-supabase-api/SKILL.md +2 -2
- package/skills/better-supabase-api/references/ai.md +56 -0
- package/skills/better-supabase-api/references/streams-credentials.md +5 -0
- package/dist/cli/add-C8CZuuRW.js +0 -1
- package/dist/cli/env-C9HRYvnX.js +0 -1
- package/dist/cli/powersync-6wkF5mUR.js +0 -1
- package/dist/cli/seed-Ki7TgmY1.js +0 -1
- package/dist/embeddings-bZWDJ5yx.js +0 -129
|
@@ -1,15 +1,85 @@
|
|
|
1
|
+
import { t as DbException } from "../../db-exception-Dv18UZ-I.js";
|
|
1
2
|
import { n as dbError } from "../../errors-CXPerGIl.js";
|
|
2
3
|
import { n as isRecord } from "../../guards-CsRa6v57.js";
|
|
3
4
|
import { o as problemResponse } from "../../problem-gZxWhEP2.js";
|
|
4
|
-
import { _ as usageOf, c as toUIMessage, h as runRelease, r as AI_SDK_UI_FORMAT } from "../../errors-
|
|
5
|
-
import { t as fromModelMessages } from "../../model-messages-
|
|
6
|
-
import { n as teeToStore, t as resumeFromStore } from "../../tee-
|
|
7
|
-
import { a as readJson, i as badRequest, o as sse, r as tenantOf } from "../../assistant-
|
|
5
|
+
import { _ as usageOf, c as toUIMessage, h as runRelease, r as AI_SDK_UI_FORMAT } from "../../errors-B3EJToP_.js";
|
|
6
|
+
import { t as fromModelMessages } from "../../model-messages-BgSCTojd.js";
|
|
7
|
+
import { n as teeToStore, t as resumeFromStore } from "../../tee-CHLXLuvg.js";
|
|
8
|
+
import { a as readJson, i as badRequest, o as sse, r as tenantOf } from "../../assistant-BBN9KJPi.js";
|
|
9
|
+
import { n as agentRuntimeParts } from "../../agents-lkuM-m6i.js";
|
|
8
10
|
import { t as WORKFLOW_ATTRIBUTES } from "../../attributes-BZNkR2z2.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
+
import { t as STREAM_TAIL_INDEX_HEADER } from "../../runs-CEm5AFQk.js";
|
|
12
|
+
import { JsonToSseTransformStream, isStepCount } from "ai";
|
|
13
|
+
import { WorkflowAgent, createModelCallToUIChunkTransform, normalizeUIMessageStreamParts } from "@ai-sdk/workflow";
|
|
11
14
|
import { getRun, resumeHook, start } from "workflow/api";
|
|
12
15
|
import { HookNotFoundError } from "workflow/errors";
|
|
16
|
+
import { FatalError, RetryableError } from "workflow";
|
|
17
|
+
// src/ai-sdk/workflow/agent.ts
|
|
18
|
+
/**
|
|
19
|
+
* `WorkflowAgent` has no `toolApproval` setting, so the policy runs inside each
|
|
20
|
+
* tool: `needsApproval` asks the user for the `ask` tools and for any call the
|
|
21
|
+
* app's check turns into `user-approval`, and a denied call throws.
|
|
22
|
+
*/
|
|
23
|
+
function approvalCheck(parts) {
|
|
24
|
+
const { toolApproval } = parts;
|
|
25
|
+
if (typeof toolApproval !== "function") return;
|
|
26
|
+
return async (name, input) => {
|
|
27
|
+
const status = await toolApproval({ toolCall: {
|
|
28
|
+
toolName: name,
|
|
29
|
+
input
|
|
30
|
+
} });
|
|
31
|
+
const type = typeof status === "string" ? status : status?.type;
|
|
32
|
+
if (type === "denied") {
|
|
33
|
+
const reason = typeof status === "object" && status.type === "denied" ? status.reason : void 0;
|
|
34
|
+
throw new Error(reason ?? "The tool call was denied");
|
|
35
|
+
}
|
|
36
|
+
return type === "user-approval" ? "user-approval" : "not-applicable";
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** The agent's tools with its approval policy as each tool's `needsApproval`. */
|
|
40
|
+
function guardedTools(parts) {
|
|
41
|
+
const check = approvalCheck(parts);
|
|
42
|
+
const tools = {};
|
|
43
|
+
for (const [name, tool] of Object.entries(parts.tools)) {
|
|
44
|
+
const asked = parts.ask[name] !== void 0;
|
|
45
|
+
tools[name] = {
|
|
46
|
+
...tool,
|
|
47
|
+
needsApproval: check === void 0 ? asked : async (input) => await check(name, input) === "user-approval"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return tools;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A `WorkflowAgent` from an agent row, with the same tools, instructions,
|
|
54
|
+
* runtime context, gateway attribution and model check as `createAgentRuntime`.
|
|
55
|
+
* The tenant's `ask` tools and high-risk operations wait for the user, and
|
|
56
|
+
* `toolApprovalSecret` signs the requests.
|
|
57
|
+
*/
|
|
58
|
+
function createWorkflowAgentRuntime(options) {
|
|
59
|
+
const { toolApprovalSecret, ...shared } = options;
|
|
60
|
+
const { agent } = shared;
|
|
61
|
+
const parts = agentRuntimeParts({
|
|
62
|
+
...shared,
|
|
63
|
+
agent
|
|
64
|
+
});
|
|
65
|
+
return new WorkflowAgent({
|
|
66
|
+
id: agent.id,
|
|
67
|
+
model: options.model(agent.model),
|
|
68
|
+
tools: guardedTools(parts),
|
|
69
|
+
...parts.instructions === "" ? {} : { instructions: parts.instructions },
|
|
70
|
+
stopWhen: options.stopWhen ?? isStepCount(20),
|
|
71
|
+
runtimeContext: parts.run,
|
|
72
|
+
...toolApprovalSecret === void 0 ? {} : { experimental_toolApprovalSecret: toolApprovalSecret },
|
|
73
|
+
prepareCall: (call) => {
|
|
74
|
+
const providerOptions = parts.withGateway(call.providerOptions);
|
|
75
|
+
return providerOptions === void 0 ? {} : { providerOptions };
|
|
76
|
+
},
|
|
77
|
+
prepareStep: async ({ model }) => {
|
|
78
|
+
await parts.checkModel(model);
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
13
83
|
// src/ai-sdk/workflow/turn.ts
|
|
14
84
|
/** The token of the hook that stops a durable turn. */
|
|
15
85
|
function durableStopToken(workflowRunId) {
|
|
@@ -69,6 +139,7 @@ async function durableTurn(input, deps) {
|
|
|
69
139
|
const historyLength = input.messages.length;
|
|
70
140
|
const approvals = /* @__PURE__ */ new Map();
|
|
71
141
|
const sources = [];
|
|
142
|
+
const streamIds = [input.streamId];
|
|
72
143
|
let conversation = input.messages;
|
|
73
144
|
let segment = {
|
|
74
145
|
streamId: input.streamId,
|
|
@@ -85,6 +156,9 @@ async function durableTurn(input, deps) {
|
|
|
85
156
|
try {
|
|
86
157
|
const result = await deps.agent({
|
|
87
158
|
chatId: input.chatId,
|
|
159
|
+
userId: input.userId,
|
|
160
|
+
...input.organizationId === void 0 ? {} : { organizationId: input.organizationId },
|
|
161
|
+
...input.context === void 0 ? {} : { context: input.context },
|
|
88
162
|
runId: segment.runId,
|
|
89
163
|
messages: conversation,
|
|
90
164
|
writable: deps.getWritable({ namespace: segment.streamId }),
|
|
@@ -92,6 +166,10 @@ async function durableTurn(input, deps) {
|
|
|
92
166
|
model: input.model,
|
|
93
167
|
providerOptions: input.providerOptions
|
|
94
168
|
});
|
|
169
|
+
if ("error" in result && result.error !== void 0) {
|
|
170
|
+
status = "failed";
|
|
171
|
+
error = messageOf(result.error);
|
|
172
|
+
}
|
|
95
173
|
conversation = result.messages;
|
|
96
174
|
sources.push(...sourcesOf(result));
|
|
97
175
|
requests = newRequests(conversation.slice(historyLength), approvals);
|
|
@@ -119,7 +197,11 @@ async function durableTurn(input, deps) {
|
|
|
119
197
|
parentId: input.parentId,
|
|
120
198
|
model: input.model,
|
|
121
199
|
runId: segment.runId,
|
|
122
|
-
status: status === "completed" ? "complete" : status === "cancelled" ? "aborted" : "error"
|
|
200
|
+
status: status === "completed" ? "complete" : status === "cancelled" ? "aborted" : "error",
|
|
201
|
+
streams: {
|
|
202
|
+
workflowRunId: deps.runId,
|
|
203
|
+
streamIds: [...streamIds]
|
|
204
|
+
}
|
|
123
205
|
});
|
|
124
206
|
if (requests.length > 0) await deps.step("approvals", {
|
|
125
207
|
chatId: input.chatId,
|
|
@@ -193,6 +275,7 @@ async function durableTurn(input, deps) {
|
|
|
193
275
|
}))
|
|
194
276
|
}];
|
|
195
277
|
segment = next;
|
|
278
|
+
streamIds.push(next.streamId);
|
|
196
279
|
}
|
|
197
280
|
}
|
|
198
281
|
// src/ai-sdk/workflow/server.ts
|
|
@@ -237,7 +320,7 @@ function streamOf(iterable) {
|
|
|
237
320
|
}
|
|
238
321
|
});
|
|
239
322
|
}
|
|
240
|
-
async function* chunksOf(stream, signal) {
|
|
323
|
+
async function* chunksOf$1(stream, signal) {
|
|
241
324
|
const reader = stream.getReader();
|
|
242
325
|
const cancel = () => {
|
|
243
326
|
reader.cancel(signal?.reason).catch(() => void 0);
|
|
@@ -263,7 +346,7 @@ function segmentChunks(workflowRunId, streamId, messageId, uiStartIndex, signal)
|
|
|
263
346
|
messageId
|
|
264
347
|
} : chunk);
|
|
265
348
|
} }));
|
|
266
|
-
return streamOf(normalizeUIMessageStreamParts(chunksOf(chunks, signal)));
|
|
349
|
+
return streamOf(normalizeUIMessageStreamParts(chunksOf$1(chunks, signal)));
|
|
267
350
|
}
|
|
268
351
|
/** `stream` once its first chunk arrives, or `undefined` when reading it fails. */
|
|
269
352
|
async function opened(stream) {
|
|
@@ -287,8 +370,55 @@ async function opened(stream) {
|
|
|
287
370
|
}
|
|
288
371
|
});
|
|
289
372
|
}
|
|
290
|
-
function runSse(stream, workflowRunId) {
|
|
291
|
-
return sse(stream,
|
|
373
|
+
function runSse(stream, workflowRunId, tailIndex) {
|
|
374
|
+
return sse(stream, {
|
|
375
|
+
...workflowRunId === void 0 ? {} : { [WORKFLOW_RUN_ID_HEADER]: workflowRunId },
|
|
376
|
+
...tailIndex === void 0 ? {} : { [STREAM_TAIL_INDEX_HEADER]: String(tailIndex) }
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* The index of the newest UI chunk a segment holds, or -1 when it holds none.
|
|
381
|
+
* The World counts raw parts, and one part can make several UI chunks, so the
|
|
382
|
+
* raw prefix is converted. `undefined` when the stream can't be read.
|
|
383
|
+
*/
|
|
384
|
+
async function uiTailIndex(workflowRunId, streamId) {
|
|
385
|
+
try {
|
|
386
|
+
const raw = getRun(workflowRunId).getReadable({ namespace: streamId });
|
|
387
|
+
const rawTail = await raw.getTailIndex();
|
|
388
|
+
if (rawTail < 0) return -1;
|
|
389
|
+
const reader = raw.getReader();
|
|
390
|
+
let seen = 0;
|
|
391
|
+
const prefix = new ReadableStream({ async pull(controller) {
|
|
392
|
+
if (seen > rawTail) {
|
|
393
|
+
controller.close();
|
|
394
|
+
await reader.cancel().catch(() => void 0);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const next = await reader.read();
|
|
398
|
+
if (next.done) controller.close();
|
|
399
|
+
else {
|
|
400
|
+
seen += 1;
|
|
401
|
+
controller.enqueue(next.value);
|
|
402
|
+
}
|
|
403
|
+
} });
|
|
404
|
+
let count = 0;
|
|
405
|
+
for await (const _ of streamAsync(prefix.pipeThrough(createModelCallToUIChunkTransform()))) count += 1;
|
|
406
|
+
return count - 1;
|
|
407
|
+
} catch {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
async function* streamAsync(stream) {
|
|
412
|
+
const reader = stream.getReader();
|
|
413
|
+
try {
|
|
414
|
+
for (;;) {
|
|
415
|
+
const next = await reader.read();
|
|
416
|
+
if (next.done) return;
|
|
417
|
+
yield next.value;
|
|
418
|
+
}
|
|
419
|
+
} finally {
|
|
420
|
+
reader.releaseLock();
|
|
421
|
+
}
|
|
292
422
|
}
|
|
293
423
|
/**
|
|
294
424
|
* Durable chat routes on the Workflow SDK: each turn is a workflow run
|
|
@@ -298,7 +428,8 @@ function runSse(stream, workflowRunId) {
|
|
|
298
428
|
*/
|
|
299
429
|
function durableChat(options) {
|
|
300
430
|
const newId = options.generateId ?? (() => crypto.randomUUID());
|
|
301
|
-
function streamSegment(context, chat, workflowRunId, streamId, messageId) {
|
|
431
|
+
async function streamSegment(context, chat, workflowRunId, streamId, messageId) {
|
|
432
|
+
const tail = await uiTailIndex(workflowRunId, streamId);
|
|
302
433
|
const teed = teeToStore(options.streams, streamId, segmentChunks(workflowRunId, streamId, messageId, 0).pipeThrough(new JsonToSseTransformStream()), {
|
|
303
434
|
owner: chat.ownerId,
|
|
304
435
|
...chat.organizationId === void 0 ? {} : { tenant: chat.organizationId },
|
|
@@ -308,12 +439,14 @@ function durableChat(options) {
|
|
|
308
439
|
context.waitUntil?.((async () => {
|
|
309
440
|
await teed.persisted;
|
|
310
441
|
})());
|
|
311
|
-
return runSse(teed.stream, workflowRunId);
|
|
442
|
+
return runSse(teed.stream, workflowRunId, tail);
|
|
312
443
|
}
|
|
313
444
|
async function startTurn(body, context) {
|
|
314
445
|
const turn = await options.assistant.prepare(body, context);
|
|
315
446
|
if (turn instanceof Response) return turn;
|
|
316
447
|
const { chat, model } = turn;
|
|
448
|
+
const appContext = await options.context?.(body, turn, context);
|
|
449
|
+
if (appContext instanceof Response) return appContext;
|
|
317
450
|
const streamId = newId();
|
|
318
451
|
const messageId = newId();
|
|
319
452
|
const claim = await context.chats.runs.claim({
|
|
@@ -336,7 +469,8 @@ function durableChat(options) {
|
|
|
336
469
|
runId,
|
|
337
470
|
streamId,
|
|
338
471
|
messages: turn.messages,
|
|
339
|
-
providerOptions: turn.providerOptions
|
|
472
|
+
providerOptions: turn.providerOptions,
|
|
473
|
+
...appContext === void 0 ? {} : { context: appContext }
|
|
340
474
|
};
|
|
341
475
|
let workflowRunId;
|
|
342
476
|
try {
|
|
@@ -470,22 +604,30 @@ function durableChat(options) {
|
|
|
470
604
|
if (run instanceof Response) return run;
|
|
471
605
|
const streamId = run?.streamId;
|
|
472
606
|
if (run === void 0 || streamId === void 0) return new Response(null, { status: 204 });
|
|
473
|
-
const
|
|
474
|
-
|
|
607
|
+
const requested = Math.trunc(resumeOptions.startIndex ?? 0);
|
|
608
|
+
const workflowRunId = run.engine === WORKFLOW_ENGINE ? run.externalRunId : void 0;
|
|
609
|
+
const tail = workflowRunId === void 0 ? void 0 : await uiTailIndex(workflowRunId, streamId);
|
|
610
|
+
const startIndex = Math.max(0, requested < 0 ? (tail ?? -1) + 1 + requested : requested);
|
|
611
|
+
if (workflowRunId !== void 0) {
|
|
475
612
|
let live;
|
|
476
613
|
try {
|
|
477
|
-
live = await opened(segmentChunks(
|
|
614
|
+
live = await opened(segmentChunks(workflowRunId, streamId, run.assistantMessageId, startIndex, resumeOptions.signal).pipeThrough(new JsonToSseTransformStream()));
|
|
478
615
|
} catch {
|
|
479
616
|
live = void 0;
|
|
480
617
|
}
|
|
481
|
-
if (live !== void 0) return runSse(live,
|
|
618
|
+
if (live !== void 0) return runSse(live, workflowRunId, tail);
|
|
619
|
+
}
|
|
620
|
+
let fromIdx = startIndex;
|
|
621
|
+
if (requested < 0) {
|
|
622
|
+
const status = await options.streams.status(streamId);
|
|
623
|
+
fromIdx = Math.max(0, (status.ok ? status.data?.next ?? 0 : 0) + requested);
|
|
482
624
|
}
|
|
483
625
|
const stored = await resumeFromStore(options.streams, streamId, {
|
|
484
|
-
fromIdx
|
|
626
|
+
fromIdx,
|
|
485
627
|
...resumeOptions.signal === void 0 ? {} : { signal: resumeOptions.signal }
|
|
486
628
|
});
|
|
487
629
|
if (!stored.ok) return problemResponse(stored.error);
|
|
488
|
-
return stored.data === void 0 ? new Response(null, { status: 204 }) : runSse(stored.data, run.externalRunId);
|
|
630
|
+
return stored.data === void 0 ? new Response(null, { status: 204 }) : runSse(stored.data, run.externalRunId, tail);
|
|
489
631
|
}
|
|
490
632
|
async function stop(chatId, context) {
|
|
491
633
|
const stopped = await context.chats.runs.stop(chatId);
|
|
@@ -531,20 +673,124 @@ function durableChat(options) {
|
|
|
531
673
|
}
|
|
532
674
|
// src/ai-sdk/workflow/steps.ts
|
|
533
675
|
/**
|
|
676
|
+
* The chunks of `stream`, one at a time.
|
|
677
|
+
*
|
|
678
|
+
* @yields {UIMessageChunk} Each chunk, until the stream ends.
|
|
679
|
+
*/
|
|
680
|
+
async function* chunksOf(stream) {
|
|
681
|
+
const reader = stream.getReader();
|
|
682
|
+
for (;;) {
|
|
683
|
+
const next = await reader.read();
|
|
684
|
+
if (next.done) return;
|
|
685
|
+
yield next.value;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* What only the UI stream carries: the persistent `data-*` parts and the
|
|
690
|
+
* message metadata of every segment. `undefined` when a stream can't be read;
|
|
691
|
+
* the answer is then saved from the model messages alone.
|
|
692
|
+
*/
|
|
693
|
+
async function uiExtras(workflowRunId, streamIds) {
|
|
694
|
+
const data = /* @__PURE__ */ new Map();
|
|
695
|
+
const metadata = {};
|
|
696
|
+
try {
|
|
697
|
+
for (const namespace of streamIds) {
|
|
698
|
+
const chunks = getRun(workflowRunId).getReadable({ namespace }).pipeThrough(createModelCallToUIChunkTransform());
|
|
699
|
+
for await (const chunk of normalizeUIMessageStreamParts(chunksOf(chunks))) if (chunk.type === "message-metadata" && isRecord(chunk.messageMetadata)) Object.assign(metadata, chunk.messageMetadata);
|
|
700
|
+
else if (chunk.type.startsWith("data-") && "data" in chunk && !("transient" in chunk && chunk.transient)) {
|
|
701
|
+
const name = chunk.type.slice(5);
|
|
702
|
+
const id = "id" in chunk && typeof chunk.id === "string" ? chunk.id : void 0;
|
|
703
|
+
data.set(`${name}:${id ?? data.size}`, {
|
|
704
|
+
type: "data",
|
|
705
|
+
name,
|
|
706
|
+
...id === void 0 ? {} : { id },
|
|
707
|
+
data: chunk.data
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
} catch {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
return {
|
|
715
|
+
data: [...data.values()],
|
|
716
|
+
metadata
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
async function withExtras(input) {
|
|
720
|
+
if (input.streams === void 0) return input.message;
|
|
721
|
+
const extras = await uiExtras(input.streams.workflowRunId, input.streams.streamIds);
|
|
722
|
+
if (extras === void 0) return input.message;
|
|
723
|
+
const metadata = {
|
|
724
|
+
...input.message.metadata,
|
|
725
|
+
...extras.metadata
|
|
726
|
+
};
|
|
727
|
+
return {
|
|
728
|
+
...input.message,
|
|
729
|
+
parts: [...input.message.parts, ...extras.data],
|
|
730
|
+
...Object.keys(metadata).length === 0 ? {} : { metadata }
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
/** Failures a retry can't fix: the same call fails the same way. */
|
|
734
|
+
const PERMANENT_KINDS = /* @__PURE__ */ new Set([
|
|
735
|
+
"forbidden",
|
|
736
|
+
"not_found",
|
|
737
|
+
"validation",
|
|
738
|
+
"conflict",
|
|
739
|
+
"foreign_key",
|
|
740
|
+
"check",
|
|
741
|
+
"not_null",
|
|
742
|
+
"exclusion",
|
|
743
|
+
"invalid_input",
|
|
744
|
+
"invalid_value",
|
|
745
|
+
"invalid_request",
|
|
746
|
+
"max_affected",
|
|
747
|
+
"multiple_rows",
|
|
748
|
+
"unsupported"
|
|
749
|
+
]);
|
|
750
|
+
/**
|
|
751
|
+
* Maps a database failure to the Workflow SDK's step errors: a permanent one
|
|
752
|
+
* (`forbidden`, `not_found`, `validation`, `conflict` and the other constraint
|
|
753
|
+
* kinds) becomes a `FatalError` so the step stops retrying; `rate_limited` and
|
|
754
|
+
* `quota_exceeded` become a `RetryableError` that waits their `retryAfter`. Any
|
|
755
|
+
* other error (a network failure, a timeout) is returned as it is, so the step
|
|
756
|
+
* keeps its default retries.
|
|
757
|
+
*/
|
|
758
|
+
function durableStepError(error) {
|
|
759
|
+
if (!(error instanceof DbException)) return error;
|
|
760
|
+
const { kind } = error.error;
|
|
761
|
+
if (PERMANENT_KINDS.has(kind)) return new FatalError(error.message);
|
|
762
|
+
if (kind === "rate_limited" || kind === "quota_exceeded") {
|
|
763
|
+
const seconds = "retryAfter" in error.error ? error.error.retryAfter : void 0;
|
|
764
|
+
return new RetryableError(error.message, seconds === void 0 ? {} : { retryAfter: seconds * 1e3 });
|
|
765
|
+
}
|
|
766
|
+
return error;
|
|
767
|
+
}
|
|
768
|
+
async function mapped(run) {
|
|
769
|
+
try {
|
|
770
|
+
return await run();
|
|
771
|
+
} catch (error) {
|
|
772
|
+
throw durableStepError(error);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
534
776
|
* Saves a turn's answer (service role) with its AI SDK form next to the
|
|
535
777
|
* canonical one. The message id is the idempotency key: a retried step, or the
|
|
536
778
|
* save after the next agent pass, updates the same message.
|
|
537
779
|
*/
|
|
538
|
-
|
|
780
|
+
function saveMessagesStep(chats, input) {
|
|
781
|
+
return mapped(() => saveMessages(chats, input));
|
|
782
|
+
}
|
|
783
|
+
async function saveMessages(chats, input) {
|
|
784
|
+
const message = await withExtras(input);
|
|
539
785
|
await chats.messages.saveAssistant({
|
|
540
786
|
chatId: input.chatId,
|
|
541
|
-
message
|
|
787
|
+
message,
|
|
542
788
|
options: {
|
|
543
789
|
parentId: input.parentId,
|
|
544
790
|
status: input.status,
|
|
545
791
|
model: input.model,
|
|
546
792
|
format: AI_SDK_UI_FORMAT,
|
|
547
|
-
native: toUIMessage(
|
|
793
|
+
native: toUIMessage(message),
|
|
548
794
|
runId: input.runId
|
|
549
795
|
}
|
|
550
796
|
}).orThrow();
|
|
@@ -589,17 +835,18 @@ async function release(chats, input, options) {
|
|
|
589
835
|
function durableSteps(chats, options = {}) {
|
|
590
836
|
return {
|
|
591
837
|
save: (input) => saveMessagesStep(chats, input),
|
|
592
|
-
approvals: (input) => recordApprovals(chats, input),
|
|
593
|
-
decisions: (input) => decisionsOf(chats, input),
|
|
594
|
-
release: (input) => release(chats, input, options)
|
|
838
|
+
approvals: (input) => mapped(() => recordApprovals(chats, input)),
|
|
839
|
+
decisions: (input) => mapped(() => decisionsOf(chats, input)),
|
|
840
|
+
release: (input) => mapped(() => release(chats, input, options))
|
|
595
841
|
};
|
|
596
842
|
}
|
|
597
843
|
/**
|
|
598
844
|
* Runs one of a durable turn's database steps. Call it from the app's one `"use
|
|
599
845
|
* step"` function, so the Workflow SDK records and retries each call; a
|
|
600
|
-
* database error throws
|
|
846
|
+
* permanent database error throws a `FatalError`, a rate limit a
|
|
847
|
+
* `RetryableError`, and any other error retries the step.
|
|
601
848
|
*/
|
|
602
849
|
function runDurableStep(chats, name, input, options = {}) {
|
|
603
850
|
return durableSteps(chats, options)[name](input);
|
|
604
851
|
}
|
|
605
|
-
export { WORKFLOW_RUN_ID_HEADER, durableChat, durableSteps, durableStopToken, durableTurn, durableTurnToken, runDurableStep, saveMessagesStep };
|
|
852
|
+
export { WORKFLOW_RUN_ID_HEADER, createWorkflowAgentRuntime, durableChat, durableStepError, durableSteps, durableStopToken, durableTurn, durableTurnToken, runDurableStep, saveMessagesStep };
|
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
import { l as AssistantTransportConfig, n as UseAssistantOptions, t as AssistantState } from "../../../index-BWR29Vvw.js";
|
|
2
2
|
import { ChatTransport, UIMessage } from "ai";
|
|
3
|
+
import { WorkflowChatTransportOptions } from "@ai-sdk/workflow/client";
|
|
4
|
+
/**
|
|
5
|
+
* What `durableTransport` takes from the app, on top of the library's own
|
|
6
|
+
* request handling: every `WorkflowChatTransport` option except `api`.
|
|
7
|
+
*
|
|
8
|
+
* - `prepareSendMessagesRequest` and `prepareReconnectToStreamRequest` refine the
|
|
9
|
+
* library's request: the library builds it first (the newest message, or the
|
|
10
|
+
* answered approvals), then your function's `body`, `headers`, `credentials`
|
|
11
|
+
* and `api` replace or extend it. `headers` are merged.
|
|
12
|
+
* - `fetch`, `onChatSendMessage`, `onChatEnd`, `maxConsecutiveErrors` and
|
|
13
|
+
* `initialStartIndex` go to the Workflow SDK's transport as they are.
|
|
14
|
+
*/
|
|
15
|
+
export type DurableTransportOptions<UI_MESSAGE extends UIMessage = UIMessage> = Omit<WorkflowChatTransportOptions<UI_MESSAGE>, "api">;
|
|
3
16
|
/**
|
|
4
17
|
* The transport for `durableChat`: the Workflow SDK's chat transport, which
|
|
5
18
|
* reconnects until the segment's `finish` when a request drops. It sends the
|
|
6
19
|
* user's newest message, or the answered approvals of the last answer so the
|
|
7
|
-
* waiting turn continues. Pass it as `useAssistant({ transport })
|
|
20
|
+
* waiting turn continues. Pass it as `useAssistant({ transport })`, or use
|
|
21
|
+
* `useDurableAssistant`. A reconnect the server answers with 204 (no durable
|
|
22
|
+
* run) resolves to `null`.
|
|
8
23
|
*/
|
|
9
|
-
export declare function durableTransport(config: AssistantTransportConfig): ChatTransport<
|
|
10
|
-
export
|
|
24
|
+
export declare function durableTransport<UI_MESSAGE extends UIMessage = UIMessage>(config: AssistantTransportConfig, options?: DurableTransportOptions<UI_MESSAGE>): ChatTransport<UI_MESSAGE>;
|
|
25
|
+
export interface UseDurableAssistantOptions<UI_MESSAGE extends UIMessage = UIMessage> extends Omit<UseAssistantOptions<UI_MESSAGE>, "transport"> {
|
|
26
|
+
/**
|
|
27
|
+
* Options of the Workflow SDK's transport. Keep the object stable (module
|
|
28
|
+
* scope or `useMemo`): a new one makes a new transport.
|
|
29
|
+
*/
|
|
30
|
+
readonly transportOptions?: DurableTransportOptions<UI_MESSAGE>;
|
|
31
|
+
}
|
|
11
32
|
/**
|
|
12
33
|
* `useAssistant` on `durableChat`. It continues the answer once every approval
|
|
13
34
|
* is answered. `resume` defaults to `false`: pass `chat.activeStreamId !==
|
|
14
35
|
* undefined` from the chat row so a reload picks up the running answer.
|
|
15
36
|
*/
|
|
16
|
-
export declare function useDurableAssistant(options: UseDurableAssistantOptions): AssistantState
|
|
37
|
+
export declare function useDurableAssistant<UI_MESSAGE extends UIMessage = UIMessage>(options: UseDurableAssistantOptions<UI_MESSAGE>): AssistantState<UI_MESSAGE>;
|
|
17
38
|
export type { AssistantState };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { n as assistantBody } from "../../../transport-
|
|
3
|
-
import { t as useAssistant } from "../../../react-
|
|
2
|
+
import { n as assistantBody } from "../../../transport-CZBRg-9e.js";
|
|
3
|
+
import { t as useAssistant } from "../../../react-DnOu9xsi.js";
|
|
4
|
+
import { useMemo } from "react";
|
|
4
5
|
import { lastAssistantMessageIsCompleteWithApprovalResponses } from "ai";
|
|
5
6
|
import { WorkflowChatTransport } from "@ai-sdk/workflow/client";
|
|
6
7
|
// src/ai-sdk/workflow/react/index.ts
|
|
@@ -13,32 +14,61 @@ function approvalsOf(message) {
|
|
|
13
14
|
...part.approval.reason === void 0 ? {} : { reason: part.approval.reason }
|
|
14
15
|
}] : []);
|
|
15
16
|
}
|
|
17
|
+
const headersOf = (...sources) => {
|
|
18
|
+
const merged = {};
|
|
19
|
+
for (const source of sources) for (const [key, value] of new Headers(source)) merged[key] = value;
|
|
20
|
+
return merged;
|
|
21
|
+
};
|
|
16
22
|
/**
|
|
17
23
|
* The transport for `durableChat`: the Workflow SDK's chat transport, which
|
|
18
24
|
* reconnects until the segment's `finish` when a request drops. It sends the
|
|
19
25
|
* user's newest message, or the answered approvals of the last answer so the
|
|
20
|
-
* waiting turn continues. Pass it as `useAssistant({ transport })
|
|
26
|
+
* waiting turn continues. Pass it as `useAssistant({ transport })`, or use
|
|
27
|
+
* `useDurableAssistant`. A reconnect the server answers with 204 (no durable
|
|
28
|
+
* run) resolves to `null`.
|
|
21
29
|
*/
|
|
22
|
-
function durableTransport(config) {
|
|
23
|
-
const { api
|
|
24
|
-
const
|
|
30
|
+
function durableTransport(config, options = {}) {
|
|
31
|
+
const { api } = config;
|
|
32
|
+
const baseFetch = options.fetch ?? globalThis.fetch;
|
|
33
|
+
const seen = { empty: false };
|
|
34
|
+
const wasEmpty = () => seen.empty;
|
|
25
35
|
const transport = new WorkflowChatTransport({
|
|
36
|
+
...options,
|
|
26
37
|
api,
|
|
27
|
-
|
|
38
|
+
fetch: async (input, init) => {
|
|
39
|
+
const response = await baseFetch(input, init);
|
|
40
|
+
if (response.status === 204) seen.empty = true;
|
|
41
|
+
return response;
|
|
42
|
+
},
|
|
43
|
+
prepareSendMessagesRequest: async (request) => {
|
|
28
44
|
const approvals = approvalsOf(request.messages.at(-1));
|
|
29
|
-
|
|
30
|
-
|
|
45
|
+
const ours = {
|
|
46
|
+
headers: headersOf(config.headers, request.headers),
|
|
31
47
|
body: approvals.length > 0 ? {
|
|
32
48
|
...config.body,
|
|
33
49
|
id: request.id,
|
|
34
50
|
approvals
|
|
35
51
|
} : assistantBody(config, request)
|
|
36
52
|
};
|
|
53
|
+
const theirs = await options.prepareSendMessagesRequest?.(request);
|
|
54
|
+
return {
|
|
55
|
+
...ours,
|
|
56
|
+
...theirs,
|
|
57
|
+
headers: headersOf(ours.headers, theirs?.headers)
|
|
58
|
+
};
|
|
37
59
|
},
|
|
38
|
-
prepareReconnectToStreamRequest: (request) =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
60
|
+
prepareReconnectToStreamRequest: async (request) => {
|
|
61
|
+
const ours = {
|
|
62
|
+
headers: headersOf(config.headers, request.headers),
|
|
63
|
+
api: `${api}/${encodeURIComponent(request.id)}/stream`
|
|
64
|
+
};
|
|
65
|
+
const theirs = await options.prepareReconnectToStreamRequest?.(request);
|
|
66
|
+
return {
|
|
67
|
+
...ours,
|
|
68
|
+
...theirs,
|
|
69
|
+
headers: headersOf(ours.headers, theirs?.headers)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
42
72
|
});
|
|
43
73
|
return {
|
|
44
74
|
sendMessages: ({ messageId, abortSignal, ...rest }) => transport.sendMessages({
|
|
@@ -46,7 +76,30 @@ function durableTransport(config) {
|
|
|
46
76
|
...messageId === void 0 ? {} : { messageId },
|
|
47
77
|
...abortSignal === void 0 ? {} : { abortSignal }
|
|
48
78
|
}),
|
|
49
|
-
reconnectToStream: (
|
|
79
|
+
reconnectToStream: async (reconnect) => {
|
|
80
|
+
seen.empty = false;
|
|
81
|
+
const stream = await transport.reconnectToStream(reconnect);
|
|
82
|
+
if (stream === null) return null;
|
|
83
|
+
const reader = stream.getReader();
|
|
84
|
+
let first;
|
|
85
|
+
try {
|
|
86
|
+
first = await reader.read();
|
|
87
|
+
} catch (cause) {
|
|
88
|
+
if (wasEmpty()) return null;
|
|
89
|
+
throw cause;
|
|
90
|
+
}
|
|
91
|
+
if (first.done && wasEmpty()) return null;
|
|
92
|
+
let pending = first;
|
|
93
|
+
return new ReadableStream({
|
|
94
|
+
async pull(controller) {
|
|
95
|
+
const next = pending ?? await reader.read();
|
|
96
|
+
pending = void 0;
|
|
97
|
+
if (next.done) controller.close();
|
|
98
|
+
else controller.enqueue(next.value);
|
|
99
|
+
},
|
|
100
|
+
cancel: (reason) => reader.cancel(reason)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
50
103
|
};
|
|
51
104
|
}
|
|
52
105
|
/**
|
|
@@ -55,11 +108,13 @@ function durableTransport(config) {
|
|
|
55
108
|
* undefined` from the chat row so a reload picks up the running answer.
|
|
56
109
|
*/
|
|
57
110
|
function useDurableAssistant(options) {
|
|
111
|
+
const { transportOptions, ...rest } = options;
|
|
112
|
+
const transport = useMemo(() => (config) => durableTransport(config, transportOptions), [transportOptions]);
|
|
58
113
|
return useAssistant({
|
|
59
|
-
...
|
|
114
|
+
...rest,
|
|
60
115
|
resume: options.resume ?? false,
|
|
61
116
|
sendAutomaticallyWhen: options.sendAutomaticallyWhen ?? lastAssistantMessageIsCompleteWithApprovalResponses,
|
|
62
|
-
transport
|
|
117
|
+
transport
|
|
63
118
|
});
|
|
64
119
|
}
|
|
65
120
|
export { durableTransport, useDurableAssistant };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { l as AssistantTransportConfig, t as AssistantState } from "../../../index-BWR29Vvw.js";
|
|
2
|
-
import { UseDurableAssistantOptions } from "./index.js";
|
|
2
|
+
import { DurableTransportOptions, UseDurableAssistantOptions } from "./index.js";
|
|
3
3
|
import { ChatTransport, UIMessage } from "ai";
|
|
4
4
|
/** The `react-server` build of `durableTransport`. */
|
|
5
|
-
export declare const durableTransport: (config: AssistantTransportConfig) => ChatTransport<
|
|
5
|
+
export declare const durableTransport: <UI_MESSAGE extends UIMessage = UIMessage>(config: AssistantTransportConfig, options?: DurableTransportOptions<UI_MESSAGE>) => ChatTransport<UI_MESSAGE>;
|
|
6
6
|
/** The `react-server` build of `useDurableAssistant`. */
|
|
7
|
-
export declare const useDurableAssistant: (options: UseDurableAssistantOptions) => AssistantState
|
|
8
|
-
export type { AssistantState, UseDurableAssistantOptions };
|
|
7
|
+
export declare const useDurableAssistant: <UI_MESSAGE extends UIMessage = UIMessage>(options: UseDurableAssistantOptions<UI_MESSAGE>) => AssistantState<UI_MESSAGE>;
|
|
8
|
+
export type { AssistantState, DurableTransportOptions, UseDurableAssistantOptions };
|
|
@@ -3,7 +3,7 @@ import { wt as EventMap } from "./events-D5aC9hkx.js";
|
|
|
3
3
|
import { i as DbBlockSource } from "./db-blocks-BZLF1SQ6.js";
|
|
4
4
|
import { n as CloudEventOptions } from "./cloud-event-CQAnJsbp.js";
|
|
5
5
|
import { t as RealtimeStatus } from "./realtime-status-D3oUx3o4.js";
|
|
6
|
-
import { t as SPEC_PINS } from "./spec-pins-
|
|
6
|
+
import { t as SPEC_PINS } from "./spec-pins-Bb6V8nR2.js";
|
|
7
7
|
import { C as ModelWebhook, E as OperationSource, O as SecurityRequirement, S as ModelTag, a as JsonSchema, b as ModelServer, d as ModelInfo, f as ModelMessage, i as JsonObject, m as ModelOperation, n as DataApiOperation, p as ModelMessageTrait, r as HttpMethod, s as ModelChannel, t as ApiModel, v as ModelSecurityProfileRequirement, w as ModelWorkflow, y as ModelSecurityScheme } from "./model-Lxa_mOzB.js";
|
|
8
8
|
import { a as ResourcePlan, o as StandardLike, r as ResourceDescription, t as ErrorResponse } from "./resource-boXKLFED.js";
|
|
9
9
|
import { c as SpecDiagnostic, i as DocumentOf, l as VersionOf, s as RenderedOf, t as AnyDocumentFormat } from "./format-BT0Z3V54.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as isPlainObject } from "./clone-H_gCsL29.js";
|
|
2
|
-
import { t as SPEC_PINS } from "./spec-pins-
|
|
2
|
+
import { t as SPEC_PINS } from "./spec-pins-Dlz8OVqi.js";
|
|
3
3
|
import { d as mergeJson, f as pointerToken, n as publishedResources, o as publishedBlocks, t as buildApiModel, u as pascal } from "./build-DsBSjC9L.js";
|
|
4
4
|
// src/spec/format.ts
|
|
5
5
|
/**
|