@agimon-ai/doompi-core 0.0.1-alpha.100
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 +21 -0
- package/README.md +5 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/agentModel.cjs +4 -0
- package/dist/agentModel.d.mts +2 -0
- package/dist/agentModel.mjs +2 -0
- package/dist/apiContracts.cjs +2009 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +1018 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +1989 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/askUser.cjs +8 -0
- package/dist/askUser.d.mts +2 -0
- package/dist/askUser.mjs +2 -0
- package/dist/authorTools.cjs +5 -0
- package/dist/authorTools.d.mts +2 -0
- package/dist/authorTools.mjs +2 -0
- package/dist/backgroundWork.cjs +7 -0
- package/dist/backgroundWork.d.mts +2 -0
- package/dist/backgroundWork.mjs +2 -0
- package/dist/bundleAssetPolicy.cjs +5 -0
- package/dist/bundleAssetPolicy.d.mts +2 -0
- package/dist/bundleAssetPolicy.mjs +2 -0
- package/dist/childProcess.cjs +15 -0
- package/dist/childProcess.d.mts +2 -0
- package/dist/childProcess.mjs +2 -0
- package/dist/childSession.cjs +8 -0
- package/dist/childSession.d.mts +3 -0
- package/dist/childSession.mjs +3 -0
- package/dist/cockpitContainer.cjs +4 -0
- package/dist/cockpitContainer.d.mts +2 -0
- package/dist/cockpitContainer.mjs +2 -0
- package/dist/config.cjs +13 -0
- package/dist/config.d.mts +3 -0
- package/dist/config.mjs +2 -0
- package/dist/contextApi.cjs +10 -0
- package/dist/contextApi.d.mts +4 -0
- package/dist/contextApi.mjs +3 -0
- package/dist/contextContributions.cjs +7 -0
- package/dist/contextContributions.d.mts +3 -0
- package/dist/contextContributions.mjs +3 -0
- package/dist/contextDetail.cjs +65 -0
- package/dist/contextDetail.cjs.map +1 -0
- package/dist/contextDetail.d.mts +19 -0
- package/dist/contextDetail.d.mts.map +1 -0
- package/dist/contextDetail.mjs +64 -0
- package/dist/contextDetail.mjs.map +1 -0
- package/dist/contextDetailStore.cjs +100 -0
- package/dist/contextDetailStore.cjs.map +1 -0
- package/dist/contextDetailStore.d.mts +19 -0
- package/dist/contextDetailStore.d.mts.map +1 -0
- package/dist/contextDetailStore.mjs +91 -0
- package/dist/contextDetailStore.mjs.map +1 -0
- package/dist/contextProjection.cjs +121 -0
- package/dist/contextProjection.cjs.map +1 -0
- package/dist/contextProjection.d.mts +130 -0
- package/dist/contextProjection.d.mts.map +1 -0
- package/dist/contextProjection.mjs +117 -0
- package/dist/contextProjection.mjs.map +1 -0
- package/dist/cordisHost.cjs +11 -0
- package/dist/cordisHost.d.mts +2 -0
- package/dist/cordisHost.mjs +2 -0
- package/dist/delegation.cjs +18 -0
- package/dist/delegation.d.mts +2 -0
- package/dist/delegation.mjs +2 -0
- package/dist/doomPackage.cjs +61 -0
- package/dist/doomPackage.cjs.map +1 -0
- package/dist/doomPackage.d.mts +17 -0
- package/dist/doomPackage.d.mts.map +1 -0
- package/dist/doomPackage.mjs +54 -0
- package/dist/doomPackage.mjs.map +1 -0
- package/dist/executionBudget.cjs +231 -0
- package/dist/executionBudget.cjs.map +1 -0
- package/dist/executionBudget.d.mts +11 -0
- package/dist/executionBudget.d.mts.map +1 -0
- package/dist/executionBudget.mjs +225 -0
- package/dist/executionBudget.mjs.map +1 -0
- package/dist/extensionFile.cjs +24 -0
- package/dist/extensionFile.d.mts +3 -0
- package/dist/extensionFile.mjs +2 -0
- package/dist/footer.cjs +6 -0
- package/dist/footer.d.mts +2 -0
- package/dist/footer.mjs +2 -0
- package/dist/headless.cjs +9 -0
- package/dist/headless.d.mts +2 -0
- package/dist/headless.mjs +2 -0
- package/dist/headlessHub.cjs +914 -0
- package/dist/headlessHub.cjs.map +1 -0
- package/dist/headlessHub.d.mts +157 -0
- package/dist/headlessHub.d.mts.map +1 -0
- package/dist/headlessHub.mjs +911 -0
- package/dist/headlessHub.mjs.map +1 -0
- package/dist/headlessServer.cjs +910 -0
- package/dist/headlessServer.cjs.map +1 -0
- package/dist/headlessServer.d.mts +64 -0
- package/dist/headlessServer.d.mts.map +1 -0
- package/dist/headlessServer.mjs +904 -0
- package/dist/headlessServer.mjs.map +1 -0
- package/dist/headlessSessionHost.cjs +0 -0
- package/dist/headlessSessionHost.d.mts +71 -0
- package/dist/headlessSessionHost.d.mts.map +1 -0
- package/dist/headlessSessionHost.mjs +1 -0
- package/dist/headlessSessionManager.cjs +51 -0
- package/dist/headlessSessionManager.cjs.map +1 -0
- package/dist/headlessSessionManager.d.mts +6 -0
- package/dist/headlessSessionManager.d.mts.map +1 -0
- package/dist/headlessSessionManager.mjs +50 -0
- package/dist/headlessSessionManager.mjs.map +1 -0
- package/dist/help.cjs +24 -0
- package/dist/help.d.mts +3 -0
- package/dist/help.mjs +3 -0
- package/dist/history.cjs +25 -0
- package/dist/history.d.mts +10 -0
- package/dist/history.mjs +10 -0
- package/dist/historyImport.cjs +553 -0
- package/dist/historyImport.cjs.map +1 -0
- package/dist/historyImport.d.mts +76 -0
- package/dist/historyImport.d.mts.map +1 -0
- package/dist/historyImport.mjs +547 -0
- package/dist/historyImport.mjs.map +1 -0
- package/dist/historyOwnership.cjs +253 -0
- package/dist/historyOwnership.cjs.map +1 -0
- package/dist/historyOwnership.d.mts +23 -0
- package/dist/historyOwnership.d.mts.map +1 -0
- package/dist/historyOwnership.mjs +247 -0
- package/dist/historyOwnership.mjs.map +1 -0
- package/dist/hubChannel.cjs +4 -0
- package/dist/hubChannel.d.mts +2 -0
- package/dist/hubChannel.mjs +2 -0
- package/dist/index.cjs +44 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +6 -0
- package/dist/json.cjs +6 -0
- package/dist/json.d.mts +2 -0
- package/dist/json.mjs +2 -0
- package/dist/jsonlSessionRepo.cjs +217 -0
- package/dist/jsonlSessionRepo.cjs.map +1 -0
- package/dist/jsonlSessionRepo.d.mts +7 -0
- package/dist/jsonlSessionRepo.d.mts.map +1 -0
- package/dist/jsonlSessionRepo.mjs +212 -0
- package/dist/jsonlSessionRepo.mjs.map +1 -0
- package/dist/kernel.cjs +3 -0
- package/dist/kernel.d.mts +3 -0
- package/dist/kernel.mjs +2 -0
- package/dist/leader.cjs +9 -0
- package/dist/leader.d.mts +2 -0
- package/dist/leader.mjs +2 -0
- package/dist/logSinkTelemetry.cjs +5 -0
- package/dist/logSinkTelemetry.d.mts +2 -0
- package/dist/logSinkTelemetry.mjs +2 -0
- package/dist/machineApi.cjs +92 -0
- package/dist/machineApi.cjs.map +1 -0
- package/dist/machineApi.d.mts +7 -0
- package/dist/machineApi.d.mts.map +1 -0
- package/dist/machineApi.mjs +88 -0
- package/dist/machineApi.mjs.map +1 -0
- package/dist/main.cjs +11 -0
- package/dist/main.d.mts +5 -0
- package/dist/main.mjs +4 -0
- package/dist/mcpFacet.cjs +12 -0
- package/dist/mcpFacet.d.mts +4 -0
- package/dist/mcpFacet.mjs +4 -0
- package/dist/mcpProjection.cjs +16 -0
- package/dist/mcpProjection.d.mts +2 -0
- package/dist/mcpProjection.mjs +2 -0
- package/dist/mcpSchemaCost.cjs +195 -0
- package/dist/mcpSchemaCost.cjs.map +1 -0
- package/dist/mcpSchemaCost.d.mts +35 -0
- package/dist/mcpSchemaCost.d.mts.map +1 -0
- package/dist/mcpSchemaCost.mjs +190 -0
- package/dist/mcpSchemaCost.mjs.map +1 -0
- package/dist/mcpSession.cjs +9 -0
- package/dist/mcpSession.d.mts +2 -0
- package/dist/mcpSession.mjs +2 -0
- package/dist/mcpStatus.cjs +7 -0
- package/dist/mcpStatus.d.mts +2 -0
- package/dist/mcpStatus.mjs +2 -0
- package/dist/mcpToolResolver.cjs +5 -0
- package/dist/mcpToolResolver.d.mts +2 -0
- package/dist/mcpToolResolver.mjs +2 -0
- package/dist/mcpWidget.cjs +0 -0
- package/dist/mcpWidget.d.mts +2 -0
- package/dist/mcpWidget.mjs +1 -0
- package/dist/moduleResolution.cjs +405 -0
- package/dist/moduleResolution.cjs.map +1 -0
- package/dist/moduleResolution.d.mts +67 -0
- package/dist/moduleResolution.d.mts.map +1 -0
- package/dist/moduleResolution.mjs +389 -0
- package/dist/moduleResolution.mjs.map +1 -0
- package/dist/narration.cjs +10 -0
- package/dist/narration.d.mts +2 -0
- package/dist/narration.mjs +2 -0
- package/dist/notification.cjs +17 -0
- package/dist/notification.d.mts +2 -0
- package/dist/notification.mjs +2 -0
- package/dist/packageApi.cjs +16 -0
- package/dist/packageApi.d.mts +3 -0
- package/dist/packageApi.mjs +3 -0
- package/dist/packageApiServer.cjs +191 -0
- package/dist/packageApiServer.cjs.map +1 -0
- package/dist/packageApiServer.d.mts +57 -0
- package/dist/packageApiServer.d.mts.map +1 -0
- package/dist/packageApiServer.mjs +189 -0
- package/dist/packageApiServer.mjs.map +1 -0
- package/dist/piExtension.cjs +13 -0
- package/dist/piExtension.d.mts +5 -0
- package/dist/piExtension.mjs +4 -0
- package/dist/piSettings.cjs +12 -0
- package/dist/piSettings.d.mts +2 -0
- package/dist/piSettings.mjs +2 -0
- package/dist/pluginProtocol.cjs +10 -0
- package/dist/pluginProtocol.d.mts +2 -0
- package/dist/pluginProtocol.mjs +2 -0
- package/dist/profileIdentity.cjs +6 -0
- package/dist/profileIdentity.d.mts +2 -0
- package/dist/profileIdentity.mjs +2 -0
- package/dist/protocol.cjs +10 -0
- package/dist/protocol.d.mts +2 -0
- package/dist/protocol.mjs +2 -0
- package/dist/readiness.cjs +8 -0
- package/dist/readiness.d.mts +2 -0
- package/dist/readiness.mjs +2 -0
- package/dist/relaunchHandoff.cjs +6 -0
- package/dist/relaunchHandoff.d.mts +2 -0
- package/dist/relaunchHandoff.mjs +2 -0
- package/dist/remoteApi.cjs +42 -0
- package/dist/remoteApi.cjs.map +1 -0
- package/dist/remoteApi.d.mts +7 -0
- package/dist/remoteApi.d.mts.map +1 -0
- package/dist/remoteApi.mjs +41 -0
- package/dist/remoteApi.mjs.map +1 -0
- package/dist/remoteRuntime.cjs +460 -0
- package/dist/remoteRuntime.cjs.map +1 -0
- package/dist/remoteRuntime.d.mts +28 -0
- package/dist/remoteRuntime.d.mts.map +1 -0
- package/dist/remoteRuntime.mjs +456 -0
- package/dist/remoteRuntime.mjs.map +1 -0
- package/dist/runtimeConfig.cjs +232 -0
- package/dist/runtimeConfig.cjs.map +1 -0
- package/dist/runtimeConfig.d.mts +313 -0
- package/dist/runtimeConfig.d.mts.map +1 -0
- package/dist/runtimeConfig.mjs +221 -0
- package/dist/runtimeConfig.mjs.map +1 -0
- package/dist/runtimeContextApi.cjs +64 -0
- package/dist/runtimeContextApi.cjs.map +1 -0
- package/dist/runtimeContextApi.d.mts +16 -0
- package/dist/runtimeContextApi.d.mts.map +1 -0
- package/dist/runtimeContextApi.mjs +62 -0
- package/dist/runtimeContextApi.mjs.map +1 -0
- package/dist/runtimeCordisHost.cjs +193 -0
- package/dist/runtimeCordisHost.cjs.map +1 -0
- package/dist/runtimeCordisHost.d.mts +63 -0
- package/dist/runtimeCordisHost.d.mts.map +1 -0
- package/dist/runtimeCordisHost.mjs +184 -0
- package/dist/runtimeCordisHost.mjs.map +1 -0
- package/dist/runtimeHeadlessSessionManager.cjs +0 -0
- package/dist/runtimeHeadlessSessionManager.d.mts +18 -0
- package/dist/runtimeHeadlessSessionManager.d.mts.map +1 -0
- package/dist/runtimeHeadlessSessionManager.mjs +1 -0
- package/dist/runtimeIdentity.cjs +26 -0
- package/dist/runtimeIdentity.cjs.map +1 -0
- package/dist/runtimeIdentity.d.mts +7 -0
- package/dist/runtimeIdentity.d.mts.map +1 -0
- package/dist/runtimeIdentity.mjs +21 -0
- package/dist/runtimeIdentity.mjs.map +1 -0
- package/dist/runtimeJson.cjs +46 -0
- package/dist/runtimeJson.cjs.map +1 -0
- package/dist/runtimeJson.d.mts +22 -0
- package/dist/runtimeJson.d.mts.map +1 -0
- package/dist/runtimeJson.mjs +39 -0
- package/dist/runtimeJson.mjs.map +1 -0
- package/dist/runtimeLogSinkTelemetry.cjs +102 -0
- package/dist/runtimeLogSinkTelemetry.cjs.map +1 -0
- package/dist/runtimeLogSinkTelemetry.d.mts +49 -0
- package/dist/runtimeLogSinkTelemetry.d.mts.map +1 -0
- package/dist/runtimeLogSinkTelemetry.mjs +99 -0
- package/dist/runtimeLogSinkTelemetry.mjs.map +1 -0
- package/dist/runtimePiExtension.cjs +339 -0
- package/dist/runtimePiExtension.cjs.map +1 -0
- package/dist/runtimePiExtension.d.mts +160 -0
- package/dist/runtimePiExtension.d.mts.map +1 -0
- package/dist/runtimePiExtension.mjs +333 -0
- package/dist/runtimePiExtension.mjs.map +1 -0
- package/dist/runtimePiSettings.cjs +116 -0
- package/dist/runtimePiSettings.cjs.map +1 -0
- package/dist/runtimePiSettings.d.mts +29 -0
- package/dist/runtimePiSettings.d.mts.map +1 -0
- package/dist/runtimePiSettings.mjs +103 -0
- package/dist/runtimePiSettings.mjs.map +1 -0
- package/dist/runtimeProtocol.cjs +223 -0
- package/dist/runtimeProtocol.cjs.map +1 -0
- package/dist/runtimeProtocol.d.mts +84 -0
- package/dist/runtimeProtocol.d.mts.map +1 -0
- package/dist/runtimeProtocol.mjs +215 -0
- package/dist/runtimeProtocol.mjs.map +1 -0
- package/dist/runtimeToolNames.cjs +51 -0
- package/dist/runtimeToolNames.cjs.map +1 -0
- package/dist/runtimeToolNames.d.mts +24 -0
- package/dist/runtimeToolNames.d.mts.map +1 -0
- package/dist/runtimeToolNames.mjs +49 -0
- package/dist/runtimeToolNames.mjs.map +1 -0
- package/dist/runtimeTransition.cjs +27 -0
- package/dist/runtimeTransition.cjs.map +1 -0
- package/dist/runtimeTransition.d.mts +114 -0
- package/dist/runtimeTransition.d.mts.map +1 -0
- package/dist/runtimeTransition.mjs +24 -0
- package/dist/runtimeTransition.mjs.map +1 -0
- package/dist/sandboxHarness.cjs +6 -0
- package/dist/sandboxHarness.d.mts +2 -0
- package/dist/sandboxHarness.mjs +2 -0
- package/dist/server.cjs +17 -0
- package/dist/server.d.mts +10 -0
- package/dist/server.mjs +7 -0
- package/dist/serverFacet.cjs +30 -0
- package/dist/serverFacet.d.mts +8 -0
- package/dist/serverFacet.mjs +8 -0
- package/dist/serverTelemetry.cjs +25 -0
- package/dist/serverTelemetry.cjs.map +1 -0
- package/dist/serverTelemetry.d.mts +12 -0
- package/dist/serverTelemetry.d.mts.map +1 -0
- package/dist/serverTelemetry.mjs +23 -0
- package/dist/serverTelemetry.mjs.map +1 -0
- package/dist/sessionFilesApi.cjs +96 -0
- package/dist/sessionFilesApi.cjs.map +1 -0
- package/dist/sessionFilesApi.d.mts +7 -0
- package/dist/sessionFilesApi.d.mts.map +1 -0
- package/dist/sessionFilesApi.mjs +91 -0
- package/dist/sessionFilesApi.mjs.map +1 -0
- package/dist/sessionMcp.cjs +6 -0
- package/dist/sessionMcp.d.mts +5 -0
- package/dist/sessionMcp.mjs +3 -0
- package/dist/sessionProtocol.cjs +8 -0
- package/dist/sessionProtocol.d.mts +3 -0
- package/dist/sessionProtocol.mjs +2 -0
- package/dist/skills.cjs +9 -0
- package/dist/skills.d.mts +2 -0
- package/dist/skills.mjs +2 -0
- package/dist/sqliteHistoryImport.cjs +151 -0
- package/dist/sqliteHistoryImport.cjs.map +1 -0
- package/dist/sqliteHistoryImport.d.mts +8 -0
- package/dist/sqliteHistoryImport.d.mts.map +1 -0
- package/dist/sqliteHistoryImport.mjs +146 -0
- package/dist/sqliteHistoryImport.mjs.map +1 -0
- package/dist/sqliteSessionStorage.cjs +53 -0
- package/dist/sqliteSessionStorage.cjs.map +1 -0
- package/dist/sqliteSessionStorage.d.mts +7 -0
- package/dist/sqliteSessionStorage.d.mts.map +1 -0
- package/dist/sqliteSessionStorage.mjs +49 -0
- package/dist/sqliteSessionStorage.mjs.map +1 -0
- package/dist/src/constants/authorTools.cjs +10 -0
- package/dist/src/constants/authorTools.cjs.map +1 -0
- package/dist/src/constants/authorTools.d.mts +6 -0
- package/dist/src/constants/authorTools.d.mts.map +1 -0
- package/dist/src/constants/authorTools.mjs +8 -0
- package/dist/src/constants/authorTools.mjs.map +1 -0
- package/dist/src/constants/contextApi.cjs +28 -0
- package/dist/src/constants/contextApi.cjs.map +1 -0
- package/dist/src/constants/contextApi.d.mts +21 -0
- package/dist/src/constants/contextApi.d.mts.map +1 -0
- package/dist/src/constants/contextApi.mjs +23 -0
- package/dist/src/constants/contextApi.mjs.map +1 -0
- package/dist/src/constants/remote.cjs +90 -0
- package/dist/src/constants/remote.cjs.map +1 -0
- package/dist/src/constants/remote.mjs +69 -0
- package/dist/src/constants/remote.mjs.map +1 -0
- package/dist/src/constants/voiceReloadHandoff.cjs +12 -0
- package/dist/src/constants/voiceReloadHandoff.cjs.map +1 -0
- package/dist/src/constants/voiceReloadHandoff.d.mts +7 -0
- package/dist/src/constants/voiceReloadHandoff.d.mts.map +1 -0
- package/dist/src/constants/voiceReloadHandoff.mjs +9 -0
- package/dist/src/constants/voiceReloadHandoff.mjs.map +1 -0
- package/dist/src/constants/voiceTools.cjs +96 -0
- package/dist/src/constants/voiceTools.cjs.map +1 -0
- package/dist/src/constants/voiceTools.d.mts +58 -0
- package/dist/src/constants/voiceTools.d.mts.map +1 -0
- package/dist/src/constants/voiceTools.mjs +60 -0
- package/dist/src/constants/voiceTools.mjs.map +1 -0
- package/dist/src/extensions/extensionFile.cjs +165 -0
- package/dist/src/extensions/extensionFile.cjs.map +1 -0
- package/dist/src/extensions/extensionFile.d.mts +79 -0
- package/dist/src/extensions/extensionFile.d.mts.map +1 -0
- package/dist/src/extensions/extensionFile.mjs +144 -0
- package/dist/src/extensions/extensionFile.mjs.map +1 -0
- package/dist/src/extensions/serverPlugin.cjs +106 -0
- package/dist/src/extensions/serverPlugin.cjs.map +1 -0
- package/dist/src/extensions/serverPlugin.d.mts +5 -0
- package/dist/src/extensions/serverPlugin.d.mts.map +1 -0
- package/dist/src/extensions/serverPlugin.mjs +106 -0
- package/dist/src/extensions/serverPlugin.mjs.map +1 -0
- package/dist/src/extensions/webPlugin.cjs +131 -0
- package/dist/src/extensions/webPlugin.cjs.map +1 -0
- package/dist/src/extensions/webPlugin.d.mts +66 -0
- package/dist/src/extensions/webPlugin.d.mts.map +1 -0
- package/dist/src/extensions/webPlugin.mjs +110 -0
- package/dist/src/extensions/webPlugin.mjs.map +1 -0
- package/dist/src/pi/piSessionRuntime.cjs +572 -0
- package/dist/src/pi/piSessionRuntime.cjs.map +1 -0
- package/dist/src/pi/piSessionRuntime.d.mts +43 -0
- package/dist/src/pi/piSessionRuntime.d.mts.map +1 -0
- package/dist/src/pi/piSessionRuntime.mjs +571 -0
- package/dist/src/pi/piSessionRuntime.mjs.map +1 -0
- package/dist/src/pi/piWebSocketListener.cjs +115 -0
- package/dist/src/pi/piWebSocketListener.cjs.map +1 -0
- package/dist/src/pi/piWebSocketListener.mjs +115 -0
- package/dist/src/pi/piWebSocketListener.mjs.map +1 -0
- package/dist/src/schemas/agentModel.cjs +33 -0
- package/dist/src/schemas/agentModel.cjs.map +1 -0
- package/dist/src/schemas/agentModel.d.mts +26 -0
- package/dist/src/schemas/agentModel.d.mts.map +1 -0
- package/dist/src/schemas/agentModel.mjs +32 -0
- package/dist/src/schemas/agentModel.mjs.map +1 -0
- package/dist/src/schemas/apiContracts.d.mts +58 -0
- package/dist/src/schemas/apiContracts.d.mts.map +1 -0
- package/dist/src/schemas/askUser.cjs +42 -0
- package/dist/src/schemas/askUser.cjs.map +1 -0
- package/dist/src/schemas/askUser.d.mts +47 -0
- package/dist/src/schemas/askUser.d.mts.map +1 -0
- package/dist/src/schemas/askUser.mjs +37 -0
- package/dist/src/schemas/askUser.mjs.map +1 -0
- package/dist/src/schemas/backgroundWork.cjs +31 -0
- package/dist/src/schemas/backgroundWork.cjs.map +1 -0
- package/dist/src/schemas/backgroundWork.d.mts +72 -0
- package/dist/src/schemas/backgroundWork.d.mts.map +1 -0
- package/dist/src/schemas/backgroundWork.mjs +27 -0
- package/dist/src/schemas/backgroundWork.mjs.map +1 -0
- package/dist/src/schemas/childProcess.cjs +67 -0
- package/dist/src/schemas/childProcess.cjs.map +1 -0
- package/dist/src/schemas/childProcess.d.mts +30 -0
- package/dist/src/schemas/childProcess.d.mts.map +1 -0
- package/dist/src/schemas/childProcess.mjs +55 -0
- package/dist/src/schemas/childProcess.mjs.map +1 -0
- package/dist/src/schemas/cockpitContainer.cjs +31 -0
- package/dist/src/schemas/cockpitContainer.cjs.map +1 -0
- package/dist/src/schemas/cockpitContainer.d.mts +80 -0
- package/dist/src/schemas/cockpitContainer.d.mts.map +1 -0
- package/dist/src/schemas/cockpitContainer.mjs +30 -0
- package/dist/src/schemas/cockpitContainer.mjs.map +1 -0
- package/dist/src/schemas/contextContributions.cjs +17 -0
- package/dist/src/schemas/contextContributions.cjs.map +1 -0
- package/dist/src/schemas/contextContributions.d.mts +49 -0
- package/dist/src/schemas/contextContributions.d.mts.map +1 -0
- package/dist/src/schemas/contextContributions.mjs +15 -0
- package/dist/src/schemas/contextContributions.mjs.map +1 -0
- package/dist/src/schemas/delegation.cjs +91 -0
- package/dist/src/schemas/delegation.cjs.map +1 -0
- package/dist/src/schemas/delegation.d.mts +95 -0
- package/dist/src/schemas/delegation.d.mts.map +1 -0
- package/dist/src/schemas/delegation.mjs +76 -0
- package/dist/src/schemas/delegation.mjs.map +1 -0
- package/dist/src/schemas/extensionFile.d.mts +136 -0
- package/dist/src/schemas/extensionFile.d.mts.map +1 -0
- package/dist/src/schemas/footer.cjs +48 -0
- package/dist/src/schemas/footer.cjs.map +1 -0
- package/dist/src/schemas/footer.d.mts +48 -0
- package/dist/src/schemas/footer.d.mts.map +1 -0
- package/dist/src/schemas/footer.mjs +45 -0
- package/dist/src/schemas/footer.mjs.map +1 -0
- package/dist/src/schemas/headless.cjs +44 -0
- package/dist/src/schemas/headless.cjs.map +1 -0
- package/dist/src/schemas/headless.d.mts +370 -0
- package/dist/src/schemas/headless.d.mts.map +1 -0
- package/dist/src/schemas/headless.mjs +38 -0
- package/dist/src/schemas/headless.mjs.map +1 -0
- package/dist/src/schemas/help.cjs +281 -0
- package/dist/src/schemas/help.cjs.map +1 -0
- package/dist/src/schemas/help.d.mts +119 -0
- package/dist/src/schemas/help.d.mts.map +1 -0
- package/dist/src/schemas/help.mjs +262 -0
- package/dist/src/schemas/help.mjs.map +1 -0
- package/dist/src/schemas/hubChannel.cjs +20 -0
- package/dist/src/schemas/hubChannel.cjs.map +1 -0
- package/dist/src/schemas/hubChannel.d.mts +236 -0
- package/dist/src/schemas/hubChannel.d.mts.map +1 -0
- package/dist/src/schemas/hubChannel.mjs +19 -0
- package/dist/src/schemas/hubChannel.mjs.map +1 -0
- package/dist/src/schemas/leader.cjs +57 -0
- package/dist/src/schemas/leader.cjs.map +1 -0
- package/dist/src/schemas/leader.d.mts +107 -0
- package/dist/src/schemas/leader.d.mts.map +1 -0
- package/dist/src/schemas/leader.mjs +51 -0
- package/dist/src/schemas/leader.mjs.map +1 -0
- package/dist/src/schemas/mcpBundle.cjs +92 -0
- package/dist/src/schemas/mcpBundle.cjs.map +1 -0
- package/dist/src/schemas/mcpBundle.d.mts +33 -0
- package/dist/src/schemas/mcpBundle.d.mts.map +1 -0
- package/dist/src/schemas/mcpBundle.mjs +90 -0
- package/dist/src/schemas/mcpBundle.mjs.map +1 -0
- package/dist/src/schemas/mcpFacet.cjs +24 -0
- package/dist/src/schemas/mcpFacet.cjs.map +1 -0
- package/dist/src/schemas/mcpFacet.d.mts +91 -0
- package/dist/src/schemas/mcpFacet.d.mts.map +1 -0
- package/dist/src/schemas/mcpFacet.mjs +21 -0
- package/dist/src/schemas/mcpFacet.mjs.map +1 -0
- package/dist/src/schemas/mcpProjection.cjs +117 -0
- package/dist/src/schemas/mcpProjection.cjs.map +1 -0
- package/dist/src/schemas/mcpProjection.d.mts +124 -0
- package/dist/src/schemas/mcpProjection.d.mts.map +1 -0
- package/dist/src/schemas/mcpProjection.mjs +104 -0
- package/dist/src/schemas/mcpProjection.mjs.map +1 -0
- package/dist/src/schemas/mcpSession.cjs +57 -0
- package/dist/src/schemas/mcpSession.cjs.map +1 -0
- package/dist/src/schemas/mcpSession.d.mts +57 -0
- package/dist/src/schemas/mcpSession.d.mts.map +1 -0
- package/dist/src/schemas/mcpSession.mjs +51 -0
- package/dist/src/schemas/mcpSession.mjs.map +1 -0
- package/dist/src/schemas/mcpStatus.cjs +52 -0
- package/dist/src/schemas/mcpStatus.cjs.map +1 -0
- package/dist/src/schemas/mcpStatus.d.mts +73 -0
- package/dist/src/schemas/mcpStatus.d.mts.map +1 -0
- package/dist/src/schemas/mcpStatus.mjs +48 -0
- package/dist/src/schemas/mcpStatus.mjs.map +1 -0
- package/dist/src/schemas/mcpToolResolver.cjs +17 -0
- package/dist/src/schemas/mcpToolResolver.cjs.map +1 -0
- package/dist/src/schemas/mcpToolResolver.d.mts +24 -0
- package/dist/src/schemas/mcpToolResolver.d.mts.map +1 -0
- package/dist/src/schemas/mcpToolResolver.mjs +15 -0
- package/dist/src/schemas/mcpToolResolver.mjs.map +1 -0
- package/dist/src/schemas/narration.cjs +54 -0
- package/dist/src/schemas/narration.cjs.map +1 -0
- package/dist/src/schemas/narration.d.mts +29 -0
- package/dist/src/schemas/narration.d.mts.map +1 -0
- package/dist/src/schemas/narration.mjs +47 -0
- package/dist/src/schemas/narration.mjs.map +1 -0
- package/dist/src/schemas/notification.cjs +122 -0
- package/dist/src/schemas/notification.cjs.map +1 -0
- package/dist/src/schemas/notification.d.mts +48 -0
- package/dist/src/schemas/notification.d.mts.map +1 -0
- package/dist/src/schemas/notification.mjs +108 -0
- package/dist/src/schemas/notification.mjs.map +1 -0
- package/dist/src/schemas/packageApi.cjs +73 -0
- package/dist/src/schemas/packageApi.cjs.map +1 -0
- package/dist/src/schemas/packageApi.d.mts +249 -0
- package/dist/src/schemas/packageApi.d.mts.map +1 -0
- package/dist/src/schemas/packageApi.mjs +64 -0
- package/dist/src/schemas/packageApi.mjs.map +1 -0
- package/dist/src/schemas/piTool.cjs +26 -0
- package/dist/src/schemas/piTool.cjs.map +1 -0
- package/dist/src/schemas/piTool.d.mts +25 -0
- package/dist/src/schemas/piTool.d.mts.map +1 -0
- package/dist/src/schemas/piTool.mjs +26 -0
- package/dist/src/schemas/piTool.mjs.map +1 -0
- package/dist/src/schemas/pluginContributions.cjs +19 -0
- package/dist/src/schemas/pluginContributions.cjs.map +1 -0
- package/dist/src/schemas/pluginContributions.d.mts +56 -0
- package/dist/src/schemas/pluginContributions.d.mts.map +1 -0
- package/dist/src/schemas/pluginContributions.mjs +18 -0
- package/dist/src/schemas/pluginContributions.mjs.map +1 -0
- package/dist/src/schemas/pluginProtocol.cjs +103 -0
- package/dist/src/schemas/pluginProtocol.cjs.map +1 -0
- package/dist/src/schemas/pluginProtocol.d.mts +68 -0
- package/dist/src/schemas/pluginProtocol.d.mts.map +1 -0
- package/dist/src/schemas/pluginProtocol.mjs +96 -0
- package/dist/src/schemas/pluginProtocol.mjs.map +1 -0
- package/dist/src/schemas/profileIdentity.cjs +67 -0
- package/dist/src/schemas/profileIdentity.cjs.map +1 -0
- package/dist/src/schemas/profileIdentity.d.mts +50 -0
- package/dist/src/schemas/profileIdentity.d.mts.map +1 -0
- package/dist/src/schemas/profileIdentity.mjs +64 -0
- package/dist/src/schemas/profileIdentity.mjs.map +1 -0
- package/dist/src/schemas/readiness.cjs +251 -0
- package/dist/src/schemas/readiness.cjs.map +1 -0
- package/dist/src/schemas/readiness.d.mts +84 -0
- package/dist/src/schemas/readiness.d.mts.map +1 -0
- package/dist/src/schemas/readiness.mjs +246 -0
- package/dist/src/schemas/readiness.mjs.map +1 -0
- package/dist/src/schemas/relaunchHandoff.cjs +47 -0
- package/dist/src/schemas/relaunchHandoff.cjs.map +1 -0
- package/dist/src/schemas/relaunchHandoff.d.mts +25 -0
- package/dist/src/schemas/relaunchHandoff.d.mts.map +1 -0
- package/dist/src/schemas/relaunchHandoff.mjs +44 -0
- package/dist/src/schemas/relaunchHandoff.mjs.map +1 -0
- package/dist/src/schemas/sandboxHarness.cjs +29 -0
- package/dist/src/schemas/sandboxHarness.cjs.map +1 -0
- package/dist/src/schemas/sandboxHarness.d.mts +39 -0
- package/dist/src/schemas/sandboxHarness.d.mts.map +1 -0
- package/dist/src/schemas/sandboxHarness.mjs +26 -0
- package/dist/src/schemas/sandboxHarness.mjs.map +1 -0
- package/dist/src/schemas/serverBundle.cjs +79 -0
- package/dist/src/schemas/serverBundle.cjs.map +1 -0
- package/dist/src/schemas/serverBundle.d.mts +34 -0
- package/dist/src/schemas/serverBundle.d.mts.map +1 -0
- package/dist/src/schemas/serverBundle.mjs +77 -0
- package/dist/src/schemas/serverBundle.mjs.map +1 -0
- package/dist/src/schemas/serverFacet.cjs +102 -0
- package/dist/src/schemas/serverFacet.cjs.map +1 -0
- package/dist/src/schemas/serverFacet.d.mts +141 -0
- package/dist/src/schemas/serverFacet.d.mts.map +1 -0
- package/dist/src/schemas/serverFacet.mjs +93 -0
- package/dist/src/schemas/serverFacet.mjs.map +1 -0
- package/dist/src/schemas/sessionMcpActivity.d.mts +45 -0
- package/dist/src/schemas/sessionMcpActivity.d.mts.map +1 -0
- package/dist/src/schemas/sessionProtocol.cjs +17 -0
- package/dist/src/schemas/sessionProtocol.cjs.map +1 -0
- package/dist/src/schemas/sessionProtocol.d.mts +308 -0
- package/dist/src/schemas/sessionProtocol.d.mts.map +1 -0
- package/dist/src/schemas/sessionProtocol.mjs +12 -0
- package/dist/src/schemas/sessionProtocol.mjs.map +1 -0
- package/dist/src/schemas/sessionUpdates.d.mts +34 -0
- package/dist/src/schemas/sessionUpdates.d.mts.map +1 -0
- package/dist/src/schemas/skills.cjs +115 -0
- package/dist/src/schemas/skills.cjs.map +1 -0
- package/dist/src/schemas/skills.d.mts +65 -0
- package/dist/src/schemas/skills.d.mts.map +1 -0
- package/dist/src/schemas/skills.mjs +109 -0
- package/dist/src/schemas/skills.mjs.map +1 -0
- package/dist/src/schemas/toolOverrides.cjs +17 -0
- package/dist/src/schemas/toolOverrides.cjs.map +1 -0
- package/dist/src/schemas/toolOverrides.d.mts +29 -0
- package/dist/src/schemas/toolOverrides.d.mts.map +1 -0
- package/dist/src/schemas/toolOverrides.mjs +15 -0
- package/dist/src/schemas/toolOverrides.mjs.map +1 -0
- package/dist/src/schemas/toolSurface.cjs +17 -0
- package/dist/src/schemas/toolSurface.cjs.map +1 -0
- package/dist/src/schemas/toolSurface.d.mts +70 -0
- package/dist/src/schemas/toolSurface.d.mts.map +1 -0
- package/dist/src/schemas/toolSurface.mjs +15 -0
- package/dist/src/schemas/toolSurface.mjs.map +1 -0
- package/dist/src/schemas/uiHub.cjs +17 -0
- package/dist/src/schemas/uiHub.cjs.map +1 -0
- package/dist/src/schemas/uiHub.d.mts +23 -0
- package/dist/src/schemas/uiHub.d.mts.map +1 -0
- package/dist/src/schemas/uiHub.mjs +15 -0
- package/dist/src/schemas/uiHub.mjs.map +1 -0
- package/dist/src/schemas/voiceReloadHandoff.cjs +78 -0
- package/dist/src/schemas/voiceReloadHandoff.cjs.map +1 -0
- package/dist/src/schemas/voiceReloadHandoff.d.mts +31 -0
- package/dist/src/schemas/voiceReloadHandoff.d.mts.map +1 -0
- package/dist/src/schemas/voiceReloadHandoff.mjs +75 -0
- package/dist/src/schemas/voiceReloadHandoff.mjs.map +1 -0
- package/dist/src/schemas/voiceTools.cjs +205 -0
- package/dist/src/schemas/voiceTools.cjs.map +1 -0
- package/dist/src/schemas/voiceTools.d.mts +120 -0
- package/dist/src/schemas/voiceTools.d.mts.map +1 -0
- package/dist/src/schemas/voiceTools.mjs +194 -0
- package/dist/src/schemas/voiceTools.mjs.map +1 -0
- package/dist/src/server/devProxyForward.cjs +141 -0
- package/dist/src/server/devProxyForward.cjs.map +1 -0
- package/dist/src/server/devProxyForward.mjs +139 -0
- package/dist/src/server/devProxyForward.mjs.map +1 -0
- package/dist/src/server/devProxyRoutes.cjs +97 -0
- package/dist/src/server/devProxyRoutes.cjs.map +1 -0
- package/dist/src/server/devProxyRoutes.mjs +97 -0
- package/dist/src/server/devProxyRoutes.mjs.map +1 -0
- package/dist/src/server/devProxySocket.cjs +87 -0
- package/dist/src/server/devProxySocket.cjs.map +1 -0
- package/dist/src/server/devProxySocket.mjs +87 -0
- package/dist/src/server/devProxySocket.mjs.map +1 -0
- package/dist/src/server/directHarnessRuntime.cjs +1964 -0
- package/dist/src/server/directHarnessRuntime.cjs.map +1 -0
- package/dist/src/server/directHarnessRuntime.d.mts +3 -0
- package/dist/src/server/directHarnessRuntime.mjs +1958 -0
- package/dist/src/server/directHarnessRuntime.mjs.map +1 -0
- package/dist/src/server/harnessErrorMessage.cjs +13 -0
- package/dist/src/server/harnessErrorMessage.cjs.map +1 -0
- package/dist/src/server/harnessErrorMessage.mjs +13 -0
- package/dist/src/server/harnessErrorMessage.mjs.map +1 -0
- package/dist/src/server/headlessProtocol.cjs +366 -0
- package/dist/src/server/headlessProtocol.cjs.map +1 -0
- package/dist/src/server/headlessProtocol.mjs +366 -0
- package/dist/src/server/headlessProtocol.mjs.map +1 -0
- package/dist/src/server/jsonlTranscriptReader.cjs +85 -0
- package/dist/src/server/jsonlTranscriptReader.cjs.map +1 -0
- package/dist/src/server/jsonlTranscriptReader.mjs +83 -0
- package/dist/src/server/jsonlTranscriptReader.mjs.map +1 -0
- package/dist/src/server/mcpBundleLoader.cjs +115 -0
- package/dist/src/server/mcpBundleLoader.cjs.map +1 -0
- package/dist/src/server/mcpBundleLoader.d.mts +27 -0
- package/dist/src/server/mcpBundleLoader.d.mts.map +1 -0
- package/dist/src/server/mcpBundleLoader.mjs +111 -0
- package/dist/src/server/mcpBundleLoader.mjs.map +1 -0
- package/dist/src/server/nativeChildTranscriptReader.cjs +20 -0
- package/dist/src/server/nativeChildTranscriptReader.cjs.map +1 -0
- package/dist/src/server/nativeChildTranscriptReader.mjs +18 -0
- package/dist/src/server/nativeChildTranscriptReader.mjs.map +1 -0
- package/dist/src/server/remoteRoutes.cjs +386 -0
- package/dist/src/server/remoteRoutes.cjs.map +1 -0
- package/dist/src/server/remoteRoutes.mjs +386 -0
- package/dist/src/server/remoteRoutes.mjs.map +1 -0
- package/dist/src/server/serverFacetLoader.cjs +220 -0
- package/dist/src/server/serverFacetLoader.cjs.map +1 -0
- package/dist/src/server/serverFacetLoader.d.mts +77 -0
- package/dist/src/server/serverFacetLoader.d.mts.map +1 -0
- package/dist/src/server/serverFacetLoader.mjs +215 -0
- package/dist/src/server/serverFacetLoader.mjs.map +1 -0
- package/dist/src/server/sessionMcpHandler.cjs +494 -0
- package/dist/src/server/sessionMcpHandler.cjs.map +1 -0
- package/dist/src/server/sessionMcpHandler.d.mts +47 -0
- package/dist/src/server/sessionMcpHandler.d.mts.map +1 -0
- package/dist/src/server/sessionMcpHandler.mjs +493 -0
- package/dist/src/server/sessionMcpHandler.mjs.map +1 -0
- package/dist/src/server/sessionMcpRoutes.cjs +780 -0
- package/dist/src/server/sessionMcpRoutes.cjs.map +1 -0
- package/dist/src/server/sessionMcpRoutes.mjs +775 -0
- package/dist/src/server/sessionMcpRoutes.mjs.map +1 -0
- package/dist/src/server/threadJournals.cjs +172 -0
- package/dist/src/server/threadJournals.cjs.map +1 -0
- package/dist/src/server/threadJournals.mjs +169 -0
- package/dist/src/server/threadJournals.mjs.map +1 -0
- package/dist/src/services/acpSessionUpdates/index.cjs +129 -0
- package/dist/src/services/acpSessionUpdates/index.cjs.map +1 -0
- package/dist/src/services/acpSessionUpdates/index.mjs +129 -0
- package/dist/src/services/acpSessionUpdates/index.mjs.map +1 -0
- package/dist/src/services/apiSurfaceAssert/index.cjs +60 -0
- package/dist/src/services/apiSurfaceAssert/index.cjs.map +1 -0
- package/dist/src/services/apiSurfaceAssert/index.d.mts +24 -0
- package/dist/src/services/apiSurfaceAssert/index.d.mts.map +1 -0
- package/dist/src/services/apiSurfaceAssert/index.mjs +60 -0
- package/dist/src/services/apiSurfaceAssert/index.mjs.map +1 -0
- package/dist/src/services/bundlePublication/index.cjs +88 -0
- package/dist/src/services/bundlePublication/index.cjs.map +1 -0
- package/dist/src/services/bundlePublication/index.mjs +85 -0
- package/dist/src/services/bundlePublication/index.mjs.map +1 -0
- package/dist/src/services/contextApiUrls/index.cjs +14 -0
- package/dist/src/services/contextApiUrls/index.cjs.map +1 -0
- package/dist/src/services/contextApiUrls/index.d.mts +6 -0
- package/dist/src/services/contextApiUrls/index.d.mts.map +1 -0
- package/dist/src/services/contextApiUrls/index.mjs +14 -0
- package/dist/src/services/contextApiUrls/index.mjs.map +1 -0
- package/dist/src/services/contextContributions/index.cjs +79 -0
- package/dist/src/services/contextContributions/index.cjs.map +1 -0
- package/dist/src/services/contextContributions/index.d.mts +6 -0
- package/dist/src/services/contextContributions/index.d.mts.map +1 -0
- package/dist/src/services/contextContributions/index.mjs +79 -0
- package/dist/src/services/contextContributions/index.mjs.map +1 -0
- package/dist/src/services/contextUsage/index.cjs +27 -0
- package/dist/src/services/contextUsage/index.cjs.map +1 -0
- package/dist/src/services/contextUsage/index.mjs +25 -0
- package/dist/src/services/contextUsage/index.mjs.map +1 -0
- package/dist/src/services/devProxyPolicy/index.cjs +168 -0
- package/dist/src/services/devProxyPolicy/index.cjs.map +1 -0
- package/dist/src/services/devProxyPolicy/index.mjs +165 -0
- package/dist/src/services/devProxyPolicy/index.mjs.map +1 -0
- package/dist/src/services/devProxyStore/index.cjs +107 -0
- package/dist/src/services/devProxyStore/index.cjs.map +1 -0
- package/dist/src/services/devProxyStore/index.mjs +104 -0
- package/dist/src/services/devProxyStore/index.mjs.map +1 -0
- package/dist/src/services/deviceAuth/index.cjs +125 -0
- package/dist/src/services/deviceAuth/index.cjs.map +1 -0
- package/dist/src/services/deviceAuth/index.d.mts +9 -0
- package/dist/src/services/deviceAuth/index.d.mts.map +1 -0
- package/dist/src/services/deviceAuth/index.mjs +125 -0
- package/dist/src/services/deviceAuth/index.mjs.map +1 -0
- package/dist/src/services/deviceSessions/index.cjs +147 -0
- package/dist/src/services/deviceSessions/index.cjs.map +1 -0
- package/dist/src/services/deviceSessions/index.d.mts +15 -0
- package/dist/src/services/deviceSessions/index.d.mts.map +1 -0
- package/dist/src/services/deviceSessions/index.mjs +141 -0
- package/dist/src/services/deviceSessions/index.mjs.map +1 -0
- package/dist/src/services/headlessClient/index.cjs +125 -0
- package/dist/src/services/headlessClient/index.cjs.map +1 -0
- package/dist/src/services/headlessClient/index.mjs +125 -0
- package/dist/src/services/headlessClient/index.mjs.map +1 -0
- package/dist/src/services/historyCreationFileSystem/index.cjs +115 -0
- package/dist/src/services/historyCreationFileSystem/index.cjs.map +1 -0
- package/dist/src/services/historyCreationFileSystem/index.mjs +115 -0
- package/dist/src/services/historyCreationFileSystem/index.mjs.map +1 -0
- package/dist/src/services/hubChannelHarness/index.cjs +50 -0
- package/dist/src/services/hubChannelHarness/index.cjs.map +1 -0
- package/dist/src/services/hubChannelHarness/index.d.mts +17 -0
- package/dist/src/services/hubChannelHarness/index.d.mts.map +1 -0
- package/dist/src/services/hubChannelHarness/index.mjs +50 -0
- package/dist/src/services/hubChannelHarness/index.mjs.map +1 -0
- package/dist/src/services/kernel/index.cjs +147 -0
- package/dist/src/services/kernel/index.cjs.map +1 -0
- package/dist/src/services/kernel/index.d.mts +9 -0
- package/dist/src/services/kernel/index.d.mts.map +1 -0
- package/dist/src/services/kernel/index.mjs +147 -0
- package/dist/src/services/kernel/index.mjs.map +1 -0
- package/dist/src/services/loginFlow/index.cjs +131 -0
- package/dist/src/services/loginFlow/index.cjs.map +1 -0
- package/dist/src/services/loginFlow/index.mjs +131 -0
- package/dist/src/services/loginFlow/index.mjs.map +1 -0
- package/dist/src/services/loopbackAddress/index.cjs +58 -0
- package/dist/src/services/loopbackAddress/index.cjs.map +1 -0
- package/dist/src/services/loopbackAddress/index.mjs +56 -0
- package/dist/src/services/loopbackAddress/index.mjs.map +1 -0
- package/dist/src/services/openSessionRegistry/index.cjs +144 -0
- package/dist/src/services/openSessionRegistry/index.cjs.map +1 -0
- package/dist/src/services/openSessionRegistry/index.d.mts +40 -0
- package/dist/src/services/openSessionRegistry/index.d.mts.map +1 -0
- package/dist/src/services/openSessionRegistry/index.mjs +141 -0
- package/dist/src/services/openSessionRegistry/index.mjs.map +1 -0
- package/dist/src/services/packageApiHarness/index.cjs +36 -0
- package/dist/src/services/packageApiHarness/index.cjs.map +1 -0
- package/dist/src/services/packageApiHarness/index.d.mts +40 -0
- package/dist/src/services/packageApiHarness/index.d.mts.map +1 -0
- package/dist/src/services/packageApiHarness/index.mjs +36 -0
- package/dist/src/services/packageApiHarness/index.mjs.map +1 -0
- package/dist/src/services/packageResource/index.cjs +54 -0
- package/dist/src/services/packageResource/index.cjs.map +1 -0
- package/dist/src/services/packageResource/index.d.mts +26 -0
- package/dist/src/services/packageResource/index.d.mts.map +1 -0
- package/dist/src/services/packageResource/index.mjs +51 -0
- package/dist/src/services/packageResource/index.mjs.map +1 -0
- package/dist/src/services/pairingFlow/index.cjs +145 -0
- package/dist/src/services/pairingFlow/index.cjs.map +1 -0
- package/dist/src/services/pairingFlow/index.d.mts +44 -0
- package/dist/src/services/pairingFlow/index.d.mts.map +1 -0
- package/dist/src/services/pairingFlow/index.mjs +145 -0
- package/dist/src/services/pairingFlow/index.mjs.map +1 -0
- package/dist/src/services/pairingPage/index.cjs +450 -0
- package/dist/src/services/pairingPage/index.cjs.map +1 -0
- package/dist/src/services/pairingPage/index.mjs +447 -0
- package/dist/src/services/pairingPage/index.mjs.map +1 -0
- package/dist/src/services/piExtensionHost/index.cjs +821 -0
- package/dist/src/services/piExtensionHost/index.cjs.map +1 -0
- package/dist/src/services/piExtensionHost/index.mjs +817 -0
- package/dist/src/services/piExtensionHost/index.mjs.map +1 -0
- package/dist/src/services/piHelpTools/index.cjs +68 -0
- package/dist/src/services/piHelpTools/index.cjs.map +1 -0
- package/dist/src/services/piHelpTools/index.d.mts +10 -0
- package/dist/src/services/piHelpTools/index.d.mts.map +1 -0
- package/dist/src/services/piHelpTools/index.mjs +68 -0
- package/dist/src/services/piHelpTools/index.mjs.map +1 -0
- package/dist/src/services/piSessionEntries/index.cjs +112 -0
- package/dist/src/services/piSessionEntries/index.cjs.map +1 -0
- package/dist/src/services/piSessionEntries/index.mjs +108 -0
- package/dist/src/services/piSessionEntries/index.mjs.map +1 -0
- package/dist/src/services/pluginLifecycle/index.cjs +71 -0
- package/dist/src/services/pluginLifecycle/index.cjs.map +1 -0
- package/dist/src/services/pluginLifecycle/index.d.mts +11 -0
- package/dist/src/services/pluginLifecycle/index.d.mts.map +1 -0
- package/dist/src/services/pluginLifecycle/index.mjs +71 -0
- package/dist/src/services/pluginLifecycle/index.mjs.map +1 -0
- package/dist/src/services/providerAuth/index.cjs +156 -0
- package/dist/src/services/providerAuth/index.cjs.map +1 -0
- package/dist/src/services/providerAuth/index.mjs +154 -0
- package/dist/src/services/providerAuth/index.mjs.map +1 -0
- package/dist/src/services/remoteAccess/index.cjs +396 -0
- package/dist/src/services/remoteAccess/index.cjs.map +1 -0
- package/dist/src/services/remoteAccess/index.d.mts +81 -0
- package/dist/src/services/remoteAccess/index.d.mts.map +1 -0
- package/dist/src/services/remoteAccess/index.mjs +396 -0
- package/dist/src/services/remoteAccess/index.mjs.map +1 -0
- package/dist/src/services/remoteAccessSettings/index.cjs +151 -0
- package/dist/src/services/remoteAccessSettings/index.cjs.map +1 -0
- package/dist/src/services/remoteAccessSettings/index.mjs +149 -0
- package/dist/src/services/remoteAccessSettings/index.mjs.map +1 -0
- package/dist/src/services/remoteAccessStore/index.cjs +126 -0
- package/dist/src/services/remoteAccessStore/index.cjs.map +1 -0
- package/dist/src/services/remoteAccessStore/index.mjs +121 -0
- package/dist/src/services/remoteAccessStore/index.mjs.map +1 -0
- package/dist/src/services/remoteGuardPolicy/index.cjs +190 -0
- package/dist/src/services/remoteGuardPolicy/index.cjs.map +1 -0
- package/dist/src/services/remoteGuardPolicy/index.d.mts +7 -0
- package/dist/src/services/remoteGuardPolicy/index.d.mts.map +1 -0
- package/dist/src/services/remoteGuardPolicy/index.mjs +186 -0
- package/dist/src/services/remoteGuardPolicy/index.mjs.map +1 -0
- package/dist/src/services/requestReceipts/index.cjs +161 -0
- package/dist/src/services/requestReceipts/index.cjs.map +1 -0
- package/dist/src/services/requestReceipts/index.d.mts +11 -0
- package/dist/src/services/requestReceipts/index.d.mts.map +1 -0
- package/dist/src/services/requestReceipts/index.mjs +161 -0
- package/dist/src/services/requestReceipts/index.mjs.map +1 -0
- package/dist/src/services/rpcTranscript/index.cjs +590 -0
- package/dist/src/services/rpcTranscript/index.cjs.map +1 -0
- package/dist/src/services/rpcTranscript/index.d.mts +50 -0
- package/dist/src/services/rpcTranscript/index.d.mts.map +1 -0
- package/dist/src/services/rpcTranscript/index.mjs +589 -0
- package/dist/src/services/rpcTranscript/index.mjs.map +1 -0
- package/dist/src/services/serverFacet/index.cjs +197 -0
- package/dist/src/services/serverFacet/index.cjs.map +1 -0
- package/dist/src/services/serverFacet/index.d.mts +31 -0
- package/dist/src/services/serverFacet/index.d.mts.map +1 -0
- package/dist/src/services/serverFacet/index.mjs +197 -0
- package/dist/src/services/serverFacet/index.mjs.map +1 -0
- package/dist/src/services/sessionGitStatus/index.cjs +46 -0
- package/dist/src/services/sessionGitStatus/index.cjs.map +1 -0
- package/dist/src/services/sessionGitStatus/index.mjs +46 -0
- package/dist/src/services/sessionGitStatus/index.mjs.map +1 -0
- package/dist/src/services/sessionGitStatus/type.d.mts +8 -0
- package/dist/src/services/sessionGitStatus/type.d.mts.map +1 -0
- package/dist/src/services/sessionMcpActivity/index.cjs +115 -0
- package/dist/src/services/sessionMcpActivity/index.cjs.map +1 -0
- package/dist/src/services/sessionMcpActivity/index.mjs +111 -0
- package/dist/src/services/sessionMcpActivity/index.mjs.map +1 -0
- package/dist/src/services/sessionMcpAuthorization/index.cjs +432 -0
- package/dist/src/services/sessionMcpAuthorization/index.cjs.map +1 -0
- package/dist/src/services/sessionMcpAuthorization/index.d.mts +123 -0
- package/dist/src/services/sessionMcpAuthorization/index.d.mts.map +1 -0
- package/dist/src/services/sessionMcpAuthorization/index.mjs +430 -0
- package/dist/src/services/sessionMcpAuthorization/index.mjs.map +1 -0
- package/dist/src/services/sessionMcpConversations/index.cjs +217 -0
- package/dist/src/services/sessionMcpConversations/index.cjs.map +1 -0
- package/dist/src/services/sessionMcpConversations/index.mjs +212 -0
- package/dist/src/services/sessionMcpConversations/index.mjs.map +1 -0
- package/dist/src/services/sessionMcpRegistrationStore/index.cjs +86 -0
- package/dist/src/services/sessionMcpRegistrationStore/index.cjs.map +1 -0
- package/dist/src/services/sessionMcpRegistrationStore/index.mjs +83 -0
- package/dist/src/services/sessionMcpRegistrationStore/index.mjs.map +1 -0
- package/dist/src/services/sessionPresentation/index.cjs +119 -0
- package/dist/src/services/sessionPresentation/index.cjs.map +1 -0
- package/dist/src/services/sessionPresentation/index.mjs +119 -0
- package/dist/src/services/sessionPresentation/index.mjs.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.cjs +105 -0
- package/dist/src/services/sqliteSessionHistory/index.cjs.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.d.mts +29 -0
- package/dist/src/services/sqliteSessionHistory/index.d.mts.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.mjs +100 -0
- package/dist/src/services/sqliteSessionHistory/index.mjs.map +1 -0
- package/dist/src/services/sqliteTranscriptReader/index.cjs +70 -0
- package/dist/src/services/sqliteTranscriptReader/index.cjs.map +1 -0
- package/dist/src/services/sqliteTranscriptReader/index.d.mts +14 -0
- package/dist/src/services/sqliteTranscriptReader/index.d.mts.map +1 -0
- package/dist/src/services/sqliteTranscriptReader/index.mjs +67 -0
- package/dist/src/services/sqliteTranscriptReader/index.mjs.map +1 -0
- package/dist/src/services/toolCost/index.cjs +47 -0
- package/dist/src/services/toolCost/index.cjs.map +1 -0
- package/dist/src/services/toolCost/index.d.mts +38 -0
- package/dist/src/services/toolCost/index.d.mts.map +1 -0
- package/dist/src/services/toolCost/index.mjs +46 -0
- package/dist/src/services/toolCost/index.mjs.map +1 -0
- package/dist/src/services/toolOverrides/index.cjs +45 -0
- package/dist/src/services/toolOverrides/index.cjs.map +1 -0
- package/dist/src/services/toolOverrides/index.d.mts +6 -0
- package/dist/src/services/toolOverrides/index.d.mts.map +1 -0
- package/dist/src/services/toolOverrides/index.mjs +45 -0
- package/dist/src/services/toolOverrides/index.mjs.map +1 -0
- package/dist/src/services/toolPrompt/index.cjs +13 -0
- package/dist/src/services/toolPrompt/index.cjs.map +1 -0
- package/dist/src/services/toolPrompt/index.mjs +13 -0
- package/dist/src/services/toolPrompt/index.mjs.map +1 -0
- package/dist/src/services/toolSurface/index.cjs +134 -0
- package/dist/src/services/toolSurface/index.cjs.map +1 -0
- package/dist/src/services/toolSurface/index.d.mts +19 -0
- package/dist/src/services/toolSurface/index.d.mts.map +1 -0
- package/dist/src/services/toolSurface/index.mjs +134 -0
- package/dist/src/services/toolSurface/index.mjs.map +1 -0
- package/dist/src/services/traceContext/index.cjs +13 -0
- package/dist/src/services/traceContext/index.cjs.map +1 -0
- package/dist/src/services/traceContext/index.mjs +13 -0
- package/dist/src/services/traceContext/index.mjs.map +1 -0
- package/dist/src/services/transcriptPages/index.cjs +74 -0
- package/dist/src/services/transcriptPages/index.cjs.map +1 -0
- package/dist/src/services/transcriptPages/index.mjs +73 -0
- package/dist/src/services/transcriptPages/index.mjs.map +1 -0
- package/dist/src/services/tunnelOutput/index.cjs +58 -0
- package/dist/src/services/tunnelOutput/index.cjs.map +1 -0
- package/dist/src/services/tunnelOutput/index.mjs +54 -0
- package/dist/src/services/tunnelOutput/index.mjs.map +1 -0
- package/dist/src/services/tunnelProcess/index.cjs +487 -0
- package/dist/src/services/tunnelProcess/index.cjs.map +1 -0
- package/dist/src/services/tunnelProcess/index.mjs +481 -0
- package/dist/src/services/tunnelProcess/index.mjs.map +1 -0
- package/dist/src/services/voiceReloadHandoff/index.cjs +136 -0
- package/dist/src/services/voiceReloadHandoff/index.cjs.map +1 -0
- package/dist/src/services/voiceReloadHandoff/index.d.mts +34 -0
- package/dist/src/services/voiceReloadHandoff/index.d.mts.map +1 -0
- package/dist/src/services/voiceReloadHandoff/index.mjs +135 -0
- package/dist/src/services/voiceReloadHandoff/index.mjs.map +1 -0
- package/dist/src/services/voiceToolsContract/index.cjs +26 -0
- package/dist/src/services/voiceToolsContract/index.cjs.map +1 -0
- package/dist/src/services/voiceToolsContract/index.d.mts +76 -0
- package/dist/src/services/voiceToolsContract/index.d.mts.map +1 -0
- package/dist/src/services/voiceToolsContract/index.mjs +24 -0
- package/dist/src/services/voiceToolsContract/index.mjs.map +1 -0
- package/dist/src/services/webauthn/index.cjs +262 -0
- package/dist/src/services/webauthn/index.cjs.map +1 -0
- package/dist/src/services/webauthn/index.d.mts +39 -0
- package/dist/src/services/webauthn/index.d.mts.map +1 -0
- package/dist/src/services/webauthn/index.mjs +262 -0
- package/dist/src/services/webauthn/index.mjs.map +1 -0
- package/dist/src/services/webauthnPolicy/index.cjs +163 -0
- package/dist/src/services/webauthnPolicy/index.cjs.map +1 -0
- package/dist/src/services/webauthnPolicy/index.d.mts +41 -0
- package/dist/src/services/webauthnPolicy/index.d.mts.map +1 -0
- package/dist/src/services/webauthnPolicy/index.mjs +156 -0
- package/dist/src/services/webauthnPolicy/index.mjs.map +1 -0
- package/dist/src/services/workspaceRegistry/index.cjs +151 -0
- package/dist/src/services/workspaceRegistry/index.cjs.map +1 -0
- package/dist/src/services/workspaceRegistry/index.d.mts +47 -0
- package/dist/src/services/workspaceRegistry/index.d.mts.map +1 -0
- package/dist/src/services/workspaceRegistry/index.mjs +144 -0
- package/dist/src/services/workspaceRegistry/index.mjs.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs +261 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts +32 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs +254 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs.map +1 -0
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs +28 -0
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs.map +1 -0
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs +25 -0
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs.map +1 -0
- package/dist/src/systems/child/services/childSession/index.cjs +219 -0
- package/dist/src/systems/child/services/childSession/index.cjs.map +1 -0
- package/dist/src/systems/child/services/childSession/index.d.mts +14 -0
- package/dist/src/systems/child/services/childSession/index.d.mts.map +1 -0
- package/dist/src/systems/child/services/childSession/index.mjs +219 -0
- package/dist/src/systems/child/services/childSession/index.mjs.map +1 -0
- package/dist/src/systems/child/types/childSession.cjs +19 -0
- package/dist/src/systems/child/types/childSession.cjs.map +1 -0
- package/dist/src/systems/child/types/childSession.d.mts +148 -0
- package/dist/src/systems/child/types/childSession.d.mts.map +1 -0
- package/dist/src/systems/child/types/childSession.mjs +16 -0
- package/dist/src/systems/child/types/childSession.mjs.map +1 -0
- package/dist/src/systems/main/adapters/headlessHost.cjs +554 -0
- package/dist/src/systems/main/adapters/headlessHost.cjs.map +1 -0
- package/dist/src/systems/main/adapters/headlessHost.d.mts +111 -0
- package/dist/src/systems/main/adapters/headlessHost.d.mts.map +1 -0
- package/dist/src/systems/main/adapters/headlessHost.mjs +552 -0
- package/dist/src/systems/main/adapters/headlessHost.mjs.map +1 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs +1293 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs.map +1 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts +14 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts.map +1 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs +1288 -0
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs.map +1 -0
- package/dist/src/systems/main/types/headlessHost.d.mts +36 -0
- package/dist/src/systems/main/types/headlessHost.d.mts.map +1 -0
- package/dist/src/testing/pi/extensionScenarios.cjs +73 -0
- package/dist/src/testing/pi/extensionScenarios.cjs.map +1 -0
- package/dist/src/testing/pi/extensionScenarios.d.mts +41 -0
- package/dist/src/testing/pi/extensionScenarios.d.mts.map +1 -0
- package/dist/src/testing/pi/extensionScenarios.mjs +73 -0
- package/dist/src/testing/pi/extensionScenarios.mjs.map +1 -0
- package/dist/src/testing/pi/testHost.cjs +398 -0
- package/dist/src/testing/pi/testHost.cjs.map +1 -0
- package/dist/src/testing/pi/testHost.d.mts +160 -0
- package/dist/src/testing/pi/testHost.d.mts.map +1 -0
- package/dist/src/testing/pi/testHost.mjs +398 -0
- package/dist/src/testing/pi/testHost.mjs.map +1 -0
- package/dist/src/types/config.d.mts +20 -0
- package/dist/src/types/config.d.mts.map +1 -0
- package/dist/src/types/kernel.d.mts +69 -0
- package/dist/src/types/kernel.d.mts.map +1 -0
- package/dist/src/types/remote.d.mts +124 -0
- package/dist/src/types/remote.d.mts.map +1 -0
- package/dist/src/types/server/directHarnessRuntime.d.mts +209 -0
- package/dist/src/types/server/directHarnessRuntime.d.mts.map +1 -0
- package/dist/src/types/server/session.d.mts +5 -0
- package/dist/src/types/server/session.d.mts.map +1 -0
- package/dist/src/types/server/sessionToolSurface.d.mts +44 -0
- package/dist/src/types/server/sessionToolSurface.d.mts.map +1 -0
- package/dist/src/web/models/globalStore.cjs +23 -0
- package/dist/src/web/models/globalStore.cjs.map +1 -0
- package/dist/src/web/models/globalStore.d.mts +6 -0
- package/dist/src/web/models/globalStore.d.mts.map +1 -0
- package/dist/src/web/models/globalStore.mjs +23 -0
- package/dist/src/web/models/globalStore.mjs.map +1 -0
- package/dist/src/web/models/sessionStore.cjs +56 -0
- package/dist/src/web/models/sessionStore.cjs.map +1 -0
- package/dist/src/web/models/sessionStore.d.mts +14 -0
- package/dist/src/web/models/sessionStore.d.mts.map +1 -0
- package/dist/src/web/models/sessionStore.mjs +56 -0
- package/dist/src/web/models/sessionStore.mjs.map +1 -0
- package/dist/src/web/models/workspaceStore.cjs +50 -0
- package/dist/src/web/models/workspaceStore.cjs.map +1 -0
- package/dist/src/web/models/workspaceStore.d.mts +18 -0
- package/dist/src/web/models/workspaceStore.d.mts.map +1 -0
- package/dist/src/web/models/workspaceStore.mjs +50 -0
- package/dist/src/web/models/workspaceStore.mjs.map +1 -0
- package/dist/src/web/schemas/bundleAssetPolicy.cjs +20 -0
- package/dist/src/web/schemas/bundleAssetPolicy.cjs.map +1 -0
- package/dist/src/web/schemas/bundleAssetPolicy.d.mts +10 -0
- package/dist/src/web/schemas/bundleAssetPolicy.d.mts.map +1 -0
- package/dist/src/web/schemas/bundleAssetPolicy.mjs +18 -0
- package/dist/src/web/schemas/bundleAssetPolicy.mjs.map +1 -0
- package/dist/src/web/schemas/template.cjs +15 -0
- package/dist/src/web/schemas/template.cjs.map +1 -0
- package/dist/src/web/schemas/template.d.mts +6 -0
- package/dist/src/web/schemas/template.d.mts.map +1 -0
- package/dist/src/web/schemas/template.mjs +15 -0
- package/dist/src/web/schemas/template.mjs.map +1 -0
- package/dist/src/web/services/apiClient/index.cjs +156 -0
- package/dist/src/web/services/apiClient/index.cjs.map +1 -0
- package/dist/src/web/services/apiClient/index.d.mts +152 -0
- package/dist/src/web/services/apiClient/index.d.mts.map +1 -0
- package/dist/src/web/services/apiClient/index.mjs +154 -0
- package/dist/src/web/services/apiClient/index.mjs.map +1 -0
- package/dist/src/web/services/apiPaths/index.cjs +83 -0
- package/dist/src/web/services/apiPaths/index.cjs.map +1 -0
- package/dist/src/web/services/apiPaths/index.d.mts +81 -0
- package/dist/src/web/services/apiPaths/index.d.mts.map +1 -0
- package/dist/src/web/services/apiPaths/index.mjs +78 -0
- package/dist/src/web/services/apiPaths/index.mjs.map +1 -0
- package/dist/src/web/services/apiRoutes/index.cjs +47 -0
- package/dist/src/web/services/apiRoutes/index.cjs.map +1 -0
- package/dist/src/web/services/apiRoutes/index.d.mts +21 -0
- package/dist/src/web/services/apiRoutes/index.d.mts.map +1 -0
- package/dist/src/web/services/apiRoutes/index.mjs +43 -0
- package/dist/src/web/services/apiRoutes/index.mjs.map +1 -0
- package/dist/src/web/services/mcpWidget.cjs +9 -0
- package/dist/src/web/services/mcpWidget.cjs.map +1 -0
- package/dist/src/web/services/mcpWidget.d.mts +6 -0
- package/dist/src/web/services/mcpWidget.d.mts.map +1 -0
- package/dist/src/web/services/mcpWidget.mjs +9 -0
- package/dist/src/web/services/mcpWidget.mjs.map +1 -0
- package/dist/src/web/services/sessionRegistry/index.cjs +70 -0
- package/dist/src/web/services/sessionRegistry/index.cjs.map +1 -0
- package/dist/src/web/services/sessionRegistry/index.d.mts +29 -0
- package/dist/src/web/services/sessionRegistry/index.d.mts.map +1 -0
- package/dist/src/web/services/sessionRegistry/index.mjs +66 -0
- package/dist/src/web/services/sessionRegistry/index.mjs.map +1 -0
- package/dist/src/web/services/testing/channels.cjs +11 -0
- package/dist/src/web/services/testing/channels.cjs.map +1 -0
- package/dist/src/web/services/testing/channels.d.mts +8 -0
- package/dist/src/web/services/testing/channels.d.mts.map +1 -0
- package/dist/src/web/services/testing/channels.mjs +11 -0
- package/dist/src/web/services/testing/channels.mjs.map +1 -0
- package/dist/src/web/services/testing/index.cjs +27 -0
- package/dist/src/web/services/testing/index.cjs.map +1 -0
- package/dist/src/web/services/testing/index.d.mts +31 -0
- package/dist/src/web/services/testing/index.d.mts.map +1 -0
- package/dist/src/web/services/testing/index.mjs +27 -0
- package/dist/src/web/services/testing/index.mjs.map +1 -0
- package/dist/src/web/services/testing/rpcStub.cjs +58 -0
- package/dist/src/web/services/testing/rpcStub.cjs.map +1 -0
- package/dist/src/web/services/testing/rpcStub.d.mts +37 -0
- package/dist/src/web/services/testing/rpcStub.d.mts.map +1 -0
- package/dist/src/web/services/testing/rpcStub.mjs +58 -0
- package/dist/src/web/services/testing/rpcStub.mjs.map +1 -0
- package/dist/src/web/services/testing/slotProps.cjs +91 -0
- package/dist/src/web/services/testing/slotProps.cjs.map +1 -0
- package/dist/src/web/services/testing/slotProps.d.mts +69 -0
- package/dist/src/web/services/testing/slotProps.d.mts.map +1 -0
- package/dist/src/web/services/testing/slotProps.mjs +90 -0
- package/dist/src/web/services/testing/slotProps.mjs.map +1 -0
- package/dist/src/web/services/testing/templateRail.cjs +128 -0
- package/dist/src/web/services/testing/templateRail.cjs.map +1 -0
- package/dist/src/web/services/testing/templateRail.d.mts +31 -0
- package/dist/src/web/services/testing/templateRail.d.mts.map +1 -0
- package/dist/src/web/services/testing/templateRail.mjs +126 -0
- package/dist/src/web/services/testing/templateRail.mjs.map +1 -0
- package/dist/src/web/services/toolResult/index.cjs +30 -0
- package/dist/src/web/services/toolResult/index.cjs.map +1 -0
- package/dist/src/web/services/toolResult/index.d.mts +14 -0
- package/dist/src/web/services/toolResult/index.d.mts.map +1 -0
- package/dist/src/web/services/toolResult/index.mjs +29 -0
- package/dist/src/web/services/toolResult/index.mjs.map +1 -0
- package/dist/src/web/types/extensionFile.d.mts +59 -0
- package/dist/src/web/types/extensionFile.d.mts.map +1 -0
- package/dist/src/web/types/mcpWidget.d.mts +14 -0
- package/dist/src/web/types/mcpWidget.d.mts.map +1 -0
- package/dist/src/web/types/modelContext.d.mts +43 -0
- package/dist/src/web/types/modelContext.d.mts.map +1 -0
- package/dist/src/web/types/sessionRegistry.d.mts +43 -0
- package/dist/src/web/types/sessionRegistry.d.mts.map +1 -0
- package/dist/src/web/types/template.d.mts +155 -0
- package/dist/src/web/types/template.d.mts.map +1 -0
- package/dist/src/web/types/webPlugin.d.mts +896 -0
- package/dist/src/web/types/webPlugin.d.mts.map +1 -0
- package/dist/syncLocation.cjs +244 -0
- package/dist/syncLocation.cjs.map +1 -0
- package/dist/syncLocation.d.mts +37 -0
- package/dist/syncLocation.d.mts.map +1 -0
- package/dist/syncLocation.mjs +231 -0
- package/dist/syncLocation.mjs.map +1 -0
- package/dist/syncRegistration.cjs +171 -0
- package/dist/syncRegistration.cjs.map +1 -0
- package/dist/syncRegistration.d.mts +48 -0
- package/dist/syncRegistration.d.mts.map +1 -0
- package/dist/syncRegistration.mjs +159 -0
- package/dist/syncRegistration.mjs.map +1 -0
- package/dist/syncStateContract.cjs +19 -0
- package/dist/syncStateContract.cjs.map +1 -0
- package/dist/syncStateContract.d.mts +14 -0
- package/dist/syncStateContract.d.mts.map +1 -0
- package/dist/syncStateContract.mjs +16 -0
- package/dist/syncStateContract.mjs.map +1 -0
- package/dist/terminalPiChildSessionService.cjs +267 -0
- package/dist/terminalPiChildSessionService.cjs.map +1 -0
- package/dist/terminalPiChildSessionService.d.mts +42 -0
- package/dist/terminalPiChildSessionService.d.mts.map +1 -0
- package/dist/terminalPiChildSessionService.mjs +260 -0
- package/dist/terminalPiChildSessionService.mjs.map +1 -0
- package/dist/testing.cjs +11 -0
- package/dist/testing.d.mts +6 -0
- package/dist/testing.mjs +6 -0
- package/dist/toolInventory.cjs +136 -0
- package/dist/toolInventory.cjs.map +1 -0
- package/dist/toolInventory.d.mts +66 -0
- package/dist/toolInventory.d.mts.map +1 -0
- package/dist/toolInventory.mjs +133 -0
- package/dist/toolInventory.mjs.map +1 -0
- package/dist/toolNames.cjs +4 -0
- package/dist/toolNames.d.mts +2 -0
- package/dist/toolNames.mjs +2 -0
- package/dist/toolOverrides.cjs +7 -0
- package/dist/toolOverrides.d.mts +3 -0
- package/dist/toolOverrides.mjs +3 -0
- package/dist/toolSurface.cjs +7 -0
- package/dist/toolSurface.d.mts +3 -0
- package/dist/toolSurface.mjs +3 -0
- package/dist/transition.cjs +5 -0
- package/dist/transition.d.cjs +5 -0
- package/dist/transition.d.mts +2 -0
- package/dist/transition.mjs +2 -0
- package/dist/transitionClassifier.cjs +112 -0
- package/dist/transitionClassifier.cjs.map +1 -0
- package/dist/transitionClassifier.d.mts +18 -0
- package/dist/transitionClassifier.d.mts.map +1 -0
- package/dist/transitionClassifier.mjs +111 -0
- package/dist/transitionClassifier.mjs.map +1 -0
- package/dist/transitionCoordinator.cjs +131 -0
- package/dist/transitionCoordinator.cjs.map +1 -0
- package/dist/transitionCoordinator.d.mts +16 -0
- package/dist/transitionCoordinator.d.mts.map +1 -0
- package/dist/transitionCoordinator.mjs +130 -0
- package/dist/transitionCoordinator.mjs.map +1 -0
- package/dist/typesContextApi.cjs +0 -0
- package/dist/typesContextApi.d.mts +73 -0
- package/dist/typesContextApi.d.mts.map +1 -0
- package/dist/typesContextApi.mjs +1 -0
- package/dist/uiHub.cjs +5 -0
- package/dist/uiHub.d.mts +2 -0
- package/dist/uiHub.mjs +2 -0
- package/dist/v3Export.cjs +1004 -0
- package/dist/v3Export.cjs.map +1 -0
- package/dist/v3Export.d.mts +34 -0
- package/dist/v3Export.d.mts.map +1 -0
- package/dist/v3Export.mjs +1000 -0
- package/dist/v3Export.mjs.map +1 -0
- package/dist/voiceReloadHandoff.cjs +14 -0
- package/dist/voiceReloadHandoff.d.mts +4 -0
- package/dist/voiceReloadHandoff.mjs +4 -0
- package/dist/voiceTools.cjs +56 -0
- package/dist/voiceTools.d.mts +4 -0
- package/dist/voiceTools.mjs +4 -0
- package/dist/web.cjs +64 -0
- package/dist/web.d.mts +19 -0
- package/dist/web.mjs +13 -0
- package/dist/webCompositions.cjs +100 -0
- package/dist/webCompositions.cjs.map +1 -0
- package/dist/webCompositions.d.mts +20 -0
- package/dist/webCompositions.d.mts.map +1 -0
- package/dist/webCompositions.mjs +95 -0
- package/dist/webCompositions.mjs.map +1 -0
- package/dist/webTesting.cjs +14 -0
- package/dist/webTesting.d.mts +6 -0
- package/dist/webTesting.mjs +6 -0
- package/package.json +616 -0
|
@@ -0,0 +1,1288 @@
|
|
|
1
|
+
import { DOOM_CHILD_SESSION_MCP_TOOL_SERVICE, DOOM_CHILD_SESSION_SERVICE } from "../../child/types/childSession.mjs";
|
|
2
|
+
import "../../../schemas/headless.mjs";
|
|
3
|
+
import { createHistoryOwnership } from "../../../../historyOwnership.mjs";
|
|
4
|
+
import { HeadlessHost, describeLoadSkillTool, headlessHarnessSkill } from "./headlessHost.mjs";
|
|
5
|
+
import { harnessErrorMessage } from "../../../server/harnessErrorMessage.mjs";
|
|
6
|
+
import { createDirectHarnessRuntime } from "../../../server/directHarnessRuntime.mjs";
|
|
7
|
+
import { buildContextDetail } from "../../../../contextDetail.mjs";
|
|
8
|
+
import { writeContextDetail } from "../../../../contextDetailStore.mjs";
|
|
9
|
+
import { DOOM_CONTEXT_ENTRY_TYPE, projectContext } from "../../../../contextProjection.mjs";
|
|
10
|
+
import { createHeadlessClient } from "../../../services/headlessClient/index.mjs";
|
|
11
|
+
import { createPiExtensionHost, preloadPiExtensions, resolvePiExtensionEntries, resolvePiSettingsPackageEntries } from "../../../services/piExtensionHost/index.mjs";
|
|
12
|
+
import { formatToolPrompt } from "../../../services/toolPrompt/index.mjs";
|
|
13
|
+
import { createHeadlessChildSessionServiceProvider } from "../../child/adapters/headlessChildSessionService.mjs";
|
|
14
|
+
import { randomUUID } from "node:crypto";
|
|
15
|
+
import fs from "node:fs";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import { Value } from "typebox/value";
|
|
18
|
+
import { BACKGROUND_CONTEXT } from "@earendil-works/pi-agent-core/harness/context";
|
|
19
|
+
import { value } from "@earendil-works/pi-agent-core/harness/session";
|
|
20
|
+
import { formatSkillsForSystemPrompt } from "@earendil-works/pi-agent-core";
|
|
21
|
+
import { ModelRuntime, SettingsManager, getAgentDir, loadProjectContextFiles, parseArgs, resolveCliModel, resolveModelScopeWithDiagnostics } from "@earendil-works/pi-coding-agent";
|
|
22
|
+
//#region src/systems/main/adapters/headlessSessionHost.ts
|
|
23
|
+
const EXTERNAL_OPERATION = "external";
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function stringArray(value) {
|
|
28
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
29
|
+
}
|
|
30
|
+
/** Restores the last accepted live selection from journal projections, falling back on launch configuration. */
|
|
31
|
+
function restoreHeadlessSelection(entries, fallback) {
|
|
32
|
+
let projected;
|
|
33
|
+
for (let index = entries.length - 1; index >= 0 && projected === void 0; index -= 1) {
|
|
34
|
+
const entry = entries[index];
|
|
35
|
+
if (!isRecord(entry) || entry.type !== "custom" || !isRecord(entry.data)) continue;
|
|
36
|
+
if (projected === void 0 && entry.customType === "doom-context") {
|
|
37
|
+
const selection = entry.data.selection;
|
|
38
|
+
if (!isRecord(selection) || typeof selection.majorMode !== "string") continue;
|
|
39
|
+
const domains = stringArray(selection.domains);
|
|
40
|
+
if (domains === void 0 || selection.profile !== void 0 && typeof selection.profile !== "string") continue;
|
|
41
|
+
projected = {
|
|
42
|
+
majorMode: selection.majorMode,
|
|
43
|
+
domains,
|
|
44
|
+
...typeof selection.profile === "string" ? { profile: selection.profile } : {}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...fallback,
|
|
50
|
+
...projected
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function isJsonValue(value) {
|
|
54
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
55
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
56
|
+
if (Array.isArray(value)) return value.every(isJsonValue);
|
|
57
|
+
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
58
|
+
}
|
|
59
|
+
function isJsonObject(value) {
|
|
60
|
+
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
61
|
+
}
|
|
62
|
+
function isToolContent(value) {
|
|
63
|
+
return Array.isArray(value) && value.every((part) => {
|
|
64
|
+
if (!isRecord(part)) return false;
|
|
65
|
+
if (part.type === "text") return typeof part.text === "string";
|
|
66
|
+
return part.type === "image" && typeof part.data === "string" && typeof part.mimeType === "string";
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function isUsage(value) {
|
|
70
|
+
if (!isRecord(value) || !isRecord(value.cost)) return false;
|
|
71
|
+
const cost = value.cost;
|
|
72
|
+
return [
|
|
73
|
+
"input",
|
|
74
|
+
"output",
|
|
75
|
+
"cacheRead",
|
|
76
|
+
"cacheWrite",
|
|
77
|
+
"totalTokens"
|
|
78
|
+
].every((key) => typeof value[key] === "number" && Number.isFinite(value[key])) && [
|
|
79
|
+
"input",
|
|
80
|
+
"output",
|
|
81
|
+
"cacheRead",
|
|
82
|
+
"cacheWrite",
|
|
83
|
+
"total"
|
|
84
|
+
].every((key) => typeof cost[key] === "number" && Number.isFinite(cost[key]));
|
|
85
|
+
}
|
|
86
|
+
function isAgentMessage(value) {
|
|
87
|
+
if (!isRecord(value) || typeof value.timestamp !== "number" || !Number.isFinite(value.timestamp)) return false;
|
|
88
|
+
if (value.role === "user") return typeof value.content === "string" || Array.isArray(value.content);
|
|
89
|
+
if (!Array.isArray(value.content)) return false;
|
|
90
|
+
if (value.role === "assistant") return typeof value.api === "string" && typeof value.provider === "string" && typeof value.model === "string" && typeof value.stopReason === "string" && isUsage(value.usage);
|
|
91
|
+
return value.role === "toolResult" && typeof value.toolCallId === "string" && typeof value.toolName === "string" && typeof value.isError === "boolean";
|
|
92
|
+
}
|
|
93
|
+
function isCompactResult(value) {
|
|
94
|
+
return isRecord(value) && typeof value.summary === "string" && typeof value.tokensBefore === "number" && Number.isFinite(value.tokensBefore) && Array.isArray(value.retainedTail) && value.retainedTail.every(isAgentMessage) && (value.usage === void 0 || isUsage(value.usage)) && (value.details === void 0 || isJsonValue(value.details));
|
|
95
|
+
}
|
|
96
|
+
const unsupported = (parsed) => {
|
|
97
|
+
const match = [
|
|
98
|
+
["--help", parsed.help],
|
|
99
|
+
["--version", parsed.version],
|
|
100
|
+
["--mode", parsed.mode],
|
|
101
|
+
["--print", parsed.print],
|
|
102
|
+
["--export", parsed.export],
|
|
103
|
+
["--no-session", parsed.noSession],
|
|
104
|
+
["--continue", parsed.continue],
|
|
105
|
+
["--resume", parsed.resume],
|
|
106
|
+
["--fork", parsed.fork],
|
|
107
|
+
["--list-models", parsed.listModels],
|
|
108
|
+
["--offline", parsed.offline],
|
|
109
|
+
["--tui-mode", parsed.tuiMode],
|
|
110
|
+
["--extensions", parsed.extensions],
|
|
111
|
+
["--no-extensions", parsed.noExtensions],
|
|
112
|
+
["--skills", parsed.skills],
|
|
113
|
+
["--no-skills", parsed.noSkills],
|
|
114
|
+
["--prompt-templates", parsed.promptTemplates],
|
|
115
|
+
["--no-prompt-templates", parsed.noPromptTemplates],
|
|
116
|
+
["--themes", parsed.themes],
|
|
117
|
+
["--no-themes", parsed.noThemes],
|
|
118
|
+
["--no-context-files", parsed.noContextFiles],
|
|
119
|
+
["--tools", parsed.tools],
|
|
120
|
+
["--exclude-tools", parsed.excludeTools],
|
|
121
|
+
["--no-tools", parsed.noTools],
|
|
122
|
+
["--no-builtin-tools", parsed.noBuiltinTools],
|
|
123
|
+
["--project-trust-override", parsed.projectTrustOverride],
|
|
124
|
+
["--verbose", parsed.verbose]
|
|
125
|
+
].find(([, value]) => value !== void 0 && value !== false);
|
|
126
|
+
if (match) return `Direct headless mode does not support ${match[0]}.`;
|
|
127
|
+
if (parsed.messages.length > 0 || parsed.fileArgs.length > 0) return "Direct headless mode does not support positional prompts or files.";
|
|
128
|
+
const unknown = parsed.unknownFlags.keys().next().value;
|
|
129
|
+
return typeof unknown === "string" ? `Direct headless mode does not support --${unknown}.` : void 0;
|
|
130
|
+
};
|
|
131
|
+
/** Validate the Pi flags that remain after Doom's harness flags are removed. */
|
|
132
|
+
function validateDirectHeadlessArgs(agentArgs) {
|
|
133
|
+
if (agentArgs.includes("--mode")) throw new Error("Direct headless mode does not support --mode.");
|
|
134
|
+
const parsed = parseArgs([...agentArgs]);
|
|
135
|
+
const diagnostics = parsed.diagnostics.filter((diagnostic) => diagnostic.type === "error");
|
|
136
|
+
if (diagnostics.length) throw new Error(diagnostics.map((diagnostic) => diagnostic.message).join("\n"));
|
|
137
|
+
const error = unsupported(parsed);
|
|
138
|
+
if (error) throw new Error(error);
|
|
139
|
+
return parsed;
|
|
140
|
+
}
|
|
141
|
+
function modelIdentity(model) {
|
|
142
|
+
return {
|
|
143
|
+
provider: model.provider,
|
|
144
|
+
id: model.id
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
async function resolveModel(parsed, modelRuntime, settings) {
|
|
148
|
+
const cli = resolveCliModel({
|
|
149
|
+
cliProvider: parsed.provider,
|
|
150
|
+
cliModel: parsed.model,
|
|
151
|
+
cliThinking: parsed.thinking,
|
|
152
|
+
modelRuntime
|
|
153
|
+
});
|
|
154
|
+
if (cli.error) throw new Error(cli.error);
|
|
155
|
+
let scoped;
|
|
156
|
+
if (parsed.models !== void 0 && parsed.models.length > 0) {
|
|
157
|
+
scoped = (await resolveModelScopeWithDiagnostics(parsed.models, modelRuntime)).scopedModels[0]?.model;
|
|
158
|
+
if (scoped === void 0) throw new Error(`No configured model matched --models ${parsed.models.join(", ")}.`);
|
|
159
|
+
}
|
|
160
|
+
const configured = cli.model ?? scoped ?? (settings.getDefaultProvider() && settings.getDefaultModel() ? modelRuntime.getModel(settings.getDefaultProvider(), settings.getDefaultModel()) : void 0) ?? (await modelRuntime.getAvailable())[0];
|
|
161
|
+
if (configured === void 0) throw new Error("Direct headless mode could not resolve a configured model.");
|
|
162
|
+
return {
|
|
163
|
+
model: configured,
|
|
164
|
+
thinkingLevel: cli.thinkingLevel ?? parsed.thinking ?? settings.getModelThinkingLevel(configured.provider, configured.id) ?? settings.getDefaultThinkingLevel()
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function mapResources(resources) {
|
|
168
|
+
const skills = [];
|
|
169
|
+
const advertised = [];
|
|
170
|
+
const promptTemplates = [];
|
|
171
|
+
const context = [];
|
|
172
|
+
for (const resource of resources) if (resource.kind === "skill") {
|
|
173
|
+
const skill = headlessHarnessSkill(resource);
|
|
174
|
+
skills.push(skill);
|
|
175
|
+
if (resource.path !== void 0 && !advertised.some((entry) => entry.name === skill.name)) advertised.push(skill);
|
|
176
|
+
} else if (resource.kind === "prompt") promptTemplates.push({
|
|
177
|
+
name: resource.name,
|
|
178
|
+
content: resource.text
|
|
179
|
+
});
|
|
180
|
+
else context.push(resource.text);
|
|
181
|
+
return {
|
|
182
|
+
harness: {
|
|
183
|
+
skills,
|
|
184
|
+
promptTemplates
|
|
185
|
+
},
|
|
186
|
+
context,
|
|
187
|
+
advertised
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function toolAdapter(tool, executionContext, reportedErrors) {
|
|
191
|
+
return {
|
|
192
|
+
name: tool.name,
|
|
193
|
+
label: tool.label ?? tool.name,
|
|
194
|
+
description: tool.description,
|
|
195
|
+
parameters: tool.parameters,
|
|
196
|
+
...tool.promptSnippet === void 0 ? {} : { promptSnippet: tool.promptSnippet },
|
|
197
|
+
...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines },
|
|
198
|
+
...tool.executionMode === void 0 ? {} : { executionMode: tool.executionMode === "parallel" ? "parallel" : "sequential" },
|
|
199
|
+
async execute(toolCallId, parameters, onUpdate, _toolContext, _invocation, context) {
|
|
200
|
+
const result = await tool.execute(toolCallId, parameters, context.abortSignal, (partial) => onUpdate({
|
|
201
|
+
content: partial.content,
|
|
202
|
+
details: partial.details
|
|
203
|
+
}), executionContext());
|
|
204
|
+
if (result.isError === true) reportedErrors.add(toolCallId);
|
|
205
|
+
return {
|
|
206
|
+
content: result.content,
|
|
207
|
+
details: result.details
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function eventHook(event) {
|
|
213
|
+
return {
|
|
214
|
+
run_start: "agent_start",
|
|
215
|
+
run_resume: "agent_start",
|
|
216
|
+
run_end: "agent_settled",
|
|
217
|
+
turn_start: "turn_start",
|
|
218
|
+
turn_end: "turn_end",
|
|
219
|
+
message_start: "message_start",
|
|
220
|
+
message_update: "message_update",
|
|
221
|
+
message_end: "message_end",
|
|
222
|
+
tool_start: "tool_execution_start",
|
|
223
|
+
tool_update: "tool_execution_update",
|
|
224
|
+
tool_end: "tool_execution_end",
|
|
225
|
+
compaction_end: "session_compact",
|
|
226
|
+
navigation_end: "session_tree"
|
|
227
|
+
}[event];
|
|
228
|
+
}
|
|
229
|
+
function emitTo(listeners, frame) {
|
|
230
|
+
const snapshot = [...listeners];
|
|
231
|
+
for (const listener of snapshot) try {
|
|
232
|
+
listener(frame);
|
|
233
|
+
} catch {}
|
|
234
|
+
}
|
|
235
|
+
function createHeadlessCompositionPublisher(runtime, host, environment, groups, readSystemPrompt) {
|
|
236
|
+
let countTokens;
|
|
237
|
+
let contextRevision = 0;
|
|
238
|
+
let publishedContext;
|
|
239
|
+
let tail = Promise.resolve();
|
|
240
|
+
const publish = async (selection) => {
|
|
241
|
+
countTokens ??= (await import("gpt-tokenizer")).countTokens;
|
|
242
|
+
const inventory = host.getContextInventory(selection, countTokens);
|
|
243
|
+
const prompt = readSystemPrompt();
|
|
244
|
+
const promptCost = prompt === void 0 ? void 0 : {
|
|
245
|
+
tokens: countTokens(prompt.text),
|
|
246
|
+
stage: prompt.stage
|
|
247
|
+
};
|
|
248
|
+
const context = projectContext({
|
|
249
|
+
revision: contextRevision + 1,
|
|
250
|
+
majorMode: selection.majorMode,
|
|
251
|
+
...selection.profile === void 0 ? {} : { profile: selection.profile },
|
|
252
|
+
groups: groups(selection),
|
|
253
|
+
domains: selection.domains,
|
|
254
|
+
sources: inventory.sources,
|
|
255
|
+
skills: inventory.skills,
|
|
256
|
+
attribution: inventory.attribution,
|
|
257
|
+
countTokens,
|
|
258
|
+
...promptCost === void 0 ? {} : { systemPrompt: promptCost }
|
|
259
|
+
});
|
|
260
|
+
const contextKey = JSON.stringify({
|
|
261
|
+
...context,
|
|
262
|
+
revision: 0,
|
|
263
|
+
promptText: prompt?.text
|
|
264
|
+
});
|
|
265
|
+
if (contextKey === publishedContext) return;
|
|
266
|
+
const revision = contextRevision + 1;
|
|
267
|
+
const details = buildContextDetail({
|
|
268
|
+
sources: inventory.sources,
|
|
269
|
+
skills: inventory.skills,
|
|
270
|
+
countTokens,
|
|
271
|
+
...prompt === void 0 || promptCost === void 0 ? {} : { systemPrompt: {
|
|
272
|
+
text: prompt.text,
|
|
273
|
+
tokens: promptCost.tokens,
|
|
274
|
+
stage: prompt.stage
|
|
275
|
+
} }
|
|
276
|
+
});
|
|
277
|
+
await runtime.appendCustomEntry(DOOM_CONTEXT_ENTRY_TYPE, {
|
|
278
|
+
...context,
|
|
279
|
+
revision
|
|
280
|
+
});
|
|
281
|
+
writeContextDetail(runtime.sessionId, revision, details, environment);
|
|
282
|
+
contextRevision = revision;
|
|
283
|
+
publishedContext = contextKey;
|
|
284
|
+
};
|
|
285
|
+
return (selection = host.context.selection) => {
|
|
286
|
+
tail = tail.then(() => publish(selection), () => publish(selection));
|
|
287
|
+
return tail;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/** Create the gated, same-process host used by direct-headless startup tests. */
|
|
291
|
+
async function createHeadlessSessionHost(options) {
|
|
292
|
+
const parsed = validateDirectHeadlessArgs(options.agentArgs);
|
|
293
|
+
const agentDir = getAgentDir();
|
|
294
|
+
const settings = SettingsManager.create(options.cwd, agentDir);
|
|
295
|
+
const modelRuntime = await ModelRuntime.create({
|
|
296
|
+
authPath: path.join(agentDir, "auth.json"),
|
|
297
|
+
modelsPath: path.join(agentDir, "models.json"),
|
|
298
|
+
refreshOnCreate: false
|
|
299
|
+
});
|
|
300
|
+
const piExtensionPaths = options.piExtensions === false ? [] : [...options.piExtensionPaths ?? resolvePiExtensionEntries(options.repoRoot), ...await resolvePiSettingsPackageEntries({
|
|
301
|
+
cwd: options.cwd,
|
|
302
|
+
agentDir,
|
|
303
|
+
settings,
|
|
304
|
+
...options.onNotice === void 0 ? {} : { onNotice: options.onNotice }
|
|
305
|
+
})];
|
|
306
|
+
const piPreload = await preloadPiExtensions({
|
|
307
|
+
cwd: options.cwd,
|
|
308
|
+
agentDir,
|
|
309
|
+
models: modelRuntime,
|
|
310
|
+
extensionPaths: [...new Set(piExtensionPaths)],
|
|
311
|
+
...options.onNotice === void 0 ? {} : { onNotice: options.onNotice }
|
|
312
|
+
});
|
|
313
|
+
const resolved = await resolveModel(parsed, modelRuntime, settings);
|
|
314
|
+
if (parsed.apiKey !== void 0) await modelRuntime.setRuntimeApiKey(resolved.model.provider, parsed.apiKey);
|
|
315
|
+
const reportedToolErrors = /* @__PURE__ */ new Set();
|
|
316
|
+
let promptPreparationFailed = false;
|
|
317
|
+
let headlessReady = false;
|
|
318
|
+
let toolGuidance = [];
|
|
319
|
+
const initialSystemPrompt = [parsed.systemPrompt, ...parsed.appendSystemPrompt ?? []].filter(Boolean).join("\n\n");
|
|
320
|
+
/**
|
|
321
|
+
* AGENTS.md and friends, in Pi's own framing.
|
|
322
|
+
*
|
|
323
|
+
* The server had none of this: its prompt began at the --system-prompt flag, so a
|
|
324
|
+
* repository's own instructions reached a terminal session and never a cockpit one.
|
|
325
|
+
* Mirrors @earendil-works/pi-coding-agent@0.86.0 dist/core/system-prompt.js:21-27
|
|
326
|
+
* (the customPrompt branch, which is the shape this host matches). `buildSystemPrompt`
|
|
327
|
+
* is not exported and the package exports map has no wildcard, so the four literals
|
|
328
|
+
* below are copied; re-diff them against that file on upgrade.
|
|
329
|
+
*
|
|
330
|
+
* Not trust-gated, deliberately: TRUST_REQUIRING_PROJECT_CONFIG_RESOURCES in Pi's
|
|
331
|
+
* trust-manager covers settings.json, extensions, skills, prompts, themes, SYSTEM.md
|
|
332
|
+
* and APPEND_SYSTEM.md, all of which execute or replace instructions. AGENTS.md is
|
|
333
|
+
* advisory prose and Pi appends it unconditionally; gating it here would be a
|
|
334
|
+
* divergence from Pi rather than parity with it.
|
|
335
|
+
*
|
|
336
|
+
* Resolved once: cwd is fixed for the host's lifetime, and composeSystemPrompt runs
|
|
337
|
+
* on every generation.
|
|
338
|
+
*/
|
|
339
|
+
const projectContextFiles = loadProjectContextFiles({
|
|
340
|
+
cwd: options.cwd,
|
|
341
|
+
agentDir
|
|
342
|
+
});
|
|
343
|
+
const projectContextBlock = (() => {
|
|
344
|
+
if (projectContextFiles.length === 0) return "";
|
|
345
|
+
return `<project_context>\n\nProject-specific instructions and guidelines:\n\n${projectContextFiles.map(({ path: filePath, content }) => `<project_instructions path="${filePath}">\n${content}\n</project_instructions>\n`).join("\n")}\n</project_context>`;
|
|
346
|
+
})();
|
|
347
|
+
const workingDirectoryLine = `Current working directory: ${options.cwd.replace(/\\/g, "/")}`;
|
|
348
|
+
/**
|
|
349
|
+
* Everything the prompt is made of before a package has had a say.
|
|
350
|
+
*
|
|
351
|
+
* Shared with the runtime callback below rather than copied. Assembling it is
|
|
352
|
+
* pure; the hook pass that follows it there is not, which is why the context
|
|
353
|
+
* panel is shown this rather than a prompt built for the panel's sake.
|
|
354
|
+
*/
|
|
355
|
+
const composeSystemPrompt = (resources) => {
|
|
356
|
+
const mapped = mapResources(resources);
|
|
357
|
+
const skills = toolGuidance.some((entry) => entry.name === "load_skill") ? "" : formatSkillsForSystemPrompt(mapped.advertised).trim();
|
|
358
|
+
return [
|
|
359
|
+
initialSystemPrompt,
|
|
360
|
+
projectContextBlock,
|
|
361
|
+
formatToolPrompt(toolGuidance),
|
|
362
|
+
skills,
|
|
363
|
+
...mapped.context,
|
|
364
|
+
workingDirectoryLine
|
|
365
|
+
].filter(Boolean).join("\n\n");
|
|
366
|
+
};
|
|
367
|
+
/** The last prompt a turn actually built, once one has. */
|
|
368
|
+
let builtSystemPrompt;
|
|
369
|
+
/**
|
|
370
|
+
* What the context panel is shown: the prompt a turn sent, or the hook-free
|
|
371
|
+
* base until one has.
|
|
372
|
+
*
|
|
373
|
+
* The base is composed from the applied snapshot rather than a fresh read, so
|
|
374
|
+
* it answers at exactly the moments the tool inventory beside it answers.
|
|
375
|
+
* Re-reading refuses while a selection is mid-apply, and the panel would then
|
|
376
|
+
* spend a published revision saying there is no prompt before the next one
|
|
377
|
+
* said there is.
|
|
378
|
+
*/
|
|
379
|
+
const readSystemPrompt = () => {
|
|
380
|
+
if (!headlessHost) return void 0;
|
|
381
|
+
if (builtSystemPrompt !== void 0) return {
|
|
382
|
+
text: builtSystemPrompt,
|
|
383
|
+
stage: "effective"
|
|
384
|
+
};
|
|
385
|
+
return {
|
|
386
|
+
text: composeSystemPrompt(headlessHost.appliedResources),
|
|
387
|
+
stage: "base"
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
const beforeTool = async (event) => {
|
|
391
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
392
|
+
const patches = await headlessHost.dispatchHook("tool_call", event);
|
|
393
|
+
let args = event.args;
|
|
394
|
+
let block;
|
|
395
|
+
for (const patch of patches) {
|
|
396
|
+
if (!isRecord(patch)) continue;
|
|
397
|
+
if (patch.args !== void 0) {
|
|
398
|
+
if (!isJsonObject(patch.args)) throw new Error("Invalid headless tool arguments");
|
|
399
|
+
args = patch.args;
|
|
400
|
+
}
|
|
401
|
+
if (patch.block === void 0) continue;
|
|
402
|
+
if (!isRecord(patch.block) || typeof patch.block.reason !== "string" || patch.block.terminate !== void 0 && typeof patch.block.terminate !== "boolean") throw new Error("Invalid headless tool denial");
|
|
403
|
+
block = {
|
|
404
|
+
reason: patch.block.reason,
|
|
405
|
+
...typeof patch.block.terminate === "boolean" ? { terminate: patch.block.terminate } : {}
|
|
406
|
+
};
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
...args === event.args ? {} : { args },
|
|
411
|
+
...block === void 0 ? {} : { block }
|
|
412
|
+
};
|
|
413
|
+
};
|
|
414
|
+
const afterTool = async (event) => {
|
|
415
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
416
|
+
const original = reportedToolErrors.delete(event.toolCallId) ? {
|
|
417
|
+
...event,
|
|
418
|
+
isError: true
|
|
419
|
+
} : event;
|
|
420
|
+
const patches = await headlessHost.dispatchHook("tool_result", original);
|
|
421
|
+
let content = original.content;
|
|
422
|
+
let details = original.details;
|
|
423
|
+
let isError = original.isError;
|
|
424
|
+
let usage = original.usage;
|
|
425
|
+
let terminate;
|
|
426
|
+
for (const patch of patches) {
|
|
427
|
+
if (!isRecord(patch)) continue;
|
|
428
|
+
if (isToolContent(patch.content)) content = patch.content;
|
|
429
|
+
if ("details" in patch && isJsonValue(patch.details)) details = patch.details;
|
|
430
|
+
if (typeof patch.isError === "boolean") isError = patch.isError;
|
|
431
|
+
if (isUsage(patch.usage)) usage = patch.usage;
|
|
432
|
+
if (typeof patch.terminate === "boolean") terminate = patch.terminate;
|
|
433
|
+
}
|
|
434
|
+
return {
|
|
435
|
+
...content === event.content ? {} : { content },
|
|
436
|
+
...details === event.details ? {} : { details },
|
|
437
|
+
...isError === event.isError ? {} : { isError },
|
|
438
|
+
...usage === event.usage ? {} : { usage },
|
|
439
|
+
...terminate === void 0 ? {} : { terminate }
|
|
440
|
+
};
|
|
441
|
+
};
|
|
442
|
+
const runtime = await createDirectHarnessRuntime({
|
|
443
|
+
cwd: options.cwd,
|
|
444
|
+
sessionId: options.sessionId,
|
|
445
|
+
...options.parentSessionId === void 0 ? {} : { parentSessionId: options.parentSessionId },
|
|
446
|
+
storage: "sqlite",
|
|
447
|
+
historyOwnership: createHistoryOwnership({ sourceFormat: "sqlite" }),
|
|
448
|
+
sessionName: parsed.name ?? options.sessionName,
|
|
449
|
+
...parsed.session === void 0 ? {} : { sessionPath: parsed.session },
|
|
450
|
+
sessionsRoot: parsed.sessionDir ?? path.join(agentDir, "server", "sessions"),
|
|
451
|
+
models: modelRuntime,
|
|
452
|
+
model: resolved.model,
|
|
453
|
+
...resolved.thinkingLevel === void 0 ? {} : { thinkingLevel: resolved.thinkingLevel },
|
|
454
|
+
beforeModelRequest: async ({ phase }) => {
|
|
455
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
456
|
+
if (phase === "turn" && options.inheritedSelection) await headlessHost.inheritSelection(await options.inheritedSelection());
|
|
457
|
+
},
|
|
458
|
+
transformContext: async (event) => {
|
|
459
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
460
|
+
const patches = await headlessHost.dispatchHook("context", event);
|
|
461
|
+
let messages = event.messages;
|
|
462
|
+
let systemPrompt = event.systemPrompt;
|
|
463
|
+
for (const patch of patches) {
|
|
464
|
+
if (!isRecord(patch)) continue;
|
|
465
|
+
if (patch.messages !== void 0) {
|
|
466
|
+
if (!Array.isArray(patch.messages)) throw new Error("Invalid headless context messages");
|
|
467
|
+
messages = patch.messages;
|
|
468
|
+
}
|
|
469
|
+
if (patch.systemPrompt !== void 0) {
|
|
470
|
+
if (typeof patch.systemPrompt !== "string") throw new Error("Invalid headless context system prompt");
|
|
471
|
+
systemPrompt = patch.systemPrompt;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
messages: await (piHost?.transformContext(messages) ?? messages),
|
|
476
|
+
systemPrompt
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
beforeTool,
|
|
480
|
+
afterTool,
|
|
481
|
+
beforePayload: async (event) => {
|
|
482
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
483
|
+
const patches = await headlessHost.dispatchHook("before_provider_request", event);
|
|
484
|
+
let payload = event.payload;
|
|
485
|
+
for (const patch of patches) {
|
|
486
|
+
if (patch === void 0 || patch === null) continue;
|
|
487
|
+
if (!isRecord(patch) || !("payload" in patch)) throw new Error("Invalid headless provider payload patch");
|
|
488
|
+
payload = patch.payload;
|
|
489
|
+
}
|
|
490
|
+
return { payload };
|
|
491
|
+
},
|
|
492
|
+
beforeCompaction: async (event) => {
|
|
493
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
494
|
+
const patches = await headlessHost.dispatchHook("session_before_compact", {
|
|
495
|
+
reason: event.reason,
|
|
496
|
+
preparation: event.preparation,
|
|
497
|
+
...event.customInstructions === void 0 ? {} : {
|
|
498
|
+
instructions: event.customInstructions,
|
|
499
|
+
customInstructions: event.customInstructions
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
try {
|
|
503
|
+
for (const patch of patches) {
|
|
504
|
+
if (patch === void 0 || patch === null) continue;
|
|
505
|
+
if (!isRecord(patch)) throw new Error("Invalid headless compaction patch");
|
|
506
|
+
if (patch.cancel !== void 0 && typeof patch.cancel !== "boolean") throw new Error("Invalid headless compaction cancellation");
|
|
507
|
+
if (patch.decline !== void 0 && typeof patch.decline !== "boolean") throw new Error("Invalid headless compaction decline");
|
|
508
|
+
const decline = patch.cancel === true || patch.decline === true;
|
|
509
|
+
if (decline && patch.compaction !== void 0) throw new Error("Conflicting headless compaction patch");
|
|
510
|
+
if (decline) return { decline: true };
|
|
511
|
+
if (patch.compaction !== void 0) {
|
|
512
|
+
if (!isCompactResult(patch.compaction)) throw new Error("Invalid headless compaction result");
|
|
513
|
+
return { compaction: patch.compaction };
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
} catch (error) {
|
|
517
|
+
options.onNotice?.(`Headless compaction hook rejected: ${error instanceof Error ? error.message : String(error)}`);
|
|
518
|
+
return { decline: true };
|
|
519
|
+
}
|
|
520
|
+
return piHost?.beforeCompaction(event);
|
|
521
|
+
},
|
|
522
|
+
systemPrompt: async () => {
|
|
523
|
+
try {
|
|
524
|
+
if (!headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
525
|
+
let prompt = composeSystemPrompt(await headlessHost.readResources());
|
|
526
|
+
const patches = await headlessHost.dispatchHook("before_agent_start", { systemPrompt: prompt });
|
|
527
|
+
for (const patch of patches) if (patch && typeof patch === "object" && "systemPrompt" in patch && typeof patch.systemPrompt === "string") prompt = patch.systemPrompt;
|
|
528
|
+
promptPreparationFailed = false;
|
|
529
|
+
if (prompt !== builtSystemPrompt) {
|
|
530
|
+
builtSystemPrompt = prompt;
|
|
531
|
+
try {
|
|
532
|
+
await publishComposition();
|
|
533
|
+
} catch {}
|
|
534
|
+
}
|
|
535
|
+
return prompt;
|
|
536
|
+
} catch {
|
|
537
|
+
promptPreparationFailed = true;
|
|
538
|
+
return "";
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
listCommands: () => {
|
|
542
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
543
|
+
return headlessHost.listCommands();
|
|
544
|
+
},
|
|
545
|
+
dispatchCommand: async (text) => {
|
|
546
|
+
const match = /^\/(\S+)(?:\s+([\s\S]*))?$/.exec(text);
|
|
547
|
+
if (!match) return false;
|
|
548
|
+
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
549
|
+
const name = match[1];
|
|
550
|
+
const args = match[2] ?? "";
|
|
551
|
+
if (!headlessHost.listCommands().some((entry) => entry.name === name)) return false;
|
|
552
|
+
await headlessHost.dispatchCommand(name, args);
|
|
553
|
+
return true;
|
|
554
|
+
},
|
|
555
|
+
guardModelRequest: () => {
|
|
556
|
+
if (!headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
const opened = await (async () => {
|
|
560
|
+
await runtime.session.setValue(value("doompi.session", "workspaceRoot"), options.repoRoot, BACKGROUND_CONTEXT);
|
|
561
|
+
await runtime.session.setValue(value("doompi.session", "execution"), JSON.stringify({
|
|
562
|
+
cwd: options.cwd,
|
|
563
|
+
repoRoot: options.repoRoot,
|
|
564
|
+
workspaceId: options.workspaceId,
|
|
565
|
+
groupingRoot: options.groupingRoot ?? options.repoRoot,
|
|
566
|
+
parentSessionId: options.parentSessionId,
|
|
567
|
+
sessionProvenance: options.sessionProvenance,
|
|
568
|
+
inheritedArtifact: options.inheritedArtifact
|
|
569
|
+
}), BACKGROUND_CONTEXT);
|
|
570
|
+
return {
|
|
571
|
+
model: await runtime.lane.getModel(BACKGROUND_CONTEXT),
|
|
572
|
+
entries: (await Promise.all([DOOM_CONTEXT_ENTRY_TYPE].map((customType) => runtime.lane.findEntries({
|
|
573
|
+
type: "custom",
|
|
574
|
+
customType,
|
|
575
|
+
order: "newestFirst",
|
|
576
|
+
limit: 1
|
|
577
|
+
}, BACKGROUND_CONTEXT)))).flat()
|
|
578
|
+
};
|
|
579
|
+
})().catch(async (error) => {
|
|
580
|
+
await runtime.dispose().catch((disposeError) => options.onNotice?.(`Session runtime failed to close: ${String(disposeError)}`));
|
|
581
|
+
throw error;
|
|
582
|
+
});
|
|
583
|
+
let currentModel = opened.model;
|
|
584
|
+
const sessionContext = options.workspaceId === void 0 ? void 0 : Object.freeze({
|
|
585
|
+
sessionId: runtime.sessionId,
|
|
586
|
+
workspaceId: options.workspaceId,
|
|
587
|
+
workspaceRoot: options.groupingRoot ?? options.repoRoot,
|
|
588
|
+
checkoutRoot: options.repoRoot,
|
|
589
|
+
cwd: options.cwd,
|
|
590
|
+
...options.parentSessionId === void 0 ? {} : { parentSessionId: options.parentSessionId },
|
|
591
|
+
...options.sessionProvenance === void 0 ? {} : { provenance: options.sessionProvenance }
|
|
592
|
+
});
|
|
593
|
+
const entries = opened.entries;
|
|
594
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
595
|
+
const selectionListeners = /* @__PURE__ */ new Set();
|
|
596
|
+
let latestSelection = options.selection;
|
|
597
|
+
const initialSelection = restoreHeadlessSelection(entries, options.selection);
|
|
598
|
+
let headlessHost;
|
|
599
|
+
let mcpServiceRoot;
|
|
600
|
+
let mcpLifecycle = new AbortController();
|
|
601
|
+
let piHost;
|
|
602
|
+
let client;
|
|
603
|
+
let disposed = false;
|
|
604
|
+
let disposePromise;
|
|
605
|
+
let publishComposition = async () => {
|
|
606
|
+
throw new Error("Direct headless composition publisher is not installed.");
|
|
607
|
+
};
|
|
608
|
+
const readMcpContext = (signal) => {
|
|
609
|
+
signal.throwIfAborted();
|
|
610
|
+
const host = headlessHost;
|
|
611
|
+
if (!host || disposed) throw new Error("Session context is unavailable.");
|
|
612
|
+
const status = host.status;
|
|
613
|
+
if (!status.ready || status.requestedRevision !== status.appliedRevision) throw new Error("Session context is unavailable.");
|
|
614
|
+
const root = fs.realpathSync(options.repoRoot);
|
|
615
|
+
const globalInstruction = path.join(fs.realpathSync(agentDir), "AGENTS.md");
|
|
616
|
+
const instructions = projectContextFiles.flatMap(({ path: filePath, content }) => {
|
|
617
|
+
const relative = path.relative(options.repoRoot, filePath);
|
|
618
|
+
if (relative === "" || relative.startsWith("..") || path.isAbsolute(relative)) return [];
|
|
619
|
+
try {
|
|
620
|
+
const canonicalPath = fs.realpathSync(filePath);
|
|
621
|
+
if (canonicalPath === globalInstruction) return [];
|
|
622
|
+
const canonicalRelative = path.relative(root, canonicalPath);
|
|
623
|
+
if (canonicalRelative === "" || canonicalRelative.startsWith("..") || path.isAbsolute(canonicalRelative)) return [];
|
|
624
|
+
} catch {
|
|
625
|
+
return [];
|
|
626
|
+
}
|
|
627
|
+
return [{
|
|
628
|
+
path: relative.replaceAll(path.sep, "/"),
|
|
629
|
+
content
|
|
630
|
+
}];
|
|
631
|
+
});
|
|
632
|
+
const selection = host.context.selection;
|
|
633
|
+
const persona = host.appliedResources.find(({ name, kind }) => name === "doompi/profile-config" && kind === "context")?.text;
|
|
634
|
+
signal.throwIfAborted();
|
|
635
|
+
const current = host.status;
|
|
636
|
+
if (!current.ready || current.appliedRevision !== status.appliedRevision || current.requestedRevision !== current.appliedRevision) throw new Error("Session context changed. Call load_context again.");
|
|
637
|
+
return {
|
|
638
|
+
session: {
|
|
639
|
+
id: runtime.sessionId,
|
|
640
|
+
revision: status.appliedRevision
|
|
641
|
+
},
|
|
642
|
+
repository: {
|
|
643
|
+
root: options.repoRoot,
|
|
644
|
+
cwd: options.cwd
|
|
645
|
+
},
|
|
646
|
+
selection: {
|
|
647
|
+
profile: selection.profile ?? null,
|
|
648
|
+
domains: [...selection.domains],
|
|
649
|
+
majorMode: selection.majorMode,
|
|
650
|
+
activeLayers: [...selection.activeLayers],
|
|
651
|
+
minorModes: [...selection.state?.["minor-mode"] ?? []]
|
|
652
|
+
},
|
|
653
|
+
instructions,
|
|
654
|
+
persona: persona ?? null
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
const childSessionProvider = createHeadlessChildSessionServiceProvider({
|
|
658
|
+
parentSessionId: runtime.sessionId,
|
|
659
|
+
cwd: options.cwd,
|
|
660
|
+
sessionsRoot: parsed.sessionDir ?? path.join(agentDir, "server", "sessions"),
|
|
661
|
+
models: modelRuntime,
|
|
662
|
+
defaultModel: () => currentModel,
|
|
663
|
+
mcpTool: () => {
|
|
664
|
+
if (disposed || !headlessReady || !headlessHost?.status.ready) return void 0;
|
|
665
|
+
return mcpServiceRoot?.get(DOOM_CHILD_SESSION_MCP_TOOL_SERVICE);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
const completeAuxiliaryModel = async (reference, request) => {
|
|
669
|
+
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
670
|
+
request.signal?.throwIfAborted();
|
|
671
|
+
const separator = reference.indexOf("/");
|
|
672
|
+
const model = separator > 0 ? modelRuntime.getModel(reference.slice(0, separator), reference.slice(separator + 1)) : void 0;
|
|
673
|
+
if (!model || !modelRuntime.hasConfiguredAuth(model.provider)) throw new Error(`Model is not configured: ${reference}`);
|
|
674
|
+
if (!runtime.completeModel) throw new Error("The runtime does not support auxiliary model requests.");
|
|
675
|
+
const response = await runtime.completeModel(model, {
|
|
676
|
+
systemPrompt: request.systemPrompt,
|
|
677
|
+
messages: [{
|
|
678
|
+
role: "user",
|
|
679
|
+
content: request.input,
|
|
680
|
+
timestamp: Date.now()
|
|
681
|
+
}],
|
|
682
|
+
...request.tools ? { tools: [...request.tools] } : {}
|
|
683
|
+
}, {
|
|
684
|
+
signal: request.signal,
|
|
685
|
+
maxTokens: request.maxTokens,
|
|
686
|
+
cacheRetention: request.cacheRetention,
|
|
687
|
+
reasoningEffort: "none",
|
|
688
|
+
maxRetries: 0
|
|
689
|
+
});
|
|
690
|
+
request.signal?.throwIfAborted();
|
|
691
|
+
if (response.stopReason === "error" || response.stopReason === "aborted") throw new Error(response.errorMessage ?? `Model stopped: ${response.stopReason}`);
|
|
692
|
+
return response;
|
|
693
|
+
};
|
|
694
|
+
const executionContext = (selection) => ({
|
|
695
|
+
cwd: options.cwd,
|
|
696
|
+
repoRoot: options.repoRoot,
|
|
697
|
+
sessionId: runtime.sessionId,
|
|
698
|
+
...sessionContext === void 0 ? {} : { sessionContext },
|
|
699
|
+
environment: options.environment,
|
|
700
|
+
client: client.client,
|
|
701
|
+
model: currentModel === void 0 ? void 0 : modelIdentity(currentModel),
|
|
702
|
+
selection,
|
|
703
|
+
textCompletion: {
|
|
704
|
+
available(reference) {
|
|
705
|
+
const separator = reference.indexOf("/");
|
|
706
|
+
return separator > 0 && !!modelRuntime.getModel(reference.slice(0, separator), reference.slice(separator + 1)) && modelRuntime.hasConfiguredAuth(reference.slice(0, separator));
|
|
707
|
+
},
|
|
708
|
+
async complete(reference, request) {
|
|
709
|
+
return (await completeAuxiliaryModel(reference, {
|
|
710
|
+
...request,
|
|
711
|
+
tools: void 0
|
|
712
|
+
})).content.filter((part) => part.type === "text").map((part) => part.text).join("").trim();
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
toolCompletion: { async complete(reference, request) {
|
|
716
|
+
const response = await completeAuxiliaryModel(reference, request);
|
|
717
|
+
if (response.stopReason === "length") throw new Error("Auxiliary tool request exceeded its output limit.");
|
|
718
|
+
return {
|
|
719
|
+
toolCalls: response.content.filter((part) => part.type === "toolCall"),
|
|
720
|
+
usage: response.usage
|
|
721
|
+
};
|
|
722
|
+
} },
|
|
723
|
+
session: {
|
|
724
|
+
async readModelSettings() {
|
|
725
|
+
const model = await runtime.lane.getModel(BACKGROUND_CONTEXT);
|
|
726
|
+
const thinkingLevel = await runtime.lane.getThinkingLevel(BACKGROUND_CONTEXT);
|
|
727
|
+
return {
|
|
728
|
+
...model ? { model: modelIdentity(model) } : {},
|
|
729
|
+
thinkingLevel
|
|
730
|
+
};
|
|
731
|
+
},
|
|
732
|
+
async setModelSettings(settings) {
|
|
733
|
+
if (settings.model) await runtime.setModel(settings.model);
|
|
734
|
+
if (settings.thinkingLevel !== void 0) await runtime.setThinkingLevel(settings.thinkingLevel);
|
|
735
|
+
},
|
|
736
|
+
async forkSource() {
|
|
737
|
+
const metadata = runtime.session.metadata;
|
|
738
|
+
if (typeof metadata.path !== "string") throw new Error("The parent session has no persisted journal.");
|
|
739
|
+
const { leafId } = await runtime.readEntries();
|
|
740
|
+
return {
|
|
741
|
+
kind: "v4-fork",
|
|
742
|
+
sessionFile: metadata.path,
|
|
743
|
+
branch: runtime.laneName,
|
|
744
|
+
...leafId === null ? {} : { entryId: leafId }
|
|
745
|
+
};
|
|
746
|
+
},
|
|
747
|
+
entries: async (query) => await runtime.lane.findEntries({
|
|
748
|
+
...query,
|
|
749
|
+
order: query?.limit === void 0 ? "oldestFirst" : "newestFirst"
|
|
750
|
+
}, BACKGROUND_CONTEXT),
|
|
751
|
+
async appendCustomEntry(type, data) {
|
|
752
|
+
await runtime.appendCustomEntry(type, data);
|
|
753
|
+
},
|
|
754
|
+
prompt: (text, delivery) => delivery === "steer" ? runtime.steer(text) : delivery === "followUp" ? runtime.followUp(text) : runtime.prompt(text),
|
|
755
|
+
async admitPrompt(text, delivery) {
|
|
756
|
+
if (delivery === "followUp") return runtime.followUp(text);
|
|
757
|
+
(await runtime.submitPrompt(text, void 0, delivery === "steer" ? "steer" : void 0)).settled.catch((error) => client.client.notify({
|
|
758
|
+
body: error instanceof Error ? error.message : String(error),
|
|
759
|
+
level: "error"
|
|
760
|
+
}));
|
|
761
|
+
},
|
|
762
|
+
abort: () => runtime.abort(),
|
|
763
|
+
compact: (instructions) => runtime.compact(instructions),
|
|
764
|
+
async activity() {
|
|
765
|
+
const state = await runtime.readState();
|
|
766
|
+
return {
|
|
767
|
+
hasPendingMessages: Number(state.pendingMessageCount) > 0,
|
|
768
|
+
isIdle: !state.isStreaming && !state.isCompacting
|
|
769
|
+
};
|
|
770
|
+
},
|
|
771
|
+
setName: (name) => runtime.setName(name)
|
|
772
|
+
},
|
|
773
|
+
shutdown: () => stop()
|
|
774
|
+
});
|
|
775
|
+
client = createHeadlessClient({
|
|
776
|
+
appendCustomEntry: async (type, data) => {
|
|
777
|
+
await runtime.appendCustomEntry(type, data);
|
|
778
|
+
},
|
|
779
|
+
emitFrame: (frame) => emitTo(listeners, frame)
|
|
780
|
+
});
|
|
781
|
+
const unsubscribePresentation = runtime.onPresentationFrame((frame) => emitTo(listeners, frame));
|
|
782
|
+
const unsubscribeEvents = runtime.onEvent(async (event, _context) => {
|
|
783
|
+
if (event.type === "config_update" && event.property === "model") {
|
|
784
|
+
currentModel = await runtime.lane.getModel(BACKGROUND_CONTEXT);
|
|
785
|
+
if (headlessHost !== void 0 && currentModel !== void 0 && headlessHost.status.ready) await headlessHost.dispatchHook("model_select", { model: currentModel });
|
|
786
|
+
}
|
|
787
|
+
const hook = eventHook(event.type);
|
|
788
|
+
if (headlessHost !== void 0 && hook !== void 0 && headlessHost.status.ready) await headlessHost.dispatchHook(hook, event);
|
|
789
|
+
});
|
|
790
|
+
let appliedFacetTools = [];
|
|
791
|
+
let appliedSessionTools = /* @__PURE__ */ new Map();
|
|
792
|
+
let appliedSkills = /* @__PURE__ */ new Map();
|
|
793
|
+
let surfaceRevision = 0;
|
|
794
|
+
let toolSurfaceReady = false;
|
|
795
|
+
let toolReapplyQueued = false;
|
|
796
|
+
let mcpSurfaceRevision = 0;
|
|
797
|
+
let mcpSurfaceReady = false;
|
|
798
|
+
let appliedMcpTools = /* @__PURE__ */ new Map();
|
|
799
|
+
let appliedMcpSkills = /* @__PURE__ */ new Map();
|
|
800
|
+
let appliedMcpUiResources = /* @__PURE__ */ new Map();
|
|
801
|
+
let mcpRefreshQueued = false;
|
|
802
|
+
const scheduleMcpRefresh = () => {
|
|
803
|
+
if (mcpRefreshQueued || disposed || !headlessReady) return;
|
|
804
|
+
mcpRefreshQueued = true;
|
|
805
|
+
queueMicrotask(() => {
|
|
806
|
+
mcpRefreshQueued = false;
|
|
807
|
+
if (disposed || !headlessReady || !headlessHost?.status.ready) return;
|
|
808
|
+
prepareMcpSurface().catch((error) => options.onNotice?.(`MCP tool refresh failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
const prepareMcpSurface = async () => {
|
|
812
|
+
if (!headlessHost?.status.ready) throw new Error("Headless capabilities are not installed.");
|
|
813
|
+
if (mcpServiceRoot === void 0) throw new Error("MCP session services are not installed.");
|
|
814
|
+
mcpSurfaceReady = false;
|
|
815
|
+
mcpLifecycle.abort();
|
|
816
|
+
const lifecycle = new AbortController();
|
|
817
|
+
mcpLifecycle = lifecycle;
|
|
818
|
+
const pluginContext = {
|
|
819
|
+
execution: headlessHost.context,
|
|
820
|
+
services: { get: (name) => mcpServiceRoot?.get(name) ?? piHost?.getService(name) },
|
|
821
|
+
selection: {
|
|
822
|
+
read: () => headlessHost.context.selection,
|
|
823
|
+
change: (change) => headlessHost.changeSelection(change)
|
|
824
|
+
},
|
|
825
|
+
loadContext: () => readMcpContext(lifecycle.signal),
|
|
826
|
+
signal: lifecycle.signal,
|
|
827
|
+
refresh: scheduleMcpRefresh
|
|
828
|
+
};
|
|
829
|
+
const nextTools = /* @__PURE__ */ new Map();
|
|
830
|
+
const nextSkills = /* @__PURE__ */ new Map();
|
|
831
|
+
const nextUiResources = /* @__PURE__ */ new Map();
|
|
832
|
+
for (const loaded of options.mcpPlugins ?? []) {
|
|
833
|
+
const selection = headlessHost.context.selection;
|
|
834
|
+
if (!loaded.declaration.owners.some((owner) => owner.majorMode === selection.majorMode && (owner.layer === "default" || selection.activeLayers.includes(owner.layer)))) continue;
|
|
835
|
+
const scope = typeof loaded.plugin.session === "function" ? await loaded.plugin.session(pluginContext) : loaded.plugin.session;
|
|
836
|
+
lifecycle.signal.throwIfAborted();
|
|
837
|
+
const resources = scope.uiResources ?? [];
|
|
838
|
+
for (const resource of resources) {
|
|
839
|
+
const uri = new URL(resource.uri);
|
|
840
|
+
if (uri.protocol !== "ui:" || !uri.hostname || uri.username || uri.password || uri.search || uri.hash || uri.href !== resource.uri || resource.mimeType !== "text/html;profile=mcp-app") throw new Error(`Invalid MCP UI resource '${resource.uri}'`);
|
|
841
|
+
if (nextUiResources.has(resource.uri) && nextUiResources.get(resource.uri).resource !== resource) throw new Error(`Duplicate MCP UI resource '${resource.uri}'`);
|
|
842
|
+
const descriptor = {
|
|
843
|
+
uri: resource.uri,
|
|
844
|
+
name: resource.name,
|
|
845
|
+
mimeType: resource.mimeType,
|
|
846
|
+
...resource.description === void 0 ? {} : { description: resource.description },
|
|
847
|
+
...resource._meta === void 0 ? {} : { _meta: resource._meta }
|
|
848
|
+
};
|
|
849
|
+
nextUiResources.set(resource.uri, {
|
|
850
|
+
descriptor,
|
|
851
|
+
resource
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
for (const tool of scope.tools ?? []) {
|
|
855
|
+
if (nextTools.has(tool.name)) throw new Error(`Duplicate MCP tool '${tool.name}'`);
|
|
856
|
+
const resourceUri = tool._meta?.ui?.resourceUri;
|
|
857
|
+
if (resourceUri !== void 0 && !resources.some((resource) => resource.uri === resourceUri)) throw new Error(`MCP tool '${tool.name}' references a UI resource not owned by its plugin`);
|
|
858
|
+
if (!headlessHost.allowsTool(tool.name)) continue;
|
|
859
|
+
nextTools.set(tool.name, {
|
|
860
|
+
descriptor: {
|
|
861
|
+
name: tool.name,
|
|
862
|
+
label: tool.label ?? tool.name,
|
|
863
|
+
description: tool.description,
|
|
864
|
+
parameters: tool.parameters,
|
|
865
|
+
...tool.annotations === void 0 ? {} : { annotations: tool.annotations },
|
|
866
|
+
...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
|
|
867
|
+
...tool._meta === void 0 ? {} : { _meta: tool._meta }
|
|
868
|
+
},
|
|
869
|
+
execute: (toolCallId, parameters, signal, onUpdate, execution) => tool.execute(toolCallId, parameters, signal, onUpdate, execution ?? headlessHost.context)
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
for (const skill of scope.skills ?? []) {
|
|
873
|
+
if ([...nextSkills.values()].some((candidate) => candidate.descriptor.name === skill.name)) throw new Error(`Duplicate MCP skill '${skill.name}'`);
|
|
874
|
+
const uri = `doompi://session/${encodeURIComponent(runtime.sessionId)}/mcp/skills/${encodeURIComponent(skill.name)}`;
|
|
875
|
+
nextSkills.set(uri, {
|
|
876
|
+
descriptor: {
|
|
877
|
+
name: skill.name,
|
|
878
|
+
description: skill.description,
|
|
879
|
+
uri
|
|
880
|
+
},
|
|
881
|
+
skill
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
appliedMcpTools = nextTools;
|
|
886
|
+
appliedMcpSkills = nextSkills;
|
|
887
|
+
appliedMcpUiResources = nextUiResources;
|
|
888
|
+
mcpSurfaceRevision += 1;
|
|
889
|
+
mcpSurfaceReady = true;
|
|
890
|
+
};
|
|
891
|
+
const applyToolSurface = async (tools) => {
|
|
892
|
+
toolSurfaceReady = false;
|
|
893
|
+
const facetTools = tools.map((tool) => toolAdapter(tool.name === "load_skill" ? {
|
|
894
|
+
...tool,
|
|
895
|
+
description: describeLoadSkillTool(tool.description, headlessHost?.appliedResources ?? [])
|
|
896
|
+
} : tool, () => headlessHost.context, reportedToolErrors));
|
|
897
|
+
const facetNames = headlessHost?.declaredToolNames ?? new Set(facetTools.map((tool) => tool.name));
|
|
898
|
+
const piTools = (piHost?.tools ?? []).filter((tool) => !facetNames.has(tool.name) && headlessHost?.allowsTool(tool.name) !== false).map((tool) => ({
|
|
899
|
+
...tool,
|
|
900
|
+
async execute(...args) {
|
|
901
|
+
headlessHost.assertActive();
|
|
902
|
+
if (!toolSurfaceReady || !headlessHost.allowsTool(tool.name)) throw new Error(`Tool '${tool.name}' is no longer active`);
|
|
903
|
+
return tool.execute(...args);
|
|
904
|
+
}
|
|
905
|
+
}));
|
|
906
|
+
const piNames = new Set(piTools.map((tool) => tool.name));
|
|
907
|
+
const nextToolGuidance = [...(piHost?.toolGuidance ?? []).filter((entry) => piNames.has(entry.name)), ...tools.map((tool) => ({
|
|
908
|
+
name: tool.name,
|
|
909
|
+
...tool.promptSnippet === void 0 ? {} : { promptSnippet: tool.promptSnippet },
|
|
910
|
+
...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines }
|
|
911
|
+
}))];
|
|
912
|
+
await runtime.replaceTools([...piTools, ...facetTools]);
|
|
913
|
+
const next = /* @__PURE__ */ new Map();
|
|
914
|
+
for (const tool of piTools) next.set(tool.name, {
|
|
915
|
+
descriptor: {
|
|
916
|
+
name: tool.name,
|
|
917
|
+
label: tool.label ?? tool.name,
|
|
918
|
+
description: tool.description,
|
|
919
|
+
parameters: tool.parameters
|
|
920
|
+
},
|
|
921
|
+
execute: (toolCallId, parameters, signal, onUpdate) => piHost.executeTool(tool.name, toolCallId, parameters, signal, onUpdate)
|
|
922
|
+
});
|
|
923
|
+
for (const tool of tools) next.set(tool.name, {
|
|
924
|
+
descriptor: {
|
|
925
|
+
name: tool.name,
|
|
926
|
+
label: tool.label ?? tool.name,
|
|
927
|
+
description: tool.description,
|
|
928
|
+
parameters: tool.parameters
|
|
929
|
+
},
|
|
930
|
+
execute: (toolCallId, parameters, signal, onUpdate) => tool.execute(toolCallId, parameters, signal, onUpdate, headlessHost.context)
|
|
931
|
+
});
|
|
932
|
+
toolGuidance = nextToolGuidance;
|
|
933
|
+
appliedSessionTools = next;
|
|
934
|
+
surfaceRevision += 1;
|
|
935
|
+
toolSurfaceReady = true;
|
|
936
|
+
};
|
|
937
|
+
/**
|
|
938
|
+
* Rebuilds the merged tool surface after a Pi extension narrowed its own tools.
|
|
939
|
+
*
|
|
940
|
+
* Deferred because the tool surface arbiter calls `setActiveTools` synchronously from inside
|
|
941
|
+
* `register`, and coalesced because several extensions register their restrictions in the same
|
|
942
|
+
* tick. The facet set is unchanged, so this never re-enters the kernel.
|
|
943
|
+
*/
|
|
944
|
+
let toolLine = Promise.resolve();
|
|
945
|
+
const applyLatestTools = () => {
|
|
946
|
+
toolLine = toolLine.catch(() => void 0).then(() => applyToolSurface(appliedFacetTools));
|
|
947
|
+
return toolLine;
|
|
948
|
+
};
|
|
949
|
+
const scheduleToolReapply = () => {
|
|
950
|
+
if (toolReapplyQueued) return;
|
|
951
|
+
toolReapplyQueued = true;
|
|
952
|
+
queueMicrotask(() => {
|
|
953
|
+
toolReapplyQueued = false;
|
|
954
|
+
if (disposed) return;
|
|
955
|
+
applyLatestTools().catch((error) => options.onNotice?.(`Pi extension tool refresh failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
const prepareFacets = (root) => {
|
|
959
|
+
mcpServiceRoot = root;
|
|
960
|
+
root.plugin((context) => {
|
|
961
|
+
context.provide(DOOM_CHILD_SESSION_SERVICE, childSessionProvider.get());
|
|
962
|
+
context.effect(() => () => childSessionProvider.close(), "headless child session service lifetime");
|
|
963
|
+
});
|
|
964
|
+
if (headlessHost !== void 0) throw new Error("Direct headless facets were prepared more than once.");
|
|
965
|
+
if (piPreload !== void 0) piHost = createPiExtensionHost({
|
|
966
|
+
cwd: options.cwd,
|
|
967
|
+
agentDir,
|
|
968
|
+
models: modelRuntime,
|
|
969
|
+
settings,
|
|
970
|
+
runtime,
|
|
971
|
+
preload: piPreload,
|
|
972
|
+
getModel: () => currentModel,
|
|
973
|
+
getThinkingLevel: () => resolved.thinkingLevel ?? "off",
|
|
974
|
+
client: () => client?.client,
|
|
975
|
+
onActiveToolsChanged: scheduleToolReapply,
|
|
976
|
+
serverServices: {
|
|
977
|
+
sessionId: options.sessionId,
|
|
978
|
+
get: (name) => root.get(name)
|
|
979
|
+
},
|
|
980
|
+
...options.onNotice === void 0 ? {} : { onNotice: options.onNotice }
|
|
981
|
+
});
|
|
982
|
+
headlessHost = new HeadlessHost(root, {
|
|
983
|
+
candidates: options.candidates,
|
|
984
|
+
selection: initialSelection,
|
|
985
|
+
selectionOverrides: [.../* @__PURE__ */ new Set([...options.selectionOverrides ?? [], ...[
|
|
986
|
+
"majorMode",
|
|
987
|
+
"domains",
|
|
988
|
+
"profile"
|
|
989
|
+
].filter((axis) => JSON.stringify(initialSelection[axis]) !== JSON.stringify(options.selection[axis]))])],
|
|
990
|
+
context: executionContext,
|
|
991
|
+
resolveSelection: options.resolveSelection,
|
|
992
|
+
...options.allowedTools === void 0 ? {} : { allowedTools: () => options.allowedTools },
|
|
993
|
+
applyTools: async (tools) => {
|
|
994
|
+
appliedFacetTools = tools;
|
|
995
|
+
await applyLatestTools();
|
|
996
|
+
},
|
|
997
|
+
applyResources: async (next) => {
|
|
998
|
+
const mapped = mapResources(next);
|
|
999
|
+
const facetNames = new Set((mapped.harness.skills ?? []).map((skill) => skill.name));
|
|
1000
|
+
const piSkills = (piHost?.skills ?? []).filter((skill) => !facetNames.has(skill.name));
|
|
1001
|
+
const mergedSkills = [...piSkills, ...mapped.harness.skills ?? []];
|
|
1002
|
+
await runtime.replaceResources(piSkills.length === 0 ? mapped.harness : {
|
|
1003
|
+
...mapped.harness,
|
|
1004
|
+
skills: mergedSkills
|
|
1005
|
+
});
|
|
1006
|
+
appliedSkills = new Map(mergedSkills.map((skill) => {
|
|
1007
|
+
const uri = `doompi://session/${encodeURIComponent(runtime.sessionId)}/skills/${encodeURIComponent(skill.name)}`;
|
|
1008
|
+
return [uri, {
|
|
1009
|
+
descriptor: {
|
|
1010
|
+
name: skill.name,
|
|
1011
|
+
description: skill.description,
|
|
1012
|
+
uri
|
|
1013
|
+
},
|
|
1014
|
+
content: skill.content
|
|
1015
|
+
}];
|
|
1016
|
+
}));
|
|
1017
|
+
surfaceRevision += 1;
|
|
1018
|
+
if (appliedFacetTools.some((tool) => tool.name === "load_skill")) await applyLatestTools();
|
|
1019
|
+
},
|
|
1020
|
+
onApplied: async (selection) => {
|
|
1021
|
+
options.publishSelectionStatus?.((source, text) => client.client.setStatus(source, text), selection);
|
|
1022
|
+
latestSelection = selection;
|
|
1023
|
+
for (const listener of selectionListeners) listener(selection);
|
|
1024
|
+
},
|
|
1025
|
+
onError: (error) => options.onNotice?.(`Headless selection failed: ${harnessErrorMessage(error)}`)
|
|
1026
|
+
});
|
|
1027
|
+
publishComposition = createHeadlessCompositionPublisher(runtime, headlessHost, options.environment, (selection) => options.contextGroups?.(root, selection) ?? [], readSystemPrompt);
|
|
1028
|
+
headlessHost.subscribeSelection(async (selection) => {
|
|
1029
|
+
if (!headlessReady || !headlessHost?.status.ready) return;
|
|
1030
|
+
try {
|
|
1031
|
+
await prepareMcpSurface();
|
|
1032
|
+
} catch (error) {
|
|
1033
|
+
if (!(error instanceof Error && error.name === "AbortError")) options.onNotice?.(`MCP tool refresh failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
1034
|
+
}
|
|
1035
|
+
await publishComposition(selection);
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
1038
|
+
const activateFacets = async (installed) => {
|
|
1039
|
+
if (headlessHost === void 0) throw new Error("Direct headless host was not prepared.");
|
|
1040
|
+
const host = headlessHost;
|
|
1041
|
+
const assertLive = () => {
|
|
1042
|
+
if (disposed) throw new Error("The session was closed while it was starting.");
|
|
1043
|
+
};
|
|
1044
|
+
host.setAvailableSources(installed.installedPackages);
|
|
1045
|
+
if (piHost !== void 0) try {
|
|
1046
|
+
await piHost.load();
|
|
1047
|
+
} catch (error) {
|
|
1048
|
+
options.onNotice?.(`Pi extensions failed to load: ${error instanceof Error ? error.message : String(error)}`);
|
|
1049
|
+
}
|
|
1050
|
+
assertLive();
|
|
1051
|
+
await host.select(initialSelection);
|
|
1052
|
+
assertLive();
|
|
1053
|
+
if (!host.status.ready) throw new Error(`Session capabilities failed to start: ${host.status.error ?? "selection is not ready"}`);
|
|
1054
|
+
headlessReady = true;
|
|
1055
|
+
await prepareMcpSurface();
|
|
1056
|
+
assertLive();
|
|
1057
|
+
await runtime.recover();
|
|
1058
|
+
assertLive();
|
|
1059
|
+
await host.dispatchHook("session_start", {});
|
|
1060
|
+
await publishComposition();
|
|
1061
|
+
runtime.resume().catch((error) => options.onNotice?.(`Session resume failed: ${harnessErrorMessage(error)}`));
|
|
1062
|
+
};
|
|
1063
|
+
const dispose = () => {
|
|
1064
|
+
disposePromise ??= (async () => {
|
|
1065
|
+
if (disposed) return;
|
|
1066
|
+
const wasReady = headlessReady;
|
|
1067
|
+
disposed = true;
|
|
1068
|
+
headlessReady = false;
|
|
1069
|
+
mcpSurfaceReady = false;
|
|
1070
|
+
mcpLifecycle.abort();
|
|
1071
|
+
const failures = [];
|
|
1072
|
+
try {
|
|
1073
|
+
await runtime.interrupt();
|
|
1074
|
+
} catch (error) {
|
|
1075
|
+
failures.push(error);
|
|
1076
|
+
}
|
|
1077
|
+
try {
|
|
1078
|
+
if (wasReady && headlessHost?.status.ready) await headlessHost.dispatchHook("session_shutdown", {});
|
|
1079
|
+
} catch (error) {
|
|
1080
|
+
failures.push(error);
|
|
1081
|
+
}
|
|
1082
|
+
try {
|
|
1083
|
+
await runtime.dispose();
|
|
1084
|
+
} catch (error) {
|
|
1085
|
+
failures.push(error);
|
|
1086
|
+
}
|
|
1087
|
+
try {
|
|
1088
|
+
await piHost?.shutdown();
|
|
1089
|
+
} catch (error) {
|
|
1090
|
+
failures.push(error);
|
|
1091
|
+
}
|
|
1092
|
+
try {
|
|
1093
|
+
await headlessHost?.close();
|
|
1094
|
+
} catch (error) {
|
|
1095
|
+
failures.push(error);
|
|
1096
|
+
}
|
|
1097
|
+
client?.dispose();
|
|
1098
|
+
unsubscribePresentation();
|
|
1099
|
+
unsubscribeEvents();
|
|
1100
|
+
try {
|
|
1101
|
+
await childSessionProvider.close();
|
|
1102
|
+
} catch (error) {
|
|
1103
|
+
failures.push(error);
|
|
1104
|
+
}
|
|
1105
|
+
if (failures.length) throw new AggregateError(failures, "Headless session shutdown failed");
|
|
1106
|
+
})();
|
|
1107
|
+
return disposePromise;
|
|
1108
|
+
};
|
|
1109
|
+
const stop = () => {
|
|
1110
|
+
dispose().catch((error) => options.onNotice?.(harnessErrorMessage(error)));
|
|
1111
|
+
};
|
|
1112
|
+
const invokeSurfaceTool = async (invocation, readRevision, readTools, ready, lifecycleSignal) => {
|
|
1113
|
+
if (disposed || !headlessReady || !ready() || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
1114
|
+
if (invocation.revision !== readRevision()) throw new Error("The session tool surface has changed");
|
|
1115
|
+
if (!isJsonObject(invocation.arguments)) throw new Error("Tool arguments must be a JSON object");
|
|
1116
|
+
const applied = readTools().get(invocation.name);
|
|
1117
|
+
if (applied === void 0) throw new Error(`Tool '${invocation.name}' is not active`);
|
|
1118
|
+
if (!Value.Check(applied.descriptor.parameters, invocation.arguments)) throw new Error(`Invalid arguments for tool '${invocation.name}'`);
|
|
1119
|
+
const signals = [invocation.signal, lifecycleSignal].filter((signal) => signal !== void 0);
|
|
1120
|
+
const signal = signals.length === 0 ? void 0 : AbortSignal.any(signals);
|
|
1121
|
+
signal?.throwIfAborted();
|
|
1122
|
+
return runtime.runExternalOperation(async () => {
|
|
1123
|
+
const toolCallId = `external-${randomUUID()}`;
|
|
1124
|
+
const before = await beforeTool({
|
|
1125
|
+
toolCallId,
|
|
1126
|
+
toolName: invocation.name,
|
|
1127
|
+
args: invocation.arguments
|
|
1128
|
+
}, BACKGROUND_CONTEXT);
|
|
1129
|
+
if (before?.block !== void 0) return {
|
|
1130
|
+
content: [{
|
|
1131
|
+
type: "text",
|
|
1132
|
+
text: before.block.reason
|
|
1133
|
+
}],
|
|
1134
|
+
isError: true
|
|
1135
|
+
};
|
|
1136
|
+
const args = before?.args ?? invocation.arguments;
|
|
1137
|
+
if (!Value.Check(applied.descriptor.parameters, args)) throw new Error(`A tool hook produced invalid arguments for '${invocation.name}'`);
|
|
1138
|
+
await invocation.authorize?.();
|
|
1139
|
+
signal?.throwIfAborted();
|
|
1140
|
+
if (disposed || !headlessReady || !ready() || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
1141
|
+
if (invocation.revision !== readRevision() || readTools().get(invocation.name) !== applied) throw new Error(`Tool '${invocation.name}' is no longer active`);
|
|
1142
|
+
const startEvent = {
|
|
1143
|
+
type: "tool_execution_start",
|
|
1144
|
+
runId: EXTERNAL_OPERATION,
|
|
1145
|
+
turnId: EXTERNAL_OPERATION,
|
|
1146
|
+
toolCallId,
|
|
1147
|
+
toolName: invocation.name,
|
|
1148
|
+
args
|
|
1149
|
+
};
|
|
1150
|
+
emitTo(listeners, startEvent);
|
|
1151
|
+
await headlessHost.dispatchHook("tool_execution_start", startEvent);
|
|
1152
|
+
let result;
|
|
1153
|
+
try {
|
|
1154
|
+
result = await applied.execute(toolCallId, args, signal, (partial) => {
|
|
1155
|
+
emitTo(listeners, {
|
|
1156
|
+
type: "tool_execution_update",
|
|
1157
|
+
runId: EXTERNAL_OPERATION,
|
|
1158
|
+
turnId: EXTERNAL_OPERATION,
|
|
1159
|
+
toolCallId,
|
|
1160
|
+
toolName: invocation.name,
|
|
1161
|
+
partialResult: partial
|
|
1162
|
+
});
|
|
1163
|
+
invocation.onUpdate?.(partial);
|
|
1164
|
+
}, invocation.mcpSkills === void 0 ? void 0 : {
|
|
1165
|
+
...headlessHost.context,
|
|
1166
|
+
mcpSkills: invocation.mcpSkills
|
|
1167
|
+
});
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
result = {
|
|
1170
|
+
content: [{
|
|
1171
|
+
type: "text",
|
|
1172
|
+
text: error instanceof Error ? error.message : String(error)
|
|
1173
|
+
}],
|
|
1174
|
+
isError: true
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
const patch = await afterTool({
|
|
1178
|
+
toolCallId,
|
|
1179
|
+
toolName: invocation.name,
|
|
1180
|
+
args,
|
|
1181
|
+
content: result.content,
|
|
1182
|
+
...isJsonValue(result.details) ? { details: result.details } : {},
|
|
1183
|
+
isError: result.isError === true
|
|
1184
|
+
}, BACKGROUND_CONTEXT);
|
|
1185
|
+
const patched = {
|
|
1186
|
+
content: patch?.content ?? result.content,
|
|
1187
|
+
...patch?.content !== void 0 || patch?.isError !== void 0 || result.structuredContent === void 0 ? {} : { structuredContent: result.structuredContent },
|
|
1188
|
+
...patch?.content !== void 0 || patch?.isError !== void 0 || patch?.details !== void 0 || result._meta === void 0 ? {} : { _meta: result._meta },
|
|
1189
|
+
...patch?.details !== void 0 ? { details: patch.details } : result.details === void 0 ? {} : { details: result.details },
|
|
1190
|
+
isError: patch?.isError ?? result.isError ?? false
|
|
1191
|
+
};
|
|
1192
|
+
const endEvent = {
|
|
1193
|
+
type: "tool_execution_end",
|
|
1194
|
+
runId: EXTERNAL_OPERATION,
|
|
1195
|
+
turnId: EXTERNAL_OPERATION,
|
|
1196
|
+
toolCallId,
|
|
1197
|
+
toolName: invocation.name,
|
|
1198
|
+
result: patched,
|
|
1199
|
+
isError: patched.isError,
|
|
1200
|
+
terminate: patch?.terminate ?? false
|
|
1201
|
+
};
|
|
1202
|
+
emitTo(listeners, endEvent);
|
|
1203
|
+
await headlessHost.dispatchHook("tool_execution_end", endEvent);
|
|
1204
|
+
return patched;
|
|
1205
|
+
});
|
|
1206
|
+
};
|
|
1207
|
+
const toolSurface = {
|
|
1208
|
+
readSurface() {
|
|
1209
|
+
if (disposed || !headlessReady || !toolSurfaceReady || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
1210
|
+
return {
|
|
1211
|
+
revision: surfaceRevision,
|
|
1212
|
+
tools: [...appliedSessionTools.values()].map((tool) => tool.descriptor),
|
|
1213
|
+
skills: [...appliedSkills.values()].map((skill) => skill.descriptor)
|
|
1214
|
+
};
|
|
1215
|
+
},
|
|
1216
|
+
invokeTool: (invocation) => invokeSurfaceTool(invocation, () => surfaceRevision, () => appliedSessionTools, () => toolSurfaceReady),
|
|
1217
|
+
readSkill(revision, uri) {
|
|
1218
|
+
if (disposed || !headlessReady || !toolSurfaceReady || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
1219
|
+
if (revision !== surfaceRevision) throw new Error("The session skill surface has changed");
|
|
1220
|
+
const skill = appliedSkills.get(uri);
|
|
1221
|
+
if (skill === void 0) throw new Error("The session skill is not active");
|
|
1222
|
+
return skill.content;
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
const mcpSurface = {
|
|
1226
|
+
readSurface() {
|
|
1227
|
+
if (disposed || !headlessReady || !mcpSurfaceReady || !headlessHost?.status.ready) throw new Error("MCP capability preparation is not ready.");
|
|
1228
|
+
return {
|
|
1229
|
+
revision: mcpSurfaceRevision,
|
|
1230
|
+
tools: [...appliedMcpTools.values()].map((tool) => tool.descriptor),
|
|
1231
|
+
skills: [...appliedMcpSkills.values()].map((skill) => skill.descriptor),
|
|
1232
|
+
uiResources: [...appliedMcpUiResources.values()].map((resource) => resource.descriptor)
|
|
1233
|
+
};
|
|
1234
|
+
},
|
|
1235
|
+
invokeTool: (invocation) => invokeSurfaceTool(invocation, () => mcpSurfaceRevision, () => appliedMcpTools, () => mcpSurfaceReady, mcpLifecycle.signal),
|
|
1236
|
+
async readUiResource(revision, uri) {
|
|
1237
|
+
if (disposed || !headlessReady || !mcpSurfaceReady || !headlessHost?.status.ready) throw new Error("MCP capability preparation is not ready.");
|
|
1238
|
+
if (revision !== mcpSurfaceRevision) throw new Error("The session MCP surface has changed");
|
|
1239
|
+
const resource = appliedMcpUiResources.get(uri)?.resource;
|
|
1240
|
+
if (resource === void 0) throw new Error("The session MCP UI resource is not active");
|
|
1241
|
+
const text = await resource.read();
|
|
1242
|
+
if (disposed || !headlessReady || !mcpSurfaceReady || !headlessHost?.status.ready) throw new Error("MCP capability preparation is not ready.");
|
|
1243
|
+
if (revision !== mcpSurfaceRevision || appliedMcpUiResources.get(uri)?.resource !== resource) throw new Error("The session MCP surface has changed");
|
|
1244
|
+
return text;
|
|
1245
|
+
},
|
|
1246
|
+
async readSkill(revision, uri) {
|
|
1247
|
+
if (disposed || !headlessReady || !mcpSurfaceReady || !headlessHost?.status.ready) throw new Error("MCP capability preparation is not ready.");
|
|
1248
|
+
if (revision !== mcpSurfaceRevision) throw new Error("The session MCP surface has changed");
|
|
1249
|
+
const skill = appliedMcpSkills.get(uri)?.skill;
|
|
1250
|
+
if (skill === void 0) throw new Error("The session MCP skill is not active");
|
|
1251
|
+
const text = await skill.read(headlessHost.context);
|
|
1252
|
+
if (disposed || !headlessReady || !mcpSurfaceReady || !headlessHost?.status.ready) throw new Error("MCP capability preparation is not ready.");
|
|
1253
|
+
if (revision !== mcpSurfaceRevision || appliedMcpSkills.get(uri)?.skill !== skill) throw new Error("The session MCP surface has changed");
|
|
1254
|
+
return text;
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
return {
|
|
1258
|
+
runtime,
|
|
1259
|
+
...sessionContext === void 0 ? {} : { sessionContext },
|
|
1260
|
+
get host() {
|
|
1261
|
+
return headlessHost;
|
|
1262
|
+
},
|
|
1263
|
+
toolSurface,
|
|
1264
|
+
mcpSurface,
|
|
1265
|
+
prepareFacets,
|
|
1266
|
+
activateFacets,
|
|
1267
|
+
canDispatch: () => !disposed && headlessReady && !promptPreparationFailed && headlessHost?.status.ready === true,
|
|
1268
|
+
onPresentationFrame(listener) {
|
|
1269
|
+
listeners.add(listener);
|
|
1270
|
+
return () => listeners.delete(listener);
|
|
1271
|
+
},
|
|
1272
|
+
onSelection(listener) {
|
|
1273
|
+
selectionListeners.add(listener);
|
|
1274
|
+
listener(latestSelection);
|
|
1275
|
+
return () => {
|
|
1276
|
+
selectionListeners.delete(listener);
|
|
1277
|
+
};
|
|
1278
|
+
},
|
|
1279
|
+
respondToExtensionUi(frame) {
|
|
1280
|
+
return client?.receive(frame) ?? false;
|
|
1281
|
+
},
|
|
1282
|
+
dispose
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
export { createHeadlessSessionHost, restoreHeadlessSelection, validateDirectHeadlessArgs };
|
|
1287
|
+
|
|
1288
|
+
//# sourceMappingURL=headlessSessionHost.mjs.map
|