@truefoundry/trueforge 0.181.0-rc.3 → 0.182.0-rc.1
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/_frontend/assets/{AgentCodeSnippets-7YBGYKYT-COw5-jCA.js → AgentCodeSnippets-UW7QOW5B-EqgBGDzZ.js} +1 -1
- package/dist/_frontend/assets/AgentCodeSnippets-UW7QOW5B-EqgBGDzZ.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-UW7QOW5B-EqgBGDzZ.js.gz +0 -0
- package/dist/_frontend/assets/{AgentMetricChart-ECYBDKGM-DJTSZ671.js → AgentMetricChart-7J5H2YWO-DHIVirW7.js} +1 -1
- package/dist/_frontend/assets/AgentMetricChart-7J5H2YWO-DHIVirW7.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-7J5H2YWO-DHIVirW7.js.gz +0 -0
- package/dist/_frontend/assets/{AgentOverview-NCWC4XDZ-DqZqGo8V.js → AgentOverview-DJEQMQNN-7Xc7Rz5d.js} +1 -1
- package/dist/_frontend/assets/AgentOverview-DJEQMQNN-7Xc7Rz5d.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-DJEQMQNN-7Xc7Rz5d.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimeline-GSHWZCTN-BrVSrckq.js → AgentSessionEventTimeline-BRNZGBUQ-DMl7_UIg.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimeline-BRNZGBUQ-DMl7_UIg.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-BRNZGBUQ-DMl7_UIg.js.gz +0 -0
- package/dist/_frontend/assets/{AgentSessionEventTimelineChart-UY4YNTFB-DAeb-1-p.js → AgentSessionEventTimelineChart-ENGQRB2V-M0x25wOo.js} +1 -1
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-ENGQRB2V-M0x25wOo.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-ENGQRB2V-M0x25wOo.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-24OZP5GC-GYewquvc.js +1 -0
- package/dist/_frontend/assets/AgentSessions-24OZP5GC-GYewquvc.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-24OZP5GC-GYewquvc.js.gz +0 -0
- package/dist/_frontend/assets/{ConnectorSettings-DYJ6Z6YL-DhF84SXP.js → ConnectorSettings-OZ3GFHXG-DfSpd_Np.js} +1 -1
- package/dist/_frontend/assets/ConnectorSettings-OZ3GFHXG-DfSpd_Np.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-OZ3GFHXG-DfSpd_Np.js.gz +0 -0
- package/dist/_frontend/assets/{DockLayout-YZPEWKJV-DyDyUCtl.js → DockLayout-PYHG42F6-DVJjU0jJ.js} +1 -1
- package/dist/_frontend/assets/{DrawerLayout-OWUKLUSV-DQnh_BPt.js → DrawerLayout-O72FXNZO-BkNx2uHv.js} +2 -2
- package/dist/_frontend/assets/DrawerLayout-O72FXNZO-BkNx2uHv.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-O72FXNZO-BkNx2uHv.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-NAZBFBQT-SBGlSViD.js +3 -0
- package/dist/_frontend/assets/EnvironmentsPage-NAZBFBQT-SBGlSViD.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-NAZBFBQT-SBGlSViD.js.gz +0 -0
- package/dist/_frontend/assets/{ModelSettings-Y5NTNBCL-BFS8Ev0r.js → ModelSettings-ZWT7TGFN-BBYWJ3Ta.js} +1 -1
- package/dist/_frontend/assets/ModelSettings-ZWT7TGFN-BBYWJ3Ta.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-ZWT7TGFN-BBYWJ3Ta.js.gz +0 -0
- package/dist/_frontend/assets/{SandboxSettings-KLDK6WZH-BB_J0XaX.js → SandboxSettings-3WIDF45O-Cxpj-eYN.js} +1 -1
- package/dist/_frontend/assets/SandboxSettings-3WIDF45O-Cxpj-eYN.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-3WIDF45O-Cxpj-eYN.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-YEK64CQ6-i-bUCLKe.js +1 -0
- package/dist/_frontend/assets/SchedulesPage-YEK64CQ6-i-bUCLKe.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-YEK64CQ6-i-bUCLKe.js.gz +0 -0
- package/dist/_frontend/assets/{SettingsBuilder-72KREKYT-Dmu76Wzi.js → SettingsBuilder-VILEXCSN-D-T9vERO.js} +2 -2
- package/dist/_frontend/assets/SettingsBuilder-VILEXCSN-D-T9vERO.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-VILEXCSN-D-T9vERO.js.gz +0 -0
- package/dist/_frontend/assets/{ShellRouteSync-G2PJ3G3L-C4RD0M9w.js → ShellRouteSync-SBVWQTZG-Bs5nBE4Z.js} +1 -1
- package/dist/_frontend/assets/ShellRouteSync-SBVWQTZG-Bs5nBE4Z.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-SBVWQTZG-Bs5nBE4Z.js.gz +0 -0
- package/dist/_frontend/assets/{SidebarLayout-BWR7N76R-B3Zm0kWX.js → SidebarLayout-JY44CYXN-p3u7KIAo.js} +2 -2
- package/dist/_frontend/assets/SidebarLayout-JY44CYXN-p3u7KIAo.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-JY44CYXN-p3u7KIAo.js.gz +0 -0
- package/dist/_frontend/assets/{SkillSettings-F7X7TZII-DYRS-1zQ.js → SkillSettings-K4WJCR62-CNzx6UbS.js} +1 -1
- package/dist/_frontend/assets/SkillSettings-K4WJCR62-CNzx6UbS.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-K4WJCR62-CNzx6UbS.js.gz +0 -0
- package/dist/_frontend/assets/{TrueForgeUIWithRouter-KPZEEO7D-BAuDAM4m.js → TrueForgeUIWithRouter-OYA7ZHNK-u0Js8wsV.js} +1 -1
- package/dist/_frontend/assets/{WebSearchSettings-VNL63UFQ-BL3QLgS_.js → WebSearchSettings-ZGPDUWYH-4OwN9pdf.js} +1 -1
- package/dist/_frontend/assets/WebSearchSettings-ZGPDUWYH-4OwN9pdf.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-ZGPDUWYH-4OwN9pdf.js.gz +0 -0
- package/dist/_frontend/assets/{WidgetLayout-5E2MCZOP-BXKkzHl9.js → WidgetLayout-R4JRDNUC-87iJC6yD.js} +1 -1
- package/dist/_frontend/assets/WidgetLayout-R4JRDNUC-87iJC6yD.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-R4JRDNUC-87iJC6yD.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-XIE7TJW5-C05XSTa4.js → chunk-A4CJJLJF-Bw0z3xJ5.js} +1 -1
- package/dist/_frontend/assets/chunk-A4CJJLJF-Bw0z3xJ5.js.br +0 -0
- package/dist/_frontend/assets/chunk-A4CJJLJF-Bw0z3xJ5.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-QYZB5BFZ-C1Zl8SCi.js → chunk-FYNMX2CR-D3kVOgbp.js} +2 -2
- package/dist/_frontend/assets/chunk-FYNMX2CR-D3kVOgbp.js.br +0 -0
- package/dist/_frontend/assets/chunk-FYNMX2CR-D3kVOgbp.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-OB3PAWPO-CDXWnkeP.js → chunk-OB3PAWPO-BlPPT6Yp.js} +1 -1
- package/dist/_frontend/assets/chunk-OB3PAWPO-BlPPT6Yp.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-BlPPT6Yp.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-NRMAG6HF-BKTcpJl0.js → chunk-U4N5YOLH-DtE2uffK.js} +1 -1
- package/dist/_frontend/assets/chunk-U4N5YOLH-DtE2uffK.js.br +0 -0
- package/dist/_frontend/assets/chunk-U4N5YOLH-DtE2uffK.js.gz +0 -0
- package/dist/_frontend/assets/{chunk-HB2ZQ4CZ-DnCTK9KS.js → chunk-YAEHWUGN-DPMKZDpC.js} +1 -1
- package/dist/_frontend/assets/{cssMode-XDzIuvZX.js → cssMode-DvTO9XkN.js} +1 -1
- package/dist/_frontend/assets/cssMode-DvTO9XkN.js.br +0 -0
- package/dist/_frontend/assets/cssMode-DvTO9XkN.js.gz +0 -0
- package/dist/_frontend/assets/{freemarker2-CMM6eRZY.js → freemarker2-aFzp34Uk.js} +1 -1
- package/dist/_frontend/assets/freemarker2-aFzp34Uk.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-aFzp34Uk.js.gz +0 -0
- package/dist/_frontend/assets/{handlebars-zWdybys2.js → handlebars-DAOUiLWh.js} +1 -1
- package/dist/_frontend/assets/handlebars-DAOUiLWh.js.br +0 -0
- package/dist/_frontend/assets/handlebars-DAOUiLWh.js.gz +0 -0
- package/dist/_frontend/assets/{html-FSsE5b6P.js → html-DfXOIhRa.js} +1 -1
- package/dist/_frontend/assets/html-DfXOIhRa.js.br +0 -0
- package/dist/_frontend/assets/html-DfXOIhRa.js.gz +0 -0
- package/dist/_frontend/assets/{htmlMode-Ba0OQ7ke.js → htmlMode-CCOUuXx1.js} +1 -1
- package/dist/_frontend/assets/htmlMode-CCOUuXx1.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-CCOUuXx1.js.gz +0 -0
- package/dist/_frontend/assets/{index-CHtf87eT.js → index-MgP9Dpwg.js} +267 -262
- package/dist/_frontend/assets/index-MgP9Dpwg.js.br +0 -0
- package/dist/_frontend/assets/index-MgP9Dpwg.js.gz +0 -0
- package/dist/_frontend/assets/{index-DJwMhvnU.js → index-c1YEABD8.js} +3 -3
- package/dist/_frontend/assets/index-c1YEABD8.js.br +0 -0
- package/dist/_frontend/assets/index-c1YEABD8.js.gz +0 -0
- package/dist/_frontend/assets/{javascript-Ce1crFvb.js → javascript-Cx1s-OSZ.js} +1 -1
- package/dist/_frontend/assets/{jsonMode-BMBeYqZi.js → jsonMode-DAQPJSYx.js} +1 -1
- package/dist/_frontend/assets/jsonMode-DAQPJSYx.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-DAQPJSYx.js.gz +0 -0
- package/dist/_frontend/assets/{liquid-cKR-cSWX.js → liquid-X5sOGYxF.js} +1 -1
- package/dist/_frontend/assets/liquid-X5sOGYxF.js.br +0 -0
- package/dist/_frontend/assets/liquid-X5sOGYxF.js.gz +0 -0
- package/dist/_frontend/assets/{lspLanguageFeatures-RvCvbT7h.js → lspLanguageFeatures-DbaAIvtN.js} +1 -1
- package/dist/_frontend/assets/lspLanguageFeatures-DbaAIvtN.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-DbaAIvtN.js.gz +0 -0
- package/dist/_frontend/assets/{mdx-DWyx_s0A.js → mdx-zIgBqqoA.js} +1 -1
- package/dist/_frontend/assets/mdx-zIgBqqoA.js.br +0 -0
- package/dist/_frontend/assets/mdx-zIgBqqoA.js.gz +0 -0
- package/dist/_frontend/assets/{python-BZT89b5u.js → python-B_gBFbpk.js} +1 -1
- package/dist/_frontend/assets/python-B_gBFbpk.js.br +0 -0
- package/dist/_frontend/assets/python-B_gBFbpk.js.gz +0 -0
- package/dist/_frontend/assets/{razor-C4RJ85c7.js → razor-BC7GwqIo.js} +1 -1
- package/dist/_frontend/assets/razor-BC7GwqIo.js.br +0 -0
- package/dist/_frontend/assets/razor-BC7GwqIo.js.gz +0 -0
- package/dist/_frontend/assets/{tsMode-BFOytUIs.js → tsMode-BTgLZVy9.js} +1 -1
- package/dist/_frontend/assets/tsMode-BTgLZVy9.js.br +0 -0
- package/dist/_frontend/assets/tsMode-BTgLZVy9.js.gz +0 -0
- package/dist/_frontend/assets/{typescript-B_aWPfCP.js → typescript-qLW7oNqI.js} +1 -1
- package/dist/_frontend/assets/typescript-qLW7oNqI.js.br +0 -0
- package/dist/_frontend/assets/typescript-qLW7oNqI.js.gz +0 -0
- package/dist/_frontend/assets/{workers-DhT6ONBN.js → workers-ZErPPocS.js} +1 -1
- package/dist/_frontend/assets/workers-ZErPPocS.js.br +0 -0
- package/dist/_frontend/assets/workers-ZErPPocS.js.gz +0 -0
- package/dist/_frontend/assets/{xml-CIXW7ba5.js → xml-B1nIp6O9.js} +1 -1
- package/dist/_frontend/assets/xml-B1nIp6O9.js.br +0 -0
- package/dist/_frontend/assets/xml-B1nIp6O9.js.gz +0 -0
- package/dist/_frontend/assets/{yaml-B06RGyXK.js → yaml-B0Wyc9_Y.js} +1 -1
- package/dist/_frontend/assets/yaml-B0Wyc9_Y.js.br +0 -0
- package/dist/_frontend/assets/yaml-B0Wyc9_Y.js.gz +0 -0
- package/dist/_frontend/index.html +1 -1
- package/dist/main.js +805 -294
- package/dist/main.js.map +1 -1
- package/dist/postgres/migrations/20260831_000001_session_external_id.js.map +1 -1
- package/dist/postgres/migrations/20260902_000002_agent_external_id.js.map +1 -1
- package/dist/postgres/migrations/20260903_000002_created_by_subject.js.map +1 -1
- package/dist/postgres/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
- package/dist/postgres/migrations/20260904_000002_session_source.js.map +1 -1
- package/dist/postgres/migrations/20260904_000003_session_metadata_gin.js.map +1 -1
- package/dist/postgres/migrations/20260926_000001_sandbox_environment.js.map +1 -1
- package/dist/postgres/migrations/20260930_000001_sandbox_environment_secret.js.map +1 -1
- package/dist/postgres/migrations/20261022_000001_drop_session_last_turn_id.js +16 -0
- package/dist/postgres/migrations/20261022_000001_drop_session_last_turn_id.js.map +1 -0
- package/dist/postgres/migrations/20261027_000001_access_control.js +21 -0
- package/dist/postgres/migrations/20261027_000001_access_control.js.map +1 -0
- package/dist/postgres/migrations/20261028_000001_session_tfg_source_backfill.js +21 -0
- package/dist/postgres/migrations/20261028_000001_session_tfg_source_backfill.js.map +1 -0
- package/dist/postgres/migrations/20261028_000002_session_tfg_source_list_idx.js +29 -0
- package/dist/postgres/migrations/20261028_000002_session_tfg_source_list_idx.js.map +1 -0
- package/dist/sqlite/migrations/20260831_000001_session_external_id.js.map +1 -1
- package/dist/sqlite/migrations/20260902_000001_session_metadata.js.map +1 -1
- package/dist/sqlite/migrations/20260902_000002_agent_external_id.js.map +1 -1
- package/dist/sqlite/migrations/20260903_000001_drop_agent_metadata.js.map +1 -1
- package/dist/sqlite/migrations/20260903_000002_created_by_subject.js.map +1 -1
- package/dist/sqlite/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
- package/dist/sqlite/migrations/20260904_000002_session_source.js.map +1 -1
- package/dist/sqlite/migrations/20260926_000001_sandbox_environment.js.map +1 -1
- package/dist/sqlite/migrations/20260930_000001_sandbox_environment_secret.js.map +1 -1
- package/dist/sqlite/migrations/20261022_000001_drop_session_last_turn_id.js +22 -0
- package/dist/sqlite/migrations/20261022_000001_drop_session_last_turn_id.js.map +1 -0
- package/dist/sqlite/migrations/20261027_000001_access_control.js +27 -0
- package/dist/sqlite/migrations/20261027_000001_access_control.js.map +1 -0
- package/dist/sqlite/migrations/20261028_000001_session_tfg_source_backfill.js +22 -0
- package/dist/sqlite/migrations/20261028_000001_session_tfg_source_backfill.js.map +1 -0
- package/dist/sqlite/migrations/20261028_000002_session_tfg_source_list_idx.js +31 -0
- package/dist/sqlite/migrations/20261028_000002_session_tfg_source_list_idx.js.map +1 -0
- package/package.json +4 -4
- package/dist/_frontend/assets/AgentCodeSnippets-7YBGYKYT-COw5-jCA.js.br +0 -0
- package/dist/_frontend/assets/AgentCodeSnippets-7YBGYKYT-COw5-jCA.js.gz +0 -0
- package/dist/_frontend/assets/AgentMetricChart-ECYBDKGM-DJTSZ671.js.br +0 -0
- package/dist/_frontend/assets/AgentMetricChart-ECYBDKGM-DJTSZ671.js.gz +0 -0
- package/dist/_frontend/assets/AgentOverview-NCWC4XDZ-DqZqGo8V.js.br +0 -0
- package/dist/_frontend/assets/AgentOverview-NCWC4XDZ-DqZqGo8V.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-GSHWZCTN-BrVSrckq.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimeline-GSHWZCTN-BrVSrckq.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-UY4YNTFB-DAeb-1-p.js.br +0 -0
- package/dist/_frontend/assets/AgentSessionEventTimelineChart-UY4YNTFB-DAeb-1-p.js.gz +0 -0
- package/dist/_frontend/assets/AgentSessions-V2V6W7CC-D1eUhvgn.js +0 -1
- package/dist/_frontend/assets/AgentSessions-V2V6W7CC-D1eUhvgn.js.br +0 -0
- package/dist/_frontend/assets/AgentSessions-V2V6W7CC-D1eUhvgn.js.gz +0 -0
- package/dist/_frontend/assets/ConnectorSettings-DYJ6Z6YL-DhF84SXP.js.br +0 -0
- package/dist/_frontend/assets/ConnectorSettings-DYJ6Z6YL-DhF84SXP.js.gz +0 -0
- package/dist/_frontend/assets/DrawerLayout-OWUKLUSV-DQnh_BPt.js.br +0 -0
- package/dist/_frontend/assets/DrawerLayout-OWUKLUSV-DQnh_BPt.js.gz +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-KOMO4W53-DT8-DDE7.js +0 -3
- package/dist/_frontend/assets/EnvironmentsPage-KOMO4W53-DT8-DDE7.js.br +0 -0
- package/dist/_frontend/assets/EnvironmentsPage-KOMO4W53-DT8-DDE7.js.gz +0 -0
- package/dist/_frontend/assets/ModelSettings-Y5NTNBCL-BFS8Ev0r.js.br +0 -0
- package/dist/_frontend/assets/ModelSettings-Y5NTNBCL-BFS8Ev0r.js.gz +0 -0
- package/dist/_frontend/assets/SandboxSettings-KLDK6WZH-BB_J0XaX.js.br +0 -0
- package/dist/_frontend/assets/SandboxSettings-KLDK6WZH-BB_J0XaX.js.gz +0 -0
- package/dist/_frontend/assets/SchedulesPage-4F5FX65T-DVKEEd4R.js +0 -1
- package/dist/_frontend/assets/SchedulesPage-4F5FX65T-DVKEEd4R.js.br +0 -0
- package/dist/_frontend/assets/SchedulesPage-4F5FX65T-DVKEEd4R.js.gz +0 -0
- package/dist/_frontend/assets/SettingsBuilder-72KREKYT-Dmu76Wzi.js.br +0 -0
- package/dist/_frontend/assets/SettingsBuilder-72KREKYT-Dmu76Wzi.js.gz +0 -0
- package/dist/_frontend/assets/ShellRouteSync-G2PJ3G3L-C4RD0M9w.js.br +0 -0
- package/dist/_frontend/assets/ShellRouteSync-G2PJ3G3L-C4RD0M9w.js.gz +0 -0
- package/dist/_frontend/assets/SidebarLayout-BWR7N76R-B3Zm0kWX.js.br +0 -0
- package/dist/_frontend/assets/SidebarLayout-BWR7N76R-B3Zm0kWX.js.gz +0 -0
- package/dist/_frontend/assets/SkillSettings-F7X7TZII-DYRS-1zQ.js.br +0 -0
- package/dist/_frontend/assets/SkillSettings-F7X7TZII-DYRS-1zQ.js.gz +0 -0
- package/dist/_frontend/assets/WebSearchSettings-VNL63UFQ-BL3QLgS_.js.br +0 -0
- package/dist/_frontend/assets/WebSearchSettings-VNL63UFQ-BL3QLgS_.js.gz +0 -0
- package/dist/_frontend/assets/WidgetLayout-5E2MCZOP-BXKkzHl9.js.br +0 -0
- package/dist/_frontend/assets/WidgetLayout-5E2MCZOP-BXKkzHl9.js.gz +0 -0
- package/dist/_frontend/assets/chunk-NRMAG6HF-BKTcpJl0.js.br +0 -0
- package/dist/_frontend/assets/chunk-NRMAG6HF-BKTcpJl0.js.gz +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-CDXWnkeP.js.br +0 -0
- package/dist/_frontend/assets/chunk-OB3PAWPO-CDXWnkeP.js.gz +0 -0
- package/dist/_frontend/assets/chunk-QYZB5BFZ-C1Zl8SCi.js.br +0 -0
- package/dist/_frontend/assets/chunk-QYZB5BFZ-C1Zl8SCi.js.gz +0 -0
- package/dist/_frontend/assets/chunk-XIE7TJW5-C05XSTa4.js.br +0 -0
- package/dist/_frontend/assets/chunk-XIE7TJW5-C05XSTa4.js.gz +0 -0
- package/dist/_frontend/assets/cssMode-XDzIuvZX.js.br +0 -6
- package/dist/_frontend/assets/cssMode-XDzIuvZX.js.gz +0 -0
- package/dist/_frontend/assets/freemarker2-CMM6eRZY.js.br +0 -0
- package/dist/_frontend/assets/freemarker2-CMM6eRZY.js.gz +0 -0
- package/dist/_frontend/assets/handlebars-zWdybys2.js.br +0 -0
- package/dist/_frontend/assets/handlebars-zWdybys2.js.gz +0 -0
- package/dist/_frontend/assets/html-FSsE5b6P.js.br +0 -0
- package/dist/_frontend/assets/html-FSsE5b6P.js.gz +0 -0
- package/dist/_frontend/assets/htmlMode-Ba0OQ7ke.js.br +0 -0
- package/dist/_frontend/assets/htmlMode-Ba0OQ7ke.js.gz +0 -0
- package/dist/_frontend/assets/index-CHtf87eT.js.br +0 -0
- package/dist/_frontend/assets/index-CHtf87eT.js.gz +0 -0
- package/dist/_frontend/assets/index-DJwMhvnU.js.br +0 -0
- package/dist/_frontend/assets/index-DJwMhvnU.js.gz +0 -0
- package/dist/_frontend/assets/jsonMode-BMBeYqZi.js.br +0 -0
- package/dist/_frontend/assets/jsonMode-BMBeYqZi.js.gz +0 -0
- package/dist/_frontend/assets/liquid-cKR-cSWX.js.br +0 -0
- package/dist/_frontend/assets/liquid-cKR-cSWX.js.gz +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-RvCvbT7h.js.br +0 -0
- package/dist/_frontend/assets/lspLanguageFeatures-RvCvbT7h.js.gz +0 -0
- package/dist/_frontend/assets/mdx-DWyx_s0A.js.br +0 -0
- package/dist/_frontend/assets/mdx-DWyx_s0A.js.gz +0 -0
- package/dist/_frontend/assets/python-BZT89b5u.js.br +0 -0
- package/dist/_frontend/assets/python-BZT89b5u.js.gz +0 -0
- package/dist/_frontend/assets/razor-C4RJ85c7.js.br +0 -0
- package/dist/_frontend/assets/razor-C4RJ85c7.js.gz +0 -0
- package/dist/_frontend/assets/tsMode-BFOytUIs.js.br +0 -0
- package/dist/_frontend/assets/tsMode-BFOytUIs.js.gz +0 -0
- package/dist/_frontend/assets/typescript-B_aWPfCP.js.br +0 -0
- package/dist/_frontend/assets/typescript-B_aWPfCP.js.gz +0 -0
- package/dist/_frontend/assets/workers-DhT6ONBN.js.br +0 -0
- package/dist/_frontend/assets/workers-DhT6ONBN.js.gz +0 -0
- package/dist/_frontend/assets/xml-CIXW7ba5.js.br +0 -0
- package/dist/_frontend/assets/xml-CIXW7ba5.js.gz +0 -0
- package/dist/_frontend/assets/yaml-B06RGyXK.js.br +0 -0
- package/dist/_frontend/assets/yaml-B06RGyXK.js.gz +0 -0
package/dist/main.js
CHANGED
|
@@ -3567,7 +3567,7 @@ var init_skillStore = __esm({
|
|
|
3567
3567
|
});
|
|
3568
3568
|
|
|
3569
3569
|
// src/db/gitSkillMounts.ts
|
|
3570
|
-
import { HTTPException as
|
|
3570
|
+
import { HTTPException as HTTPException23 } from "hono/http-exception";
|
|
3571
3571
|
async function validateGitAgentSkills(store, input) {
|
|
3572
3572
|
const { tenant_id, skills } = input;
|
|
3573
3573
|
if (skills.length === 0) {
|
|
@@ -3575,7 +3575,7 @@ async function validateGitAgentSkills(store, input) {
|
|
|
3575
3575
|
}
|
|
3576
3576
|
for (const skill of skills) {
|
|
3577
3577
|
if (skill.preload) {
|
|
3578
|
-
throw new
|
|
3578
|
+
throw new HTTPException23(422, {
|
|
3579
3579
|
message: `Skill "${skill.name}": preload is not supported for git skills`
|
|
3580
3580
|
});
|
|
3581
3581
|
}
|
|
@@ -3585,12 +3585,12 @@ async function validateGitAgentSkills(store, input) {
|
|
|
3585
3585
|
for (const skill of skills) {
|
|
3586
3586
|
const record = byName.get(skill.name);
|
|
3587
3587
|
if (record === void 0) {
|
|
3588
|
-
throw new
|
|
3588
|
+
throw new HTTPException23(422, {
|
|
3589
3589
|
message: `Unknown skill "${skill.name}" \u2014 not configured`
|
|
3590
3590
|
});
|
|
3591
3591
|
}
|
|
3592
3592
|
if (record.manifest.type !== "git") {
|
|
3593
|
-
throw new
|
|
3593
|
+
throw new HTTPException23(422, {
|
|
3594
3594
|
message: `Skill "${skill.name}" is not a git skill`
|
|
3595
3595
|
});
|
|
3596
3596
|
}
|
|
@@ -3608,13 +3608,13 @@ async function resolveGitTurnSkills(store, input) {
|
|
|
3608
3608
|
for (const skill of skills) {
|
|
3609
3609
|
const record = byName.get(skill.name);
|
|
3610
3610
|
if (record === void 0) {
|
|
3611
|
-
throw new
|
|
3611
|
+
throw new HTTPException23(422, {
|
|
3612
3612
|
message: `Unknown skill "${skill.name}" \u2014 not configured`
|
|
3613
3613
|
});
|
|
3614
3614
|
}
|
|
3615
3615
|
const git = parseGitSkill(record.manifest);
|
|
3616
3616
|
if (git === void 0) {
|
|
3617
|
-
throw new
|
|
3617
|
+
throw new HTTPException23(422, {
|
|
3618
3618
|
message: `Skill "${skill.name}" is not a git skill`
|
|
3619
3619
|
});
|
|
3620
3620
|
}
|
|
@@ -3778,9 +3778,9 @@ var PostgresAgentStore_exports = {};
|
|
|
3778
3778
|
__export(PostgresAgentStore_exports, {
|
|
3779
3779
|
PostgresAgentStore: () => PostgresAgentStore
|
|
3780
3780
|
});
|
|
3781
|
-
import { CreatedBySubjectSchema as
|
|
3781
|
+
import { CreatedBySubjectSchema as CreatedBySubjectSchema5 } from "@truefoundry/trueforge-core/agent-session";
|
|
3782
3782
|
import {
|
|
3783
|
-
decodeOffsetPageToken,
|
|
3783
|
+
decodeOffsetPageToken as decodeOffsetPageToken2,
|
|
3784
3784
|
paginateOffsetRows
|
|
3785
3785
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
3786
3786
|
import { sql as sql2 } from "kysely";
|
|
@@ -3792,7 +3792,7 @@ function toRecord(row) {
|
|
|
3792
3792
|
description: row.description,
|
|
3793
3793
|
manifest: parseStoredAgentSpec(row.manifest),
|
|
3794
3794
|
external_id: row.external_id,
|
|
3795
|
-
created_by_subject:
|
|
3795
|
+
created_by_subject: CreatedBySubjectSchema5.parse(row.created_by_subject),
|
|
3796
3796
|
created_at: row.created_at.toISOString(),
|
|
3797
3797
|
updated_at: row.updated_at.toISOString()
|
|
3798
3798
|
};
|
|
@@ -3867,7 +3867,7 @@ var init_PostgresAgentStore = __esm({
|
|
|
3867
3867
|
const data2 = rows2.map(toRecord);
|
|
3868
3868
|
return { data: data2, pagination: { limit: data2.length } };
|
|
3869
3869
|
}
|
|
3870
|
-
const offset =
|
|
3870
|
+
const offset = decodeOffsetPageToken2(input.page_token);
|
|
3871
3871
|
const rows = await query.limit(input.limit + 1).offset(offset).execute();
|
|
3872
3872
|
const { data, pagination } = paginateOffsetRows(rows, input.limit, offset);
|
|
3873
3873
|
return { data: data.map(toRecord), pagination };
|
|
@@ -4108,6 +4108,7 @@ var init_client2 = __esm({
|
|
|
4108
4108
|
"token",
|
|
4109
4109
|
"auth_data",
|
|
4110
4110
|
"created_by_subject",
|
|
4111
|
+
"granted_by_subject",
|
|
4111
4112
|
"source",
|
|
4112
4113
|
// sandbox_environment ↔ version join aliases
|
|
4113
4114
|
"ver_manifest",
|
|
@@ -4416,12 +4417,11 @@ async function assembleTurnRecord(db, args) {
|
|
|
4416
4417
|
async function createTurn(db, input) {
|
|
4417
4418
|
try {
|
|
4418
4419
|
await db.transaction().execute(async (trx) => {
|
|
4419
|
-
const locked = await trx.selectFrom("session").select(["
|
|
4420
|
+
const locked = await trx.selectFrom("session").select(["session_id"]).where("session_id", "=", input.session_id).executeTakeFirst();
|
|
4420
4421
|
if (!locked) {
|
|
4421
4422
|
throw new SessionNotFoundError(input.session_id);
|
|
4422
4423
|
}
|
|
4423
4424
|
let sessionUpdate = trx.updateTable("session").set({
|
|
4424
|
-
last_turn_id: input.turn.turn_id,
|
|
4425
4425
|
last_turn_details: lastTurnDetails({ turn_id: input.turn.turn_id, turn_state: input.turn.state }),
|
|
4426
4426
|
updated_at: nowIso(),
|
|
4427
4427
|
last_activity_timestamp_ms: input.last_activity_timestamp_ms,
|
|
@@ -4826,7 +4826,7 @@ var init_capabilities = __esm({
|
|
|
4826
4826
|
|
|
4827
4827
|
// src/db/sqlite/session-store/queries/events.ts
|
|
4828
4828
|
import {
|
|
4829
|
-
decodeOffsetPageToken as
|
|
4829
|
+
decodeOffsetPageToken as decodeOffsetPageToken3,
|
|
4830
4830
|
paginateOffsetRows as paginateOffsetRows2
|
|
4831
4831
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
4832
4832
|
import {
|
|
@@ -4862,7 +4862,7 @@ async function appendToEvents(db, input) {
|
|
|
4862
4862
|
});
|
|
4863
4863
|
}
|
|
4864
4864
|
async function listTurnEvents(db, input) {
|
|
4865
|
-
const offset =
|
|
4865
|
+
const offset = decodeOffsetPageToken3(input.page_token);
|
|
4866
4866
|
const limit = input.limit;
|
|
4867
4867
|
const eventOrder = input.order === "desc" ? "desc" : "asc";
|
|
4868
4868
|
const rows = await db.selectFrom("turn as t").leftJoin(
|
|
@@ -4903,7 +4903,7 @@ async function resolveAncestorChain(db, sessionId, anchor) {
|
|
|
4903
4903
|
}
|
|
4904
4904
|
async function listSessionEvents(db, input) {
|
|
4905
4905
|
const limit = input.limit;
|
|
4906
|
-
const session = await db.selectFrom("session").select("last_turn_id").where("session_id", "=", input.session_id).executeTakeFirst();
|
|
4906
|
+
const session = await db.selectFrom("session").select(sql7`json_extract(last_turn_details, '$.id')`.as("last_turn_id")).where("session_id", "=", input.session_id).executeTakeFirst();
|
|
4907
4907
|
if (!session) {
|
|
4908
4908
|
throw new SessionNotFoundError2(input.session_id);
|
|
4909
4909
|
}
|
|
@@ -5061,7 +5061,7 @@ var init_sessionAgentColumns = __esm({
|
|
|
5061
5061
|
|
|
5062
5062
|
// src/db/sqlite/session-store/queries/sessions.ts
|
|
5063
5063
|
import {
|
|
5064
|
-
CreatedBySubjectSchema as
|
|
5064
|
+
CreatedBySubjectSchema as CreatedBySubjectSchema6,
|
|
5065
5065
|
SessionLastTurnDetailsSchema as SessionLastTurnDetailsSchema2,
|
|
5066
5066
|
SessionMetadataSchema as SessionMetadataSchema2,
|
|
5067
5067
|
SessionSourceSchema
|
|
@@ -5096,7 +5096,7 @@ function mapRowToSessionRecord(row) {
|
|
|
5096
5096
|
return {
|
|
5097
5097
|
tenant_id: row.tenant_id,
|
|
5098
5098
|
session_id: row.session_id,
|
|
5099
|
-
created_by_subject:
|
|
5099
|
+
created_by_subject: CreatedBySubjectSchema6.parse(row.created_by_subject),
|
|
5100
5100
|
source: SessionSourceSchema.nullable().parse(row.source),
|
|
5101
5101
|
agent: sessionAgentFromColumns({
|
|
5102
5102
|
session_id: row.session_id,
|
|
@@ -5106,7 +5106,6 @@ function mapRowToSessionRecord(row) {
|
|
|
5106
5106
|
}),
|
|
5107
5107
|
title: row.title,
|
|
5108
5108
|
shared: row.shared !== 0,
|
|
5109
|
-
last_turn_id: row.last_turn_id,
|
|
5110
5109
|
last_turn_details: SessionLastTurnDetailsSchema2.nullable().parse(row.last_turn_details),
|
|
5111
5110
|
external_id: row.external_id,
|
|
5112
5111
|
custom: parseSessionCustom(row.custom),
|
|
@@ -5128,7 +5127,6 @@ function sessionSelectColumns() {
|
|
|
5128
5127
|
jsonText(sql8.ref("agent_spec")).as("agent_spec"),
|
|
5129
5128
|
"title",
|
|
5130
5129
|
"shared",
|
|
5131
|
-
"last_turn_id",
|
|
5132
5130
|
jsonText(sql8.ref("last_turn_details")).as("last_turn_details"),
|
|
5133
5131
|
"external_id",
|
|
5134
5132
|
jsonText(sql8.ref("custom")).as("custom"),
|
|
@@ -5574,8 +5572,8 @@ __export(SqliteSessionStore_exports, {
|
|
|
5574
5572
|
SqliteSessionStore: () => SqliteSessionStore
|
|
5575
5573
|
});
|
|
5576
5574
|
import {
|
|
5577
|
-
decodeOffsetPageToken as
|
|
5578
|
-
encodeOffsetPageToken as
|
|
5575
|
+
decodeOffsetPageToken as decodeOffsetPageToken4,
|
|
5576
|
+
encodeOffsetPageToken as encodeOffsetPageToken3
|
|
5579
5577
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
5580
5578
|
var SqliteSessionStore;
|
|
5581
5579
|
var init_SqliteSessionStore = __esm({
|
|
@@ -5653,7 +5651,7 @@ var init_SqliteSessionStore = __esm({
|
|
|
5653
5651
|
return getTurn(this.db, input);
|
|
5654
5652
|
}
|
|
5655
5653
|
async listTurns(input) {
|
|
5656
|
-
const offset =
|
|
5654
|
+
const offset = decodeOffsetPageToken4(input.page_token);
|
|
5657
5655
|
const result = await listTurns(this.db, {
|
|
5658
5656
|
session_id: input.session_id,
|
|
5659
5657
|
limit: input.limit,
|
|
@@ -5661,10 +5659,10 @@ var init_SqliteSessionStore = __esm({
|
|
|
5661
5659
|
});
|
|
5662
5660
|
const pagination = { limit: input.limit };
|
|
5663
5661
|
if (result.next_offset !== null) {
|
|
5664
|
-
pagination.next_page_token =
|
|
5662
|
+
pagination.next_page_token = encodeOffsetPageToken3(result.next_offset);
|
|
5665
5663
|
}
|
|
5666
5664
|
if (offset > 0) {
|
|
5667
|
-
pagination.previous_page_token =
|
|
5665
|
+
pagination.previous_page_token = encodeOffsetPageToken3(Math.max(0, offset - input.limit));
|
|
5668
5666
|
}
|
|
5669
5667
|
return { data: result.turns, pagination };
|
|
5670
5668
|
}
|
|
@@ -6332,10 +6330,10 @@ __export(SqliteAgentStore_exports, {
|
|
|
6332
6330
|
SqliteAgentStore: () => SqliteAgentStore
|
|
6333
6331
|
});
|
|
6334
6332
|
import {
|
|
6335
|
-
CreatedBySubjectSchema as
|
|
6333
|
+
CreatedBySubjectSchema as CreatedBySubjectSchema7
|
|
6336
6334
|
} from "@truefoundry/trueforge-core/agent-session";
|
|
6337
6335
|
import {
|
|
6338
|
-
decodeOffsetPageToken as
|
|
6336
|
+
decodeOffsetPageToken as decodeOffsetPageToken5,
|
|
6339
6337
|
paginateOffsetRows as paginateOffsetRows3
|
|
6340
6338
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
6341
6339
|
import { sql as sql13 } from "kysely";
|
|
@@ -6356,7 +6354,7 @@ function toRecord3(row) {
|
|
|
6356
6354
|
return {
|
|
6357
6355
|
...row,
|
|
6358
6356
|
manifest: parseStoredAgentSpec(row.manifest),
|
|
6359
|
-
created_by_subject:
|
|
6357
|
+
created_by_subject: CreatedBySubjectSchema7.parse(row.created_by_subject)
|
|
6360
6358
|
};
|
|
6361
6359
|
}
|
|
6362
6360
|
function catalogUsagePairs2({ entity, tenant_id }) {
|
|
@@ -6417,7 +6415,7 @@ var init_SqliteAgentStore = __esm({
|
|
|
6417
6415
|
const data2 = rows2.map(toRecord3);
|
|
6418
6416
|
return { data: data2, pagination: { limit: data2.length } };
|
|
6419
6417
|
}
|
|
6420
|
-
const offset =
|
|
6418
|
+
const offset = decodeOffsetPageToken5(input.page_token);
|
|
6421
6419
|
const rows = await query.limit(input.limit + 1).offset(offset).execute();
|
|
6422
6420
|
const { data, pagination } = paginateOffsetRows3(rows, input.limit, offset);
|
|
6423
6421
|
return { data: data.map(toRecord3), pagination };
|
|
@@ -6550,10 +6548,10 @@ __export(SqliteScheduleStore_exports, {
|
|
|
6550
6548
|
SqliteScheduleStore: () => SqliteScheduleStore
|
|
6551
6549
|
});
|
|
6552
6550
|
import {
|
|
6553
|
-
CreatedBySubjectSchema as
|
|
6551
|
+
CreatedBySubjectSchema as CreatedBySubjectSchema8
|
|
6554
6552
|
} from "@truefoundry/trueforge-core/agent-session";
|
|
6555
6553
|
import {
|
|
6556
|
-
decodeOffsetPageToken as
|
|
6554
|
+
decodeOffsetPageToken as decodeOffsetPageToken6,
|
|
6557
6555
|
paginateOffsetRows as paginateOffsetRows4
|
|
6558
6556
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
6559
6557
|
import { sql as sql14 } from "kysely";
|
|
@@ -6591,13 +6589,13 @@ function toScheduleRecord(row) {
|
|
|
6591
6589
|
return {
|
|
6592
6590
|
...row,
|
|
6593
6591
|
manifest: parseStoredScheduleManifest(row.manifest),
|
|
6594
|
-
created_by_subject:
|
|
6592
|
+
created_by_subject: CreatedBySubjectSchema8.parse(row.created_by_subject)
|
|
6595
6593
|
};
|
|
6596
6594
|
}
|
|
6597
6595
|
function toRunRecord(row) {
|
|
6598
6596
|
return {
|
|
6599
6597
|
...row,
|
|
6600
|
-
created_by_subject:
|
|
6598
|
+
created_by_subject: CreatedBySubjectSchema8.parse(row.created_by_subject)
|
|
6601
6599
|
};
|
|
6602
6600
|
}
|
|
6603
6601
|
var SqliteScheduleStore;
|
|
@@ -6722,7 +6720,7 @@ var init_SqliteScheduleStore = __esm({
|
|
|
6722
6720
|
await db.deleteFrom("schedule").where("tenant_id", "=", input.tenant_id).where("id", "=", input.id).execute();
|
|
6723
6721
|
}
|
|
6724
6722
|
async listSchedules(input, transaction) {
|
|
6725
|
-
const offset =
|
|
6723
|
+
const offset = decodeOffsetPageToken6(input.page_token);
|
|
6726
6724
|
const db = transaction ?? this.#db;
|
|
6727
6725
|
let query = db.selectFrom("schedule").select(scheduleColumns).where("tenant_id", "=", input.tenant_id);
|
|
6728
6726
|
if (input.agent_names !== void 0) {
|
|
@@ -6741,11 +6739,11 @@ var init_SqliteScheduleStore = __esm({
|
|
|
6741
6739
|
const rows = await db.selectFrom("schedule").select(["id", jsonText(sql14.ref("created_by_subject")).as("created_by_subject")]).where("tenant_id", "=", input.tenant_id).where("id", "in", [...input.ids]).execute();
|
|
6742
6740
|
return rows.map((row) => ({
|
|
6743
6741
|
id: row.id,
|
|
6744
|
-
created_by_subject:
|
|
6742
|
+
created_by_subject: CreatedBySubjectSchema8.parse(row.created_by_subject)
|
|
6745
6743
|
}));
|
|
6746
6744
|
}
|
|
6747
6745
|
async listRuns(input, transaction) {
|
|
6748
|
-
const offset =
|
|
6746
|
+
const offset = decodeOffsetPageToken6(input.page_token);
|
|
6749
6747
|
const db = transaction ?? this.#db;
|
|
6750
6748
|
const rows = await db.selectFrom("schedule_run").select(runColumns).where("tenant_id", "=", input.tenant_id).where("schedule_id", "=", input.schedule_id).orderBy("scheduled_for", "desc").orderBy("id").limit(input.limit + 1).offset(offset).execute();
|
|
6751
6749
|
const { data, pagination } = paginateOffsetRows4(rows, input.limit, offset);
|
|
@@ -6824,10 +6822,10 @@ __export(SqliteSandboxEnvironmentStore_exports, {
|
|
|
6824
6822
|
SqliteSandboxEnvironmentStore: () => SqliteSandboxEnvironmentStore
|
|
6825
6823
|
});
|
|
6826
6824
|
import {
|
|
6827
|
-
CreatedBySubjectSchema as
|
|
6825
|
+
CreatedBySubjectSchema as CreatedBySubjectSchema9
|
|
6828
6826
|
} from "@truefoundry/trueforge-core/agent-session";
|
|
6829
6827
|
import {
|
|
6830
|
-
decodeOffsetPageToken as
|
|
6828
|
+
decodeOffsetPageToken as decodeOffsetPageToken7,
|
|
6831
6829
|
paginateOffsetRows as paginateOffsetRows5
|
|
6832
6830
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
6833
6831
|
import { sql as sql15 } from "kysely";
|
|
@@ -6925,7 +6923,7 @@ function toEnvironmentRecord(row) {
|
|
|
6925
6923
|
description: row.description,
|
|
6926
6924
|
active_version: row.active_version,
|
|
6927
6925
|
lifecycle_stage: row.lifecycle_stage,
|
|
6928
|
-
created_by_subject:
|
|
6926
|
+
created_by_subject: CreatedBySubjectSchema9.parse(row.created_by_subject),
|
|
6929
6927
|
created_at: row.created_at,
|
|
6930
6928
|
updated_at: row.updated_at
|
|
6931
6929
|
};
|
|
@@ -6940,7 +6938,7 @@ function toVersionRecord(row) {
|
|
|
6940
6938
|
status_reason: row.status_reason,
|
|
6941
6939
|
external_ref: row.external_ref,
|
|
6942
6940
|
internal_metadata: SandboxEnvironmentVersionInternalMetadataSchema.parse(row.internal_metadata),
|
|
6943
|
-
created_by_subject:
|
|
6941
|
+
created_by_subject: CreatedBySubjectSchema9.parse(row.created_by_subject),
|
|
6944
6942
|
created_at: row.created_at,
|
|
6945
6943
|
updated_at: row.updated_at
|
|
6946
6944
|
};
|
|
@@ -6986,7 +6984,7 @@ var init_SqliteSandboxEnvironmentStore = __esm({
|
|
|
6986
6984
|
const rows2 = await query.execute();
|
|
6987
6985
|
return { data: rows2.map(toWithVersion), pagination: { limit: rows2.length } };
|
|
6988
6986
|
}
|
|
6989
|
-
const offset =
|
|
6987
|
+
const offset = decodeOffsetPageToken7(input.page_token);
|
|
6990
6988
|
const rows = await query.limit(input.limit + 1).offset(offset).execute();
|
|
6991
6989
|
const { data, pagination } = paginateOffsetRows5(rows, input.limit, offset);
|
|
6992
6990
|
return { data: data.map(toWithVersion), pagination };
|
|
@@ -7012,7 +7010,7 @@ var init_SqliteSandboxEnvironmentStore = __esm({
|
|
|
7012
7010
|
return rows.map((row) => ({
|
|
7013
7011
|
id: row.id,
|
|
7014
7012
|
name: row.name,
|
|
7015
|
-
created_by_subject:
|
|
7013
|
+
created_by_subject: CreatedBySubjectSchema9.parse(row.created_by_subject)
|
|
7016
7014
|
}));
|
|
7017
7015
|
}
|
|
7018
7016
|
async getActiveEnvironment(input, transaction) {
|
|
@@ -7376,6 +7374,63 @@ var init_SqliteSandboxEnvironmentStore = __esm({
|
|
|
7376
7374
|
}
|
|
7377
7375
|
});
|
|
7378
7376
|
|
|
7377
|
+
// src/db/sqlite/access-control-store/SqliteAccessControlStore.ts
|
|
7378
|
+
var SqliteAccessControlStore_exports = {};
|
|
7379
|
+
__export(SqliteAccessControlStore_exports, {
|
|
7380
|
+
SqliteAccessControlStore: () => SqliteAccessControlStore
|
|
7381
|
+
});
|
|
7382
|
+
function recordColumns7(eb) {
|
|
7383
|
+
return [
|
|
7384
|
+
"tenant_id",
|
|
7385
|
+
"session_id",
|
|
7386
|
+
"subject_type",
|
|
7387
|
+
"subject_id",
|
|
7388
|
+
jsonText(eb.ref("granted_by_subject")).as("granted_by_subject"),
|
|
7389
|
+
"created_at"
|
|
7390
|
+
];
|
|
7391
|
+
}
|
|
7392
|
+
var SqliteAccessControlStore;
|
|
7393
|
+
var init_SqliteAccessControlStore = __esm({
|
|
7394
|
+
"src/db/sqlite/access-control-store/SqliteAccessControlStore.ts"() {
|
|
7395
|
+
"use strict";
|
|
7396
|
+
init_sqlExpressions2();
|
|
7397
|
+
SqliteAccessControlStore = class {
|
|
7398
|
+
#db;
|
|
7399
|
+
constructor(db) {
|
|
7400
|
+
this.#db = db;
|
|
7401
|
+
}
|
|
7402
|
+
async listSessionAccess(input, transaction) {
|
|
7403
|
+
const db = transaction ?? this.#db;
|
|
7404
|
+
return await db.selectFrom("access_control").select(recordColumns7).where("tenant_id", "=", input.tenant_id).where("session_id", "=", input.session_id).orderBy("created_at").orderBy("subject_id").execute();
|
|
7405
|
+
}
|
|
7406
|
+
async grantSessionAccess(input, transaction) {
|
|
7407
|
+
const db = transaction ?? this.#db;
|
|
7408
|
+
const timestamp = nowIso();
|
|
7409
|
+
await db.insertInto("access_control").values(
|
|
7410
|
+
input.subjects.map((subject) => ({
|
|
7411
|
+
tenant_id: input.tenant_id,
|
|
7412
|
+
session_id: input.session_id,
|
|
7413
|
+
subject_type: subject.subject_type,
|
|
7414
|
+
subject_id: subject.subject_id,
|
|
7415
|
+
granted_by_subject: jsonbBind(input.granted_by_subject),
|
|
7416
|
+
created_at: timestamp
|
|
7417
|
+
}))
|
|
7418
|
+
).onConflict((oc) => oc.columns(["tenant_id", "session_id", "subject_type", "subject_id"]).doNothing()).execute();
|
|
7419
|
+
}
|
|
7420
|
+
async revokeSessionAccess(input, transaction) {
|
|
7421
|
+
const db = transaction ?? this.#db;
|
|
7422
|
+
await db.deleteFrom("access_control").where("tenant_id", "=", input.tenant_id).where("session_id", "=", input.session_id).where(
|
|
7423
|
+
(eb) => eb.or(
|
|
7424
|
+
input.subjects.map(
|
|
7425
|
+
(subject) => eb.and([eb("subject_type", "=", subject.subject_type), eb("subject_id", "=", subject.subject_id)])
|
|
7426
|
+
)
|
|
7427
|
+
)
|
|
7428
|
+
).execute();
|
|
7429
|
+
}
|
|
7430
|
+
};
|
|
7431
|
+
}
|
|
7432
|
+
});
|
|
7433
|
+
|
|
7379
7434
|
// src/db/migratePostgres.ts
|
|
7380
7435
|
var migratePostgres_exports = {};
|
|
7381
7436
|
__export(migratePostgres_exports, {
|
|
@@ -7640,12 +7695,11 @@ async function assembleTurnRecord2(db, args) {
|
|
|
7640
7695
|
async function createTurn2(db, input) {
|
|
7641
7696
|
try {
|
|
7642
7697
|
await db.transaction().execute(async (trx) => {
|
|
7643
|
-
const locked = await trx.selectFrom("session").select(["
|
|
7698
|
+
const locked = await trx.selectFrom("session").select(["session_id"]).where("session_id", "=", input.session_id).forUpdate().executeTakeFirst();
|
|
7644
7699
|
if (!locked) {
|
|
7645
7700
|
throw new SessionNotFoundError5(input.session_id);
|
|
7646
7701
|
}
|
|
7647
7702
|
await trx.updateTable("session").set({
|
|
7648
|
-
last_turn_id: input.turn.turn_id,
|
|
7649
7703
|
last_turn_details: lastTurnDetails2({ turn_id: input.turn.turn_id, turn_state: input.turn.state }),
|
|
7650
7704
|
updated_at: sql17`now()`,
|
|
7651
7705
|
last_activity_timestamp_ms: input.last_activity_timestamp_ms,
|
|
@@ -7991,7 +8045,7 @@ var init_capabilities2 = __esm({
|
|
|
7991
8045
|
|
|
7992
8046
|
// src/db/postgres/session-store/queries/events.ts
|
|
7993
8047
|
import {
|
|
7994
|
-
decodeOffsetPageToken as
|
|
8048
|
+
decodeOffsetPageToken as decodeOffsetPageToken8,
|
|
7995
8049
|
paginateOffsetRows as paginateOffsetRows6
|
|
7996
8050
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
7997
8051
|
import {
|
|
@@ -8031,7 +8085,7 @@ async function appendToEvents2(db, input) {
|
|
|
8031
8085
|
}
|
|
8032
8086
|
}
|
|
8033
8087
|
async function listTurnEvents2(db, input) {
|
|
8034
|
-
const offset =
|
|
8088
|
+
const offset = decodeOffsetPageToken8(input.page_token);
|
|
8035
8089
|
const limit = input.limit;
|
|
8036
8090
|
const eventOrder = input.order === "desc" ? "desc" : "asc";
|
|
8037
8091
|
const rows = await db.selectFrom("turn as t").leftJoin(
|
|
@@ -8051,7 +8105,7 @@ async function listTurnEvents2(db, input) {
|
|
|
8051
8105
|
}
|
|
8052
8106
|
async function listSessionEvents2(db, input) {
|
|
8053
8107
|
const limit = input.limit;
|
|
8054
|
-
const session = await db.selectFrom("session").select("last_turn_id").where("session_id", "=", input.session_id).executeTakeFirst();
|
|
8108
|
+
const session = await db.selectFrom("session").select(sql19`last_turn_details->>'id'`.as("last_turn_id")).where("session_id", "=", input.session_id).executeTakeFirst();
|
|
8055
8109
|
if (!session) {
|
|
8056
8110
|
throw new SessionNotFoundError6(input.session_id);
|
|
8057
8111
|
}
|
|
@@ -8183,7 +8237,7 @@ var init_inboundEvents2 = __esm({
|
|
|
8183
8237
|
|
|
8184
8238
|
// src/db/postgres/session-store/queries/sessions.ts
|
|
8185
8239
|
import {
|
|
8186
|
-
CreatedBySubjectSchema as
|
|
8240
|
+
CreatedBySubjectSchema as CreatedBySubjectSchema10,
|
|
8187
8241
|
SessionLastTurnDetailsSchema as SessionLastTurnDetailsSchema4,
|
|
8188
8242
|
SessionMetadataSchema as SessionMetadataSchema3,
|
|
8189
8243
|
SessionSourceSchema as SessionSourceSchema2
|
|
@@ -8218,7 +8272,7 @@ function mapRowToSessionRecord2(row) {
|
|
|
8218
8272
|
return {
|
|
8219
8273
|
tenant_id: row.tenant_id,
|
|
8220
8274
|
session_id: row.session_id,
|
|
8221
|
-
created_by_subject:
|
|
8275
|
+
created_by_subject: CreatedBySubjectSchema10.parse(row.created_by_subject),
|
|
8222
8276
|
source: SessionSourceSchema2.nullable().parse(row.source),
|
|
8223
8277
|
agent: sessionAgentFromColumns({
|
|
8224
8278
|
session_id: row.session_id,
|
|
@@ -8228,7 +8282,6 @@ function mapRowToSessionRecord2(row) {
|
|
|
8228
8282
|
}),
|
|
8229
8283
|
title: row.title,
|
|
8230
8284
|
shared: row.shared,
|
|
8231
|
-
last_turn_id: row.last_turn_id,
|
|
8232
8285
|
last_turn_details: SessionLastTurnDetailsSchema4.nullable().parse(row.last_turn_details),
|
|
8233
8286
|
external_id: row.external_id,
|
|
8234
8287
|
custom: parseSessionCustom2(row.custom),
|
|
@@ -8357,6 +8410,9 @@ async function listSessions2(db, input) {
|
|
|
8357
8410
|
query = query.where(sql21`metadata = '{}'::jsonb`);
|
|
8358
8411
|
} else {
|
|
8359
8412
|
query = query.where(sql21`metadata @> ${json(input.metadata)}`);
|
|
8413
|
+
for (const [key, value] of Object.entries(input.metadata)) {
|
|
8414
|
+
query = query.where(sql21`metadata->>${sql21.lit(key)}`, "=", value);
|
|
8415
|
+
}
|
|
8360
8416
|
}
|
|
8361
8417
|
}
|
|
8362
8418
|
if (input.source_type !== void 0) {
|
|
@@ -8635,8 +8691,8 @@ __export(PostgresSessionStore_exports, {
|
|
|
8635
8691
|
PostgresSessionStore: () => PostgresSessionStore
|
|
8636
8692
|
});
|
|
8637
8693
|
import {
|
|
8638
|
-
decodeOffsetPageToken as
|
|
8639
|
-
encodeOffsetPageToken as
|
|
8694
|
+
decodeOffsetPageToken as decodeOffsetPageToken9,
|
|
8695
|
+
encodeOffsetPageToken as encodeOffsetPageToken4
|
|
8640
8696
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
8641
8697
|
var PostgresSessionStore;
|
|
8642
8698
|
var init_PostgresSessionStore = __esm({
|
|
@@ -8714,7 +8770,7 @@ var init_PostgresSessionStore = __esm({
|
|
|
8714
8770
|
return getTurn2(this.db, input);
|
|
8715
8771
|
}
|
|
8716
8772
|
async listTurns(input) {
|
|
8717
|
-
const offset =
|
|
8773
|
+
const offset = decodeOffsetPageToken9(input.page_token);
|
|
8718
8774
|
const result = await listTurns2(this.db, {
|
|
8719
8775
|
session_id: input.session_id,
|
|
8720
8776
|
limit: input.limit,
|
|
@@ -8722,10 +8778,10 @@ var init_PostgresSessionStore = __esm({
|
|
|
8722
8778
|
});
|
|
8723
8779
|
const pagination = { limit: input.limit };
|
|
8724
8780
|
if (result.next_offset !== null) {
|
|
8725
|
-
pagination.next_page_token =
|
|
8781
|
+
pagination.next_page_token = encodeOffsetPageToken4(result.next_offset);
|
|
8726
8782
|
}
|
|
8727
8783
|
if (offset > 0) {
|
|
8728
|
-
pagination.previous_page_token =
|
|
8784
|
+
pagination.previous_page_token = encodeOffsetPageToken4(Math.max(0, offset - input.limit));
|
|
8729
8785
|
}
|
|
8730
8786
|
return { data: result.turns, pagination };
|
|
8731
8787
|
}
|
|
@@ -9409,9 +9465,9 @@ var PostgresScheduleStore_exports = {};
|
|
|
9409
9465
|
__export(PostgresScheduleStore_exports, {
|
|
9410
9466
|
PostgresScheduleStore: () => PostgresScheduleStore
|
|
9411
9467
|
});
|
|
9412
|
-
import { CreatedBySubjectSchema as
|
|
9468
|
+
import { CreatedBySubjectSchema as CreatedBySubjectSchema11 } from "@truefoundry/trueforge-core/agent-session";
|
|
9413
9469
|
import {
|
|
9414
|
-
decodeOffsetPageToken as
|
|
9470
|
+
decodeOffsetPageToken as decodeOffsetPageToken10,
|
|
9415
9471
|
paginateOffsetRows as paginateOffsetRows7
|
|
9416
9472
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
9417
9473
|
import "kysely";
|
|
@@ -9424,7 +9480,7 @@ function toScheduleRecord2(row) {
|
|
|
9424
9480
|
name: row.name,
|
|
9425
9481
|
manifest: parseStoredScheduleManifest(row.manifest),
|
|
9426
9482
|
status: row.status,
|
|
9427
|
-
created_by_subject:
|
|
9483
|
+
created_by_subject: CreatedBySubjectSchema11.parse(row.created_by_subject),
|
|
9428
9484
|
created_at: row.created_at.toISOString(),
|
|
9429
9485
|
updated_at: row.updated_at.toISOString()
|
|
9430
9486
|
};
|
|
@@ -9437,7 +9493,7 @@ function toRunRecord2(row) {
|
|
|
9437
9493
|
name: row.name,
|
|
9438
9494
|
scheduled_for: row.scheduled_for.toISOString(),
|
|
9439
9495
|
status: row.status,
|
|
9440
|
-
created_by_subject:
|
|
9496
|
+
created_by_subject: CreatedBySubjectSchema11.parse(row.created_by_subject),
|
|
9441
9497
|
triggered_at: row.triggered_at === null ? null : row.triggered_at.toISOString(),
|
|
9442
9498
|
reason: row.reason,
|
|
9443
9499
|
session_id: row.session_id,
|
|
@@ -9558,7 +9614,7 @@ var init_PostgresScheduleStore = __esm({
|
|
|
9558
9614
|
await db.deleteFrom("schedule").where("tenant_id", "=", input.tenant_id).where("id", "=", input.id).execute();
|
|
9559
9615
|
}
|
|
9560
9616
|
async listSchedules(input, transaction) {
|
|
9561
|
-
const offset =
|
|
9617
|
+
const offset = decodeOffsetPageToken10(input.page_token);
|
|
9562
9618
|
const db = transaction ?? this.#db;
|
|
9563
9619
|
let query = db.selectFrom("schedule").selectAll().where("tenant_id", "=", input.tenant_id);
|
|
9564
9620
|
if (input.agent_names !== void 0) {
|
|
@@ -9577,11 +9633,11 @@ var init_PostgresScheduleStore = __esm({
|
|
|
9577
9633
|
const rows = await db.selectFrom("schedule").select(["id", "created_by_subject"]).where("tenant_id", "=", input.tenant_id).where("id", "in", [...input.ids]).execute();
|
|
9578
9634
|
return rows.map((row) => ({
|
|
9579
9635
|
id: row.id,
|
|
9580
|
-
created_by_subject:
|
|
9636
|
+
created_by_subject: CreatedBySubjectSchema11.parse(row.created_by_subject)
|
|
9581
9637
|
}));
|
|
9582
9638
|
}
|
|
9583
9639
|
async listRuns(input, transaction) {
|
|
9584
|
-
const offset =
|
|
9640
|
+
const offset = decodeOffsetPageToken10(input.page_token);
|
|
9585
9641
|
const db = transaction ?? this.#db;
|
|
9586
9642
|
const rows = await db.selectFrom("schedule_run").selectAll().where("tenant_id", "=", input.tenant_id).where("schedule_id", "=", input.schedule_id).orderBy("scheduled_for", "desc").orderBy("id").limit(input.limit + 1).offset(offset).execute();
|
|
9587
9643
|
const { data, pagination } = paginateOffsetRows7(rows, input.limit, offset);
|
|
@@ -9658,9 +9714,9 @@ var PostgresSandboxEnvironmentStore_exports = {};
|
|
|
9658
9714
|
__export(PostgresSandboxEnvironmentStore_exports, {
|
|
9659
9715
|
PostgresSandboxEnvironmentStore: () => PostgresSandboxEnvironmentStore
|
|
9660
9716
|
});
|
|
9661
|
-
import { CreatedBySubjectSchema as
|
|
9717
|
+
import { CreatedBySubjectSchema as CreatedBySubjectSchema12 } from "@truefoundry/trueforge-core/agent-session";
|
|
9662
9718
|
import {
|
|
9663
|
-
decodeOffsetPageToken as
|
|
9719
|
+
decodeOffsetPageToken as decodeOffsetPageToken11,
|
|
9664
9720
|
paginateOffsetRows as paginateOffsetRows8
|
|
9665
9721
|
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
9666
9722
|
import { sql as sql25 } from "kysely";
|
|
@@ -9686,7 +9742,7 @@ function toEnvironmentRecord2(row) {
|
|
|
9686
9742
|
description: row.description,
|
|
9687
9743
|
active_version: row.active_version,
|
|
9688
9744
|
lifecycle_stage: row.lifecycle_stage,
|
|
9689
|
-
created_by_subject:
|
|
9745
|
+
created_by_subject: CreatedBySubjectSchema12.parse(row.created_by_subject),
|
|
9690
9746
|
created_at: row.created_at.toISOString(),
|
|
9691
9747
|
updated_at: row.updated_at.toISOString()
|
|
9692
9748
|
};
|
|
@@ -9701,7 +9757,7 @@ function toVersionRecord2(row) {
|
|
|
9701
9757
|
status_reason: row.status_reason,
|
|
9702
9758
|
external_ref: row.external_ref,
|
|
9703
9759
|
internal_metadata: SandboxEnvironmentVersionInternalMetadataSchema.parse(row.internal_metadata),
|
|
9704
|
-
created_by_subject:
|
|
9760
|
+
created_by_subject: CreatedBySubjectSchema12.parse(row.created_by_subject),
|
|
9705
9761
|
created_at: row.created_at.toISOString(),
|
|
9706
9762
|
updated_at: row.updated_at.toISOString()
|
|
9707
9763
|
};
|
|
@@ -9787,7 +9843,7 @@ var init_PostgresSandboxEnvironmentStore = __esm({
|
|
|
9787
9843
|
const rows2 = await query.execute();
|
|
9788
9844
|
return { data: rows2.map(toWithVersion2), pagination: { limit: rows2.length } };
|
|
9789
9845
|
}
|
|
9790
|
-
const offset =
|
|
9846
|
+
const offset = decodeOffsetPageToken11(input.page_token);
|
|
9791
9847
|
const rows = await query.limit(input.limit + 1).offset(offset).execute();
|
|
9792
9848
|
const { data, pagination } = paginateOffsetRows8(rows, input.limit, offset);
|
|
9793
9849
|
return { data: data.map(toWithVersion2), pagination };
|
|
@@ -9813,7 +9869,7 @@ var init_PostgresSandboxEnvironmentStore = __esm({
|
|
|
9813
9869
|
return rows.map((row) => ({
|
|
9814
9870
|
id: row.id,
|
|
9815
9871
|
name: row.name,
|
|
9816
|
-
created_by_subject:
|
|
9872
|
+
created_by_subject: CreatedBySubjectSchema12.parse(row.created_by_subject)
|
|
9817
9873
|
}));
|
|
9818
9874
|
}
|
|
9819
9875
|
async getActiveEnvironment(input, transaction) {
|
|
@@ -10141,6 +10197,60 @@ var init_PostgresSandboxEnvironmentStore = __esm({
|
|
|
10141
10197
|
}
|
|
10142
10198
|
});
|
|
10143
10199
|
|
|
10200
|
+
// src/db/postgres/access-control-store/PostgresAccessControlStore.ts
|
|
10201
|
+
var PostgresAccessControlStore_exports = {};
|
|
10202
|
+
__export(PostgresAccessControlStore_exports, {
|
|
10203
|
+
PostgresAccessControlStore: () => PostgresAccessControlStore
|
|
10204
|
+
});
|
|
10205
|
+
var PostgresAccessControlStore;
|
|
10206
|
+
var init_PostgresAccessControlStore = __esm({
|
|
10207
|
+
"src/db/postgres/access-control-store/PostgresAccessControlStore.ts"() {
|
|
10208
|
+
"use strict";
|
|
10209
|
+
init_sqlExpressions();
|
|
10210
|
+
PostgresAccessControlStore = class {
|
|
10211
|
+
#db;
|
|
10212
|
+
constructor(db) {
|
|
10213
|
+
this.#db = db;
|
|
10214
|
+
}
|
|
10215
|
+
async listSessionAccess(input, transaction) {
|
|
10216
|
+
const db = transaction ?? this.#db;
|
|
10217
|
+
const rows = await db.selectFrom("access_control").selectAll().where("tenant_id", "=", input.tenant_id).where("session_id", "=", input.session_id).orderBy("created_at").orderBy("subject_id").execute();
|
|
10218
|
+
return rows.map((row) => ({
|
|
10219
|
+
tenant_id: row.tenant_id,
|
|
10220
|
+
session_id: row.session_id,
|
|
10221
|
+
subject_type: row.subject_type,
|
|
10222
|
+
subject_id: row.subject_id,
|
|
10223
|
+
granted_by_subject: row.granted_by_subject,
|
|
10224
|
+
created_at: row.created_at.toISOString()
|
|
10225
|
+
}));
|
|
10226
|
+
}
|
|
10227
|
+
async grantSessionAccess(input, transaction) {
|
|
10228
|
+
const db = transaction ?? this.#db;
|
|
10229
|
+
await db.insertInto("access_control").values(
|
|
10230
|
+
input.subjects.map((subject) => ({
|
|
10231
|
+
tenant_id: input.tenant_id,
|
|
10232
|
+
session_id: input.session_id,
|
|
10233
|
+
subject_type: subject.subject_type,
|
|
10234
|
+
subject_id: subject.subject_id,
|
|
10235
|
+
granted_by_subject: json(input.granted_by_subject),
|
|
10236
|
+
created_at: now()
|
|
10237
|
+
}))
|
|
10238
|
+
).onConflict((oc) => oc.columns(["tenant_id", "session_id", "subject_type", "subject_id"]).doNothing()).execute();
|
|
10239
|
+
}
|
|
10240
|
+
async revokeSessionAccess(input, transaction) {
|
|
10241
|
+
const db = transaction ?? this.#db;
|
|
10242
|
+
await db.deleteFrom("access_control").where("tenant_id", "=", input.tenant_id).where("session_id", "=", input.session_id).where(
|
|
10243
|
+
(eb) => eb.or(
|
|
10244
|
+
input.subjects.map(
|
|
10245
|
+
(subject) => eb.and([eb("subject_type", "=", subject.subject_type), eb("subject_id", "=", subject.subject_id)])
|
|
10246
|
+
)
|
|
10247
|
+
)
|
|
10248
|
+
).execute();
|
|
10249
|
+
}
|
|
10250
|
+
};
|
|
10251
|
+
}
|
|
10252
|
+
});
|
|
10253
|
+
|
|
10144
10254
|
// src/main.ts
|
|
10145
10255
|
import {
|
|
10146
10256
|
configureOperationMetrics,
|
|
@@ -10192,10 +10302,10 @@ import { RequestReplyExecutor, RequestReplyRouter } from "@truefoundry/trueforge
|
|
|
10192
10302
|
|
|
10193
10303
|
// src/app.ts
|
|
10194
10304
|
import { swaggerUI } from "@hono/swagger-ui";
|
|
10195
|
-
import { OpenAPIHono as
|
|
10305
|
+
import { OpenAPIHono as OpenAPIHono21, z as z43 } from "@hono/zod-openapi";
|
|
10196
10306
|
import { extractErrorLogFields as extractErrorLogFields7 } from "@truefoundry/trueforge-core/core";
|
|
10197
10307
|
import { bodyLimit } from "hono/body-limit";
|
|
10198
|
-
import { HTTPException as
|
|
10308
|
+
import { HTTPException as HTTPException19 } from "hono/http-exception";
|
|
10199
10309
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
10200
10310
|
|
|
10201
10311
|
// src/apis/agents.ts
|
|
@@ -10481,6 +10591,7 @@ var TOKEN_PAGINATION = {
|
|
|
10481
10591
|
var OPENAPI_DOCUMENT_TAGS = [
|
|
10482
10592
|
{ name: "Internal" /* INTERNAL */ },
|
|
10483
10593
|
{ name: "Auth" /* AUTH */ },
|
|
10594
|
+
{ name: "Users" /* USERS */ },
|
|
10484
10595
|
{ name: "Capabilities" /* CAPABILITIES */ },
|
|
10485
10596
|
{ name: "Models" /* MODELS */ },
|
|
10486
10597
|
{ name: "MCP Servers" /* MCP_SERVERS */ },
|
|
@@ -15760,7 +15871,7 @@ import { HTTPException as HTTPException12 } from "hono/http-exception";
|
|
|
15760
15871
|
import { streamSSE } from "hono/streaming";
|
|
15761
15872
|
|
|
15762
15873
|
// src/routes/turnRoutes.ts
|
|
15763
|
-
import { createRoute as createRoute13, z as
|
|
15874
|
+
import { createRoute as createRoute13, z as z35 } from "@hono/zod-openapi";
|
|
15764
15875
|
|
|
15765
15876
|
// src/schemas/events.ts
|
|
15766
15877
|
init_common();
|
|
@@ -15884,7 +15995,7 @@ var DownloadSandboxFileRequestQuerySchema = z30.object({
|
|
|
15884
15995
|
}).openapi("DownloadSandboxFileRequestQuery");
|
|
15885
15996
|
|
|
15886
15997
|
// src/routes/sessionRoutes.ts
|
|
15887
|
-
import { createRoute as createRoute12, z as
|
|
15998
|
+
import { createRoute as createRoute12, z as z34 } from "@hono/zod-openapi";
|
|
15888
15999
|
|
|
15889
16000
|
// src/schemas/session.ts
|
|
15890
16001
|
init_common();
|
|
@@ -16045,9 +16156,31 @@ var ListSessionsResponseSchema = z32.object({
|
|
|
16045
16156
|
pagination: TokenPaginationSchema6
|
|
16046
16157
|
}).openapi("ListSessionsResponse");
|
|
16047
16158
|
|
|
16159
|
+
// src/schemas/sessionGrant.ts
|
|
16160
|
+
import { z as z33 } from "@hono/zod-openapi";
|
|
16161
|
+
import { CreatedBySubjectSchema as CreatedBySubjectSchema4 } from "@truefoundry/trueforge-core/agent-session";
|
|
16162
|
+
var SESSION_GRANT_MAX_SUBJECTS_PER_LIST = 50;
|
|
16163
|
+
var SessionGrantSubjectTypeSchema = z33.enum(["user"]).describe("Kind of subject.").openapi("SessionGrantSubjectType");
|
|
16164
|
+
var SessionGrantSubjectSchema = z33.object({
|
|
16165
|
+
subject_type: SessionGrantSubjectTypeSchema,
|
|
16166
|
+
subject_id: z33.string().min(1).max(255).describe("ID of the subject.")
|
|
16167
|
+
}).strict().describe("Who the session is shared with.").openapi("SessionGrantSubject");
|
|
16168
|
+
var SessionGrantSchema = z33.object({
|
|
16169
|
+
subject: SessionGrantSubjectSchema,
|
|
16170
|
+
granted_by_subject: CreatedBySubjectSchema4,
|
|
16171
|
+
created_at: z33.string().describe("When the session was shared with the subject (ISO-8601 UTC).")
|
|
16172
|
+
}).strict().openapi("SessionGrant");
|
|
16173
|
+
var ListSessionGrantsResponseSchema = z33.object({ data: z33.array(SessionGrantSchema) }).openapi("ListSessionGrantsResponse");
|
|
16174
|
+
var UpdateSessionGrantsRequestSchema = z33.object({
|
|
16175
|
+
grant: z33.array(SessionGrantSubjectSchema).max(SESSION_GRANT_MAX_SUBJECTS_PER_LIST).optional().default([]).describe(`Subjects to share the session with (up to ${String(SESSION_GRANT_MAX_SUBJECTS_PER_LIST)}).`),
|
|
16176
|
+
revoke: z33.array(SessionGrantSubjectSchema).max(SESSION_GRANT_MAX_SUBJECTS_PER_LIST).optional().default([]).describe(`Subjects to remove access for (up to ${String(SESSION_GRANT_MAX_SUBJECTS_PER_LIST)}).`)
|
|
16177
|
+
}).strict().refine((body) => body.grant.length + body.revoke.length > 0, {
|
|
16178
|
+
message: "At least one subject to grant or revoke is required."
|
|
16179
|
+
}).openapi("UpdateSessionGrantsRequest");
|
|
16180
|
+
|
|
16048
16181
|
// src/routes/sessionRoutes.ts
|
|
16049
|
-
var SessionIdParamsSchema =
|
|
16050
|
-
session_id:
|
|
16182
|
+
var SessionIdParamsSchema = z34.object({
|
|
16183
|
+
session_id: z34.string().min(1).max(64).describe("Session identifier.")
|
|
16051
16184
|
});
|
|
16052
16185
|
var createSessionRoute = createRoute12({
|
|
16053
16186
|
method: "post",
|
|
@@ -16298,10 +16431,74 @@ var listSessionEventsRoute = createRoute12({
|
|
|
16298
16431
|
}
|
|
16299
16432
|
}
|
|
16300
16433
|
});
|
|
16434
|
+
var listSessionGrantsRoute = createRoute12({
|
|
16435
|
+
method: "get",
|
|
16436
|
+
path: "/{session_id}/grants",
|
|
16437
|
+
tags: ["Agent Sessions" /* AGENT_SESSIONS */],
|
|
16438
|
+
summary: "List session grants",
|
|
16439
|
+
description: "List the subjects this session is shared with.",
|
|
16440
|
+
"x-fern-sdk-group-name": ["sessions"],
|
|
16441
|
+
"x-fern-sdk-method-name": "list_grants",
|
|
16442
|
+
request: {
|
|
16443
|
+
params: SessionIdParamsSchema
|
|
16444
|
+
},
|
|
16445
|
+
responses: {
|
|
16446
|
+
200: {
|
|
16447
|
+
content: { "application/json": { schema: ListSessionGrantsResponseSchema } },
|
|
16448
|
+
description: "Subjects the session is shared with."
|
|
16449
|
+
},
|
|
16450
|
+
403: {
|
|
16451
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16452
|
+
description: "User does not have permission."
|
|
16453
|
+
},
|
|
16454
|
+
404: {
|
|
16455
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16456
|
+
description: "Session not found."
|
|
16457
|
+
}
|
|
16458
|
+
}
|
|
16459
|
+
});
|
|
16460
|
+
var updateSessionGrantsRoute = createRoute12({
|
|
16461
|
+
method: "post",
|
|
16462
|
+
path: "/{session_id}/grants",
|
|
16463
|
+
tags: ["Agent Sessions" /* AGENT_SESSIONS */],
|
|
16464
|
+
summary: "Update session grants",
|
|
16465
|
+
description: "Share this session with subjects and remove access for others in one atomic request. Granting an existing subject or revoking one without access is a no-op. Returns every subject the session is shared with.",
|
|
16466
|
+
"x-fern-sdk-group-name": ["sessions"],
|
|
16467
|
+
"x-fern-sdk-method-name": "update_grants",
|
|
16468
|
+
request: {
|
|
16469
|
+
params: SessionIdParamsSchema,
|
|
16470
|
+
body: {
|
|
16471
|
+
content: { "application/json": { schema: UpdateSessionGrantsRequestSchema } },
|
|
16472
|
+
required: true
|
|
16473
|
+
}
|
|
16474
|
+
},
|
|
16475
|
+
responses: {
|
|
16476
|
+
200: {
|
|
16477
|
+
content: { "application/json": { schema: ListSessionGrantsResponseSchema } },
|
|
16478
|
+
description: "Subjects the session is shared with after the change."
|
|
16479
|
+
},
|
|
16480
|
+
400: {
|
|
16481
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16482
|
+
description: "Invalid request body."
|
|
16483
|
+
},
|
|
16484
|
+
403: {
|
|
16485
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16486
|
+
description: "User does not have permission."
|
|
16487
|
+
},
|
|
16488
|
+
404: {
|
|
16489
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16490
|
+
description: "Session not found."
|
|
16491
|
+
},
|
|
16492
|
+
422: {
|
|
16493
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
16494
|
+
description: "A subject to grant is unknown or is the session creator, or a subject is both granted and revoked."
|
|
16495
|
+
}
|
|
16496
|
+
}
|
|
16497
|
+
});
|
|
16301
16498
|
|
|
16302
16499
|
// src/routes/turnRoutes.ts
|
|
16303
16500
|
var TurnIdParamsSchema = SessionIdParamsSchema.extend({
|
|
16304
|
-
turn_id:
|
|
16501
|
+
turn_id: z35.string().min(1).describe("Turn identifier.")
|
|
16305
16502
|
});
|
|
16306
16503
|
var listTurnsRoute = createRoute13({
|
|
16307
16504
|
method: "get",
|
|
@@ -16375,7 +16572,7 @@ var downloadSandboxFileRoute = createRoute13({
|
|
|
16375
16572
|
},
|
|
16376
16573
|
responses: {
|
|
16377
16574
|
200: {
|
|
16378
|
-
content: { "application/octet-stream": { schema:
|
|
16575
|
+
content: { "application/octet-stream": { schema: z35.string().openapi({ format: "binary" }) } },
|
|
16379
16576
|
description: "File contents."
|
|
16380
16577
|
},
|
|
16381
16578
|
400: {
|
|
@@ -16861,10 +17058,11 @@ init_sandboxEnvironment();
|
|
|
16861
17058
|
|
|
16862
17059
|
// src/truefoundry/gatewayMetadata.ts
|
|
16863
17060
|
import { HTTPException as HTTPException11 } from "hono/http-exception";
|
|
16864
|
-
import { z as
|
|
17061
|
+
import { z as z36 } from "zod";
|
|
16865
17062
|
var X_TFY_METADATA = "x-tfy-metadata";
|
|
17063
|
+
var X_TFY_CONVERSATION_ID = "x-tfy-conversation-id";
|
|
16866
17064
|
var TFG_METADATA_PREFIX = "tfg";
|
|
16867
|
-
var GatewayMetadataSchema =
|
|
17065
|
+
var GatewayMetadataSchema = z36.record(z36.string().min(1), z36.string());
|
|
16868
17066
|
function parseGatewayMetadataHeader(raw) {
|
|
16869
17067
|
let decoded;
|
|
16870
17068
|
try {
|
|
@@ -16924,14 +17122,17 @@ function gatewayMetadataHeadersForTurn(turnMetadata) {
|
|
|
16924
17122
|
return {};
|
|
16925
17123
|
}
|
|
16926
17124
|
const raw = headerValue(turnMetadata.requestHeaders, X_TFY_METADATA);
|
|
16927
|
-
return
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
|
|
16933
|
-
|
|
16934
|
-
|
|
17125
|
+
return {
|
|
17126
|
+
...gatewayMetadataHeaders(
|
|
17127
|
+
mergeGatewayMetadata({
|
|
17128
|
+
sessionId: turnMetadata.sessionId,
|
|
17129
|
+
turnId: turnMetadata.turnId,
|
|
17130
|
+
...turnMetadata.agent === void 0 ? {} : { agent: turnMetadata.agent },
|
|
17131
|
+
requestMetadata: raw === void 0 ? {} : parseGatewayMetadataHeader(raw)
|
|
17132
|
+
})
|
|
17133
|
+
),
|
|
17134
|
+
[X_TFY_CONVERSATION_ID]: turnMetadata.sessionId
|
|
17135
|
+
};
|
|
16935
17136
|
}
|
|
16936
17137
|
function headerValue(headers, name) {
|
|
16937
17138
|
if (headers === void 0) {
|
|
@@ -17205,7 +17406,7 @@ async function beginTurnExecution(params) {
|
|
|
17205
17406
|
...requestHeaders === void 0 ? {} : { requestHeaders }
|
|
17206
17407
|
}
|
|
17207
17408
|
});
|
|
17208
|
-
const title = session.record.
|
|
17409
|
+
const title = session.record.last_turn_details ? void 0 : deriveSessionTitle(input);
|
|
17209
17410
|
const turn = await session.createTurn({
|
|
17210
17411
|
turn_id: turnId,
|
|
17211
17412
|
active_executor_id: config_default.EXECUTOR_ID,
|
|
@@ -18079,13 +18280,13 @@ import { OpenAPIHono as OpenAPIHono13 } from "@hono/zod-openapi";
|
|
|
18079
18280
|
import { createRoute as createRoute14 } from "@hono/zod-openapi";
|
|
18080
18281
|
|
|
18081
18282
|
// src/schemas/sessionMetrics.ts
|
|
18082
|
-
import { z as
|
|
18283
|
+
import { z as z37 } from "@hono/zod-openapi";
|
|
18083
18284
|
var MAX_SESSION_METRICS_WINDOW_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
18084
|
-
var SessionMetricsPointSchema =
|
|
18085
|
-
timestamp:
|
|
18086
|
-
value:
|
|
18285
|
+
var SessionMetricsPointSchema = z37.object({
|
|
18286
|
+
timestamp: z37.string(),
|
|
18287
|
+
value: z37.number().nonnegative()
|
|
18087
18288
|
}).strict().openapi("SessionMetricsPoint");
|
|
18088
|
-
var SessionMetricsMeterNameSchema =
|
|
18289
|
+
var SessionMetricsMeterNameSchema = z37.enum([
|
|
18089
18290
|
"total_sessions",
|
|
18090
18291
|
"total_cost_in_usd",
|
|
18091
18292
|
"total_turns",
|
|
@@ -18102,47 +18303,47 @@ var SessionMetricsMeterNameSchema = z36.enum([
|
|
|
18102
18303
|
var METRICS_USD_FERN_ENUM = {
|
|
18103
18304
|
$: { name: "USD" }
|
|
18104
18305
|
};
|
|
18105
|
-
var MetricsUnitSchema =
|
|
18306
|
+
var MetricsUnitSchema = z37.enum(["count", "$", "ms"]).openapi("MetricsUnit", {
|
|
18106
18307
|
"x-fern-enum": METRICS_USD_FERN_ENUM
|
|
18107
18308
|
});
|
|
18108
|
-
var SessionMetricsMeterSchema =
|
|
18309
|
+
var SessionMetricsMeterSchema = z37.object({
|
|
18109
18310
|
name: SessionMetricsMeterNameSchema,
|
|
18110
|
-
aggregate_value:
|
|
18111
|
-
description:
|
|
18311
|
+
aggregate_value: z37.number().nonnegative(),
|
|
18312
|
+
description: z37.string(),
|
|
18112
18313
|
unit: MetricsUnitSchema
|
|
18113
18314
|
}).strict().openapi("SessionMetricsMeter");
|
|
18114
|
-
var SessionMetricsMeterResponseSchema =
|
|
18115
|
-
meters:
|
|
18315
|
+
var SessionMetricsMeterResponseSchema = z37.object({
|
|
18316
|
+
meters: z37.array(SessionMetricsMeterSchema)
|
|
18116
18317
|
}).strict().openapi("SessionMetricsMeterResponse");
|
|
18117
|
-
var SessionMetricsChartNameSchema =
|
|
18118
|
-
var SessionMetricsChartSchema =
|
|
18318
|
+
var SessionMetricsChartNameSchema = z37.enum(["sessions_over_time", "sessions_cost_over_time", "turns_over_time"]).describe("Session metrics chart to return.").openapi("SessionMetricsChartName");
|
|
18319
|
+
var SessionMetricsChartSchema = z37.object({
|
|
18119
18320
|
name: SessionMetricsChartNameSchema,
|
|
18120
|
-
display_name:
|
|
18121
|
-
description:
|
|
18122
|
-
chart_type:
|
|
18321
|
+
display_name: z37.string(),
|
|
18322
|
+
description: z37.string(),
|
|
18323
|
+
chart_type: z37.literal("line")
|
|
18123
18324
|
}).strict().openapi("SessionMetricsChart");
|
|
18124
|
-
var SessionMetricsChartResponseSchema =
|
|
18125
|
-
charts:
|
|
18325
|
+
var SessionMetricsChartResponseSchema = z37.object({
|
|
18326
|
+
charts: z37.array(SessionMetricsChartSchema)
|
|
18126
18327
|
}).strict().openapi("SessionMetricsChartResponse");
|
|
18127
|
-
var SessionMetricsGraphLineSchema =
|
|
18128
|
-
name:
|
|
18129
|
-
values:
|
|
18328
|
+
var SessionMetricsGraphLineSchema = z37.object({
|
|
18329
|
+
name: z37.string(),
|
|
18330
|
+
values: z37.array(SessionMetricsPointSchema)
|
|
18130
18331
|
}).strict().openapi("SessionMetricsGraphLine");
|
|
18131
|
-
var SessionMetricsGraphSchema =
|
|
18332
|
+
var SessionMetricsGraphSchema = z37.object({
|
|
18132
18333
|
name: SessionMetricsChartNameSchema,
|
|
18133
|
-
display_name:
|
|
18134
|
-
description:
|
|
18334
|
+
display_name: z37.string(),
|
|
18335
|
+
description: z37.string(),
|
|
18135
18336
|
unit: MetricsUnitSchema,
|
|
18136
|
-
chart_type:
|
|
18137
|
-
graph_lines:
|
|
18337
|
+
chart_type: z37.literal("line"),
|
|
18338
|
+
graph_lines: z37.array(SessionMetricsGraphLineSchema)
|
|
18138
18339
|
}).strict().openapi("SessionMetricsGraph");
|
|
18139
|
-
var SessionMetricsChartDataResponseSchema =
|
|
18140
|
-
step:
|
|
18141
|
-
graphs:
|
|
18340
|
+
var SessionMetricsChartDataResponseSchema = z37.object({
|
|
18341
|
+
step: z37.string(),
|
|
18342
|
+
graphs: z37.array(SessionMetricsGraphSchema)
|
|
18142
18343
|
}).strict().openapi("SessionMetricsChartDataResponse");
|
|
18143
|
-
var IsoTimestampQueryParam2 =
|
|
18144
|
-
var GetSessionMetricsRequestQueryObjectSchema =
|
|
18145
|
-
agent_id:
|
|
18344
|
+
var IsoTimestampQueryParam2 = z37.iso.datetime({ offset: true }).openapi({ type: "string", format: "date-time" }).transform((s) => new Date(s));
|
|
18345
|
+
var GetSessionMetricsRequestQueryObjectSchema = z37.object({
|
|
18346
|
+
agent_id: z37.string().min(1).max(64).describe("Named agent identifier."),
|
|
18146
18347
|
start_timestamp: IsoTimestampQueryParam2.describe("Inclusive lower bound on session `created_at`."),
|
|
18147
18348
|
end_timestamp: IsoTimestampQueryParam2.describe("Inclusive upper bound on session `created_at`.")
|
|
18148
18349
|
});
|
|
@@ -18167,17 +18368,17 @@ function refineSessionMetricsTimeWindow(query, ctx) {
|
|
|
18167
18368
|
var GetSessionMetricsRequestQuerySchema = GetSessionMetricsRequestQueryObjectSchema.superRefine(
|
|
18168
18369
|
refineSessionMetricsTimeWindow
|
|
18169
18370
|
).openapi("GetSessionMetricsRequestQuery");
|
|
18170
|
-
var GetSessionMetricsChartDataRequestQuerySchema =
|
|
18371
|
+
var GetSessionMetricsChartDataRequestQuerySchema = z37.object({
|
|
18171
18372
|
...GetSessionMetricsRequestQueryObjectSchema.shape,
|
|
18172
18373
|
chart_name: SessionMetricsChartNameSchema
|
|
18173
18374
|
}).superRefine(refineSessionMetricsTimeWindow).openapi("GetSessionMetricsChartDataRequestQuery");
|
|
18174
|
-
var GetSessionMetricsMeterResponseSchema =
|
|
18375
|
+
var GetSessionMetricsMeterResponseSchema = z37.object({
|
|
18175
18376
|
data: SessionMetricsMeterResponseSchema
|
|
18176
18377
|
}).openapi("GetSessionMetricsMeterResponse");
|
|
18177
|
-
var GetSessionMetricsChartResponseSchema =
|
|
18378
|
+
var GetSessionMetricsChartResponseSchema = z37.object({
|
|
18178
18379
|
data: SessionMetricsChartResponseSchema
|
|
18179
18380
|
}).openapi("GetSessionMetricsChartResponse");
|
|
18180
|
-
var GetSessionMetricsChartDataResponseSchema =
|
|
18381
|
+
var GetSessionMetricsChartDataResponseSchema = z37.object({
|
|
18181
18382
|
data: SessionMetricsChartDataResponseSchema
|
|
18182
18383
|
}).openapi("GetSessionMetricsChartDataResponse");
|
|
18183
18384
|
|
|
@@ -18307,14 +18508,14 @@ import {
|
|
|
18307
18508
|
RequestTimeoutError
|
|
18308
18509
|
} from "@truefoundry/trueforge-core/request-reply";
|
|
18309
18510
|
import { HTTPException as HTTPException14 } from "hono/http-exception";
|
|
18310
|
-
import { z as
|
|
18511
|
+
import { z as z38 } from "zod";
|
|
18311
18512
|
init_config();
|
|
18312
18513
|
init_id();
|
|
18313
18514
|
var SESSIONS_CANCEL_PATH = "sessions/cancel";
|
|
18314
|
-
var CancelPeerBodySchema =
|
|
18315
|
-
session_id:
|
|
18316
|
-
turn_id:
|
|
18317
|
-
reason:
|
|
18515
|
+
var CancelPeerBodySchema = z38.object({
|
|
18516
|
+
session_id: z38.string(),
|
|
18517
|
+
turn_id: z38.string(),
|
|
18518
|
+
reason: z38.enum(CancellationReason2)
|
|
18318
18519
|
});
|
|
18319
18520
|
function toWireSession(record) {
|
|
18320
18521
|
return {
|
|
@@ -18426,6 +18627,38 @@ function isSessionOwner2({
|
|
|
18426
18627
|
}) {
|
|
18427
18628
|
return subject_id === created_by_subject.subject_id;
|
|
18428
18629
|
}
|
|
18630
|
+
var FORBIDDEN_SESSION_ACCESS_MANAGEMENT = "Only the session creator can manage access to this session";
|
|
18631
|
+
async function requireOwnedSession(deps, input) {
|
|
18632
|
+
const requestContext = deps.resolveRequestContext(input.c);
|
|
18633
|
+
const record = await deps.sessionStore.getSession({
|
|
18634
|
+
tenant_id: requestContext.tenant_id,
|
|
18635
|
+
session_id: input.session_id
|
|
18636
|
+
});
|
|
18637
|
+
if (!record) {
|
|
18638
|
+
throw new HTTPException14(404, { message: `Session not found: ${input.session_id}` });
|
|
18639
|
+
}
|
|
18640
|
+
if (!isSessionOwner2({ subject_id: requestContext.subject.id, created_by_subject: record.created_by_subject })) {
|
|
18641
|
+
throw new HTTPException14(403, { message: FORBIDDEN_SESSION_ACCESS_MANAGEMENT });
|
|
18642
|
+
}
|
|
18643
|
+
return { requestContext, record };
|
|
18644
|
+
}
|
|
18645
|
+
function subjectKey(subject) {
|
|
18646
|
+
return `${subject.subject_type}:${subject.subject_id}`;
|
|
18647
|
+
}
|
|
18648
|
+
function uniqueSubjects(subjects) {
|
|
18649
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
18650
|
+
for (const subject of subjects) {
|
|
18651
|
+
byKey.set(subjectKey(subject), subject);
|
|
18652
|
+
}
|
|
18653
|
+
return [...byKey.values()];
|
|
18654
|
+
}
|
|
18655
|
+
function toWireSessionGrant(record) {
|
|
18656
|
+
return {
|
|
18657
|
+
subject: { subject_type: record.subject_type, subject_id: record.subject_id },
|
|
18658
|
+
granted_by_subject: record.granted_by_subject,
|
|
18659
|
+
created_at: record.created_at
|
|
18660
|
+
};
|
|
18661
|
+
}
|
|
18429
18662
|
function validateInlineSessionSpec(deps, input) {
|
|
18430
18663
|
const { c, spec, requestContext } = input;
|
|
18431
18664
|
return validateAgentSpec({
|
|
@@ -18714,7 +18947,7 @@ function createSessionsRouter(deps) {
|
|
|
18714
18947
|
})) {
|
|
18715
18948
|
return c.json({ error: { message: FORBIDDEN_SESSION_ACCESS2 } }, 403);
|
|
18716
18949
|
}
|
|
18717
|
-
const turnId = session.record.
|
|
18950
|
+
const turnId = session.record.last_turn_details?.id;
|
|
18718
18951
|
if (!turnId) {
|
|
18719
18952
|
return c.json({}, 200);
|
|
18720
18953
|
}
|
|
@@ -18760,6 +18993,62 @@ function createSessionsRouter(deps) {
|
|
|
18760
18993
|
throw error;
|
|
18761
18994
|
}
|
|
18762
18995
|
};
|
|
18996
|
+
const listSessionGrantsHandler = async (c) => {
|
|
18997
|
+
const { session_id: sessionId } = c.req.valid("param");
|
|
18998
|
+
const { requestContext } = await requireOwnedSession(deps, { c, session_id: sessionId });
|
|
18999
|
+
const records = await deps.accessControlStore.listSessionAccess({
|
|
19000
|
+
tenant_id: requestContext.tenant_id,
|
|
19001
|
+
session_id: sessionId
|
|
19002
|
+
});
|
|
19003
|
+
return c.json({ data: records.map(toWireSessionGrant) }, 200);
|
|
19004
|
+
};
|
|
19005
|
+
const updateSessionGrantsHandler = async (c) => {
|
|
19006
|
+
const { session_id: sessionId } = c.req.valid("param");
|
|
19007
|
+
const body = c.req.valid("json");
|
|
19008
|
+
const { requestContext } = await requireOwnedSession(deps, { c, session_id: sessionId });
|
|
19009
|
+
const toGrant = uniqueSubjects(body.grant);
|
|
19010
|
+
const toRevoke = uniqueSubjects(body.revoke);
|
|
19011
|
+
const revokeKeys = new Set(toRevoke.map(subjectKey));
|
|
19012
|
+
if (toGrant.some((subject) => revokeKeys.has(subjectKey(subject)))) {
|
|
19013
|
+
throw new HTTPException14(422, { message: "A subject cannot be both granted and revoked." });
|
|
19014
|
+
}
|
|
19015
|
+
const userIds = toGrant.map((subject) => subject.subject_id);
|
|
19016
|
+
if (userIds.includes(requestContext.subject.id)) {
|
|
19017
|
+
throw new HTTPException14(422, { message: "The session creator already has access." });
|
|
19018
|
+
}
|
|
19019
|
+
if (userIds.length > 0) {
|
|
19020
|
+
const knownUsers = await deps.userStore.getUsersByIds({ context: requestContext, ids: userIds });
|
|
19021
|
+
const knownIds = new Set(knownUsers.map((user) => user.id));
|
|
19022
|
+
const unknownIds = userIds.filter((id) => !knownIds.has(id));
|
|
19023
|
+
if (unknownIds.length > 0) {
|
|
19024
|
+
throw new HTTPException14(422, { message: `Unknown users: ${unknownIds.join(", ")}` });
|
|
19025
|
+
}
|
|
19026
|
+
}
|
|
19027
|
+
await deps.withTransaction(async (transaction) => {
|
|
19028
|
+
if (toGrant.length > 0) {
|
|
19029
|
+
await deps.accessControlStore.grantSessionAccess(
|
|
19030
|
+
{
|
|
19031
|
+
tenant_id: requestContext.tenant_id,
|
|
19032
|
+
session_id: sessionId,
|
|
19033
|
+
subjects: toGrant,
|
|
19034
|
+
granted_by_subject: createdBySubjectFromRequestContext(requestContext)
|
|
19035
|
+
},
|
|
19036
|
+
transaction
|
|
19037
|
+
);
|
|
19038
|
+
}
|
|
19039
|
+
if (toRevoke.length > 0) {
|
|
19040
|
+
await deps.accessControlStore.revokeSessionAccess(
|
|
19041
|
+
{ tenant_id: requestContext.tenant_id, session_id: sessionId, subjects: toRevoke },
|
|
19042
|
+
transaction
|
|
19043
|
+
);
|
|
19044
|
+
}
|
|
19045
|
+
});
|
|
19046
|
+
const records = await deps.accessControlStore.listSessionAccess({
|
|
19047
|
+
tenant_id: requestContext.tenant_id,
|
|
19048
|
+
session_id: sessionId
|
|
19049
|
+
});
|
|
19050
|
+
return c.json({ data: records.map(toWireSessionGrant) }, 200);
|
|
19051
|
+
};
|
|
18763
19052
|
const router = new OpenAPIHono14();
|
|
18764
19053
|
router.openapi(createSessionRoute, createSessionHandler);
|
|
18765
19054
|
router.openapi(getSessionRoute, getSessionHandler);
|
|
@@ -18768,6 +19057,8 @@ function createSessionsRouter(deps) {
|
|
|
18768
19057
|
router.openapi(listSessionsRoute, listSessionsHandler);
|
|
18769
19058
|
router.openapi(cancelSessionRoute, cancelSessionHandler);
|
|
18770
19059
|
router.openapi(listSessionEventsRoute, listSessionEventsHandler);
|
|
19060
|
+
router.openapi(listSessionGrantsRoute, listSessionGrantsHandler);
|
|
19061
|
+
router.openapi(updateSessionGrantsRoute, updateSessionGrantsHandler);
|
|
18771
19062
|
deps.requestReplyRouter.registerRoute(SESSIONS_CANCEL_PATH, cancelSessionTurnPeerHandler(deps.activeTurns));
|
|
18772
19063
|
return router;
|
|
18773
19064
|
}
|
|
@@ -18782,9 +19073,9 @@ import { assertSafeOutboundUrl as assertSafeOutboundUrl2, OUTBOUND_URL_BLOCKED a
|
|
|
18782
19073
|
import { HTTPException as HTTPException15 } from "hono/http-exception";
|
|
18783
19074
|
|
|
18784
19075
|
// src/routes/modelProviderRoutes.ts
|
|
18785
|
-
import { createRoute as createRoute15, z as
|
|
18786
|
-
var ModelProviderNameParamsSchema =
|
|
18787
|
-
name:
|
|
19076
|
+
import { createRoute as createRoute15, z as z39 } from "@hono/zod-openapi";
|
|
19077
|
+
var ModelProviderNameParamsSchema = z39.object({
|
|
19078
|
+
name: z39.string().min(1).describe("Model provider name.")
|
|
18788
19079
|
});
|
|
18789
19080
|
var listModelProvidersRoute = createRoute15({
|
|
18790
19081
|
method: "get",
|
|
@@ -19283,10 +19574,10 @@ init_skillStore();
|
|
|
19283
19574
|
import { OpenAPIHono as OpenAPIHono17 } from "@hono/zod-openapi";
|
|
19284
19575
|
|
|
19285
19576
|
// src/routes/skillRoutes.ts
|
|
19286
|
-
import { createRoute as createRoute17, z as
|
|
19577
|
+
import { createRoute as createRoute17, z as z40 } from "@hono/zod-openapi";
|
|
19287
19578
|
init_skill();
|
|
19288
|
-
var SkillNameParamsSchema =
|
|
19289
|
-
name:
|
|
19579
|
+
var SkillNameParamsSchema = z40.object({
|
|
19580
|
+
name: z40.string().min(1).describe("Skill name.")
|
|
19290
19581
|
});
|
|
19291
19582
|
var listAvailableSkillsRoute = createRoute17({
|
|
19292
19583
|
method: "get",
|
|
@@ -19737,6 +20028,114 @@ function createSettingsRouter(deps) {
|
|
|
19737
20028
|
return router;
|
|
19738
20029
|
}
|
|
19739
20030
|
|
|
20031
|
+
// src/apis/users.ts
|
|
20032
|
+
import { OpenAPIHono as OpenAPIHono20 } from "@hono/zod-openapi";
|
|
20033
|
+
import { InvalidPageTokenError as InvalidPageTokenError4 } from "@truefoundry/trueforge-core/agent-session";
|
|
20034
|
+
import {
|
|
20035
|
+
decodeOffsetPageToken,
|
|
20036
|
+
encodeOffsetPageToken
|
|
20037
|
+
} from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
20038
|
+
import { HTTPException as HTTPException18 } from "hono/http-exception";
|
|
20039
|
+
|
|
20040
|
+
// src/routes/userRoutes.ts
|
|
20041
|
+
import { createRoute as createRoute19 } from "@hono/zod-openapi";
|
|
20042
|
+
|
|
20043
|
+
// src/schemas/user.ts
|
|
20044
|
+
init_common();
|
|
20045
|
+
import { z as z41 } from "@hono/zod-openapi";
|
|
20046
|
+
import { TokenPaginationSchema as TokenPaginationSchema7 } from "@truefoundry/trueforge-core/agent-session";
|
|
20047
|
+
var LIST_USERS_PAGE_LIMIT = 100;
|
|
20048
|
+
var LIST_USERS_MAX_IDS = 100;
|
|
20049
|
+
var UserSchema = z41.object({
|
|
20050
|
+
id: z41.string().describe("User id, unique within the tenant."),
|
|
20051
|
+
display_name: z41.string().describe("Human-readable name for the user."),
|
|
20052
|
+
email: z41.string().describe("Email of the user.")
|
|
20053
|
+
}).openapi("User");
|
|
20054
|
+
var ListUsersRequestQuerySchema = z41.object({
|
|
20055
|
+
query: z41.string().trim().min(1).max(200).optional().describe("Case-insensitive substring match on email or display name."),
|
|
20056
|
+
limit: z41.coerce.number().int().min(1).max(LIST_USERS_PAGE_LIMIT).optional().default(PAGE_LIMIT).describe(`Page size. Defaults to ${String(PAGE_LIMIT)}, max ${String(LIST_USERS_PAGE_LIMIT)}.`),
|
|
20057
|
+
page_token: z41.string().optional().describe("Opaque token from a previous response `next_page_token`."),
|
|
20058
|
+
ids: z41.string().optional().openapi({
|
|
20059
|
+
type: "string",
|
|
20060
|
+
description: `Return only these users (comma-separated ids, up to ${String(LIST_USERS_MAX_IDS)}). Users that are unknown or inactive are omitted. Cannot be combined with \`query\` or \`page_token\`.`
|
|
20061
|
+
}).transform((value) => parseCommaSeparatedQuery(value)).pipe(z41.array(z41.string().min(1).max(255)).min(1).max(LIST_USERS_MAX_IDS).optional())
|
|
20062
|
+
}).refine((q) => q.ids === void 0 || q.query === void 0 && q.page_token === void 0, {
|
|
20063
|
+
message: "`ids` cannot be combined with `query` or `page_token`."
|
|
20064
|
+
}).openapi("ListUsersRequestQuery");
|
|
20065
|
+
var ListUsersResponseSchema = z41.object({
|
|
20066
|
+
data: z41.array(UserSchema),
|
|
20067
|
+
pagination: TokenPaginationSchema7
|
|
20068
|
+
}).openapi("ListUsersResponse");
|
|
20069
|
+
|
|
20070
|
+
// src/routes/userRoutes.ts
|
|
20071
|
+
var listUsersRoute = createRoute19({
|
|
20072
|
+
method: "get",
|
|
20073
|
+
path: "/",
|
|
20074
|
+
tags: ["Users" /* USERS */],
|
|
20075
|
+
summary: "List users",
|
|
20076
|
+
description: "List users in the tenant that sessions can be shared with. Searches email and display name, or looks up specific users with `ids`.",
|
|
20077
|
+
"x-fern-sdk-group-name": ["users"],
|
|
20078
|
+
"x-fern-sdk-method-name": "list",
|
|
20079
|
+
"x-fern-pagination": TOKEN_PAGINATION,
|
|
20080
|
+
request: {
|
|
20081
|
+
query: ListUsersRequestQuerySchema
|
|
20082
|
+
},
|
|
20083
|
+
responses: {
|
|
20084
|
+
200: {
|
|
20085
|
+
content: { "application/json": { schema: ListUsersResponseSchema } },
|
|
20086
|
+
description: "Paginated users."
|
|
20087
|
+
},
|
|
20088
|
+
400: {
|
|
20089
|
+
content: { "application/json": { schema: RequestErrorResponseSchema } },
|
|
20090
|
+
description: "Invalid query parameters or page token."
|
|
20091
|
+
}
|
|
20092
|
+
}
|
|
20093
|
+
});
|
|
20094
|
+
|
|
20095
|
+
// src/apis/users.ts
|
|
20096
|
+
function decodeOffset(pageToken) {
|
|
20097
|
+
try {
|
|
20098
|
+
return decodeOffsetPageToken(pageToken);
|
|
20099
|
+
} catch (error) {
|
|
20100
|
+
if (error instanceof InvalidPageTokenError4) {
|
|
20101
|
+
throw new HTTPException18(400, { message: error.message, cause: error });
|
|
20102
|
+
}
|
|
20103
|
+
throw error;
|
|
20104
|
+
}
|
|
20105
|
+
}
|
|
20106
|
+
function createUsersRouter(deps) {
|
|
20107
|
+
const listUsersHandler = async (c) => {
|
|
20108
|
+
const { query, limit, page_token: pageToken, ids } = c.req.valid("query");
|
|
20109
|
+
const context = deps.resolveRequestContext(c);
|
|
20110
|
+
if (ids !== void 0) {
|
|
20111
|
+
const users = await deps.userStore.getUsersByIds({ context, ids });
|
|
20112
|
+
return c.json({ data: users, pagination: { limit: ids.length } }, 200);
|
|
20113
|
+
}
|
|
20114
|
+
const offset = decodeOffset(pageToken);
|
|
20115
|
+
const { data, total } = await deps.userStore.listUsers({
|
|
20116
|
+
context,
|
|
20117
|
+
query,
|
|
20118
|
+
limit,
|
|
20119
|
+
offset
|
|
20120
|
+
});
|
|
20121
|
+
const nextOffset = offset + data.length;
|
|
20122
|
+
return c.json(
|
|
20123
|
+
{
|
|
20124
|
+
data,
|
|
20125
|
+
pagination: {
|
|
20126
|
+
limit,
|
|
20127
|
+
...data.length > 0 && nextOffset < total ? { next_page_token: encodeOffsetPageToken(nextOffset) } : {},
|
|
20128
|
+
...offset > 0 ? { previous_page_token: encodeOffsetPageToken(Math.max(0, offset - limit)) } : {}
|
|
20129
|
+
}
|
|
20130
|
+
},
|
|
20131
|
+
200
|
|
20132
|
+
);
|
|
20133
|
+
};
|
|
20134
|
+
const router = new OpenAPIHono20();
|
|
20135
|
+
router.openapi(listUsersRoute, listUsersHandler);
|
|
20136
|
+
return router;
|
|
20137
|
+
}
|
|
20138
|
+
|
|
19740
20139
|
// src/app.ts
|
|
19741
20140
|
init_config();
|
|
19742
20141
|
|
|
@@ -19763,9 +20162,9 @@ var PACKAGE_VERSION = readPackageVersion();
|
|
|
19763
20162
|
init_schedule();
|
|
19764
20163
|
|
|
19765
20164
|
// src/zodErrorResponse.ts
|
|
19766
|
-
import { z as
|
|
20165
|
+
import { z as z42 } from "@hono/zod-openapi";
|
|
19767
20166
|
function zodErrorResponse(c, error) {
|
|
19768
|
-
return c.json({ error: { message:
|
|
20167
|
+
return c.json({ error: { message: z42.prettifyError(error) } }, 400);
|
|
19769
20168
|
}
|
|
19770
20169
|
var zodValidationHook = (result) => {
|
|
19771
20170
|
if (!result.success) {
|
|
@@ -19808,13 +20207,13 @@ function createSessionPathLogContextMiddleware() {
|
|
|
19808
20207
|
};
|
|
19809
20208
|
}
|
|
19810
20209
|
function withAuth(router, middleware) {
|
|
19811
|
-
const shell = new
|
|
20210
|
+
const shell = new OpenAPIHono21();
|
|
19812
20211
|
shell.use("*", middleware);
|
|
19813
20212
|
shell.route("/", router);
|
|
19814
20213
|
return shell;
|
|
19815
20214
|
}
|
|
19816
20215
|
function withAdminAuth(router, middleware) {
|
|
19817
|
-
const shell = new
|
|
20216
|
+
const shell = new OpenAPIHono21();
|
|
19818
20217
|
shell.use("*", middleware);
|
|
19819
20218
|
shell.route("/", router);
|
|
19820
20219
|
return shell;
|
|
@@ -19862,7 +20261,7 @@ function createAppErrorHandler(params) {
|
|
|
19862
20261
|
}
|
|
19863
20262
|
params.logger.warn(message, fields);
|
|
19864
20263
|
};
|
|
19865
|
-
if (error instanceof
|
|
20264
|
+
if (error instanceof z43.ZodError) {
|
|
19866
20265
|
logError(400, "Client API error");
|
|
19867
20266
|
return zodErrorResponse(c, error);
|
|
19868
20267
|
}
|
|
@@ -19870,7 +20269,7 @@ function createAppErrorHandler(params) {
|
|
|
19870
20269
|
logError(400, "Client API error");
|
|
19871
20270
|
return c.json({ error: { message: error.message } }, 400);
|
|
19872
20271
|
}
|
|
19873
|
-
if (error instanceof
|
|
20272
|
+
if (error instanceof HTTPException19) {
|
|
19874
20273
|
logError(error.status, error.status >= 500 ? "Server API error" : "Client API error");
|
|
19875
20274
|
return c.json({ error: { message: error.message } }, error.status);
|
|
19876
20275
|
}
|
|
@@ -19911,7 +20310,7 @@ function routeNotFound(c) {
|
|
|
19911
20310
|
return c.json({ error: { message: `Route not found: ${c.req.method} ${c.req.path}` } }, 404);
|
|
19912
20311
|
}
|
|
19913
20312
|
function createServerApp(deps) {
|
|
19914
|
-
const app = new
|
|
20313
|
+
const app = new OpenAPIHono21({ defaultHook: zodValidationHook });
|
|
19915
20314
|
const authMiddleware = createAuthMiddleware(deps.authenticator);
|
|
19916
20315
|
const adminAuthMiddleware = createAdminAuthMiddleware(deps.authenticator);
|
|
19917
20316
|
const scheduleExecutionAuthMiddleware = createApiKeyAuthMiddleware(config_default.TRUEFORGE_API_KEY);
|
|
@@ -19952,6 +20351,10 @@ function createServerApp(deps) {
|
|
|
19952
20351
|
authMiddleware
|
|
19953
20352
|
})
|
|
19954
20353
|
);
|
|
20354
|
+
app.route(
|
|
20355
|
+
"/api/v1/users",
|
|
20356
|
+
withAuth(createUsersRouter({ userStore: deps.userStore, resolveRequestContext }), authMiddleware)
|
|
20357
|
+
);
|
|
19955
20358
|
app.route(
|
|
19956
20359
|
"/api/v1/capabilities",
|
|
19957
20360
|
withAuth(
|
|
@@ -20150,6 +20553,9 @@ function createServerApp(deps) {
|
|
|
20150
20553
|
createSessionsRouter({
|
|
20151
20554
|
sessions: deps.sessions,
|
|
20152
20555
|
sessionStore: deps.sessionStore,
|
|
20556
|
+
accessControlStore: deps.accessControlStore,
|
|
20557
|
+
userStore: deps.userStore,
|
|
20558
|
+
withTransaction: deps.withTransaction,
|
|
20153
20559
|
activeTurns: deps.activeTurns,
|
|
20154
20560
|
resolveModelProviderStore: deps.resolveModelProviderStore,
|
|
20155
20561
|
resolveMcpServerStore: deps.resolveMcpServerStore,
|
|
@@ -20295,7 +20701,7 @@ var TrueForgeAuthorizer = class {
|
|
|
20295
20701
|
init_config();
|
|
20296
20702
|
|
|
20297
20703
|
// src/truefoundry/TrueFoundryAuthenticator.ts
|
|
20298
|
-
import { HTTPException as
|
|
20704
|
+
import { HTTPException as HTTPException20 } from "hono/http-exception";
|
|
20299
20705
|
var TrueFoundryAuthenticator = class {
|
|
20300
20706
|
#client;
|
|
20301
20707
|
constructor(client2) {
|
|
@@ -20304,7 +20710,7 @@ var TrueFoundryAuthenticator = class {
|
|
|
20304
20710
|
async authenticate(c) {
|
|
20305
20711
|
const token = extractRequestToken(c);
|
|
20306
20712
|
if (!token) {
|
|
20307
|
-
throw new
|
|
20713
|
+
throw new HTTPException20(401, { message: "Authentication required" });
|
|
20308
20714
|
}
|
|
20309
20715
|
const session = await this.#client.getSession(token);
|
|
20310
20716
|
const { subject } = session.user;
|
|
@@ -20322,17 +20728,17 @@ var TrueFoundryAuthenticator = class {
|
|
|
20322
20728
|
};
|
|
20323
20729
|
|
|
20324
20730
|
// src/auth/oidcAuthenticator.ts
|
|
20325
|
-
import { HTTPException as
|
|
20731
|
+
import { HTTPException as HTTPException21 } from "hono/http-exception";
|
|
20326
20732
|
import { jwtVerify as jwtVerify2 } from "jose";
|
|
20327
20733
|
var OidcAuthenticator = class {
|
|
20328
20734
|
async authenticate(c) {
|
|
20329
20735
|
const oidcVerify2 = getOidcVerify();
|
|
20330
20736
|
if (!oidcVerify2) {
|
|
20331
|
-
throw new
|
|
20737
|
+
throw new HTTPException21(401, { message: "Authentication required" });
|
|
20332
20738
|
}
|
|
20333
20739
|
const token = extractRequestToken(c);
|
|
20334
20740
|
if (!token) {
|
|
20335
|
-
throw new
|
|
20741
|
+
throw new HTTPException21(401, { message: "Authentication required" });
|
|
20336
20742
|
}
|
|
20337
20743
|
let payload;
|
|
20338
20744
|
try {
|
|
@@ -20341,7 +20747,7 @@ var OidcAuthenticator = class {
|
|
|
20341
20747
|
audience: oidcVerify2.audience
|
|
20342
20748
|
}));
|
|
20343
20749
|
} catch {
|
|
20344
|
-
throw new
|
|
20750
|
+
throw new HTTPException21(401, { message: "Authentication required" });
|
|
20345
20751
|
}
|
|
20346
20752
|
try {
|
|
20347
20753
|
const claims = { ...payload };
|
|
@@ -20351,7 +20757,7 @@ var OidcAuthenticator = class {
|
|
|
20351
20757
|
user_credential: token
|
|
20352
20758
|
});
|
|
20353
20759
|
} catch (error) {
|
|
20354
|
-
throw new
|
|
20760
|
+
throw new HTTPException21(401, { message: "Authentication required", cause: error });
|
|
20355
20761
|
}
|
|
20356
20762
|
}
|
|
20357
20763
|
};
|
|
@@ -20412,7 +20818,7 @@ function loadYamlAtPath(filePath, schema) {
|
|
|
20412
20818
|
}
|
|
20413
20819
|
|
|
20414
20820
|
// src/catalog/mcpCatalog.gen.ts
|
|
20415
|
-
var shippedMcpCatalogYaml = "# Shipped MCP catalog: server presets offered by\n# GET /api/v1/catalog/mcp-servers for the UI to copy into\n# PUT /api/v1/settings/mcp-servers bodies. Discovery-only \u2014 never executed against.\nmcp_servers:\n - type: remote\n name: linear\n logo: https://assets.production.truefoundry.com/linear.svg\n url: https://mcp.linear.app/mcp\n description: Search, read, and create Linear issues.\n auth:\n type: dcr\n - type: remote\n name: notion\n logo: https://assets.production.truefoundry.com/notion.svg\n url: https://mcp.notion.com/mcp\n description: Search pages, read content, query databases, create pages.\n auth:\n type: dcr\n - type: remote\n name: sentry\n logo: https://assets.production.truefoundry.com/sentry.svg\n url: https://mcp.sentry.dev/mcp\n description: Search errors, read stack traces, and check releases.\n auth:\n type: dcr\n - type: remote\n name: deepwiki\n logo: https://assets.production.truefoundry.com/deepwiki.png\n url: https://mcp.deepwiki.com/mcp\n description: Read documentation and ask questions about any public GitHub repository.\n - type: remote\n name: exa\n logo: https://assets.production.truefoundry.com/exa.svg\n url: https://mcp.exa.ai/mcp\n description: Search the web, fetch page contents, and find similar pages.\n - type: remote\n name: parallel-web\n logo: https://assets.production.truefoundry.com/parallel-web.svg\n url: https://search.parallel.ai/mcp\n description: Search the web and get ranked results with extracted content.\n - type: remote\n name: github\n logo: https://assets.production.truefoundry.com/github.svg\n url: https://api.githubcopilot.com/mcp/\n description: Work with issues, pull requests, repository files, and CI status.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_GITHUB_PAT\n - type: remote\n name: tavily\n logo: https://assets.production.truefoundry.com/tavily.svg\n url: https://mcp.tavily.com/mcp\n description: Search the web, extract page content, and crawl sites.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_TAVILY_API_KEY\n - type: remote\n name: bright-data\n logo: https://assets.production.truefoundry.com/bright-data.png\n url: https://mcp.brightdata.com/mcp\n description: Search the web and scrape pages, including sites behind bot protection.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_BRIGHT_DATA_API_TOKEN\n - type: remote\n name: supabase\n logo: https://assets.production.truefoundry.com/supabase.svg\n url: https://mcp.supabase.com/mcp\n description: Run SQL queries, manage tables, and inspect Supabase projects.\n auth:\n type: dcr\n - type: remote\n name: stripe\n logo: https://assets.production.truefoundry.com/stripe.svg\n url: https://mcp.stripe.com\n description: Create and manage customers, payments, invoices, and subscriptions.\n auth:\n type: dcr\n - type: remote\n name: confluence\n logo: https://assets.production.truefoundry.com/confluence.svg\n url: https://mcp.atlassian.com/v1/mcp\n description: Search spaces, read pages, and create or update content.\n auth:\n type: dcr\n - type: remote\n name: jira\n logo: https://assets.production.truefoundry.com/jira.png\n url: https://mcp.atlassian.com/v1/mcp\n description: Search, read, create, and update Jira issues.\n auth:\n type: dcr\n - type: remote\n name: posthog\n logo: https://assets.production.truefoundry.com/posthog.svg\n url: https://mcp.posthog.com/mcp\n description: Query product analytics, run SQL, and manage feature flags.\n auth:\n type: dcr\n - type: remote\n logo: https://assets.production.truefoundry.com/you.svg\n name: you\n url: https://api.you.com/mcp?profile=free\n description: Search the web, fetch page content, and run multi-step research using You.com. Keyless free profile; pass a You.com API key at https://api.you.com/mcp for full-rate access.\n - type: remote\n logo: https://assets.production.truefoundry.com/keenable.svg\n name: keenable\n url: https://api.keenable.ai/mcp?keenable_title=trueforge\n description: Search the web and fetch page content as markdown using Keenable. Keyless; add a Keenable API key as an X-API-Key header for higher rate limits.\n";
|
|
20821
|
+
var shippedMcpCatalogYaml = "# Shipped MCP catalog: server presets offered by\n# GET /api/v1/catalog/mcp-servers for the UI to copy into\n# PUT /api/v1/settings/mcp-servers bodies. Discovery-only \u2014 never executed against.\nmcp_servers:\n - type: remote\n name: linear\n logo: https://assets.production.truefoundry.com/linear.svg\n url: https://mcp.linear.app/mcp\n description: Search, read, and create Linear issues.\n auth:\n type: dcr\n - type: remote\n name: notion\n logo: https://assets.production.truefoundry.com/notion.svg\n url: https://mcp.notion.com/mcp\n description: Search pages, read content, query databases, create pages.\n auth:\n type: dcr\n - type: remote\n name: sentry\n logo: https://assets.production.truefoundry.com/sentry.svg\n url: https://mcp.sentry.dev/mcp\n description: Search errors, read stack traces, and check releases.\n auth:\n type: dcr\n - type: remote\n name: deepwiki\n logo: https://assets.production.truefoundry.com/deepwiki.png\n url: https://mcp.deepwiki.com/mcp\n description: Read documentation and ask questions about any public GitHub repository.\n - type: remote\n name: exa\n logo: https://assets.production.truefoundry.com/exa.svg\n url: https://mcp.exa.ai/mcp\n description: Search the web, fetch page contents, and find similar pages.\n - type: remote\n name: parallel-web\n logo: https://assets.production.truefoundry.com/parallel-web.svg\n url: https://search.parallel.ai/mcp\n description: Search the web and get ranked results with extracted content.\n - type: remote\n name: github\n logo: https://assets.production.truefoundry.com/github.svg\n url: https://api.githubcopilot.com/mcp/\n description: Work with issues, pull requests, repository files, and CI status.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_GITHUB_PAT\n - type: remote\n name: tavily\n logo: https://assets.production.truefoundry.com/tavily.svg\n url: https://mcp.tavily.com/mcp\n description: Search the web, extract page content, and crawl sites.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_TAVILY_API_KEY\n - type: remote\n name: bright-data\n logo: https://assets.production.truefoundry.com/bright-data.png\n url: https://mcp.brightdata.com/mcp\n description: Search the web and scrape pages, including sites behind bot protection.\n auth:\n type: header\n headers:\n Authorization: Bearer YOUR_BRIGHT_DATA_API_TOKEN\n - type: remote\n name: supabase\n logo: https://assets.production.truefoundry.com/supabase.svg\n url: https://mcp.supabase.com/mcp\n description: Run SQL queries, manage tables, and inspect Supabase projects.\n auth:\n type: dcr\n - type: remote\n name: stripe\n logo: https://assets.production.truefoundry.com/stripe.svg\n url: https://mcp.stripe.com\n description: Create and manage customers, payments, invoices, and subscriptions.\n auth:\n type: dcr\n - type: remote\n name: confluence\n logo: https://assets.production.truefoundry.com/confluence.svg\n url: https://mcp.atlassian.com/v1/mcp\n description: Search spaces, read pages, and create or update content.\n auth:\n type: dcr\n - type: remote\n name: jira\n logo: https://assets.production.truefoundry.com/jira.png\n url: https://mcp.atlassian.com/v1/mcp\n description: Search, read, create, and update Jira issues.\n auth:\n type: dcr\n - type: remote\n name: posthog\n logo: https://assets.production.truefoundry.com/posthog.svg\n url: https://mcp.posthog.com/mcp\n description: Query product analytics, run SQL, and manage feature flags.\n auth:\n type: dcr\n - type: remote\n logo: https://assets.production.truefoundry.com/you.svg\n name: you\n url: https://api.you.com/mcp?profile=free\n description: Search the web, fetch page content, and run multi-step research using You.com. Keyless free profile; pass a You.com API key at https://api.you.com/mcp for full-rate access.\n - type: remote\n logo: https://assets.production.truefoundry.com/keenable.svg\n name: keenable\n url: https://api.keenable.ai/mcp?keenable_title=trueforge\n description: Search the web and fetch page content as markdown using Keenable. Keyless; add a Keenable API key as an X-API-Key header for higher rate limits.\n - type: remote\n name: evolink\n url: https://mcp.evolink.ai/mcp\n description: Generate images, video, music and speech with 150+ AI models. Sign in with your EvoLink account (OAuth); model search, prices and quotes are free, and generation is billed to your EvoLink balance.\n auth:\n type: dcr\n";
|
|
20416
20822
|
|
|
20417
20823
|
// src/catalog/McpCatalog.ts
|
|
20418
20824
|
var McpCatalog = class _McpCatalog {
|
|
@@ -20925,6 +21331,16 @@ var McpServerWithAuthStore = class {
|
|
|
20925
21331
|
}
|
|
20926
21332
|
};
|
|
20927
21333
|
|
|
21334
|
+
// src/db/userStore.ts
|
|
21335
|
+
var EmptyUserStore = class {
|
|
21336
|
+
listUsers() {
|
|
21337
|
+
return Promise.resolve({ data: [], total: 0 });
|
|
21338
|
+
}
|
|
21339
|
+
getUsersByIds() {
|
|
21340
|
+
return Promise.resolve([]);
|
|
21341
|
+
}
|
|
21342
|
+
};
|
|
21343
|
+
|
|
20928
21344
|
// src/frontend.ts
|
|
20929
21345
|
import { serveStatic } from "@hono/node-server/serve-static";
|
|
20930
21346
|
import { every } from "hono/combine";
|
|
@@ -21917,7 +22333,7 @@ var InlineModelProviderStore = class {
|
|
|
21917
22333
|
};
|
|
21918
22334
|
|
|
21919
22335
|
// src/truefoundry/inlineResources.ts
|
|
21920
|
-
import { HTTPException as
|
|
22336
|
+
import { HTTPException as HTTPException22 } from "hono/http-exception";
|
|
21921
22337
|
init_skill();
|
|
21922
22338
|
var X_TFG_MCP = "x-tfg-mcp";
|
|
21923
22339
|
var X_TFG_SKILLS = "x-tfg-skills";
|
|
@@ -21925,10 +22341,10 @@ var X_TFG_MODELS = "x-tfg-models";
|
|
|
21925
22341
|
function assertInlineResourceHeadersAllowed(input) {
|
|
21926
22342
|
const labeled = input.headerNames.join("/");
|
|
21927
22343
|
if (!input.isTrueFoundryMode) {
|
|
21928
|
-
throw new
|
|
22344
|
+
throw new HTTPException22(400, { message: `${labeled} requires TrueFoundry mode` });
|
|
21929
22345
|
}
|
|
21930
22346
|
if (!input.allowInlineResources) {
|
|
21931
|
-
throw new
|
|
22347
|
+
throw new HTTPException22(400, {
|
|
21932
22348
|
message: `${labeled} is only allowed when creating or updating an inline session, or on a turn for one`
|
|
21933
22349
|
});
|
|
21934
22350
|
}
|
|
@@ -21975,20 +22391,20 @@ function parseByName(input) {
|
|
|
21975
22391
|
try {
|
|
21976
22392
|
decoded = JSON.parse(raw);
|
|
21977
22393
|
} catch (error) {
|
|
21978
|
-
throw new
|
|
22394
|
+
throw new HTTPException22(400, { message: `${header} must be a JSON object`, cause: error });
|
|
21979
22395
|
}
|
|
21980
22396
|
if (!isPlainObject(decoded)) {
|
|
21981
|
-
throw new
|
|
22397
|
+
throw new HTTPException22(400, { message: `${header} must map each name to a definition` });
|
|
21982
22398
|
}
|
|
21983
22399
|
const manifests = {};
|
|
21984
22400
|
Object.setPrototypeOf(manifests, null);
|
|
21985
22401
|
for (const [name, definition] of Object.entries(decoded)) {
|
|
21986
22402
|
if (!isPlainObject(definition)) {
|
|
21987
|
-
throw new
|
|
22403
|
+
throw new HTTPException22(400, { message: `${header} entry "${name}" must be an object` });
|
|
21988
22404
|
}
|
|
21989
22405
|
const parsed = parseEntry(name, definition);
|
|
21990
22406
|
if (!parsed.ok) {
|
|
21991
|
-
throw new
|
|
22407
|
+
throw new HTTPException22(400, { message: `${header} entry "${name}" ${parsed.reason}` });
|
|
21992
22408
|
}
|
|
21993
22409
|
manifests[name] = parsed.manifest;
|
|
21994
22410
|
}
|
|
@@ -22000,7 +22416,7 @@ function isPlainObject(value) {
|
|
|
22000
22416
|
|
|
22001
22417
|
// src/truefoundry/InlineSkillStore.ts
|
|
22002
22418
|
init_gitSkillMounts();
|
|
22003
|
-
import { HTTPException as
|
|
22419
|
+
import { HTTPException as HTTPException24 } from "hono/http-exception";
|
|
22004
22420
|
var InlineSkillStore = class {
|
|
22005
22421
|
#inline;
|
|
22006
22422
|
constructor(input) {
|
|
@@ -22055,7 +22471,7 @@ var InlineSkillStore = class {
|
|
|
22055
22471
|
#require(name) {
|
|
22056
22472
|
const manifest = this.#inline[name];
|
|
22057
22473
|
if (manifest === void 0) {
|
|
22058
|
-
throw new
|
|
22474
|
+
throw new HTTPException24(422, {
|
|
22059
22475
|
message: `Unknown skill "${name}" \u2014 not present in ${X_TFG_SKILLS}`
|
|
22060
22476
|
});
|
|
22061
22477
|
}
|
|
@@ -22075,25 +22491,25 @@ var InlineSkillStore = class {
|
|
|
22075
22491
|
};
|
|
22076
22492
|
function unsupportedInlineSkillWrite() {
|
|
22077
22493
|
return Promise.reject(
|
|
22078
|
-
new
|
|
22494
|
+
new HTTPException24(400, { message: `Request-scoped skills from ${X_TFG_SKILLS} do not support writes` })
|
|
22079
22495
|
);
|
|
22080
22496
|
}
|
|
22081
22497
|
|
|
22082
22498
|
// src/truefoundry/perServerMcpHeaders.ts
|
|
22083
|
-
import { HTTPException as
|
|
22084
|
-
import { z as
|
|
22499
|
+
import { HTTPException as HTTPException25 } from "hono/http-exception";
|
|
22500
|
+
import { z as z44 } from "zod";
|
|
22085
22501
|
var X_TFG_MCP_HEADERS = "x-tfg-mcp-headers";
|
|
22086
|
-
var PerServerMcpHeadersSchema =
|
|
22502
|
+
var PerServerMcpHeadersSchema = z44.record(z44.string().min(1), z44.record(z44.string().min(1), z44.string()));
|
|
22087
22503
|
function parsePerServerMcpHeaders(raw) {
|
|
22088
22504
|
let decoded;
|
|
22089
22505
|
try {
|
|
22090
22506
|
decoded = JSON.parse(raw);
|
|
22091
22507
|
} catch (error) {
|
|
22092
|
-
throw new
|
|
22508
|
+
throw new HTTPException25(400, { message: `${X_TFG_MCP_HEADERS} must be a JSON object`, cause: error });
|
|
22093
22509
|
}
|
|
22094
22510
|
const parsed = PerServerMcpHeadersSchema.safeParse(decoded);
|
|
22095
22511
|
if (!parsed.success) {
|
|
22096
|
-
throw new
|
|
22512
|
+
throw new HTTPException25(400, {
|
|
22097
22513
|
message: `${X_TFG_MCP_HEADERS} must map each MCP server name to a header map`
|
|
22098
22514
|
});
|
|
22099
22515
|
}
|
|
@@ -22113,10 +22529,10 @@ import {
|
|
|
22113
22529
|
getOperationMetrics as getOperationMetrics4,
|
|
22114
22530
|
httpStatusClass
|
|
22115
22531
|
} from "@truefoundry/trueforge-core/core";
|
|
22116
|
-
import { HTTPException as
|
|
22532
|
+
import { HTTPException as HTTPException26 } from "hono/http-exception";
|
|
22117
22533
|
import { LRUCache } from "lru-cache";
|
|
22118
22534
|
import { fetch as undiciFetch3 } from "undici";
|
|
22119
|
-
import { z as
|
|
22535
|
+
import { z as z47 } from "zod";
|
|
22120
22536
|
|
|
22121
22537
|
// src/truefoundry/internalTls.ts
|
|
22122
22538
|
function normalizeInternalTlsUrl(input) {
|
|
@@ -22130,20 +22546,20 @@ function createInternalTlsDispatcher(options) {
|
|
|
22130
22546
|
}
|
|
22131
22547
|
|
|
22132
22548
|
// src/truefoundry/mapSfyAgentSkills.ts
|
|
22133
|
-
import { z as
|
|
22134
|
-
var SfyRegistryManifestSchema =
|
|
22549
|
+
import { z as z45 } from "zod";
|
|
22550
|
+
var SfyRegistryManifestSchema = z45.object({
|
|
22135
22551
|
// Display label only — not TF ResourceName / DNS-label rules.
|
|
22136
|
-
name:
|
|
22137
|
-
version:
|
|
22552
|
+
name: z45.string().min(1),
|
|
22553
|
+
version: z45.number().int().positive(),
|
|
22138
22554
|
// SFY field is `ml_repo`; TrueForge wire is `repository_name`.
|
|
22139
|
-
ml_repo:
|
|
22140
|
-
source:
|
|
22141
|
-
description:
|
|
22555
|
+
ml_repo: z45.string().min(1),
|
|
22556
|
+
source: z45.object({
|
|
22557
|
+
description: z45.string().min(1).optional()
|
|
22142
22558
|
}).optional()
|
|
22143
22559
|
});
|
|
22144
|
-
var SfyRegistrySkillSchema =
|
|
22145
|
-
latest_version:
|
|
22146
|
-
fqn:
|
|
22560
|
+
var SfyRegistrySkillSchema = z45.object({
|
|
22561
|
+
latest_version: z45.object({
|
|
22562
|
+
fqn: z45.string().min(1),
|
|
22147
22563
|
manifest: SfyRegistryManifestSchema
|
|
22148
22564
|
})
|
|
22149
22565
|
}).transform(({ latest_version }) => ({
|
|
@@ -22154,20 +22570,20 @@ var SfyRegistrySkillSchema = z43.object({
|
|
|
22154
22570
|
repository_name: latest_version.manifest.ml_repo,
|
|
22155
22571
|
version: latest_version.manifest.version
|
|
22156
22572
|
}));
|
|
22157
|
-
var SfyRegistrySkillVersionSchema =
|
|
22158
|
-
agent_skill_id:
|
|
22159
|
-
fqn:
|
|
22573
|
+
var SfyRegistrySkillVersionSchema = z45.object({
|
|
22574
|
+
agent_skill_id: z45.string().min(1),
|
|
22575
|
+
fqn: z45.string().min(1),
|
|
22160
22576
|
manifest: SfyRegistryManifestSchema
|
|
22161
22577
|
});
|
|
22162
|
-
var ResolvedAgentSkillVersionSchema =
|
|
22163
|
-
fqn:
|
|
22164
|
-
name:
|
|
22165
|
-
description:
|
|
22166
|
-
skill_md_content:
|
|
22167
|
-
presigned_url:
|
|
22578
|
+
var ResolvedAgentSkillVersionSchema = z45.object({
|
|
22579
|
+
fqn: z45.string().min(1),
|
|
22580
|
+
name: z45.string().min(1),
|
|
22581
|
+
description: z45.string().min(1),
|
|
22582
|
+
skill_md_content: z45.string().nullable().optional(),
|
|
22583
|
+
presigned_url: z45.string().min(1).optional()
|
|
22168
22584
|
});
|
|
22169
|
-
var ResolveAgentSkillVersionsResponseSchema =
|
|
22170
|
-
skills:
|
|
22585
|
+
var ResolveAgentSkillVersionsResponseSchema = z45.object({
|
|
22586
|
+
skills: z45.array(ResolvedAgentSkillVersionSchema)
|
|
22171
22587
|
});
|
|
22172
22588
|
function mapSfyRegistrySkills(rows) {
|
|
22173
22589
|
return rows.map((row) => SfyRegistrySkillSchema.parse(row));
|
|
@@ -22191,48 +22607,48 @@ function mapResolvedAgentSkillVersions(payload) {
|
|
|
22191
22607
|
}
|
|
22192
22608
|
|
|
22193
22609
|
// src/truefoundry/mapSfyMcpServers.ts
|
|
22194
|
-
import { z as
|
|
22610
|
+
import { z as z46 } from "zod";
|
|
22195
22611
|
var MCP_PROXY_BASE_URL_TEMPLATE = "{{mcpProxyBaseURL}}";
|
|
22196
|
-
var IsoInstantSchema =
|
|
22612
|
+
var IsoInstantSchema = z46.union([z46.string().min(1), z46.date()]).transform((value, ctx) => {
|
|
22197
22613
|
if (value instanceof Date) {
|
|
22198
22614
|
if (!Number.isFinite(value.getTime())) {
|
|
22199
22615
|
ctx.addIssue({ code: "custom", message: "Invalid Date" });
|
|
22200
|
-
return
|
|
22616
|
+
return z46.NEVER;
|
|
22201
22617
|
}
|
|
22202
22618
|
return value.toISOString();
|
|
22203
22619
|
}
|
|
22204
22620
|
const ms = Date.parse(value);
|
|
22205
22621
|
if (!Number.isFinite(ms)) {
|
|
22206
22622
|
ctx.addIssue({ code: "custom", message: "Invalid ISO timestamp" });
|
|
22207
|
-
return
|
|
22623
|
+
return z46.NEVER;
|
|
22208
22624
|
}
|
|
22209
22625
|
return new Date(ms).toISOString();
|
|
22210
22626
|
});
|
|
22211
|
-
var SfyMcpServerRowSchema =
|
|
22212
|
-
id:
|
|
22213
|
-
name:
|
|
22214
|
-
proxyUrl:
|
|
22627
|
+
var SfyMcpServerRowSchema = z46.object({
|
|
22628
|
+
id: z46.string().min(1),
|
|
22629
|
+
name: z46.string().min(1),
|
|
22630
|
+
proxyUrl: z46.string().min(1),
|
|
22215
22631
|
createdAt: IsoInstantSchema,
|
|
22216
22632
|
updatedAt: IsoInstantSchema,
|
|
22217
|
-
manifest:
|
|
22218
|
-
description:
|
|
22219
|
-
auth_data:
|
|
22220
|
-
type:
|
|
22633
|
+
manifest: z46.object({
|
|
22634
|
+
description: z46.string().min(1).optional(),
|
|
22635
|
+
auth_data: z46.object({
|
|
22636
|
+
type: z46.string().min(1).optional()
|
|
22221
22637
|
}).optional()
|
|
22222
22638
|
}).optional()
|
|
22223
22639
|
});
|
|
22224
|
-
var SfyMcpAuthStatusAuthenticatedSchema =
|
|
22225
|
-
var SfyMcpAuthStatusNotRequiredSchema =
|
|
22226
|
-
var SfyMcpAuthStatusRequiredSchema =
|
|
22640
|
+
var SfyMcpAuthStatusAuthenticatedSchema = z46.object({ status: z46.literal("authenticated") });
|
|
22641
|
+
var SfyMcpAuthStatusNotRequiredSchema = z46.object({ status: z46.literal("authentication_not_required") });
|
|
22642
|
+
var SfyMcpAuthStatusRequiredSchema = z46.object({ status: z46.literal("authentication_required") });
|
|
22227
22643
|
var SfyMcpAuthorizeRequiredSchema = SfyMcpAuthStatusRequiredSchema.extend({
|
|
22228
|
-
authorization_endpoint:
|
|
22644
|
+
authorization_endpoint: z46.url()
|
|
22229
22645
|
});
|
|
22230
|
-
var SfyMcpAuthStatusSchema =
|
|
22646
|
+
var SfyMcpAuthStatusSchema = z46.discriminatedUnion("status", [
|
|
22231
22647
|
SfyMcpAuthStatusAuthenticatedSchema,
|
|
22232
22648
|
SfyMcpAuthStatusRequiredSchema,
|
|
22233
22649
|
SfyMcpAuthStatusNotRequiredSchema
|
|
22234
22650
|
]);
|
|
22235
|
-
var SfyMcpAuthorizeResultSchema =
|
|
22651
|
+
var SfyMcpAuthorizeResultSchema = z46.discriminatedUnion("status", [
|
|
22236
22652
|
SfyMcpAuthStatusAuthenticatedSchema,
|
|
22237
22653
|
SfyMcpAuthorizeRequiredSchema,
|
|
22238
22654
|
SfyMcpAuthStatusNotRequiredSchema
|
|
@@ -22303,34 +22719,35 @@ var AGENT_SKILL_VERSIONS_PATH = "v1/agent-skill-versions";
|
|
|
22303
22719
|
var SESSION_PATH = "v1/session";
|
|
22304
22720
|
var AGENT_PERMISSIONS_PATH = "v1/authorize/permissions";
|
|
22305
22721
|
var VEND_TOKEN_PATH = "internal/vend-token";
|
|
22722
|
+
var SUBJECTS_PEEK_PATH = "v1/subjects/peek";
|
|
22306
22723
|
var AGENT_SKILLS_PAGE_SIZE = 100;
|
|
22307
22724
|
var AGENT_SKILL_RESOLVE_CHUNK_SIZE = 50;
|
|
22308
|
-
var SessionSubjectSchema =
|
|
22309
|
-
subjectId:
|
|
22310
|
-
subjectType:
|
|
22311
|
-
subjectDisplayName:
|
|
22312
|
-
subjectSlug:
|
|
22725
|
+
var SessionSubjectSchema = z47.object({
|
|
22726
|
+
subjectId: z47.string().min(1),
|
|
22727
|
+
subjectType: z47.string().min(1),
|
|
22728
|
+
subjectDisplayName: z47.string().nullable().optional(),
|
|
22729
|
+
subjectSlug: z47.string().nullable().optional()
|
|
22313
22730
|
});
|
|
22314
|
-
var GetSessionUserSchema =
|
|
22315
|
-
tenantName:
|
|
22316
|
-
roles:
|
|
22731
|
+
var GetSessionUserSchema = z47.object({
|
|
22732
|
+
tenantName: z47.string().min(1),
|
|
22733
|
+
roles: z47.array(z47.string()),
|
|
22317
22734
|
subject: SessionSubjectSchema
|
|
22318
22735
|
});
|
|
22319
|
-
var GetSessionUnauthenticatedSchema =
|
|
22320
|
-
user:
|
|
22736
|
+
var GetSessionUnauthenticatedSchema = z47.object({
|
|
22737
|
+
user: z47.null()
|
|
22321
22738
|
});
|
|
22322
|
-
var GetSessionAuthenticatedSchema =
|
|
22739
|
+
var GetSessionAuthenticatedSchema = z47.object({
|
|
22323
22740
|
user: GetSessionUserSchema
|
|
22324
22741
|
});
|
|
22325
|
-
var GetSessionWireSchema =
|
|
22326
|
-
var TenantControlPlaneUrlSchema =
|
|
22327
|
-
controlPlaneURL:
|
|
22742
|
+
var GetSessionWireSchema = z47.union([GetSessionUnauthenticatedSchema, GetSessionAuthenticatedSchema]);
|
|
22743
|
+
var TenantControlPlaneUrlSchema = z47.object({
|
|
22744
|
+
controlPlaneURL: z47.url()
|
|
22328
22745
|
});
|
|
22329
|
-
var ListResponseSchema =
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
data:
|
|
22333
|
-
pagination:
|
|
22746
|
+
var ListResponseSchema = z47.union([
|
|
22747
|
+
z47.array(z47.unknown()),
|
|
22748
|
+
z47.object({
|
|
22749
|
+
data: z47.array(z47.unknown()).catch([]),
|
|
22750
|
+
pagination: z47.object({ total: z47.number().optional() }).optional()
|
|
22334
22751
|
})
|
|
22335
22752
|
]);
|
|
22336
22753
|
var SERVICE_FOUNDRY_OPERATIONS = {
|
|
@@ -22350,27 +22767,37 @@ var SERVICE_FOUNDRY_OPERATIONS = {
|
|
|
22350
22767
|
getTenantControlPlaneUrl: "get_session",
|
|
22351
22768
|
getAgentPermissions: "agent_permissions",
|
|
22352
22769
|
getTenantPermissions: "tenant_permissions",
|
|
22353
|
-
vendToken: "vend_token"
|
|
22770
|
+
vendToken: "vend_token",
|
|
22771
|
+
peekUsers: "users"
|
|
22354
22772
|
};
|
|
22355
|
-
var ServiceFoundryErrorSchema =
|
|
22356
|
-
message:
|
|
22773
|
+
var ServiceFoundryErrorSchema = z47.object({
|
|
22774
|
+
message: z47.union([z47.string(), z47.array(z47.string())]).optional()
|
|
22357
22775
|
});
|
|
22358
|
-
var PutRemoteAgentResponseSchema =
|
|
22359
|
-
agentId:
|
|
22776
|
+
var PutRemoteAgentResponseSchema = z47.object({
|
|
22777
|
+
agentId: z47.string().min(1)
|
|
22360
22778
|
});
|
|
22361
|
-
var AgentPermissionSchema =
|
|
22362
|
-
var AgentPermissionsSchema =
|
|
22363
|
-
|
|
22364
|
-
|
|
22779
|
+
var AgentPermissionSchema = z47.enum(["READ_AGENT", "USE_AGENT", "MANAGE_AGENT", "DELETE_AGENT"]);
|
|
22780
|
+
var AgentPermissionsSchema = z47.record(
|
|
22781
|
+
z47.string(),
|
|
22782
|
+
z47.array(z47.string()).transform(
|
|
22365
22783
|
(permissions) => permissions.flatMap((permission) => {
|
|
22366
22784
|
const parsed = AgentPermissionSchema.safeParse(permission);
|
|
22367
22785
|
return parsed.success ? [parsed.data] : [];
|
|
22368
22786
|
})
|
|
22369
22787
|
)
|
|
22370
22788
|
);
|
|
22371
|
-
var VendTokenResponseSchema =
|
|
22372
|
-
subjectToken:
|
|
22373
|
-
actorToken:
|
|
22789
|
+
var VendTokenResponseSchema = z47.object({
|
|
22790
|
+
subjectToken: z47.string().min(1),
|
|
22791
|
+
actorToken: z47.string().min(1)
|
|
22792
|
+
});
|
|
22793
|
+
var PeekUserSchema = z47.object({
|
|
22794
|
+
id: z47.string().min(1),
|
|
22795
|
+
name: z47.string().nullish(),
|
|
22796
|
+
email: z47.string().min(1)
|
|
22797
|
+
});
|
|
22798
|
+
var PeekUsersResponseSchema = z47.object({
|
|
22799
|
+
users: z47.array(PeekUserSchema),
|
|
22800
|
+
totalUsers: z47.number().int().nonnegative()
|
|
22374
22801
|
});
|
|
22375
22802
|
async function readServiceFoundryErrorMessage(response) {
|
|
22376
22803
|
const body = await response.json().catch(() => void 0);
|
|
@@ -22496,7 +22923,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22496
22923
|
...extractErrorLogFields8(parsed.error),
|
|
22497
22924
|
reportable_error: { error: parsed.error }
|
|
22498
22925
|
});
|
|
22499
|
-
throw new
|
|
22926
|
+
throw new HTTPException26(424, {
|
|
22500
22927
|
message: "TrueFoundry ServiceFoundry put remote agent returned an unexpected response",
|
|
22501
22928
|
cause: parsed.error
|
|
22502
22929
|
});
|
|
@@ -22572,7 +22999,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22572
22999
|
this.#logger.error("TrueFoundry ServiceFoundry resolve agent-skill-versions returned an unexpected response", {
|
|
22573
23000
|
...extractErrorLogFields8(error)
|
|
22574
23001
|
});
|
|
22575
|
-
throw new
|
|
23002
|
+
throw new HTTPException26(500, {
|
|
22576
23003
|
message: "TrueFoundry ServiceFoundry resolve agent-skill-versions returned an unexpected response",
|
|
22577
23004
|
cause: error
|
|
22578
23005
|
});
|
|
@@ -22626,7 +23053,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22626
23053
|
...extractErrorLogFields8(error),
|
|
22627
23054
|
reportable_error: { error, extra: { mcp_server_id: input.mcpServerId } }
|
|
22628
23055
|
});
|
|
22629
|
-
throw new
|
|
23056
|
+
throw new HTTPException26(424, {
|
|
22630
23057
|
message: "TrueFoundry ServiceFoundry MCP authorize returned an unexpected response",
|
|
22631
23058
|
cause: error
|
|
22632
23059
|
});
|
|
@@ -22651,7 +23078,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22651
23078
|
...extractErrorLogFields8(error),
|
|
22652
23079
|
reportable_error: { error, extra: { mcp_server_id: input.mcpServerId } }
|
|
22653
23080
|
});
|
|
22654
|
-
throw new
|
|
23081
|
+
throw new HTTPException26(424, {
|
|
22655
23082
|
message: "TrueFoundry ServiceFoundry MCP auth status returned an unexpected response",
|
|
22656
23083
|
cause: error
|
|
22657
23084
|
});
|
|
@@ -22685,23 +23112,23 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22685
23112
|
method: "GET"
|
|
22686
23113
|
});
|
|
22687
23114
|
} catch (error) {
|
|
22688
|
-
if (error instanceof
|
|
23115
|
+
if (error instanceof HTTPException26 && (error.status === 401 || error.status === 403)) {
|
|
22689
23116
|
throw error;
|
|
22690
23117
|
}
|
|
22691
|
-
throw new
|
|
23118
|
+
throw new HTTPException26(500, {
|
|
22692
23119
|
message: "TrueFoundry ServiceFoundry session request failed",
|
|
22693
23120
|
cause: error
|
|
22694
23121
|
});
|
|
22695
23122
|
}
|
|
22696
23123
|
const parsed = GetSessionWireSchema.safeParse(payload);
|
|
22697
23124
|
if (!parsed.success) {
|
|
22698
|
-
throw new
|
|
23125
|
+
throw new HTTPException26(500, {
|
|
22699
23126
|
message: "TrueFoundry ServiceFoundry session response was malformed",
|
|
22700
23127
|
cause: parsed.error
|
|
22701
23128
|
});
|
|
22702
23129
|
}
|
|
22703
23130
|
if (parsed.data.user === null) {
|
|
22704
|
-
throw new
|
|
23131
|
+
throw new HTTPException26(401, { message: "Authentication required" });
|
|
22705
23132
|
}
|
|
22706
23133
|
return parsed.data;
|
|
22707
23134
|
}
|
|
@@ -22724,14 +23151,14 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22724
23151
|
});
|
|
22725
23152
|
} catch (error) {
|
|
22726
23153
|
const causeString = error instanceof Error ? error.message : String(error);
|
|
22727
|
-
throw new
|
|
23154
|
+
throw new HTTPException26(500, {
|
|
22728
23155
|
message: `TrueFoundry ServiceFoundry session request failed: ${causeString}`,
|
|
22729
23156
|
cause: error
|
|
22730
23157
|
});
|
|
22731
23158
|
}
|
|
22732
23159
|
const parsed = TenantControlPlaneUrlSchema.safeParse(payload);
|
|
22733
23160
|
if (!parsed.success) {
|
|
22734
|
-
throw new
|
|
23161
|
+
throw new HTTPException26(500, {
|
|
22735
23162
|
message: "TrueFoundry ServiceFoundry session response was malformed",
|
|
22736
23163
|
cause: parsed.error
|
|
22737
23164
|
});
|
|
@@ -22757,7 +23184,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22757
23184
|
...extractErrorLogFields8(parsed.error),
|
|
22758
23185
|
reportable_error: { error: parsed.error }
|
|
22759
23186
|
});
|
|
22760
|
-
throw new
|
|
23187
|
+
throw new HTTPException26(424, {
|
|
22761
23188
|
message: "TrueFoundry ServiceFoundry agent permissions response was malformed",
|
|
22762
23189
|
cause: parsed.error
|
|
22763
23190
|
});
|
|
@@ -22775,19 +23202,51 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22775
23202
|
accessToken: input.accessToken,
|
|
22776
23203
|
method: "GET"
|
|
22777
23204
|
});
|
|
22778
|
-
const parsed =
|
|
23205
|
+
const parsed = z47.array(z47.string()).safeParse(payload);
|
|
22779
23206
|
if (!parsed.success) {
|
|
22780
23207
|
this.#logger.error("TrueFoundry ServiceFoundry tenant permissions response was malformed", {
|
|
22781
23208
|
...extractErrorLogFields8(parsed.error),
|
|
22782
23209
|
reportable_error: { error: parsed.error }
|
|
22783
23210
|
});
|
|
22784
|
-
throw new
|
|
23211
|
+
throw new HTTPException26(424, {
|
|
22785
23212
|
message: "TrueFoundry ServiceFoundry tenant permissions response was malformed",
|
|
22786
23213
|
cause: parsed.error
|
|
22787
23214
|
});
|
|
22788
23215
|
}
|
|
22789
23216
|
return parsed.data;
|
|
22790
23217
|
}
|
|
23218
|
+
/**
|
|
23219
|
+
* `GET v1/subjects/peek` for active tenant users, with the caller's token.
|
|
23220
|
+
* Search needs `limit`, since ServiceFoundry returns every match without one. An id lookup returns
|
|
23221
|
+
* at most one user per id, so it sends no paging.
|
|
23222
|
+
*/
|
|
23223
|
+
async peekUsers(input) {
|
|
23224
|
+
const search = "ids" in input ? { filter: JSON.stringify({ subjects: input.ids.map((id) => ({ subjectType: "user", subjectId: id })) }) } : {
|
|
23225
|
+
filter: JSON.stringify({
|
|
23226
|
+
subjectType: ["user"],
|
|
23227
|
+
...input.name === void 0 ? {} : { name: input.name }
|
|
23228
|
+
}),
|
|
23229
|
+
limit: String(input.limit),
|
|
23230
|
+
offset: String(input.offset)
|
|
23231
|
+
};
|
|
23232
|
+
const payload = await this.#requestJson({
|
|
23233
|
+
operation: SERVICE_FOUNDRY_OPERATIONS.peekUsers,
|
|
23234
|
+
url: this.#url(SUBJECTS_PEEK_PATH, search),
|
|
23235
|
+
accessToken: input.accessToken,
|
|
23236
|
+
method: "GET"
|
|
23237
|
+
});
|
|
23238
|
+
const parsed = PeekUsersResponseSchema.safeParse(payload);
|
|
23239
|
+
if (!parsed.success) {
|
|
23240
|
+
this.#logger.error("TrueFoundry ServiceFoundry subjects response was malformed", {
|
|
23241
|
+
...extractErrorLogFields8(parsed.error)
|
|
23242
|
+
});
|
|
23243
|
+
throw new HTTPException26(424, {
|
|
23244
|
+
message: "TrueFoundry ServiceFoundry subjects response was malformed",
|
|
23245
|
+
cause: parsed.error
|
|
23246
|
+
});
|
|
23247
|
+
}
|
|
23248
|
+
return parsed.data;
|
|
23249
|
+
}
|
|
22791
23250
|
/**
|
|
22792
23251
|
* Exchange a TrueFoundry API key for dual agent-scoped tokens.
|
|
22793
23252
|
* Wire `actorToken` is the agent identity. Wire `subjectToken` is the user with the agent in `act`.
|
|
@@ -22813,7 +23272,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22813
23272
|
...extractErrorLogFields8(parsed.error),
|
|
22814
23273
|
reportable_error: { error: parsed.error }
|
|
22815
23274
|
});
|
|
22816
|
-
throw new
|
|
23275
|
+
throw new HTTPException26(424, {
|
|
22817
23276
|
message: "TrueFoundry ServiceFoundry vend-token response was malformed",
|
|
22818
23277
|
cause: parsed.error
|
|
22819
23278
|
});
|
|
@@ -22827,7 +23286,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22827
23286
|
...extractErrorLogFields8(parsed.error),
|
|
22828
23287
|
reportable_error: { error: parsed.error }
|
|
22829
23288
|
});
|
|
22830
|
-
throw new
|
|
23289
|
+
throw new HTTPException26(424, {
|
|
22831
23290
|
message: "TrueFoundry ServiceFoundry server returned an unexpected list response",
|
|
22832
23291
|
cause: parsed.error
|
|
22833
23292
|
});
|
|
@@ -22884,7 +23343,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22884
23343
|
timedOut,
|
|
22885
23344
|
...extractErrorLogFields8(error)
|
|
22886
23345
|
});
|
|
22887
|
-
throw new
|
|
23346
|
+
throw new HTTPException26(500, {
|
|
22888
23347
|
message: timedOut ? `TrueFoundry ServiceFoundry server request timed out after ${String(timeoutMs / 1e3)}s` : "TrueFoundry ServiceFoundry server request failed",
|
|
22889
23348
|
cause: error
|
|
22890
23349
|
});
|
|
@@ -22898,7 +23357,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22898
23357
|
if (response.status === 401 || response.status === 403) {
|
|
22899
23358
|
record("error", response.status);
|
|
22900
23359
|
const detail = await readServiceFoundryErrorMessage(response);
|
|
22901
|
-
throw new
|
|
23360
|
+
throw new HTTPException26(response.status, {
|
|
22902
23361
|
message: `TrueFoundry ServiceFoundry server rejected the request: ${detail ?? `HTTP ${String(response.status)}`}`
|
|
22903
23362
|
});
|
|
22904
23363
|
}
|
|
@@ -22909,7 +23368,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22909
23368
|
if (!response.ok) {
|
|
22910
23369
|
record("error", response.status);
|
|
22911
23370
|
const detail = await readServiceFoundryErrorMessage(response);
|
|
22912
|
-
throw new
|
|
23371
|
+
throw new HTTPException26(424, {
|
|
22913
23372
|
message: `TrueFoundry ServiceFoundry server request failed: ${detail ?? `HTTP ${String(response.status)}`}`
|
|
22914
23373
|
});
|
|
22915
23374
|
}
|
|
@@ -22933,7 +23392,7 @@ var TrueFoundryServiceFoundryServerClient = class {
|
|
|
22933
23392
|
...extractErrorLogFields8(error),
|
|
22934
23393
|
reportable_error: { error }
|
|
22935
23394
|
});
|
|
22936
|
-
throw new
|
|
23395
|
+
throw new HTTPException26(424, {
|
|
22937
23396
|
message: "TrueFoundry ServiceFoundry server returned non-JSON",
|
|
22938
23397
|
cause: error
|
|
22939
23398
|
});
|
|
@@ -23145,7 +23604,7 @@ var TrueFoundryAgentStore = class {
|
|
|
23145
23604
|
};
|
|
23146
23605
|
|
|
23147
23606
|
// src/truefoundry/TrueFoundryAuthorizer.ts
|
|
23148
|
-
import { HTTPException as
|
|
23607
|
+
import { HTTPException as HTTPException27 } from "hono/http-exception";
|
|
23149
23608
|
var permissionByAction = {
|
|
23150
23609
|
read: "READ_AGENT",
|
|
23151
23610
|
use: "USE_AGENT",
|
|
@@ -23166,7 +23625,7 @@ function toResourcePermissions(permissions) {
|
|
|
23166
23625
|
}
|
|
23167
23626
|
function requireUserCredential(context) {
|
|
23168
23627
|
if (context.user_credential === null) {
|
|
23169
|
-
throw new
|
|
23628
|
+
throw new HTTPException27(401, { message: "Authentication token required for agent authorization" });
|
|
23170
23629
|
}
|
|
23171
23630
|
return context.user_credential;
|
|
23172
23631
|
}
|
|
@@ -23242,32 +23701,32 @@ var TrueFoundryAuthorizer = class {
|
|
|
23242
23701
|
|
|
23243
23702
|
// src/truefoundry/TrueFoundryMcpServerStore.ts
|
|
23244
23703
|
import { McpConnectionError as McpConnectionError6 } from "@truefoundry/trueforge-core/core";
|
|
23245
|
-
import { HTTPException as
|
|
23704
|
+
import { HTTPException as HTTPException29 } from "hono/http-exception";
|
|
23246
23705
|
init_config();
|
|
23247
23706
|
init_mcpServerStore();
|
|
23248
23707
|
|
|
23249
23708
|
// src/truefoundry/mapEnabledModels.ts
|
|
23250
23709
|
init_config();
|
|
23251
23710
|
import { SUPPORTED_REASONING_EFFORTS as SUPPORTED_REASONING_EFFORTS3 } from "@truefoundry/trueforge-core/core";
|
|
23252
|
-
import { HTTPException as
|
|
23253
|
-
import { z as
|
|
23254
|
-
var ModelParamSchema =
|
|
23255
|
-
key:
|
|
23256
|
-
supportedValues:
|
|
23711
|
+
import { HTTPException as HTTPException28 } from "hono/http-exception";
|
|
23712
|
+
import { z as z48 } from "zod";
|
|
23713
|
+
var ModelParamSchema = z48.object({
|
|
23714
|
+
key: z48.string(),
|
|
23715
|
+
supportedValues: z48.array(z48.string()).optional()
|
|
23257
23716
|
});
|
|
23258
|
-
var MetadataSchema =
|
|
23259
|
-
limits:
|
|
23260
|
-
context_window:
|
|
23261
|
-
max_input_tokens:
|
|
23262
|
-
max_output_tokens:
|
|
23263
|
-
max_tokens:
|
|
23717
|
+
var MetadataSchema = z48.object({
|
|
23718
|
+
limits: z48.object({
|
|
23719
|
+
context_window: z48.number().optional(),
|
|
23720
|
+
max_input_tokens: z48.number().optional(),
|
|
23721
|
+
max_output_tokens: z48.number().optional(),
|
|
23722
|
+
max_tokens: z48.number().optional()
|
|
23264
23723
|
}).optional(),
|
|
23265
|
-
params:
|
|
23724
|
+
params: z48.array(ModelParamSchema).optional()
|
|
23266
23725
|
});
|
|
23267
|
-
var IntegrationSchema =
|
|
23268
|
-
name:
|
|
23269
|
-
manifest:
|
|
23270
|
-
providerAccount:
|
|
23726
|
+
var IntegrationSchema = z48.object({
|
|
23727
|
+
name: z48.string().min(1),
|
|
23728
|
+
manifest: z48.object({ model_types: z48.array(z48.string()).optional() }),
|
|
23729
|
+
providerAccount: z48.object({ name: z48.string().min(1) }),
|
|
23271
23730
|
metadata: MetadataSchema.optional()
|
|
23272
23731
|
});
|
|
23273
23732
|
function toReasoningEfforts(params) {
|
|
@@ -23325,11 +23784,11 @@ function filterEnvModels(input) {
|
|
|
23325
23784
|
const allowed = new Set(allowedAccounts);
|
|
23326
23785
|
return input.models.filter((model) => allowed.has(model.accountName));
|
|
23327
23786
|
}
|
|
23328
|
-
var InstallationSchema =
|
|
23329
|
-
isDefault:
|
|
23330
|
-
manifest:
|
|
23787
|
+
var InstallationSchema = z48.object({
|
|
23788
|
+
isDefault: z48.boolean().optional(),
|
|
23789
|
+
manifest: z48.object({ url: z48.string().min(1) })
|
|
23331
23790
|
});
|
|
23332
|
-
var InstallationsEnvelopeSchema =
|
|
23791
|
+
var InstallationsEnvelopeSchema = z48.union([z48.array(z48.unknown()), z48.object({ data: z48.array(z48.unknown()) })]);
|
|
23333
23792
|
function resolveDefaultGatewayUrl(payload) {
|
|
23334
23793
|
const envelope = InstallationsEnvelopeSchema.parse(payload);
|
|
23335
23794
|
const rows = Array.isArray(envelope) ? envelope : envelope.data;
|
|
@@ -23339,7 +23798,7 @@ function resolveDefaultGatewayUrl(payload) {
|
|
|
23339
23798
|
return installation.manifest.url;
|
|
23340
23799
|
}
|
|
23341
23800
|
}
|
|
23342
|
-
throw new
|
|
23801
|
+
throw new HTTPException28(502, { message: "No default TrueFoundry AI gateway installation is configured" });
|
|
23343
23802
|
}
|
|
23344
23803
|
|
|
23345
23804
|
// src/truefoundry/TrueFoundryMcpServerStore.ts
|
|
@@ -23393,7 +23852,7 @@ var TrueFoundryMcpServerStore = class {
|
|
|
23393
23852
|
if (status.status === "auth_required") {
|
|
23394
23853
|
const authUrl = status.authorization_url;
|
|
23395
23854
|
if (authUrl === void 0 || authUrl.length === 0) {
|
|
23396
|
-
throw new
|
|
23855
|
+
throw new HTTPException29(422, {
|
|
23397
23856
|
message: `MCP server "${record.name}" requires authentication but returned no authorization URL`
|
|
23398
23857
|
});
|
|
23399
23858
|
}
|
|
@@ -23669,7 +24128,7 @@ function toManifest(input) {
|
|
|
23669
24128
|
// src/truefoundry/TrueFoundrySandboxEnvironmentStore.ts
|
|
23670
24129
|
init_sandboxEnvironmentStore();
|
|
23671
24130
|
init_sandboxEnvironment();
|
|
23672
|
-
import { encodeOffsetPageToken } from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
24131
|
+
import { encodeOffsetPageToken as encodeOffsetPageToken2 } from "@truefoundry/trueforge-core/agent-session/store/OffsetPageToken";
|
|
23673
24132
|
import { createLogger as createLogger2 } from "winston";
|
|
23674
24133
|
|
|
23675
24134
|
// src/truefoundry/synthesizeTrueFoundryDefaultSandboxEnvironment.ts
|
|
@@ -23741,7 +24200,7 @@ var TrueFoundrySandboxEnvironmentStore = class {
|
|
|
23741
24200
|
data: [synthesized],
|
|
23742
24201
|
pagination: {
|
|
23743
24202
|
limit: input.limit ?? 1,
|
|
23744
|
-
...hasMore ? { next_page_token: peek.pagination.next_page_token ??
|
|
24203
|
+
...hasMore ? { next_page_token: peek.pagination.next_page_token ?? encodeOffsetPageToken2(0) } : {}
|
|
23745
24204
|
}
|
|
23746
24205
|
};
|
|
23747
24206
|
}
|
|
@@ -23947,7 +24406,7 @@ var TrueFoundrySandboxProviderStore = class {
|
|
|
23947
24406
|
};
|
|
23948
24407
|
|
|
23949
24408
|
// src/truefoundry/TrueFoundrySkillStore.ts
|
|
23950
|
-
import { HTTPException as
|
|
24409
|
+
import { HTTPException as HTTPException30 } from "hono/http-exception";
|
|
23951
24410
|
function toRegistryRecord(tenant_id, skill) {
|
|
23952
24411
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
23953
24412
|
const manifest = {
|
|
@@ -23988,18 +24447,18 @@ var TrueFoundryAdminSkillStore = class {
|
|
|
23988
24447
|
return skills.map((skill) => {
|
|
23989
24448
|
const row = byFqn.get(skill.name);
|
|
23990
24449
|
if (row === void 0) {
|
|
23991
|
-
throw new
|
|
24450
|
+
throw new HTTPException30(422, {
|
|
23992
24451
|
message: `Unknown skill "${skill.name}" \u2014 not configured`
|
|
23993
24452
|
});
|
|
23994
24453
|
}
|
|
23995
24454
|
if (row.presigned_url === void 0) {
|
|
23996
|
-
throw new
|
|
24455
|
+
throw new HTTPException30(422, {
|
|
23997
24456
|
message: `Skill "${skill.name}" did not return a presigned URL`
|
|
23998
24457
|
});
|
|
23999
24458
|
}
|
|
24000
24459
|
const skillMdContent = skill.preload ? row.skill_md_content ?? null : null;
|
|
24001
24460
|
if (skill.preload && (skillMdContent === null || skillMdContent.length === 0)) {
|
|
24002
|
-
throw new
|
|
24461
|
+
throw new HTTPException30(422, {
|
|
24003
24462
|
message: `Skill "${skill.name}" did not return SKILL.md for preload`
|
|
24004
24463
|
});
|
|
24005
24464
|
}
|
|
@@ -24026,7 +24485,7 @@ var TrueFoundrySkillStore = class extends TrueFoundryAdminSkillStore {
|
|
|
24026
24485
|
async listSkills(input, transaction) {
|
|
24027
24486
|
void transaction;
|
|
24028
24487
|
if (input.names !== void 0) {
|
|
24029
|
-
throw new
|
|
24488
|
+
throw new HTTPException30(422, {
|
|
24030
24489
|
message: "TrueFoundry skill list does not support name filters"
|
|
24031
24490
|
});
|
|
24032
24491
|
}
|
|
@@ -24074,7 +24533,7 @@ var TrueFoundrySkillStore = class extends TrueFoundryAdminSkillStore {
|
|
|
24074
24533
|
const seenFqns = /* @__PURE__ */ new Set();
|
|
24075
24534
|
for (const skill of skills) {
|
|
24076
24535
|
if (seenFqns.has(skill.name)) {
|
|
24077
|
-
throw new
|
|
24536
|
+
throw new HTTPException30(422, {
|
|
24078
24537
|
message: `Duplicate skill FQN "${skill.name}"`
|
|
24079
24538
|
});
|
|
24080
24539
|
}
|
|
@@ -24088,7 +24547,7 @@ var TrueFoundrySkillStore = class extends TrueFoundryAdminSkillStore {
|
|
|
24088
24547
|
const byFqn = new Map(resolved.map((row) => [row.fqn, row]));
|
|
24089
24548
|
for (const skill of skills) {
|
|
24090
24549
|
if (!byFqn.has(skill.name)) {
|
|
24091
|
-
throw new
|
|
24550
|
+
throw new HTTPException30(422, {
|
|
24092
24551
|
message: `Unknown skill "${skill.name}" \u2014 not configured`
|
|
24093
24552
|
});
|
|
24094
24553
|
}
|
|
@@ -24096,7 +24555,7 @@ var TrueFoundrySkillStore = class extends TrueFoundryAdminSkillStore {
|
|
|
24096
24555
|
const seenNames = /* @__PURE__ */ new Set();
|
|
24097
24556
|
for (const row of resolved) {
|
|
24098
24557
|
if (seenNames.has(row.name)) {
|
|
24099
|
-
throw new
|
|
24558
|
+
throw new HTTPException30(422, {
|
|
24100
24559
|
message: `Agent skills must have unique names; duplicate skill name(s): ${row.name}`
|
|
24101
24560
|
});
|
|
24102
24561
|
}
|
|
@@ -24105,6 +24564,45 @@ var TrueFoundrySkillStore = class extends TrueFoundryAdminSkillStore {
|
|
|
24105
24564
|
}
|
|
24106
24565
|
};
|
|
24107
24566
|
|
|
24567
|
+
// src/truefoundry/TrueFoundryUserStore.ts
|
|
24568
|
+
var PEEK_IDS_CHUNK_SIZE = 50;
|
|
24569
|
+
function toUser(user) {
|
|
24570
|
+
return {
|
|
24571
|
+
id: user.id,
|
|
24572
|
+
display_name: user.name ?? user.email,
|
|
24573
|
+
email: user.email
|
|
24574
|
+
};
|
|
24575
|
+
}
|
|
24576
|
+
var TrueFoundryUserStore = class {
|
|
24577
|
+
#client;
|
|
24578
|
+
constructor(client2) {
|
|
24579
|
+
this.#client = client2;
|
|
24580
|
+
}
|
|
24581
|
+
async listUsers(input) {
|
|
24582
|
+
const { users, totalUsers } = await this.#client.peekUsers({
|
|
24583
|
+
accessToken: await callerAccessToken(input.context)(),
|
|
24584
|
+
...input.query === void 0 ? {} : { name: input.query },
|
|
24585
|
+
limit: input.limit,
|
|
24586
|
+
offset: input.offset
|
|
24587
|
+
});
|
|
24588
|
+
return { data: users.map(toUser), total: totalUsers };
|
|
24589
|
+
}
|
|
24590
|
+
async getUsersByIds(input) {
|
|
24591
|
+
const ids = [...new Set(input.ids)];
|
|
24592
|
+
if (ids.length === 0) {
|
|
24593
|
+
return [];
|
|
24594
|
+
}
|
|
24595
|
+
const accessToken = await callerAccessToken(input.context)();
|
|
24596
|
+
const found = [];
|
|
24597
|
+
for (let i = 0; i < ids.length; i += PEEK_IDS_CHUNK_SIZE) {
|
|
24598
|
+
const chunk = ids.slice(i, i + PEEK_IDS_CHUNK_SIZE);
|
|
24599
|
+
const { users } = await this.#client.peekUsers({ accessToken, ids: chunk });
|
|
24600
|
+
found.push(...users.map(toUser));
|
|
24601
|
+
}
|
|
24602
|
+
return found;
|
|
24603
|
+
}
|
|
24604
|
+
};
|
|
24605
|
+
|
|
24108
24606
|
// src/truefoundry/TrueFoundryWebSearchProviderStore.ts
|
|
24109
24607
|
init_config();
|
|
24110
24608
|
function synthesizeParallelRecord(tenantId) {
|
|
@@ -24328,7 +24826,8 @@ async function createStandalonePersistence(options) {
|
|
|
24328
24826
|
Promise.resolve().then(() => (init_SqliteWebSearchProviderStore(), SqliteWebSearchProviderStore_exports)),
|
|
24329
24827
|
Promise.resolve().then(() => (init_SqliteAgentStore(), SqliteAgentStore_exports)),
|
|
24330
24828
|
Promise.resolve().then(() => (init_SqliteScheduleStore(), SqliteScheduleStore_exports)),
|
|
24331
|
-
Promise.resolve().then(() => (init_SqliteSandboxEnvironmentStore(), SqliteSandboxEnvironmentStore_exports))
|
|
24829
|
+
Promise.resolve().then(() => (init_SqliteSandboxEnvironmentStore(), SqliteSandboxEnvironmentStore_exports)),
|
|
24830
|
+
Promise.resolve().then(() => (init_SqliteAccessControlStore(), SqliteAccessControlStore_exports))
|
|
24332
24831
|
])
|
|
24333
24832
|
]);
|
|
24334
24833
|
const [
|
|
@@ -24342,7 +24841,8 @@ async function createStandalonePersistence(options) {
|
|
|
24342
24841
|
{ SqliteWebSearchProviderStore: SqliteWebSearchProviderStore2 },
|
|
24343
24842
|
{ SqliteAgentStore: SqliteAgentStore2 },
|
|
24344
24843
|
{ SqliteScheduleStore: SqliteScheduleStore2 },
|
|
24345
|
-
{ SqliteSandboxEnvironmentStore: SqliteSandboxEnvironmentStore2 }
|
|
24844
|
+
{ SqliteSandboxEnvironmentStore: SqliteSandboxEnvironmentStore2 },
|
|
24845
|
+
{ SqliteAccessControlStore: SqliteAccessControlStore2 }
|
|
24346
24846
|
] = sqliteStores;
|
|
24347
24847
|
const db = createSqliteDb2(sqlitePath);
|
|
24348
24848
|
await migrateSqliteToLatest2(db);
|
|
@@ -24363,6 +24863,7 @@ async function createStandalonePersistence(options) {
|
|
|
24363
24863
|
return {
|
|
24364
24864
|
withTransaction: (callback) => db.transaction().execute(callback),
|
|
24365
24865
|
sessionStore: new SqliteSessionStore2(db),
|
|
24866
|
+
accessControlStore: new SqliteAccessControlStore2(db),
|
|
24366
24867
|
sessionMetricsStore: new SqliteSessionMetricsStore2(db),
|
|
24367
24868
|
mcpOAuthStore: mcpServerStore,
|
|
24368
24869
|
tokenStore,
|
|
@@ -24420,7 +24921,8 @@ async function createDistributedPersistence(options) {
|
|
|
24420
24921
|
Promise.resolve().then(() => (init_PostgresWebSearchProviderStore(), PostgresWebSearchProviderStore_exports)),
|
|
24421
24922
|
Promise.resolve().then(() => (init_PostgresAgentStore(), PostgresAgentStore_exports)),
|
|
24422
24923
|
Promise.resolve().then(() => (init_PostgresScheduleStore(), PostgresScheduleStore_exports)),
|
|
24423
|
-
Promise.resolve().then(() => (init_PostgresSandboxEnvironmentStore(), PostgresSandboxEnvironmentStore_exports))
|
|
24924
|
+
Promise.resolve().then(() => (init_PostgresSandboxEnvironmentStore(), PostgresSandboxEnvironmentStore_exports)),
|
|
24925
|
+
Promise.resolve().then(() => (init_PostgresAccessControlStore(), PostgresAccessControlStore_exports))
|
|
24424
24926
|
])
|
|
24425
24927
|
]);
|
|
24426
24928
|
const [
|
|
@@ -24434,7 +24936,8 @@ async function createDistributedPersistence(options) {
|
|
|
24434
24936
|
{ PostgresWebSearchProviderStore: PostgresWebSearchProviderStore2 },
|
|
24435
24937
|
{ PostgresAgentStore: PostgresAgentStore3 },
|
|
24436
24938
|
{ PostgresScheduleStore: PostgresScheduleStore2 },
|
|
24437
|
-
{ PostgresSandboxEnvironmentStore: PostgresSandboxEnvironmentStore2 }
|
|
24939
|
+
{ PostgresSandboxEnvironmentStore: PostgresSandboxEnvironmentStore2 },
|
|
24940
|
+
{ PostgresAccessControlStore: PostgresAccessControlStore2 }
|
|
24438
24941
|
] = postgresStores;
|
|
24439
24942
|
logger2.info("Connecting to Postgres");
|
|
24440
24943
|
const db = createDb2({
|
|
@@ -24499,6 +25002,7 @@ async function createDistributedPersistence(options) {
|
|
|
24499
25002
|
return {
|
|
24500
25003
|
withTransaction: (callback) => db.transaction().execute(callback),
|
|
24501
25004
|
sessionStore: new PostgresSessionStore2(db),
|
|
25005
|
+
accessControlStore: new PostgresAccessControlStore2(db),
|
|
24502
25006
|
sessionMetricsStore: new PostgresSessionMetricsStore2(db),
|
|
24503
25007
|
mcpOAuthStore: mcpServerWithAuthStore,
|
|
24504
25008
|
tokenStore,
|
|
@@ -24536,6 +25040,7 @@ async function createServerRuntime(persistence, logger2) {
|
|
|
24536
25040
|
const {
|
|
24537
25041
|
withTransaction,
|
|
24538
25042
|
sessionStore,
|
|
25043
|
+
accessControlStore,
|
|
24539
25044
|
sessionMetricsStore,
|
|
24540
25045
|
tokenStore,
|
|
24541
25046
|
scheduleStore,
|
|
@@ -24560,6 +25065,7 @@ async function createServerRuntime(persistence, logger2) {
|
|
|
24560
25065
|
const oidcClient = await initOidc(oidc);
|
|
24561
25066
|
let authenticator;
|
|
24562
25067
|
let authorizer;
|
|
25068
|
+
let userStore;
|
|
24563
25069
|
const mode = getTrueForgeAuthMode2(configuration2);
|
|
24564
25070
|
if (mode === TrueForgeAuthMode2.TrueFoundry) {
|
|
24565
25071
|
if (serviceFoundryClient === void 0) {
|
|
@@ -24570,12 +25076,15 @@ async function createServerRuntime(persistence, logger2) {
|
|
|
24570
25076
|
serviceFoundryClient
|
|
24571
25077
|
});
|
|
24572
25078
|
authorizer = new TrueFoundryAuthorizer(serviceFoundryClient);
|
|
25079
|
+
userStore = new TrueFoundryUserStore(serviceFoundryClient);
|
|
24573
25080
|
} else if (mode === TrueForgeAuthMode2.Oidc) {
|
|
24574
25081
|
authenticator = createAuthenticator({ mode: TrueForgeAuthMode2.Oidc });
|
|
24575
25082
|
authorizer = new TrueForgeAuthorizer();
|
|
25083
|
+
userStore = new EmptyUserStore();
|
|
24576
25084
|
} else {
|
|
24577
25085
|
authenticator = createAuthenticator({ mode: TrueForgeAuthMode2.Standalone });
|
|
24578
25086
|
authorizer = new TrueForgeAuthorizer();
|
|
25087
|
+
userStore = new EmptyUserStore();
|
|
24579
25088
|
}
|
|
24580
25089
|
const controller = configuration2.STANDALONE ? createController({
|
|
24581
25090
|
scheduleStore,
|
|
@@ -24673,7 +25182,9 @@ async function createServerRuntime(persistence, logger2) {
|
|
|
24673
25182
|
sandboxEnvironmentStore,
|
|
24674
25183
|
sandboxProviderStore: persistence.sandboxProviderStore,
|
|
24675
25184
|
sessionStore,
|
|
25185
|
+
accessControlStore,
|
|
24676
25186
|
sessionMetricsStore,
|
|
25187
|
+
userStore,
|
|
24677
25188
|
sessions,
|
|
24678
25189
|
activeTurns,
|
|
24679
25190
|
redis: redis?.client,
|