dineway 0.1.48 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{activity-events-C9u37D5z.mjs → activity-events-y6eT8UW6.mjs} +6 -38
- package/dist/actor-CrObAPV0.mjs +37 -0
- package/dist/after-BfniwgIf.mjs +9 -0
- package/dist/{allowed-origins-DhipQNLb.mjs → allowed-origins-_oeyP6x-.mjs} +1 -1
- package/dist/api/route-utils.d.mts +10 -10
- package/dist/api/route-utils.mjs +17 -14
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -4
- package/dist/{api-Eiy8_zVZ.mjs → api-ByrU2q-Z.mjs} +61 -37
- package/dist/{api-tokens-DtvdtIkm.mjs → api-tokens-CjVMQT-X.mjs} +6 -2
- package/dist/{apply-CX3no7XE.mjs → apply-bZswmZPm.mjs} +117 -77
- package/dist/astro/image-endpoint.d.mts +7 -0
- package/dist/astro/image-endpoint.mjs +54 -0
- package/dist/astro/index.d.mts +35 -11
- package/dist/astro/index.mjs +157 -23
- package/dist/astro/integration/shims/use-sync-external-store-with-selector.js +71 -0
- package/dist/astro/integration/shims/use-sync-external-store.js +1 -0
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.mjs +42 -24
- package/dist/astro/middleware/redirect.mjs +14 -5
- package/dist/astro/middleware/request-context.mjs +9 -6
- package/dist/astro/middleware/seed.d.mts +1 -1
- package/dist/astro/middleware/seed.mjs +2 -2
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.mjs +334 -193
- package/dist/astro/routes/admin.astro +6 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -6
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -6
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +6 -6
- package/dist/astro/routes/api/admin/briefing.mjs +22 -18
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +4 -4
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +9 -8
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +9 -8
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +9 -8
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +18 -15
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +18 -15
- package/dist/astro/routes/api/admin/bylines/index.mjs +18 -15
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +15 -13
- package/dist/astro/routes/api/admin/comments/_id_.mjs +7 -6
- package/dist/astro/routes/api/admin/comments/bulk.mjs +12 -10
- package/dist/astro/routes/api/admin/comments/counts.mjs +7 -6
- package/dist/astro/routes/api/admin/comments/index.mjs +12 -10
- package/dist/astro/routes/api/admin/context/_id_/history.mjs +27 -25
- package/dist/astro/routes/api/admin/context/_id_/index.mjs +27 -25
- package/dist/astro/routes/api/admin/context/_id_/review.mjs +32 -29
- package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +32 -29
- package/dist/astro/routes/api/admin/context/diff.mjs +31 -28
- package/dist/astro/routes/api/admin/context/index.mjs +32 -29
- package/dist/astro/routes/api/admin/context/stale.mjs +31 -28
- package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +27 -25
- package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +31 -28
- package/dist/astro/routes/api/admin/hitl-requests/index.mjs +31 -28
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +28 -26
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +3 -3
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +6 -6
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +6 -6
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +56 -52
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +56 -52
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +48 -44
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +54 -50
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +53 -49
- package/dist/astro/routes/api/admin/plugins/index.mjs +48 -44
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +2 -2
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +53 -49
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +47 -43
- package/dist/astro/routes/api/admin/plugins/updates.mjs +47 -43
- package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +6 -6
- package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +32 -28
- package/dist/astro/routes/api/admin/review-requests/index.mjs +11 -10
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +47 -43
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +2 -2
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +47 -43
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +8 -7
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +4 -4
- package/dist/astro/routes/api/admin/users/index.mjs +7 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs +4 -4
- package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/complete.mjs +12 -11
- package/dist/astro/routes/api/auth/invite/index.mjs +9 -8
- package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -10
- package/dist/astro/routes/api/auth/logout.mjs +2 -2
- package/dist/astro/routes/api/auth/magic-link/send.mjs +11 -10
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/me.mjs +10 -9
- package/dist/astro/routes/api/auth/mode.mjs +1 -1
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +3 -3
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +6 -5
- package/dist/astro/routes/api/auth/passkey/index.mjs +1 -1
- package/dist/astro/routes/api/auth/passkey/options.mjs +12 -11
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +10 -9
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +11 -10
- package/dist/astro/routes/api/auth/passkey/verify.mjs +11 -10
- package/dist/astro/routes/api/auth/setup-token/index.mjs +6 -6
- package/dist/astro/routes/api/auth/setup-token/verify.mjs +2 -2
- package/dist/astro/routes/api/auth/signup/complete.mjs +12 -11
- package/dist/astro/routes/api/auth/signup/request.mjs +11 -10
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +16 -14
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.d.mts +8 -0
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +160 -0
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +12 -11
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +17 -15
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +6 -6
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/authors.mjs +2 -2
- package/dist/astro/routes/api/content/_collection_/index.mjs +11 -10
- package/dist/astro/routes/api/content/_collection_/trash.mjs +7 -6
- package/dist/astro/routes/api/dashboard.mjs +10 -9
- package/dist/astro/routes/api/dev/emails.mjs +2 -2
- package/dist/astro/routes/api/health.mjs +1 -1
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +23 -11
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +9 -6
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +19 -1
- package/dist/astro/routes/api/import/wordpress/execute.mjs +85 -38
- package/dist/astro/routes/api/import/wordpress/media.d.mts +13 -1
- package/dist/astro/routes/api/import/wordpress/media.mjs +20 -14
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +36 -33
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +18 -1
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +121 -101
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +25 -13
- package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +56 -2
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +284 -56
- package/dist/astro/routes/api/manifest.mjs +14 -5
- package/dist/astro/routes/api/mcp.mjs +266 -70
- package/dist/astro/routes/api/media/_id_/confirm.mjs +39 -11
- package/dist/astro/routes/api/media/_id_.mjs +11 -7
- package/dist/astro/routes/api/media/file/_...key_.mjs +1 -1
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +2 -2
- package/dist/astro/routes/api/media/providers/index.mjs +2 -2
- package/dist/astro/routes/api/media/upload-url.mjs +12 -11
- package/dist/astro/routes/api/media.mjs +28 -35
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +32 -29
- package/dist/astro/routes/api/menus/_name_/items.mjs +32 -29
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +32 -29
- package/dist/astro/routes/api/menus/_name_/translations.mjs +32 -29
- package/dist/astro/routes/api/menus/_name_.mjs +32 -29
- package/dist/astro/routes/api/menus/index.mjs +32 -29
- package/dist/astro/routes/api/oauth/authorize.mjs +7 -7
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +4 -4
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +4 -3
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +30 -30
- package/dist/astro/routes/api/redirects/404s/index.mjs +12 -11
- package/dist/astro/routes/api/redirects/404s/summary.mjs +12 -11
- package/dist/astro/routes/api/redirects/_id_.mjs +33 -30
- package/dist/astro/routes/api/redirects/index.mjs +33 -30
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +2 -2
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +2 -2
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +48 -44
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +48 -44
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +48 -44
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +48 -44
- package/dist/astro/routes/api/schema/collections/index.mjs +48 -44
- package/dist/astro/routes/api/schema/index.mjs +13 -14
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +47 -43
- package/dist/astro/routes/api/schema/orphans/index.mjs +47 -43
- package/dist/astro/routes/api/search/enable.mjs +12 -11
- package/dist/astro/routes/api/search/index.mjs +11 -10
- package/dist/astro/routes/api/search/rebuild.mjs +12 -11
- package/dist/astro/routes/api/search/stats.mjs +7 -7
- package/dist/astro/routes/api/search/suggest.mjs +11 -10
- package/dist/astro/routes/api/sections/_slug_.mjs +32 -29
- package/dist/astro/routes/api/sections/index.mjs +32 -29
- package/dist/astro/routes/api/settings/email.mjs +4 -4
- package/dist/astro/routes/api/settings.mjs +32 -29
- package/dist/astro/routes/api/setup/admin-verify.mjs +14 -13
- package/dist/astro/routes/api/setup/admin.mjs +12 -11
- package/dist/astro/routes/api/setup/dev-bypass.mjs +32 -26
- package/dist/astro/routes/api/setup/dev-reset.mjs +2 -2
- package/dist/astro/routes/api/setup/index.mjs +30 -26
- package/dist/astro/routes/api/setup/status.mjs +3 -3
- package/dist/astro/routes/api/snapshot.mjs +9 -8
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +35 -32
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +35 -32
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +35 -32
- package/dist/astro/routes/api/taxonomies/index.mjs +35 -32
- package/dist/astro/routes/api/themes/preview.mjs +6 -6
- package/dist/astro/routes/api/typegen.mjs +4 -4
- package/dist/astro/routes/api/well-known/auth.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +3 -3
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +3 -3
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +31 -28
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +32 -29
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +32 -29
- package/dist/astro/routes/api/widget-areas/_name_.mjs +29 -27
- package/dist/astro/routes/api/widget-areas/index.mjs +32 -29
- package/dist/astro/routes/api/widget-components.mjs +2 -2
- package/dist/astro/routes/robots.txt.mjs +9 -8
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +24 -15
- package/dist/astro/routes/sitemap.xml.mjs +10 -9
- package/dist/astro/session-driver.d.mts +1 -1
- package/dist/astro/session-driver.mjs +3 -3
- package/dist/astro/types.d.mts +21 -13
- package/dist/{audit-D1cbG7xH.mjs → audit-ByVKIwWF.mjs} +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{auth-control-guard-Dr14I98m.mjs → auth-control-guard-CqeUmQsv.mjs} +1 -1
- package/dist/{authorize-BLO0m7fW.mjs → authorize-CcBxcHtz.mjs} +1 -1
- package/dist/{briefing-CObXGOGz.mjs → briefing-BJaJI8dm.mjs} +2 -1
- package/dist/{briefing-gKWiGLt1.mjs → briefing-CawZ59CY.mjs} +90 -28
- package/dist/bundle-7C_DpkEq.mjs +602 -0
- package/dist/{byline-1ntDwv8c.mjs → byline-e51-fWRs.mjs} +30 -62
- package/dist/{byline-fields-BX7rWKNU.d.mts → byline-fields-CUvbslGc.d.mts} +49 -6
- package/dist/{byline-fields-C9_iaPaM.mjs → byline-fields-D-N5qVIG.mjs} +1 -1
- package/dist/{byline-fields-B-ZkoVft.mjs → byline-fields-DOJO16Gm.mjs} +3 -3
- package/dist/{byline-registry-CUSvkasJ.mjs → byline-registry-87nNnYl4.mjs} +2 -2
- package/dist/{bylines-bC15ZqAv.mjs → bylines-CMQNCNFh.mjs} +9 -3
- package/dist/{bylines-DtxChhN_.mjs → bylines-y4LO-dTj.mjs} +5 -5
- package/dist/{cache-DbKyr60Q.mjs → cache-C-FNTFYK.mjs} +2 -2
- package/dist/{chunks-C5zp2xir.mjs → chunks-CxBt-GxR.mjs} +1 -1
- package/dist/cli/index.mjs +820 -1276
- package/dist/client/external-auth-headers.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +2 -1
- package/dist/{comment-CXDOQ93N.mjs → comment-DlA4iChg.mjs} +13 -3
- package/dist/comment-reaction-DfFao1ST.mjs +58 -0
- package/dist/{comments-hK-rdzJ9.mjs → comments-DApFGMsP.mjs} +1 -1
- package/dist/{content-QaryevFO.mjs → content-Bh4BDjv8.mjs} +51 -34
- package/dist/content-refresh-CgutSUfO.mjs +1576 -0
- package/dist/{context-CoYb_fvK.mjs → context-C5W3G18y.mjs} +111 -50
- package/dist/{context-DBL1ib4v.mjs → context-CK4ym2Sf.mjs} +2 -2
- package/dist/{context-route-helpers-CYQVmbIm.mjs → context-route-helpers-MASyGgWf.mjs} +2 -1
- package/dist/{cron-DxCAU_Sn.mjs → cron-cKcNTix_.mjs} +7 -3
- package/dist/{dashboard-DNlqsknJ.mjs → dashboard-DQkVT7Ei.mjs} +4 -4
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{device-flow-DygsFPGL.mjs → device-flow-BnqRH-T9.mjs} +5 -5
- package/dist/{placeholder-BDo81Is5.mjs → enrich-DIFIFA8O.mjs} +36 -9
- package/dist/{error-DCSuUAZW.mjs → error-CytFlgcd.mjs} +5 -0
- package/dist/field-defs-cache-DRNdhBJv.mjs +49 -0
- package/dist/{fts-manager-CIZlScg5.mjs → fts-manager-Crzypjqu.mjs} +1 -1
- package/dist/hitl-Hw1RmWOq.mjs +677 -0
- package/dist/{hitl-requests-CGQwOEiq.mjs → hitl-requests-B4Vbcmaq.mjs} +2 -2
- package/dist/{hitl-route-helpers-GSDLNPpN.mjs → hitl-route-helpers-hEVzvP8l.mjs} +5 -4
- package/dist/import-Bh9biJfx.mjs +1354 -0
- package/dist/{index-CwRuZ-u8.d.mts → index-D4y6NGiy.d.mts} +75 -3
- package/dist/index.d.mts +17 -16
- package/dist/index.mjs +81 -69
- package/dist/{jsonld-DZ67souc.d.mts → jsonld-Dq0gsnOH.d.mts} +8 -4
- package/dist/{load-xE01Jm0V.mjs → load-DmYeniXl.mjs} +1 -1
- package/dist/{loader-tg63WSY2.mjs → loader-CjWqjweO.mjs} +117 -31
- package/dist/{manifest-schema-qh2P7RDX.mjs → manifest-schema-BxVPYMJR.mjs} +34 -1
- package/dist/mcp-reviewed-executor-TwVbMzG6.mjs +555 -0
- package/dist/media/image-endpoint.d.mts +32 -0
- package/dist/media/image-endpoint.mjs +111 -0
- package/dist/media/index.d.mts +27 -2
- package/dist/media/index.mjs +5 -3
- package/dist/media/local-runtime.d.mts +16 -11
- package/dist/media/local-runtime.mjs +10 -8
- package/dist/{media-DUAjMfvR.mjs → media-DMj0grzC.mjs} +3 -1
- package/dist/{media-allowlist-BsXkT9RK.mjs → media-allowlist-BlVCSzHx.mjs} +1 -1
- package/dist/media-url-lEKSrpr9.mjs +20 -0
- package/dist/{menus-WpFRMXjz.mjs → menus-TaW1gKnk.mjs} +19 -5
- package/dist/{menus-DU1eZqw_.mjs → menus-xvsnVZXw.mjs} +80 -15
- package/dist/{normalize-DUnoXAa9.mjs → normalize-5ek_z7de.mjs} +8 -1
- package/dist/{oauth-authorization-D-1p52Je.mjs → oauth-authorization-DiaGvRVz.mjs} +5 -5
- package/dist/{oauth-clients-CzeMGyUU.mjs → oauth-clients-Dl9E8dEM.mjs} +2 -2
- package/dist/object-cache/memory.d.mts +14 -0
- package/dist/object-cache/memory.mjs +55 -0
- package/dist/object-cache-D51qOseS.mjs +419 -0
- package/dist/page/index.d.mts +4 -3
- package/dist/page/index.mjs +2 -2
- package/dist/{parse-CneSgl7-.mjs → parse-CbymENaR.mjs} +1 -1
- package/dist/{parser-DxfsARXL.mjs → parser-C1nYd-81.mjs} +151 -9
- package/dist/{placeholder-CXfoCtCd.d.mts → placeholder-uvNRZBX9.d.mts} +12 -4
- package/dist/plugin-utils.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.d.mts +9 -9
- package/dist/plugins/adapt-sandbox-entry.mjs +11 -2
- package/dist/{plugins-C57YQi4l.mjs → plugins-BolVa-tl.mjs} +832 -64
- package/dist/{transport-LSdZVXHF.mjs → portable-text-dA_UlJwW.mjs} +1 -134
- package/dist/{preview-D5rvDhRt.mjs → preview-vSVg6fwG.mjs} +4 -3
- package/dist/process-cache-7xgAO9JY.mjs +106 -0
- package/dist/{provider-loader-9it4vd6L.d.mts → provider-loader-MD8zAbnH.d.mts} +1 -1
- package/dist/{public-url-DLUM5OOv.mjs → public-url-BEz_sM9n.mjs} +24 -18
- package/dist/{public-url-B5HaoGzj.d.mts → public-url-gsp3oUbu.d.mts} +5 -4
- package/dist/{query-BYc3oruA.mjs → query-CfRCdaL3.mjs} +281 -76
- package/dist/{query-DKEwzobh.mjs → query-jaAmw8E1.mjs} +11 -6
- package/dist/{rate-limit-i0G3IAOX.mjs → rate-limit-ZLdyWoZF.mjs} +2 -2
- package/dist/{redirect-C2zXRj3c.mjs → redirect-BAjt4Z6b.mjs} +2 -2
- package/dist/{redirects-YZo_znWG.mjs → redirects-BTdwpQtE.mjs} +47 -24
- package/dist/{redirects-ocRJmQHP.mjs → redirects-CA-xylPG.mjs} +19 -11
- package/dist/{registry-CTkbIDB9.mjs → registry-CtyVedcN.mjs} +130 -77
- package/dist/request-context.d.mts +2 -0
- package/dist/{request-meta-DAb6xaP9.mjs → request-meta-CUypToDJ.mjs} +1 -1
- package/dist/{review-requests-C0un5kdV.mjs → review-requests-C9Ff11Vq.mjs} +1 -1
- package/dist/{review-requests-gGMyYYhy.mjs → review-requests-DUyEmtmG.mjs} +1 -1
- package/dist/{runner-D4FL9usy.d.mts → runner-1tC2tIRV.d.mts} +1 -1
- package/dist/runner-DB7CRfOF.mjs +6740 -0
- package/dist/{runtime-DEWQpZ-4.d.mts → runtime-BOeiQsCv.d.mts} +2028 -1564
- package/dist/runtime.d.mts +10 -10
- package/dist/runtime.mjs +4 -4
- package/dist/schema-DXdYj4R3.mjs +8 -0
- package/dist/{search-axGQ1KY3.mjs → search-DSaLgEFI.mjs} +5 -3
- package/dist/{secrets-062Izo8i.mjs → secrets-CDZo2k8L.mjs} +15 -12
- package/dist/{sections-OLKgXL10.mjs → sections-PVVXHGfp.mjs} +2 -2
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +22 -19
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.mjs +3 -12
- package/dist/{seo-Cd45Po8L.mjs → seo-CQG3GCHQ.mjs} +5 -2
- package/dist/{seo-contributions-CqVvReEj.mjs → seo-contributions-C1EnikHB.mjs} +11 -3
- package/dist/{seo-5lJOtB5J.mjs → seo-qa7Dn0jK.mjs} +22 -4
- package/dist/{service-Bwad8s5h.mjs → service-DiN4ZuPp.mjs} +2 -2
- package/dist/session-user-CAKImna3.mjs +22 -0
- package/dist/{settings-yLjz_I4T.mjs → settings-BbqgHWpU.mjs} +28 -55
- package/dist/{settings-lAHjaUit.mjs → settings-i4VPP8bT.mjs} +2 -2
- package/dist/{setup-complete--PradA4R.mjs → setup-complete-B8fl-mjV.mjs} +1 -1
- package/dist/{site-activity-D7Xyropw.mjs → site-activity-Dy3FROs0.mjs} +1 -1
- package/dist/{site-context-DaN9Z91j.mjs → site-context-DQiL8Fl5.mjs} +23 -652
- package/dist/{site-url-DpGZo9Z6.mjs → site-url-BML3GQYm.mjs} +1 -1
- package/dist/status-DANd8ERo.mjs +21 -0
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/{taxonomies-uXVEoQso.mjs → taxonomies-9s-v03H-.mjs} +36 -29
- package/dist/taxonomies-DRiixp_E.mjs +443 -0
- package/dist/{taxonomy-CBmkmMuU.mjs → taxonomy-Dvsw6BOs.mjs} +44 -9
- package/dist/{tokens-CjSgb0AC.mjs → tokens-1RK1n6ED.mjs} +1 -1
- package/dist/transport-BNmCqLu7.mjs +134 -0
- package/dist/types-4garmdWa.mjs +66 -0
- package/dist/{types-DSPGWjxO.d.mts → types-C8XW6L19.d.mts} +225 -4
- package/dist/{types-GaCtZ1k9.d.mts → types-CDpH6MA4.d.mts} +18 -0
- package/dist/{types-DRIKLmJI.d.mts → types-C_ly5eTp.d.mts} +17 -2
- package/dist/types-DF7ZuGGk.d.mts +118 -0
- package/dist/types-DU0bU2Wu.d.mts +2392 -0
- package/dist/{types-CwawBUTa.d.mts → types-DW_-sFyz.d.mts} +2 -1
- package/dist/{types-DfuD0Afl.mjs → types-Dq1qT19x.mjs} +2 -2
- package/dist/ui/server-runtime.d.mts +15 -15
- package/dist/ui/server-runtime.mjs +25 -21
- package/dist/url-Cac7a9QZ.mjs +33 -0
- package/dist/{user-DtNmjNYt.mjs → user-BIZPzCb9.mjs} +2 -2
- package/dist/{utils-wv-zvC-Y.mjs → utils-CMDhr5Xd.mjs} +129 -7
- package/dist/{validate-BMs11tan.d.mts → validate-CZvb-BKB.d.mts} +10 -7
- package/dist/{validate-7SYRbz2f.mjs → validate-DNs0pTSc.mjs} +11 -6
- package/dist/version-BTvfRGc6.mjs +6 -0
- package/dist/{widgets-DR8EHuRO.mjs → widgets-f0ibZUIq.mjs} +46 -43
- package/dist/{wordpress-slugs-Dvhxh4cl.mjs → wordpress-slugs-BhHJX8XE.mjs} +1 -1
- package/dist/{zod-generator-BS9-umbk.mjs → zod-generator-B7TMjyFJ.mjs} +41 -13
- package/package.json +31 -8
- package/src/components/Block.astro +50 -0
- package/src/components/Comments.astro +143 -1
- package/src/components/DinewayHead.astro +19 -2
- package/src/components/DinewayImage.astro +66 -33
- package/src/components/DinewayMedia.astro +1 -2
- package/src/components/Image.astro +85 -40
- package/src/components/InlinePortableTextEditor.tsx +12 -2
- package/src/components/JsonLdScript.astro +9 -0
- package/src/components/LiveSearch.astro +40 -4
- package/src/components/index.ts +4 -0
- package/src/components/live-search-routing.ts +30 -0
- package/src/components/portable-text-text-align.ts +15 -0
- package/src/ui.ts +2 -0
- package/dist/entity-aliases-Egjmqc7I.mjs +0 -51
- package/dist/import-CvHY6sf5.mjs +0 -684
- package/dist/runner-B-tbV751.mjs +0 -2741
- package/dist/schema-B6zyB-Xn.mjs +0 -8
- package/dist/taxonomies-CNOGeC-3.mjs +0 -327
- package/dist/types-eu5UDgHN.d.mts +0 -652
- package/dist/version-xlzMSXF2.mjs +0 -6
- /package/dist/{adapters-OQCImOL7.d.mts → adapters-NVSs4UH7.d.mts} +0 -0
- /package/dist/{api-tokens-CYUoFGo7.mjs → api-tokens-2r7OWi_I.mjs} +0 -0
- /package/dist/{base64-C1Q9yr0B.mjs → base64-F8-DUraK.mjs} +0 -0
- /package/dist/{challenge-store-CRSz-Xim.mjs → challenge-store-Bjlepa2E.mjs} +0 -0
- /package/dist/{components--pg6zBvu.mjs → components-Bclf98Be.mjs} +0 -0
- /package/dist/{context-types-DQh_XKkn.mjs → context-types-DqTo6C79.mjs} +0 -0
- /package/dist/{default-B6iaLvP7.mjs → default--K40jqm0.mjs} +0 -0
- /package/dist/{email-console-BOVqIYpB.mjs → email-console-ChgKFO8-.mjs} +0 -0
- /package/dist/{escape-BDgouFFY.mjs → escape-Bd4P_xKg.mjs} +0 -0
- /package/dist/{experimental-workflows-Dh4DUoD_.mjs → experimental-workflows-BMsUnIAw.mjs} +0 -0
- /package/dist/{mime-8pAB8-77.mjs → mime-CA7Lgovc.mjs} +0 -0
- /package/dist/{mode-CpyEz8pe.mjs → mode-C4CIyjtR.mjs} +0 -0
- /package/dist/{oauth-state-store-qncPB_IU.mjs → oauth-state-store-CNoXafF7.mjs} +0 -0
- /package/dist/{oauth-user-lookup-BFjWF8wK.mjs → oauth-user-lookup-Ygw4bNyt.mjs} +0 -0
- /package/dist/{options-BvJoSSJR.mjs → options-DQPTH5n0.mjs} +0 -0
- /package/dist/{passkey-config-DzHQK90v.mjs → passkey-config-BUwu8BA3.mjs} +0 -0
- /package/dist/{patterns-r-0n824Y.mjs → patterns-BhAvqO0S.mjs} +0 -0
- /package/dist/{provider-loader-DzUxejk7.mjs → provider-loader-D0w9dqjm.mjs} +0 -0
- /package/dist/{redirect-BjIBtDWY.mjs → redirect-wphRBv4y.mjs} +0 -0
- /package/dist/{request-cache-CYMbwZc6.mjs → request-cache-D9GQBxMP.mjs} +0 -0
- /package/dist/{resolve-DTuDyYKs.mjs → resolve-Cb6Dbz-C.mjs} +0 -0
- /package/dist/{setup-nonce-pyGfc9hV.mjs → setup-nonce-CoyjILvW.mjs} +0 -0
- /package/dist/{sidecar-client-mJxwayYN.mjs → sidecar-client-C3mqXg4C.mjs} +0 -0
- /package/dist/{slugify-BzGxlOFx.mjs → slugify-KSsVD_D3.mjs} +0 -0
- /package/dist/{ssrf-DiKqWd3N.mjs → ssrf-DWe8jwAp.mjs} +0 -0
- /package/dist/{transaction-CShMWIej.mjs → transaction-C2EOMTJA.mjs} +0 -0
- /package/dist/{transport-BnsNxh2l.d.mts → transport-CcJu3Co8.d.mts} +0 -0
- /package/dist/{trusted-proxy-BgIIcbsN.mjs → trusted-proxy-DTXQ2IMv.mjs} +0 -0
- /package/dist/{types-BO8TGjS8.mjs → types-B3t5cxhU.mjs} +0 -0
- /package/dist/{types-nP9vGUFq.d.mts → types-C46EvNdc.d.mts} +0 -0
- /package/dist/{types-Cg276-3z.mjs → types-C5CVgwsV.mjs} +0 -0
- /package/dist/{types-DZpT-PnG.d.mts → types-POH8PQZh.d.mts} +0 -0
- /package/dist/{types-Dryvv7LH.d.mts → types-Rc3gQqqw.d.mts} +0 -0
- /package/dist/{url-w7Mp5qAD.mjs → url-CpyFDFpO.mjs} +0 -0
|
@@ -1,404 +1,20 @@
|
|
|
1
1
|
import { t as validateIdentifier } from "./validate-VPnKoIzW.mjs";
|
|
2
|
-
import { t as ContentRepository } from "./content-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { n as assertExperimentalSiteContextWorkflowsEnabled } from "./experimental-workflows-Dh4DUoD_.mjs";
|
|
2
|
+
import { t as ContentRepository } from "./content-Bh4BDjv8.mjs";
|
|
3
|
+
import { t as SiteActivityRepository } from "./site-activity-Dy3FROs0.mjs";
|
|
4
|
+
import { t as ReviewRequestRepository } from "./review-requests-DUyEmtmG.mjs";
|
|
5
|
+
import { c as stableStringify, d as HitlRequestRepository, f as EntityAliasRepository, n as HandoffSnapshotRepository, o as AssignmentRepository, p as normalizeEntityAlias, s as buildStableActionHash, t as HitlRequestService } from "./hitl-Hw1RmWOq.mjs";
|
|
6
|
+
import { r as isPattern } from "./patterns-BhAvqO0S.mjs";
|
|
7
|
+
import { a as ContextRepository, i as parseSiteBriefingScope, l as handlePluginList } from "./briefing-CawZ59CY.mjs";
|
|
8
|
+
import { t as FTSManager } from "./fts-manager-Crzypjqu.mjs";
|
|
9
|
+
import { n as SchemaRegistry } from "./registry-CtyVedcN.mjs";
|
|
10
|
+
import { a as getSiteSettingsWithDb } from "./settings-BbqgHWpU.mjs";
|
|
11
|
+
import { m as normalizeUrl } from "./utils-CMDhr5Xd.mjs";
|
|
12
|
+
import { t as sanitizeWordPressImportSlug } from "./wordpress-slugs-BhHJX8XE.mjs";
|
|
13
|
+
import { s as searchCollection } from "./search-DSaLgEFI.mjs";
|
|
14
|
+
import { n as assertExperimentalSiteContextWorkflowsEnabled } from "./experimental-workflows-BMsUnIAw.mjs";
|
|
16
15
|
import { sql } from "kysely";
|
|
17
|
-
import { ulid } from "ulidx";
|
|
18
16
|
import { Role } from "@dineway-ai/auth";
|
|
19
17
|
|
|
20
|
-
//#region src/database/repositories/assignments.ts
|
|
21
|
-
const ASSIGNMENT_ACTOR_TYPES = [
|
|
22
|
-
"user",
|
|
23
|
-
"api_token",
|
|
24
|
-
"system"
|
|
25
|
-
];
|
|
26
|
-
const ASSIGNMENT_STATUSES = [
|
|
27
|
-
"pending",
|
|
28
|
-
"accepted",
|
|
29
|
-
"in_progress",
|
|
30
|
-
"blocked",
|
|
31
|
-
"completed",
|
|
32
|
-
"declined",
|
|
33
|
-
"cancelled"
|
|
34
|
-
];
|
|
35
|
-
const ASSIGNMENT_PRIORITIES = [
|
|
36
|
-
"low",
|
|
37
|
-
"normal",
|
|
38
|
-
"high",
|
|
39
|
-
"urgent"
|
|
40
|
-
];
|
|
41
|
-
var AssignmentRepository = class {
|
|
42
|
-
constructor(db) {
|
|
43
|
-
this.db = db;
|
|
44
|
-
}
|
|
45
|
-
async create(input) {
|
|
46
|
-
const id = ulid();
|
|
47
|
-
const now = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
48
|
-
await this.db.insertInto("_dineway_assignments").values(toInsertableAssignment(id, input, now)).execute();
|
|
49
|
-
const assignment = await this.findById(id);
|
|
50
|
-
if (!assignment) throw new Error("Failed to create assignment");
|
|
51
|
-
return assignment;
|
|
52
|
-
}
|
|
53
|
-
async findById(id) {
|
|
54
|
-
const row = await this.db.selectFrom("_dineway_assignments").selectAll().where("id", "=", id).executeTakeFirst();
|
|
55
|
-
return row ? rowToAssignment(row) : null;
|
|
56
|
-
}
|
|
57
|
-
async list(query = {}) {
|
|
58
|
-
const limit = clampLimit$3(query.limit);
|
|
59
|
-
const rows = await this.queryRows(query).execute();
|
|
60
|
-
const items = rows.slice(0, limit).map(rowToAssignment);
|
|
61
|
-
const result = { items };
|
|
62
|
-
if (rows.length > limit && items.length > 0) {
|
|
63
|
-
const last = items.at(-1);
|
|
64
|
-
result.nextCursor = encodeCursor(last.createdAt, last.id);
|
|
65
|
-
}
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
async accept(id, input = {}) {
|
|
69
|
-
const value = input.acceptedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
70
|
-
return this.transition(id, ["pending"], {
|
|
71
|
-
status: "accepted",
|
|
72
|
-
assigned_to_actor_type: input.assignedToActorType ?? null,
|
|
73
|
-
assigned_to_actor_id: input.assignedToActorId ?? null,
|
|
74
|
-
accepted_at: value,
|
|
75
|
-
updated_at: value,
|
|
76
|
-
metadata: jsonString$1(input.metadata)
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
async start(id, input = {}) {
|
|
80
|
-
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
81
|
-
return this.transition(id, ["accepted", "blocked"], {
|
|
82
|
-
status: "in_progress",
|
|
83
|
-
started_at: value,
|
|
84
|
-
updated_at: value,
|
|
85
|
-
metadata: jsonString$1(input.metadata)
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async block(id, input = {}) {
|
|
89
|
-
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
90
|
-
return this.transition(id, ["accepted", "in_progress"], {
|
|
91
|
-
status: "blocked",
|
|
92
|
-
blocked_at: value,
|
|
93
|
-
updated_at: value,
|
|
94
|
-
metadata: jsonString$1(input.metadata)
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
async complete(id, input = {}) {
|
|
98
|
-
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
99
|
-
return this.transition(id, [
|
|
100
|
-
"pending",
|
|
101
|
-
"accepted",
|
|
102
|
-
"in_progress"
|
|
103
|
-
], {
|
|
104
|
-
status: "completed",
|
|
105
|
-
completed_at: value,
|
|
106
|
-
updated_at: value,
|
|
107
|
-
metadata: jsonString$1(input.metadata)
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
async decline(id, input = {}) {
|
|
111
|
-
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
112
|
-
return this.transition(id, ["pending", "accepted"], {
|
|
113
|
-
status: "declined",
|
|
114
|
-
declined_at: value,
|
|
115
|
-
updated_at: value,
|
|
116
|
-
metadata: jsonString$1(input.metadata)
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
async cancel(id, input = {}) {
|
|
120
|
-
const value = input.at ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
121
|
-
return this.transition(id, [
|
|
122
|
-
"pending",
|
|
123
|
-
"accepted",
|
|
124
|
-
"in_progress",
|
|
125
|
-
"blocked"
|
|
126
|
-
], {
|
|
127
|
-
status: "cancelled",
|
|
128
|
-
cancelled_at: value,
|
|
129
|
-
updated_at: value,
|
|
130
|
-
metadata: jsonString$1(input.metadata)
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
async linkHitlRequest(id, relatedHitlRequestId, at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
134
|
-
const result = await this.db.updateTable("_dineway_assignments").set({
|
|
135
|
-
related_hitl_request_id: relatedHitlRequestId,
|
|
136
|
-
updated_at: at
|
|
137
|
-
}).where("id", "=", id).executeTakeFirst();
|
|
138
|
-
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
139
|
-
return this.findById(id);
|
|
140
|
-
}
|
|
141
|
-
queryRows(query) {
|
|
142
|
-
const limit = clampLimit$3(query.limit);
|
|
143
|
-
let q = this.db.selectFrom("_dineway_assignments").selectAll().orderBy("created_at", "desc").orderBy("id", "desc").limit(limit + 1);
|
|
144
|
-
if (query.scope) q = q.where("scope", "=", query.scope);
|
|
145
|
-
if (query.scopes && query.scopes.length > 0) q = q.where("scope", "in", query.scopes);
|
|
146
|
-
if (query.statuses && query.statuses.length > 0) q = q.where("status", "in", query.statuses);
|
|
147
|
-
if (query.priority) q = q.where("priority", "=", query.priority);
|
|
148
|
-
if (query.assignmentType) q = q.where("assignment_type", "=", query.assignmentType);
|
|
149
|
-
if (query.assignedToActorType && query.assignedToActorId) q = q.where("assigned_to_actor_type", "=", query.assignedToActorType).where("assigned_to_actor_id", "=", query.assignedToActorId);
|
|
150
|
-
if (query.assignedByActorType && query.assignedByActorId) q = q.where("assigned_by_actor_type", "=", query.assignedByActorType).where("assigned_by_actor_id", "=", query.assignedByActorId);
|
|
151
|
-
if (query.participantActor) q = q.where((eb) => eb.or([eb.and([eb("assigned_by_actor_type", "=", query.participantActor.actorType), eb("assigned_by_actor_id", "=", query.participantActor.actorId)]), eb.and([eb("assigned_to_actor_type", "=", query.participantActor.actorType), eb("assigned_to_actor_id", "=", query.participantActor.actorId)])]));
|
|
152
|
-
if (query.since) q = q.where("updated_at", ">=", query.since);
|
|
153
|
-
if (query.cursor) {
|
|
154
|
-
const decoded = decodeCursor(query.cursor);
|
|
155
|
-
if (decoded) q = q.where((eb) => eb.or([eb("created_at", "<", decoded.orderValue), eb.and([eb("created_at", "=", decoded.orderValue), eb("id", "<", decoded.id)])]));
|
|
156
|
-
}
|
|
157
|
-
return q;
|
|
158
|
-
}
|
|
159
|
-
async transition(id, validFrom, update) {
|
|
160
|
-
const result = await this.db.updateTable("_dineway_assignments").set(update).where("id", "=", id).where("status", "in", validFrom).executeTakeFirst();
|
|
161
|
-
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
162
|
-
return this.findById(id);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
function toInsertableAssignment(id, input, now) {
|
|
166
|
-
return {
|
|
167
|
-
id,
|
|
168
|
-
scope: input.scope,
|
|
169
|
-
assignment_type: input.assignmentType,
|
|
170
|
-
status: "pending",
|
|
171
|
-
priority: input.priority ?? "normal",
|
|
172
|
-
title: input.title,
|
|
173
|
-
summary: input.summary ?? null,
|
|
174
|
-
details: input.details ?? null,
|
|
175
|
-
assigned_by_actor_type: input.assignedByActorType,
|
|
176
|
-
assigned_by_actor_id: input.assignedByActorId,
|
|
177
|
-
assigned_to_actor_type: input.assignedToActorType ?? null,
|
|
178
|
-
assigned_to_actor_id: input.assignedToActorId ?? null,
|
|
179
|
-
metadata: jsonString$1(input.metadata),
|
|
180
|
-
related_handoff_snapshot_id: input.relatedHandoffSnapshotId ?? null,
|
|
181
|
-
related_hitl_request_id: input.relatedHitlRequestId ?? null,
|
|
182
|
-
due_at: input.dueAt ?? null,
|
|
183
|
-
created_at: now,
|
|
184
|
-
updated_at: now,
|
|
185
|
-
accepted_at: null,
|
|
186
|
-
started_at: null,
|
|
187
|
-
blocked_at: null,
|
|
188
|
-
completed_at: null,
|
|
189
|
-
declined_at: null,
|
|
190
|
-
cancelled_at: null
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function rowToAssignment(row) {
|
|
194
|
-
return {
|
|
195
|
-
id: row.id,
|
|
196
|
-
scope: row.scope,
|
|
197
|
-
assignmentType: row.assignment_type,
|
|
198
|
-
status: row.status,
|
|
199
|
-
priority: row.priority,
|
|
200
|
-
title: row.title,
|
|
201
|
-
summary: row.summary,
|
|
202
|
-
details: row.details,
|
|
203
|
-
assignedByActorType: row.assigned_by_actor_type,
|
|
204
|
-
assignedByActorId: row.assigned_by_actor_id,
|
|
205
|
-
assignedToActorType: row.assigned_to_actor_type,
|
|
206
|
-
assignedToActorId: row.assigned_to_actor_id,
|
|
207
|
-
metadata: parseRecord$2(row.metadata),
|
|
208
|
-
relatedHandoffSnapshotId: row.related_handoff_snapshot_id,
|
|
209
|
-
relatedHitlRequestId: row.related_hitl_request_id,
|
|
210
|
-
dueAt: row.due_at,
|
|
211
|
-
createdAt: row.created_at,
|
|
212
|
-
updatedAt: row.updated_at,
|
|
213
|
-
acceptedAt: row.accepted_at,
|
|
214
|
-
startedAt: row.started_at,
|
|
215
|
-
blockedAt: row.blocked_at,
|
|
216
|
-
completedAt: row.completed_at,
|
|
217
|
-
declinedAt: row.declined_at,
|
|
218
|
-
cancelledAt: row.cancelled_at
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
function jsonString$1(value) {
|
|
222
|
-
return JSON.stringify(value ?? {});
|
|
223
|
-
}
|
|
224
|
-
function parseRecord$2(value) {
|
|
225
|
-
if (!value) return {};
|
|
226
|
-
try {
|
|
227
|
-
const parsed = JSON.parse(value);
|
|
228
|
-
return isRecord$5(parsed) ? parsed : {};
|
|
229
|
-
} catch {
|
|
230
|
-
return {};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
function isRecord$5(value) {
|
|
234
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
235
|
-
}
|
|
236
|
-
function clampLimit$3(limit) {
|
|
237
|
-
if (!limit || limit < 1) return 50;
|
|
238
|
-
return Math.min(limit, 100);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/database/repositories/hitl-requests.ts
|
|
243
|
-
const HITL_REQUEST_STATUSES = [
|
|
244
|
-
"pending",
|
|
245
|
-
"approved",
|
|
246
|
-
"rejected"
|
|
247
|
-
];
|
|
248
|
-
const HITL_REQUEST_PRIORITIES = [
|
|
249
|
-
"low",
|
|
250
|
-
"normal",
|
|
251
|
-
"high",
|
|
252
|
-
"urgent"
|
|
253
|
-
];
|
|
254
|
-
var HitlRequestRepository = class {
|
|
255
|
-
constructor(db) {
|
|
256
|
-
this.db = db;
|
|
257
|
-
}
|
|
258
|
-
async create(input) {
|
|
259
|
-
const id = ulid();
|
|
260
|
-
const now = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
261
|
-
await this.db.insertInto("_dineway_hitl_requests").values(toInsertableHitlRequest(id, input, now)).execute();
|
|
262
|
-
const request = await this.findById(id);
|
|
263
|
-
if (!request) throw new Error("Failed to create HITL request");
|
|
264
|
-
return request;
|
|
265
|
-
}
|
|
266
|
-
async findById(id) {
|
|
267
|
-
const row = await this.db.selectFrom("_dineway_hitl_requests").selectAll().where("id", "=", id).executeTakeFirst();
|
|
268
|
-
return row ? rowToHitlRequest(row) : null;
|
|
269
|
-
}
|
|
270
|
-
async list(query = {}) {
|
|
271
|
-
const limit = clampLimit$2(query.limit);
|
|
272
|
-
const rows = await this.queryRows(query).execute();
|
|
273
|
-
const items = rows.slice(0, limit).map(rowToHitlRequest);
|
|
274
|
-
const result = { items };
|
|
275
|
-
if (rows.length > limit && items.length > 0) {
|
|
276
|
-
const last = items.at(-1);
|
|
277
|
-
result.nextCursor = encodeCursor(last.createdAt, last.id);
|
|
278
|
-
}
|
|
279
|
-
return result;
|
|
280
|
-
}
|
|
281
|
-
async resolve(id, input) {
|
|
282
|
-
const resolvedAt = input.resolvedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
283
|
-
const result = await this.db.updateTable("_dineway_hitl_requests").set({
|
|
284
|
-
status: input.decision,
|
|
285
|
-
resolved_by_actor_type: input.resolvedByActorType,
|
|
286
|
-
resolved_by_actor_id: input.resolvedByActorId,
|
|
287
|
-
resolved_auth_metadata: jsonStringOrNull(input.resolvedAuthMetadata),
|
|
288
|
-
review_note: input.reviewNote ?? null,
|
|
289
|
-
resolved_at: resolvedAt,
|
|
290
|
-
updated_at: resolvedAt
|
|
291
|
-
}).where("id", "=", id).where("status", "=", "pending").executeTakeFirst();
|
|
292
|
-
if (Number(result.numUpdatedRows ?? 0) === 0) return null;
|
|
293
|
-
return this.findById(id);
|
|
294
|
-
}
|
|
295
|
-
queryRows(query) {
|
|
296
|
-
const limit = clampLimit$2(query.limit);
|
|
297
|
-
let q = this.db.selectFrom("_dineway_hitl_requests").selectAll().orderBy("created_at", "desc").orderBy("id", "desc").limit(limit + 1);
|
|
298
|
-
if (query.scope) q = q.where("scope", "=", query.scope);
|
|
299
|
-
if (query.scopes && query.scopes.length > 0) q = q.where("scope", "in", query.scopes);
|
|
300
|
-
if (query.statuses && query.statuses.length > 0) q = q.where("status", "in", query.statuses);
|
|
301
|
-
if (query.priority) q = q.where("priority", "=", query.priority);
|
|
302
|
-
if (query.actionType) q = q.where("action_type", "=", query.actionType);
|
|
303
|
-
if (query.targetRefType) q = q.where("target_ref_type", "=", query.targetRefType);
|
|
304
|
-
if (query.targetRefId) q = q.where("target_ref_id", "=", query.targetRefId);
|
|
305
|
-
if (query.relatedAssignmentId) q = q.where("related_assignment_id", "=", query.relatedAssignmentId);
|
|
306
|
-
if (query.requestedByActorType && query.requestedByActorId) q = q.where("requested_by_actor_type", "=", query.requestedByActorType).where("requested_by_actor_id", "=", query.requestedByActorId);
|
|
307
|
-
if (query.participantActor) q = q.where("requested_by_actor_type", "=", query.participantActor.actorType).where("requested_by_actor_id", "=", query.participantActor.actorId);
|
|
308
|
-
if (query.since) q = q.where("updated_at", ">=", query.since);
|
|
309
|
-
if (query.cursor) {
|
|
310
|
-
const decoded = decodeCursor(query.cursor);
|
|
311
|
-
if (decoded) q = q.where((eb) => eb.or([eb("created_at", "<", decoded.orderValue), eb.and([eb("created_at", "=", decoded.orderValue), eb("id", "<", decoded.id)])]));
|
|
312
|
-
}
|
|
313
|
-
return q;
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
function toInsertableHitlRequest(id, input, now) {
|
|
317
|
-
return {
|
|
318
|
-
id,
|
|
319
|
-
scope: input.scope,
|
|
320
|
-
action_type: input.actionType,
|
|
321
|
-
status: "pending",
|
|
322
|
-
priority: input.priority ?? "normal",
|
|
323
|
-
title: input.title,
|
|
324
|
-
summary: input.summary ?? null,
|
|
325
|
-
risk_reason: input.riskReason,
|
|
326
|
-
review_payload: JSON.stringify(input.reviewPayload),
|
|
327
|
-
target_ref_type: input.targetRefType,
|
|
328
|
-
target_ref_id: input.targetRefId,
|
|
329
|
-
requested_by_actor_type: input.requestedByActorType,
|
|
330
|
-
requested_by_actor_id: input.requestedByActorId,
|
|
331
|
-
requested_auth_metadata: jsonStringOrNull(input.requestedAuthMetadata),
|
|
332
|
-
resolved_by_actor_type: null,
|
|
333
|
-
resolved_by_actor_id: null,
|
|
334
|
-
resolved_auth_metadata: null,
|
|
335
|
-
review_note: null,
|
|
336
|
-
metadata: jsonString(input.metadata),
|
|
337
|
-
related_assignment_id: input.relatedAssignmentId ?? null,
|
|
338
|
-
related_handoff_snapshot_id: input.relatedHandoffSnapshotId ?? null,
|
|
339
|
-
sla_due_at: input.slaDueAt ?? null,
|
|
340
|
-
created_at: now,
|
|
341
|
-
updated_at: now,
|
|
342
|
-
resolved_at: null
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
function rowToHitlRequest(row) {
|
|
346
|
-
return {
|
|
347
|
-
id: row.id,
|
|
348
|
-
scope: row.scope,
|
|
349
|
-
actionType: row.action_type,
|
|
350
|
-
status: row.status,
|
|
351
|
-
priority: row.priority,
|
|
352
|
-
title: row.title,
|
|
353
|
-
summary: row.summary,
|
|
354
|
-
riskReason: row.risk_reason,
|
|
355
|
-
reviewPayload: parseRecord$1(row.review_payload),
|
|
356
|
-
targetRefType: row.target_ref_type,
|
|
357
|
-
targetRefId: row.target_ref_id,
|
|
358
|
-
requestedByActorType: row.requested_by_actor_type,
|
|
359
|
-
requestedByActorId: row.requested_by_actor_id,
|
|
360
|
-
requestedAuthMetadata: parseNullableRecord(row.requested_auth_metadata),
|
|
361
|
-
resolvedByActorType: row.resolved_by_actor_type,
|
|
362
|
-
resolvedByActorId: row.resolved_by_actor_id,
|
|
363
|
-
resolvedAuthMetadata: parseNullableRecord(row.resolved_auth_metadata),
|
|
364
|
-
reviewNote: row.review_note,
|
|
365
|
-
metadata: parseRecord$1(row.metadata),
|
|
366
|
-
relatedAssignmentId: row.related_assignment_id,
|
|
367
|
-
relatedHandoffSnapshotId: row.related_handoff_snapshot_id,
|
|
368
|
-
slaDueAt: row.sla_due_at,
|
|
369
|
-
createdAt: row.created_at,
|
|
370
|
-
updatedAt: row.updated_at,
|
|
371
|
-
resolvedAt: row.resolved_at
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
function jsonString(value) {
|
|
375
|
-
return JSON.stringify(value ?? {});
|
|
376
|
-
}
|
|
377
|
-
function jsonStringOrNull(value) {
|
|
378
|
-
return value ? JSON.stringify(value) : null;
|
|
379
|
-
}
|
|
380
|
-
function parseRecord$1(value) {
|
|
381
|
-
if (!value) return {};
|
|
382
|
-
try {
|
|
383
|
-
const parsed = JSON.parse(value);
|
|
384
|
-
return isRecord$4(parsed) ? parsed : {};
|
|
385
|
-
} catch {
|
|
386
|
-
return {};
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
function parseNullableRecord(value) {
|
|
390
|
-
if (!value) return null;
|
|
391
|
-
return parseRecord$1(value);
|
|
392
|
-
}
|
|
393
|
-
function isRecord$4(value) {
|
|
394
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
395
|
-
}
|
|
396
|
-
function clampLimit$2(limit) {
|
|
397
|
-
if (!limit || limit < 1) return 50;
|
|
398
|
-
return Math.min(limit, 100);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
//#endregion
|
|
402
18
|
//#region src/site-context/context-entry-public.ts
|
|
403
19
|
function toPublicContextEntry(entry) {
|
|
404
20
|
return {
|
|
@@ -443,24 +59,6 @@ function toPublicContextDiff(diff) {
|
|
|
443
59
|
};
|
|
444
60
|
}
|
|
445
61
|
|
|
446
|
-
//#endregion
|
|
447
|
-
//#region src/site-context/action-hash.ts
|
|
448
|
-
async function buildStableActionHash(value) {
|
|
449
|
-
return sha256Hex(stableStringify(value));
|
|
450
|
-
}
|
|
451
|
-
function stableStringify(value) {
|
|
452
|
-
if (Array.isArray(value)) return `[${value.map((item) => stableStringify(item)).join(",")}]`;
|
|
453
|
-
if (isRecord$3(value)) return `{${Object.entries(value).filter(([, entryValue]) => entryValue !== void 0).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, entryValue]) => `${JSON.stringify(key)}:${stableStringify(entryValue)}`).join(",")}}`;
|
|
454
|
-
return JSON.stringify(value ?? null);
|
|
455
|
-
}
|
|
456
|
-
function isRecord$3(value) {
|
|
457
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
458
|
-
}
|
|
459
|
-
async function sha256Hex(value) {
|
|
460
|
-
const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
461
|
-
return Array.from(new Uint8Array(buffer), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
462
|
-
}
|
|
463
|
-
|
|
464
62
|
//#endregion
|
|
465
63
|
//#region src/site-context/review-payload.ts
|
|
466
64
|
var ReviewPayloadBuilder = class {
|
|
@@ -554,9 +152,9 @@ var ReviewPayloadBuilder = class {
|
|
|
554
152
|
}
|
|
555
153
|
};
|
|
556
154
|
function asRecord(value) {
|
|
557
|
-
return isRecord$
|
|
155
|
+
return isRecord$1(value) ? value : null;
|
|
558
156
|
}
|
|
559
|
-
function isRecord$
|
|
157
|
+
function isRecord$1(value) {
|
|
560
158
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
561
159
|
}
|
|
562
160
|
function stringOrNull(value) {
|
|
@@ -2742,12 +2340,12 @@ function parseUnknownRecord(value) {
|
|
|
2742
2340
|
if (!value) return null;
|
|
2743
2341
|
try {
|
|
2744
2342
|
const parsed = JSON.parse(value);
|
|
2745
|
-
return isRecord
|
|
2343
|
+
return isRecord(parsed) ? parsed : null;
|
|
2746
2344
|
} catch {
|
|
2747
2345
|
return null;
|
|
2748
2346
|
}
|
|
2749
2347
|
}
|
|
2750
|
-
function isRecord
|
|
2348
|
+
function isRecord(value) {
|
|
2751
2349
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2752
2350
|
}
|
|
2753
2351
|
|
|
@@ -3135,7 +2733,7 @@ var EntityResolver = class {
|
|
|
3135
2733
|
return this.options.db.selectFrom("_dineway_taxonomy_defs").selectAll().execute();
|
|
3136
2734
|
}
|
|
3137
2735
|
async listPlugins() {
|
|
3138
|
-
const result = await handlePluginList(this.options.db, this.options.handlers.configuredPlugins, this.options.handlers.config.marketplace);
|
|
2736
|
+
const result = await handlePluginList(this.options.db, this.options.handlers.configuredPlugins, this.options.handlers.sandboxedPluginEntries ?? [], this.options.handlers.config.marketplace);
|
|
3139
2737
|
return result.success ? result.data?.items ?? [] : [];
|
|
3140
2738
|
}
|
|
3141
2739
|
contentCandidate(item, context, matchTier, matchReason) {
|
|
@@ -3534,97 +3132,6 @@ function clampLimit$1(value) {
|
|
|
3534
3132
|
return Math.min(Math.max(1, value ?? 10), 100);
|
|
3535
3133
|
}
|
|
3536
3134
|
|
|
3537
|
-
//#endregion
|
|
3538
|
-
//#region src/database/repositories/handoff-snapshots.ts
|
|
3539
|
-
var HandoffSnapshotRepository = class {
|
|
3540
|
-
constructor(db) {
|
|
3541
|
-
this.db = db;
|
|
3542
|
-
}
|
|
3543
|
-
async create(input) {
|
|
3544
|
-
const id = ulid();
|
|
3545
|
-
await this.db.insertInto("_dineway_handoff_snapshots").values(toInsertableHandoffSnapshot(id, input)).execute();
|
|
3546
|
-
return this.findById(id).then((snapshot) => {
|
|
3547
|
-
if (!snapshot) throw new Error("Failed to create handoff snapshot");
|
|
3548
|
-
return snapshot;
|
|
3549
|
-
});
|
|
3550
|
-
}
|
|
3551
|
-
async findById(id) {
|
|
3552
|
-
const row = await this.db.selectFrom("_dineway_handoff_snapshots").selectAll().where("id", "=", id).executeTakeFirst();
|
|
3553
|
-
return row ? rowToHandoffSnapshot(row) : null;
|
|
3554
|
-
}
|
|
3555
|
-
async markResumed(id, resumedAt) {
|
|
3556
|
-
const value = resumedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
3557
|
-
await this.db.updateTable("_dineway_handoff_snapshots").set({ resumed_at: value }).where("id", "=", id).execute();
|
|
3558
|
-
return this.findById(id);
|
|
3559
|
-
}
|
|
3560
|
-
};
|
|
3561
|
-
function toInsertableHandoffSnapshot(id, input) {
|
|
3562
|
-
return {
|
|
3563
|
-
id,
|
|
3564
|
-
scope: input.scope,
|
|
3565
|
-
actor_type: input.actorType,
|
|
3566
|
-
actor_id: input.actorId,
|
|
3567
|
-
auth_metadata: jsonOrNull(input.authMetadata),
|
|
3568
|
-
objective: input.objective,
|
|
3569
|
-
reasoning: input.reasoning,
|
|
3570
|
-
key_findings: JSON.stringify(input.keyFindings ?? []),
|
|
3571
|
-
touched_objects: JSON.stringify(input.touchedObjects ?? []),
|
|
3572
|
-
pending_actions: JSON.stringify(input.pendingActions ?? []),
|
|
3573
|
-
tool_evidence: JSON.stringify(input.toolEvidence ?? []),
|
|
3574
|
-
confidence: input.confidence ?? null,
|
|
3575
|
-
handoff_kind: input.handoffKind ?? "pause",
|
|
3576
|
-
reference_type: input.referenceType ?? null,
|
|
3577
|
-
reference_id: input.referenceId ?? null,
|
|
3578
|
-
created_at: input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
3579
|
-
resumed_at: null
|
|
3580
|
-
};
|
|
3581
|
-
}
|
|
3582
|
-
function rowToHandoffSnapshot(row) {
|
|
3583
|
-
return {
|
|
3584
|
-
id: row.id,
|
|
3585
|
-
scope: row.scope,
|
|
3586
|
-
actorType: row.actor_type,
|
|
3587
|
-
actorId: row.actor_id,
|
|
3588
|
-
authMetadata: parseRecord(row.auth_metadata),
|
|
3589
|
-
objective: row.objective,
|
|
3590
|
-
reasoning: row.reasoning,
|
|
3591
|
-
keyFindings: parseArray(row.key_findings),
|
|
3592
|
-
touchedObjects: parseArray(row.touched_objects),
|
|
3593
|
-
pendingActions: parseArray(row.pending_actions),
|
|
3594
|
-
toolEvidence: parseArray(row.tool_evidence),
|
|
3595
|
-
confidence: row.confidence,
|
|
3596
|
-
handoffKind: row.handoff_kind,
|
|
3597
|
-
referenceType: row.reference_type,
|
|
3598
|
-
referenceId: row.reference_id,
|
|
3599
|
-
createdAt: row.created_at,
|
|
3600
|
-
resumedAt: row.resumed_at
|
|
3601
|
-
};
|
|
3602
|
-
}
|
|
3603
|
-
function jsonOrNull(value) {
|
|
3604
|
-
return value ? JSON.stringify(value) : null;
|
|
3605
|
-
}
|
|
3606
|
-
function parseRecord(value) {
|
|
3607
|
-
if (!value) return null;
|
|
3608
|
-
try {
|
|
3609
|
-
const parsed = JSON.parse(value);
|
|
3610
|
-
return isRecord(parsed) ? parsed : null;
|
|
3611
|
-
} catch {
|
|
3612
|
-
return null;
|
|
3613
|
-
}
|
|
3614
|
-
}
|
|
3615
|
-
function parseArray(value) {
|
|
3616
|
-
if (!value) return [];
|
|
3617
|
-
try {
|
|
3618
|
-
const parsed = JSON.parse(value);
|
|
3619
|
-
return Array.isArray(parsed) ? parsed.filter((_item) => true) : [];
|
|
3620
|
-
} catch {
|
|
3621
|
-
return [];
|
|
3622
|
-
}
|
|
3623
|
-
}
|
|
3624
|
-
function isRecord(value) {
|
|
3625
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3626
|
-
}
|
|
3627
|
-
|
|
3628
3135
|
//#endregion
|
|
3629
3136
|
//#region src/site-context/handoff.ts
|
|
3630
3137
|
const DEFAULT_ACTIVITY_LIMIT = 25;
|
|
@@ -3924,7 +3431,7 @@ var AssignmentService = class {
|
|
|
3924
3431
|
}
|
|
3925
3432
|
assertReadable(assignment, actor) {
|
|
3926
3433
|
if (isWorkflowSupervisor(actor.userRole)) return;
|
|
3927
|
-
if (matchesActor
|
|
3434
|
+
if (matchesActor(assignment.assignedByActorType, assignment.assignedByActorId, actor) || matchesActor(assignment.assignedToActorType, assignment.assignedToActorId, actor)) return;
|
|
3928
3435
|
throw new Error("Insufficient permissions to access this assignment.");
|
|
3929
3436
|
}
|
|
3930
3437
|
assertAssigneeAction(action, assignment, actor) {
|
|
@@ -3933,12 +3440,12 @@ var AssignmentService = class {
|
|
|
3933
3440
|
if (action === "accept") return;
|
|
3934
3441
|
throw new Error(`Only an assigned actor can ${action} this assignment.`);
|
|
3935
3442
|
}
|
|
3936
|
-
if (matchesActor
|
|
3443
|
+
if (matchesActor(assignment.assignedToActorType, assignment.assignedToActorId, actor)) return;
|
|
3937
3444
|
throw new Error(`Only the assignee can ${action} this assignment.`);
|
|
3938
3445
|
}
|
|
3939
3446
|
assertCanceller(assignment, actor) {
|
|
3940
3447
|
if (isWorkflowSupervisor(actor.userRole)) return;
|
|
3941
|
-
if (matchesActor
|
|
3448
|
+
if (matchesActor(assignment.assignedByActorType, assignment.assignedByActorId, actor)) return;
|
|
3942
3449
|
throw new Error("Only the assigner or an editor can cancel this assignment.");
|
|
3943
3450
|
}
|
|
3944
3451
|
assertValidAction(action, currentStatus) {
|
|
@@ -3951,7 +3458,7 @@ function validateAssignmentAction(action, currentStatus) {
|
|
|
3951
3458
|
if (validFrom.includes(currentStatus)) return null;
|
|
3952
3459
|
return `Cannot ${action} an assignment that is currently '${currentStatus}'. Must be: ${validFrom.join(" or ")}`;
|
|
3953
3460
|
}
|
|
3954
|
-
function matchesActor
|
|
3461
|
+
function matchesActor(actorType, actorId, actor) {
|
|
3955
3462
|
return actorType === actor.actorType && actorId === actor.actorId;
|
|
3956
3463
|
}
|
|
3957
3464
|
function isWorkflowSupervisor(userRole) {
|
|
@@ -3965,142 +3472,6 @@ function mergeReasonMetadata(metadata, key, reason) {
|
|
|
3965
3472
|
};
|
|
3966
3473
|
}
|
|
3967
3474
|
|
|
3968
|
-
//#endregion
|
|
3969
|
-
//#region src/site-context/hitl.ts
|
|
3970
|
-
const HITL_REQUEST_VALID_FROM = { resolve: ["pending"] };
|
|
3971
|
-
var HitlRequestService = class {
|
|
3972
|
-
repository;
|
|
3973
|
-
assignments;
|
|
3974
|
-
constructor(db) {
|
|
3975
|
-
this.db = db;
|
|
3976
|
-
this.repository = new HitlRequestRepository(db);
|
|
3977
|
-
this.assignments = new AssignmentRepository(db);
|
|
3978
|
-
}
|
|
3979
|
-
async create(actor, input) {
|
|
3980
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
3981
|
-
parseSiteBriefingScope(input.scope);
|
|
3982
|
-
const assignment = input.relatedAssignmentId ? await this.assignments.findById(input.relatedAssignmentId) : null;
|
|
3983
|
-
if (input.relatedAssignmentId && !assignment) throw new Error(`Assignment not found: ${input.relatedAssignmentId}`);
|
|
3984
|
-
if (assignment) {
|
|
3985
|
-
this.assertRelatedAssignmentReadable(assignment, actor);
|
|
3986
|
-
if (assignment.scope !== input.scope) throw new Error("Related assignment scope must match the HITL request scope.");
|
|
3987
|
-
if (assignment.relatedHitlRequestId) throw new Error(`Assignment ${assignment.id} is already linked to HITL request ${assignment.relatedHitlRequestId}.`);
|
|
3988
|
-
}
|
|
3989
|
-
if (input.relatedHandoffSnapshotId) {
|
|
3990
|
-
const snapshot = await new HandoffSnapshotRepository(this.db).findById(input.relatedHandoffSnapshotId);
|
|
3991
|
-
if (!snapshot) throw new Error(`Handoff snapshot not found: ${input.relatedHandoffSnapshotId}`);
|
|
3992
|
-
this.assertRelatedHandoffSnapshotReadable(snapshot, actor);
|
|
3993
|
-
if (snapshot.scope !== input.scope) throw new Error("Related handoff snapshot scope must match the HITL request scope.");
|
|
3994
|
-
}
|
|
3995
|
-
const request = await this.repository.create({
|
|
3996
|
-
scope: input.scope,
|
|
3997
|
-
actionType: input.actionType,
|
|
3998
|
-
title: input.title,
|
|
3999
|
-
summary: input.summary,
|
|
4000
|
-
riskReason: input.riskReason,
|
|
4001
|
-
reviewPayload: input.reviewPayload,
|
|
4002
|
-
targetRefType: input.targetRefType,
|
|
4003
|
-
targetRefId: input.targetRefId,
|
|
4004
|
-
requestedByActorType: actor.actorType,
|
|
4005
|
-
requestedByActorId: actor.actorId,
|
|
4006
|
-
requestedAuthMetadata: actor.authMetadata,
|
|
4007
|
-
priority: input.priority,
|
|
4008
|
-
metadata: input.metadata,
|
|
4009
|
-
relatedAssignmentId: input.relatedAssignmentId,
|
|
4010
|
-
relatedHandoffSnapshotId: input.relatedHandoffSnapshotId,
|
|
4011
|
-
slaDueAt: input.slaDueAt,
|
|
4012
|
-
createdAt: input.createdAt
|
|
4013
|
-
});
|
|
4014
|
-
if (assignment) {
|
|
4015
|
-
if (!await this.assignments.linkHitlRequest(assignment.id, request.id, request.createdAt)) throw new Error(`Failed to link assignment ${assignment.id} to HITL request ${request.id}.`);
|
|
4016
|
-
}
|
|
4017
|
-
return request;
|
|
4018
|
-
}
|
|
4019
|
-
async get(id, actor) {
|
|
4020
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
4021
|
-
const request = await this.repository.findById(id);
|
|
4022
|
-
if (!request) return null;
|
|
4023
|
-
this.assertReadable(request, actor);
|
|
4024
|
-
return request;
|
|
4025
|
-
}
|
|
4026
|
-
async list(actor, input = {}) {
|
|
4027
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
4028
|
-
return this.repository.list(this.buildListQuery(actor, input));
|
|
4029
|
-
}
|
|
4030
|
-
async resolve(input) {
|
|
4031
|
-
assertExperimentalSiteContextWorkflowsEnabled();
|
|
4032
|
-
const request = await this.loadExisting(input.id);
|
|
4033
|
-
this.assertResolver(input.actor);
|
|
4034
|
-
this.assertReadable(request, input.actor);
|
|
4035
|
-
this.assertValidAction("resolve", request.status);
|
|
4036
|
-
const resolved = await this.repository.resolve(request.id, {
|
|
4037
|
-
decision: input.decision,
|
|
4038
|
-
resolvedByActorType: input.actor.actorType,
|
|
4039
|
-
resolvedByActorId: input.actor.actorId,
|
|
4040
|
-
resolvedAuthMetadata: input.actor.authMetadata,
|
|
4041
|
-
reviewNote: input.reviewNote,
|
|
4042
|
-
resolvedAt: input.at
|
|
4043
|
-
});
|
|
4044
|
-
if (!resolved) throw new Error(`Failed to resolve HITL request ${request.id}.`);
|
|
4045
|
-
return resolved;
|
|
4046
|
-
}
|
|
4047
|
-
buildListQuery(actor, input) {
|
|
4048
|
-
const query = {
|
|
4049
|
-
scope: input.scope,
|
|
4050
|
-
scopes: input.scopes,
|
|
4051
|
-
statuses: input.statuses,
|
|
4052
|
-
priority: input.priority,
|
|
4053
|
-
actionType: input.actionType,
|
|
4054
|
-
targetRefType: input.targetRefType,
|
|
4055
|
-
targetRefId: input.targetRefId,
|
|
4056
|
-
relatedAssignmentId: input.relatedAssignmentId,
|
|
4057
|
-
since: input.since,
|
|
4058
|
-
limit: input.limit,
|
|
4059
|
-
cursor: input.cursor
|
|
4060
|
-
};
|
|
4061
|
-
if (isHitlSupervisor(actor.userRole)) return query;
|
|
4062
|
-
return {
|
|
4063
|
-
...query,
|
|
4064
|
-
requestedByActorType: actor.actorType,
|
|
4065
|
-
requestedByActorId: actor.actorId
|
|
4066
|
-
};
|
|
4067
|
-
}
|
|
4068
|
-
async loadExisting(id) {
|
|
4069
|
-
const request = await this.repository.findById(id);
|
|
4070
|
-
if (!request) throw new Error(`HITL request not found: ${id}`);
|
|
4071
|
-
return request;
|
|
4072
|
-
}
|
|
4073
|
-
assertReadable(request, actor) {
|
|
4074
|
-
if (isHitlSupervisor(actor.userRole)) return;
|
|
4075
|
-
if (request.requestedByActorType === actor.actorType && request.requestedByActorId === actor.actorId) return;
|
|
4076
|
-
throw new Error("Insufficient permissions to read this HITL request.");
|
|
4077
|
-
}
|
|
4078
|
-
assertResolver(actor) {
|
|
4079
|
-
if (isHitlSupervisor(actor.userRole)) return;
|
|
4080
|
-
throw new Error("HITL requests may only be resolved by an editor or admin.");
|
|
4081
|
-
}
|
|
4082
|
-
assertRelatedAssignmentReadable(assignment, actor) {
|
|
4083
|
-
if (isHitlSupervisor(actor.userRole)) return;
|
|
4084
|
-
if (matchesActor(assignment.assignedByActorType, assignment.assignedByActorId, actor) || matchesActor(assignment.assignedToActorType, assignment.assignedToActorId, actor)) return;
|
|
4085
|
-
throw new Error("Insufficient permissions to link this assignment to a HITL request.");
|
|
4086
|
-
}
|
|
4087
|
-
assertRelatedHandoffSnapshotReadable(snapshot, actor) {
|
|
4088
|
-
if (isHitlSupervisor(actor.userRole)) return;
|
|
4089
|
-
if (matchesActor(snapshot.actorType, snapshot.actorId, actor)) return;
|
|
4090
|
-
throw new Error("Insufficient permissions to link this handoff snapshot to a HITL request.");
|
|
4091
|
-
}
|
|
4092
|
-
assertValidAction(action, status) {
|
|
4093
|
-
const validFrom = HITL_REQUEST_VALID_FROM[action];
|
|
4094
|
-
if (!validFrom.includes(status)) throw new Error(`Cannot ${action} a HITL request in status "${status}". Valid statuses: ${validFrom.join(", ")}.`);
|
|
4095
|
-
}
|
|
4096
|
-
};
|
|
4097
|
-
function isHitlSupervisor(role) {
|
|
4098
|
-
return role >= Role.EDITOR;
|
|
4099
|
-
}
|
|
4100
|
-
function matchesActor(actorType, actorId, actor) {
|
|
4101
|
-
return actorType === actor.actorType && actorId === actor.actorId;
|
|
4102
|
-
}
|
|
4103
|
-
|
|
4104
3475
|
//#endregion
|
|
4105
3476
|
//#region src/site-context/workflow-hitl.ts
|
|
4106
3477
|
var WorkflowHitlCoordinator = class {
|
|
@@ -4143,4 +3514,4 @@ var WorkflowHitlCoordinator = class {
|
|
|
4143
3514
|
};
|
|
4144
3515
|
|
|
4145
3516
|
//#endregion
|
|
4146
|
-
export {
|
|
3517
|
+
export { ReviewPayloadBuilder as _, EntityResolver as a, toPublicContextEntryPage as b, TaxonomyHitlPayloadBuilder as c, SettingsHitlPayloadBuilder as d, WordPressImportHitlPayloadBuilder as f, RiskPolicyEvaluator as g, SchemaHitlPayloadBuilder as h, ActorExpertiseService as i, MenuHitlPayloadBuilder as l, PluginHitlPayloadBuilder as m, AssignmentService as n, WidgetHitlPayloadBuilder as o, ExclusiveHookHitlPayloadBuilder as p, HandoffSnapshotStore as r, SectionHitlPayloadBuilder as s, WorkflowHitlCoordinator as t, RedirectHitlPayloadBuilder as u, toPublicContextDiff as v, toPublicContextEntry as y };
|