@datalayer/agent-runtimes 1.6.38 → 1.6.40
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-embed/chunks/{AgentDetails-Ba3DRn2p.js → AgentDetails-DC7O2VWb.js} +1 -1
- package/dist-embed/chunks/{AgentDetailsDialog-CXN0RO_L.js → AgentDetailsDialog-BTJCl-o-.js} +1 -1
- package/dist-embed/chunks/{AgentInspector-C66D0b0W.js → AgentInspector-BXqYY8g-.js} +1 -1
- package/dist-embed/chunks/{AgentInspectorDialog-DeK96QG1.js → AgentInspectorDialog-dRHZ1p73.js} +1 -1
- package/dist-embed/chunks/Avatar-Cv5OpUWu.js +1 -0
- package/dist-embed/chunks/{CellSidebarExtension-D7aXShZc.js → CellSidebarExtension-DXPIz0Km.js} +7 -7
- package/dist-embed/chunks/{ChatView-2N7PbcDs.js → ChatView-CRitAB2i.js} +4 -4
- package/dist-embed/chunks/{CollapsiblePlugin-y8sx_FL8.js → CollapsiblePlugin-BPlfrDQU.js} +1 -1
- package/dist-embed/chunks/DatalayerAgentBridge-D01Ek4NE.js +1 -0
- package/dist-embed/chunks/{DeckComponent-BnyeYRQq.js → DeckComponent-jvb83Q__.js} +1 -1
- package/dist-embed/chunks/{DocumentView-DT4DcdJI.js → DocumentView-BrdFnTVh.js} +3 -3
- package/dist-embed/chunks/{EphemeralDocument-CGISw1N3.js → EphemeralDocument-CkPQKyfy.js} +1 -1
- package/dist-embed/chunks/{EphemeralNotebook-Dyx-25uN.js → EphemeralNotebook-CiQIC3MG.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawComponent-Bl3R2Mic.js → ExcalidrawComponent-D6Cr_b0Z.js} +1 -1
- package/dist-embed/chunks/{ExcalidrawModal-DSL5jBhG.js → ExcalidrawModal-Bso7oDbl.js} +1 -1
- package/dist-embed/chunks/{JupyterLexicalExtension-C55KdpCk.js → JupyterLexicalExtension-DuD7IV6j.js} +6 -6
- package/dist-embed/chunks/{KernelVariables-D3DSQaD3.js → KernelVariables-CXQagESp.js} +2 -2
- package/dist-embed/chunks/{NotebookSkeleton-BkzTMhIX.js → NotebookSkeleton-CvO9WylK.js} +1 -1
- package/dist-embed/chunks/{NotebookToolSurfaces-Bvj9nwA9.js → NotebookToolSurfaces-B9fkzQNR.js} +1 -1
- package/dist-embed/chunks/{NotebookToolbar-BMjQTGrr.js → NotebookToolbar-D36duUxK.js} +1 -1
- package/dist-embed/chunks/{NotebookView-DRPnBAI2.js → NotebookView-BrdHwtKH.js} +1 -1
- package/dist-embed/chunks/{Output-D-7eUege.js → Output-D9cwH5rg.js} +1 -1
- package/dist-embed/chunks/{SandboxDetailsDialog-qJBg2naH.js → SandboxDetailsDialog-BYgLjg3W.js} +1 -1
- package/dist-embed/chunks/{SchemaForm-D6BAKaNe.js → SchemaForm-B3qMIWMy.js} +1 -1
- package/dist-embed/chunks/{SheetTabs-BLaEhX0D.js → SheetTabs-BR72mzuo.js} +2 -2
- package/dist-embed/chunks/{SpreadsheetPreviewView-CaFQASZ4.js → SpreadsheetPreviewView-RA8ASTBV.js} +1 -1
- package/dist-embed/chunks/{SpreadsheetView-DesdGLpm.js → SpreadsheetView-BfScdA-X.js} +1 -1
- package/dist-embed/chunks/{Toolbar-BncUh2ly.js → Toolbar-BAjGB6b-.js} +1 -1
- package/dist-embed/chunks/{WidgetVariableView-B4faSdWW.js → WidgetVariableView-7lvDcxCg.js} +1 -1
- package/dist-embed/chunks/{YouTubePlugin-BPUrB3sh.js → YouTubePlugin-BbjCzaT_.js} +1 -1
- package/dist-embed/chunks/{ar-SA-G6X2FPQ2-Dq_tRQtR.js → ar-SA-G6X2FPQ2-D4M2b5Lr.js} +1 -1
- package/dist-embed/chunks/{az-AZ-76LH7QW2-DQAoJi9C.js → az-AZ-76LH7QW2-Rn7oINhz.js} +1 -1
- package/dist-embed/chunks/{bg-BG-XCXSNQG7-CfZUFj2_.js → bg-BG-XCXSNQG7-xztohKe7.js} +1 -1
- package/dist-embed/chunks/{bn-BD-2XOGV67Q-DiqZdhkT.js → bn-BD-2XOGV67Q-C7Ssg1_2.js} +1 -1
- package/dist-embed/chunks/{ca-ES-6MX7JW3Y-B6c2PcO9.js → ca-ES-6MX7JW3Y-Cr0zd8Z6.js} +1 -1
- package/dist-embed/chunks/{celltoolbartracker-BHSFiiuz.js → celltoolbartracker-D1C_kGQL.js} +1 -1
- package/dist-embed/chunks/{component-BUTWfiVL.js → component-CmnuUtgX.js} +3 -3
- package/dist-embed/chunks/{cs-CZ-2BRQDIVT-ha7l75va.js → cs-CZ-2BRQDIVT-G9tBUkZh.js} +1 -1
- package/dist-embed/chunks/{da-DK-5WZEPLOC-C3b8_hbR.js → da-DK-5WZEPLOC-91_vyLpq.js} +1 -1
- package/dist-embed/chunks/{de-DE-XR44H4JA-CxWFSn3l.js → de-DE-XR44H4JA-Bb9tvIZa.js} +1 -1
- package/dist-embed/chunks/{dist-BF0YFIb6.js → dist-B5YvY_O1.js} +2 -2
- package/dist-embed/chunks/{dist-DsEDq9qF.js → dist-BBqWTRLi.js} +1 -1
- package/dist-embed/chunks/{dist-DRRbvr4-.js → dist-BC_2VyAM.js} +1 -1
- package/dist-embed/chunks/{dist-B_TGJsfl.js → dist-BhfyuH1D.js} +1 -1
- package/dist-embed/chunks/{dist-Cfvz7CF7.js → dist-BlIg6ytm.js} +1 -1
- package/dist-embed/chunks/{dist-COiURBxL.js → dist-Ct-bkqXx.js} +4 -4
- package/dist-embed/chunks/{dist-tosaS6vh.js → dist-CtFgtNKe.js} +1 -1
- package/dist-embed/chunks/{dist-B1tXS8Wo.js → dist-DLyNQ3Jj.js} +1 -1
- package/dist-embed/chunks/{document-CqNE0DPx.js → document-Dp0KpIjg.js} +1 -1
- package/dist-embed/chunks/{drivecontents-D1HzL7Fi.js → drivecontents-BsC6Y2Vl.js} +1 -1
- package/dist-embed/chunks/{el-GR-BZB4AONW-iSsL6em8.js → el-GR-BZB4AONW-B5kc3JC5.js} +1 -1
- package/dist-embed/chunks/{es-ES-U4NZUMDT-BEbh9GGw.js → es-ES-U4NZUMDT-CpFB18Kf.js} +1 -1
- package/dist-embed/chunks/{esm-RWOqF6ly.js → esm-BqqxV5QL.js} +1 -1
- package/dist-embed/chunks/{eu-ES-A7QVB2H4-C7o7R9hc.js → eu-ES-A7QVB2H4-CqCALK0Q.js} +1 -1
- package/dist-embed/chunks/{fa-IR-HGAKTJCU-DQNpeHKi.js → fa-IR-HGAKTJCU-BzSY8fri.js} +1 -1
- package/dist-embed/chunks/{fi-FI-Z5N7JZ37-D083iC1R.js → fi-FI-Z5N7JZ37-DPRPVT_v.js} +1 -1
- package/dist-embed/chunks/{fr-FR-RHASNOE6-CUvaq7hG.js → fr-FR-RHASNOE6-Cr4lVSvD.js} +1 -1
- package/dist-embed/chunks/{gl-ES-HMX3MZ6V-DU31KRvC.js → gl-ES-HMX3MZ6V-CZUw7dN0.js} +1 -1
- package/dist-embed/chunks/{he-IL-6SHJWFNN-bMtU7JNY.js → he-IL-6SHJWFNN-DaU5Odek.js} +1 -1
- package/dist-embed/chunks/{hi-IN-IWLTKZ5I-Pma0rKxO.js → hi-IN-IWLTKZ5I-BZ84Rooc.js} +1 -1
- package/dist-embed/chunks/{htmlselect-CqXICb9e.js → htmlselect-5N6NdDqL.js} +1 -1
- package/dist-embed/chunks/{hu-HU-A5ZG7DT2-Dof3afSc.js → hu-HU-A5ZG7DT2-SZiCSe0B.js} +1 -1
- package/dist-embed/chunks/{id-ID-SAP4L64H-ZwqZHBDj.js → id-ID-SAP4L64H-DrRa3vVi.js} +1 -1
- package/dist-embed/chunks/{index-9EhrHHj7.js → index-B6-uQd5L.js} +3 -3
- package/dist-embed/chunks/{index-9wJFadG-.js → index-CEeyR3FZ.js} +1 -1
- package/dist-embed/chunks/{index-CqP3xLL5.js → index-CKWSKbHe.js} +1 -1
- package/dist-embed/chunks/{index-BbcMy3Al.js → index-DpN8KK6c.js} +1 -1
- package/dist-embed/chunks/{index--S8WFITA.js → index-JmqWOkdt.js} +1 -1
- package/dist-embed/chunks/{index-CMhceBby.js → index-PKH5uAl-.js} +1 -1
- package/dist-embed/chunks/{index-C7UsrKrP.js → index-hhftmReh.js} +1 -1
- package/dist-embed/chunks/{index-6zxBQeM_.js → index-qhxI1VzX.js} +2 -2
- package/dist-embed/chunks/{index.esm-xgVG4GIx.js → index.esm-Bvtnemp7.js} +1 -1
- package/dist-embed/chunks/{it-IT-JPQ66NNP-C-uM6NhO.js → it-IT-JPQ66NNP-_TEhDIcF.js} +1 -1
- package/dist-embed/chunks/{ja-JP-DBVTYXUO-qzihtLnX.js → ja-JP-DBVTYXUO-IJaTVgTb.js} +1 -1
- package/dist-embed/chunks/{kaa-6HZHGXH3-Amx_Jfx0.js → kaa-6HZHGXH3-CTksAiLJ.js} +1 -1
- package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-BPZfDYRT.js → kab-KAB-ZGHBKWFO-DbA7aOfU.js} +1 -1
- package/dist-embed/chunks/{kk-KZ-P5N5QNE5-B83bJ3Yw.js → kk-KZ-P5N5QNE5-Bdzg30AB.js} +1 -1
- package/dist-embed/chunks/{km-KH-HSX4SM5Z-BvPDwBVw.js → km-KH-HSX4SM5Z-Bwn2NP1-.js} +1 -1
- package/dist-embed/chunks/{ko-KR-MTYHY66A-jpQ_OpzG.js → ko-KR-MTYHY66A-KUaxlo0q.js} +1 -1
- package/dist-embed/chunks/{ku-TR-6OUDTVRD-RsfwTm7i.js → ku-TR-6OUDTVRD-DRegsFXo.js} +1 -1
- package/dist-embed/chunks/{lib-CFx15o08.js → lib--J3JPp2K.js} +1 -1
- package/dist-embed/chunks/{lib-D6X8UF4a.js → lib-9S57siQD.js} +1 -1
- package/dist-embed/chunks/{lib-CoK70EWs.js → lib-BpltV-0Y.js} +1 -1
- package/dist-embed/chunks/{lib-DGhrI5Uw.js → lib-C2mgrsS1.js} +1 -1
- package/dist-embed/chunks/{lib-XSPvEMl2.js → lib-C46CpvHb.js} +1 -1
- package/dist-embed/chunks/{lib-D0Q8IWel.js → lib-CHID83aM.js} +1 -1
- package/dist-embed/chunks/{lib-Pqxz_81N.js → lib-COJY2oKd.js} +25 -25
- package/dist-embed/chunks/{lib-p7v7zGkv.js → lib-CQeoQJWp.js} +1 -1
- package/dist-embed/chunks/{lib-CdtiDxdA.js → lib-CjBEbEzm.js} +1 -1
- package/dist-embed/chunks/{lib-BBnVlTAj.js → lib-Cpc8Fspj.js} +1 -1
- package/dist-embed/chunks/{lib-CsiCQ8oM.js → lib-D7CvuX1J.js} +1 -1
- package/dist-embed/chunks/{lib-7ge2Kma3.js → lib-DOnguzJf.js} +1 -1
- package/dist-embed/chunks/{lib-UYAFV0Oh.js → lib-Dh9o1esj.js} +1 -1
- package/dist-embed/chunks/{lib-DdeRC7g0.js → lib-DrEcjKb5.js} +1 -1
- package/dist-embed/chunks/{lib-Dj12Ge-1.js → lib-PbTUB5SW.js} +1 -1
- package/dist-embed/chunks/{lib-DMy40SOL.js → lib-QmOij8gS.js} +1 -1
- package/dist-embed/chunks/{lib-C7Y61LM1.js → lib-csBGF1d0.js} +1 -1
- package/dist-embed/chunks/{lib-DTyx2eLX.js → lib-op0DTswa.js} +1 -1
- package/dist-embed/chunks/{lib-CkcilPdy.js → lib-ox3VOLDA.js} +1 -1
- package/dist-embed/chunks/{lib-Bi95m_cb.js → lib-rn9DpcHi.js} +1 -1
- package/dist-embed/chunks/{lt-LT-XHIRWOB4-qZ_KjUTQ.js → lt-LT-XHIRWOB4-c6CdaS7u.js} +1 -1
- package/dist-embed/chunks/{lv-LV-5QDEKY6T-BOKJbljG.js → lv-LV-5QDEKY6T-D9RognOk.js} +1 -1
- package/dist-embed/chunks/{model-C2VRzh1c.js → model-DbDJZyri.js} +1 -1
- package/dist-embed/chunks/{mr-IN-CRQNXWMA-xba6p6AI.js → mr-IN-CRQNXWMA-ht3P_mrN.js} +1 -1
- package/dist-embed/chunks/{my-MM-5M5IBNSE-B_H0GaRX.js → my-MM-5M5IBNSE-CsIkhWRp.js} +1 -1
- package/dist-embed/chunks/{nb-NO-T6EIAALU-Ddg4NpHf.js → nb-NO-T6EIAALU-DJw7Uvbx.js} +1 -1
- package/dist-embed/chunks/{nl-NL-IS3SIHDZ-DS_Sofox.js → nl-NL-IS3SIHDZ-Dcrp-zwB.js} +1 -1
- package/dist-embed/chunks/{nn-NO-6E72VCQL-CYSB6TTi.js → nn-NO-6E72VCQL-DaBAIbM9.js} +1 -1
- package/dist-embed/chunks/{oc-FR-POXYY2M6-QrIn4XvF.js → oc-FR-POXYY2M6-DSdMEDCa.js} +1 -1
- package/dist-embed/chunks/{pa-IN-N4M65BXN-BbacRfk_.js → pa-IN-N4M65BXN-BMyPito1.js} +1 -1
- package/dist-embed/chunks/{percentages-BXMCSKIN-TyKhSuec.js → percentages-BXMCSKIN-pswfKMt2.js} +3 -3
- package/dist-embed/chunks/{pl-PL-T2D74RX3-Cn2ehrU4.js → pl-PL-T2D74RX3-CFk8rHgP.js} +1 -1
- package/dist-embed/chunks/{plugin-CPCdQWpK.js → plugin-BpyrQiv7.js} +1 -1
- package/dist-embed/chunks/{plugin-D7Giq2rW.js → plugin-NcgdmcAO.js} +1 -1
- package/dist-embed/chunks/{plugin-AdqytlNC.js → plugin-omHCT1Jk.js} +1 -1
- package/dist-embed/chunks/{pt-BR-5N22H2LF-CpNtiBPh.js → pt-BR-5N22H2LF-BYlDcalT.js} +1 -1
- package/dist-embed/chunks/{pt-PT-UZXXM6DQ-CcDR3Igq.js → pt-PT-UZXXM6DQ-xXdoFOOb.js} +1 -1
- package/dist-embed/chunks/{pyodide-kernel-CN7B4QLg.js → pyodide-kernel-bjLdubpe.js} +1 -1
- package/dist-embed/chunks/{pyodide-kernel-extension-CKE5jq9F.js → pyodide-kernel-extension-CshyO6Mm.js} +1 -1
- package/dist-embed/chunks/{renderer-8__rsP1H.js → renderer-We9CyR7b.js} +1 -1
- package/dist-embed/chunks/{ro-RO-JPDTUUEW-CANXxss1.js → ro-RO-JPDTUUEW-e-URCww-.js} +1 -1
- package/dist-embed/chunks/{ru-RU-B4JR7IUQ-B_NkKbWo.js → ru-RU-B4JR7IUQ-CrXBOpZl.js} +1 -1
- package/dist-embed/chunks/{server-extension-BvlUJPbJ.js → server-extension-D9R-wwz5.js} +1 -1
- package/dist-embed/chunks/{sessions-CgjtuOSm.js → sessions-DdXtI_C1.js} +1 -1
- package/dist-embed/chunks/{si-LK-N5RQ5JYF-Da_Bg8Mv.js → si-LK-N5RQ5JYF-DmJK04-A.js} +1 -1
- package/dist-embed/chunks/{sk-SK-C5VTKIMK-BKs6l_DT.js → sk-SK-C5VTKIMK-BDHycW1Q.js} +1 -1
- package/dist-embed/chunks/{sl-SI-NN7IZMDC-C4TvSXZU.js → sl-SI-NN7IZMDC-Bv9ZQTNb.js} +1 -1
- package/dist-embed/chunks/{subset-shared.chunk-BZGTZU2h.js → subset-shared.chunk-B0WCMaCa.js} +1 -1
- package/dist-embed/chunks/{subset-worker.chunk-CNJFtQV7.js → subset-worker.chunk-i0SNRqXr.js} +1 -1
- package/dist-embed/chunks/{sv-SE-XGPEYMSR-DdKzikID.js → sv-SE-XGPEYMSR-_HPzcZFc.js} +1 -1
- package/dist-embed/chunks/{ta-IN-2NMHFXQM-CDzGLNXS.js → ta-IN-2NMHFXQM-Ccvi-lqm.js} +1 -1
- package/dist-embed/chunks/{th-TH-HPSO5L25-X4BJ7awj.js → th-TH-HPSO5L25-DvAg4Mv1.js} +1 -1
- package/dist-embed/chunks/{tokens-CBhRbpQP.js → tokens-CTXFWLvM.js} +1 -1
- package/dist-embed/chunks/{tr-TR-DEFEU3FU-CN69_6_H.js → tr-TR-DEFEU3FU-DJsjfrja.js} +1 -1
- package/dist-embed/chunks/{uk-UA-QMV73CPH-KjB2cySI.js → uk-UA-QMV73CPH-3fvexlQA.js} +1 -1
- package/dist-embed/chunks/{usePrimerThemeBridge-DyX4EYyN.js → usePrimerThemeBridge-NsTRGuo7.js} +1 -1
- package/dist-embed/chunks/{vi-VN-M7AON7JQ-BqVSbGWG.js → vi-VN-M7AON7JQ-BoQ3ayAr.js} +1 -1
- package/dist-embed/chunks/{zh-CN-LNUGB5OW-oRPI4tbl.js → zh-CN-LNUGB5OW-Dzh0Ni_q.js} +1 -1
- package/dist-embed/chunks/{zh-HK-E62DVLB3-BUlz3y0i.js → zh-HK-E62DVLB3-_1FpSc_d.js} +1 -1
- package/dist-embed/chunks/{zh-TW-RAJ6MFWO-NxjUwhr3.js → zh-TW-RAJ6MFWO-CU-R8eF0.js} +1 -1
- package/dist-embed/datalayer-app-main.js +154 -154
- package/lib/apps/apps/AppRenderer.d.ts +6 -0
- package/lib/apps/apps/AppRenderer.js +3 -0
- package/lib/apps/plugins/agents/DatalayerAgentBridge.js +10 -3
- package/lib/apps/plugins/agents/SandboxSelector.js +1 -1
- package/lib/apps/plugins/agents/appLaunch.js +12 -0
- package/lib/apps/plugins/agents/handoffRuntime.d.ts +36 -0
- package/lib/apps/plugins/agents/handoffRuntime.js +50 -0
- package/lib/apps/plugins/agents/plugin.d.ts +20 -6
- package/lib/apps/plugins/agents/plugin.js +1 -0
- package/lib/apps/plugins/agents/switchable.d.ts +14 -2
- package/lib/apps/plugins/agents/switchable.js +13 -3
- package/lib/hooks/useAgentRuntimes.d.ts +1 -1
- package/lib/hooks/useAgentRuntimes.js +2 -0
- package/lib/loop-main.js +27 -25
- package/lib/portable/hosts/agentClient.d.ts +9 -9
- package/lib/portable/hosts/agentClient.js +34 -8
- package/lib/portable/hosts/contracts.json +3 -28
- package/lib/portable/hosts/index.d.ts +0 -1
- package/lib/portable/hosts/index.js +0 -1
- package/lib/runtimes/actions.js +6 -0
- package/lib/runtimes/apis.d.ts +8 -0
- package/lib/specs/agents/agents.js +1 -1
- package/lib/types/agents-lifecycle.d.ts +7 -0
- package/lib/types/agentspecs.d.ts +9 -4
- package/lib/types/agentspecs.js +7 -1
- package/package.json +1 -1
- package/dist-embed/chunks/Avatar-MNx1kN3F.js +0 -1
- package/dist-embed/chunks/DatalayerAgentBridge-BmoysA2b.js +0 -1
- package/lib/portable/hosts/sessionUid.d.ts +0 -9
- package/lib/portable/hosts/sessionUid.js +0 -29
|
@@ -95,6 +95,12 @@ export type AppInstance = {
|
|
|
95
95
|
* application of nobody's organization.
|
|
96
96
|
*/
|
|
97
97
|
organizationUid?: string;
|
|
98
|
+
/**
|
|
99
|
+
* What runs and hosts its agent, as its deployment says (`runtime_engine`):
|
|
100
|
+
* a kagent deployment's runtime is launched on kagent. Unsaid, its agent
|
|
101
|
+
* spec's engine applies.
|
|
102
|
+
*/
|
|
103
|
+
runtimeEngine?: 'datalayer' | 'kagent';
|
|
98
104
|
};
|
|
99
105
|
export type AppRendererProps = Omit<LoopEmbedProps, 'agentId'> & {
|
|
100
106
|
/** The application to render. */
|
|
@@ -311,6 +311,9 @@ export function appDatalayerCreatePayload(app, instance) {
|
|
|
311
311
|
...(instance.organizationUid
|
|
312
312
|
? { organization_uid: instance.organizationUid }
|
|
313
313
|
: {}),
|
|
314
|
+
...(instance.runtimeEngine
|
|
315
|
+
? { runtime_engine: instance.runtimeEngine }
|
|
316
|
+
: {}),
|
|
314
317
|
},
|
|
315
318
|
}
|
|
316
319
|
: {}),
|
|
@@ -147,11 +147,17 @@ export function DatalayerAgentBridge() {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
if (already) {
|
|
150
|
+
// The runtime's Jupyter, when the host gave it — a terminal session
|
|
151
|
+
// handed over by `/browser` does: the notebook opens on it, as the
|
|
152
|
+
// terminal's `/notebook` does. Without it the agent is already on its
|
|
153
|
+
// runtime and the chat is all the page talks to.
|
|
154
|
+
const jupyter = visitors ? undefined : kept?.jupyter;
|
|
150
155
|
service.report({
|
|
151
156
|
variant: 'datalayer',
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
157
|
+
sandbox_running: Boolean(jupyter),
|
|
158
|
+
...(jupyter
|
|
159
|
+
? { jupyter_url: jupyter.url, jupyter_token: jupyter.token }
|
|
160
|
+
: {}),
|
|
155
161
|
agent_base_url: already,
|
|
156
162
|
});
|
|
157
163
|
return;
|
|
@@ -197,6 +203,7 @@ export function DatalayerAgentBridge() {
|
|
|
197
203
|
status,
|
|
198
204
|
error,
|
|
199
205
|
already,
|
|
206
|
+
kept,
|
|
200
207
|
visitors,
|
|
201
208
|
visitorAgent,
|
|
202
209
|
]);
|
|
@@ -62,7 +62,7 @@ export function SandboxSelector(_props) {
|
|
|
62
62
|
// Held here: drawn, said why on hover, not taken. `aria-disabled`
|
|
63
63
|
// rather than `disabled`: a disabled button takes no pointer, and
|
|
64
64
|
// its reason would never be read.
|
|
65
|
-
const held = heldTargetReason(entry, service?.serverUrl ?? '');
|
|
65
|
+
const held = heldTargetReason(entry, service?.serverUrl ?? '', service?.fixedTarget);
|
|
66
66
|
return (_jsx(SegmentedControl.Button, { selected: position === index, "aria-disabled": held ? true : undefined, "data-sandbox-target": entry, "data-sandbox-target-held": held ? '' : undefined, sx: {
|
|
67
67
|
listStyle: 'none',
|
|
68
68
|
...(held
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
+
import { RUNTIME_ENGINES } from '../../../types/agentspecs.js';
|
|
5
6
|
/**
|
|
6
7
|
* The launch of the application an agent is created with, or none.
|
|
7
8
|
*
|
|
@@ -20,9 +21,20 @@ export function appLaunchOf(createPayload) {
|
|
|
20
21
|
const deploymentUid = typeof instance.deployment_uid === 'string' && instance.deployment_uid
|
|
21
22
|
? instance.deployment_uid
|
|
22
23
|
: undefined;
|
|
24
|
+
const said = instance.runtime_engine;
|
|
25
|
+
if (said !== undefined &&
|
|
26
|
+
said !== '' &&
|
|
27
|
+
!RUNTIME_ENGINES.includes(said)) {
|
|
28
|
+
throw new Error(`The application's instance runs on ${String(said)}: one of ${RUNTIME_ENGINES.join(', ')} (runtime_engine).`);
|
|
29
|
+
}
|
|
30
|
+
if (said === 'agentcore') {
|
|
31
|
+
throw new Error('An application deployed on AWS AgentCore is not launched on a runtime: AgentCore starts its agent runtime itself.');
|
|
32
|
+
}
|
|
33
|
+
const runtimeEngine = said ? said : undefined;
|
|
23
34
|
return {
|
|
24
35
|
appSpec: appSpec,
|
|
25
36
|
...(appUid ? { appUid } : {}),
|
|
26
37
|
...(deploymentUid ? { deploymentUid } : {}),
|
|
38
|
+
...(runtimeEngine ? { runtimeEngine } : {}),
|
|
27
39
|
};
|
|
28
40
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a session handed over from the terminal runs, and the Agents
|
|
3
|
+
* plugin's configuration that keeps it there.
|
|
4
|
+
*
|
|
5
|
+
* `/browser` mints a handoff carrying `runtime` (`routes/loop.py`); the LOOP
|
|
6
|
+
* page redeems it and configures this plugin from it, so the switch shows the
|
|
7
|
+
* session's place selected and every other place held.
|
|
8
|
+
*
|
|
9
|
+
* @module apps/plugins/agents/handoffRuntime
|
|
10
|
+
*/
|
|
11
|
+
import type { AgentsConfig } from './plugin';
|
|
12
|
+
/**
|
|
13
|
+
* Where the handed-over session's agent runs, as the terminal said.
|
|
14
|
+
*
|
|
15
|
+
* The page cannot tell for itself: on Datalayer it is served through the
|
|
16
|
+
* terminal's relay at `http://127.0.0.1:<port>`, which looks exactly like a
|
|
17
|
+
* local server. The Jupyter token arrives here, in the exchange's answer, and
|
|
18
|
+
* never in the page's address.
|
|
19
|
+
*/
|
|
20
|
+
export type SessionRuntime = {
|
|
21
|
+
where: 'local';
|
|
22
|
+
} | {
|
|
23
|
+
where: 'datalayer';
|
|
24
|
+
name: string;
|
|
25
|
+
jupyterUrl: string;
|
|
26
|
+
jupyterToken: string;
|
|
27
|
+
};
|
|
28
|
+
/** The exchange's `runtime`, or an error saying what is missing. */
|
|
29
|
+
export declare function sessionRuntimeOf(runtime: unknown): SessionRuntime;
|
|
30
|
+
/**
|
|
31
|
+
* The Agents plugin's configuration for a session: where it runs, and only
|
|
32
|
+
* there. A handed-over session is fixed to its place — Datalayer with the
|
|
33
|
+
* runtime's Jupyter for the notebook, or Local — and the switch holds the
|
|
34
|
+
* others; a page opened without a handoff starts on Local, movable.
|
|
35
|
+
*/
|
|
36
|
+
export declare function agentsConfigOf(serverUrl: string, runtime: SessionRuntime | undefined): AgentsConfig;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/** The exchange's `runtime`, or an error saying what is missing. */
|
|
6
|
+
export function sessionRuntimeOf(runtime) {
|
|
7
|
+
const value = (runtime ?? {});
|
|
8
|
+
if (value.where === 'local') {
|
|
9
|
+
return { where: 'local' };
|
|
10
|
+
}
|
|
11
|
+
if (value.where === 'datalayer' &&
|
|
12
|
+
typeof value.name === 'string' &&
|
|
13
|
+
typeof value.jupyter_url === 'string' &&
|
|
14
|
+
typeof value.jupyter_token === 'string') {
|
|
15
|
+
return {
|
|
16
|
+
where: 'datalayer',
|
|
17
|
+
name: value.name,
|
|
18
|
+
jupyterUrl: value.jupyter_url,
|
|
19
|
+
jupyterToken: value.jupyter_token,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
throw new Error('The handed-over session does not say where its agent runs: update agent-runtimes on the server that minted the handoff.');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The Agents plugin's configuration for a session: where it runs, and only
|
|
26
|
+
* there. A handed-over session is fixed to its place — Datalayer with the
|
|
27
|
+
* runtime's Jupyter for the notebook, or Local — and the switch holds the
|
|
28
|
+
* others; a page opened without a handoff starts on Local, movable.
|
|
29
|
+
*/
|
|
30
|
+
export function agentsConfigOf(serverUrl, runtime) {
|
|
31
|
+
if (runtime?.where === 'datalayer') {
|
|
32
|
+
return {
|
|
33
|
+
serverUrl,
|
|
34
|
+
target: 'datalayer',
|
|
35
|
+
targetFixed: true,
|
|
36
|
+
// The agent is already on the runtime, reached through the relay —
|
|
37
|
+
// this page's origin — which adds the person's token.
|
|
38
|
+
datalayerKept: {
|
|
39
|
+
url: serverUrl,
|
|
40
|
+
name: runtime.name,
|
|
41
|
+
jupyter: { url: runtime.jupyterUrl, token: runtime.jupyterToken },
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
serverUrl,
|
|
47
|
+
target: 'local',
|
|
48
|
+
targetFixed: runtime !== undefined,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -114,13 +114,25 @@ export type AgentsConfig = {
|
|
|
114
114
|
*/
|
|
115
115
|
datalayerVisitors?: DatalayerVisitors;
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* person's own token
|
|
117
|
+
* An agent already on a runtime of its own, so nothing is allocated or
|
|
118
|
+
* created: a deployment kept there (R-33), its agent made from the
|
|
119
|
+
* deployment record when the runtime started, which the chat speaks to
|
|
120
|
+
* with the person's own token; or the runtime a terminal session runs on,
|
|
121
|
+
* handed over by `/browser`, reached through the terminal's relay, which
|
|
122
|
+
* adds the token itself. `url` is the runtime's agent-runtimes address.
|
|
123
|
+
*
|
|
124
|
+
* `jupyter` is the runtime's Jupyter server, when the page opens notebooks
|
|
125
|
+
* on it: its base URL (the ingress) and its own token. Given, the sandbox
|
|
126
|
+
* is reported running there; absent, the chat is all the page talks to.
|
|
127
|
+
* `name` is the runtime's.
|
|
121
128
|
*/
|
|
122
129
|
datalayerKept?: {
|
|
123
130
|
url: string;
|
|
131
|
+
name?: string;
|
|
132
|
+
jupyter?: {
|
|
133
|
+
url: string;
|
|
134
|
+
token: string;
|
|
135
|
+
};
|
|
124
136
|
};
|
|
125
137
|
/**
|
|
126
138
|
* An embed token for the application (R-20): what an embedded
|
|
@@ -131,8 +143,10 @@ export type AgentsConfig = {
|
|
|
131
143
|
embedToken?: string;
|
|
132
144
|
/**
|
|
133
145
|
* The target is the host's decision, not the reader's: started there even
|
|
134
|
-
* with the control hidden
|
|
135
|
-
*
|
|
146
|
+
* with the control hidden, and, with the control shown, every other target
|
|
147
|
+
* held in it with the reason (`heldTargetReason`). For an application that
|
|
148
|
+
* runs where it is deployed, and for a session handed over from the
|
|
149
|
+
* terminal, which runs where it was started; a workspace leaves it unset.
|
|
136
150
|
*/
|
|
137
151
|
targetFixed?: boolean;
|
|
138
152
|
};
|
|
@@ -62,6 +62,7 @@ export const AgentsPlugin = definePlugin({
|
|
|
62
62
|
// read here, so that it is held on the web like any other.
|
|
63
63
|
initialTarget: offeredTarget((showVariants || config.targetFixed ? config.target : 'browser') ??
|
|
64
64
|
'local', config.serverUrl),
|
|
65
|
+
targetFixed: config.targetFixed,
|
|
65
66
|
kernelSource: config.kernelSource,
|
|
66
67
|
localAgent: config.localAgent,
|
|
67
68
|
// The capacity plugins' say, read at switch time — lazily, because a
|
|
@@ -59,6 +59,11 @@ export declare const SANDBOX_TARGETS: readonly SandboxTarget[];
|
|
|
59
59
|
* Why a target is shown but not offered here — said on it — or nothing when
|
|
60
60
|
* it is offered.
|
|
61
61
|
*
|
|
62
|
+
* A host that fixed the target (`fixed`) offers that one and no other: a
|
|
63
|
+
* session the terminal handed over runs where it was started — on a Datalayer
|
|
64
|
+
* runtime, or on this machine — and the page cannot move it. The others stay
|
|
65
|
+
* in the switch, held, saying so.
|
|
66
|
+
*
|
|
62
67
|
* *Local* is a local agent with the Jupyter server it starts beside itself,
|
|
63
68
|
* and a web page has no machine of the reader's to start them on. Decided
|
|
64
69
|
* 2026-10-10 (Eric): not offered on the web for now, and left in the switch,
|
|
@@ -66,7 +71,7 @@ export declare const SANDBOX_TARGETS: readonly SandboxTarget[];
|
|
|
66
71
|
* JupyterLab it is offered as before — the same line the code-sandbox picker
|
|
67
72
|
* draws for a Jupyter Server's kernels (`codeSandboxProviders`).
|
|
68
73
|
*/
|
|
69
|
-
export declare function heldTargetReason(target: SandboxTarget, serverUrl: string): string | undefined;
|
|
74
|
+
export declare function heldTargetReason(target: SandboxTarget, serverUrl: string, fixed?: SandboxTarget): string | undefined;
|
|
70
75
|
export declare const TARGET_SPECS: Record<SandboxTarget, SandboxTargetSpec>;
|
|
71
76
|
/** Whether an agent runs on this target — the question the chat asks. */
|
|
72
77
|
export declare function targetHasAgent(target: SandboxTarget): boolean;
|
|
@@ -81,6 +86,8 @@ export declare function targetRunsAgentInPage(target: SandboxTarget): boolean;
|
|
|
81
86
|
export type SwitchableSandboxService = SandboxService & {
|
|
82
87
|
/** Where the sandbox currently runs. */
|
|
83
88
|
readonly target: ReadonlySignal<SandboxTarget>;
|
|
89
|
+
/** The one target offered, when the host fixed it; every other is held. */
|
|
90
|
+
readonly fixedTarget?: SandboxTarget;
|
|
84
91
|
/** Move it. Disconnects the old backing before starting the new one. */
|
|
85
92
|
setTarget: (target: SandboxTarget) => Promise<void>;
|
|
86
93
|
/** The in-browser services, when the browser is the active target. */
|
|
@@ -91,6 +98,11 @@ export type SwitchableSandboxService = SandboxService & {
|
|
|
91
98
|
export type SwitchableConfig = {
|
|
92
99
|
serverUrl: string;
|
|
93
100
|
initialTarget?: SandboxTarget;
|
|
101
|
+
/**
|
|
102
|
+
* Whether the initial target is the only one: the host decided where the
|
|
103
|
+
* agent runs, and the reader cannot move it (`heldTargetReason`).
|
|
104
|
+
*/
|
|
105
|
+
targetFixed?: boolean;
|
|
94
106
|
/**
|
|
95
107
|
* Agent to create when Local is selected.
|
|
96
108
|
*
|
|
@@ -119,7 +131,7 @@ export type SwitchableConfig = {
|
|
|
119
131
|
*/
|
|
120
132
|
kernelSource?: ServiceManagerSource;
|
|
121
133
|
};
|
|
122
|
-
export declare function createSwitchableSandboxService({ serverUrl, initialTarget, kernelSource, localAgent, blueprint, }: SwitchableConfig): SwitchableSandboxService;
|
|
134
|
+
export declare function createSwitchableSandboxService({ serverUrl, initialTarget, targetFixed, kernelSource, localAgent, blueprint, }: SwitchableConfig): SwitchableSandboxService;
|
|
123
135
|
/**
|
|
124
136
|
* Create the agent whose per-agent Jupyter sandbox backs Local, on the
|
|
125
137
|
* agent-runtimes server at `serverUrl`, unless it is there already — then
|
|
@@ -45,6 +45,11 @@ export const SANDBOX_TARGETS = [
|
|
|
45
45
|
* Why a target is shown but not offered here — said on it — or nothing when
|
|
46
46
|
* it is offered.
|
|
47
47
|
*
|
|
48
|
+
* A host that fixed the target (`fixed`) offers that one and no other: a
|
|
49
|
+
* session the terminal handed over runs where it was started — on a Datalayer
|
|
50
|
+
* runtime, or on this machine — and the page cannot move it. The others stay
|
|
51
|
+
* in the switch, held, saying so.
|
|
52
|
+
*
|
|
48
53
|
* *Local* is a local agent with the Jupyter server it starts beside itself,
|
|
49
54
|
* and a web page has no machine of the reader's to start them on. Decided
|
|
50
55
|
* 2026-10-10 (Eric): not offered on the web for now, and left in the switch,
|
|
@@ -52,7 +57,10 @@ export const SANDBOX_TARGETS = [
|
|
|
52
57
|
* JupyterLab it is offered as before — the same line the code-sandbox picker
|
|
53
58
|
* draws for a Jupyter Server's kernels (`codeSandboxProviders`).
|
|
54
59
|
*/
|
|
55
|
-
export function heldTargetReason(target, serverUrl) {
|
|
60
|
+
export function heldTargetReason(target, serverUrl, fixed) {
|
|
61
|
+
if (fixed && target !== fixed) {
|
|
62
|
+
return `This session runs on ${TARGET_SPECS[fixed].label}: it cannot be moved from here.`;
|
|
63
|
+
}
|
|
56
64
|
// A host that names its own agent-runtimes server — `app.mount`, `loop apps
|
|
57
65
|
// run --web` (P-08, P-25) — is not asking for the reader's machine:
|
|
58
66
|
// Local is that server, and it is offered. Held, every message of a page
|
|
@@ -139,8 +147,9 @@ export function targetHasAgent(target) {
|
|
|
139
147
|
export function targetRunsAgentInPage(target) {
|
|
140
148
|
return target === 'browser';
|
|
141
149
|
}
|
|
142
|
-
export function createSwitchableSandboxService({ serverUrl, initialTarget = 'local', kernelSource, localAgent, blueprint, }) {
|
|
150
|
+
export function createSwitchableSandboxService({ serverUrl, initialTarget = 'local', targetFixed = false, kernelSource, localAgent, blueprint, }) {
|
|
143
151
|
const target = signal(initialTarget);
|
|
152
|
+
const fixedTarget = targetFixed ? initialTarget : undefined;
|
|
144
153
|
// Both implementations exist from the start, but neither connects until it is
|
|
145
154
|
// the active one — a Pyodide kernel that nobody asked for is megabytes of
|
|
146
155
|
// download, and a WebSocket to a server nobody chose is noise in the logs.
|
|
@@ -256,6 +265,7 @@ export function createSwitchableSandboxService({ serverUrl, initialTarget = 'loc
|
|
|
256
265
|
: 'server';
|
|
257
266
|
},
|
|
258
267
|
target,
|
|
268
|
+
fixedTarget,
|
|
259
269
|
snapshot,
|
|
260
270
|
status,
|
|
261
271
|
ready,
|
|
@@ -323,7 +333,7 @@ export function createSwitchableSandboxService({ serverUrl, initialTarget = 'loc
|
|
|
323
333
|
return;
|
|
324
334
|
}
|
|
325
335
|
// Held here: refused whoever asks, not only by the switch's button.
|
|
326
|
-
const held = heldTargetReason(next, serverUrl);
|
|
336
|
+
const held = heldTargetReason(next, serverUrl, fixedTarget);
|
|
327
337
|
if (held) {
|
|
328
338
|
throw new Error(held);
|
|
329
339
|
}
|
|
@@ -62,7 +62,7 @@ export interface UseAgentOptions {
|
|
|
62
62
|
appLaunch?: AppLaunch;
|
|
63
63
|
}
|
|
64
64
|
/** What an application's launch carries besides its environment (R-19). */
|
|
65
|
-
export type AppLaunch = Required<Pick<IRuntimeOptions, 'appSpec'>> & Pick<IRuntimeOptions, 'appUid' | 'deploymentUid'>;
|
|
65
|
+
export type AppLaunch = Required<Pick<IRuntimeOptions, 'appSpec'>> & Pick<IRuntimeOptions, 'appUid' | 'deploymentUid' | 'runtimeEngine'>;
|
|
66
66
|
/**
|
|
67
67
|
* Return type for the useAgents hook.
|
|
68
68
|
*/
|
|
@@ -958,6 +958,8 @@ export function useCreateAgentRuntime() {
|
|
|
958
958
|
enable_codemode: data.enableCodemode ?? false,
|
|
959
959
|
agent_spec_id: data.agentSpecId || undefined,
|
|
960
960
|
agent_spec: data.agentSpec || undefined,
|
|
961
|
+
// The person's choice overrides the spec's; none is the spec's.
|
|
962
|
+
runtime_engine: data.runtimeEngine || undefined,
|
|
961
963
|
user_account_handle: data.userAccountHandle || undefined,
|
|
962
964
|
billing_entity_uid: data.billingEntityUid || undefined,
|
|
963
965
|
billing_entity_type: data.billingEntityType || undefined,
|
package/lib/loop-main.js
CHANGED
|
@@ -38,6 +38,7 @@ import { ChatPlugin } from './apps/plugins/chat/index.js';
|
|
|
38
38
|
import { A2uiPlugin } from './apps/plugins/a2ui/index.js';
|
|
39
39
|
import { AgentspecsPlugin } from './apps/plugins/agentspecs/index.js';
|
|
40
40
|
import { AgentsPlugin } from './apps/plugins/agents/index.js';
|
|
41
|
+
import { agentsConfigOf, sessionRuntimeOf, } from './apps/plugins/agents/handoffRuntime.js';
|
|
41
42
|
import { ModelsPlugin } from './apps/plugins/models/index.js';
|
|
42
43
|
import { DocumentPlugin } from './apps/plugins/document/index.js';
|
|
43
44
|
import { NotebookPlugin } from './apps/plugins/notebook/index.js';
|
|
@@ -67,37 +68,42 @@ async function resolveSession(serverUrl) {
|
|
|
67
68
|
if (!handoff) {
|
|
68
69
|
return fallback;
|
|
69
70
|
}
|
|
71
|
+
let session;
|
|
70
72
|
try {
|
|
71
73
|
const response = await fetch(`${serverUrl}/api/v1/loop/handoff/exchange?code=${encodeURIComponent(handoff)}`, { method: 'POST' });
|
|
72
74
|
if (!response.ok) {
|
|
73
75
|
return fallback;
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
params.delete('handoff');
|
|
77
|
-
const query = params.toString();
|
|
78
|
-
window.history.replaceState({}, '', `${window.location.pathname}${query ? `?${query}` : ''}`);
|
|
79
|
-
return {
|
|
80
|
-
serverUrl,
|
|
81
|
-
agentId: session.agent_id ?? fallback.agentId,
|
|
82
|
-
conversationId: session.conversation_id ?? undefined,
|
|
83
|
-
model: session.model ?? undefined,
|
|
84
|
-
view: session.view ?? view,
|
|
85
|
-
sandbox: {
|
|
86
|
-
state: session.sandbox?.sandbox_running ? 'running' : 'idle',
|
|
87
|
-
variant: session.sandbox?.variant,
|
|
88
|
-
kernelId: session.sandbox?.kernel_id,
|
|
89
|
-
jupyterUrl: session.sandbox?.jupyter_url,
|
|
90
|
-
},
|
|
91
|
-
};
|
|
77
|
+
session = await response.json();
|
|
92
78
|
}
|
|
93
79
|
catch {
|
|
94
80
|
// A handoff that cannot be redeemed is not a reason to show nothing: the
|
|
95
81
|
// page still opens, just without the terminal's conversation.
|
|
96
82
|
return fallback;
|
|
97
83
|
}
|
|
84
|
+
params.delete('handoff');
|
|
85
|
+
const query = params.toString();
|
|
86
|
+
window.history.replaceState({}, '', `${window.location.pathname}${query ? `?${query}` : ''}`);
|
|
87
|
+
return {
|
|
88
|
+
serverUrl,
|
|
89
|
+
agentId: session.agent_id ?? fallback.agentId,
|
|
90
|
+
conversationId: session.conversation_id ?? undefined,
|
|
91
|
+
model: session.model ?? undefined,
|
|
92
|
+
view: session.view ?? view,
|
|
93
|
+
sandbox: {
|
|
94
|
+
state: session.sandbox?.sandbox_running ? 'running' : 'idle',
|
|
95
|
+
variant: session.sandbox?.variant,
|
|
96
|
+
kernelId: session.sandbox?.kernel_id,
|
|
97
|
+
jupyterUrl: session.sandbox?.jupyter_url,
|
|
98
|
+
},
|
|
99
|
+
// Redeemed but not saying where it runs is a server out of step with
|
|
100
|
+
// this page: said on the page, rather than guessed at (`sessionRuntimeOf`).
|
|
101
|
+
runtime: sessionRuntimeOf(session.runtime),
|
|
102
|
+
};
|
|
98
103
|
}
|
|
99
104
|
function LoopPage() {
|
|
100
105
|
const [session, setSession] = useState(null);
|
|
106
|
+
const [failure, setFailure] = useState(null);
|
|
101
107
|
const { colorMode, theme } = useThemeStore();
|
|
102
108
|
const systemColorMode = useSystemColorMode();
|
|
103
109
|
const resolvedMode = colorMode === 'auto' ? systemColorMode : colorMode;
|
|
@@ -110,7 +116,7 @@ function LoopPage() {
|
|
|
110
116
|
}, []);
|
|
111
117
|
useEffect(() => {
|
|
112
118
|
const serverUrl = window.location.origin;
|
|
113
|
-
|
|
119
|
+
resolveSession(serverUrl).then(setSession, (error) => setFailure(error instanceof Error ? error.message : String(error)));
|
|
114
120
|
}, []);
|
|
115
121
|
return (_jsx(DatalayerThemeProvider, { colorMode: resolvedMode, theme: themeConfig.primerTheme, themeStyles: themeConfig.themeStyles, children: _jsx(QueryClientProvider, { client: internalQueryClient, children: _jsx(Box, { height: "100vh", overflow: "hidden", children: session ? (_jsx(LoopWorkspace, { serverUrl: session.serverUrl, agentId: session.agentId, conversationId: session.conversationId, model: session.model, sandbox: session.sandbox, initialViewType: session.view,
|
|
116
122
|
// The notebook and document plugins depend on the sandbox, so
|
|
@@ -118,18 +124,14 @@ function LoopPage() {
|
|
|
118
124
|
// server it talks to.
|
|
119
125
|
extensions: [
|
|
120
126
|
ChatPlugin,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// A session handed over from the terminal is server-backed;
|
|
124
|
-
// the header control can move it from there.
|
|
125
|
-
target: 'local',
|
|
126
|
-
}),
|
|
127
|
+
// Where the terminal's session runs, and only there.
|
|
128
|
+
configurePlugin(AgentsPlugin, agentsConfigOf(session.serverUrl, session.runtime)),
|
|
127
129
|
NotebookPlugin,
|
|
128
130
|
DocumentPlugin,
|
|
129
131
|
A2uiPlugin,
|
|
130
132
|
AgentspecsPlugin,
|
|
131
133
|
ModelsPlugin,
|
|
132
|
-
] })) : null }) }) }));
|
|
134
|
+
] })) : failure ? (_jsx(Box, { p: 4, color: "danger.fg", children: failure })) : null }) }) }));
|
|
133
135
|
}
|
|
134
136
|
const container = document.getElementById('root');
|
|
135
137
|
if (container) {
|
|
@@ -14,12 +14,13 @@ export type HostTurnRequest<P> = Readonly<{
|
|
|
14
14
|
principalId: string;
|
|
15
15
|
prompt: string;
|
|
16
16
|
provenance: P;
|
|
17
|
-
sessionId?: string;
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* The session the thread runs, as the host keeps it: a message to it.
|
|
19
|
+
* Without one, the turn opens a new session, whose uid the runtime mints
|
|
20
|
+
* (a ULID) and names back in the turn's `loop.turn` event; the host keeps
|
|
21
|
+
* it against its thread from `TurnStream.sessionId`.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
sessionId?: string;
|
|
23
24
|
/**
|
|
24
25
|
* The host user never linked: exchanged as a visitor, which ai-agents
|
|
25
26
|
* answers only when the installation's owner opened it to visitors and the
|
|
@@ -67,13 +68,12 @@ export type TurnProvenance = Readonly<{
|
|
|
67
68
|
message_id: string;
|
|
68
69
|
}>;
|
|
69
70
|
/**
|
|
70
|
-
* What is the host's own in a turn: the
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
71
|
+
* What is the host's own in a turn: the place Datalayer checks the channel
|
|
72
|
+
* policy against, the delivery target handed back with every delivery, the
|
|
73
|
+
* provenance sent with the turn, and what is said when its installation
|
|
74
|
+
* holds no host key.
|
|
74
75
|
*/
|
|
75
76
|
export type HostShape<P> = Readonly<{
|
|
76
|
-
sessionUidOf(request: HostTurnRequest<P>): string;
|
|
77
77
|
placeOf(request: HostTurnRequest<P>): Place;
|
|
78
78
|
targetOf(request: HostTurnRequest<P>): Record<string, unknown>;
|
|
79
79
|
/** The turn's provenance; a host that sends none leaves it out. */
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* started or sent on the deployment's session API (idempotent by the host's
|
|
8
8
|
* event id), its AG-UI stream reduced to semantic events, and its session
|
|
9
9
|
* mapped to the host's thread so approvals and completions are delivered.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* A new session's uid is the runtime's (a ULID), named back in the stream;
|
|
11
|
+
* the host keeps it against its thread. What is the host's own (its thread
|
|
12
|
+
* key, the place, the delivery target, its words) is injected as a
|
|
12
13
|
* `HostShape`. Moved from the Slack service (DC-004).
|
|
13
14
|
*
|
|
14
15
|
* @module portable/hosts/agentClient
|
|
@@ -238,7 +239,6 @@ export class HttpAgentClient {
|
|
|
238
239
|
async startTurn(request) {
|
|
239
240
|
const host = await this.credentials.forTurn(request);
|
|
240
241
|
assertTrustedStreamUrl(this.apiUrl, host.sessionApiUrl);
|
|
241
|
-
const sessionId = request.sessionId ?? this.shape.sessionUidOf(request);
|
|
242
242
|
const provenance = this.shape.provenanceOf?.(request);
|
|
243
243
|
const headers = {
|
|
244
244
|
accept: 'text/event-stream',
|
|
@@ -247,7 +247,7 @@ export class HttpAgentClient {
|
|
|
247
247
|
[IDEMPOTENCY_HEADER]: request.externalEventId,
|
|
248
248
|
};
|
|
249
249
|
const response = request.sessionId
|
|
250
|
-
? await this.fetchImplementation(`${host.sessionApiUrl}/${encodeURIComponent(sessionId)}/messages`, {
|
|
250
|
+
? await this.fetchImplementation(`${host.sessionApiUrl}/${encodeURIComponent(request.sessionId)}/messages`, {
|
|
251
251
|
body: JSON.stringify({
|
|
252
252
|
external_event_id: request.externalEventId,
|
|
253
253
|
text: request.prompt,
|
|
@@ -262,7 +262,6 @@ export class HttpAgentClient {
|
|
|
262
262
|
deployment_uid: host.deploymentUid,
|
|
263
263
|
external_event_id: request.externalEventId,
|
|
264
264
|
opener: request.prompt,
|
|
265
|
-
session: sessionId,
|
|
266
265
|
...(host.userToken ? { user_token: host.userToken } : {}),
|
|
267
266
|
...(provenance ? { provenance } : {}),
|
|
268
267
|
}),
|
|
@@ -275,6 +274,20 @@ export class HttpAgentClient {
|
|
|
275
274
|
// limit, a session of someone else.
|
|
276
275
|
throw new HostRefusedError(response.status, await refusalDetailOf(response), 'The turn');
|
|
277
276
|
}
|
|
277
|
+
const events = agUiEventsOf(response.body)[Symbol.asyncIterator]();
|
|
278
|
+
// A new session is named by the runtime: its `loop.turn` event, the
|
|
279
|
+
// first or second of the stream (after `loop.session`), on a first run
|
|
280
|
+
// and on a retry's replay alike.
|
|
281
|
+
const head = [];
|
|
282
|
+
let sessionId = request.sessionId;
|
|
283
|
+
while (!sessionId) {
|
|
284
|
+
const next = await events.next();
|
|
285
|
+
if (next.done) {
|
|
286
|
+
throw new Error('Datalayer named no session for the turn.');
|
|
287
|
+
}
|
|
288
|
+
head.push(next.value);
|
|
289
|
+
sessionId = turnOf(next.value)?.session || undefined;
|
|
290
|
+
}
|
|
278
291
|
const hostKey = host.bindable && this.hostKeyFor
|
|
279
292
|
? await this.hostKeyFor(request)
|
|
280
293
|
: undefined;
|
|
@@ -285,7 +298,20 @@ export class HttpAgentClient {
|
|
|
285
298
|
return {
|
|
286
299
|
run,
|
|
287
300
|
sessionId,
|
|
288
|
-
updates: this.#updates(
|
|
301
|
+
updates: this.#updates((async function* () {
|
|
302
|
+
try {
|
|
303
|
+
yield* head;
|
|
304
|
+
for (;;) {
|
|
305
|
+
const next = await events.next();
|
|
306
|
+
if (next.done)
|
|
307
|
+
return;
|
|
308
|
+
yield next.value;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
await events.return?.();
|
|
313
|
+
}
|
|
314
|
+
})(), host, sessionId, run),
|
|
289
315
|
};
|
|
290
316
|
}
|
|
291
317
|
/**
|
|
@@ -329,9 +355,9 @@ export class HttpAgentClient {
|
|
|
329
355
|
throw new Error(`Datalayer did not map the thread to its session (${response.status}).`);
|
|
330
356
|
}
|
|
331
357
|
}
|
|
332
|
-
async *#updates(
|
|
358
|
+
async *#updates(events, host, sessionId, run) {
|
|
333
359
|
const tools = new Map();
|
|
334
|
-
for await (const event of
|
|
360
|
+
for await (const event of events) {
|
|
335
361
|
const turn = turnOf(event);
|
|
336
362
|
if (turn?.turn) {
|
|
337
363
|
run.id = turn.turn;
|
|
@@ -202,10 +202,10 @@
|
|
|
202
202
|
"agent": "agent-desk",
|
|
203
203
|
"deployment_uid": "dep-1",
|
|
204
204
|
"opener": "Summarize the launch risks",
|
|
205
|
-
"session": "slack-T0-C0-1700000000-000001",
|
|
206
205
|
"external_event_id": "Ev0123",
|
|
207
206
|
"user_token": ""
|
|
208
207
|
},
|
|
208
|
+
"session": "A start names no session: the runtime mints its uid (a ULID) and names it in the turn event's session, on the first run and on its replay; the host keeps it and sends the next messages to it.",
|
|
209
209
|
"message_request": {
|
|
210
210
|
"text": "And the costs?",
|
|
211
211
|
"external_event_id": "Ev0124"
|
|
@@ -507,7 +507,7 @@
|
|
|
507
507
|
}
|
|
508
508
|
},
|
|
509
509
|
"discord": {
|
|
510
|
-
"about": "Discord's forms of the generic contracts: the installation is <application_id>:<guild_id>, a member is their snowflake, a thread is sent as its parent channel
|
|
510
|
+
"about": "Discord's forms of the generic contracts: the installation is <application_id>:<guild_id>, a member is their snowflake, a thread is sent as its parent channel; the session uid is the runtime's, kept by the service against its thread.",
|
|
511
511
|
"application_id": "123456789012345678",
|
|
512
512
|
"guild_id": "234567890123456789",
|
|
513
513
|
"bind_request": {
|
|
@@ -539,15 +539,6 @@
|
|
|
539
539
|
"id": "678901234567890123"
|
|
540
540
|
}
|
|
541
541
|
},
|
|
542
|
-
"session": {
|
|
543
|
-
"parts": [
|
|
544
|
-
"123456789012345678",
|
|
545
|
-
"234567890123456789",
|
|
546
|
-
"345678901234567890",
|
|
547
|
-
"456789012345678901"
|
|
548
|
-
],
|
|
549
|
-
"uid": "discord-15beb80510370bbe027882df9d4d4666925017df"
|
|
550
|
-
},
|
|
551
542
|
"target": {
|
|
552
543
|
"applicationId": "123456789012345678",
|
|
553
544
|
"channelId": "345678901234567890",
|
|
@@ -558,7 +549,7 @@
|
|
|
558
549
|
}
|
|
559
550
|
},
|
|
560
551
|
"whatsapp": {
|
|
561
|
-
"about": "WhatsApp's forms of the generic contracts: the installation is <waba_id>:<phone_number_id>, one per connected business number; a person is their business-scoped user id (BSUID: a country code, a period and up to 128 characters; never the phone number), which the external id pattern admits as it is, no hash in between; a 1:1 chat is a direct place named by the BSUID, a group a channel named by its group id; the session uid is
|
|
552
|
+
"about": "WhatsApp's forms of the generic contracts: the installation is <waba_id>:<phone_number_id>, one per connected business number; a person is their business-scoped user id (BSUID: a country code, a period and up to 128 characters; never the phone number), which the external id pattern admits as it is, no hash in between; a 1:1 chat is a direct place named by the BSUID, a group a channel named by its group id; the session uid is the runtime's, kept by the service against its chat or group; a turn's provenance names the message by its wamid.",
|
|
562
553
|
"waba_id": "102290129340398",
|
|
563
554
|
"phone_number_id": "106540352242922",
|
|
564
555
|
"bind_request": {
|
|
@@ -584,22 +575,6 @@
|
|
|
584
575
|
"id": "120363025246125486"
|
|
585
576
|
}
|
|
586
577
|
},
|
|
587
|
-
"session": {
|
|
588
|
-
"parts": [
|
|
589
|
-
"102290129340398",
|
|
590
|
-
"106540352242922",
|
|
591
|
-
"US.13491208655302741918"
|
|
592
|
-
],
|
|
593
|
-
"uid": "whatsapp-870e7e8165519947ec9c7df03d378b342cee380e"
|
|
594
|
-
},
|
|
595
|
-
"group_session": {
|
|
596
|
-
"parts": [
|
|
597
|
-
"102290129340398",
|
|
598
|
-
"106540352242922",
|
|
599
|
-
"120363025246125486"
|
|
600
|
-
],
|
|
601
|
-
"uid": "whatsapp-49aeadff03b2d02e6359121f9a55bae904640b35"
|
|
602
|
-
},
|
|
603
578
|
"provenance": {
|
|
604
579
|
"host_kind": "whatsapp",
|
|
605
580
|
"place": {
|