@agimon-ai/po-core 0.0.0-alpha.2 → 0.0.0-alpha.21
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/LICENSE +149 -21
- package/NOTICE +41 -0
- package/dist/agentModel.cjs +1 -1
- package/dist/agentModel.d.mts +2 -2
- package/dist/agentModel.mjs +1 -2
- package/dist/apiContracts.cjs +623 -802
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +277 -615
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +617 -794
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/askUser.cjs +2 -2
- package/dist/askUser.d.mts +2 -2
- package/dist/askUser.mjs +1 -2
- package/dist/authorTools.mjs +1 -2
- package/dist/backgroundWork.cjs +3 -3
- package/dist/backgroundWork.d.mts +2 -2
- package/dist/backgroundWork.mjs +1 -2
- package/dist/bundleAssetPolicy.mjs +1 -2
- package/dist/chatgptAuth.cjs +3 -2
- package/dist/chatgptAuth.d.mts +3 -2
- package/dist/chatgptAuth.mjs +2 -1
- package/dist/childProcess.cjs +1 -1
- package/dist/childProcess.d.mts +2 -2
- package/dist/childProcess.mjs +1 -2
- package/dist/childSession.cjs +11 -6
- package/dist/childSession.d.mts +3 -3
- package/dist/childSession.mjs +3 -3
- package/dist/cockpitContainer.mjs +1 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -2
- package/dist/contextApi.cjs +1 -0
- package/dist/contextApi.d.mts +2 -2
- package/dist/contextApi.mjs +2 -2
- package/dist/contextContributions.cjs +4 -4
- package/dist/contextContributions.d.mts +3 -3
- package/dist/contextContributions.mjs +3 -3
- package/dist/contextDetailStore.cjs +7 -5
- package/dist/contextDetailStore.cjs.map +1 -1
- package/dist/contextDetailStore.d.mts +2 -1
- package/dist/contextDetailStore.d.mts.map +1 -1
- package/dist/contextDetailStore.mjs +6 -4
- package/dist/contextDetailStore.mjs.map +1 -1
- package/dist/contextProjection.cjs +7 -2
- package/dist/contextProjection.cjs.map +1 -1
- package/dist/contextProjection.d.mts +4 -1
- package/dist/contextProjection.d.mts.map +1 -1
- package/dist/contextProjection.mjs +5 -2
- package/dist/contextProjection.mjs.map +1 -1
- package/dist/cordisHost.cjs +11 -11
- package/dist/cordisHost.d.mts +2 -2
- package/dist/cordisHost.mjs +1 -2
- package/dist/delegation.cjs +8 -8
- package/dist/delegation.d.mts +2 -2
- package/dist/delegation.mjs +1 -2
- package/dist/executionBudget.cjs +4 -3
- package/dist/executionBudget.cjs.map +1 -1
- package/dist/executionBudget.d.mts +2 -2
- package/dist/executionBudget.d.mts.map +1 -1
- package/dist/executionBudget.mjs +4 -3
- package/dist/executionBudget.mjs.map +1 -1
- package/dist/extensionFile.cjs +5 -0
- package/dist/extensionFile.d.mts +4 -2
- package/dist/extensionFile.mjs +4 -2
- package/dist/footer.d.mts +2 -2
- package/dist/footer.mjs +1 -2
- package/dist/headless.cjs +14 -14
- package/dist/headless.d.mts +2 -2
- package/dist/headless.mjs +1 -2
- package/dist/headlessHub.cjs +308 -109
- package/dist/headlessHub.cjs.map +1 -1
- package/dist/headlessHub.d.mts +71 -36
- package/dist/headlessHub.d.mts.map +1 -1
- package/dist/headlessHub.mjs +309 -110
- package/dist/headlessHub.mjs.map +1 -1
- package/dist/headlessProtocol.cjs +327 -0
- package/dist/headlessProtocol.cjs.map +1 -0
- package/dist/headlessProtocol.d.mts +30 -0
- package/dist/headlessProtocol.d.mts.map +1 -0
- package/dist/headlessProtocol.mjs +326 -0
- package/dist/headlessProtocol.mjs.map +1 -0
- package/dist/headlessServer.cjs +166 -151
- package/dist/headlessServer.cjs.map +1 -1
- package/dist/headlessServer.d.mts +13 -5
- package/dist/headlessServer.d.mts.map +1 -1
- package/dist/headlessServer.mjs +166 -151
- package/dist/headlessServer.mjs.map +1 -1
- package/dist/headlessSessionHost.d.mts +58 -21
- package/dist/headlessSessionHost.d.mts.map +1 -1
- package/dist/help.cjs +20 -20
- package/dist/help.d.mts +2 -2
- package/dist/help.mjs +2 -2
- package/dist/history.cjs +16 -20
- package/dist/history.d.mts +9 -7
- package/dist/history.mjs +6 -7
- package/dist/historyOwnership.cjs.map +1 -1
- package/dist/historyOwnership.d.mts +1 -1
- package/dist/historyOwnership.mjs.map +1 -1
- package/dist/hubChannel.cjs +9 -0
- package/dist/hubChannel.d.mts +3 -2
- package/dist/hubChannel.mjs +3 -2
- package/dist/index.cjs +26 -28
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -6
- package/dist/interop/chord.mjs +1 -0
- package/dist/interop/chordContext.mjs +1 -0
- package/dist/json.cjs +11 -5
- package/dist/json.d.mts +4 -2
- package/dist/json.mjs +4 -2
- package/dist/kernel.cjs +1 -1
- package/dist/kernel.d.mts +3 -3
- package/dist/kernel.mjs +1 -2
- package/dist/leader.d.mts +2 -2
- package/dist/leader.mjs +1 -2
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/machineApi.cjs +80 -74
- package/dist/machineApi.cjs.map +1 -1
- package/dist/machineApi.d.mts +5 -2
- package/dist/machineApi.d.mts.map +1 -1
- package/dist/machineApi.mjs +78 -71
- package/dist/machineApi.mjs.map +1 -1
- package/dist/main.cjs +2 -1
- package/dist/main.d.mts +2 -1
- package/dist/main.mjs +2 -1
- package/dist/mcpFacet.d.mts +3 -3
- package/dist/mcpProjection.cjs +13 -13
- package/dist/mcpProjection.d.mts +2 -2
- package/dist/mcpProjection.mjs +1 -2
- package/dist/mcpSchemaCost.cjs +4 -4
- package/dist/mcpSchemaCost.cjs.map +1 -1
- package/dist/mcpSchemaCost.d.mts +2 -2
- package/dist/mcpSchemaCost.mjs +4 -4
- package/dist/mcpSchemaCost.mjs.map +1 -1
- package/dist/mcpSession.cjs +7 -7
- package/dist/mcpSession.d.mts +2 -2
- package/dist/mcpSession.mjs +1 -2
- package/dist/mcpStatus.cjs +2 -2
- package/dist/mcpStatus.d.mts +2 -2
- package/dist/mcpStatus.mjs +1 -2
- package/dist/mcpToolResolver.cjs +3 -3
- package/dist/mcpToolResolver.d.mts +2 -2
- package/dist/mcpToolResolver.mjs +1 -2
- package/dist/mcpWidget.d.mts +2 -2
- package/dist/moduleResolution.cjs +43 -8
- package/dist/moduleResolution.cjs.map +1 -1
- package/dist/moduleResolution.d.mts +10 -1
- package/dist/moduleResolution.d.mts.map +1 -1
- package/dist/moduleResolution.mjs +40 -7
- package/dist/moduleResolution.mjs.map +1 -1
- package/dist/narration.cjs +3 -3
- package/dist/narration.d.mts +2 -2
- package/dist/narration.mjs +1 -2
- package/dist/native.cjs +9 -0
- package/dist/native.d.mts +4 -3
- package/dist/native.mjs +3 -2
- package/dist/nodePlatform.cjs +77 -0
- package/dist/nodePlatform.cjs.map +1 -0
- package/dist/nodePlatform.d.mts +17 -0
- package/dist/nodePlatform.d.mts.map +1 -0
- package/dist/nodePlatform.mjs +72 -0
- package/dist/nodePlatform.mjs.map +1 -0
- package/dist/notification.cjs +15 -15
- package/dist/notification.d.mts +2 -2
- package/dist/notification.mjs +1 -2
- package/dist/packageApi.cjs +11 -11
- package/dist/packageApi.d.mts +2 -2
- package/dist/packageApi.mjs +2 -2
- package/dist/packageApiServer.cjs +45 -27
- package/dist/packageApiServer.cjs.map +1 -1
- package/dist/packageApiServer.d.mts +36 -26
- package/dist/packageApiServer.d.mts.map +1 -1
- package/dist/packageApiServer.mjs +44 -26
- package/dist/packageApiServer.mjs.map +1 -1
- package/dist/piSettings.cjs +41 -20
- package/dist/piSettings.d.mts +4 -2
- package/dist/piSettings.mjs +4 -2
- package/dist/platform.cjs +62 -0
- package/dist/platform.d.mts +10 -0
- package/dist/platform.mjs +10 -0
- package/dist/pluginProtocol.cjs +7 -8
- package/dist/pluginProtocol.d.mts +2 -2
- package/dist/pluginProtocol.mjs +1 -2
- package/dist/poPackage.cjs +12 -0
- package/dist/poPackage.d.mts +3 -0
- package/dist/poPackage.mjs +3 -0
- package/dist/profileIdentity.cjs +1 -1
- package/dist/profileIdentity.d.mts +2 -2
- package/dist/profileIdentity.mjs +1 -2
- package/dist/protocol.cjs +3 -3
- package/dist/protocol.d.mts +2 -2
- package/dist/protocol.mjs +1 -2
- package/dist/readiness.cjs +6 -6
- package/dist/readiness.d.mts +2 -2
- package/dist/readiness.mjs +1 -2
- package/dist/remoteApi.cjs.map +1 -1
- package/dist/remoteApi.d.mts +2 -2
- package/dist/remoteApi.mjs.map +1 -1
- package/dist/remoteRuntime.cjs +42 -65
- package/dist/remoteRuntime.cjs.map +1 -1
- package/dist/remoteRuntime.d.mts +3 -2
- package/dist/remoteRuntime.d.mts.map +1 -1
- package/dist/remoteRuntime.mjs +41 -62
- package/dist/remoteRuntime.mjs.map +1 -1
- package/dist/runtimeConfig.cjs +4 -4
- package/dist/runtimeConfig.cjs.map +1 -1
- package/dist/runtimeConfig.d.mts +10 -9
- package/dist/runtimeConfig.d.mts.map +1 -1
- package/dist/runtimeConfig.mjs +4 -4
- package/dist/runtimeConfig.mjs.map +1 -1
- package/dist/runtimeContextApi.cjs +10 -3
- package/dist/runtimeContextApi.cjs.map +1 -1
- package/dist/runtimeContextApi.d.mts +3 -3
- package/dist/runtimeContextApi.d.mts.map +1 -1
- package/dist/runtimeContextApi.mjs +10 -3
- package/dist/runtimeContextApi.mjs.map +1 -1
- package/dist/runtimeCordisHost.cjs +46 -46
- package/dist/runtimeCordisHost.cjs.map +1 -1
- package/dist/runtimeCordisHost.d.mts +29 -28
- package/dist/runtimeCordisHost.d.mts.map +1 -1
- package/dist/runtimeCordisHost.mjs +42 -42
- package/dist/runtimeCordisHost.mjs.map +1 -1
- package/dist/runtimeIdentity.cjs +6 -9
- package/dist/runtimeIdentity.cjs.map +1 -1
- package/dist/runtimeIdentity.d.mts +5 -1
- package/dist/runtimeIdentity.d.mts.map +1 -1
- package/dist/runtimeIdentity.mjs +5 -8
- package/dist/runtimeIdentity.mjs.map +1 -1
- package/dist/runtimeJson.cjs +10 -45
- package/dist/runtimeJson.d.mts +3 -22
- package/dist/runtimeJson.mjs +3 -39
- package/dist/runtimeLogSinkTelemetry.cjs +19 -19
- package/dist/runtimeLogSinkTelemetry.cjs.map +1 -1
- package/dist/runtimeLogSinkTelemetry.d.mts +19 -19
- package/dist/runtimeLogSinkTelemetry.mjs +19 -19
- package/dist/runtimeLogSinkTelemetry.mjs.map +1 -1
- package/dist/runtimePackages.cjs +7 -2
- package/dist/runtimePackages.cjs.map +1 -1
- package/dist/runtimePackages.d.mts +4 -1
- package/dist/runtimePackages.d.mts.map +1 -1
- package/dist/runtimePackages.mjs +7 -2
- package/dist/runtimePackages.mjs.map +1 -1
- package/dist/runtimePiSettings.cjs +40 -263
- package/dist/runtimePiSettings.d.mts +3 -72
- package/dist/runtimePiSettings.mjs +3 -241
- package/dist/runtimeProtocol.cjs +19 -19
- package/dist/runtimeProtocol.cjs.map +1 -1
- package/dist/runtimeProtocol.d.mts +7 -7
- package/dist/runtimeProtocol.d.mts.map +1 -1
- package/dist/runtimeProtocol.mjs +17 -17
- package/dist/runtimeProtocol.mjs.map +1 -1
- package/dist/runtimeTransition.cjs +9 -9
- package/dist/runtimeTransition.cjs.map +1 -1
- package/dist/runtimeTransition.d.mts +10 -10
- package/dist/runtimeTransition.d.mts.map +1 -1
- package/dist/runtimeTransition.mjs +7 -7
- package/dist/runtimeTransition.mjs.map +1 -1
- package/dist/sandboxHarness.mjs +1 -2
- package/dist/server.cjs +3 -7
- package/dist/server.d.mts +6 -6
- package/dist/server.mjs +3 -4
- package/dist/serverPlugin.cjs +39 -0
- package/dist/serverPlugin.d.mts +12 -0
- package/dist/serverPlugin.mjs +11 -0
- package/dist/serverTelemetry.cjs +1 -1
- package/dist/serverTelemetry.cjs.map +1 -1
- package/dist/serverTelemetry.d.mts +2 -2
- package/dist/serverTelemetry.mjs +2 -2
- package/dist/serverTelemetry.mjs.map +1 -1
- package/dist/sessionFilesApi.cjs +41 -37
- package/dist/sessionFilesApi.cjs.map +1 -1
- package/dist/sessionFilesApi.d.mts +6 -3
- package/dist/sessionFilesApi.d.mts.map +1 -1
- package/dist/sessionFilesApi.mjs +41 -36
- package/dist/sessionFilesApi.mjs.map +1 -1
- package/dist/sessionProtocol.cjs +31 -6
- package/dist/sessionProtocol.d.mts +8 -3
- package/dist/sessionProtocol.mjs +8 -2
- package/dist/skills.cjs +5 -5
- package/dist/skills.d.mts +2 -2
- package/dist/skills.mjs +1 -2
- package/dist/sqliteSessionStorage.cjs +28 -50
- package/dist/sqliteSessionStorage.cjs.map +1 -1
- package/dist/sqliteSessionStorage.d.mts +13 -20
- package/dist/sqliteSessionStorage.d.mts.map +1 -1
- package/dist/sqliteSessionStorage.mjs +25 -48
- package/dist/sqliteSessionStorage.mjs.map +1 -1
- package/dist/src/constants/agentSettled.cjs +7 -0
- package/dist/src/constants/agentSettled.cjs.map +1 -0
- package/dist/src/constants/agentSettled.mjs +7 -0
- package/dist/src/constants/agentSettled.mjs.map +1 -0
- package/dist/src/constants/contextApi.cjs +3 -1
- package/dist/src/constants/contextApi.cjs.map +1 -1
- package/dist/src/constants/contextApi.d.mts +2 -1
- package/dist/src/constants/contextApi.d.mts.map +1 -1
- package/dist/src/constants/contextApi.mjs +3 -2
- package/dist/src/constants/contextApi.mjs.map +1 -1
- package/dist/src/constants/voiceTools.cjs +6 -6
- package/dist/src/constants/voiceTools.cjs.map +1 -1
- package/dist/src/constants/voiceTools.d.mts +3 -3
- package/dist/src/constants/voiceTools.mjs +4 -4
- package/dist/src/constants/voiceTools.mjs.map +1 -1
- package/dist/src/extensions/extensionFile.cjs +22 -5
- package/dist/src/extensions/extensionFile.cjs.map +1 -1
- package/dist/src/extensions/extensionFile.d.mts +17 -4
- package/dist/src/extensions/extensionFile.d.mts.map +1 -1
- package/dist/src/extensions/extensionFile.mjs +22 -6
- package/dist/src/extensions/extensionFile.mjs.map +1 -1
- package/dist/src/extensions/serverPlugin.cjs +231 -92
- package/dist/src/extensions/serverPlugin.cjs.map +1 -1
- package/dist/src/extensions/serverPlugin.d.mts +2 -2
- package/dist/src/extensions/serverPlugin.d.mts.map +1 -1
- package/dist/src/extensions/serverPlugin.mjs +232 -93
- package/dist/src/extensions/serverPlugin.mjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.cjs +349 -142
- package/dist/src/pi/piSessionRuntime.cjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.d.mts +18 -17
- package/dist/src/pi/piSessionRuntime.d.mts.map +1 -1
- package/dist/src/pi/piSessionRuntime.mjs +342 -135
- package/dist/src/pi/piSessionRuntime.mjs.map +1 -1
- package/dist/src/schemas/agentModel.cjs +2 -2
- package/dist/src/schemas/agentModel.cjs.map +1 -1
- package/dist/src/schemas/agentModel.d.mts +1 -1
- package/dist/src/schemas/agentModel.mjs +2 -2
- package/dist/src/schemas/agentModel.mjs.map +1 -1
- package/dist/src/schemas/apiContracts.d.mts +2 -2
- package/dist/src/schemas/apiContracts.d.mts.map +1 -1
- package/dist/src/schemas/askUser.cjs +4 -4
- package/dist/src/schemas/askUser.cjs.map +1 -1
- package/dist/src/schemas/askUser.d.mts +4 -4
- package/dist/src/schemas/askUser.d.mts.map +1 -1
- package/dist/src/schemas/askUser.mjs +3 -3
- package/dist/src/schemas/askUser.mjs.map +1 -1
- package/dist/src/schemas/backgroundWork.cjs +10 -10
- package/dist/src/schemas/backgroundWork.cjs.map +1 -1
- package/dist/src/schemas/backgroundWork.d.mts +9 -9
- package/dist/src/schemas/backgroundWork.d.mts.map +1 -1
- package/dist/src/schemas/backgroundWork.mjs +8 -8
- package/dist/src/schemas/backgroundWork.mjs.map +1 -1
- package/dist/src/schemas/childProcess.cjs +5 -5
- package/dist/src/schemas/childProcess.cjs.map +1 -1
- package/dist/src/schemas/childProcess.d.mts +2 -2
- package/dist/src/schemas/childProcess.mjs +5 -5
- package/dist/src/schemas/childProcess.mjs.map +1 -1
- package/dist/src/schemas/contextContributions.cjs +10 -10
- package/dist/src/schemas/contextContributions.cjs.map +1 -1
- package/dist/src/schemas/contextContributions.d.mts +16 -16
- package/dist/src/schemas/contextContributions.d.mts.map +1 -1
- package/dist/src/schemas/contextContributions.mjs +8 -8
- package/dist/src/schemas/contextContributions.mjs.map +1 -1
- package/dist/src/schemas/delegation.cjs +17 -17
- package/dist/src/schemas/delegation.cjs.map +1 -1
- package/dist/src/schemas/delegation.d.mts +16 -16
- package/dist/src/schemas/delegation.d.mts.map +1 -1
- package/dist/src/schemas/delegation.mjs +10 -10
- package/dist/src/schemas/delegation.mjs.map +1 -1
- package/dist/src/schemas/extensionFile.d.mts +23 -19
- package/dist/src/schemas/extensionFile.d.mts.map +1 -1
- package/dist/src/schemas/footer.cjs.map +1 -1
- package/dist/src/schemas/footer.d.mts +5 -5
- package/dist/src/schemas/footer.d.mts.map +1 -1
- package/dist/src/schemas/footer.mjs.map +1 -1
- package/dist/src/schemas/headless.cjs +37 -37
- package/dist/src/schemas/headless.cjs.map +1 -1
- package/dist/src/schemas/headless.d.mts +100 -101
- package/dist/src/schemas/headless.d.mts.map +1 -1
- package/dist/src/schemas/headless.mjs +24 -24
- package/dist/src/schemas/headless.mjs.map +1 -1
- package/dist/src/schemas/help.cjs +60 -60
- package/dist/src/schemas/help.cjs.map +1 -1
- package/dist/src/schemas/help.d.mts +43 -43
- package/dist/src/schemas/help.d.mts.map +1 -1
- package/dist/src/schemas/help.mjs +41 -41
- package/dist/src/schemas/help.mjs.map +1 -1
- package/dist/src/schemas/home.cjs +127 -0
- package/dist/src/schemas/home.cjs.map +1 -0
- package/dist/src/schemas/home.d.mts +63 -0
- package/dist/src/schemas/home.d.mts.map +1 -0
- package/dist/src/schemas/home.mjs +121 -0
- package/dist/src/schemas/home.mjs.map +1 -0
- package/dist/src/schemas/httpApiContracts.cjs +441 -0
- package/dist/src/schemas/httpApiContracts.cjs.map +1 -0
- package/dist/src/schemas/httpApiContracts.d.mts +78 -0
- package/dist/src/schemas/httpApiContracts.d.mts.map +1 -0
- package/dist/src/schemas/httpApiContracts.mjs +434 -0
- package/dist/src/schemas/httpApiContracts.mjs.map +1 -0
- package/dist/src/schemas/hubChannel.cjs +3 -0
- package/dist/src/schemas/hubChannel.cjs.map +1 -1
- package/dist/src/schemas/hubChannel.d.mts +84 -60
- package/dist/src/schemas/hubChannel.d.mts.map +1 -1
- package/dist/src/schemas/hubChannel.mjs +3 -1
- package/dist/src/schemas/hubChannel.mjs.map +1 -1
- package/dist/src/schemas/leader.cjs.map +1 -1
- package/dist/src/schemas/leader.d.mts +3 -3
- package/dist/src/schemas/leader.d.mts.map +1 -1
- package/dist/src/schemas/leader.mjs.map +1 -1
- package/dist/src/schemas/mcpBundle.d.mts +3 -3
- package/dist/src/schemas/mcpFacet.cjs.map +1 -1
- package/dist/src/schemas/mcpFacet.d.mts +22 -22
- package/dist/src/schemas/mcpFacet.d.mts.map +1 -1
- package/dist/src/schemas/mcpFacet.mjs.map +1 -1
- package/dist/src/schemas/mcpProjection.cjs +41 -41
- package/dist/src/schemas/mcpProjection.cjs.map +1 -1
- package/dist/src/schemas/mcpProjection.d.mts +31 -30
- package/dist/src/schemas/mcpProjection.d.mts.map +1 -1
- package/dist/src/schemas/mcpProjection.mjs +29 -29
- package/dist/src/schemas/mcpProjection.mjs.map +1 -1
- package/dist/src/schemas/mcpSession.cjs +23 -23
- package/dist/src/schemas/mcpSession.cjs.map +1 -1
- package/dist/src/schemas/mcpSession.d.mts +12 -12
- package/dist/src/schemas/mcpSession.d.mts.map +1 -1
- package/dist/src/schemas/mcpSession.mjs +18 -18
- package/dist/src/schemas/mcpSession.mjs.map +1 -1
- package/dist/src/schemas/mcpStatus.cjs +5 -5
- package/dist/src/schemas/mcpStatus.cjs.map +1 -1
- package/dist/src/schemas/mcpStatus.d.mts +4 -4
- package/dist/src/schemas/mcpStatus.d.mts.map +1 -1
- package/dist/src/schemas/mcpStatus.mjs +4 -4
- package/dist/src/schemas/mcpStatus.mjs.map +1 -1
- package/dist/src/schemas/mcpToolResolver.cjs +9 -9
- package/dist/src/schemas/mcpToolResolver.cjs.map +1 -1
- package/dist/src/schemas/mcpToolResolver.d.mts +7 -7
- package/dist/src/schemas/mcpToolResolver.d.mts.map +1 -1
- package/dist/src/schemas/mcpToolResolver.mjs +7 -7
- package/dist/src/schemas/mcpToolResolver.mjs.map +1 -1
- package/dist/src/schemas/narration.cjs +9 -9
- package/dist/src/schemas/narration.cjs.map +1 -1
- package/dist/src/schemas/narration.d.mts +5 -5
- package/dist/src/schemas/narration.d.mts.map +1 -1
- package/dist/src/schemas/narration.mjs +7 -7
- package/dist/src/schemas/narration.mjs.map +1 -1
- package/dist/src/schemas/notification.cjs +45 -45
- package/dist/src/schemas/notification.cjs.map +1 -1
- package/dist/src/schemas/notification.d.mts +22 -22
- package/dist/src/schemas/notification.d.mts.map +1 -1
- package/dist/src/schemas/notification.mjs +31 -31
- package/dist/src/schemas/notification.mjs.map +1 -1
- package/dist/src/schemas/packageApi.cjs +28 -28
- package/dist/src/schemas/packageApi.cjs.map +1 -1
- package/dist/src/schemas/packageApi.d.mts +91 -65
- package/dist/src/schemas/packageApi.d.mts.map +1 -1
- package/dist/src/schemas/packageApi.mjs +18 -18
- package/dist/src/schemas/packageApi.mjs.map +1 -1
- package/dist/src/schemas/platform.cjs +34 -0
- package/dist/src/schemas/platform.cjs.map +1 -0
- package/dist/src/schemas/platform.d.mts +75 -0
- package/dist/src/schemas/platform.d.mts.map +1 -0
- package/dist/src/schemas/platform.mjs +27 -0
- package/dist/src/schemas/platform.mjs.map +1 -0
- package/dist/src/schemas/pluginContributions.cjs.map +1 -1
- package/dist/src/schemas/pluginContributions.d.mts +12 -12
- package/dist/src/schemas/pluginContributions.d.mts.map +1 -1
- package/dist/src/schemas/pluginContributions.mjs.map +1 -1
- package/dist/src/schemas/pluginProtocol.cjs +24 -27
- package/dist/src/schemas/pluginProtocol.cjs.map +1 -1
- package/dist/src/schemas/pluginProtocol.d.mts +21 -21
- package/dist/src/schemas/pluginProtocol.d.mts.map +1 -1
- package/dist/src/schemas/pluginProtocol.mjs +18 -20
- package/dist/src/schemas/pluginProtocol.mjs.map +1 -1
- package/dist/src/schemas/profileIdentity.cjs +2 -2
- package/dist/src/schemas/profileIdentity.cjs.map +1 -1
- package/dist/src/schemas/profileIdentity.d.mts +1 -1
- package/dist/src/schemas/profileIdentity.mjs +2 -2
- package/dist/src/schemas/profileIdentity.mjs.map +1 -1
- package/dist/src/schemas/protocolChannelsContract.cjs +27 -0
- package/dist/src/schemas/protocolChannelsContract.cjs.map +1 -0
- package/dist/src/schemas/protocolChannelsContract.d.mts +37 -0
- package/dist/src/schemas/protocolChannelsContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolChannelsContract.mjs +25 -0
- package/dist/src/schemas/protocolChannelsContract.mjs.map +1 -0
- package/dist/src/schemas/protocolContracts.cjs +168 -0
- package/dist/src/schemas/protocolContracts.cjs.map +1 -0
- package/dist/src/schemas/protocolContracts.d.mts +69 -0
- package/dist/src/schemas/protocolContracts.d.mts.map +1 -0
- package/dist/src/schemas/protocolContracts.mjs +164 -0
- package/dist/src/schemas/protocolContracts.mjs.map +1 -0
- package/dist/src/schemas/protocolHubContract.cjs +51 -0
- package/dist/src/schemas/protocolHubContract.cjs.map +1 -0
- package/dist/src/schemas/protocolHubContract.d.mts +218 -0
- package/dist/src/schemas/protocolHubContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolHubContract.mjs +49 -0
- package/dist/src/schemas/protocolHubContract.mjs.map +1 -0
- package/dist/src/schemas/protocolSessionContract.cjs +22 -0
- package/dist/src/schemas/protocolSessionContract.cjs.map +1 -0
- package/dist/src/schemas/protocolSessionContract.d.mts +324 -0
- package/dist/src/schemas/protocolSessionContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolSessionContract.mjs +22 -0
- package/dist/src/schemas/protocolSessionContract.mjs.map +1 -0
- package/dist/src/schemas/protocolThreadContract.cjs +21 -0
- package/dist/src/schemas/protocolThreadContract.cjs.map +1 -0
- package/dist/src/schemas/protocolThreadContract.d.mts +29 -0
- package/dist/src/schemas/protocolThreadContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolThreadContract.mjs +20 -0
- package/dist/src/schemas/protocolThreadContract.mjs.map +1 -0
- package/dist/src/schemas/readiness.cjs +36 -36
- package/dist/src/schemas/readiness.cjs.map +1 -1
- package/dist/src/schemas/readiness.d.mts +37 -37
- package/dist/src/schemas/readiness.d.mts.map +1 -1
- package/dist/src/schemas/readiness.mjs +31 -31
- package/dist/src/schemas/readiness.mjs.map +1 -1
- package/dist/src/schemas/serverBundle.d.mts +5 -5
- package/dist/src/schemas/serverPlugin.cjs +103 -0
- package/dist/src/schemas/serverPlugin.cjs.map +1 -0
- package/dist/src/schemas/serverPlugin.d.mts +176 -0
- package/dist/src/schemas/serverPlugin.d.mts.map +1 -0
- package/dist/src/schemas/serverPlugin.mjs +95 -0
- package/dist/src/schemas/serverPlugin.mjs.map +1 -0
- package/dist/src/schemas/serverScope.cjs +37 -0
- package/dist/src/schemas/serverScope.cjs.map +1 -0
- package/dist/src/schemas/serverScope.d.mts +77 -0
- package/dist/src/schemas/serverScope.d.mts.map +1 -0
- package/dist/src/schemas/serverScope.mjs +33 -0
- package/dist/src/schemas/serverScope.mjs.map +1 -0
- package/dist/src/schemas/sessionApiContracts.cjs +320 -0
- package/dist/src/schemas/sessionApiContracts.cjs.map +1 -0
- package/dist/src/schemas/sessionApiContracts.mjs +318 -0
- package/dist/src/schemas/sessionApiContracts.mjs.map +1 -0
- package/dist/src/schemas/sessionProtocol.cjs +20 -13
- package/dist/src/schemas/sessionProtocol.cjs.map +1 -1
- package/dist/src/schemas/sessionProtocol.d.mts +37 -54
- package/dist/src/schemas/sessionProtocol.d.mts.map +1 -1
- package/dist/src/schemas/sessionProtocol.mjs +17 -8
- package/dist/src/schemas/sessionProtocol.mjs.map +1 -1
- package/dist/src/schemas/skills.cjs +16 -16
- package/dist/src/schemas/skills.cjs.map +1 -1
- package/dist/src/schemas/skills.d.mts +7 -7
- package/dist/src/schemas/skills.d.mts.map +1 -1
- package/dist/src/schemas/skills.mjs +12 -12
- package/dist/src/schemas/skills.mjs.map +1 -1
- package/dist/src/schemas/toolOverrides.cjs +9 -9
- package/dist/src/schemas/toolOverrides.cjs.map +1 -1
- package/dist/src/schemas/toolOverrides.d.mts +8 -8
- package/dist/src/schemas/toolOverrides.d.mts.map +1 -1
- package/dist/src/schemas/toolOverrides.mjs +7 -7
- package/dist/src/schemas/toolOverrides.mjs.map +1 -1
- package/dist/src/schemas/toolSurface.cjs +9 -9
- package/dist/src/schemas/toolSurface.cjs.map +1 -1
- package/dist/src/schemas/toolSurface.d.mts +13 -13
- package/dist/src/schemas/toolSurface.d.mts.map +1 -1
- package/dist/src/schemas/toolSurface.mjs +7 -7
- package/dist/src/schemas/toolSurface.mjs.map +1 -1
- package/dist/src/schemas/uiHub.cjs +9 -9
- package/dist/src/schemas/uiHub.cjs.map +1 -1
- package/dist/src/schemas/uiHub.d.mts +12 -12
- package/dist/src/schemas/uiHub.d.mts.map +1 -1
- package/dist/src/schemas/uiHub.mjs +7 -7
- package/dist/src/schemas/uiHub.mjs.map +1 -1
- package/dist/src/server/directHarnessRuntime.cjs +691 -775
- package/dist/src/server/directHarnessRuntime.cjs.map +1 -1
- package/dist/src/server/directHarnessRuntime.d.mts +5 -1
- package/dist/src/server/directHarnessRuntime.d.mts.map +1 -0
- package/dist/src/server/directHarnessRuntime.mjs +671 -754
- package/dist/src/server/directHarnessRuntime.mjs.map +1 -1
- package/dist/src/server/largeFrameLink.cjs +47 -0
- package/dist/src/server/largeFrameLink.cjs.map +1 -0
- package/dist/src/server/largeFrameLink.mjs +47 -0
- package/dist/src/server/largeFrameLink.mjs.map +1 -0
- package/dist/src/server/liveImport.cjs +1 -1
- package/dist/src/server/liveImport.cjs.map +1 -1
- package/dist/src/server/liveImport.d.mts +1 -1
- package/dist/src/server/liveImport.mjs +1 -1
- package/dist/src/server/liveImport.mjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.cjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.d.mts +6 -6
- package/dist/src/server/mcpBundleLoader.d.mts.map +1 -1
- package/dist/src/server/mcpBundleLoader.mjs.map +1 -1
- package/dist/src/server/serverPackages.cjs +60 -0
- package/dist/src/server/serverPackages.cjs.map +1 -0
- package/dist/src/server/serverPackages.d.mts +44 -0
- package/dist/src/server/serverPackages.d.mts.map +1 -0
- package/dist/src/server/serverPackages.mjs +59 -0
- package/dist/src/server/serverPackages.mjs.map +1 -0
- package/dist/src/server/serverScope.cjs +510 -0
- package/dist/src/server/serverScope.cjs.map +1 -0
- package/dist/src/server/serverScope.d.mts +123 -0
- package/dist/src/server/serverScope.d.mts.map +1 -0
- package/dist/src/server/serverScope.mjs +510 -0
- package/dist/src/server/serverScope.mjs.map +1 -0
- package/dist/src/server/sessionMcpHandler.cjs +3 -3
- package/dist/src/server/sessionMcpHandler.cjs.map +1 -1
- package/dist/src/server/sessionMcpHandler.mjs +4 -4
- package/dist/src/server/sessionMcpHandler.mjs.map +1 -1
- package/dist/src/server/sessionMcpRoutes.cjs +2 -1
- package/dist/src/server/sessionMcpRoutes.cjs.map +1 -1
- package/dist/src/server/sessionMcpRoutes.mjs +2 -1
- package/dist/src/server/sessionMcpRoutes.mjs.map +1 -1
- package/dist/src/server/threadJournals.cjs +38 -107
- package/dist/src/server/threadJournals.cjs.map +1 -1
- package/dist/src/server/threadJournals.mjs +38 -104
- package/dist/src/server/threadJournals.mjs.map +1 -1
- package/dist/src/services/apiSurfaceAssert/index.cjs +1 -1
- package/dist/src/services/apiSurfaceAssert/index.cjs.map +1 -1
- package/dist/src/services/apiSurfaceAssert/index.d.mts +6 -6
- package/dist/src/services/apiSurfaceAssert/index.mjs +1 -1
- package/dist/src/services/apiSurfaceAssert/index.mjs.map +1 -1
- package/dist/src/services/chatgptAuth/index.cjs +1 -220
- package/dist/src/services/chatgptAuth/index.cjs.map +1 -1
- package/dist/src/services/chatgptAuth/index.d.mts +0 -18
- package/dist/src/services/chatgptAuth/index.d.mts.map +1 -1
- package/dist/src/services/chatgptAuth/index.mjs +1 -217
- package/dist/src/services/chatgptAuth/index.mjs.map +1 -1
- package/dist/src/services/chatgptImages/index.cjs +1 -1
- package/dist/src/services/chatgptImages/index.cjs.map +1 -1
- package/dist/src/services/chatgptImages/index.mjs +1 -1
- package/dist/src/services/chatgptImages/index.mjs.map +1 -1
- package/dist/src/services/chatgptLogin/index.cjs +230 -0
- package/dist/src/services/chatgptLogin/index.cjs.map +1 -0
- package/dist/src/services/chatgptLogin/index.d.mts +21 -0
- package/dist/src/services/chatgptLogin/index.d.mts.map +1 -0
- package/dist/src/services/chatgptLogin/index.mjs +227 -0
- package/dist/src/services/chatgptLogin/index.mjs.map +1 -0
- package/dist/src/services/chatgptWebSearch/index.cjs +1 -1
- package/dist/src/services/chatgptWebSearch/index.cjs.map +1 -1
- package/dist/src/services/chatgptWebSearch/index.mjs +1 -1
- package/dist/src/services/chatgptWebSearch/index.mjs.map +1 -1
- package/dist/src/services/contextContributions/index.cjs +8 -8
- package/dist/src/services/contextContributions/index.cjs.map +1 -1
- package/dist/src/services/contextContributions/index.d.mts +3 -3
- package/dist/src/services/contextContributions/index.d.mts.map +1 -1
- package/dist/src/services/contextContributions/index.mjs +8 -8
- package/dist/src/services/contextContributions/index.mjs.map +1 -1
- package/dist/src/services/devProxyStore/devProxyRecords.cjs +59 -0
- package/dist/src/services/devProxyStore/devProxyRecords.cjs.map +1 -0
- package/dist/src/services/devProxyStore/devProxyRecords.mjs +56 -0
- package/dist/src/services/devProxyStore/devProxyRecords.mjs.map +1 -0
- package/dist/src/services/devProxyStore/index.cjs +7 -101
- package/dist/src/services/devProxyStore/index.cjs.map +1 -1
- package/dist/src/services/devProxyStore/index.mjs +7 -101
- package/dist/src/services/devProxyStore/index.mjs.map +1 -1
- package/dist/src/services/devProxyStore/sync.cjs +66 -0
- package/dist/src/services/devProxyStore/sync.cjs.map +1 -0
- package/dist/src/services/devProxyStore/sync.mjs +63 -0
- package/dist/src/services/devProxyStore/sync.mjs.map +1 -0
- package/dist/src/services/durableNavigation/docs.cjs +15 -0
- package/dist/src/services/durableNavigation/docs.cjs.map +1 -0
- package/dist/src/services/durableNavigation/docs.mjs +16 -0
- package/dist/src/services/durableNavigation/docs.mjs.map +1 -0
- package/dist/src/services/durableNavigation/index.cjs +3 -18
- package/dist/src/services/durableNavigation/index.cjs.map +1 -1
- package/dist/src/services/durableNavigation/index.mjs +2 -17
- package/dist/src/services/durableNavigation/index.mjs.map +1 -1
- package/dist/src/services/durableQueue/docs.cjs +12 -0
- package/dist/src/services/durableQueue/docs.cjs.map +1 -0
- package/dist/src/services/durableQueue/docs.mjs +13 -0
- package/dist/src/services/durableQueue/docs.mjs.map +1 -0
- package/dist/src/services/durableQueue/index.cjs +151 -0
- package/dist/src/services/durableQueue/index.cjs.map +1 -0
- package/dist/src/services/durableQueue/index.mjs +149 -0
- package/dist/src/services/durableQueue/index.mjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/docs.cjs +11 -0
- package/dist/src/services/durableRequestReceipts/docs.cjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/docs.mjs +12 -0
- package/dist/src/services/durableRequestReceipts/docs.mjs.map +1 -0
- package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.cjs +10 -16
- package/dist/src/services/durableRequestReceipts/index.cjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/index.d.mts +12 -0
- package/dist/src/services/durableRequestReceipts/index.d.mts.map +1 -0
- package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.mjs +7 -13
- package/dist/src/services/durableRequestReceipts/index.mjs.map +1 -0
- package/dist/src/services/durableSession/docs.cjs +65 -0
- package/dist/src/services/durableSession/docs.cjs.map +1 -0
- package/dist/src/services/durableSession/docs.d.mts +17 -0
- package/dist/src/services/durableSession/docs.d.mts.map +1 -0
- package/dist/src/services/durableSession/docs.mjs +60 -0
- package/dist/src/services/durableSession/docs.mjs.map +1 -0
- package/dist/src/services/durableSession/index.cjs +21 -0
- package/dist/src/services/durableSession/index.cjs.map +1 -0
- package/dist/src/services/durableSession/index.d.mts +13 -0
- package/dist/src/services/durableSession/index.d.mts.map +1 -0
- package/dist/src/services/durableSession/index.mjs +20 -0
- package/dist/src/services/durableSession/index.mjs.map +1 -0
- package/dist/src/services/durableSubagents/docs.cjs +15 -0
- package/dist/src/services/durableSubagents/docs.cjs.map +1 -0
- package/dist/src/services/durableSubagents/docs.mjs +16 -0
- package/dist/src/services/durableSubagents/docs.mjs.map +1 -0
- package/dist/src/services/durableSubagents/extension.cjs +11 -0
- package/dist/src/services/durableSubagents/extension.cjs.map +1 -0
- package/dist/src/services/durableSubagents/extension.mjs +12 -0
- package/dist/src/services/durableSubagents/extension.mjs.map +1 -0
- package/dist/src/services/durableSubagents/index.cjs +95 -0
- package/dist/src/services/durableSubagents/index.cjs.map +1 -0
- package/dist/src/services/durableSubagents/index.mjs +90 -0
- package/dist/src/services/durableSubagents/index.mjs.map +1 -0
- package/dist/src/services/durableSubagents/tasks.cjs +25 -0
- package/dist/src/services/durableSubagents/tasks.cjs.map +1 -0
- package/dist/src/services/durableSubagents/tasks.mjs +26 -0
- package/dist/src/services/durableSubagents/tasks.mjs.map +1 -0
- package/dist/src/services/headlessClient/index.cjs +20 -13
- package/dist/src/services/headlessClient/index.cjs.map +1 -1
- package/dist/src/services/headlessClient/index.mjs +21 -14
- package/dist/src/services/headlessClient/index.mjs.map +1 -1
- package/dist/src/services/historyOwnership/type.d.mts +15 -0
- package/dist/src/services/historyOwnership/type.d.mts.map +1 -0
- package/dist/src/services/hubChannelHarness/index.cjs +2 -2
- package/dist/src/services/hubChannelHarness/index.cjs.map +1 -1
- package/dist/src/services/hubChannelHarness/index.d.mts +8 -8
- package/dist/src/services/hubChannelHarness/index.d.mts.map +1 -1
- package/dist/src/services/hubChannelHarness/index.mjs +2 -2
- package/dist/src/services/hubChannelHarness/index.mjs.map +1 -1
- package/dist/src/services/json/core.cjs +30 -0
- package/dist/src/services/json/core.cjs.map +1 -0
- package/dist/src/services/json/core.d.mts +21 -0
- package/dist/src/services/json/core.d.mts.map +1 -0
- package/dist/src/services/json/core.mjs +26 -0
- package/dist/src/services/json/core.mjs.map +1 -0
- package/dist/src/services/json/sync.cjs +48 -0
- package/dist/src/services/json/sync.cjs.map +1 -0
- package/dist/src/services/json/sync.d.mts +22 -0
- package/dist/src/services/json/sync.d.mts.map +1 -0
- package/dist/src/services/json/sync.mjs +43 -0
- package/dist/src/services/json/sync.mjs.map +1 -0
- package/dist/src/services/kernel/index.cjs +2 -2
- package/dist/src/services/kernel/index.cjs.map +1 -1
- package/dist/src/services/kernel/index.d.mts +3 -3
- package/dist/src/services/kernel/index.d.mts.map +1 -1
- package/dist/src/services/kernel/index.mjs +2 -2
- package/dist/src/services/kernel/index.mjs.map +1 -1
- package/dist/src/services/nativeChildTools/index.cjs +16 -0
- package/dist/src/services/nativeChildTools/index.cjs.map +1 -0
- package/dist/src/services/nativeChildTools/index.mjs +16 -0
- package/dist/src/services/nativeChildTools/index.mjs.map +1 -0
- package/dist/src/services/nodeHost/index.cjs +30 -0
- package/dist/src/services/nodeHost/index.cjs.map +1 -0
- package/dist/src/services/nodeHost/index.d.mts +16 -0
- package/dist/src/services/nodeHost/index.d.mts.map +1 -0
- package/dist/src/services/nodeHost/index.mjs +27 -0
- package/dist/src/services/nodeHost/index.mjs.map +1 -0
- package/dist/src/services/nodeModelDependencies/index.cjs +89 -0
- package/dist/src/services/nodeModelDependencies/index.cjs.map +1 -0
- package/dist/src/services/nodeModelDependencies/index.mjs +86 -0
- package/dist/src/services/nodeModelDependencies/index.mjs.map +1 -0
- package/dist/src/services/openSessionRegistry/index.cjs +6 -128
- package/dist/src/services/openSessionRegistry/index.cjs.map +1 -1
- package/dist/src/services/openSessionRegistry/index.d.mts +5 -36
- package/dist/src/services/openSessionRegistry/index.mjs +6 -128
- package/dist/src/services/openSessionRegistry/index.mjs.map +1 -1
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs +87 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs.map +1 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts +30 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts.map +1 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs +81 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.cjs +71 -0
- package/dist/src/services/openSessionRegistry/sync.cjs.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.d.mts +14 -0
- package/dist/src/services/openSessionRegistry/sync.d.mts.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.mjs +68 -0
- package/dist/src/services/openSessionRegistry/sync.mjs.map +1 -0
- package/dist/src/services/packageApiHarness/index.cjs +1 -1
- package/dist/src/services/packageApiHarness/index.cjs.map +1 -1
- package/dist/src/services/packageApiHarness/index.d.mts +6 -6
- package/dist/src/services/packageApiHarness/index.d.mts.map +1 -1
- package/dist/src/services/packageApiHarness/index.mjs +2 -2
- package/dist/src/services/packageApiHarness/index.mjs.map +1 -1
- package/dist/src/services/piArgs/index.cjs +53 -0
- package/dist/src/services/piArgs/index.cjs.map +1 -0
- package/dist/src/services/piArgs/index.d.mts +6 -0
- package/dist/src/services/piArgs/index.d.mts.map +1 -0
- package/dist/src/services/piArgs/index.mjs +53 -0
- package/dist/src/services/piArgs/index.mjs.map +1 -0
- package/dist/src/services/piExtensionHost/index.cjs +47 -39
- package/dist/src/services/piExtensionHost/index.cjs.map +1 -1
- package/dist/src/services/piExtensionHost/index.d.mts +83 -0
- package/dist/src/services/piExtensionHost/index.d.mts.map +1 -0
- package/dist/src/services/piExtensionHost/index.mjs +47 -38
- package/dist/src/services/piExtensionHost/index.mjs.map +1 -1
- package/dist/src/services/piHelpTools/index.cjs +5 -5
- package/dist/src/services/piHelpTools/index.cjs.map +1 -1
- package/dist/src/services/piHelpTools/index.d.mts.map +1 -1
- package/dist/src/services/piHelpTools/index.mjs +7 -7
- package/dist/src/services/piHelpTools/index.mjs.map +1 -1
- package/dist/src/services/piMessages/index.cjs +106 -0
- package/dist/src/services/piMessages/index.cjs.map +1 -0
- package/dist/src/services/piMessages/index.mjs +105 -0
- package/dist/src/services/piMessages/index.mjs.map +1 -0
- package/dist/src/services/piSessionEntries/index.cjs +4 -4
- package/dist/src/services/piSessionEntries/index.cjs.map +1 -1
- package/dist/src/services/piSessionEntries/index.mjs +3 -3
- package/dist/src/services/piSessionEntries/index.mjs.map +1 -1
- package/dist/src/services/piSettings/core.cjs +308 -0
- package/dist/src/services/piSettings/core.cjs.map +1 -0
- package/dist/src/services/piSettings/core.d.mts +102 -0
- package/dist/src/services/piSettings/core.d.mts.map +1 -0
- package/dist/src/services/piSettings/core.mjs +276 -0
- package/dist/src/services/piSettings/core.mjs.map +1 -0
- package/dist/src/services/piSettings/sync.cjs +119 -0
- package/dist/src/services/piSettings/sync.cjs.map +1 -0
- package/dist/src/services/piSettings/sync.d.mts +44 -0
- package/dist/src/services/piSettings/sync.d.mts.map +1 -0
- package/dist/src/services/piSettings/sync.mjs +110 -0
- package/dist/src/services/piSettings/sync.mjs.map +1 -0
- package/dist/src/services/piSummary/index.cjs +7 -0
- package/dist/src/services/piSummary/index.cjs.map +1 -0
- package/dist/src/services/piSummary/index.mjs +7 -0
- package/dist/src/services/piSummary/index.mjs.map +1 -0
- package/dist/src/services/platformFiles/index.cjs +44 -0
- package/dist/src/services/platformFiles/index.cjs.map +1 -0
- package/dist/src/services/platformFiles/index.d.mts +16 -0
- package/dist/src/services/platformFiles/index.d.mts.map +1 -0
- package/dist/src/services/platformFiles/index.mjs +39 -0
- package/dist/src/services/platformFiles/index.mjs.map +1 -0
- package/dist/src/services/pluginLifecycle/index.cjs +19 -13
- package/dist/src/services/pluginLifecycle/index.cjs.map +1 -1
- package/dist/src/services/pluginLifecycle/index.d.mts +2 -0
- package/dist/src/services/pluginLifecycle/index.d.mts.map +1 -1
- package/dist/src/services/pluginLifecycle/index.mjs +19 -14
- package/dist/src/services/pluginLifecycle/index.mjs.map +1 -1
- package/dist/src/services/poPackage/core.cjs +73 -0
- package/dist/src/services/poPackage/core.cjs.map +1 -0
- package/dist/src/services/poPackage/core.d.mts +32 -0
- package/dist/src/services/poPackage/core.d.mts.map +1 -0
- package/dist/src/services/poPackage/core.mjs +66 -0
- package/dist/src/services/poPackage/core.mjs.map +1 -0
- package/dist/src/services/poPackage/sync.cjs +55 -0
- package/dist/src/services/poPackage/sync.cjs.map +1 -0
- package/dist/src/services/poPackage/sync.d.mts +21 -0
- package/dist/src/services/poPackage/sync.d.mts.map +1 -0
- package/dist/src/services/poPackage/sync.mjs +50 -0
- package/dist/src/services/poPackage/sync.mjs.map +1 -0
- package/dist/src/services/providerAuth/index.cjs +11 -7
- package/dist/src/services/providerAuth/index.cjs.map +1 -1
- package/dist/src/services/providerAuth/index.mjs +11 -7
- package/dist/src/services/providerAuth/index.mjs.map +1 -1
- package/dist/src/services/publicFileShares/index.cjs +1 -1
- package/dist/src/services/publicFileShares/index.cjs.map +1 -1
- package/dist/src/services/publicFileShares/index.d.mts +2 -2
- package/dist/src/services/publicFileShares/index.mjs +2 -2
- package/dist/src/services/publicFileShares/index.mjs.map +1 -1
- package/dist/src/services/remoteAccess/index.d.mts +1 -0
- package/dist/src/services/remoteAccess/index.d.mts.map +1 -1
- package/dist/src/services/remoteAccessStore/index.cjs +8 -190
- package/dist/src/services/remoteAccessStore/index.cjs.map +1 -1
- package/dist/src/services/remoteAccessStore/index.d.mts +2 -0
- package/dist/src/services/remoteAccessStore/index.mjs +7 -187
- package/dist/src/services/remoteAccessStore/index.mjs.map +1 -1
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs +98 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs.map +1 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs +88 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs.map +1 -0
- package/dist/src/services/remoteAccessStore/sync.cjs +111 -0
- package/dist/src/services/remoteAccessStore/sync.cjs.map +1 -0
- package/dist/src/services/remoteAccessStore/sync.mjs +108 -0
- package/dist/src/services/remoteAccessStore/sync.mjs.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.cjs +23 -0
- package/dist/src/services/runtimeIdentity/sync.cjs.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.d.mts +9 -0
- package/dist/src/services/runtimeIdentity/sync.d.mts.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.mjs +20 -0
- package/dist/src/services/runtimeIdentity/sync.mjs.map +1 -0
- package/dist/src/services/serialRunner/index.cjs +25 -0
- package/dist/src/services/serialRunner/index.cjs.map +1 -0
- package/dist/src/services/serialRunner/index.d.mts +10 -0
- package/dist/src/services/serialRunner/index.d.mts.map +1 -0
- package/dist/src/services/serialRunner/index.mjs +25 -0
- package/dist/src/services/serialRunner/index.mjs.map +1 -0
- package/dist/src/services/{serverFacet → serverHost}/index.cjs +5 -5
- package/dist/src/services/serverHost/index.cjs.map +1 -0
- package/dist/src/services/serverHost/index.d.mts +31 -0
- package/dist/src/services/serverHost/index.d.mts.map +1 -0
- package/dist/src/services/{serverFacet → serverHost}/index.mjs +5 -5
- package/dist/src/services/serverHost/index.mjs.map +1 -0
- package/dist/src/services/sessionAttachments/index.cjs +4 -3
- package/dist/src/services/sessionAttachments/index.cjs.map +1 -1
- package/dist/src/services/sessionAttachments/index.d.mts +1 -6
- package/dist/src/services/sessionAttachments/index.d.mts.map +1 -1
- package/dist/src/services/sessionAttachments/index.mjs +3 -2
- package/dist/src/services/sessionAttachments/index.mjs.map +1 -1
- package/dist/src/services/sessionAttachments/type.d.mts +9 -0
- package/dist/src/services/sessionAttachments/type.d.mts.map +1 -0
- package/dist/src/services/sessionFiles/index.cjs +96 -0
- package/dist/src/services/sessionFiles/index.cjs.map +1 -0
- package/dist/src/services/sessionFiles/index.d.mts +33 -0
- package/dist/src/services/sessionFiles/index.d.mts.map +1 -0
- package/dist/src/services/sessionFiles/index.mjs +89 -0
- package/dist/src/services/sessionFiles/index.mjs.map +1 -0
- package/dist/src/services/sessionFiles/sessionDirectory.cjs +66 -0
- package/dist/src/services/sessionFiles/sessionDirectory.cjs.map +1 -0
- package/dist/src/services/sessionFiles/sessionDirectory.mjs +62 -0
- package/dist/src/services/sessionFiles/sessionDirectory.mjs.map +1 -0
- package/dist/src/services/sessionGitStatus/index.cjs +31 -33
- package/dist/src/services/sessionGitStatus/index.cjs.map +1 -1
- package/dist/src/services/sessionGitStatus/index.mjs +31 -33
- package/dist/src/services/sessionGitStatus/index.mjs.map +1 -1
- package/dist/src/services/sessionPresentation/index.cjs +3 -27
- package/dist/src/services/sessionPresentation/index.cjs.map +1 -1
- package/dist/src/services/sessionPresentation/index.mjs +3 -27
- package/dist/src/services/sessionPresentation/index.mjs.map +1 -1
- package/dist/src/services/skillPrompt/index.cjs +11 -0
- package/dist/src/services/skillPrompt/index.cjs.map +1 -0
- package/dist/src/services/skillPrompt/index.mjs +11 -0
- package/dist/src/services/skillPrompt/index.mjs.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.cjs +44 -30
- package/dist/src/services/sqliteSessionHistory/index.cjs.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.d.mts +7 -4
- package/dist/src/services/sqliteSessionHistory/index.d.mts.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.mjs +43 -28
- package/dist/src/services/sqliteSessionHistory/index.mjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.cjs +21 -45
- package/dist/src/services/sqliteTranscriptReader/index.cjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.d.mts +3 -2
- package/dist/src/services/sqliteTranscriptReader/index.d.mts.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.mjs +16 -38
- package/dist/src/services/sqliteTranscriptReader/index.mjs.map +1 -1
- package/dist/src/services/testMode/index.cjs +162 -0
- package/dist/src/services/testMode/index.cjs.map +1 -0
- package/dist/src/services/testMode/index.d.mts +17 -0
- package/dist/src/services/testMode/index.d.mts.map +1 -0
- package/dist/src/services/testMode/index.mjs +155 -0
- package/dist/src/services/testMode/index.mjs.map +1 -0
- package/dist/src/services/toolOverrides/index.cjs +6 -6
- package/dist/src/services/toolOverrides/index.cjs.map +1 -1
- package/dist/src/services/toolOverrides/index.d.mts +3 -3
- package/dist/src/services/toolOverrides/index.d.mts.map +1 -1
- package/dist/src/services/toolOverrides/index.mjs +6 -6
- package/dist/src/services/toolOverrides/index.mjs.map +1 -1
- package/dist/src/services/toolPrompt/index.d.mts +17 -0
- package/dist/src/services/toolPrompt/index.d.mts.map +1 -0
- package/dist/src/services/toolSurface/index.cjs +3 -3
- package/dist/src/services/toolSurface/index.cjs.map +1 -1
- package/dist/src/services/toolSurface/index.d.mts +3 -3
- package/dist/src/services/toolSurface/index.d.mts.map +1 -1
- package/dist/src/services/toolSurface/index.mjs +4 -4
- package/dist/src/services/toolSurface/index.mjs.map +1 -1
- package/dist/src/services/traceContext/index.cjs.map +1 -1
- package/dist/src/services/traceContext/index.mjs.map +1 -1
- package/dist/src/services/transcriptPages/index.cjs +159 -33
- package/dist/src/services/transcriptPages/index.cjs.map +1 -1
- package/dist/src/services/transcriptPages/index.mjs +158 -34
- package/dist/src/services/transcriptPages/index.mjs.map +1 -1
- package/dist/src/services/voiceToolsContract/index.cjs +7 -7
- package/dist/src/services/voiceToolsContract/index.cjs.map +1 -1
- package/dist/src/services/voiceToolsContract/index.d.mts +4 -4
- package/dist/src/services/voiceToolsContract/index.d.mts.map +1 -1
- package/dist/src/services/voiceToolsContract/index.mjs +7 -7
- package/dist/src/services/voiceToolsContract/index.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/index.cjs +9 -179
- package/dist/src/services/workspaceRegistry/index.cjs.map +1 -1
- package/dist/src/services/workspaceRegistry/index.d.mts +5 -47
- package/dist/src/services/workspaceRegistry/index.mjs +7 -176
- package/dist/src/services/workspaceRegistry/index.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/sync.cjs +148 -0
- package/dist/src/services/workspaceRegistry/sync.cjs.map +1 -0
- package/dist/src/services/workspaceRegistry/sync.d.mts +34 -0
- package/dist/src/services/workspaceRegistry/sync.d.mts.map +1 -0
- package/dist/src/services/workspaceRegistry/sync.mjs +140 -0
- package/dist/src/services/workspaceRegistry/sync.mjs.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs +114 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts +31 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs +101 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs +339 -202
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts +16 -21
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs +329 -191
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs.map +1 -1
- package/dist/src/systems/child/services/childSession/index.cjs +94 -20
- package/dist/src/systems/child/services/childSession/index.cjs.map +1 -1
- package/dist/src/systems/child/services/childSession/index.d.mts +12 -3
- package/dist/src/systems/child/services/childSession/index.d.mts.map +1 -1
- package/dist/src/systems/child/services/childSession/index.mjs +94 -20
- package/dist/src/systems/child/services/childSession/index.mjs.map +1 -1
- package/dist/src/systems/child/types/childSession.cjs +33 -13
- package/dist/src/systems/child/types/childSession.cjs.map +1 -1
- package/dist/src/systems/child/types/childSession.d.mts +143 -80
- package/dist/src/systems/child/types/childSession.d.mts.map +1 -1
- package/dist/src/systems/child/types/childSession.mjs +24 -9
- package/dist/src/systems/child/types/childSession.mjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.cjs +30 -27
- package/dist/src/systems/main/adapters/headlessHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.d.mts +22 -22
- package/dist/src/systems/main/adapters/headlessHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.mjs +33 -30
- package/dist/src/systems/main/adapters/headlessHost.mjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs +248 -229
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts +4 -5
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs +239 -219
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs.map +1 -1
- package/dist/src/systems/main/types/headlessHost.d.mts +16 -14
- package/dist/src/systems/main/types/headlessHost.d.mts.map +1 -1
- package/dist/src/testing/pi/testHost.cjs +2 -2
- package/dist/src/testing/pi/testHost.cjs.map +1 -1
- package/dist/src/testing/pi/testHost.d.mts +3 -2
- package/dist/src/testing/pi/testHost.mjs +3 -3
- package/dist/src/testing/pi/testHost.mjs.map +1 -1
- package/dist/src/types/config.d.mts +1 -1
- package/dist/src/types/config.d.mts.map +1 -1
- package/dist/src/types/kernel.d.mts +3 -3
- package/dist/src/types/server/directHarnessRuntime.d.mts +54 -25
- package/dist/src/types/server/directHarnessRuntime.d.mts.map +1 -1
- package/dist/src/types/server/sessionToolSurface.d.mts +9 -9
- package/dist/src/web/services/apiClient/index.d.mts +1 -0
- package/dist/src/web/services/apiPaths/index.cjs.map +1 -1
- package/dist/src/web/services/apiPaths/index.d.mts +1 -1
- package/dist/src/web/services/apiPaths/index.mjs.map +1 -1
- package/dist/src/web/services/mcpWidget.cjs.map +1 -1
- package/dist/src/web/services/mcpWidget.d.mts +2 -2
- package/dist/src/web/services/mcpWidget.d.mts.map +1 -1
- package/dist/src/web/services/mcpWidget.mjs.map +1 -1
- package/dist/src/web/services/testing/templateRail.cjs +3 -0
- package/dist/src/web/services/testing/templateRail.cjs.map +1 -1
- package/dist/src/web/services/testing/templateRail.mjs +3 -0
- package/dist/src/web/services/testing/templateRail.mjs.map +1 -1
- package/dist/src/web/types/mcpWidget.d.mts +1 -1
- package/dist/src/web/types/nativeTemplate.d.mts +1 -1
- package/dist/src/web/types/nativeTemplate.d.mts.map +1 -1
- package/dist/src/web/types/template.d.mts +8 -0
- package/dist/src/web/types/template.d.mts.map +1 -1
- package/dist/src/web/types/webPlugin.d.mts +17 -5
- package/dist/src/web/types/webPlugin.d.mts.map +1 -1
- package/dist/testMode.cjs +4 -0
- package/dist/testMode.d.mts +2 -0
- package/dist/testMode.mjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +2 -2
- package/dist/toolInventory.cjs.map +1 -1
- package/dist/toolInventory.mjs.map +1 -1
- package/dist/toolNames.mjs +1 -2
- package/dist/toolOverrides.cjs +4 -4
- package/dist/toolOverrides.d.mts +3 -3
- package/dist/toolOverrides.mjs +3 -3
- package/dist/toolSurface.cjs +4 -4
- package/dist/toolSurface.d.mts +3 -3
- package/dist/toolSurface.mjs +3 -3
- package/dist/transition.cjs +3 -3
- package/dist/transition.d.cjs +3 -3
- package/dist/transition.d.mts +2 -2
- package/dist/transition.mjs +1 -2
- package/dist/transitionClassifier.cjs.map +1 -1
- package/dist/transitionClassifier.d.mts +2 -2
- package/dist/transitionClassifier.d.mts.map +1 -1
- package/dist/transitionClassifier.mjs.map +1 -1
- package/dist/transitionCoordinator.cjs +3 -3
- package/dist/transitionCoordinator.cjs.map +1 -1
- package/dist/transitionCoordinator.d.mts +4 -4
- package/dist/transitionCoordinator.d.mts.map +1 -1
- package/dist/transitionCoordinator.mjs +3 -3
- package/dist/transitionCoordinator.mjs.map +1 -1
- package/dist/typesContextApi.d.mts +2 -1
- package/dist/typesContextApi.d.mts.map +1 -1
- package/dist/uiHub.cjs +3 -3
- package/dist/uiHub.d.mts +2 -2
- package/dist/uiHub.mjs +1 -2
- package/dist/voiceTools.cjs +5 -5
- package/dist/voiceTools.d.mts +3 -3
- package/dist/voiceTools.mjs +3 -3
- package/dist/web.cjs +8 -0
- package/dist/web.d.mts +3 -2
- package/dist/web.mjs +2 -1
- package/dist/webCompositions.cjs.map +1 -1
- package/dist/webCompositions.d.mts +7 -7
- package/dist/webCompositions.d.mts.map +1 -1
- package/dist/webCompositions.mjs.map +1 -1
- package/licenses/Codex-Apache-2.0.txt +201 -0
- package/package.json +58 -53
- package/dist/doomPackage.cjs +0 -61
- package/dist/doomPackage.cjs.map +0 -1
- package/dist/doomPackage.d.mts +0 -17
- package/dist/doomPackage.d.mts.map +0 -1
- package/dist/doomPackage.mjs +0 -54
- package/dist/doomPackage.mjs.map +0 -1
- package/dist/jsonlSessionRepo.cjs +0 -44
- package/dist/jsonlSessionRepo.cjs.map +0 -1
- package/dist/jsonlSessionRepo.d.mts +0 -7
- package/dist/jsonlSessionRepo.d.mts.map +0 -1
- package/dist/jsonlSessionRepo.mjs +0 -42
- package/dist/jsonlSessionRepo.mjs.map +0 -1
- package/dist/runtimeJson.cjs.map +0 -1
- package/dist/runtimeJson.d.mts.map +0 -1
- package/dist/runtimeJson.mjs.map +0 -1
- package/dist/runtimePiSettings.cjs.map +0 -1
- package/dist/runtimePiSettings.d.mts.map +0 -1
- package/dist/runtimePiSettings.mjs.map +0 -1
- package/dist/serverFacet.cjs +0 -34
- package/dist/serverFacet.d.mts +0 -10
- package/dist/serverFacet.mjs +0 -9
- package/dist/src/pi/piWebSocketListener.cjs +0 -115
- package/dist/src/pi/piWebSocketListener.cjs.map +0 -1
- package/dist/src/pi/piWebSocketListener.mjs +0 -115
- package/dist/src/pi/piWebSocketListener.mjs.map +0 -1
- package/dist/src/schemas/serverFacet.cjs +0 -111
- package/dist/src/schemas/serverFacet.cjs.map +0 -1
- package/dist/src/schemas/serverFacet.d.mts +0 -152
- package/dist/src/schemas/serverFacet.d.mts.map +0 -1
- package/dist/src/schemas/serverFacet.mjs +0 -101
- package/dist/src/schemas/serverFacet.mjs.map +0 -1
- package/dist/src/schemas/sessionUpdates.d.mts +0 -34
- package/dist/src/schemas/sessionUpdates.d.mts.map +0 -1
- package/dist/src/server/headlessProtocol.cjs +0 -382
- package/dist/src/server/headlessProtocol.cjs.map +0 -1
- package/dist/src/server/headlessProtocol.mjs +0 -382
- package/dist/src/server/headlessProtocol.mjs.map +0 -1
- package/dist/src/server/nativeChildTranscriptReader.cjs +0 -20
- package/dist/src/server/nativeChildTranscriptReader.cjs.map +0 -1
- package/dist/src/server/nativeChildTranscriptReader.mjs +0 -18
- package/dist/src/server/nativeChildTranscriptReader.mjs.map +0 -1
- package/dist/src/server/serverFacetLoader.cjs +0 -214
- package/dist/src/server/serverFacetLoader.cjs.map +0 -1
- package/dist/src/server/serverFacetLoader.d.mts +0 -72
- package/dist/src/server/serverFacetLoader.d.mts.map +0 -1
- package/dist/src/server/serverFacetLoader.mjs +0 -212
- package/dist/src/server/serverFacetLoader.mjs.map +0 -1
- package/dist/src/services/acpSessionUpdates/index.cjs +0 -129
- package/dist/src/services/acpSessionUpdates/index.cjs.map +0 -1
- package/dist/src/services/acpSessionUpdates/index.mjs +0 -129
- package/dist/src/services/acpSessionUpdates/index.mjs.map +0 -1
- package/dist/src/services/historyImport/index.cjs +0 -8
- package/dist/src/services/historyImport/index.cjs.map +0 -1
- package/dist/src/services/historyImport/index.d.mts +0 -68
- package/dist/src/services/historyImport/index.d.mts.map +0 -1
- package/dist/src/services/historyImport/index.mjs +0 -8
- package/dist/src/services/historyImport/index.mjs.map +0 -1
- package/dist/src/services/openSessionRegistry/index.d.mts.map +0 -1
- package/dist/src/services/requestReceipts/index.cjs.map +0 -1
- package/dist/src/services/requestReceipts/index.d.mts +0 -11
- package/dist/src/services/requestReceipts/index.d.mts.map +0 -1
- package/dist/src/services/requestReceipts/index.mjs.map +0 -1
- package/dist/src/services/rpcTranscript/index.cjs +0 -633
- package/dist/src/services/rpcTranscript/index.cjs.map +0 -1
- package/dist/src/services/rpcTranscript/index.d.mts +0 -50
- package/dist/src/services/rpcTranscript/index.d.mts.map +0 -1
- package/dist/src/services/rpcTranscript/index.mjs +0 -632
- package/dist/src/services/rpcTranscript/index.mjs.map +0 -1
- package/dist/src/services/serverFacet/index.cjs.map +0 -1
- package/dist/src/services/serverFacet/index.d.mts +0 -31
- package/dist/src/services/serverFacet/index.d.mts.map +0 -1
- package/dist/src/services/serverFacet/index.mjs.map +0 -1
- package/dist/src/services/workspaceRegistry/index.d.mts.map +0 -1
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs +0 -28
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs.map +0 -1
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs +0 -25
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs.map +0 -1
- package/dist/terminalPiChildSessionService.cjs +0 -324
- package/dist/terminalPiChildSessionService.cjs.map +0 -1
- package/dist/terminalPiChildSessionService.d.mts +0 -46
- package/dist/terminalPiChildSessionService.d.mts.map +0 -1
- package/dist/terminalPiChildSessionService.mjs +0 -318
- package/dist/terminalPiChildSessionService.mjs.map +0 -1
- package/dist/v3Export.cjs +0 -10
- package/dist/v3Export.cjs.map +0 -1
- package/dist/v3Export.d.mts +0 -35
- package/dist/v3Export.d.mts.map +0 -1
- package/dist/v3Export.mjs +0 -9
- package/dist/v3Export.mjs.map +0 -1
|
@@ -24,8 +24,8 @@ function generationDiagnostic(expected, current) {
|
|
|
24
24
|
if (expected.hostGeneration !== current.hostGeneration) return STALE_GENERATION_DIAGNOSTIC;
|
|
25
25
|
if (expected.configGeneration !== current.configGeneration) return "transition.stale.config";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const hostGeneration = options.hostGeneration ?? `
|
|
27
|
+
function createPoTransitionCoordinator(options) {
|
|
28
|
+
const hostGeneration = options.hostGeneration ?? `po-transition:${crypto.randomUUID()}`;
|
|
29
29
|
const readGeneration = options.generation ?? (() => defaultGeneration(options.sessionId, hostGeneration));
|
|
30
30
|
const operationIds = /* @__PURE__ */ new Set();
|
|
31
31
|
let committedSelection;
|
|
@@ -125,6 +125,6 @@ function createDoomTransitionCoordinator(options) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
|
-
export {
|
|
128
|
+
export { createPoTransitionCoordinator };
|
|
129
129
|
|
|
130
130
|
//# sourceMappingURL=transitionCoordinator.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transitionCoordinator.mjs","names":[],"sources":["../src/services/transitionCoordinator/index.ts"],"sourcesContent":["import type {\n DoomTransitionCoordinator,\n DoomTransitionPlan,\n DoomTransitionRequest,\n DoomTransitionResult,\n StructuralTransitionExecution,\n TransitionDiagnosticCode,\n TransitionGeneration,\n TransitionOutcome,\n} from '../../exports/transition';\nimport { classifyTransition, type TransitionClassifierContext } from '../transitionClassifier';\n\nconst LIVE_AXIS = 'live';\nconst STALE_SESSION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.stale.session';\nconst STALE_GENERATION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.stale.generation';\nconst ABORTED_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.rejected.aborted';\nconst EXECUTION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.rejected.execution';\nconst NO_CHANGE_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.no-change';\n\nexport interface TransitionCoordinatorOptions {\n readonly sessionId: string;\n readonly hostGeneration?: string;\n readonly classifierContext: () => TransitionClassifierContext;\n /** Captures identities that must remain stable while a transition is queued. */\n readonly generation?: () => TransitionGeneration;\n readonly acceptGenerationChange?: (\n before: TransitionGeneration,\n after: TransitionGeneration,\n plan: DoomTransitionPlan,\n ) => boolean;\n readonly executeStructural?: (request: DoomTransitionRequest, plan: DoomTransitionPlan) => Promise<TransitionOutcome>;\n}\n\nfunction result(\n plan: DoomTransitionPlan,\n outcome: TransitionOutcome,\n diagnostic?: TransitionDiagnosticCode,\n): DoomTransitionResult {\n return {\n ...plan,\n outcome,\n diagnostics: diagnostic ? [...plan.diagnostics, diagnostic] : plan.diagnostics,\n };\n}\n\nfunction defaultGeneration(sessionId: string, hostGeneration: string): TransitionGeneration {\n return { sessionId, hostGeneration };\n}\n\nfunction generationDiagnostic(\n expected: TransitionGeneration,\n current: TransitionGeneration,\n): TransitionDiagnosticCode | undefined {\n if (expected.sessionId !== current.sessionId) return STALE_SESSION_DIAGNOSTIC;\n if (expected.hostGeneration !== current.hostGeneration) return STALE_GENERATION_DIAGNOSTIC;\n if (expected.configGeneration !== current.configGeneration) return 'transition.stale.config';\n return undefined;\n}\n\nexport function createDoomTransitionCoordinator(options: TransitionCoordinatorOptions): DoomTransitionCoordinator {\n const hostGeneration = options.hostGeneration ?? `doom-transition:${crypto.randomUUID()}`;\n const readGeneration = options.generation ?? (() => defaultGeneration(options.sessionId, hostGeneration));\n const operationIds = new Set<string>();\n let committedSelection: DoomTransitionPlan['candidate'] | undefined;\n let structuralTail: Promise<void> = Promise.resolve();\n let structuralPending = 0;\n let disposed = false;\n\n const plan = (request: DoomTransitionRequest): DoomTransitionPlan => {\n const context = options.classifierContext();\n const current = {\n ...(committedSelection ?? context.current),\n };\n return classifyTransition(request, { ...context, current });\n };\n\n const requestDiagnostic = (request: DoomTransitionRequest): TransitionDiagnosticCode | undefined => {\n if (request.sessionId !== options.sessionId) return STALE_SESSION_DIAGNOSTIC;\n if (request.hostGeneration !== hostGeneration) return STALE_GENERATION_DIAGNOSTIC;\n if (disposed || request.signal?.aborted) return ABORTED_DIAGNOSTIC;\n if (request.target.axis !== LIVE_AXIS && operationIds.has(request.operationId)) {\n return 'transition.rejected.duplicate';\n }\n return undefined;\n };\n\n const executeLive = async (\n request: DoomTransitionRequest,\n transitionPlan: DoomTransitionPlan,\n execution: StructuralTransitionExecution | undefined,\n expectedGeneration: TransitionGeneration,\n ): Promise<DoomTransitionResult> => {\n if (request.target.axis !== LIVE_AXIS) {\n return result(transitionPlan, 'rejected', EXECUTION_DIAGNOSTIC);\n }\n if (!execution) return result(transitionPlan, 'rejected', 'transition.rejected.unavailable');\n const before = generationDiagnostic(expectedGeneration, readGeneration());\n if (before) return result(transitionPlan, 'stale', before);\n try {\n {\n const outcome = await execution(request, transitionPlan);\n const currentGeneration = readGeneration();\n const after = generationDiagnostic(expectedGeneration, currentGeneration);\n if (after && !options.acceptGenerationChange?.(expectedGeneration, currentGeneration, transitionPlan)) {\n return result(transitionPlan, 'stale', after);\n }\n return result(transitionPlan, outcome);\n }\n } catch {\n return result(transitionPlan, 'rejected', EXECUTION_DIAGNOSTIC);\n }\n };\n\n const executeStructural = async (\n request: DoomTransitionRequest,\n transitionPlan: DoomTransitionPlan,\n execution: StructuralTransitionExecution | undefined,\n expectedGeneration: TransitionGeneration,\n ): Promise<DoomTransitionResult> => {\n if (disposed || request.signal?.aborted) {\n return result(transitionPlan, 'rejected', ABORTED_DIAGNOSTIC);\n }\n const stale = generationDiagnostic(expectedGeneration, readGeneration());\n if (stale) return result(transitionPlan, 'stale', stale);\n if (transitionPlan.disposition === 'sync-required') {\n return result(transitionPlan, 'rejected');\n }\n const selectedExecution = execution ?? options.executeStructural;\n if (!selectedExecution) {\n const outcome = transitionPlan.disposition === 'live' ? 'applied' : 'queued';\n if (outcome === 'applied') committedSelection = transitionPlan.candidate;\n return result(transitionPlan, outcome);\n }\n const outcome = await selectedExecution(request, transitionPlan);\n const currentGeneration = readGeneration();\n const after = generationDiagnostic(expectedGeneration, currentGeneration);\n if (after && !options.acceptGenerationChange?.(expectedGeneration, currentGeneration, transitionPlan)) {\n return result(transitionPlan, 'stale', after);\n }\n if (outcome === 'applied') committedSelection = transitionPlan.candidate;\n return result(transitionPlan, outcome);\n };\n\n return {\n sessionId: options.sessionId,\n hostGeneration,\n plan,\n async execute(request, execution) {\n const admission = requestDiagnostic(request);\n if (admission) {\n const outcome = admission.startsWith('transition.rejected.') ? 'rejected' : 'stale';\n return result(plan(request), outcome, admission);\n }\n const expectedGeneration = readGeneration();\n if (expectedGeneration.sessionId !== options.sessionId) {\n return result(plan(request), 'stale', STALE_SESSION_DIAGNOSTIC);\n }\n if (expectedGeneration.hostGeneration !== hostGeneration) {\n return result(plan(request), 'stale', STALE_GENERATION_DIAGNOSTIC);\n }\n if (request.target.axis !== LIVE_AXIS) operationIds.add(request.operationId);\n\n if (request.target.axis === LIVE_AXIS) {\n const transitionPlan = plan(request);\n if (transitionPlan.diagnostics.includes(NO_CHANGE_DIAGNOSTIC)) return result(transitionPlan, 'unchanged');\n return executeLive(request, transitionPlan, execution, expectedGeneration);\n }\n\n structuralPending += 1;\n const queued = structuralTail.then(async () => {\n const transitionPlan = plan(request);\n const stale = generationDiagnostic(expectedGeneration, readGeneration());\n if (stale) return result(transitionPlan, 'stale', stale);\n if (transitionPlan.diagnostics.includes(NO_CHANGE_DIAGNOSTIC)) return result(transitionPlan, 'unchanged');\n return executeStructural(request, transitionPlan, execution, expectedGeneration);\n });\n structuralTail = queued.then(\n () => undefined,\n () => undefined,\n );\n try {\n return await queued;\n } finally {\n structuralPending -= 1;\n }\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n committedSelection = undefined;\n operationIds.clear();\n if (structuralPending === 0) structuralTail = Promise.resolve();\n },\n };\n}\n"],"mappings":";;AAYA,MAAM,YAAY;AAClB,MAAM,2BAAqD;AAC3D,MAAM,8BAAwD;AAC9D,MAAM,qBAA+C;AACrD,MAAM,uBAAiD;AACvD,MAAM,uBAAiD;AAgBvD,SAAS,OACP,MACA,SACA,YACsB;CACtB,OAAO;EACL,GAAG;EACH;EACA,aAAa,aAAa,CAAC,GAAG,KAAK,aAAa,UAAU,IAAI,KAAK;CACrE;AACF;AAEA,SAAS,kBAAkB,WAAmB,gBAA8C;CAC1F,OAAO;EAAE;EAAW;CAAe;AACrC;AAEA,SAAS,qBACP,UACA,SACsC;CACtC,IAAI,SAAS,cAAc,QAAQ,WAAW,OAAO;CACrD,IAAI,SAAS,mBAAmB,QAAQ,gBAAgB,OAAO;CAC/D,IAAI,SAAS,qBAAqB,QAAQ,kBAAkB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AK,OAAO,GAAG,SAAS,2BAA2B;GAEnE,IAAI,QAAQ,OAAO,SAAS,WAAW,aAAa,IAAI,QAAQ,WAAW;GAE3E,IAAI,QAAQ,OAAO,SAAS,WAAW;IACrC,MAAM,iBAAiB,KAAK,OAAO;IACnC,IAAI,eAAe,YAAY,SAAS,oBAAoB,GAAG,OAAO,OAAO,gBAAgB,WAAW;IACxG,OAAO,YAAY,SAAS,gBAAgB,WAAW,kBAAkB;GAC3E;GAEA,qBAAqB;GACrB,MAAM,SAAS,eAAe,KAAK,YAAY;IAC7C,MAAM,iBAAiB,KAAK,OAAO;IACnC,MAAM,QAAQ,qBAAqB,oBAAoB,eAAe,CAAC;IACvE,IAAI,OAAO,OAAO,OAAO,gBAAgB,SAAS,KAAK;IACvD,IAAI,eAAe,YAAY,SAAS,oBAAoB,GAAG,OAAO,OAAO,gBAAgB,WAAW;IACxG,OAAO,kBAAkB,SAAS,gBAAgB,WAAW,kBAAkB;GACjF,CAAC;GACD,iBAAiB,OAAO,WAChB,KAAA,SACA,KAAA,CACR;GACA,IAAI;IACF,OAAO,MAAM;GACf,UAAU;IACR,qBAAqB;GACvB;EACF;EACA,UAAU;GACR,IAAI,UAAU;GACd,WAAW;GACX,qBAAqB,KAAA;GACrB,aAAa,MAAM;GACnB,IAAI,sBAAsB,GAAG,iBAAiB,QAAQ,QAAQ;EAChE;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"transitionCoordinator.mjs","names":[],"sources":["../src/services/transitionCoordinator/index.ts"],"sourcesContent":["import type {\n PoTransitionCoordinator,\n PoTransitionPlan,\n PoTransitionRequest,\n PoTransitionResult,\n StructuralTransitionExecution,\n TransitionDiagnosticCode,\n TransitionGeneration,\n TransitionOutcome,\n} from '../../exports/transition';\nimport { classifyTransition, type TransitionClassifierContext } from '../transitionClassifier';\n\nconst LIVE_AXIS = 'live';\nconst STALE_SESSION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.stale.session';\nconst STALE_GENERATION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.stale.generation';\nconst ABORTED_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.rejected.aborted';\nconst EXECUTION_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.rejected.execution';\nconst NO_CHANGE_DIAGNOSTIC: TransitionDiagnosticCode = 'transition.no-change';\n\nexport interface TransitionCoordinatorOptions {\n readonly sessionId: string;\n readonly hostGeneration?: string;\n readonly classifierContext: () => TransitionClassifierContext;\n /** Captures identities that must remain stable while a transition is queued. */\n readonly generation?: () => TransitionGeneration;\n readonly acceptGenerationChange?: (\n before: TransitionGeneration,\n after: TransitionGeneration,\n plan: PoTransitionPlan,\n ) => boolean;\n readonly executeStructural?: (request: PoTransitionRequest, plan: PoTransitionPlan) => Promise<TransitionOutcome>;\n}\n\nfunction result(\n plan: PoTransitionPlan,\n outcome: TransitionOutcome,\n diagnostic?: TransitionDiagnosticCode,\n): PoTransitionResult {\n return {\n ...plan,\n outcome,\n diagnostics: diagnostic ? [...plan.diagnostics, diagnostic] : plan.diagnostics,\n };\n}\n\nfunction defaultGeneration(sessionId: string, hostGeneration: string): TransitionGeneration {\n return { sessionId, hostGeneration };\n}\n\nfunction generationDiagnostic(\n expected: TransitionGeneration,\n current: TransitionGeneration,\n): TransitionDiagnosticCode | undefined {\n if (expected.sessionId !== current.sessionId) return STALE_SESSION_DIAGNOSTIC;\n if (expected.hostGeneration !== current.hostGeneration) return STALE_GENERATION_DIAGNOSTIC;\n if (expected.configGeneration !== current.configGeneration) return 'transition.stale.config';\n return undefined;\n}\n\nexport function createPoTransitionCoordinator(options: TransitionCoordinatorOptions): PoTransitionCoordinator {\n const hostGeneration = options.hostGeneration ?? `po-transition:${crypto.randomUUID()}`;\n const readGeneration = options.generation ?? (() => defaultGeneration(options.sessionId, hostGeneration));\n const operationIds = new Set<string>();\n let committedSelection: PoTransitionPlan['candidate'] | undefined;\n let structuralTail: Promise<void> = Promise.resolve();\n let structuralPending = 0;\n let disposed = false;\n\n const plan = (request: PoTransitionRequest): PoTransitionPlan => {\n const context = options.classifierContext();\n const current = {\n ...(committedSelection ?? context.current),\n };\n return classifyTransition(request, { ...context, current });\n };\n\n const requestDiagnostic = (request: PoTransitionRequest): TransitionDiagnosticCode | undefined => {\n if (request.sessionId !== options.sessionId) return STALE_SESSION_DIAGNOSTIC;\n if (request.hostGeneration !== hostGeneration) return STALE_GENERATION_DIAGNOSTIC;\n if (disposed || request.signal?.aborted) return ABORTED_DIAGNOSTIC;\n if (request.target.axis !== LIVE_AXIS && operationIds.has(request.operationId)) {\n return 'transition.rejected.duplicate';\n }\n return undefined;\n };\n\n const executeLive = async (\n request: PoTransitionRequest,\n transitionPlan: PoTransitionPlan,\n execution: StructuralTransitionExecution | undefined,\n expectedGeneration: TransitionGeneration,\n ): Promise<PoTransitionResult> => {\n if (request.target.axis !== LIVE_AXIS) {\n return result(transitionPlan, 'rejected', EXECUTION_DIAGNOSTIC);\n }\n if (!execution) return result(transitionPlan, 'rejected', 'transition.rejected.unavailable');\n const before = generationDiagnostic(expectedGeneration, readGeneration());\n if (before) return result(transitionPlan, 'stale', before);\n try {\n {\n const outcome = await execution(request, transitionPlan);\n const currentGeneration = readGeneration();\n const after = generationDiagnostic(expectedGeneration, currentGeneration);\n if (after && !options.acceptGenerationChange?.(expectedGeneration, currentGeneration, transitionPlan)) {\n return result(transitionPlan, 'stale', after);\n }\n return result(transitionPlan, outcome);\n }\n } catch {\n return result(transitionPlan, 'rejected', EXECUTION_DIAGNOSTIC);\n }\n };\n\n const executeStructural = async (\n request: PoTransitionRequest,\n transitionPlan: PoTransitionPlan,\n execution: StructuralTransitionExecution | undefined,\n expectedGeneration: TransitionGeneration,\n ): Promise<PoTransitionResult> => {\n if (disposed || request.signal?.aborted) {\n return result(transitionPlan, 'rejected', ABORTED_DIAGNOSTIC);\n }\n const stale = generationDiagnostic(expectedGeneration, readGeneration());\n if (stale) return result(transitionPlan, 'stale', stale);\n if (transitionPlan.disposition === 'sync-required') {\n return result(transitionPlan, 'rejected');\n }\n const selectedExecution = execution ?? options.executeStructural;\n if (!selectedExecution) {\n const outcome = transitionPlan.disposition === 'live' ? 'applied' : 'queued';\n if (outcome === 'applied') committedSelection = transitionPlan.candidate;\n return result(transitionPlan, outcome);\n }\n const outcome = await selectedExecution(request, transitionPlan);\n const currentGeneration = readGeneration();\n const after = generationDiagnostic(expectedGeneration, currentGeneration);\n if (after && !options.acceptGenerationChange?.(expectedGeneration, currentGeneration, transitionPlan)) {\n return result(transitionPlan, 'stale', after);\n }\n if (outcome === 'applied') committedSelection = transitionPlan.candidate;\n return result(transitionPlan, outcome);\n };\n\n return {\n sessionId: options.sessionId,\n hostGeneration,\n plan,\n async execute(request, execution) {\n const admission = requestDiagnostic(request);\n if (admission) {\n const outcome = admission.startsWith('transition.rejected.') ? 'rejected' : 'stale';\n return result(plan(request), outcome, admission);\n }\n const expectedGeneration = readGeneration();\n if (expectedGeneration.sessionId !== options.sessionId) {\n return result(plan(request), 'stale', STALE_SESSION_DIAGNOSTIC);\n }\n if (expectedGeneration.hostGeneration !== hostGeneration) {\n return result(plan(request), 'stale', STALE_GENERATION_DIAGNOSTIC);\n }\n if (request.target.axis !== LIVE_AXIS) operationIds.add(request.operationId);\n\n if (request.target.axis === LIVE_AXIS) {\n const transitionPlan = plan(request);\n if (transitionPlan.diagnostics.includes(NO_CHANGE_DIAGNOSTIC)) return result(transitionPlan, 'unchanged');\n return executeLive(request, transitionPlan, execution, expectedGeneration);\n }\n\n structuralPending += 1;\n const queued = structuralTail.then(async () => {\n const transitionPlan = plan(request);\n const stale = generationDiagnostic(expectedGeneration, readGeneration());\n if (stale) return result(transitionPlan, 'stale', stale);\n if (transitionPlan.diagnostics.includes(NO_CHANGE_DIAGNOSTIC)) return result(transitionPlan, 'unchanged');\n return executeStructural(request, transitionPlan, execution, expectedGeneration);\n });\n structuralTail = queued.then(\n () => undefined,\n () => undefined,\n );\n try {\n return await queued;\n } finally {\n structuralPending -= 1;\n }\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n committedSelection = undefined;\n operationIds.clear();\n if (structuralPending === 0) structuralTail = Promise.resolve();\n },\n };\n}\n"],"mappings":";;AAYA,MAAM,YAAY;AAClB,MAAM,2BAAqD;AAC3D,MAAM,8BAAwD;AAC9D,MAAM,qBAA+C;AACrD,MAAM,uBAAiD;AACvD,MAAM,uBAAiD;AAgBvD,SAAS,OACP,MACA,SACA,YACoB;CACpB,OAAO;EACL,GAAG;EACH;EACA,aAAa,aAAa,CAAC,GAAG,KAAK,aAAa,UAAU,IAAI,KAAK;CACrE;AACF;AAEA,SAAS,kBAAkB,WAAmB,gBAA8C;CAC1F,OAAO;EAAE;EAAW;CAAe;AACrC;AAEA,SAAS,qBACP,UACA,SACsC;CACtC,IAAI,SAAS,cAAc,QAAQ,WAAW,OAAO;CACrD,IAAI,SAAS,mBAAmB,QAAQ,gBAAgB,OAAO;CAC/D,IAAI,SAAS,qBAAqB,QAAQ,kBAAkB,OAAO;AAErE;AAEA,SAAgB,8BAA8B,SAAgE;CAC5G,MAAM,iBAAiB,QAAQ,kBAAkB,iBAAiB,OAAO,WAAW;CACpF,MAAM,iBAAiB,QAAQ,qBAAqB,kBAAkB,QAAQ,WAAW,cAAc;CACvG,MAAM,+BAAe,IAAI,IAAY;CACrC,IAAI;CACJ,IAAI,iBAAgC,QAAQ,QAAQ;CACpD,IAAI,oBAAoB;CACxB,IAAI,WAAW;CAEf,MAAM,QAAQ,YAAmD;EAC/D,MAAM,UAAU,QAAQ,kBAAkB;EAC1C,MAAM,UAAU,EACd,GAAI,sBAAsB,QAAQ,QACpC;EACA,OAAO,mBAAmB,SAAS;GAAE,GAAG;GAAS;EAAQ,CAAC;CAC5D;CAEA,MAAM,qBAAqB,YAAuE;EAChG,IAAI,QAAQ,cAAc,QAAQ,WAAW,OAAO;EACpD,IAAI,QAAQ,mBAAmB,gBAAgB,OAAO;EACtD,IAAI,YAAY,QAAQ,QAAQ,SAAS,OAAO;EAChD,IAAI,QAAQ,OAAO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ACA,KAAA,CACR;GACA,IAAI;IACF,OAAO,MAAM;GACf,UAAU;IACR,qBAAqB;GACvB;EACF;EACA,UAAU;GACR,IAAI,UAAU;GACd,WAAW;GACX,qBAAqB,KAAA;GACrB,aAAa,MAAM;GACnB,IAAI,sBAAsB,GAAG,iBAAiB,QAAQ,QAAQ;EAChE;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextItemSource } from "./contextProjection.mjs";
|
|
1
|
+
import { ContextItemSource, ContextProjection } from "./contextProjection.mjs";
|
|
2
2
|
//#region src/types/contextApi.d.ts
|
|
3
3
|
export type ContextItemKind = 'tool' | 'skill' | 'prompt';
|
|
4
4
|
/**
|
|
@@ -68,6 +68,7 @@ export interface ContextDetailFile {
|
|
|
68
68
|
/** Matches the projection revision the panel is rendering. */
|
|
69
69
|
readonly revision: number;
|
|
70
70
|
readonly items: readonly ContextItemDetail[];
|
|
71
|
+
readonly projection?: ContextProjection;
|
|
71
72
|
}
|
|
72
73
|
/** A warning origin supplied by the runtime owning a registered tool. */
|
|
73
74
|
export interface ContextToolWarning {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typesContextApi.d.mts","names":[],"sources":["../src/types/contextApi.ts"],"mappings":";;YAEY;;;;;;;;;YAUA;;iBAGK;;WAEN;;WAEA;WACA;;iBAGM;WACN;WACA;WACA;WACA,QAAQ;WACR;WACA,QAAQ;WACR;;WAEA;WACA;;WAEA;;iBAGM;WACN;WACA;WACA;WACA,QAAQ;WACR;;WAEA;WACA;WACA;;WAEA;;WAEA;;;;;;;;;iBAUM;WACN;WACA;WACA;WACA,OAAO;WACP;;YAGC,oBAAoB,oBAAoB,qBAAqB;;iBAGxD;WACN;;WAEA;WACA,gBAAgB;;;
|
|
1
|
+
{"version":3,"file":"typesContextApi.d.mts","names":[],"sources":["../src/types/contextApi.ts"],"mappings":";;YAEY;;;;;;;;;YAUA;;iBAGK;;WAEN;;WAEA;WACA;;iBAGM;WACN;WACA;WACA;WACA,QAAQ;WACR;WACA,QAAQ;WACR;;WAEA;WACA;;WAEA;;iBAGM;WACN;WACA;WACA;WACA,QAAQ;WACR;;WAEA;WACA;WACA;;WAEA;;WAEA;;;;;;;;;iBAUM;WACN;WACA;WACA;WACA,OAAO;WACP;;YAGC,oBAAoB,oBAAoB,qBAAqB;;iBAGxD;WACN;;WAEA;WACA,gBAAgB;WAChB,aAAa;;;iBAIP;EACf;EACA;EACA"}
|
package/dist/uiHub.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_uiHub = require("./src/schemas/uiHub.cjs");
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
3
|
+
exports.PO_UI_HUB_SERVICE = require_uiHub.PO_UI_HUB_SERVICE;
|
|
4
|
+
exports.readPoUiHub = require_uiHub.readPoUiHub;
|
|
5
|
+
exports.requirePoUiHub = require_uiHub.requirePoUiHub;
|
package/dist/uiHub.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { PO_UI_HUB_SERVICE, PoUiHubService, readPoUiHub, requirePoUiHub } from "./src/schemas/uiHub.mjs";
|
|
2
|
+
export { PO_UI_HUB_SERVICE, type PoUiHubService, readPoUiHub, requirePoUiHub };
|
package/dist/uiHub.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { DOOM_UI_HUB_SERVICE, readDoomUiHub, requireDoomUiHub };
|
|
1
|
+
export { PO_UI_HUB_SERVICE, readPoUiHub, requirePoUiHub } from "./src/schemas/uiHub.mjs";
|
package/dist/voiceTools.cjs
CHANGED
|
@@ -2,10 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_voiceTools = require("./src/constants/voiceTools.cjs");
|
|
3
3
|
const require_voiceTools$1 = require("./src/schemas/voiceTools.cjs");
|
|
4
4
|
const require_index = require("./src/services/voiceToolsContract/index.cjs");
|
|
5
|
-
exports.DOOM_VOICE_AUTO_MODE_ID = require_voiceTools.DOOM_VOICE_AUTO_MODE_ID;
|
|
6
|
-
exports.DOOM_VOICE_SOURCE = require_voiceTools.DOOM_VOICE_SOURCE;
|
|
7
|
-
exports.DOOM_VOICE_TOOLS_SERVICE = require_voiceTools.DOOM_VOICE_TOOLS_SERVICE;
|
|
8
5
|
exports.MAX_ORDER = require_voiceTools.MAX_ORDER;
|
|
6
|
+
exports.PO_VOICE_AUTO_MODE_ID = require_voiceTools.PO_VOICE_AUTO_MODE_ID;
|
|
7
|
+
exports.PO_VOICE_SOURCE = require_voiceTools.PO_VOICE_SOURCE;
|
|
8
|
+
exports.PO_VOICE_TOOLS_SERVICE = require_voiceTools.PO_VOICE_TOOLS_SERVICE;
|
|
9
9
|
exports.SAFE_IDENTIFIER = require_voiceTools.SAFE_IDENTIFIER;
|
|
10
10
|
exports.SAFE_NAME = require_voiceTools.SAFE_NAME;
|
|
11
11
|
exports.VOICE_DESCRIBE_TOOL_NAME = require_voiceTools.VOICE_DESCRIBE_TOOL_NAME;
|
|
@@ -52,5 +52,5 @@ exports.VoiceToolError = require_index.VoiceToolError;
|
|
|
52
52
|
exports.VoiceToolErrorCodeSchema = require_voiceTools$1.VoiceToolErrorCodeSchema;
|
|
53
53
|
exports.VoiceToolErrorSchema = require_voiceTools$1.VoiceToolErrorSchema;
|
|
54
54
|
exports.VoiceToolUseInputSchema = require_voiceTools$1.VoiceToolUseInputSchema;
|
|
55
|
-
exports.
|
|
56
|
-
exports.
|
|
55
|
+
exports.readPoVoiceToolsService = require_index.readPoVoiceToolsService;
|
|
56
|
+
exports.requirePoVoiceToolsService = require_index.requirePoVoiceToolsService;
|
package/dist/voiceTools.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { VoiceToolBatchCall, VoiceToolBatchCallSchema, VoiceToolBatchItemResult, VoiceToolBatchItemResultSchema, VoiceToolBatchResult, VoiceToolBatchResultSchema, VoiceToolCatalogEntry, VoiceToolCatalogEntrySchema, VoiceToolCatalogSnapshot, VoiceToolCatalogSnapshotSchema, VoiceToolCatalogToken, VoiceToolCatalogTokenSchema, VoiceToolConflictDiagnostic, VoiceToolConflictDiagnosticSchema, VoiceToolDescribeInput, VoiceToolDescribeInputSchema, VoiceToolDescriptorSchema, VoiceToolErrorCode, VoiceToolErrorCodeSchema, VoiceToolErrorPayload, VoiceToolErrorSchema, VoiceToolUseInput, VoiceToolUseInputSchema } from "./src/schemas/voiceTools.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
2
|
+
import { PoVoiceToolsService, VoiceToolDefinition, VoiceToolDescriptor, VoiceToolError, VoiceToolExecuteOptions, VoiceToolExecutionContext, VoiceToolRegistrationHandle, VoiceToolRegistrationOptions, VoiceToolSessionHandle, readPoVoiceToolsService, requirePoVoiceToolsService } from "./src/services/voiceToolsContract/index.mjs";
|
|
3
|
+
import { MAX_ORDER, PO_VOICE_AUTO_MODE_ID, PO_VOICE_SOURCE, PO_VOICE_TOOLS_SERVICE, SAFE_IDENTIFIER, SAFE_NAME, VOICE_DESCRIBE_TOOL_NAME, VOICE_FACADE_TOOL_NAMES, VOICE_MODE_TOOL_NAMES, VOICE_NARRATE_TOOL_NAME, VOICE_TOOL_ABORTED, VOICE_TOOL_BATCH_STOPPED, VOICE_TOOL_DEFAULT_TIMEOUT_MS, VOICE_TOOL_ERROR_CODE, VOICE_TOOL_EXECUTION_FAILED, VOICE_TOOL_HOST_UNAVAILABLE, VOICE_TOOL_INACTIVE, VOICE_TOOL_INVALID_INPUT, VOICE_TOOL_INVALID_RESULT, VOICE_TOOL_MAX_BATCH_BYTES, VOICE_TOOL_MAX_BATCH_ITEMS, VOICE_TOOL_MAX_DESCRIPTION_LENGTH, VOICE_TOOL_MAX_DOMAIN_COUNT, VOICE_TOOL_MAX_ERROR_MESSAGE_LENGTH, VOICE_TOOL_MAX_IDENTIFIER_LENGTH, VOICE_TOOL_MAX_INPUT_BYTES, VOICE_TOOL_MAX_JSON_DEPTH, VOICE_TOOL_MAX_LABEL_LENGTH, VOICE_TOOL_MAX_SCHEMA_BYTES, VOICE_TOOL_MAX_TIMEOUT_MS, VOICE_TOOL_NAME_CONFLICT, VOICE_TOOL_NOT_FOUND, VOICE_TOOL_STALE_CATALOG, VOICE_TOOL_STALE_SESSION, VOICE_TOOL_TERMINAL_OPERATION_LIMIT, VOICE_TOOL_TIMEOUT, VOICE_USE_TOOL_NAME } from "./src/constants/voiceTools.mjs";
|
|
4
|
+
export { MAX_ORDER, PO_VOICE_AUTO_MODE_ID, PO_VOICE_SOURCE, PO_VOICE_TOOLS_SERVICE, PoVoiceToolsService, SAFE_IDENTIFIER, SAFE_NAME, VOICE_DESCRIBE_TOOL_NAME, VOICE_FACADE_TOOL_NAMES, VOICE_MODE_TOOL_NAMES, VOICE_NARRATE_TOOL_NAME, VOICE_TOOL_ABORTED, VOICE_TOOL_BATCH_STOPPED, VOICE_TOOL_DEFAULT_TIMEOUT_MS, VOICE_TOOL_ERROR_CODE, VOICE_TOOL_EXECUTION_FAILED, VOICE_TOOL_HOST_UNAVAILABLE, VOICE_TOOL_INACTIVE, VOICE_TOOL_INVALID_INPUT, VOICE_TOOL_INVALID_RESULT, VOICE_TOOL_MAX_BATCH_BYTES, VOICE_TOOL_MAX_BATCH_ITEMS, VOICE_TOOL_MAX_DESCRIPTION_LENGTH, VOICE_TOOL_MAX_DOMAIN_COUNT, VOICE_TOOL_MAX_ERROR_MESSAGE_LENGTH, VOICE_TOOL_MAX_IDENTIFIER_LENGTH, VOICE_TOOL_MAX_INPUT_BYTES, VOICE_TOOL_MAX_JSON_DEPTH, VOICE_TOOL_MAX_LABEL_LENGTH, VOICE_TOOL_MAX_SCHEMA_BYTES, VOICE_TOOL_MAX_TIMEOUT_MS, VOICE_TOOL_NAME_CONFLICT, VOICE_TOOL_NOT_FOUND, VOICE_TOOL_STALE_CATALOG, VOICE_TOOL_STALE_SESSION, VOICE_TOOL_TERMINAL_OPERATION_LIMIT, VOICE_TOOL_TIMEOUT, VOICE_USE_TOOL_NAME, VoiceToolBatchCall, VoiceToolBatchCallSchema, VoiceToolBatchItemResult, VoiceToolBatchItemResultSchema, VoiceToolBatchResult, VoiceToolBatchResultSchema, VoiceToolCatalogEntry, VoiceToolCatalogEntrySchema, VoiceToolCatalogSnapshot, VoiceToolCatalogSnapshotSchema, VoiceToolCatalogToken, VoiceToolCatalogTokenSchema, VoiceToolConflictDiagnostic, VoiceToolConflictDiagnosticSchema, VoiceToolDefinition, VoiceToolDescribeInput, VoiceToolDescribeInputSchema, VoiceToolDescriptor, VoiceToolDescriptorSchema, VoiceToolError, VoiceToolErrorCode, VoiceToolErrorCodeSchema, VoiceToolErrorPayload, VoiceToolErrorSchema, VoiceToolExecuteOptions, VoiceToolExecutionContext, VoiceToolRegistrationHandle, VoiceToolRegistrationOptions, VoiceToolSessionHandle, VoiceToolUseInput, VoiceToolUseInputSchema, readPoVoiceToolsService, requirePoVoiceToolsService };
|
package/dist/voiceTools.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MAX_ORDER, PO_VOICE_AUTO_MODE_ID, PO_VOICE_SOURCE, PO_VOICE_TOOLS_SERVICE, SAFE_IDENTIFIER, SAFE_NAME, VOICE_DESCRIBE_TOOL_NAME, VOICE_FACADE_TOOL_NAMES, VOICE_MODE_TOOL_NAMES, VOICE_NARRATE_TOOL_NAME, VOICE_TOOL_ABORTED, VOICE_TOOL_BATCH_STOPPED, VOICE_TOOL_DEFAULT_TIMEOUT_MS, VOICE_TOOL_ERROR_CODE, VOICE_TOOL_EXECUTION_FAILED, VOICE_TOOL_HOST_UNAVAILABLE, VOICE_TOOL_INACTIVE, VOICE_TOOL_INVALID_INPUT, VOICE_TOOL_INVALID_RESULT, VOICE_TOOL_MAX_BATCH_BYTES, VOICE_TOOL_MAX_BATCH_ITEMS, VOICE_TOOL_MAX_DESCRIPTION_LENGTH, VOICE_TOOL_MAX_DOMAIN_COUNT, VOICE_TOOL_MAX_ERROR_MESSAGE_LENGTH, VOICE_TOOL_MAX_IDENTIFIER_LENGTH, VOICE_TOOL_MAX_INPUT_BYTES, VOICE_TOOL_MAX_JSON_DEPTH, VOICE_TOOL_MAX_LABEL_LENGTH, VOICE_TOOL_MAX_SCHEMA_BYTES, VOICE_TOOL_MAX_TIMEOUT_MS, VOICE_TOOL_NAME_CONFLICT, VOICE_TOOL_NOT_FOUND, VOICE_TOOL_STALE_CATALOG, VOICE_TOOL_STALE_SESSION, VOICE_TOOL_TERMINAL_OPERATION_LIMIT, VOICE_TOOL_TIMEOUT, VOICE_USE_TOOL_NAME } from "./src/constants/voiceTools.mjs";
|
|
2
2
|
import { VoiceToolBatchCallSchema, VoiceToolBatchItemResultSchema, VoiceToolBatchResultSchema, VoiceToolCatalogEntrySchema, VoiceToolCatalogSnapshotSchema, VoiceToolCatalogTokenSchema, VoiceToolConflictDiagnosticSchema, VoiceToolDescribeInputSchema, VoiceToolDescriptorSchema, VoiceToolErrorCodeSchema, VoiceToolErrorSchema, VoiceToolUseInputSchema } from "./src/schemas/voiceTools.mjs";
|
|
3
|
-
import { VoiceToolError,
|
|
4
|
-
export {
|
|
3
|
+
import { VoiceToolError, readPoVoiceToolsService, requirePoVoiceToolsService } from "./src/services/voiceToolsContract/index.mjs";
|
|
4
|
+
export { MAX_ORDER, PO_VOICE_AUTO_MODE_ID, PO_VOICE_SOURCE, PO_VOICE_TOOLS_SERVICE, SAFE_IDENTIFIER, SAFE_NAME, VOICE_DESCRIBE_TOOL_NAME, VOICE_FACADE_TOOL_NAMES, VOICE_MODE_TOOL_NAMES, VOICE_NARRATE_TOOL_NAME, VOICE_TOOL_ABORTED, VOICE_TOOL_BATCH_STOPPED, VOICE_TOOL_DEFAULT_TIMEOUT_MS, VOICE_TOOL_ERROR_CODE, VOICE_TOOL_EXECUTION_FAILED, VOICE_TOOL_HOST_UNAVAILABLE, VOICE_TOOL_INACTIVE, VOICE_TOOL_INVALID_INPUT, VOICE_TOOL_INVALID_RESULT, VOICE_TOOL_MAX_BATCH_BYTES, VOICE_TOOL_MAX_BATCH_ITEMS, VOICE_TOOL_MAX_DESCRIPTION_LENGTH, VOICE_TOOL_MAX_DOMAIN_COUNT, VOICE_TOOL_MAX_ERROR_MESSAGE_LENGTH, VOICE_TOOL_MAX_IDENTIFIER_LENGTH, VOICE_TOOL_MAX_INPUT_BYTES, VOICE_TOOL_MAX_JSON_DEPTH, VOICE_TOOL_MAX_LABEL_LENGTH, VOICE_TOOL_MAX_SCHEMA_BYTES, VOICE_TOOL_MAX_TIMEOUT_MS, VOICE_TOOL_NAME_CONFLICT, VOICE_TOOL_NOT_FOUND, VOICE_TOOL_STALE_CATALOG, VOICE_TOOL_STALE_SESSION, VOICE_TOOL_TERMINAL_OPERATION_LIMIT, VOICE_TOOL_TIMEOUT, VOICE_USE_TOOL_NAME, VoiceToolBatchCallSchema, VoiceToolBatchItemResultSchema, VoiceToolBatchResultSchema, VoiceToolCatalogEntrySchema, VoiceToolCatalogSnapshotSchema, VoiceToolCatalogTokenSchema, VoiceToolConflictDiagnosticSchema, VoiceToolDescribeInputSchema, VoiceToolDescriptorSchema, VoiceToolError, VoiceToolErrorCodeSchema, VoiceToolErrorSchema, VoiceToolUseInputSchema, readPoVoiceToolsService, requirePoVoiceToolsService };
|
package/dist/web.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_bundleAssetPolicy = require("./src/web/schemas/bundleAssetPolicy.cjs");
|
|
3
|
+
const require_home = require("./src/schemas/home.cjs");
|
|
3
4
|
const require_webPlugin = require("./src/extensions/webPlugin.cjs");
|
|
4
5
|
const require_globalStore = require("./src/web/models/globalStore.cjs");
|
|
5
6
|
const require_sessionStore = require("./src/web/models/sessionStore.cjs");
|
|
@@ -14,6 +15,9 @@ const require_index$5 = require("./src/web/services/sessionRegistry/index.cjs");
|
|
|
14
15
|
const require_mcpWidget = require("./src/web/services/mcpWidget.cjs");
|
|
15
16
|
exports.BUNDLE_ASSET_POLICY_PATH = require_bundleAssetPolicy.BUNDLE_ASSET_POLICY_PATH;
|
|
16
17
|
exports.BUNDLE_ASSET_POLICY_VERSION = require_bundleAssetPolicy.BUNDLE_ASSET_POLICY_VERSION;
|
|
18
|
+
exports.HOME_ENTITY_LIMIT = require_home.HOME_ENTITY_LIMIT;
|
|
19
|
+
exports.HOME_KINDS = require_home.HOME_KINDS;
|
|
20
|
+
exports.HOME_PAGE_LIMIT = require_home.HOME_PAGE_LIMIT;
|
|
17
21
|
exports.HUB_ADVERTISEMENT_VERSION = require_index$5.HUB_ADVERTISEMENT_VERSION;
|
|
18
22
|
exports.REGISTRY_DIR_ENV = require_index$5.REGISTRY_DIR_ENV;
|
|
19
23
|
exports.SETTINGS_BASE_PATH = require_index$1.SETTINGS_BASE_PATH;
|
|
@@ -55,6 +59,10 @@ exports.hubAdvertisementPath = require_index$5.hubAdvertisementPath;
|
|
|
55
59
|
exports.isNativeApiTarget = require_index$4.isNativeApiTarget;
|
|
56
60
|
exports.nativeApiTransport = require_index$4.nativeApiTransport;
|
|
57
61
|
exports.parseBundleAssetPolicy = require_bundleAssetPolicy.parseBundleAssetPolicy;
|
|
62
|
+
exports.parseHomeContribution = require_home.parseHomeContribution;
|
|
63
|
+
exports.parseHomeEntity = require_home.parseHomeEntity;
|
|
64
|
+
exports.parseHomeProjection = require_home.parseHomeProjection;
|
|
65
|
+
exports.parseHomeSnapshot = require_home.parseHomeSnapshot;
|
|
58
66
|
exports.parseHubAdvertisement = require_index$5.parseHubAdvertisement;
|
|
59
67
|
exports.parseNativeTemplate = require_template.parseNativeTemplate;
|
|
60
68
|
exports.parseWebTemplate = require_template.parseWebTemplate;
|
package/dist/web.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, BundleAssetPolicy, parseBundleAssetPolicy } from "./src/web/schemas/bundleAssetPolicy.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, HomeContribution, HomeCoverage, HomeEntity, HomeItem, HomeKind, HomeProjection, HomeRequest, HomeSnapshot, HomeSourceStatus, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot } from "./src/schemas/home.mjs";
|
|
3
|
+
import { PoMcpWidgetProps } from "./src/web/types/mcpWidget.mjs";
|
|
3
4
|
import { WebTemplateContribution, WebTemplateHeaderOptions, WebTemplateRail, WebTemplateRailActions, WebTemplateRailDirectoryListing, WebTemplateRailPendingSetup, WebTemplateRailResult, WebTemplateRailSession, WebTemplateRailWorkspace } from "./src/web/types/template.mjs";
|
|
4
5
|
import { NativeTemplateContribution, NativeTemplateScreens, NativeTemplateSessionsActions, NativeTemplateSessionsProps } from "./src/web/types/nativeTemplate.mjs";
|
|
5
6
|
import { ModelContext, ModelContextAbortSignal, ModelContextBinding, ModelContextExecutionOptions, ModelContextRegistrationOptions, ModelContextTool, ModelContextToolChangeEvent, ModelContextToolChangeListener, ModelContextToolDescriptor } from "./src/web/types/modelContext.mjs";
|
|
@@ -18,4 +19,4 @@ import { parseNativeTemplate, parseWebTemplate } from "./src/web/schemas/templat
|
|
|
18
19
|
import { HubAdvertisement, RegistryDirInput } from "./src/web/types/sessionRegistry.mjs";
|
|
19
20
|
import { HUB_ADVERTISEMENT_VERSION, REGISTRY_DIR_ENV, hubAdvertisementPath, parseHubAdvertisement, resolveRegistryDir } from "./src/web/services/sessionRegistry/index.mjs";
|
|
20
21
|
import { defineMcpWidget } from "./src/web/services/mcpWidget.mjs";
|
|
21
|
-
export { type ActivityGroupContribution, type ActivityGroupFile, type ApiCallInit, type ApiClient, type ApiClientOptions, type ApiMethod, type ApiParams, type ApiQuery, type ApiResponseOf, type ApiResult, type ApiRouteMethod, type ApiRouteSpec, type ApiRoutes, type ApiScopeAddress, type ApiScopeClient, type ApiScopeName, type ApiStreamMethod, type ApiTransport, BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, type BundleAssetPolicy, type CaptureStatusEvent, type ChannelFile, type ComposerCapture, type ComposerSubmission, type ContextAction, type ContextActionContribution, type ContextActionFile, type ContextActionRunContext, type DockFaceContribution, type DockFaceFile, type
|
|
22
|
+
export { type ActivityGroupContribution, type ActivityGroupFile, type ApiCallInit, type ApiClient, type ApiClientOptions, type ApiMethod, type ApiParams, type ApiQuery, type ApiResponseOf, type ApiResult, type ApiRouteMethod, type ApiRouteSpec, type ApiRoutes, type ApiScopeAddress, type ApiScopeClient, type ApiScopeName, type ApiStreamMethod, type ApiTransport, BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, type BundleAssetPolicy, type CaptureStatusEvent, type ChannelFile, type ComposerCapture, type ComposerSubmission, type ContextAction, type ContextActionContribution, type ContextActionFile, type ContextActionRunContext, type DockFaceContribution, type DockFaceFile, type FileLinkSource, type FillFile, type GlobalStore, HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, HUB_ADVERTISEMENT_VERSION, HomeContribution, HomeCoverage, HomeEntity, HomeItem, HomeKind, HomeProjection, HomeRequest, HomeSnapshot, HomeSourceStatus, type HubAdvertisement, type LeaderBindingContribution, type LeaderBindingFile, type LeaderKeyContribution, type MinorModeContribution, type MinorModeFile, type ModelContext, type ModelContextAbortSignal, type ModelContextBinding, type ModelContextExecutionOptions, type ModelContextRegistrationOptions, type ModelContextTool, type ModelContextToolChangeEvent, type ModelContextToolChangeListener, type ModelContextToolDescriptor, type NativeTemplateContribution, type NativeTemplateScreens, type NativeTemplateSessionsActions, type NativeTemplateSessionsProps, type PaletteCommandContext, type PaletteCommandContribution, type PaletteCommandFile, type PoMcpWidgetProps, REGISTRY_DIR_ENV, type RegistryDirInput, type RepositorySettingsPanelContribution, type RepositorySettingsPanelProps, type RepositorySettingsRepository, SETTINGS_BASE_PATH, type SelectionAxisContribution, type SelectionAxisFile, type SessionChannelContribution, type SessionFrameSender, type SessionRecords, type SessionStore, type SessionStoreChannel, type SettingsFieldContribution, type SettingsFieldOption, type SettingsPanelContribution, type SettingsPanelFile, type SettingsPanelProps, type SettingsSectionContribution, type SettingsSectionFile, type SettingsSectionGroup, type SlotDataFill, type SlotDeclaration, type SlotFile, type SlotFillContribution, type SurfaceContribution, type TabContribution, type TabFile, type ThreadViewOptions, type ToolCompletionEvent, type ToolMessageRenderProps, type ToolPromptContribution, type ToolPromptDialog, type ToolPromptRenderProps, type ToolRendererContribution, type ToolRendererFile, type ToolResultView, type TransientTab, type UserMessageActionContribution, type UserMessageActionFile, type UserMessageActionRunContext, type WebPluginContextInventoryItem, type WebPluginContextItem, type WebPluginContributions, type WebPluginDefinition, type WebPluginMount, type WebPluginNewSessionContext, type WebPluginRuntime, type WebPluginScope, type WebPluginSessionContext, type WebPluginSlotProps, type WebTemplateContribution, type WebTemplateFile, type WebTemplateHeaderOptions, type WebTemplateRail, type WebTemplateRailActions, type WebTemplateRailDirectoryListing, type WebTemplateRailPendingSetup, type WebTemplateRailResult, type WebTemplateRailSession, type WebTemplateRailWorkspace, type WorkspaceRecords, type WorkspaceStore, apiQueryString, apiResponse, applyPathParams, bindNativeApiTransport, bindSessionApiWorkspace, createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineContextAction, defineDockFace, defineFileLinks, defineFill, defineGlobalStore, defineLeaderBinding, defineMcpWidget, defineMinorModeFile, definePaletteCommand, defineRepositorySettingsPanel, defineSelectionAxis, defineSessionChannel, defineSessionStore, defineSettingsPanel, defineSettingsSection, defineSlot, defineSlotFile, defineTab, defineToolRenderer, defineUserMessageAction, defineWebLifecycle, defineWebPlugin, defineWebTemplate, defineWorkspaceStore, globalApiPath, hubAdvertisementPath, isNativeApiTarget, nativeApiTransport, parseBundleAssetPolicy, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot, parseHubAdvertisement, parseNativeTemplate, parseWebTemplate, pluginApiBase, pluginApiUrl, resolveRegistryDir, scopeApiRoot, sessionApiAddress, sessionApiPath, toolResultText, toolResultTextLines, workspaceApiPath };
|
package/dist/web.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, parseBundleAssetPolicy } from "./src/web/schemas/bundleAssetPolicy.mjs";
|
|
2
|
+
import { HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot } from "./src/schemas/home.mjs";
|
|
2
3
|
import { defineActivityGroup, defineChannelFile, defineContextAction, defineDockFace, defineFileLinks, defineFill, defineLeaderBinding, defineMinorModeFile, definePaletteCommand, defineRepositorySettingsPanel, defineSelectionAxis, defineSessionChannel, defineSettingsPanel, defineSettingsSection, defineSlot, defineSlotFile, defineTab, defineToolRenderer, defineUserMessageAction, defineWebLifecycle, defineWebPlugin, defineWebTemplate } from "./src/extensions/webPlugin.mjs";
|
|
3
4
|
import { defineGlobalStore } from "./src/web/models/globalStore.mjs";
|
|
4
5
|
import { defineSessionStore } from "./src/web/models/sessionStore.mjs";
|
|
@@ -11,4 +12,4 @@ import { bindNativeApiTransport, isNativeApiTarget, nativeApiTransport } from ".
|
|
|
11
12
|
import { parseNativeTemplate, parseWebTemplate } from "./src/web/schemas/template.mjs";
|
|
12
13
|
import { HUB_ADVERTISEMENT_VERSION, REGISTRY_DIR_ENV, hubAdvertisementPath, parseHubAdvertisement, resolveRegistryDir } from "./src/web/services/sessionRegistry/index.mjs";
|
|
13
14
|
import { defineMcpWidget } from "./src/web/services/mcpWidget.mjs";
|
|
14
|
-
export { BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, HUB_ADVERTISEMENT_VERSION, REGISTRY_DIR_ENV, SETTINGS_BASE_PATH, apiQueryString, apiResponse, applyPathParams, bindNativeApiTransport, bindSessionApiWorkspace, createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineContextAction, defineDockFace, defineFileLinks, defineFill, defineGlobalStore, defineLeaderBinding, defineMcpWidget, defineMinorModeFile, definePaletteCommand, defineRepositorySettingsPanel, defineSelectionAxis, defineSessionChannel, defineSessionStore, defineSettingsPanel, defineSettingsSection, defineSlot, defineSlotFile, defineTab, defineToolRenderer, defineUserMessageAction, defineWebLifecycle, defineWebPlugin, defineWebTemplate, defineWorkspaceStore, globalApiPath, hubAdvertisementPath, isNativeApiTarget, nativeApiTransport, parseBundleAssetPolicy, parseHubAdvertisement, parseNativeTemplate, parseWebTemplate, pluginApiBase, pluginApiUrl, resolveRegistryDir, scopeApiRoot, sessionApiAddress, sessionApiPath, toolResultText, toolResultTextLines, workspaceApiPath };
|
|
15
|
+
export { BUNDLE_ASSET_POLICY_PATH, BUNDLE_ASSET_POLICY_VERSION, HOME_ENTITY_LIMIT, HOME_KINDS, HOME_PAGE_LIMIT, HUB_ADVERTISEMENT_VERSION, REGISTRY_DIR_ENV, SETTINGS_BASE_PATH, apiQueryString, apiResponse, applyPathParams, bindNativeApiTransport, bindSessionApiWorkspace, createApiClient, defineActivityGroup, defineApiRoutes, defineChannelFile, defineContextAction, defineDockFace, defineFileLinks, defineFill, defineGlobalStore, defineLeaderBinding, defineMcpWidget, defineMinorModeFile, definePaletteCommand, defineRepositorySettingsPanel, defineSelectionAxis, defineSessionChannel, defineSessionStore, defineSettingsPanel, defineSettingsSection, defineSlot, defineSlotFile, defineTab, defineToolRenderer, defineUserMessageAction, defineWebLifecycle, defineWebPlugin, defineWebTemplate, defineWorkspaceStore, globalApiPath, hubAdvertisementPath, isNativeApiTarget, nativeApiTransport, parseBundleAssetPolicy, parseHomeContribution, parseHomeEntity, parseHomeProjection, parseHomeSnapshot, parseHubAdvertisement, parseNativeTemplate, parseWebTemplate, pluginApiBase, pluginApiUrl, resolveRegistryDir, scopeApiRoot, sessionApiAddress, sessionApiPath, toolResultText, toolResultTextLines, workspaceApiPath };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webCompositions.cjs","names":["crypto","createPluginBundlePublication","NATIVE_ENTRY_PATH","HOST_CHANNEL_KEY_TAG","fs","path"],"sources":["../src/services/webCompositions/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\n\nimport { HOST_CHANNEL_KEY_TAG } from '../../constants/remote';\nimport type { DoomApiMount, DoomNativeComposition, DoomWebComposition } from '../../exports/packageApi';\nimport { createPluginBundlePublication, type PublishedBundle } from '../bundlePublication';\n\n/** One plugin copy in a global web build: its slot entry and the files that entry can load. */\nexport interface GlobalWebBuildPlugin {\n pluginId: string;\n /** The copy's identity: the pluginId for a host plugin, else the pluginId plus a package hash. */\n slot: string;\n packageDir: string;\n isHost: boolean;\n /** The slot entry module below `pluginsDirectory`. */\n entry: string;\n /** Every file below `pluginsDirectory` the entry reaches through static and dynamic imports, plus its stylesheet. */\n files: readonly string[];\n /** The stylesheets of the entry's static import closure. */\n css: readonly string[];\n}\n\n/** One global web build: the shell, the shared plugin composition, and one stylesheet per plugin copy. */\nexport interface GlobalWebBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Signed cockpit shell directory. */\n webDirectory: string;\n /** Shared plugin composition directory, published once for every mount. */\n pluginsDirectory: string;\n /** Every plugin copy in the build, in build order. */\n plugins: readonly GlobalWebBuildPlugin[];\n /** Content-hashed stylesheet paths below `pluginsDirectory`, keyed by slot. */\n pluginStyles: Readonly<Record<string, string>>;\n /** Stylesheet a mount without plugin styles still loads, for the host shell and fallback template. */\n baseStyle?: string;\n}\n\n/** One global native build: a single signed CommonJS composition shared by every mount. */\nexport interface GlobalNativeBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Directory holding exactly `/composition.js`. */\n pluginsDirectory: string;\n}\n\nconst absolute = (file: string): string => (file.startsWith('/') ? file : `/${file}`);\n\n/** The build's plugin copies for exactly the given slots, in slot order. */\nfunction slotPlugins(build: GlobalWebBuild, slots: readonly string[]): GlobalWebBuildPlugin[] {\n return slots.flatMap((slot) => build.plugins.filter((plugin) => plugin.slot === slot));\n}\n\n/**\n * The stylesheets of exactly the given slots, each loaded once: the stylesheets their code\n * imports first, then each slot's own stylesheet in slot order.\n */\nexport function mountStylePaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n const paths = slots.map((slot) => build.pluginStyles[slot]).filter((style) => style !== undefined);\n if (paths.length === 0 && build.baseStyle !== undefined) paths.push(build.baseStyle);\n const imported = slotPlugins(build, slots).flatMap((plugin) => plugin.css);\n return [...new Set([...imported, ...paths].map(absolute))];\n}\n\n/** Every file the given slots can load: their reachable files and static stylesheets, each once. */\nexport function mountAssetPaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n return [\n ...new Set(\n slotPlugins(build, slots)\n .flatMap((plugin) => [...plugin.files, ...plugin.css])\n .map(absolute),\n ),\n ];\n}\n\nconst sha256 = (value: string): string => crypto.createHash('sha256').update(value).digest('hex');\n\n/**\n * Signs the global build once and hands each mount a composition naming its own plugins.\n *\n * Every mount of one build shares a publication id, so the bytes are counted per mount and\n * released only when the last mount leaves or moves to another build.\n */\nexport function createWebCompositions(stateDirectory: string, onNotice: (message: string) => void) {\n const publication = createPluginBundlePublication(stateDirectory, onNotice);\n let shell: PublishedBundle | undefined;\n const mounts = new Map<string, DoomWebComposition>();\n const nativeMounts = new Map<string, DoomNativeComposition>();\n const references = new Map<string, number>();\n const keyOf = (mount: DoomApiMount): string =>\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n const release = (id: string): void => {\n const count = (references.get(id) ?? 0) - 1;\n if (count > 0) {\n references.set(id, count);\n return;\n }\n references.delete(id);\n publication.release(id);\n };\n return {\n publishShell(build: GlobalWebBuild): void {\n shell = publication.publish(sha256(`shell:${build.key}`), build.webDirectory);\n if (!shell) throw new Error('Could not publish the global web shell.');\n },\n shellTrust: () =>\n shell === undefined ? undefined : { publicKey: shell.signed.publicKey, revision: shell.signed.manifest.revision },\n publish(\n mount: DoomApiMount,\n build: GlobalWebBuild,\n channels: readonly string[],\n slots: readonly string[],\n ): DoomWebComposition | undefined {\n const id = sha256(`plugins:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory);\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} web composition.`);\n const previous = mounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const signedPaths = new Set(published.signed.manifest.assets.map((asset) => asset.path));\n const composition: DoomWebComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n verifiedAssetBaseUrl: `/verified-plugins/${id}/${String(revision)}`,\n pluginEntries: slotPlugins(build, slots).map((plugin): [string, string] => [\n plugin.slot,\n absolute(plugin.entry),\n ]),\n assetPaths: mountAssetPaths(build, slots).filter((file) => signedPaths.has(file)),\n stylePaths: mountStylePaths(build, slots).filter((style) => signedPaths.has(style)),\n channels: [...channels],\n plugins: [...slots],\n };\n mounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n get: (mount: DoomApiMount) => mounts.get(keyOf(mount)),\n remove: (mount: DoomApiMount) => {\n const previous = mounts.get(keyOf(mount));\n mounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Publishes the native composition for one mount. Signed under the `native` profile, so it can\n * never be served or verified as a web bundle. Shares reference counting with web publications.\n */\n publishNative(\n mount: DoomApiMount,\n build: GlobalNativeBuild,\n channels: readonly string[],\n pluginIds: readonly string[],\n ): DoomNativeComposition {\n const id = sha256(`native:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory, 'native');\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} native composition.`);\n const previous = nativeMounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const composition: DoomNativeComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n entryPath: NATIVE_ENTRY_PATH,\n channels: [...channels],\n plugins: [...pluginIds],\n };\n nativeMounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n getNative: (mount: DoomApiMount) => nativeMounts.get(keyOf(mount)),\n removeNative: (mount: DoomApiMount) => {\n const previous = nativeMounts.get(keyOf(mount));\n nativeMounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Signs `po/host-channel-key/v1` with the shell publication's signer, the key the pairing QR pins\n * as `s`. Undefined until the shell is published.\n */\n attestHost: (fields: readonly string[]): string | undefined =>\n shell === undefined ? undefined : publication.attest(HOST_CHANNEL_KEY_TAG, fields),\n publicKey: () => publication.publicKey(),\n async request(request: Request): Promise<Response | undefined> {\n const url = new URL(request.url);\n if (\n (url.pathname === '/bundle-manifest.json' || url.pathname.startsWith('/bundle-assets/')) &&\n request.method !== 'GET' &&\n request.method !== 'HEAD'\n )\n return new Response(null, { status: 405 });\n if (url.pathname === '/bundle-manifest.json') {\n if (!shell) return new Response(null, { status: 404 });\n return Response.json(shell.signed);\n }\n const shellAsset = /^\\/bundle-assets\\/(\\d+)(\\/.*)$/u.exec(url.pathname);\n if (shellAsset) {\n if (!shell || Number(shellAsset[1]) !== shell.signed.manifest.revision)\n return new Response(null, { status: 404 });\n const asset = shell.signed.manifest.assets.find((entry) => entry.path === shellAsset[2]);\n if (!asset) return new Response(null, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(shell.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: { 'content-type': asset.contentType, 'x-content-type-options': 'nosniff' },\n });\n }\n const match = /^\\/api\\/web-plugins\\/([a-f0-9]{64})\\/(\\d+)\\/(manifest|assets(?:\\/.*)?)$/u.exec(url.pathname);\n if (!match) return undefined;\n if (request.method !== 'GET' && request.method !== 'HEAD') return new Response(null, { status: 405 });\n const bundle = publication.get(match[1], Number(match[2]));\n if (!bundle) return Response.json({ error: 'Plugin generation not found.' }, { status: 404 });\n if (match[3] === 'manifest') return Response.json(bundle.signed);\n const assetPath = match[3].slice('assets'.length);\n const asset = bundle.signed.manifest.assets.find((candidate) => candidate.path === assetPath);\n if (!asset) return Response.json({ error: 'Plugin asset not found.' }, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(bundle.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: {\n 'content-type': asset.contentType,\n 'cache-control': 'private, max-age=31536000, immutable',\n 'x-content-type-options': 'nosniff',\n },\n });\n },\n close() {\n mounts.clear();\n nativeMounts.clear();\n references.clear();\n publication.close();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAiDA,MAAM,YAAY,SAA0B,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI;;AAG9E,SAAS,YAAY,OAAuB,OAAkD;CAC5F,OAAO,MAAM,SAAS,SAAS,MAAM,QAAQ,QAAQ,WAAW,OAAO,SAAS,IAAI,CAAC;AACvF;;;;;AAMA,SAAgB,gBAAgB,OAAuB,OAAoC;CACzF,MAAM,QAAQ,MAAM,KAAK,SAAS,MAAM,aAAa,KAAK,CAAC,CAAC,QAAQ,UAAU,UAAU,KAAA,CAAS;CACjG,IAAI,MAAM,WAAW,KAAK,MAAM,cAAc,KAAA,GAAW,MAAM,KAAK,MAAM,SAAS;CACnF,MAAM,WAAW,YAAY,OAAO,KAAK,CAAC,CAAC,SAAS,WAAW,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,MAAM,CAAe;GAChD,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,MAAM,cAAc,UAAU,SAAS,SAAS;GAC5F,IAAI,CAAC,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,0BAA0B,GAAG,EAAE,QAAQ,IAAI,CAAC;GACtF,MAAM,QAAQ,MAAMD,QAAAA,QAAG,SAAS,SAASC,UAAAA,QAAK,KAAK,OAAO,WAAW,MAAM,IAAI,CAAC;GAChF,OAAO,IAAI,SAAS,QAAQ,WAAW,SAAS,OAAO,OAAO,EAC5D,SAAS;IACP,gBAAgB,MAAM;IACtB,iBAAiB;IACjB,0BAA0B;GAC5B,EACF,CAAC;EACH;EACA,QAAQ;GACN,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,WAAW,MAAM;GACjB,YAAY,MAAM;EACpB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"webCompositions.cjs","names":["crypto","createPluginBundlePublication","NATIVE_ENTRY_PATH","HOST_CHANNEL_KEY_TAG","fs","path"],"sources":["../src/services/webCompositions/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\n\nimport { HOST_CHANNEL_KEY_TAG } from '../../constants/remote';\nimport type { PoApiMount, PoNativeComposition, PoWebComposition } from '../../exports/packageApi';\nimport { createPluginBundlePublication, type PublishedBundle } from '../bundlePublication';\n\n/** One plugin copy in a global web build: its slot entry and the files that entry can load. */\nexport interface GlobalWebBuildPlugin {\n pluginId: string;\n /** The copy's identity: the pluginId for a host plugin, else the pluginId plus a package hash. */\n slot: string;\n packageDir: string;\n isHost: boolean;\n /** The slot entry module below `pluginsDirectory`. */\n entry: string;\n /** Every file below `pluginsDirectory` the entry reaches through static and dynamic imports, plus its stylesheet. */\n files: readonly string[];\n /** The stylesheets of the entry's static import closure. */\n css: readonly string[];\n}\n\n/** One global web build: the shell, the shared plugin composition, and one stylesheet per plugin copy. */\nexport interface GlobalWebBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Signed cockpit shell directory. */\n webDirectory: string;\n /** Shared plugin composition directory, published once for every mount. */\n pluginsDirectory: string;\n /** Every plugin copy in the build, in build order. */\n plugins: readonly GlobalWebBuildPlugin[];\n /** Content-hashed stylesheet paths below `pluginsDirectory`, keyed by slot. */\n pluginStyles: Readonly<Record<string, string>>;\n /** Stylesheet a mount without plugin styles still loads, for the host shell and fallback template. */\n baseStyle?: string;\n}\n\n/** One global native build: a single signed CommonJS composition shared by every mount. */\nexport interface GlobalNativeBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Directory holding exactly `/composition.js`. */\n pluginsDirectory: string;\n}\n\nconst absolute = (file: string): string => (file.startsWith('/') ? file : `/${file}`);\n\n/** The build's plugin copies for exactly the given slots, in slot order. */\nfunction slotPlugins(build: GlobalWebBuild, slots: readonly string[]): GlobalWebBuildPlugin[] {\n return slots.flatMap((slot) => build.plugins.filter((plugin) => plugin.slot === slot));\n}\n\n/**\n * The stylesheets of exactly the given slots, each loaded once: the stylesheets their code\n * imports first, then each slot's own stylesheet in slot order.\n */\nexport function mountStylePaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n const paths = slots.map((slot) => build.pluginStyles[slot]).filter((style) => style !== undefined);\n if (paths.length === 0 && build.baseStyle !== undefined) paths.push(build.baseStyle);\n const imported = slotPlugins(build, slots).flatMap((plugin) => plugin.css);\n return [...new Set([...imported, ...paths].map(absolute))];\n}\n\n/** Every file the given slots can load: their reachable files and static stylesheets, each once. */\nexport function mountAssetPaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n return [\n ...new Set(\n slotPlugins(build, slots)\n .flatMap((plugin) => [...plugin.files, ...plugin.css])\n .map(absolute),\n ),\n ];\n}\n\nconst sha256 = (value: string): string => crypto.createHash('sha256').update(value).digest('hex');\n\n/**\n * Signs the global build once and hands each mount a composition naming its own plugins.\n *\n * Every mount of one build shares a publication id, so the bytes are counted per mount and\n * released only when the last mount leaves or moves to another build.\n */\nexport function createWebCompositions(stateDirectory: string, onNotice: (message: string) => void) {\n const publication = createPluginBundlePublication(stateDirectory, onNotice);\n let shell: PublishedBundle | undefined;\n const mounts = new Map<string, PoWebComposition>();\n const nativeMounts = new Map<string, PoNativeComposition>();\n const references = new Map<string, number>();\n const keyOf = (mount: PoApiMount): string =>\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n const release = (id: string): void => {\n const count = (references.get(id) ?? 0) - 1;\n if (count > 0) {\n references.set(id, count);\n return;\n }\n references.delete(id);\n publication.release(id);\n };\n return {\n publishShell(build: GlobalWebBuild): void {\n shell = publication.publish(sha256(`shell:${build.key}`), build.webDirectory);\n if (!shell) throw new Error('Could not publish the global web shell.');\n },\n shellTrust: () =>\n shell === undefined ? undefined : { publicKey: shell.signed.publicKey, revision: shell.signed.manifest.revision },\n publish(\n mount: PoApiMount,\n build: GlobalWebBuild,\n channels: readonly string[],\n slots: readonly string[],\n ): PoWebComposition | undefined {\n const id = sha256(`plugins:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory);\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} web composition.`);\n const previous = mounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const signedPaths = new Set(published.signed.manifest.assets.map((asset) => asset.path));\n const composition: PoWebComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n verifiedAssetBaseUrl: `/verified-plugins/${id}/${String(revision)}`,\n pluginEntries: slotPlugins(build, slots).map((plugin): [string, string] => [\n plugin.slot,\n absolute(plugin.entry),\n ]),\n assetPaths: mountAssetPaths(build, slots).filter((file) => signedPaths.has(file)),\n stylePaths: mountStylePaths(build, slots).filter((style) => signedPaths.has(style)),\n channels: [...channels],\n plugins: [...slots],\n };\n mounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n get: (mount: PoApiMount) => mounts.get(keyOf(mount)),\n remove: (mount: PoApiMount) => {\n const previous = mounts.get(keyOf(mount));\n mounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Publishes the native composition for one mount. Signed under the `native` profile, so it can\n * never be served or verified as a web bundle. Shares reference counting with web publications.\n */\n publishNative(\n mount: PoApiMount,\n build: GlobalNativeBuild,\n channels: readonly string[],\n pluginIds: readonly string[],\n ): PoNativeComposition {\n const id = sha256(`native:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory, 'native');\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} native composition.`);\n const previous = nativeMounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const composition: PoNativeComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n entryPath: NATIVE_ENTRY_PATH,\n channels: [...channels],\n plugins: [...pluginIds],\n };\n nativeMounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n getNative: (mount: PoApiMount) => nativeMounts.get(keyOf(mount)),\n removeNative: (mount: PoApiMount) => {\n const previous = nativeMounts.get(keyOf(mount));\n nativeMounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Signs `po/host-channel-key/v1` with the shell publication's signer, the key the pairing QR pins\n * as `s`. Undefined until the shell is published.\n */\n attestHost: (fields: readonly string[]): string | undefined =>\n shell === undefined ? undefined : publication.attest(HOST_CHANNEL_KEY_TAG, fields),\n publicKey: () => publication.publicKey(),\n async request(request: Request): Promise<Response | undefined> {\n const url = new URL(request.url);\n if (\n (url.pathname === '/bundle-manifest.json' || url.pathname.startsWith('/bundle-assets/')) &&\n request.method !== 'GET' &&\n request.method !== 'HEAD'\n )\n return new Response(null, { status: 405 });\n if (url.pathname === '/bundle-manifest.json') {\n if (!shell) return new Response(null, { status: 404 });\n return Response.json(shell.signed);\n }\n const shellAsset = /^\\/bundle-assets\\/(\\d+)(\\/.*)$/u.exec(url.pathname);\n if (shellAsset) {\n if (!shell || Number(shellAsset[1]) !== shell.signed.manifest.revision)\n return new Response(null, { status: 404 });\n const asset = shell.signed.manifest.assets.find((entry) => entry.path === shellAsset[2]);\n if (!asset) return new Response(null, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(shell.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: { 'content-type': asset.contentType, 'x-content-type-options': 'nosniff' },\n });\n }\n const match = /^\\/api\\/web-plugins\\/([a-f0-9]{64})\\/(\\d+)\\/(manifest|assets(?:\\/.*)?)$/u.exec(url.pathname);\n if (!match) return undefined;\n if (request.method !== 'GET' && request.method !== 'HEAD') return new Response(null, { status: 405 });\n const bundle = publication.get(match[1], Number(match[2]));\n if (!bundle) return Response.json({ error: 'Plugin generation not found.' }, { status: 404 });\n if (match[3] === 'manifest') return Response.json(bundle.signed);\n const assetPath = match[3].slice('assets'.length);\n const asset = bundle.signed.manifest.assets.find((candidate) => candidate.path === assetPath);\n if (!asset) return Response.json({ error: 'Plugin asset not found.' }, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(bundle.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: {\n 'content-type': asset.contentType,\n 'cache-control': 'private, max-age=31536000, immutable',\n 'x-content-type-options': 'nosniff',\n },\n });\n },\n close() {\n mounts.clear();\n nativeMounts.clear();\n references.clear();\n publication.close();\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AAiDA,MAAM,YAAY,SAA0B,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI;;AAG9E,SAAS,YAAY,OAAu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,OAAO,OAAO,KAAA;GACnB,IAAI,QAAQ,WAAW,SAAS,QAAQ,WAAW,QAAQ,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;GACpG,MAAM,SAAS,YAAY,IAAI,MAAM,IAAI,OAAO,MAAM,EAAE,CAAC;GACzD,IAAI,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,OAAO,+BAA+B,GAAG,EAAE,QAAQ,IAAI,CAAC;GAC5F,IAAI,MAAM,OAAO,YAAY,OAAO,SAAS,KAAK,OAAO,MAAM;GAC/D,MAAM,YAAY,MAAM,EAAE,CAAC,MAAM,CAAe;GAChD,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,MAAM,cAAc,UAAU,SAAS,SAAS;GAC5F,IAAI,CAAC,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,0BAA0B,GAAG,EAAE,QAAQ,IAAI,CAAC;GACtF,MAAM,QAAQ,MAAMD,QAAAA,QAAG,SAAS,SAASC,UAAAA,QAAK,KAAK,OAAO,WAAW,MAAM,IAAI,CAAC;GAChF,OAAO,IAAI,SAAS,QAAQ,WAAW,SAAS,OAAO,OAAO,EAC5D,SAAS;IACP,gBAAgB,MAAM;IACtB,iBAAiB;IACjB,0BAA0B;GAC5B,EACF,CAAC;EACH;EACA,QAAQ;GACN,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,WAAW,MAAM;GACjB,YAAY,MAAM;EACpB;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PoApiMount, PoNativeComposition, PoWebComposition } from "./src/schemas/packageApi.mjs";
|
|
2
2
|
import "./packageApi.mjs";
|
|
3
3
|
//#region src/services/webCompositions/index.d.ts
|
|
4
4
|
/** One plugin copy in a global web build: its slot entry and the files that entry can load. */
|
|
@@ -56,16 +56,16 @@ export declare function createWebCompositions(stateDirectory: string, onNotice:
|
|
|
56
56
|
publicKey: string;
|
|
57
57
|
revision: number;
|
|
58
58
|
} | undefined;
|
|
59
|
-
publish(mount:
|
|
60
|
-
get: (mount:
|
|
61
|
-
remove: (mount:
|
|
59
|
+
publish(mount: PoApiMount, build: GlobalWebBuild, channels: readonly string[], slots: readonly string[]): PoWebComposition | undefined;
|
|
60
|
+
get: (mount: PoApiMount) => PoWebComposition | undefined;
|
|
61
|
+
remove: (mount: PoApiMount) => void;
|
|
62
62
|
/**
|
|
63
63
|
* Publishes the native composition for one mount. Signed under the `native` profile, so it can
|
|
64
64
|
* never be served or verified as a web bundle. Shares reference counting with web publications.
|
|
65
65
|
*/
|
|
66
|
-
publishNative(mount:
|
|
67
|
-
getNative: (mount:
|
|
68
|
-
removeNative: (mount:
|
|
66
|
+
publishNative(mount: PoApiMount, build: GlobalNativeBuild, channels: readonly string[], pluginIds: readonly string[]): PoNativeComposition;
|
|
67
|
+
getNative: (mount: PoApiMount) => PoNativeComposition | undefined;
|
|
68
|
+
removeNative: (mount: PoApiMount) => void;
|
|
69
69
|
/**
|
|
70
70
|
* Signs `po/host-channel-key/v1` with the shell publication's signer, the key the pairing QR pins
|
|
71
71
|
* as `s`. Undefined until the shell is published.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webCompositions.d.mts","names":[],"sources":["../src/services/webCompositions/index.ts"],"mappings":";;;;iBAWiB;EACf;;EAEA;EACA;EACA;;EAEA;;EAEA;;EAEA;;;iBAIe;;EAEf;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB,cAAc,SAAS;;EAEvB;;;iBAIe;;EAEf;;EAEA;;;;;;wBAcc,gBAAgB,OAAO,gBAAgB;;wBAQvC,gBAAgB,OAAO,gBAAgB;;;;;;;wBAkBvC,sBAAsB,wBAAwB,WAAW;EAsBrE,aAAY,OAAQ;EAIpB;;;;EAEA,QAAO,OACE,
|
|
1
|
+
{"version":3,"file":"webCompositions.d.mts","names":[],"sources":["../src/services/webCompositions/index.ts"],"mappings":";;;;iBAWiB;EACf;;EAEA;EACA;EACA;;EAEA;;EAEA;;EAEA;;;iBAIe;;EAEf;;EAEA;;EAEA;;EAEA,kBAAkB;;EAElB,cAAc,SAAS;;EAEvB;;;iBAIe;;EAEf;;EAEA;;;;;;wBAcc,gBAAgB,OAAO,gBAAgB;;wBAQvC,gBAAgB,OAAO,gBAAgB;;;;;;;wBAkBvC,sBAAsB,wBAAwB,WAAW;EAsBrE,aAAY,OAAQ;EAIpB;;;;EAEA,QAAO,OACE,YAAU,OACV,gBAAc,6BACM,2BAE1B;EA6BH,MAAG,OAAU,eAAU;EACvB,SAAM,OAAU;;;;;EAShB,cAAa,OACJ,YAAU,OACV,mBAAiB,6BACG,+BAE1B;EAsBH,YAAS,OAAU,eAAU;EAC7B,eAAY,OAAU;;;;;EAStB,aAAU;EAEV;EACM,QAAO,SAAU,UAAU,QAAQ;EAyCzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webCompositions.mjs","names":[],"sources":["../src/services/webCompositions/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\n\nimport { HOST_CHANNEL_KEY_TAG } from '../../constants/remote';\nimport type { DoomApiMount, DoomNativeComposition, DoomWebComposition } from '../../exports/packageApi';\nimport { createPluginBundlePublication, type PublishedBundle } from '../bundlePublication';\n\n/** One plugin copy in a global web build: its slot entry and the files that entry can load. */\nexport interface GlobalWebBuildPlugin {\n pluginId: string;\n /** The copy's identity: the pluginId for a host plugin, else the pluginId plus a package hash. */\n slot: string;\n packageDir: string;\n isHost: boolean;\n /** The slot entry module below `pluginsDirectory`. */\n entry: string;\n /** Every file below `pluginsDirectory` the entry reaches through static and dynamic imports, plus its stylesheet. */\n files: readonly string[];\n /** The stylesheets of the entry's static import closure. */\n css: readonly string[];\n}\n\n/** One global web build: the shell, the shared plugin composition, and one stylesheet per plugin copy. */\nexport interface GlobalWebBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Signed cockpit shell directory. */\n webDirectory: string;\n /** Shared plugin composition directory, published once for every mount. */\n pluginsDirectory: string;\n /** Every plugin copy in the build, in build order. */\n plugins: readonly GlobalWebBuildPlugin[];\n /** Content-hashed stylesheet paths below `pluginsDirectory`, keyed by slot. */\n pluginStyles: Readonly<Record<string, string>>;\n /** Stylesheet a mount without plugin styles still loads, for the host shell and fallback template. */\n baseStyle?: string;\n}\n\n/** One global native build: a single signed CommonJS composition shared by every mount. */\nexport interface GlobalNativeBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Directory holding exactly `/composition.js`. */\n pluginsDirectory: string;\n}\n\nconst absolute = (file: string): string => (file.startsWith('/') ? file : `/${file}`);\n\n/** The build's plugin copies for exactly the given slots, in slot order. */\nfunction slotPlugins(build: GlobalWebBuild, slots: readonly string[]): GlobalWebBuildPlugin[] {\n return slots.flatMap((slot) => build.plugins.filter((plugin) => plugin.slot === slot));\n}\n\n/**\n * The stylesheets of exactly the given slots, each loaded once: the stylesheets their code\n * imports first, then each slot's own stylesheet in slot order.\n */\nexport function mountStylePaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n const paths = slots.map((slot) => build.pluginStyles[slot]).filter((style) => style !== undefined);\n if (paths.length === 0 && build.baseStyle !== undefined) paths.push(build.baseStyle);\n const imported = slotPlugins(build, slots).flatMap((plugin) => plugin.css);\n return [...new Set([...imported, ...paths].map(absolute))];\n}\n\n/** Every file the given slots can load: their reachable files and static stylesheets, each once. */\nexport function mountAssetPaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n return [\n ...new Set(\n slotPlugins(build, slots)\n .flatMap((plugin) => [...plugin.files, ...plugin.css])\n .map(absolute),\n ),\n ];\n}\n\nconst sha256 = (value: string): string => crypto.createHash('sha256').update(value).digest('hex');\n\n/**\n * Signs the global build once and hands each mount a composition naming its own plugins.\n *\n * Every mount of one build shares a publication id, so the bytes are counted per mount and\n * released only when the last mount leaves or moves to another build.\n */\nexport function createWebCompositions(stateDirectory: string, onNotice: (message: string) => void) {\n const publication = createPluginBundlePublication(stateDirectory, onNotice);\n let shell: PublishedBundle | undefined;\n const mounts = new Map<string, DoomWebComposition>();\n const nativeMounts = new Map<string, DoomNativeComposition>();\n const references = new Map<string, number>();\n const keyOf = (mount: DoomApiMount): string =>\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n const release = (id: string): void => {\n const count = (references.get(id) ?? 0) - 1;\n if (count > 0) {\n references.set(id, count);\n return;\n }\n references.delete(id);\n publication.release(id);\n };\n return {\n publishShell(build: GlobalWebBuild): void {\n shell = publication.publish(sha256(`shell:${build.key}`), build.webDirectory);\n if (!shell) throw new Error('Could not publish the global web shell.');\n },\n shellTrust: () =>\n shell === undefined ? undefined : { publicKey: shell.signed.publicKey, revision: shell.signed.manifest.revision },\n publish(\n mount: DoomApiMount,\n build: GlobalWebBuild,\n channels: readonly string[],\n slots: readonly string[],\n ): DoomWebComposition | undefined {\n const id = sha256(`plugins:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory);\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} web composition.`);\n const previous = mounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const signedPaths = new Set(published.signed.manifest.assets.map((asset) => asset.path));\n const composition: DoomWebComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n verifiedAssetBaseUrl: `/verified-plugins/${id}/${String(revision)}`,\n pluginEntries: slotPlugins(build, slots).map((plugin): [string, string] => [\n plugin.slot,\n absolute(plugin.entry),\n ]),\n assetPaths: mountAssetPaths(build, slots).filter((file) => signedPaths.has(file)),\n stylePaths: mountStylePaths(build, slots).filter((style) => signedPaths.has(style)),\n channels: [...channels],\n plugins: [...slots],\n };\n mounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n get: (mount: DoomApiMount) => mounts.get(keyOf(mount)),\n remove: (mount: DoomApiMount) => {\n const previous = mounts.get(keyOf(mount));\n mounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Publishes the native composition for one mount. Signed under the `native` profile, so it can\n * never be served or verified as a web bundle. Shares reference counting with web publications.\n */\n publishNative(\n mount: DoomApiMount,\n build: GlobalNativeBuild,\n channels: readonly string[],\n pluginIds: readonly string[],\n ): DoomNativeComposition {\n const id = sha256(`native:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory, 'native');\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} native composition.`);\n const previous = nativeMounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const composition: DoomNativeComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n entryPath: NATIVE_ENTRY_PATH,\n channels: [...channels],\n plugins: [...pluginIds],\n };\n nativeMounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n getNative: (mount: DoomApiMount) => nativeMounts.get(keyOf(mount)),\n removeNative: (mount: DoomApiMount) => {\n const previous = nativeMounts.get(keyOf(mount));\n nativeMounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Signs `po/host-channel-key/v1` with the shell publication's signer, the key the pairing QR pins\n * as `s`. Undefined until the shell is published.\n */\n attestHost: (fields: readonly string[]): string | undefined =>\n shell === undefined ? undefined : publication.attest(HOST_CHANNEL_KEY_TAG, fields),\n publicKey: () => publication.publicKey(),\n async request(request: Request): Promise<Response | undefined> {\n const url = new URL(request.url);\n if (\n (url.pathname === '/bundle-manifest.json' || url.pathname.startsWith('/bundle-assets/')) &&\n request.method !== 'GET' &&\n request.method !== 'HEAD'\n )\n return new Response(null, { status: 405 });\n if (url.pathname === '/bundle-manifest.json') {\n if (!shell) return new Response(null, { status: 404 });\n return Response.json(shell.signed);\n }\n const shellAsset = /^\\/bundle-assets\\/(\\d+)(\\/.*)$/u.exec(url.pathname);\n if (shellAsset) {\n if (!shell || Number(shellAsset[1]) !== shell.signed.manifest.revision)\n return new Response(null, { status: 404 });\n const asset = shell.signed.manifest.assets.find((entry) => entry.path === shellAsset[2]);\n if (!asset) return new Response(null, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(shell.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: { 'content-type': asset.contentType, 'x-content-type-options': 'nosniff' },\n });\n }\n const match = /^\\/api\\/web-plugins\\/([a-f0-9]{64})\\/(\\d+)\\/(manifest|assets(?:\\/.*)?)$/u.exec(url.pathname);\n if (!match) return undefined;\n if (request.method !== 'GET' && request.method !== 'HEAD') return new Response(null, { status: 405 });\n const bundle = publication.get(match[1], Number(match[2]));\n if (!bundle) return Response.json({ error: 'Plugin generation not found.' }, { status: 404 });\n if (match[3] === 'manifest') return Response.json(bundle.signed);\n const assetPath = match[3].slice('assets'.length);\n const asset = bundle.signed.manifest.assets.find((candidate) => candidate.path === assetPath);\n if (!asset) return Response.json({ error: 'Plugin asset not found.' }, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(bundle.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: {\n 'content-type': asset.contentType,\n 'cache-control': 'private, max-age=31536000, immutable',\n 'x-content-type-options': 'nosniff',\n },\n });\n },\n close() {\n mounts.clear();\n nativeMounts.clear();\n references.clear();\n publication.close();\n },\n };\n}\n"],"mappings":";;;;;;;AAiDA,MAAM,YAAY,SAA0B,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI;;AAG9E,SAAS,YAAY,OAAuB,OAAkD;CAC5F,OAAO,MAAM,SAAS,SAAS,MAAM,Q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AAQ,IAAI,CAAC;GACpG,MAAM,SAAS,YAAY,IAAI,MAAM,IAAI,OAAO,MAAM,EAAE,CAAC;GACzD,IAAI,CAAC,QAAQ,OAAO,SAAS,KAAK,EAAE,OAAO,+BAA+B,GAAG,EAAE,QAAQ,IAAI,CAAC;GAC5F,IAAI,MAAM,OAAO,YAAY,OAAO,SAAS,KAAK,OAAO,MAAM;GAC/D,MAAM,YAAY,MAAM,EAAE,CAAC,MAAM,CAAe;GAChD,MAAM,QAAQ,OAAO,OAAO,SAAS,OAAO,MAAM,cAAc,UAAU,SAAS,SAAS;GAC5F,IAAI,CAAC,OAAO,OAAO,SAAS,KAAK,EAAE,OAAO,0BAA0B,GAAG,EAAE,QAAQ,IAAI,CAAC;GACtF,MAAM,QAAQ,MAAM,GAAG,SAAS,SAAS,KAAK,KAAK,OAAO,WAAW,MAAM,IAAI,CAAC;GAChF,OAAO,IAAI,SAAS,QAAQ,WAAW,SAAS,OAAO,OAAO,EAC5D,SAAS;IACP,gBAAgB,MAAM;IACtB,iBAAiB;IACjB,0BAA0B;GAC5B,EACF,CAAC;EACH;EACA,QAAQ;GACN,OAAO,MAAM;GACb,aAAa,MAAM;GACnB,WAAW,MAAM;GACjB,YAAY,MAAM;EACpB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"webCompositions.mjs","names":[],"sources":["../src/services/webCompositions/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\n\nimport { HOST_CHANNEL_KEY_TAG } from '../../constants/remote';\nimport type { PoApiMount, PoNativeComposition, PoWebComposition } from '../../exports/packageApi';\nimport { createPluginBundlePublication, type PublishedBundle } from '../bundlePublication';\n\n/** One plugin copy in a global web build: its slot entry and the files that entry can load. */\nexport interface GlobalWebBuildPlugin {\n pluginId: string;\n /** The copy's identity: the pluginId for a host plugin, else the pluginId plus a package hash. */\n slot: string;\n packageDir: string;\n isHost: boolean;\n /** The slot entry module below `pluginsDirectory`. */\n entry: string;\n /** Every file below `pluginsDirectory` the entry reaches through static and dynamic imports, plus its stylesheet. */\n files: readonly string[];\n /** The stylesheets of the entry's static import closure. */\n css: readonly string[];\n}\n\n/** One global web build: the shell, the shared plugin composition, and one stylesheet per plugin copy. */\nexport interface GlobalWebBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Signed cockpit shell directory. */\n webDirectory: string;\n /** Shared plugin composition directory, published once for every mount. */\n pluginsDirectory: string;\n /** Every plugin copy in the build, in build order. */\n plugins: readonly GlobalWebBuildPlugin[];\n /** Content-hashed stylesheet paths below `pluginsDirectory`, keyed by slot. */\n pluginStyles: Readonly<Record<string, string>>;\n /** Stylesheet a mount without plugin styles still loads, for the host shell and fallback template. */\n baseStyle?: string;\n}\n\n/** One global native build: a single signed CommonJS composition shared by every mount. */\nexport interface GlobalNativeBuild {\n /** Content key of the build; equal keys hold identical bytes. */\n key: string;\n /** Directory holding exactly `/composition.js`. */\n pluginsDirectory: string;\n}\n\nconst absolute = (file: string): string => (file.startsWith('/') ? file : `/${file}`);\n\n/** The build's plugin copies for exactly the given slots, in slot order. */\nfunction slotPlugins(build: GlobalWebBuild, slots: readonly string[]): GlobalWebBuildPlugin[] {\n return slots.flatMap((slot) => build.plugins.filter((plugin) => plugin.slot === slot));\n}\n\n/**\n * The stylesheets of exactly the given slots, each loaded once: the stylesheets their code\n * imports first, then each slot's own stylesheet in slot order.\n */\nexport function mountStylePaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n const paths = slots.map((slot) => build.pluginStyles[slot]).filter((style) => style !== undefined);\n if (paths.length === 0 && build.baseStyle !== undefined) paths.push(build.baseStyle);\n const imported = slotPlugins(build, slots).flatMap((plugin) => plugin.css);\n return [...new Set([...imported, ...paths].map(absolute))];\n}\n\n/** Every file the given slots can load: their reachable files and static stylesheets, each once. */\nexport function mountAssetPaths(build: GlobalWebBuild, slots: readonly string[]): string[] {\n return [\n ...new Set(\n slotPlugins(build, slots)\n .flatMap((plugin) => [...plugin.files, ...plugin.css])\n .map(absolute),\n ),\n ];\n}\n\nconst sha256 = (value: string): string => crypto.createHash('sha256').update(value).digest('hex');\n\n/**\n * Signs the global build once and hands each mount a composition naming its own plugins.\n *\n * Every mount of one build shares a publication id, so the bytes are counted per mount and\n * released only when the last mount leaves or moves to another build.\n */\nexport function createWebCompositions(stateDirectory: string, onNotice: (message: string) => void) {\n const publication = createPluginBundlePublication(stateDirectory, onNotice);\n let shell: PublishedBundle | undefined;\n const mounts = new Map<string, PoWebComposition>();\n const nativeMounts = new Map<string, PoNativeComposition>();\n const references = new Map<string, number>();\n const keyOf = (mount: PoApiMount): string =>\n mount.scope === 'global'\n ? 'global'\n : mount.scope === 'workspace'\n ? `workspace:${mount.workspaceId}`\n : `session:${mount.sessionId}`;\n const release = (id: string): void => {\n const count = (references.get(id) ?? 0) - 1;\n if (count > 0) {\n references.set(id, count);\n return;\n }\n references.delete(id);\n publication.release(id);\n };\n return {\n publishShell(build: GlobalWebBuild): void {\n shell = publication.publish(sha256(`shell:${build.key}`), build.webDirectory);\n if (!shell) throw new Error('Could not publish the global web shell.');\n },\n shellTrust: () =>\n shell === undefined ? undefined : { publicKey: shell.signed.publicKey, revision: shell.signed.manifest.revision },\n publish(\n mount: PoApiMount,\n build: GlobalWebBuild,\n channels: readonly string[],\n slots: readonly string[],\n ): PoWebComposition | undefined {\n const id = sha256(`plugins:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory);\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} web composition.`);\n const previous = mounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const signedPaths = new Set(published.signed.manifest.assets.map((asset) => asset.path));\n const composition: PoWebComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n verifiedAssetBaseUrl: `/verified-plugins/${id}/${String(revision)}`,\n pluginEntries: slotPlugins(build, slots).map((plugin): [string, string] => [\n plugin.slot,\n absolute(plugin.entry),\n ]),\n assetPaths: mountAssetPaths(build, slots).filter((file) => signedPaths.has(file)),\n stylePaths: mountStylePaths(build, slots).filter((style) => signedPaths.has(style)),\n channels: [...channels],\n plugins: [...slots],\n };\n mounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n get: (mount: PoApiMount) => mounts.get(keyOf(mount)),\n remove: (mount: PoApiMount) => {\n const previous = mounts.get(keyOf(mount));\n mounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Publishes the native composition for one mount. Signed under the `native` profile, so it can\n * never be served or verified as a web bundle. Shares reference counting with web publications.\n */\n publishNative(\n mount: PoApiMount,\n build: GlobalNativeBuild,\n channels: readonly string[],\n pluginIds: readonly string[],\n ): PoNativeComposition {\n const id = sha256(`native:${build.key}`);\n const published = publication.publish(id, build.pluginsDirectory, 'native');\n if (!published) throw new Error(`Could not publish ${keyOf(mount)} native composition.`);\n const previous = nativeMounts.get(keyOf(mount));\n if (previous?.id !== id) references.set(id, (references.get(id) ?? 0) + 1);\n const revision = published.signed.manifest.revision;\n const base = `/api/web-plugins/${id}/${String(revision)}`;\n const composition: PoNativeComposition = {\n id,\n scope: mount.scope,\n revision,\n manifestUrl: `${base}/manifest`,\n rawAssetBaseUrl: `${base}/assets`,\n entryPath: NATIVE_ENTRY_PATH,\n channels: [...channels],\n plugins: [...pluginIds],\n };\n nativeMounts.set(keyOf(mount), composition);\n if (previous !== undefined && previous.id !== id) release(previous.id);\n return composition;\n },\n getNative: (mount: PoApiMount) => nativeMounts.get(keyOf(mount)),\n removeNative: (mount: PoApiMount) => {\n const previous = nativeMounts.get(keyOf(mount));\n nativeMounts.delete(keyOf(mount));\n if (previous) release(previous.id);\n },\n /**\n * Signs `po/host-channel-key/v1` with the shell publication's signer, the key the pairing QR pins\n * as `s`. Undefined until the shell is published.\n */\n attestHost: (fields: readonly string[]): string | undefined =>\n shell === undefined ? undefined : publication.attest(HOST_CHANNEL_KEY_TAG, fields),\n publicKey: () => publication.publicKey(),\n async request(request: Request): Promise<Response | undefined> {\n const url = new URL(request.url);\n if (\n (url.pathname === '/bundle-manifest.json' || url.pathname.startsWith('/bundle-assets/')) &&\n request.method !== 'GET' &&\n request.method !== 'HEAD'\n )\n return new Response(null, { status: 405 });\n if (url.pathname === '/bundle-manifest.json') {\n if (!shell) return new Response(null, { status: 404 });\n return Response.json(shell.signed);\n }\n const shellAsset = /^\\/bundle-assets\\/(\\d+)(\\/.*)$/u.exec(url.pathname);\n if (shellAsset) {\n if (!shell || Number(shellAsset[1]) !== shell.signed.manifest.revision)\n return new Response(null, { status: 404 });\n const asset = shell.signed.manifest.assets.find((entry) => entry.path === shellAsset[2]);\n if (!asset) return new Response(null, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(shell.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: { 'content-type': asset.contentType, 'x-content-type-options': 'nosniff' },\n });\n }\n const match = /^\\/api\\/web-plugins\\/([a-f0-9]{64})\\/(\\d+)\\/(manifest|assets(?:\\/.*)?)$/u.exec(url.pathname);\n if (!match) return undefined;\n if (request.method !== 'GET' && request.method !== 'HEAD') return new Response(null, { status: 405 });\n const bundle = publication.get(match[1], Number(match[2]));\n if (!bundle) return Response.json({ error: 'Plugin generation not found.' }, { status: 404 });\n if (match[3] === 'manifest') return Response.json(bundle.signed);\n const assetPath = match[3].slice('assets'.length);\n const asset = bundle.signed.manifest.assets.find((candidate) => candidate.path === assetPath);\n if (!asset) return Response.json({ error: 'Plugin asset not found.' }, { status: 404 });\n const bytes = await fs.promises.readFile(path.join(bundle.assetsDir, asset.path));\n return new Response(request.method === 'HEAD' ? null : bytes, {\n headers: {\n 'content-type': asset.contentType,\n 'cache-control': 'private, max-age=31536000, immutable',\n 'x-content-type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