@agimon-ai/po-core 0.0.0-alpha.21 → 0.0.0-alpha.211
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 -149
- package/NOTICE +1 -1
- package/README.md +40 -3
- package/dist/agentModel.cjs +4 -0
- package/dist/agentModel.d.mts +3 -1
- package/dist/agentModel.mjs +3 -1
- package/dist/apiContracts.cjs +631 -326
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +1252 -149
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +626 -323
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/approval.cjs +17 -0
- package/dist/approval.d.mts +5 -0
- package/dist/approval.mjs +4 -0
- package/dist/backgroundWork.cjs +5 -0
- package/dist/backgroundWork.d.mts +2 -2
- package/dist/backgroundWork.mjs +1 -1
- package/dist/bundlePublicationWorker.cjs +30 -0
- package/dist/bundlePublicationWorker.cjs.map +1 -0
- package/dist/bundlePublicationWorker.d.mts +1 -0
- package/dist/bundlePublicationWorker.mjs +28 -0
- package/dist/bundlePublicationWorker.mjs.map +1 -0
- package/dist/childSession.d.mts +3 -2
- package/dist/clientDevices.cjs +4 -0
- package/dist/clientDevices.d.mts +3 -0
- package/dist/clientDevices.mjs +1 -0
- package/dist/clientMetadata.cjs +13 -0
- package/dist/clientMetadata.d.mts +4 -0
- package/dist/clientMetadata.mjs +3 -0
- package/dist/codemode.cjs +7 -0
- package/dist/codemode.d.mts +2 -0
- package/dist/codemode.mjs +1 -0
- package/dist/contextDetailStore.cjs +20 -12
- package/dist/contextDetailStore.cjs.map +1 -1
- package/dist/contextDetailStore.d.mts +7 -4
- package/dist/contextDetailStore.d.mts.map +1 -1
- package/dist/contextDetailStore.mjs +19 -11
- package/dist/contextDetailStore.mjs.map +1 -1
- package/dist/contextProjection.cjs +68 -8
- package/dist/contextProjection.cjs.map +1 -1
- package/dist/contextProjection.d.mts +34 -10
- package/dist/contextProjection.d.mts.map +1 -1
- package/dist/contextProjection.mjs +65 -9
- package/dist/contextProjection.mjs.map +1 -1
- package/dist/delegation.cjs +3 -0
- package/dist/delegation.d.mts +2 -2
- package/dist/delegation.mjs +1 -1
- package/dist/executionBudget.cjs +13 -5
- package/dist/executionBudget.cjs.map +1 -1
- package/dist/executionBudget.d.mts.map +1 -1
- package/dist/executionBudget.mjs +13 -5
- package/dist/executionBudget.mjs.map +1 -1
- package/dist/extensionFile.cjs +1 -2
- package/dist/extensionFile.d.mts +4 -4
- package/dist/extensionFile.mjs +3 -3
- package/dist/headless.cjs +22 -0
- package/dist/headless.d.mts +6 -2
- package/dist/headless.mjs +5 -1
- package/dist/headlessHub.cjs +941 -137
- package/dist/headlessHub.cjs.map +1 -1
- package/dist/headlessHub.d.mts +133 -25
- package/dist/headlessHub.d.mts.map +1 -1
- package/dist/headlessHub.mjs +938 -135
- package/dist/headlessHub.mjs.map +1 -1
- package/dist/headlessProtocol.cjs +331 -74
- package/dist/headlessProtocol.cjs.map +1 -1
- package/dist/headlessProtocol.d.mts +29 -3
- package/dist/headlessProtocol.d.mts.map +1 -1
- package/dist/headlessProtocol.mjs +335 -79
- package/dist/headlessProtocol.mjs.map +1 -1
- package/dist/headlessServer.cjs +1057 -219
- package/dist/headlessServer.cjs.map +1 -1
- package/dist/headlessServer.d.mts +140 -14
- package/dist/headlessServer.d.mts.map +1 -1
- package/dist/headlessServer.mjs +1057 -219
- package/dist/headlessServer.mjs.map +1 -1
- package/dist/headlessSessionHost.d.mts +65 -24
- package/dist/headlessSessionHost.d.mts.map +1 -1
- package/dist/headlessSessionManager.cjs +23 -16
- package/dist/headlessSessionManager.cjs.map +1 -1
- package/dist/headlessSessionManager.d.mts +1 -1
- package/dist/headlessSessionManager.d.mts.map +1 -1
- package/dist/headlessSessionManager.mjs +23 -16
- package/dist/headlessSessionManager.mjs.map +1 -1
- package/dist/help.cjs +6 -0
- package/dist/help.d.mts +2 -2
- package/dist/help.mjs +2 -2
- package/dist/history.cjs +7 -0
- package/dist/history.d.mts +5 -3
- package/dist/history.mjs +5 -2
- package/dist/historyOwnership.cjs +100 -71
- package/dist/historyOwnership.cjs.map +1 -1
- package/dist/historyOwnership.d.mts.map +1 -1
- package/dist/historyOwnership.mjs +103 -75
- package/dist/historyOwnership.mjs.map +1 -1
- package/dist/hubChannel.cjs +32 -0
- package/dist/hubChannel.d.mts +5 -3
- package/dist/hubChannel.mjs +5 -3
- package/dist/images.cjs +15 -0
- package/dist/images.d.mts +2 -0
- package/dist/images.mjs +1 -0
- package/dist/index.cjs +27 -0
- package/dist/index.d.mts +7 -3
- package/dist/index.mjs +7 -3
- package/dist/inputTemplate.cjs +5 -0
- package/dist/inputTemplate.d.mts +3 -0
- package/dist/inputTemplate.mjs +1 -0
- package/dist/interop/piCodingAgent.mjs +1 -0
- package/dist/lintReview.cjs +4 -0
- package/dist/lintReview.d.mts +2 -0
- package/dist/lintReview.mjs +1 -0
- package/dist/locale.cjs +19 -0
- package/dist/locale.d.mts +3 -0
- package/dist/locale.mjs +3 -0
- package/dist/machineApi.cjs +30 -81
- package/dist/machineApi.cjs.map +1 -1
- package/dist/machineApi.d.mts +1 -1
- package/dist/machineApi.d.mts.map +1 -1
- package/dist/machineApi.mjs +30 -79
- package/dist/machineApi.mjs.map +1 -1
- package/dist/main.cjs +6 -1
- package/dist/main.d.mts +3 -3
- package/dist/main.mjs +3 -3
- package/dist/mcp.cjs +7 -0
- package/dist/mcp.d.mts +2 -0
- package/dist/mcp.mjs +1 -0
- package/dist/mcpProjection.cjs +1 -0
- package/dist/mcpProjection.d.mts +2 -2
- package/dist/mcpProjection.mjs +1 -1
- package/dist/mcpSchemaCost.cjs +10 -10
- package/dist/mcpSchemaCost.cjs.map +1 -1
- package/dist/mcpSchemaCost.mjs +9 -9
- package/dist/mcpSchemaCost.mjs.map +1 -1
- package/dist/modelGateway.cjs +33 -0
- package/dist/modelGateway.d.mts +13 -0
- package/dist/modelGateway.mjs +10 -0
- package/dist/moduleResolution.cjs +18 -18
- package/dist/moduleResolution.cjs.map +1 -1
- package/dist/moduleResolution.d.mts +4 -4
- package/dist/moduleResolution.d.mts.map +1 -1
- package/dist/moduleResolution.mjs +17 -17
- package/dist/moduleResolution.mjs.map +1 -1
- package/dist/native.cjs +99 -13
- package/dist/native.d.mts +26 -9
- package/dist/native.mjs +20 -4
- package/dist/nodePlatform.cjs +42 -4
- package/dist/nodePlatform.cjs.map +1 -1
- package/dist/nodePlatform.d.mts +5 -0
- package/dist/nodePlatform.d.mts.map +1 -1
- package/dist/nodePlatform.mjs +42 -5
- package/dist/nodePlatform.mjs.map +1 -1
- package/dist/notification.cjs +1 -0
- package/dist/notification.d.mts +2 -2
- package/dist/notification.mjs +1 -1
- package/dist/operationHook.cjs +3 -0
- package/dist/operationHook.d.mts +2 -0
- package/dist/operationHook.mjs +1 -0
- package/dist/packageApi.cjs +9 -0
- package/dist/packageApi.d.mts +4 -2
- package/dist/packageApi.mjs +3 -2
- package/dist/packageApiServer.cjs +148 -40
- package/dist/packageApiServer.cjs.map +1 -1
- package/dist/packageApiServer.d.mts +34 -6
- package/dist/packageApiServer.d.mts.map +1 -1
- package/dist/packageApiServer.mjs +140 -36
- package/dist/packageApiServer.mjs.map +1 -1
- package/dist/pairingPage.cjs +6 -0
- package/dist/pairingPage.d.mts +2 -0
- package/dist/pairingPage.mjs +1 -0
- package/dist/personTimeZone.cjs +7 -0
- package/dist/personTimeZone.d.mts +2 -0
- package/dist/personTimeZone.mjs +1 -0
- package/dist/piSettings.cjs +2 -0
- package/dist/piSettings.d.mts +3 -3
- package/dist/piSettings.mjs +3 -3
- package/dist/platform.cjs +47 -2
- package/dist/platform.d.mts +11 -6
- package/dist/platform.mjs +11 -6
- package/dist/pluginProtocol.cjs +15 -0
- package/dist/pluginProtocol.d.mts +2 -2
- package/dist/pluginProtocol.mjs +1 -1
- package/dist/po-runtime-identity.json +1 -0
- package/dist/protocolTransport.cjs +7 -0
- package/dist/protocolTransport.d.mts +3 -0
- package/dist/protocolTransport.mjs +3 -0
- package/dist/providerAuth.cjs +8 -0
- package/dist/providerAuth.d.mts +4 -0
- package/dist/providerAuth.mjs +3 -0
- package/dist/remoteChildSession.cjs +6 -0
- package/dist/remoteChildSession.d.mts +3 -0
- package/dist/remoteChildSession.mjs +1 -0
- package/dist/remoteContract.cjs +42 -0
- package/dist/remoteContract.d.mts +4 -0
- package/dist/remoteContract.mjs +3 -0
- package/dist/remoteOrigin.cjs +4 -0
- package/dist/remoteOrigin.d.mts +2 -0
- package/dist/remoteOrigin.mjs +1 -0
- package/dist/runtimeContextApi.cjs +1 -1
- package/dist/runtimeContextApi.cjs.map +1 -1
- package/dist/runtimeContextApi.mjs +1 -1
- package/dist/runtimeContextApi.mjs.map +1 -1
- package/dist/runtimeCordisHost.cjs +9 -8
- package/dist/runtimeCordisHost.cjs.map +1 -1
- package/dist/runtimeCordisHost.d.mts +1 -1
- package/dist/runtimeCordisHost.d.mts.map +1 -1
- package/dist/runtimeCordisHost.mjs +3 -2
- package/dist/runtimeCordisHost.mjs.map +1 -1
- package/dist/runtimeEnvironment.cjs +6 -0
- package/dist/runtimeEnvironment.d.mts +2 -0
- package/dist/runtimeEnvironment.mjs +1 -0
- package/dist/runtimeHeadlessSessionManager.d.mts +1 -0
- package/dist/runtimeHeadlessSessionManager.d.mts.map +1 -1
- package/dist/runtimeIdentity.cjs.map +1 -1
- package/dist/runtimeIdentity.d.mts +1 -1
- package/dist/runtimeIdentity.mjs.map +1 -1
- package/dist/runtimeLogSinkTelemetry.cjs +4 -4
- package/dist/runtimeLogSinkTelemetry.cjs.map +1 -1
- package/dist/runtimeLogSinkTelemetry.d.mts +4 -3
- package/dist/runtimeLogSinkTelemetry.d.mts.map +1 -1
- package/dist/runtimeLogSinkTelemetry.mjs +4 -4
- package/dist/runtimeLogSinkTelemetry.mjs.map +1 -1
- package/dist/runtimePackages.cjs +27 -22
- package/dist/runtimePackages.cjs.map +1 -1
- package/dist/runtimePackages.d.mts +9 -1
- package/dist/runtimePackages.d.mts.map +1 -1
- package/dist/runtimePackages.mjs +26 -21
- package/dist/runtimePackages.mjs.map +1 -1
- package/dist/runtimePiSettings.cjs +2 -0
- package/dist/runtimePiSettings.d.mts +3 -3
- package/dist/runtimePiSettings.mjs +3 -3
- package/dist/runtimeTransition.cjs.map +1 -1
- package/dist/runtimeTransition.d.mts +7 -7
- package/dist/runtimeTransition.d.mts.map +1 -1
- package/dist/runtimeTransition.mjs.map +1 -1
- package/dist/sandboxIdentity.cjs +5 -0
- package/dist/sandboxIdentity.d.mts +2 -0
- package/dist/sandboxIdentity.mjs +1 -0
- package/dist/server.d.mts +3 -3
- package/dist/serverPlugin.cjs +45 -6
- package/dist/serverPlugin.d.mts +18 -5
- package/dist/serverPlugin.mjs +16 -3
- package/dist/serverTelemetry.cjs +2 -2
- package/dist/serverTelemetry.cjs.map +1 -1
- package/dist/serverTelemetry.d.mts +2 -1
- package/dist/serverTelemetry.d.mts.map +1 -1
- package/dist/serverTelemetry.mjs +1 -1
- package/dist/serverTelemetry.mjs.map +1 -1
- package/dist/sessionFilesApi.cjs +17 -6
- package/dist/sessionFilesApi.cjs.map +1 -1
- package/dist/sessionFilesApi.d.mts.map +1 -1
- package/dist/sessionFilesApi.mjs +17 -6
- package/dist/sessionFilesApi.mjs.map +1 -1
- package/dist/sessionMcpContract.cjs +18 -0
- package/dist/sessionMcpContract.d.mts +5 -0
- package/dist/sessionMcpContract.mjs +1 -0
- package/dist/sessionProtocol.cjs +24 -2
- package/dist/sessionProtocol.d.mts +6 -5
- package/dist/sessionProtocol.mjs +6 -5
- package/dist/skills.cjs +4 -0
- package/dist/skills.d.mts +2 -1
- package/dist/skills.mjs +3 -1
- package/dist/sqliteSessionStorage.cjs +20 -13
- package/dist/sqliteSessionStorage.cjs.map +1 -1
- package/dist/sqliteSessionStorage.d.mts +3 -3
- package/dist/sqliteSessionStorage.d.mts.map +1 -1
- package/dist/sqliteSessionStorage.mjs +19 -12
- package/dist/sqliteSessionStorage.mjs.map +1 -1
- package/dist/src/constants/agentSettled.d.mts +5 -0
- package/dist/src/constants/agentSettled.d.mts.map +1 -0
- package/dist/src/constants/cloud.cjs +11 -0
- package/dist/src/constants/cloud.cjs.map +1 -0
- package/dist/src/constants/cloud.d.mts +9 -0
- package/dist/src/constants/cloud.d.mts.map +1 -0
- package/dist/src/constants/cloud.mjs +11 -0
- package/dist/src/constants/cloud.mjs.map +1 -0
- package/dist/src/constants/fixedCore.cjs +38 -0
- package/dist/src/constants/fixedCore.cjs.map +1 -0
- package/dist/src/constants/fixedCore.d.mts +12 -0
- package/dist/src/constants/fixedCore.d.mts.map +1 -0
- package/dist/src/constants/fixedCore.mjs +38 -0
- package/dist/src/constants/fixedCore.mjs.map +1 -0
- package/dist/src/constants/globalSettings.cjs +10 -0
- package/dist/src/constants/globalSettings.cjs.map +1 -0
- package/dist/src/constants/globalSettings.d.mts +8 -0
- package/dist/src/constants/globalSettings.d.mts.map +1 -0
- package/dist/src/constants/globalSettings.mjs +10 -0
- package/dist/src/constants/globalSettings.mjs.map +1 -0
- package/dist/src/constants/modelGateway.cjs +48 -0
- package/dist/src/constants/modelGateway.cjs.map +1 -0
- package/dist/src/constants/modelGateway.d.mts +29 -0
- package/dist/src/constants/modelGateway.d.mts.map +1 -0
- package/dist/src/constants/modelGateway.mjs +42 -0
- package/dist/src/constants/modelGateway.mjs.map +1 -0
- package/dist/src/constants/nativeHost.cjs +11 -1
- package/dist/src/constants/nativeHost.cjs.map +1 -1
- package/dist/src/constants/nativeHost.d.mts +1 -1
- package/dist/src/constants/nativeHost.d.mts.map +1 -1
- package/dist/src/constants/nativeHost.mjs +11 -1
- package/dist/src/constants/nativeHost.mjs.map +1 -1
- package/dist/src/constants/remote.cjs +26 -14
- package/dist/src/constants/remote.cjs.map +1 -1
- package/dist/src/constants/remote.d.mts +105 -0
- package/dist/src/constants/remote.d.mts.map +1 -0
- package/dist/src/constants/remote.mjs +18 -10
- package/dist/src/constants/remote.mjs.map +1 -1
- package/dist/src/constants/sessionFiles.cjs +3 -0
- package/dist/src/constants/sessionFiles.cjs.map +1 -1
- package/dist/src/constants/sessionFiles.d.mts +9 -0
- package/dist/src/constants/sessionFiles.d.mts.map +1 -0
- package/dist/src/constants/sessionFiles.mjs +3 -1
- package/dist/src/constants/sessionFiles.mjs.map +1 -1
- package/dist/src/constants/template.cjs +13 -0
- package/dist/src/constants/template.cjs.map +1 -0
- package/dist/src/constants/template.d.mts +9 -0
- package/dist/src/constants/template.d.mts.map +1 -0
- package/dist/src/constants/template.mjs +11 -0
- package/dist/src/constants/template.mjs.map +1 -0
- package/dist/src/extensions/extensionFile.cjs +9 -10
- package/dist/src/extensions/extensionFile.cjs.map +1 -1
- package/dist/src/extensions/extensionFile.d.mts +16 -8
- package/dist/src/extensions/extensionFile.d.mts.map +1 -1
- package/dist/src/extensions/extensionFile.mjs +10 -10
- package/dist/src/extensions/extensionFile.mjs.map +1 -1
- package/dist/src/extensions/serverPlugin.cjs +55 -7
- package/dist/src/extensions/serverPlugin.cjs.map +1 -1
- package/dist/src/extensions/serverPlugin.d.mts +1 -1
- package/dist/src/extensions/serverPlugin.d.mts.map +1 -1
- package/dist/src/extensions/serverPlugin.mjs +53 -5
- package/dist/src/extensions/serverPlugin.mjs.map +1 -1
- package/dist/src/extensions/webPlugin.cjs +25 -2
- package/dist/src/extensions/webPlugin.cjs.map +1 -1
- package/dist/src/extensions/webPlugin.d.mts +10 -2
- package/dist/src/extensions/webPlugin.d.mts.map +1 -1
- package/dist/src/extensions/webPlugin.mjs +21 -2
- package/dist/src/extensions/webPlugin.mjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.cjs +299 -132
- package/dist/src/pi/piSessionRuntime.cjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.d.mts +45 -9
- package/dist/src/pi/piSessionRuntime.d.mts.map +1 -1
- package/dist/src/pi/piSessionRuntime.mjs +299 -133
- package/dist/src/pi/piSessionRuntime.mjs.map +1 -1
- package/dist/src/schemas/agentModel.cjs +1 -1
- package/dist/src/schemas/agentModel.cjs.map +1 -1
- package/dist/src/schemas/agentModel.d.mts +1 -1
- package/dist/src/schemas/agentModel.mjs +1 -1
- package/dist/src/schemas/agentModel.mjs.map +1 -1
- package/dist/src/schemas/agentRun.cjs +16 -0
- package/dist/src/schemas/agentRun.cjs.map +1 -0
- package/dist/src/schemas/agentRun.d.mts +48 -0
- package/dist/src/schemas/agentRun.d.mts.map +1 -0
- package/dist/src/schemas/agentRun.mjs +14 -0
- package/dist/src/schemas/agentRun.mjs.map +1 -0
- package/dist/src/schemas/apiContracts.d.mts +2 -2
- package/dist/src/schemas/apiContracts.d.mts.map +1 -1
- package/dist/src/schemas/approval.cjs +21 -0
- package/dist/src/schemas/approval.cjs.map +1 -0
- package/dist/src/schemas/approval.d.mts +82 -0
- package/dist/src/schemas/approval.d.mts.map +1 -0
- package/dist/src/schemas/approval.mjs +15 -0
- package/dist/src/schemas/approval.mjs.map +1 -0
- package/dist/src/schemas/approvalPrompt.cjs +103 -0
- package/dist/src/schemas/approvalPrompt.cjs.map +1 -0
- package/dist/src/schemas/approvalPrompt.d.mts +83 -0
- package/dist/src/schemas/approvalPrompt.d.mts.map +1 -0
- package/dist/src/schemas/approvalPrompt.mjs +99 -0
- package/dist/src/schemas/approvalPrompt.mjs.map +1 -0
- package/dist/src/schemas/askUser.d.mts.map +1 -1
- package/dist/src/schemas/backgroundWork.cjs +24 -2
- package/dist/src/schemas/backgroundWork.cjs.map +1 -1
- package/dist/src/schemas/backgroundWork.d.mts +11 -1
- package/dist/src/schemas/backgroundWork.d.mts.map +1 -1
- package/dist/src/schemas/backgroundWork.mjs +20 -3
- package/dist/src/schemas/backgroundWork.mjs.map +1 -1
- package/dist/src/schemas/brain.cjs +43 -0
- package/dist/src/schemas/brain.cjs.map +1 -0
- package/dist/src/schemas/brain.d.mts +107 -0
- package/dist/src/schemas/brain.d.mts.map +1 -0
- package/dist/src/schemas/brain.mjs +43 -0
- package/dist/src/schemas/brain.mjs.map +1 -0
- package/dist/src/schemas/childProcess.cjs +2 -1
- package/dist/src/schemas/childProcess.cjs.map +1 -1
- package/dist/src/schemas/childProcess.d.mts +1 -1
- package/dist/src/schemas/childProcess.d.mts.map +1 -1
- package/dist/src/schemas/childProcess.mjs +2 -1
- package/dist/src/schemas/childProcess.mjs.map +1 -1
- package/dist/src/schemas/childReport.cjs +42 -0
- package/dist/src/schemas/childReport.cjs.map +1 -0
- package/dist/src/schemas/childReport.d.mts +96 -0
- package/dist/src/schemas/childReport.d.mts.map +1 -0
- package/dist/src/schemas/childReport.mjs +35 -0
- package/dist/src/schemas/childReport.mjs.map +1 -0
- package/dist/src/schemas/clientDevices.d.mts +25 -0
- package/dist/src/schemas/clientDevices.d.mts.map +1 -0
- package/dist/src/schemas/clientMetadata.d.mts +27 -0
- package/dist/src/schemas/clientMetadata.d.mts.map +1 -0
- package/dist/src/schemas/codemode.cjs +34 -0
- package/dist/src/schemas/codemode.cjs.map +1 -0
- package/dist/src/schemas/codemode.d.mts +162 -0
- package/dist/src/schemas/codemode.d.mts.map +1 -0
- package/dist/src/schemas/codemode.mjs +30 -0
- package/dist/src/schemas/codemode.mjs.map +1 -0
- package/dist/src/schemas/delegation.cjs +35 -3
- package/dist/src/schemas/delegation.cjs.map +1 -1
- package/dist/src/schemas/delegation.d.mts +23 -0
- package/dist/src/schemas/delegation.d.mts.map +1 -1
- package/dist/src/schemas/delegation.mjs +33 -4
- package/dist/src/schemas/delegation.mjs.map +1 -1
- package/dist/src/schemas/extensionFile.d.mts +11 -5
- package/dist/src/schemas/extensionFile.d.mts.map +1 -1
- package/dist/src/schemas/federation.cjs +50 -0
- package/dist/src/schemas/federation.cjs.map +1 -0
- package/dist/src/schemas/federation.d.mts +376 -0
- package/dist/src/schemas/federation.d.mts.map +1 -0
- package/dist/src/schemas/federation.mjs +44 -0
- package/dist/src/schemas/federation.mjs.map +1 -0
- package/dist/src/schemas/headless.cjs +153 -5
- package/dist/src/schemas/headless.cjs.map +1 -1
- package/dist/src/schemas/headless.d.mts +409 -20
- package/dist/src/schemas/headless.d.mts.map +1 -1
- package/dist/src/schemas/headless.mjs +143 -6
- package/dist/src/schemas/headless.mjs.map +1 -1
- package/dist/src/schemas/help.cjs +22 -3
- package/dist/src/schemas/help.cjs.map +1 -1
- package/dist/src/schemas/help.d.mts +70 -3
- package/dist/src/schemas/help.d.mts.map +1 -1
- package/dist/src/schemas/help.mjs +17 -4
- package/dist/src/schemas/help.mjs.map +1 -1
- package/dist/src/schemas/home.cjs +35 -12
- package/dist/src/schemas/home.cjs.map +1 -1
- package/dist/src/schemas/home.d.mts +6 -0
- package/dist/src/schemas/home.d.mts.map +1 -1
- package/dist/src/schemas/home.mjs +34 -13
- package/dist/src/schemas/home.mjs.map +1 -1
- package/dist/src/schemas/hostServiceContracts.cjs +39 -0
- package/dist/src/schemas/hostServiceContracts.cjs.map +1 -0
- package/dist/src/schemas/hostServiceContracts.d.mts +26 -0
- package/dist/src/schemas/hostServiceContracts.d.mts.map +1 -0
- package/dist/src/schemas/hostServiceContracts.mjs +39 -0
- package/dist/src/schemas/hostServiceContracts.mjs.map +1 -0
- package/dist/src/schemas/hostServices.cjs +14 -0
- package/dist/src/schemas/hostServices.cjs.map +1 -0
- package/dist/src/schemas/hostServices.d.mts +45 -0
- package/dist/src/schemas/hostServices.d.mts.map +1 -0
- package/dist/src/schemas/hostServices.mjs +12 -0
- package/dist/src/schemas/hostServices.mjs.map +1 -0
- package/dist/src/schemas/hostTeam.cjs +15 -0
- package/dist/src/schemas/hostTeam.cjs.map +1 -0
- package/dist/src/schemas/hostTeam.d.mts +64 -0
- package/dist/src/schemas/hostTeam.d.mts.map +1 -0
- package/dist/src/schemas/hostTeam.mjs +13 -0
- package/dist/src/schemas/hostTeam.mjs.map +1 -0
- package/dist/src/schemas/httpApiContracts.cjs +282 -18
- package/dist/src/schemas/httpApiContracts.cjs.map +1 -1
- package/dist/src/schemas/httpApiContracts.mjs +282 -18
- package/dist/src/schemas/httpApiContracts.mjs.map +1 -1
- package/dist/src/schemas/hubChannel.cjs +132 -0
- package/dist/src/schemas/hubChannel.cjs.map +1 -1
- package/dist/src/schemas/hubChannel.d.mts +366 -15
- package/dist/src/schemas/hubChannel.d.mts.map +1 -1
- package/dist/src/schemas/hubChannel.mjs +116 -1
- package/dist/src/schemas/hubChannel.mjs.map +1 -1
- package/dist/src/schemas/humanIdentity.cjs +16 -0
- package/dist/src/schemas/humanIdentity.cjs.map +1 -0
- package/dist/src/schemas/humanIdentity.d.mts +39 -0
- package/dist/src/schemas/humanIdentity.d.mts.map +1 -0
- package/dist/src/schemas/humanIdentity.mjs +14 -0
- package/dist/src/schemas/humanIdentity.mjs.map +1 -0
- package/dist/src/schemas/identity.cjs +34 -0
- package/dist/src/schemas/identity.cjs.map +1 -0
- package/dist/src/schemas/identity.d.mts +193 -0
- package/dist/src/schemas/identity.d.mts.map +1 -0
- package/dist/src/schemas/identity.mjs +30 -0
- package/dist/src/schemas/identity.mjs.map +1 -0
- package/dist/src/schemas/lang.cjs +34 -0
- package/dist/src/schemas/lang.cjs.map +1 -0
- package/dist/src/schemas/lang.d.mts +37 -0
- package/dist/src/schemas/lang.d.mts.map +1 -0
- package/dist/src/schemas/lang.mjs +27 -0
- package/dist/src/schemas/lang.mjs.map +1 -0
- package/dist/src/schemas/leader.cjs +1 -1
- package/dist/src/schemas/leader.cjs.map +1 -1
- package/dist/src/schemas/leader.d.mts +1 -1
- package/dist/src/schemas/leader.d.mts.map +1 -1
- package/dist/src/schemas/leader.mjs +1 -1
- package/dist/src/schemas/leader.mjs.map +1 -1
- package/dist/src/schemas/lintReview.cjs +14 -0
- package/dist/src/schemas/lintReview.cjs.map +1 -0
- package/dist/src/schemas/lintReview.d.mts +75 -0
- package/dist/src/schemas/lintReview.d.mts.map +1 -0
- package/dist/src/schemas/lintReview.mjs +13 -0
- package/dist/src/schemas/lintReview.mjs.map +1 -0
- package/dist/src/schemas/locale.cjs +116 -0
- package/dist/src/schemas/locale.cjs.map +1 -0
- package/dist/src/schemas/locale.d.mts +40 -0
- package/dist/src/schemas/locale.d.mts.map +1 -0
- package/dist/src/schemas/locale.mjs +108 -0
- package/dist/src/schemas/locale.mjs.map +1 -0
- package/dist/src/schemas/mcp.cjs +17 -0
- package/dist/src/schemas/mcp.cjs.map +1 -0
- package/dist/src/schemas/mcp.d.mts +112 -0
- package/dist/src/schemas/mcp.d.mts.map +1 -0
- package/dist/src/schemas/mcp.mjs +13 -0
- package/dist/src/schemas/mcp.mjs.map +1 -0
- package/dist/src/schemas/mcpFacet.cjs.map +1 -1
- package/dist/src/schemas/mcpFacet.d.mts +4 -3
- package/dist/src/schemas/mcpFacet.d.mts.map +1 -1
- package/dist/src/schemas/mcpFacet.mjs.map +1 -1
- package/dist/src/schemas/mcpProjection.cjs +11 -1
- package/dist/src/schemas/mcpProjection.cjs.map +1 -1
- package/dist/src/schemas/mcpProjection.d.mts +10 -4
- package/dist/src/schemas/mcpProjection.d.mts.map +1 -1
- package/dist/src/schemas/mcpProjection.mjs +11 -2
- package/dist/src/schemas/mcpProjection.mjs.map +1 -1
- package/dist/src/schemas/mcpSession.d.mts +1 -1
- package/dist/src/schemas/modelGateway.cjs +143 -0
- package/dist/src/schemas/modelGateway.cjs.map +1 -0
- package/dist/src/schemas/modelGateway.d.mts +150 -0
- package/dist/src/schemas/modelGateway.d.mts.map +1 -0
- package/dist/src/schemas/modelGateway.mjs +135 -0
- package/dist/src/schemas/modelGateway.mjs.map +1 -0
- package/dist/src/schemas/narration.d.mts.map +1 -1
- package/dist/src/schemas/notification.cjs +59 -5
- package/dist/src/schemas/notification.cjs.map +1 -1
- package/dist/src/schemas/notification.d.mts +26 -0
- package/dist/src/schemas/notification.d.mts.map +1 -1
- package/dist/src/schemas/notification.mjs +59 -6
- package/dist/src/schemas/notification.mjs.map +1 -1
- package/dist/src/schemas/operationHook.cjs +180 -0
- package/dist/src/schemas/operationHook.cjs.map +1 -0
- package/dist/src/schemas/operationHook.d.mts +141 -0
- package/dist/src/schemas/operationHook.d.mts.map +1 -0
- package/dist/src/schemas/operationHook.mjs +180 -0
- package/dist/src/schemas/operationHook.mjs.map +1 -0
- package/dist/src/schemas/packageApi.cjs +76 -7
- package/dist/src/schemas/packageApi.cjs.map +1 -1
- package/dist/src/schemas/packageApi.d.mts +174 -30
- package/dist/src/schemas/packageApi.d.mts.map +1 -1
- package/dist/src/schemas/packageApi.mjs +70 -8
- package/dist/src/schemas/packageApi.mjs.map +1 -1
- package/dist/src/schemas/personTimeZone.cjs +29 -0
- package/dist/src/schemas/personTimeZone.cjs.map +1 -0
- package/dist/src/schemas/personTimeZone.d.mts +33 -0
- package/dist/src/schemas/personTimeZone.d.mts.map +1 -0
- package/dist/src/schemas/personTimeZone.mjs +25 -0
- package/dist/src/schemas/personTimeZone.mjs.map +1 -0
- package/dist/src/schemas/platform.cjs +48 -0
- package/dist/src/schemas/platform.cjs.map +1 -1
- package/dist/src/schemas/platform.d.mts +355 -11
- package/dist/src/schemas/platform.d.mts.map +1 -1
- package/dist/src/schemas/platform.mjs +34 -1
- package/dist/src/schemas/platform.mjs.map +1 -1
- package/dist/src/schemas/pluginCatalog.cjs +42 -0
- package/dist/src/schemas/pluginCatalog.cjs.map +1 -0
- package/dist/src/schemas/pluginCatalog.d.mts +67 -0
- package/dist/src/schemas/pluginCatalog.d.mts.map +1 -0
- package/dist/src/schemas/pluginCatalog.mjs +39 -0
- package/dist/src/schemas/pluginCatalog.mjs.map +1 -0
- package/dist/src/schemas/pluginContributions.cjs.map +1 -1
- package/dist/src/schemas/pluginContributions.d.mts +5 -2
- package/dist/src/schemas/pluginContributions.d.mts.map +1 -1
- package/dist/src/schemas/pluginContributions.mjs.map +1 -1
- package/dist/src/schemas/pluginProtocol.cjs +110 -10
- package/dist/src/schemas/pluginProtocol.cjs.map +1 -1
- package/dist/src/schemas/pluginProtocol.d.mts +63 -5
- package/dist/src/schemas/pluginProtocol.d.mts.map +1 -1
- package/dist/src/schemas/pluginProtocol.mjs +96 -11
- package/dist/src/schemas/pluginProtocol.mjs.map +1 -1
- package/dist/src/schemas/profileIdentity.cjs +3 -3
- package/dist/src/schemas/profileIdentity.cjs.map +1 -1
- package/dist/src/schemas/profileIdentity.d.mts +2 -2
- package/dist/src/schemas/profileIdentity.mjs +3 -3
- package/dist/src/schemas/profileIdentity.mjs.map +1 -1
- package/dist/src/schemas/protocolChannelsContract.cjs +4 -8
- package/dist/src/schemas/protocolChannelsContract.cjs.map +1 -1
- package/dist/src/schemas/protocolChannelsContract.d.mts +16 -22
- package/dist/src/schemas/protocolChannelsContract.d.mts.map +1 -1
- package/dist/src/schemas/protocolChannelsContract.mjs +5 -9
- package/dist/src/schemas/protocolChannelsContract.mjs.map +1 -1
- package/dist/src/schemas/protocolContracts.cjs +193 -133
- package/dist/src/schemas/protocolContracts.cjs.map +1 -1
- package/dist/src/schemas/protocolContracts.d.mts +136 -32
- package/dist/src/schemas/protocolContracts.d.mts.map +1 -1
- package/dist/src/schemas/protocolContracts.mjs +186 -132
- package/dist/src/schemas/protocolContracts.mjs.map +1 -1
- package/dist/src/schemas/protocolHubContract.cjs +109 -27
- package/dist/src/schemas/protocolHubContract.cjs.map +1 -1
- package/dist/src/schemas/protocolHubContract.d.mts +292 -134
- package/dist/src/schemas/protocolHubContract.d.mts.map +1 -1
- package/dist/src/schemas/protocolHubContract.mjs +103 -30
- package/dist/src/schemas/protocolHubContract.mjs.map +1 -1
- package/dist/src/schemas/protocolService.cjs +12 -0
- package/dist/src/schemas/protocolService.cjs.map +1 -0
- package/dist/src/schemas/protocolService.d.mts +22 -0
- package/dist/src/schemas/protocolService.d.mts.map +1 -0
- package/dist/src/schemas/protocolService.mjs +11 -0
- package/dist/src/schemas/protocolService.mjs.map +1 -0
- package/dist/src/schemas/protocolSessionContract.cjs +7 -11
- package/dist/src/schemas/protocolSessionContract.cjs.map +1 -1
- package/dist/src/schemas/protocolSessionContract.d.mts +303 -299
- package/dist/src/schemas/protocolSessionContract.d.mts.map +1 -1
- package/dist/src/schemas/protocolSessionContract.mjs +9 -13
- package/dist/src/schemas/protocolSessionContract.mjs.map +1 -1
- package/dist/src/schemas/protocolThreadContract.cjs +5 -6
- package/dist/src/schemas/protocolThreadContract.cjs.map +1 -1
- package/dist/src/schemas/protocolThreadContract.d.mts +12 -16
- package/dist/src/schemas/protocolThreadContract.d.mts.map +1 -1
- package/dist/src/schemas/protocolThreadContract.mjs +6 -7
- package/dist/src/schemas/protocolThreadContract.mjs.map +1 -1
- package/dist/src/schemas/remoteGateway.cjs +14 -0
- package/dist/src/schemas/remoteGateway.cjs.map +1 -0
- package/dist/src/schemas/remoteGateway.d.mts +19 -0
- package/dist/src/schemas/remoteGateway.d.mts.map +1 -0
- package/dist/src/schemas/remoteGateway.mjs +12 -0
- package/dist/src/schemas/remoteGateway.mjs.map +1 -0
- package/dist/src/schemas/remoteOrigin.cjs +9 -0
- package/dist/src/schemas/remoteOrigin.cjs.map +1 -0
- package/dist/src/schemas/remoteOrigin.d.mts +16 -0
- package/dist/src/schemas/remoteOrigin.d.mts.map +1 -0
- package/dist/src/schemas/remoteOrigin.mjs +8 -0
- package/dist/src/schemas/remoteOrigin.mjs.map +1 -0
- package/dist/src/schemas/sandboxIdentity.cjs +14 -0
- package/dist/src/schemas/sandboxIdentity.cjs.map +1 -0
- package/dist/src/schemas/sandboxIdentity.d.mts +23 -0
- package/dist/src/schemas/sandboxIdentity.d.mts.map +1 -0
- package/dist/src/schemas/sandboxIdentity.mjs +12 -0
- package/dist/src/schemas/sandboxIdentity.mjs.map +1 -0
- package/dist/src/schemas/serverBundle.cjs +13 -0
- package/dist/src/schemas/serverBundle.cjs.map +1 -0
- package/dist/src/schemas/serverBundle.d.mts +29 -1
- package/dist/src/schemas/serverBundle.d.mts.map +1 -1
- package/dist/src/schemas/serverBundle.mjs +13 -0
- package/dist/src/schemas/serverBundle.mjs.map +1 -0
- package/dist/src/schemas/serverPlugin.cjs +5 -3
- package/dist/src/schemas/serverPlugin.cjs.map +1 -1
- package/dist/src/schemas/serverPlugin.d.mts +2 -2
- package/dist/src/schemas/serverPlugin.d.mts.map +1 -1
- package/dist/src/schemas/serverPlugin.mjs +5 -3
- package/dist/src/schemas/serverPlugin.mjs.map +1 -1
- package/dist/src/schemas/serverScope.cjs +21 -3
- package/dist/src/schemas/serverScope.cjs.map +1 -1
- package/dist/src/schemas/serverScope.d.mts +17 -1
- package/dist/src/schemas/serverScope.d.mts.map +1 -1
- package/dist/src/schemas/serverScope.mjs +21 -4
- package/dist/src/schemas/serverScope.mjs.map +1 -1
- package/dist/src/schemas/sessionApiContracts.cjs +17 -11
- package/dist/src/schemas/sessionApiContracts.cjs.map +1 -1
- package/dist/src/schemas/sessionApiContracts.mjs +18 -11
- package/dist/src/schemas/sessionApiContracts.mjs.map +1 -1
- package/dist/src/schemas/sessionLifecycle.cjs +12 -0
- package/dist/src/schemas/sessionLifecycle.cjs.map +1 -0
- package/dist/src/schemas/sessionLifecycle.d.mts +33 -0
- package/dist/src/schemas/sessionLifecycle.d.mts.map +1 -0
- package/dist/src/schemas/sessionLifecycle.mjs +11 -0
- package/dist/src/schemas/sessionLifecycle.mjs.map +1 -0
- package/dist/src/schemas/sessionProtocol.cjs +13 -0
- package/dist/src/schemas/sessionProtocol.cjs.map +1 -1
- package/dist/src/schemas/sessionProtocol.d.mts +57 -15
- package/dist/src/schemas/sessionProtocol.d.mts.map +1 -1
- package/dist/src/schemas/sessionProtocol.mjs +12 -1
- package/dist/src/schemas/sessionProtocol.mjs.map +1 -1
- package/dist/src/schemas/sharedModels.cjs +9 -0
- package/dist/src/schemas/sharedModels.cjs.map +1 -0
- package/dist/src/schemas/sharedModels.d.mts +33 -0
- package/dist/src/schemas/sharedModels.d.mts.map +1 -0
- package/dist/src/schemas/sharedModels.mjs +8 -0
- package/dist/src/schemas/sharedModels.mjs.map +1 -0
- package/dist/src/schemas/skills.cjs +1 -1
- package/dist/src/schemas/skills.cjs.map +1 -1
- package/dist/src/schemas/skills.d.mts +1 -1
- package/dist/src/schemas/skills.mjs +1 -1
- package/dist/src/schemas/skills.mjs.map +1 -1
- package/dist/src/schemas/space.cjs +33 -0
- package/dist/src/schemas/space.cjs.map +1 -0
- package/dist/src/schemas/space.d.mts +90 -0
- package/dist/src/schemas/space.d.mts.map +1 -0
- package/dist/src/schemas/space.mjs +29 -0
- package/dist/src/schemas/space.mjs.map +1 -0
- package/dist/src/schemas/toolSurface.cjs.map +1 -1
- package/dist/src/schemas/toolSurface.d.mts +2 -2
- package/dist/src/schemas/toolSurface.d.mts.map +1 -1
- package/dist/src/schemas/toolSurface.mjs.map +1 -1
- package/dist/src/schemas/userFeedback.cjs +22 -0
- package/dist/src/schemas/userFeedback.cjs.map +1 -0
- package/dist/src/schemas/userFeedback.d.mts +30 -0
- package/dist/src/schemas/userFeedback.d.mts.map +1 -0
- package/dist/src/schemas/userFeedback.mjs +18 -0
- package/dist/src/schemas/userFeedback.mjs.map +1 -0
- package/dist/src/schemas/voiceReloadHandoff.cjs +3 -3
- package/dist/src/schemas/voiceReloadHandoff.cjs.map +1 -1
- package/dist/src/schemas/voiceReloadHandoff.d.mts +5 -5
- package/dist/src/schemas/voiceReloadHandoff.d.mts.map +1 -1
- package/dist/src/schemas/voiceReloadHandoff.mjs +3 -3
- package/dist/src/schemas/voiceReloadHandoff.mjs.map +1 -1
- package/dist/src/schemas/workflow.cjs +217 -0
- package/dist/src/schemas/workflow.cjs.map +1 -0
- package/dist/src/schemas/workflow.d.mts +593 -0
- package/dist/src/schemas/workflow.d.mts.map +1 -0
- package/dist/src/schemas/workflow.mjs +188 -0
- package/dist/src/schemas/workflow.mjs.map +1 -0
- package/dist/src/schemas/workspaceRegistry.cjs +13 -0
- package/dist/src/schemas/workspaceRegistry.cjs.map +1 -0
- package/dist/src/schemas/workspaceRegistry.d.mts +45 -0
- package/dist/src/schemas/workspaceRegistry.d.mts.map +1 -0
- package/dist/src/schemas/workspaceRegistry.mjs +11 -0
- package/dist/src/schemas/workspaceRegistry.mjs.map +1 -0
- package/dist/src/schemas/workspaceSandboxes.cjs +14 -0
- package/dist/src/schemas/workspaceSandboxes.cjs.map +1 -0
- package/dist/src/schemas/workspaceSandboxes.d.mts +85 -0
- package/dist/src/schemas/workspaceSandboxes.d.mts.map +1 -0
- package/dist/src/schemas/workspaceSandboxes.mjs +12 -0
- package/dist/src/schemas/workspaceSandboxes.mjs.map +1 -0
- package/dist/src/server/conversationEvents.cjs +345 -0
- package/dist/src/server/conversationEvents.cjs.map +1 -0
- package/dist/src/server/conversationEvents.mjs +345 -0
- package/dist/src/server/conversationEvents.mjs.map +1 -0
- package/dist/src/server/directHarnessRuntime.cjs +1326 -549
- package/dist/src/server/directHarnessRuntime.cjs.map +1 -1
- package/dist/src/server/directHarnessRuntime.d.mts +1 -1
- package/dist/src/server/directHarnessRuntime.d.mts.map +1 -1
- package/dist/src/server/directHarnessRuntime.mjs +1308 -532
- package/dist/src/server/directHarnessRuntime.mjs.map +1 -1
- package/dist/src/server/largeFrameLink.cjs +22 -37
- package/dist/src/server/largeFrameLink.cjs.map +1 -1
- package/dist/src/server/largeFrameLink.mjs +22 -37
- package/dist/src/server/largeFrameLink.mjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.cjs +2 -1
- package/dist/src/server/mcpBundleLoader.cjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.d.mts +1 -1
- package/dist/src/server/mcpBundleLoader.d.mts.map +1 -1
- package/dist/src/server/mcpBundleLoader.mjs +2 -1
- package/dist/src/server/mcpBundleLoader.mjs.map +1 -1
- package/dist/src/server/providerRoutes.cjs +74 -0
- package/dist/src/server/providerRoutes.cjs.map +1 -0
- package/dist/src/server/providerRoutes.d.mts +20 -0
- package/dist/src/server/providerRoutes.d.mts.map +1 -0
- package/dist/src/server/providerRoutes.mjs +74 -0
- package/dist/src/server/providerRoutes.mjs.map +1 -0
- package/dist/src/server/providerRuntime.cjs +41 -0
- package/dist/src/server/providerRuntime.cjs.map +1 -0
- package/dist/src/server/providerRuntime.d.mts +12 -0
- package/dist/src/server/providerRuntime.d.mts.map +1 -0
- package/dist/src/server/providerRuntime.mjs +39 -0
- package/dist/src/server/providerRuntime.mjs.map +1 -0
- package/dist/src/server/serverPackages.cjs +29 -7
- package/dist/src/server/serverPackages.cjs.map +1 -1
- package/dist/src/server/serverPackages.d.mts +9 -3
- package/dist/src/server/serverPackages.d.mts.map +1 -1
- package/dist/src/server/serverPackages.mjs +29 -7
- package/dist/src/server/serverPackages.mjs.map +1 -1
- package/dist/src/server/serverScope.cjs +434 -34
- package/dist/src/server/serverScope.cjs.map +1 -1
- package/dist/src/server/serverScope.d.mts +72 -8
- package/dist/src/server/serverScope.d.mts.map +1 -1
- package/dist/src/server/serverScope.mjs +435 -35
- package/dist/src/server/serverScope.mjs.map +1 -1
- package/dist/src/server/threadJournals.cjs.map +1 -1
- package/dist/src/server/threadJournals.mjs.map +1 -1
- package/dist/src/services/approvalGate/index.cjs +179 -0
- package/dist/src/services/approvalGate/index.cjs.map +1 -0
- package/dist/src/services/approvalGate/index.d.mts +30 -0
- package/dist/src/services/approvalGate/index.d.mts.map +1 -0
- package/dist/src/services/approvalGate/index.mjs +174 -0
- package/dist/src/services/approvalGate/index.mjs.map +1 -0
- package/dist/src/services/approvalGate/type.d.mts +36 -0
- package/dist/src/services/approvalGate/type.d.mts.map +1 -0
- package/dist/src/services/bundlePublication/index.cjs +103 -39
- package/dist/src/services/bundlePublication/index.cjs.map +1 -1
- package/dist/src/services/bundlePublication/index.d.mts +11 -0
- package/dist/src/services/bundlePublication/index.d.mts.map +1 -0
- package/dist/src/services/bundlePublication/index.mjs +101 -39
- package/dist/src/services/bundlePublication/index.mjs.map +1 -1
- package/dist/src/services/chatgptImages/index.cjs +56 -11
- package/dist/src/services/chatgptImages/index.cjs.map +1 -1
- package/dist/src/services/chatgptImages/index.mjs +56 -11
- package/dist/src/services/chatgptImages/index.mjs.map +1 -1
- package/dist/src/services/chatgptLogin/index.cjs +2 -2
- package/dist/src/services/chatgptLogin/index.cjs.map +1 -1
- package/dist/src/services/chordAdapter/index.cjs +456 -0
- package/dist/src/services/chordAdapter/index.cjs.map +1 -0
- package/dist/src/services/chordAdapter/index.d.mts +13 -0
- package/dist/src/services/chordAdapter/index.d.mts.map +1 -0
- package/dist/src/services/chordAdapter/index.mjs +453 -0
- package/dist/src/services/chordAdapter/index.mjs.map +1 -0
- package/dist/src/services/chordAdapter/type.d.mts +24 -0
- package/dist/src/services/chordAdapter/type.d.mts.map +1 -0
- package/dist/src/services/clientDevices/index.cjs +75 -0
- package/dist/src/services/clientDevices/index.cjs.map +1 -0
- package/dist/src/services/clientDevices/index.d.mts +7 -0
- package/dist/src/services/clientDevices/index.d.mts.map +1 -0
- package/dist/src/services/clientDevices/index.mjs +74 -0
- package/dist/src/services/clientDevices/index.mjs.map +1 -0
- package/dist/src/services/clientMetadata/_lib/codec.cjs +96 -0
- package/dist/src/services/clientMetadata/_lib/codec.cjs.map +1 -0
- package/dist/src/services/clientMetadata/_lib/codec.d.mts +16 -0
- package/dist/src/services/clientMetadata/_lib/codec.d.mts.map +1 -0
- package/dist/src/services/clientMetadata/_lib/codec.mjs +89 -0
- package/dist/src/services/clientMetadata/_lib/codec.mjs.map +1 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.cjs +63 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.cjs.map +1 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.d.mts +10 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.d.mts.map +1 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.mjs +62 -0
- package/dist/src/services/clientMetadata/_lib/deviceLabel.mjs.map +1 -0
- package/dist/src/services/contextUsage/index.cjs +0 -9
- package/dist/src/services/contextUsage/index.cjs.map +1 -1
- package/dist/src/services/contextUsage/index.mjs +1 -9
- package/dist/src/services/contextUsage/index.mjs.map +1 -1
- package/dist/src/services/durableNavigation/docs.cjs +1 -0
- package/dist/src/services/durableNavigation/docs.cjs.map +1 -1
- package/dist/src/services/durableNavigation/docs.mjs +1 -0
- package/dist/src/services/durableNavigation/docs.mjs.map +1 -1
- package/dist/src/services/durableNavigation/index.cjs.map +1 -1
- package/dist/src/services/durableNavigation/index.mjs.map +1 -1
- package/dist/src/services/durableQueue/docs.cjs +1 -0
- package/dist/src/services/durableQueue/docs.cjs.map +1 -1
- package/dist/src/services/durableQueue/docs.mjs +1 -0
- package/dist/src/services/durableQueue/docs.mjs.map +1 -1
- package/dist/src/services/durableQueue/index.cjs +157 -69
- package/dist/src/services/durableQueue/index.cjs.map +1 -1
- package/dist/src/services/durableQueue/index.mjs +156 -70
- package/dist/src/services/durableQueue/index.mjs.map +1 -1
- package/dist/src/services/durableRequestReceipts/docs.cjs +1 -0
- package/dist/src/services/durableRequestReceipts/docs.cjs.map +1 -1
- package/dist/src/services/durableRequestReceipts/docs.mjs +1 -0
- package/dist/src/services/durableRequestReceipts/docs.mjs.map +1 -1
- package/dist/src/services/durableResumeSnapshots/docs.cjs +49 -0
- package/dist/src/services/durableResumeSnapshots/docs.cjs.map +1 -0
- package/dist/src/services/durableResumeSnapshots/docs.mjs +48 -0
- package/dist/src/services/durableResumeSnapshots/docs.mjs.map +1 -0
- package/dist/src/services/durableResumeSnapshots/index.cjs +392 -0
- package/dist/src/services/durableResumeSnapshots/index.cjs.map +1 -0
- package/dist/src/services/durableResumeSnapshots/index.mjs +392 -0
- package/dist/src/services/durableResumeSnapshots/index.mjs.map +1 -0
- package/dist/src/services/durableResumeSnapshots/type.d.mts +27 -0
- package/dist/src/services/durableResumeSnapshots/type.d.mts.map +1 -0
- package/dist/src/services/durableSession/docs.cjs +13 -1
- package/dist/src/services/durableSession/docs.cjs.map +1 -1
- package/dist/src/services/durableSession/docs.d.mts +9 -1
- package/dist/src/services/durableSession/docs.d.mts.map +1 -1
- package/dist/src/services/durableSession/docs.mjs +13 -1
- package/dist/src/services/durableSession/docs.mjs.map +1 -1
- package/dist/src/services/durableSession/index.cjs.map +1 -1
- package/dist/src/services/durableSession/index.d.mts +1 -1
- package/dist/src/services/durableSession/index.mjs.map +1 -1
- package/dist/src/services/durableSubagents/docs.cjs +1 -0
- package/dist/src/services/durableSubagents/docs.cjs.map +1 -1
- package/dist/src/services/durableSubagents/docs.mjs +1 -0
- package/dist/src/services/durableSubagents/docs.mjs.map +1 -1
- package/dist/src/services/durableSubagents/extension.cjs.map +1 -1
- package/dist/src/services/durableSubagents/index.cjs +29 -3
- package/dist/src/services/durableSubagents/index.cjs.map +1 -1
- package/dist/src/services/durableSubagents/index.mjs +29 -4
- package/dist/src/services/durableSubagents/index.mjs.map +1 -1
- package/dist/src/services/durableSubagents/tasks.cjs.map +1 -1
- package/dist/src/services/edgeModelRuntime/index.cjs +377 -0
- package/dist/src/services/edgeModelRuntime/index.cjs.map +1 -0
- package/dist/src/services/edgeModelRuntime/index.d.mts +24 -0
- package/dist/src/services/edgeModelRuntime/index.d.mts.map +1 -0
- package/dist/src/services/edgeModelRuntime/index.mjs +374 -0
- package/dist/src/services/edgeModelRuntime/index.mjs.map +1 -0
- package/dist/src/services/edgeModelRuntime/type.d.mts +39 -0
- package/dist/src/services/edgeModelRuntime/type.d.mts.map +1 -0
- package/dist/src/services/editPresence/index.cjs +53 -0
- package/dist/src/services/editPresence/index.cjs.map +1 -0
- package/dist/src/services/editPresence/index.d.mts +6 -0
- package/dist/src/services/editPresence/index.d.mts.map +1 -0
- package/dist/src/services/editPresence/index.mjs +53 -0
- package/dist/src/services/editPresence/index.mjs.map +1 -0
- package/dist/src/services/fileAccess/accessibleFile.cjs +63 -0
- package/dist/src/services/fileAccess/accessibleFile.cjs.map +1 -0
- package/dist/src/services/fileAccess/accessibleFile.d.mts +1 -0
- package/dist/src/services/fileAccess/accessibleFile.mjs +60 -0
- package/dist/src/services/fileAccess/accessibleFile.mjs.map +1 -0
- package/dist/src/services/fileAccess/core.cjs +87 -0
- package/dist/src/services/fileAccess/core.cjs.map +1 -0
- package/dist/src/services/fileAccess/core.mjs +78 -0
- package/dist/src/services/fileAccess/core.mjs.map +1 -0
- package/dist/src/services/fileAccess/index.cjs +34 -0
- package/dist/src/services/fileAccess/index.cjs.map +1 -0
- package/dist/src/services/fileAccess/index.d.mts +23 -0
- package/dist/src/services/fileAccess/index.d.mts.map +1 -0
- package/dist/src/services/fileAccess/index.mjs +29 -0
- package/dist/src/services/fileAccess/index.mjs.map +1 -0
- package/dist/src/services/fileAccess/type.d.mts +1 -0
- package/dist/src/services/grantLedger/index.cjs +56 -0
- package/dist/src/services/grantLedger/index.cjs.map +1 -0
- package/dist/src/services/grantLedger/index.mjs +55 -0
- package/dist/src/services/grantLedger/index.mjs.map +1 -0
- package/dist/src/services/guardedFile/index.cjs +36 -0
- package/dist/src/services/guardedFile/index.cjs.map +1 -0
- package/dist/src/services/guardedFile/index.d.mts +9 -0
- package/dist/src/services/guardedFile/index.d.mts.map +1 -0
- package/dist/src/services/guardedFile/index.mjs +33 -0
- package/dist/src/services/guardedFile/index.mjs.map +1 -0
- package/dist/src/services/headlessClient/index.cjs +85 -3
- package/dist/src/services/headlessClient/index.cjs.map +1 -1
- package/dist/src/services/headlessClient/index.mjs +86 -4
- package/dist/src/services/headlessClient/index.mjs.map +1 -1
- package/dist/src/services/hostServices/index.cjs +157 -0
- package/dist/src/services/hostServices/index.cjs.map +1 -0
- package/dist/src/services/hostServices/index.d.mts +33 -0
- package/dist/src/services/hostServices/index.d.mts.map +1 -0
- package/dist/src/services/hostServices/index.mjs +157 -0
- package/dist/src/services/hostServices/index.mjs.map +1 -0
- package/dist/src/services/inputTemplate/index.cjs +120 -0
- package/dist/src/services/inputTemplate/index.cjs.map +1 -0
- package/dist/src/services/inputTemplate/index.d.mts +10 -0
- package/dist/src/services/inputTemplate/index.d.mts.map +1 -0
- package/dist/src/services/inputTemplate/index.mjs +118 -0
- package/dist/src/services/inputTemplate/index.mjs.map +1 -0
- package/dist/src/services/inputTemplate/type.d.mts +17 -0
- package/dist/src/services/inputTemplate/type.d.mts.map +1 -0
- package/dist/src/services/json/core.cjs.map +1 -1
- package/dist/src/services/json/core.d.mts +1 -1
- package/dist/src/services/json/core.mjs.map +1 -1
- package/dist/src/services/json/sync.cjs +2 -2
- package/dist/src/services/json/sync.cjs.map +1 -1
- package/dist/src/services/json/sync.d.mts.map +1 -1
- package/dist/src/services/json/sync.mjs +1 -1
- package/dist/src/services/json/sync.mjs.map +1 -1
- package/dist/src/services/kernel/index.cjs.map +1 -1
- package/dist/src/services/kernel/index.d.mts +1 -1
- package/dist/src/services/kernel/index.mjs.map +1 -1
- package/dist/src/services/loginFlow/index.cjs +7 -1
- package/dist/src/services/loginFlow/index.cjs.map +1 -1
- package/dist/src/services/loginFlow/index.mjs +7 -1
- package/dist/src/services/loginFlow/index.mjs.map +1 -1
- package/dist/src/services/modelDispatch/index.cjs +200 -0
- package/dist/src/services/modelDispatch/index.cjs.map +1 -0
- package/dist/src/services/modelDispatch/index.mjs +197 -0
- package/dist/src/services/modelDispatch/index.mjs.map +1 -0
- package/dist/src/services/modelFallback/index.cjs +88 -0
- package/dist/src/services/modelFallback/index.cjs.map +1 -0
- package/dist/src/services/modelFallback/index.d.mts +16 -0
- package/dist/src/services/modelFallback/index.d.mts.map +1 -0
- package/dist/src/services/modelFallback/index.mjs +86 -0
- package/dist/src/services/modelFallback/index.mjs.map +1 -0
- package/dist/src/services/modelFallback/type.d.mts +16 -0
- package/dist/src/services/modelFallback/type.d.mts.map +1 -0
- package/dist/src/services/modelGatewayContainer/index.cjs +394 -0
- package/dist/src/services/modelGatewayContainer/index.cjs.map +1 -0
- package/dist/src/services/modelGatewayContainer/index.d.mts +16 -0
- package/dist/src/services/modelGatewayContainer/index.d.mts.map +1 -0
- package/dist/src/services/modelGatewayContainer/index.mjs +393 -0
- package/dist/src/services/modelGatewayContainer/index.mjs.map +1 -0
- package/dist/src/services/modelGatewayContainer/type.d.mts +28 -0
- package/dist/src/services/modelGatewayContainer/type.d.mts.map +1 -0
- package/dist/src/services/modelGatewayExecutor/index.cjs +160 -0
- package/dist/src/services/modelGatewayExecutor/index.cjs.map +1 -0
- package/dist/src/services/modelGatewayExecutor/index.d.mts +18 -0
- package/dist/src/services/modelGatewayExecutor/index.d.mts.map +1 -0
- package/dist/src/services/modelGatewayExecutor/index.mjs +160 -0
- package/dist/src/services/modelGatewayExecutor/index.mjs.map +1 -0
- package/dist/src/services/modelGatewayExecutor/type.d.mts +36 -0
- package/dist/src/services/modelGatewayExecutor/type.d.mts.map +1 -0
- package/dist/src/services/modelGatewayHost/index.cjs +292 -0
- package/dist/src/services/modelGatewayHost/index.cjs.map +1 -0
- package/dist/src/services/modelGatewayHost/index.d.mts +13 -0
- package/dist/src/services/modelGatewayHost/index.d.mts.map +1 -0
- package/dist/src/services/modelGatewayHost/index.mjs +292 -0
- package/dist/src/services/modelGatewayHost/index.mjs.map +1 -0
- package/dist/src/services/modelGatewayHost/type.d.mts +61 -0
- package/dist/src/services/modelGatewayHost/type.d.mts.map +1 -0
- package/dist/src/services/modelGatewayWire/index.cjs +170 -0
- package/dist/src/services/modelGatewayWire/index.cjs.map +1 -0
- package/dist/src/services/modelGatewayWire/index.d.mts +30 -0
- package/dist/src/services/modelGatewayWire/index.d.mts.map +1 -0
- package/dist/src/services/modelGatewayWire/index.mjs +163 -0
- package/dist/src/services/modelGatewayWire/index.mjs.map +1 -0
- package/dist/src/services/nativeChildTools/index.cjs +307 -9
- package/dist/src/services/nativeChildTools/index.cjs.map +1 -1
- package/dist/src/services/nativeChildTools/index.d.mts +11 -0
- package/dist/src/services/nativeChildTools/index.d.mts.map +1 -0
- package/dist/src/services/nativeChildTools/index.mjs +298 -3
- package/dist/src/services/nativeChildTools/index.mjs.map +1 -1
- package/dist/src/services/nodeHost/index.cjs +4 -2
- package/dist/src/services/nodeHost/index.cjs.map +1 -1
- package/dist/src/services/nodeHost/index.d.mts +2 -0
- package/dist/src/services/nodeHost/index.d.mts.map +1 -1
- package/dist/src/services/nodeHost/index.mjs +3 -1
- package/dist/src/services/nodeHost/index.mjs.map +1 -1
- package/dist/src/services/nodeModelDependencies/index.cjs +26 -29
- package/dist/src/services/nodeModelDependencies/index.cjs.map +1 -1
- package/dist/src/services/nodeModelDependencies/index.mjs +18 -20
- package/dist/src/services/nodeModelDependencies/index.mjs.map +1 -1
- package/dist/src/services/openSessionRegistry/index.cjs +1 -0
- package/dist/src/services/openSessionRegistry/index.cjs.map +1 -1
- package/dist/src/services/openSessionRegistry/index.d.mts +1 -1
- package/dist/src/services/openSessionRegistry/index.mjs +1 -0
- package/dist/src/services/openSessionRegistry/index.mjs.map +1 -1
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs +44 -4
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs.map +1 -1
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts +26 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts.map +1 -1
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs +44 -4
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs.map +1 -1
- package/dist/src/services/openSessionRegistry/sync.cjs +9 -4
- package/dist/src/services/openSessionRegistry/sync.cjs.map +1 -1
- package/dist/src/services/openSessionRegistry/sync.d.mts.map +1 -1
- package/dist/src/services/openSessionRegistry/sync.mjs +8 -3
- package/dist/src/services/openSessionRegistry/sync.mjs.map +1 -1
- package/dist/src/services/operationDispatch/index.cjs +263 -0
- package/dist/src/services/operationDispatch/index.cjs.map +1 -0
- package/dist/src/services/operationDispatch/index.mjs +263 -0
- package/dist/src/services/operationDispatch/index.mjs.map +1 -0
- package/dist/src/services/packageApiHarness/index.cjs +2 -1
- package/dist/src/services/packageApiHarness/index.cjs.map +1 -1
- package/dist/src/services/packageApiHarness/index.d.mts +2 -1
- package/dist/src/services/packageApiHarness/index.d.mts.map +1 -1
- package/dist/src/services/packageApiHarness/index.mjs +2 -1
- package/dist/src/services/packageApiHarness/index.mjs.map +1 -1
- package/dist/src/services/packageContentRevision/index.cjs +173 -0
- package/dist/src/services/packageContentRevision/index.cjs.map +1 -0
- package/dist/src/services/packageContentRevision/index.d.mts +39 -0
- package/dist/src/services/packageContentRevision/index.d.mts.map +1 -0
- package/dist/src/services/packageContentRevision/index.mjs +168 -0
- package/dist/src/services/packageContentRevision/index.mjs.map +1 -0
- package/dist/src/services/packageResource/index.cjs +12 -8
- package/dist/src/services/packageResource/index.cjs.map +1 -1
- package/dist/src/services/packageResource/index.d.mts.map +1 -1
- package/dist/src/services/packageResource/index.mjs +12 -8
- package/dist/src/services/packageResource/index.mjs.map +1 -1
- package/dist/src/services/pairingPage/index.cjs +85 -24
- package/dist/src/services/pairingPage/index.cjs.map +1 -1
- package/dist/src/services/pairingPage/index.d.mts +23 -0
- package/dist/src/services/pairingPage/index.d.mts.map +1 -0
- package/dist/src/services/pairingPage/index.mjs +86 -25
- package/dist/src/services/pairingPage/index.mjs.map +1 -1
- package/dist/src/services/piArgs/index.cjs +2 -2
- package/dist/src/services/piArgs/index.cjs.map +1 -1
- package/dist/src/services/piExtensionHost/index.cjs +344 -56
- package/dist/src/services/piExtensionHost/index.cjs.map +1 -1
- package/dist/src/services/piExtensionHost/index.d.mts +3 -1
- package/dist/src/services/piExtensionHost/index.d.mts.map +1 -1
- package/dist/src/services/piExtensionHost/index.mjs +325 -37
- package/dist/src/services/piExtensionHost/index.mjs.map +1 -1
- package/dist/src/services/piMessages/index.cjs +16 -0
- package/dist/src/services/piMessages/index.cjs.map +1 -1
- package/dist/src/services/piMessages/index.d.mts +12 -0
- package/dist/src/services/piMessages/index.d.mts.map +1 -0
- package/dist/src/services/piMessages/index.mjs +16 -1
- package/dist/src/services/piMessages/index.mjs.map +1 -1
- package/dist/src/services/piSettings/core.cjs +18 -5
- package/dist/src/services/piSettings/core.cjs.map +1 -1
- package/dist/src/services/piSettings/core.d.mts +6 -1
- package/dist/src/services/piSettings/core.d.mts.map +1 -1
- package/dist/src/services/piSettings/core.mjs +18 -6
- package/dist/src/services/piSettings/core.mjs.map +1 -1
- package/dist/src/services/piSettings/sync.cjs +31 -2
- package/dist/src/services/piSettings/sync.cjs.map +1 -1
- package/dist/src/services/piSettings/sync.d.mts +3 -0
- package/dist/src/services/piSettings/sync.d.mts.map +1 -1
- package/dist/src/services/piSettings/sync.mjs +31 -3
- package/dist/src/services/piSettings/sync.mjs.map +1 -1
- package/dist/src/services/piSummary/index.cjs +2 -2
- package/dist/src/services/piSummary/index.cjs.map +1 -1
- package/dist/src/services/platformFiles/index.cjs +81 -0
- package/dist/src/services/platformFiles/index.cjs.map +1 -1
- package/dist/src/services/platformFiles/index.d.mts +12 -1
- package/dist/src/services/platformFiles/index.d.mts.map +1 -1
- package/dist/src/services/platformFiles/index.mjs +76 -1
- package/dist/src/services/platformFiles/index.mjs.map +1 -1
- package/dist/src/services/platformFiles/rootBoundReplace.cjs +110 -0
- package/dist/src/services/platformFiles/rootBoundReplace.cjs.map +1 -0
- package/dist/src/services/platformFiles/rootBoundReplace.d.mts +21 -0
- package/dist/src/services/platformFiles/rootBoundReplace.d.mts.map +1 -0
- package/dist/src/services/platformFiles/rootBoundReplace.mjs +106 -0
- package/dist/src/services/platformFiles/rootBoundReplace.mjs.map +1 -0
- package/dist/src/services/poPackage/core.cjs.map +1 -1
- package/dist/src/services/poPackage/core.d.mts +1 -1
- package/dist/src/services/poPackage/core.mjs.map +1 -1
- package/dist/src/services/poPackage/sync.cjs +2 -2
- package/dist/src/services/poPackage/sync.cjs.map +1 -1
- package/dist/src/services/poPackage/sync.d.mts.map +1 -1
- package/dist/src/services/poPackage/sync.mjs +1 -1
- package/dist/src/services/poPackage/sync.mjs.map +1 -1
- package/dist/src/services/poTelemetry/index.cjs +69 -0
- package/dist/src/services/poTelemetry/index.cjs.map +1 -0
- package/dist/src/services/poTelemetry/index.d.mts +7 -0
- package/dist/src/services/poTelemetry/index.d.mts.map +1 -0
- package/dist/src/services/poTelemetry/index.mjs +66 -0
- package/dist/src/services/poTelemetry/index.mjs.map +1 -0
- package/dist/src/services/portableConfig/index.cjs +136 -0
- package/dist/src/services/portableConfig/index.cjs.map +1 -0
- package/dist/src/services/portableConfig/index.d.mts +30 -0
- package/dist/src/services/portableConfig/index.d.mts.map +1 -0
- package/dist/src/services/portableConfig/index.mjs +130 -0
- package/dist/src/services/portableConfig/index.mjs.map +1 -0
- package/dist/src/services/providerAuth/index.cjs +6 -10
- package/dist/src/services/providerAuth/index.cjs.map +1 -1
- package/dist/src/services/providerAuth/index.mjs +5 -7
- package/dist/src/services/providerAuth/index.mjs.map +1 -1
- package/dist/src/services/providerImages/fitter.cjs +48 -0
- package/dist/src/services/providerImages/fitter.cjs.map +1 -0
- package/dist/src/services/providerImages/fitter.mjs +47 -0
- package/dist/src/services/providerImages/fitter.mjs.map +1 -0
- package/dist/src/services/providerImages/index.cjs +21 -0
- package/dist/src/services/providerImages/index.cjs.map +1 -0
- package/dist/src/services/providerImages/index.d.mts +3 -0
- package/dist/src/services/providerImages/index.mjs +21 -0
- package/dist/src/services/providerImages/index.mjs.map +1 -0
- package/dist/src/services/runtimeEnvironment/index.cjs +228 -0
- package/dist/src/services/runtimeEnvironment/index.cjs.map +1 -0
- package/dist/src/services/runtimeEnvironment/index.d.mts +37 -0
- package/dist/src/services/runtimeEnvironment/index.d.mts.map +1 -0
- package/dist/src/services/runtimeEnvironment/index.mjs +219 -0
- package/dist/src/services/runtimeEnvironment/index.mjs.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.cjs +2 -2
- package/dist/src/services/runtimeIdentity/sync.cjs.map +1 -1
- package/dist/src/services/runtimeIdentity/sync.d.mts.map +1 -1
- package/dist/src/services/runtimeIdentity/sync.mjs +1 -1
- package/dist/src/services/runtimeIdentity/sync.mjs.map +1 -1
- package/dist/src/services/scopeInput/index.cjs +49 -0
- package/dist/src/services/scopeInput/index.cjs.map +1 -0
- package/dist/src/services/scopeInput/index.mjs +47 -0
- package/dist/src/services/scopeInput/index.mjs.map +1 -0
- package/dist/src/services/serialRunner/index.cjs +3 -0
- package/dist/src/services/serialRunner/index.cjs.map +1 -1
- package/dist/src/services/serialRunner/index.d.mts +2 -0
- package/dist/src/services/serialRunner/index.d.mts.map +1 -1
- package/dist/src/services/serialRunner/index.mjs +3 -1
- package/dist/src/services/serialRunner/index.mjs.map +1 -1
- package/dist/src/services/serverHost/index.cjs +12 -2
- package/dist/src/services/serverHost/index.cjs.map +1 -1
- package/dist/src/services/serverHost/index.d.mts +3 -1
- package/dist/src/services/serverHost/index.d.mts.map +1 -1
- package/dist/src/services/serverHost/index.mjs +12 -2
- package/dist/src/services/serverHost/index.mjs.map +1 -1
- package/dist/src/services/sessionAccess/index.cjs +168 -0
- package/dist/src/services/sessionAccess/index.cjs.map +1 -0
- package/dist/src/services/sessionAccess/index.d.mts +11 -0
- package/dist/src/services/sessionAccess/index.d.mts.map +1 -0
- package/dist/src/services/sessionAccess/index.mjs +163 -0
- package/dist/src/services/sessionAccess/index.mjs.map +1 -0
- package/dist/src/services/sessionAccess/type.d.mts +32 -0
- package/dist/src/services/sessionAccess/type.d.mts.map +1 -0
- package/dist/src/services/sessionAttachments/index.cjs +13 -13
- package/dist/src/services/sessionAttachments/index.cjs.map +1 -1
- package/dist/src/services/sessionAttachments/index.d.mts +3 -1
- package/dist/src/services/sessionAttachments/index.d.mts.map +1 -1
- package/dist/src/services/sessionAttachments/index.mjs +12 -12
- package/dist/src/services/sessionAttachments/index.mjs.map +1 -1
- package/dist/src/services/sessionFiles/index.cjs +35 -13
- package/dist/src/services/sessionFiles/index.cjs.map +1 -1
- package/dist/src/services/sessionFiles/index.d.mts +10 -1
- package/dist/src/services/sessionFiles/index.d.mts.map +1 -1
- package/dist/src/services/sessionFiles/index.mjs +34 -14
- package/dist/src/services/sessionFiles/index.mjs.map +1 -1
- package/dist/src/services/sessionFiles/sessionDirectory.cjs +3 -3
- package/dist/src/services/sessionFiles/sessionDirectory.cjs.map +1 -1
- package/dist/src/services/sessionFiles/sessionDirectory.mjs +3 -3
- package/dist/src/services/sessionFiles/sessionDirectory.mjs.map +1 -1
- package/dist/src/services/sessionLifecycle/index.cjs +293 -0
- package/dist/src/services/sessionLifecycle/index.cjs.map +1 -0
- package/dist/src/services/sessionLifecycle/index.mjs +293 -0
- package/dist/src/services/sessionLifecycle/index.mjs.map +1 -0
- package/dist/src/services/sessionLifecycle/type.d.mts +32 -0
- package/dist/src/services/sessionLifecycle/type.d.mts.map +1 -0
- package/dist/src/services/sessionMcpRoutePaths/index.cjs +60 -0
- package/dist/src/services/sessionMcpRoutePaths/index.cjs.map +1 -0
- package/dist/src/services/sessionMcpRoutePaths/index.d.mts +31 -0
- package/dist/src/services/sessionMcpRoutePaths/index.d.mts.map +1 -0
- package/dist/src/services/sessionMcpRoutePaths/index.mjs +45 -0
- package/dist/src/services/sessionMcpRoutePaths/index.mjs.map +1 -0
- package/dist/src/services/sessionWorkspaceMove/index.cjs +81 -0
- package/dist/src/services/sessionWorkspaceMove/index.cjs.map +1 -0
- package/dist/src/services/sessionWorkspaceMove/index.d.mts +6 -0
- package/dist/src/services/sessionWorkspaceMove/index.d.mts.map +1 -0
- package/dist/src/services/sessionWorkspaceMove/index.mjs +81 -0
- package/dist/src/services/sessionWorkspaceMove/index.mjs.map +1 -0
- package/dist/src/services/sessionWorkspaceMove/type.d.mts +16 -0
- package/dist/src/services/sessionWorkspaceMove/type.d.mts.map +1 -0
- package/dist/src/services/skillPrompt/index.cjs +14 -4
- package/dist/src/services/skillPrompt/index.cjs.map +1 -1
- package/dist/src/services/skillPrompt/index.mjs +14 -5
- package/dist/src/services/skillPrompt/index.mjs.map +1 -1
- package/dist/src/services/skillRelations/index.cjs +113 -0
- package/dist/src/services/skillRelations/index.cjs.map +1 -0
- package/dist/src/services/skillRelations/index.d.mts +32 -0
- package/dist/src/services/skillRelations/index.d.mts.map +1 -0
- package/dist/src/services/skillRelations/index.mjs +111 -0
- package/dist/src/services/skillRelations/index.mjs.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.cjs +38 -10
- package/dist/src/services/sqliteSessionHistory/index.cjs.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.d.mts +13 -0
- package/dist/src/services/sqliteSessionHistory/index.d.mts.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.mjs +37 -10
- package/dist/src/services/sqliteSessionHistory/index.mjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.cjs +12 -12
- package/dist/src/services/sqliteTranscriptReader/index.cjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.d.mts +2 -2
- package/dist/src/services/sqliteTranscriptReader/index.mjs +3 -3
- package/dist/src/services/sqliteTranscriptReader/index.mjs.map +1 -1
- package/dist/src/services/telemetry/index.cjs +591 -0
- package/dist/src/services/telemetry/index.cjs.map +1 -0
- package/dist/src/services/telemetry/index.d.mts +7 -0
- package/dist/src/services/telemetry/index.d.mts.map +1 -0
- package/dist/src/services/telemetry/index.mjs +587 -0
- package/dist/src/services/telemetry/index.mjs.map +1 -0
- package/dist/src/services/toolContinuation/index.cjs +84 -0
- package/dist/src/services/toolContinuation/index.cjs.map +1 -0
- package/dist/src/services/toolContinuation/index.mjs +83 -0
- package/dist/src/services/toolContinuation/index.mjs.map +1 -0
- package/dist/src/services/traceContext/index.cjs.map +1 -1
- package/dist/src/services/traceContext/index.mjs.map +1 -1
- package/dist/src/services/transcriptPages/index.cjs +169 -8
- package/dist/src/services/transcriptPages/index.cjs.map +1 -1
- package/dist/src/services/transcriptPages/index.mjs +165 -9
- package/dist/src/services/transcriptPages/index.mjs.map +1 -1
- package/dist/src/services/verifiedArchive/index.cjs +181 -0
- package/dist/src/services/verifiedArchive/index.cjs.map +1 -0
- package/dist/src/services/verifiedArchive/index.d.mts +38 -0
- package/dist/src/services/verifiedArchive/index.d.mts.map +1 -0
- package/dist/src/services/verifiedArchive/index.mjs +173 -0
- package/dist/src/services/verifiedArchive/index.mjs.map +1 -0
- package/dist/src/services/voiceReloadHandoff/index.cjs +5 -5
- package/dist/src/services/voiceReloadHandoff/index.cjs.map +1 -1
- package/dist/src/services/voiceReloadHandoff/index.d.mts +1 -1
- package/dist/src/services/voiceReloadHandoff/index.mjs +5 -5
- package/dist/src/services/voiceReloadHandoff/index.mjs.map +1 -1
- package/dist/src/services/workspaceLookup/index.cjs +34 -0
- package/dist/src/services/workspaceLookup/index.cjs.map +1 -0
- package/dist/src/services/workspaceLookup/index.d.mts +6 -0
- package/dist/src/services/workspaceLookup/index.d.mts.map +1 -0
- package/dist/src/services/workspaceLookup/index.mjs +34 -0
- package/dist/src/services/workspaceLookup/index.mjs.map +1 -0
- package/dist/src/services/workspaceRegistry/index.cjs +2 -0
- package/dist/src/services/workspaceRegistry/index.cjs.map +1 -1
- package/dist/src/services/workspaceRegistry/index.d.mts +3 -3
- package/dist/src/services/workspaceRegistry/index.mjs +4 -2
- package/dist/src/services/workspaceRegistry/index.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/sync.cjs +18 -6
- package/dist/src/services/workspaceRegistry/sync.cjs.map +1 -1
- package/dist/src/services/workspaceRegistry/sync.d.mts +4 -4
- package/dist/src/services/workspaceRegistry/sync.d.mts.map +1 -1
- package/dist/src/services/workspaceRegistry/sync.mjs +18 -6
- package/dist/src/services/workspaceRegistry/sync.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs +60 -8
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs.map +1 -1
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts +20 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts.map +1 -1
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs +58 -9
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs.map +1 -1
- package/dist/src/services/workspaceSandboxes/index.cjs +33 -0
- package/dist/src/services/workspaceSandboxes/index.cjs.map +1 -0
- package/dist/src/services/workspaceSandboxes/index.d.mts +9 -0
- package/dist/src/services/workspaceSandboxes/index.d.mts.map +1 -0
- package/dist/src/services/workspaceSandboxes/index.mjs +33 -0
- package/dist/src/services/workspaceSandboxes/index.mjs.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs +65 -27
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts +19 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs +65 -30
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs.map +1 -1
- package/dist/src/systems/child/adapters/remoteChildSessionService.cjs +328 -0
- package/dist/src/systems/child/adapters/remoteChildSessionService.cjs.map +1 -0
- package/dist/src/systems/child/adapters/remoteChildSessionService.d.mts +35 -0
- package/dist/src/systems/child/adapters/remoteChildSessionService.d.mts.map +1 -0
- package/dist/src/systems/child/adapters/remoteChildSessionService.mjs +325 -0
- package/dist/src/systems/child/adapters/remoteChildSessionService.mjs.map +1 -0
- package/dist/src/systems/child/services/childSession/index.cjs +60 -32
- package/dist/src/systems/child/services/childSession/index.cjs.map +1 -1
- package/dist/src/systems/child/services/childSession/index.d.mts +5 -0
- package/dist/src/systems/child/services/childSession/index.d.mts.map +1 -1
- package/dist/src/systems/child/services/childSession/index.mjs +60 -32
- package/dist/src/systems/child/services/childSession/index.mjs.map +1 -1
- package/dist/src/systems/child/types/childSession.cjs.map +1 -1
- package/dist/src/systems/child/types/childSession.d.mts +34 -18
- package/dist/src/systems/child/types/childSession.d.mts.map +1 -1
- package/dist/src/systems/child/types/childSession.mjs.map +1 -1
- package/dist/src/systems/child/types/childSessionInput.d.mts +17 -0
- package/dist/src/systems/child/types/childSessionInput.d.mts.map +1 -0
- package/dist/src/systems/child/types/remoteChildSession.d.mts +85 -0
- package/dist/src/systems/child/types/remoteChildSession.d.mts.map +1 -0
- package/dist/src/systems/main/adapters/headlessHost.cjs +614 -82
- package/dist/src/systems/main/adapters/headlessHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.d.mts +60 -12
- package/dist/src/systems/main/adapters/headlessHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.mjs +612 -81
- package/dist/src/systems/main/adapters/headlessHost.mjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs +866 -184
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts +23 -3
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs +845 -167
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs.map +1 -1
- package/dist/src/systems/main/types/headlessHost.d.mts +14 -5
- package/dist/src/systems/main/types/headlessHost.d.mts.map +1 -1
- package/dist/src/testing/pi/testHost.cjs +1 -0
- package/dist/src/testing/pi/testHost.cjs.map +1 -1
- package/dist/src/testing/pi/testHost.mjs +1 -0
- package/dist/src/testing/pi/testHost.mjs.map +1 -1
- package/dist/src/types/kernel.d.mts +3 -3
- package/dist/src/types/remote.d.mts +53 -29
- package/dist/src/types/remote.d.mts.map +1 -1
- package/dist/src/types/server/agentSessionForward.d.mts +14 -0
- package/dist/src/types/server/agentSessionForward.d.mts.map +1 -0
- package/dist/src/types/server/auth.d.mts +104 -0
- package/dist/src/types/server/auth.d.mts.map +1 -0
- package/dist/src/types/server/directHarnessRuntime.d.mts +144 -19
- package/dist/src/types/server/directHarnessRuntime.d.mts.map +1 -1
- package/dist/src/types/server/sessionMcp.d.mts +34 -0
- package/dist/src/types/server/sessionMcp.d.mts.map +1 -0
- package/dist/src/types/telemetry.d.mts +64 -0
- package/dist/src/types/telemetry.d.mts.map +1 -0
- package/dist/src/web/hostSlots.cjs +199 -0
- package/dist/src/web/hostSlots.cjs.map +1 -0
- package/dist/src/web/hostSlots.d.mts +196 -0
- package/dist/src/web/hostSlots.d.mts.map +1 -0
- package/dist/src/web/hostSlots.mjs +195 -0
- package/dist/src/web/hostSlots.mjs.map +1 -0
- package/dist/src/web/models/globalStore.cjs +2 -2
- package/dist/src/web/models/globalStore.cjs.map +1 -1
- package/dist/src/web/models/globalStore.d.mts +2 -2
- package/dist/src/web/models/globalStore.d.mts.map +1 -1
- package/dist/src/web/models/globalStore.mjs +2 -2
- package/dist/src/web/models/globalStore.mjs.map +1 -1
- package/dist/src/web/models/sessionStore.cjs +1 -1
- package/dist/src/web/models/sessionStore.cjs.map +1 -1
- package/dist/src/web/models/sessionStore.mjs +1 -1
- package/dist/src/web/models/sessionStore.mjs.map +1 -1
- package/dist/src/web/schemas/onboarding.cjs +17 -0
- package/dist/src/web/schemas/onboarding.cjs.map +1 -0
- package/dist/src/web/schemas/onboarding.d.mts +6 -0
- package/dist/src/web/schemas/onboarding.d.mts.map +1 -0
- package/dist/src/web/schemas/onboarding.mjs +17 -0
- package/dist/src/web/schemas/onboarding.mjs.map +1 -0
- package/dist/src/web/schemas/template.cjs +20 -8
- package/dist/src/web/schemas/template.cjs.map +1 -1
- package/dist/src/web/schemas/template.d.mts +6 -2
- package/dist/src/web/schemas/template.d.mts.map +1 -1
- package/dist/src/web/schemas/template.mjs +20 -8
- package/dist/src/web/schemas/template.mjs.map +1 -1
- package/dist/src/web/services/apiClient/index.cjs +13 -2
- package/dist/src/web/services/apiClient/index.cjs.map +1 -1
- package/dist/src/web/services/apiClient/index.d.mts +3 -2
- package/dist/src/web/services/apiClient/index.d.mts.map +1 -1
- package/dist/src/web/services/apiClient/index.mjs +13 -2
- package/dist/src/web/services/apiClient/index.mjs.map +1 -1
- package/dist/src/web/services/apiPaths/index.cjs +1 -1
- package/dist/src/web/services/apiPaths/index.cjs.map +1 -1
- package/dist/src/web/services/apiPaths/index.d.mts +1 -1
- package/dist/src/web/services/apiPaths/index.mjs +1 -1
- package/dist/src/web/services/apiPaths/index.mjs.map +1 -1
- package/dist/src/web/services/apiRoutes/index.cjs +4 -4
- package/dist/src/web/services/apiRoutes/index.cjs.map +1 -1
- package/dist/src/web/services/apiRoutes/index.d.mts +2 -2
- package/dist/src/web/services/apiRoutes/index.mjs +4 -4
- package/dist/src/web/services/apiRoutes/index.mjs.map +1 -1
- package/dist/src/web/services/htmlInspect.cjs +277 -0
- package/dist/src/web/services/htmlInspect.cjs.map +1 -0
- package/dist/src/web/services/htmlInspect.d.mts +75 -0
- package/dist/src/web/services/htmlInspect.d.mts.map +1 -0
- package/dist/src/web/services/htmlInspect.mjs +272 -0
- package/dist/src/web/services/htmlInspect.mjs.map +1 -0
- package/dist/src/web/services/hubRevisions/index.cjs +60 -0
- package/dist/src/web/services/hubRevisions/index.cjs.map +1 -0
- package/dist/src/web/services/hubRevisions/index.d.mts +13 -0
- package/dist/src/web/services/hubRevisions/index.d.mts.map +1 -0
- package/dist/src/web/services/hubRevisions/index.mjs +57 -0
- package/dist/src/web/services/hubRevisions/index.mjs.map +1 -0
- package/dist/src/web/services/i18n/index.cjs +94 -0
- package/dist/src/web/services/i18n/index.cjs.map +1 -0
- package/dist/src/web/services/i18n/index.d.mts +18 -0
- package/dist/src/web/services/i18n/index.d.mts.map +1 -0
- package/dist/src/web/services/i18n/index.mjs +87 -0
- package/dist/src/web/services/i18n/index.mjs.map +1 -0
- package/dist/src/web/services/nativeByteCodec/index.cjs +28 -0
- package/dist/src/web/services/nativeByteCodec/index.cjs.map +1 -0
- package/dist/src/web/services/nativeByteCodec/index.d.mts +10 -0
- package/dist/src/web/services/nativeByteCodec/index.d.mts.map +1 -0
- package/dist/src/web/services/nativeByteCodec/index.mjs +26 -0
- package/dist/src/web/services/nativeByteCodec/index.mjs.map +1 -0
- package/dist/src/web/services/nativeByteCodec/type.d.mts +8 -0
- package/dist/src/web/services/nativeByteCodec/type.d.mts.map +1 -0
- package/dist/src/web/services/railSteps/index.cjs +39 -0
- package/dist/src/web/services/railSteps/index.cjs.map +1 -0
- package/dist/src/web/services/railSteps/index.d.mts +17 -0
- package/dist/src/web/services/railSteps/index.d.mts.map +1 -0
- package/dist/src/web/services/railSteps/index.mjs +39 -0
- package/dist/src/web/services/railSteps/index.mjs.map +1 -0
- package/dist/src/web/services/testing/settingsDirectory.cjs +164 -0
- package/dist/src/web/services/testing/settingsDirectory.cjs.map +1 -0
- package/dist/src/web/services/testing/settingsDirectory.d.mts +18 -0
- package/dist/src/web/services/testing/settingsDirectory.d.mts.map +1 -0
- package/dist/src/web/services/testing/settingsDirectory.mjs +164 -0
- package/dist/src/web/services/testing/settingsDirectory.mjs.map +1 -0
- package/dist/src/web/services/testing/templateRail.cjs +84 -6
- package/dist/src/web/services/testing/templateRail.cjs.map +1 -1
- package/dist/src/web/services/testing/templateRail.d.mts +8 -1
- package/dist/src/web/services/testing/templateRail.d.mts.map +1 -1
- package/dist/src/web/services/testing/templateRail.mjs +83 -7
- package/dist/src/web/services/testing/templateRail.mjs.map +1 -1
- package/dist/src/web/types/extensionFile.d.mts +11 -4
- package/dist/src/web/types/extensionFile.d.mts.map +1 -1
- package/dist/src/web/types/nativeTemplate.d.mts +170 -7
- package/dist/src/web/types/nativeTemplate.d.mts.map +1 -1
- package/dist/src/web/types/template.d.mts +133 -17
- package/dist/src/web/types/template.d.mts.map +1 -1
- package/dist/src/web/types/webPlugin.d.mts +535 -38
- package/dist/src/web/types/webPlugin.d.mts.map +1 -1
- package/dist/telemetry.cjs +7 -0
- package/dist/telemetry.d.mts +4 -0
- package/dist/telemetry.mjs +3 -0
- package/dist/transition.d.mts +2 -2
- package/dist/transitionClassifier.cjs +9 -9
- package/dist/transitionClassifier.cjs.map +1 -1
- package/dist/transitionClassifier.d.mts +1 -1
- package/dist/transitionClassifier.mjs +9 -9
- package/dist/transitionClassifier.mjs.map +1 -1
- package/dist/userFeedback.cjs +7 -0
- package/dist/userFeedback.d.mts +2 -0
- package/dist/userFeedback.mjs +1 -0
- package/dist/vendor/upm/_chunks/main.mjs +1 -1
- package/dist/verifiedArchive.cjs +11 -0
- package/dist/verifiedArchive.d.mts +2 -0
- package/dist/verifiedArchive.mjs +1 -0
- package/dist/web.cjs +89 -32
- package/dist/web.d.mts +22 -9
- package/dist/web.mjs +16 -5
- package/dist/webCompositions.cjs +87 -17
- package/dist/webCompositions.cjs.map +1 -1
- package/dist/webCompositions.d.mts +22 -6
- package/dist/webCompositions.d.mts.map +1 -1
- package/dist/webCompositions.mjs +87 -18
- package/dist/webCompositions.mjs.map +1 -1
- package/dist/webTesting.cjs +4 -0
- package/dist/webTesting.d.mts +3 -2
- package/dist/webTesting.mjs +3 -2
- package/dist/workflow.cjs +32 -0
- package/dist/workflow.d.mts +2 -0
- package/dist/workflow.mjs +1 -0
- package/dist/workspaceRegistry.cjs +7 -0
- package/dist/workspaceRegistry.d.mts +3 -0
- package/dist/workspaceRegistry.mjs +3 -0
- package/dist/workspaceSandboxes.cjs +7 -0
- package/dist/workspaceSandboxes.d.mts +3 -0
- package/dist/workspaceSandboxes.mjs +3 -0
- package/locales/vi.json +4 -0
- package/locales/zh-CN.json +4 -0
- package/package.json +164 -51
- package/dist/authorTools.cjs +0 -5
- package/dist/authorTools.d.mts +0 -2
- package/dist/authorTools.mjs +0 -1
- package/dist/cockpitContainer.cjs +0 -4
- package/dist/cockpitContainer.d.mts +0 -2
- package/dist/cockpitContainer.mjs +0 -1
- package/dist/remoteApi.cjs +0 -45
- package/dist/remoteApi.cjs.map +0 -1
- package/dist/remoteApi.d.mts +0 -7
- package/dist/remoteApi.d.mts.map +0 -1
- package/dist/remoteApi.mjs +0 -44
- package/dist/remoteApi.mjs.map +0 -1
- package/dist/remoteRuntime.cjs +0 -475
- package/dist/remoteRuntime.cjs.map +0 -1
- package/dist/remoteRuntime.d.mts +0 -37
- package/dist/remoteRuntime.d.mts.map +0 -1
- package/dist/remoteRuntime.mjs +0 -473
- package/dist/remoteRuntime.mjs.map +0 -1
- package/dist/sandboxHarness.cjs +0 -6
- package/dist/sandboxHarness.d.mts +0 -2
- package/dist/sandboxHarness.mjs +0 -1
- package/dist/sessionMcp.cjs +0 -6
- package/dist/sessionMcp.d.mts +0 -5
- package/dist/sessionMcp.mjs +0 -3
- package/dist/src/constants/authorTools.cjs +0 -10
- package/dist/src/constants/authorTools.cjs.map +0 -1
- package/dist/src/constants/authorTools.d.mts +0 -6
- package/dist/src/constants/authorTools.d.mts.map +0 -1
- package/dist/src/constants/authorTools.mjs +0 -8
- package/dist/src/constants/authorTools.mjs.map +0 -1
- package/dist/src/schemas/cockpitContainer.cjs +0 -31
- package/dist/src/schemas/cockpitContainer.cjs.map +0 -1
- package/dist/src/schemas/cockpitContainer.d.mts +0 -80
- package/dist/src/schemas/cockpitContainer.d.mts.map +0 -1
- package/dist/src/schemas/cockpitContainer.mjs +0 -30
- package/dist/src/schemas/cockpitContainer.mjs.map +0 -1
- package/dist/src/schemas/httpApiContracts.d.mts +0 -78
- package/dist/src/schemas/httpApiContracts.d.mts.map +0 -1
- package/dist/src/schemas/sandboxHarness.cjs +0 -29
- package/dist/src/schemas/sandboxHarness.cjs.map +0 -1
- package/dist/src/schemas/sandboxHarness.d.mts +0 -39
- package/dist/src/schemas/sandboxHarness.d.mts.map +0 -1
- package/dist/src/schemas/sandboxHarness.mjs +0 -26
- package/dist/src/schemas/sandboxHarness.mjs.map +0 -1
- package/dist/src/server/devProxyForward.cjs +0 -141
- package/dist/src/server/devProxyForward.cjs.map +0 -1
- package/dist/src/server/devProxyForward.mjs +0 -139
- package/dist/src/server/devProxyForward.mjs.map +0 -1
- package/dist/src/server/devProxyRoutes.cjs +0 -97
- package/dist/src/server/devProxyRoutes.cjs.map +0 -1
- package/dist/src/server/devProxyRoutes.mjs +0 -97
- package/dist/src/server/devProxyRoutes.mjs.map +0 -1
- package/dist/src/server/devProxySocket.cjs +0 -93
- package/dist/src/server/devProxySocket.cjs.map +0 -1
- package/dist/src/server/devProxySocket.d.mts +0 -25
- package/dist/src/server/devProxySocket.d.mts.map +0 -1
- package/dist/src/server/devProxySocket.mjs +0 -93
- package/dist/src/server/devProxySocket.mjs.map +0 -1
- package/dist/src/server/remoteRoutes.cjs +0 -463
- package/dist/src/server/remoteRoutes.cjs.map +0 -1
- package/dist/src/server/remoteRoutes.mjs +0 -463
- package/dist/src/server/remoteRoutes.mjs.map +0 -1
- package/dist/src/server/sessionMcpHandler.cjs +0 -585
- package/dist/src/server/sessionMcpHandler.cjs.map +0 -1
- package/dist/src/server/sessionMcpHandler.d.mts +0 -50
- package/dist/src/server/sessionMcpHandler.d.mts.map +0 -1
- package/dist/src/server/sessionMcpHandler.mjs +0 -582
- package/dist/src/server/sessionMcpHandler.mjs.map +0 -1
- package/dist/src/server/sessionMcpRoutes.cjs +0 -822
- package/dist/src/server/sessionMcpRoutes.cjs.map +0 -1
- package/dist/src/server/sessionMcpRoutes.mjs +0 -816
- package/dist/src/server/sessionMcpRoutes.mjs.map +0 -1
- package/dist/src/services/devProxyPolicy/index.cjs +0 -168
- package/dist/src/services/devProxyPolicy/index.cjs.map +0 -1
- package/dist/src/services/devProxyPolicy/index.mjs +0 -165
- package/dist/src/services/devProxyPolicy/index.mjs.map +0 -1
- package/dist/src/services/devProxyStore/devProxyRecords.cjs +0 -59
- package/dist/src/services/devProxyStore/devProxyRecords.cjs.map +0 -1
- package/dist/src/services/devProxyStore/devProxyRecords.mjs +0 -56
- package/dist/src/services/devProxyStore/devProxyRecords.mjs.map +0 -1
- package/dist/src/services/devProxyStore/index.cjs +0 -13
- package/dist/src/services/devProxyStore/index.cjs.map +0 -1
- package/dist/src/services/devProxyStore/index.mjs +0 -10
- package/dist/src/services/devProxyStore/index.mjs.map +0 -1
- package/dist/src/services/devProxyStore/sync.cjs +0 -66
- package/dist/src/services/devProxyStore/sync.cjs.map +0 -1
- package/dist/src/services/devProxyStore/sync.mjs +0 -63
- package/dist/src/services/devProxyStore/sync.mjs.map +0 -1
- package/dist/src/services/deviceAuth/index.cjs +0 -146
- package/dist/src/services/deviceAuth/index.cjs.map +0 -1
- package/dist/src/services/deviceAuth/index.d.mts +0 -9
- package/dist/src/services/deviceAuth/index.d.mts.map +0 -1
- package/dist/src/services/deviceAuth/index.mjs +0 -146
- package/dist/src/services/deviceAuth/index.mjs.map +0 -1
- package/dist/src/services/deviceSessions/index.cjs +0 -147
- package/dist/src/services/deviceSessions/index.cjs.map +0 -1
- package/dist/src/services/deviceSessions/index.d.mts +0 -18
- package/dist/src/services/deviceSessions/index.d.mts.map +0 -1
- package/dist/src/services/deviceSessions/index.mjs +0 -141
- package/dist/src/services/deviceSessions/index.mjs.map +0 -1
- package/dist/src/services/deviceTrust/index.cjs +0 -294
- package/dist/src/services/deviceTrust/index.cjs.map +0 -1
- package/dist/src/services/deviceTrust/index.mjs +0 -282
- package/dist/src/services/deviceTrust/index.mjs.map +0 -1
- package/dist/src/services/loopbackAddress/index.cjs +0 -58
- package/dist/src/services/loopbackAddress/index.cjs.map +0 -1
- package/dist/src/services/loopbackAddress/index.mjs +0 -56
- package/dist/src/services/loopbackAddress/index.mjs.map +0 -1
- package/dist/src/services/pairingFlow/index.cjs +0 -145
- package/dist/src/services/pairingFlow/index.cjs.map +0 -1
- package/dist/src/services/pairingFlow/index.d.mts +0 -44
- package/dist/src/services/pairingFlow/index.d.mts.map +0 -1
- package/dist/src/services/pairingFlow/index.mjs +0 -145
- package/dist/src/services/pairingFlow/index.mjs.map +0 -1
- package/dist/src/services/publicFileShares/index.cjs +0 -192
- package/dist/src/services/publicFileShares/index.cjs.map +0 -1
- package/dist/src/services/publicFileShares/index.d.mts +0 -16
- package/dist/src/services/publicFileShares/index.d.mts.map +0 -1
- package/dist/src/services/publicFileShares/index.mjs +0 -188
- package/dist/src/services/publicFileShares/index.mjs.map +0 -1
- package/dist/src/services/remoteAccess/index.cjs +0 -567
- package/dist/src/services/remoteAccess/index.cjs.map +0 -1
- package/dist/src/services/remoteAccess/index.d.mts +0 -122
- package/dist/src/services/remoteAccess/index.d.mts.map +0 -1
- package/dist/src/services/remoteAccess/index.mjs +0 -567
- package/dist/src/services/remoteAccess/index.mjs.map +0 -1
- package/dist/src/services/remoteAccessSettings/index.cjs +0 -151
- package/dist/src/services/remoteAccessSettings/index.cjs.map +0 -1
- package/dist/src/services/remoteAccessSettings/index.mjs +0 -149
- package/dist/src/services/remoteAccessSettings/index.mjs.map +0 -1
- package/dist/src/services/remoteAccessStore/index.cjs +0 -15
- package/dist/src/services/remoteAccessStore/index.cjs.map +0 -1
- package/dist/src/services/remoteAccessStore/index.d.mts +0 -2
- package/dist/src/services/remoteAccessStore/index.mjs +0 -12
- package/dist/src/services/remoteAccessStore/index.mjs.map +0 -1
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs +0 -98
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs.map +0 -1
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs +0 -88
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs.map +0 -1
- package/dist/src/services/remoteAccessStore/sync.cjs +0 -111
- package/dist/src/services/remoteAccessStore/sync.cjs.map +0 -1
- package/dist/src/services/remoteAccessStore/sync.mjs +0 -108
- package/dist/src/services/remoteAccessStore/sync.mjs.map +0 -1
- package/dist/src/services/remoteGuardPolicy/index.cjs +0 -200
- package/dist/src/services/remoteGuardPolicy/index.cjs.map +0 -1
- package/dist/src/services/remoteGuardPolicy/index.d.mts +0 -7
- package/dist/src/services/remoteGuardPolicy/index.d.mts.map +0 -1
- package/dist/src/services/remoteGuardPolicy/index.mjs +0 -196
- package/dist/src/services/remoteGuardPolicy/index.mjs.map +0 -1
- package/dist/src/services/sessionMcpActivity/index.cjs +0 -115
- package/dist/src/services/sessionMcpActivity/index.cjs.map +0 -1
- package/dist/src/services/sessionMcpActivity/index.mjs +0 -111
- package/dist/src/services/sessionMcpActivity/index.mjs.map +0 -1
- package/dist/src/services/sessionMcpAuthorization/index.cjs +0 -473
- package/dist/src/services/sessionMcpAuthorization/index.cjs.map +0 -1
- package/dist/src/services/sessionMcpAuthorization/index.d.mts +0 -125
- package/dist/src/services/sessionMcpAuthorization/index.d.mts.map +0 -1
- package/dist/src/services/sessionMcpAuthorization/index.mjs +0 -469
- package/dist/src/services/sessionMcpAuthorization/index.mjs.map +0 -1
- package/dist/src/services/sessionMcpConversations/index.cjs +0 -217
- package/dist/src/services/sessionMcpConversations/index.cjs.map +0 -1
- package/dist/src/services/sessionMcpConversations/index.mjs +0 -212
- package/dist/src/services/sessionMcpConversations/index.mjs.map +0 -1
- package/dist/src/services/sessionMcpRegistrationStore/index.cjs +0 -86
- package/dist/src/services/sessionMcpRegistrationStore/index.cjs.map +0 -1
- package/dist/src/services/sessionMcpRegistrationStore/index.mjs +0 -83
- package/dist/src/services/sessionMcpRegistrationStore/index.mjs.map +0 -1
- package/dist/src/services/testMode/index.cjs +0 -162
- package/dist/src/services/testMode/index.cjs.map +0 -1
- package/dist/src/services/testMode/index.d.mts +0 -17
- package/dist/src/services/testMode/index.d.mts.map +0 -1
- package/dist/src/services/testMode/index.mjs +0 -155
- package/dist/src/services/testMode/index.mjs.map +0 -1
- package/dist/src/services/tunnelOutput/index.cjs +0 -58
- package/dist/src/services/tunnelOutput/index.cjs.map +0 -1
- package/dist/src/services/tunnelOutput/index.mjs +0 -54
- package/dist/src/services/tunnelOutput/index.mjs.map +0 -1
- package/dist/src/services/tunnelProcess/index.cjs +0 -487
- package/dist/src/services/tunnelProcess/index.cjs.map +0 -1
- package/dist/src/services/tunnelProcess/index.mjs +0 -481
- package/dist/src/services/tunnelProcess/index.mjs.map +0 -1
- package/dist/src/services/webauthn/index.cjs +0 -262
- package/dist/src/services/webauthn/index.cjs.map +0 -1
- package/dist/src/services/webauthn/index.d.mts +0 -39
- package/dist/src/services/webauthn/index.d.mts.map +0 -1
- package/dist/src/services/webauthn/index.mjs +0 -262
- package/dist/src/services/webauthn/index.mjs.map +0 -1
- package/dist/src/services/webauthnPolicy/index.cjs +0 -184
- package/dist/src/services/webauthnPolicy/index.cjs.map +0 -1
- package/dist/src/services/webauthnPolicy/index.d.mts +0 -41
- package/dist/src/services/webauthnPolicy/index.d.mts.map +0 -1
- package/dist/src/services/webauthnPolicy/index.mjs +0 -177
- package/dist/src/services/webauthnPolicy/index.mjs.map +0 -1
- package/dist/testMode.cjs +0 -4
- package/dist/testMode.d.mts +0 -2
- package/dist/testMode.mjs +0 -1
package/dist/headlessServer.cjs
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_codec = require("./src/services/clientMetadata/_lib/codec.cjs");
|
|
3
4
|
require("./src/constants/contextApi.cjs");
|
|
4
5
|
const require_headless = require("./src/schemas/headless.cjs");
|
|
6
|
+
const require_hubChannel = require("./src/schemas/hubChannel.cjs");
|
|
7
|
+
const require_packageApi = require("./src/schemas/packageApi.cjs");
|
|
8
|
+
const require_index = require("./src/services/sessionAccess/index.cjs");
|
|
5
9
|
const require_sessionProtocol = require("./src/schemas/sessionProtocol.cjs");
|
|
6
|
-
const
|
|
10
|
+
const require_protocolContracts = require("./src/schemas/protocolContracts.cjs");
|
|
11
|
+
const require_sessionFiles = require("./src/constants/sessionFiles.cjs");
|
|
7
12
|
const require_contextDetailStore = require("./contextDetailStore.cjs");
|
|
13
|
+
const require_index$1 = require("./src/services/sessionAttachments/index.cjs");
|
|
8
14
|
const require_serverTelemetry = require("./serverTelemetry.cjs");
|
|
9
|
-
const
|
|
15
|
+
const require_harnessErrorMessage = require("./src/server/harnessErrorMessage.cjs");
|
|
10
16
|
require("./packageApi.cjs");
|
|
11
|
-
const require_sessionFiles = require("./src/constants/sessionFiles.cjs");
|
|
12
|
-
const require_index = require("./src/services/sessionAttachments/index.cjs");
|
|
13
|
-
const require_index$1 = require("./src/services/sessionMcpActivity/index.cjs");
|
|
14
|
-
const require_index$2 = require("./src/services/sessionMcpConversations/index.cjs");
|
|
15
|
-
const require_index$3 = require("./src/services/sessionMcpRegistrationStore/index.cjs");
|
|
16
17
|
const require_runtimeContextApi = require("./runtimeContextApi.cjs");
|
|
18
|
+
const require_packageApiServer = require("./packageApiServer.cjs");
|
|
17
19
|
const require_headlessProtocol = require("./headlessProtocol.cjs");
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
20
|
+
let node_crypto = require("node:crypto");
|
|
21
|
+
let node_fs_promises = require("node:fs/promises");
|
|
22
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
|
|
21
23
|
let node_os = require("node:os");
|
|
22
24
|
node_os = require_runtime.__toESM(node_os, 1);
|
|
23
25
|
let node_path = require("node:path");
|
|
24
26
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
25
|
-
let node_http = require("node:http");
|
|
26
27
|
let dist_interop_chordContext_mjs = require("../dist/interop/chordContext.mjs");
|
|
27
|
-
let
|
|
28
|
+
let node_http = require("node:http");
|
|
28
29
|
let node_stream = require("node:stream");
|
|
29
30
|
let node_stream_promises = require("node:stream/promises");
|
|
30
31
|
let ws = require("ws");
|
|
@@ -46,11 +47,37 @@ const PO_PACKAGE_API_PATH_PATTERN = /^\/api(?:\/workspaces\/([^/]+)(?:\/sessions
|
|
|
46
47
|
const HEALTH_ROLE = "hub";
|
|
47
48
|
const PROTOCOL_VERSION = 1;
|
|
48
49
|
const MAX_BODY_BYTES = 8388608;
|
|
50
|
+
/** Body and WebSocket frame cap for package public routes. */
|
|
51
|
+
const PUBLIC_MAX_BYTES = 1048576;
|
|
52
|
+
const PUBLIC_PLUGIN_PATH = /^\/api\/plugins\/([^/]+)(\/.*)?$/u;
|
|
53
|
+
const LOOPBACK_HOST = /^(?:127\.0\.0\.1|localhost|\[::1\])(?::\d+)?$/iu;
|
|
54
|
+
const LOOPBACK_PEERS = /* @__PURE__ */ new Set([
|
|
55
|
+
"127.0.0.1",
|
|
56
|
+
"::1",
|
|
57
|
+
"::ffff:127.0.0.1"
|
|
58
|
+
]);
|
|
59
|
+
const EXTENSION_ORIGIN_PREFIX = "chrome-extension://";
|
|
60
|
+
/**
|
|
61
|
+
* Headers that mark a forwarded request. The remote runtime's forward always attaches the host token
|
|
62
|
+
* and sealed requests carry caller stamps, so a public route answers any of these with 404.
|
|
63
|
+
*/
|
|
64
|
+
const FORWARDED_MARKERS = [
|
|
65
|
+
"x-po-token",
|
|
66
|
+
...require_packageApi.PO_API_CALLER_HEADERS,
|
|
67
|
+
"forwarded",
|
|
68
|
+
"x-forwarded-for",
|
|
69
|
+
"x-forwarded-host",
|
|
70
|
+
"cf-connecting-ip",
|
|
71
|
+
"cf-ray"
|
|
72
|
+
];
|
|
49
73
|
const DIRECTORY_SUGGESTION_LIMIT = 12;
|
|
50
74
|
const DIRECTORY_CHILDREN_LIMIT = 500;
|
|
51
75
|
const HOME_PREFIX = "~";
|
|
52
76
|
const WORKSPACE_NAME_MAX_LENGTH = 80;
|
|
77
|
+
const WORKSPACE_INSTRUCTIONS_MAX_LENGTH = 1e5;
|
|
53
78
|
const WORKSPACE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]*$/u;
|
|
79
|
+
const MAX_REMOTE_PLUGINS = 200;
|
|
80
|
+
const PLUGIN_ID = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u;
|
|
54
81
|
/** Restart closes the session host, which aborts a running turn, so it waits for idle. */
|
|
55
82
|
const RESTART_WHILE_RUNNING_ERROR = "The session is running a turn. Stop it or wait for it to finish before reloading extensions.";
|
|
56
83
|
function sessionView(session) {
|
|
@@ -75,13 +102,19 @@ function sessionView(session) {
|
|
|
75
102
|
...session.profile === void 0 ? {} : { profile: { ...session.profile } },
|
|
76
103
|
...session.parentSessionId === void 0 ? {} : { parentSessionId: session.parentSessionId },
|
|
77
104
|
...session.sessionProvenance === void 0 ? {} : { sessionProvenance: session.sessionProvenance },
|
|
105
|
+
...session.interaction === void 0 ? {} : { interaction: session.interaction },
|
|
78
106
|
...session.groups === void 0 || session.groups.length === 0 ? {} : { groups: [...session.groups] },
|
|
107
|
+
...session.bot === void 0 ? {} : {
|
|
108
|
+
bot: { ...session.bot },
|
|
109
|
+
botRevision: session.botRevision ?? 0
|
|
110
|
+
},
|
|
79
111
|
...session.pendingSetups === void 0 ? {} : { pendingSetups: session.pendingSetups },
|
|
80
|
-
...session.activity === void 0 ? {} : { activity: { ...session.activity } }
|
|
112
|
+
...session.activity === void 0 ? {} : { activity: { ...session.activity } },
|
|
113
|
+
...session.pendingApprovalCount === void 0 ? {} : { pendingApprovalCount: session.pendingApprovalCount }
|
|
81
114
|
};
|
|
82
115
|
}
|
|
83
116
|
/** The dormant counterpart of `sessionView`; same shape, no runtime behind it. */
|
|
84
|
-
function dormantView(record) {
|
|
117
|
+
function dormantView(record, pendingApprovalCount) {
|
|
85
118
|
return {
|
|
86
119
|
id: record.sessionId,
|
|
87
120
|
workspaceId: record.workspaceId,
|
|
@@ -96,9 +129,15 @@ function dormantView(record) {
|
|
|
96
129
|
everPrompted: false,
|
|
97
130
|
awaitingInput: false,
|
|
98
131
|
dormant: true,
|
|
132
|
+
...pendingApprovalCount === void 0 ? {} : { pendingApprovalCount },
|
|
99
133
|
...record.parentSessionId === void 0 ? {} : { parentSessionId: record.parentSessionId },
|
|
100
134
|
...record.sessionProvenance === void 0 ? {} : { sessionProvenance: record.sessionProvenance },
|
|
101
|
-
...record.
|
|
135
|
+
...record.interaction === void 0 ? {} : { interaction: record.interaction },
|
|
136
|
+
...record.groups === void 0 || record.groups.length === 0 ? {} : { groups: [...record.groups] },
|
|
137
|
+
...record.bot === void 0 ? {} : {
|
|
138
|
+
bot: { ...record.bot },
|
|
139
|
+
botRevision: record.botRevision ?? 0
|
|
140
|
+
}
|
|
102
141
|
};
|
|
103
142
|
}
|
|
104
143
|
function json(response, status, value) {
|
|
@@ -109,18 +148,73 @@ function json(response, status, value) {
|
|
|
109
148
|
});
|
|
110
149
|
response.end(body);
|
|
111
150
|
}
|
|
151
|
+
const tokenDigest = (value) => (0, node_crypto.createHash)("sha256").update(value).digest();
|
|
152
|
+
/** Compares fixed-length digests, so neither the length nor the content of the token leaks through timing. */
|
|
153
|
+
function tokenMatches(candidate, token) {
|
|
154
|
+
return typeof candidate === "string" && (0, node_crypto.timingSafeEqual)(tokenDigest(candidate), tokenDigest(token));
|
|
155
|
+
}
|
|
112
156
|
function authorized(request, token) {
|
|
113
157
|
if (token === void 0) return true;
|
|
114
158
|
const authorization = request.headers.authorization;
|
|
115
|
-
if (authorization?.startsWith("Bearer ") && authorization.slice(7)
|
|
159
|
+
if (authorization?.startsWith("Bearer ") && tokenMatches(authorization.slice(7), token)) return true;
|
|
116
160
|
const header = request.headers["x-po-token"];
|
|
117
|
-
if (typeof header === "string" && header
|
|
161
|
+
if (typeof header === "string" && tokenMatches(header, token)) return true;
|
|
118
162
|
try {
|
|
119
|
-
return new URL(request.url ?? "/", "http://po.local").searchParams.get("token")
|
|
163
|
+
return tokenMatches(new URL(request.url ?? "/", "http://po.local").searchParams.get("token"), token);
|
|
120
164
|
} catch {
|
|
121
165
|
return false;
|
|
122
166
|
}
|
|
123
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* The verified person behind a create, read only from the token-holding proxy that stamps callers.
|
|
170
|
+
* Anything else, a browser included, starts an unattributed session.
|
|
171
|
+
*/
|
|
172
|
+
function sessionStarter(request, token) {
|
|
173
|
+
if (token === void 0 || !authorized(request, token)) return void 0;
|
|
174
|
+
const headers = new Headers();
|
|
175
|
+
for (const name of require_packageApi.PO_API_CALLER_HEADERS) {
|
|
176
|
+
const value = request.headers[name];
|
|
177
|
+
if (typeof value === "string") headers.set(name, value);
|
|
178
|
+
}
|
|
179
|
+
return require_packageApi.poSessionStarterFrom(require_packageApi.poApiCallerFrom(headers));
|
|
180
|
+
}
|
|
181
|
+
/** Why a public route refuses a request before authentication: 404 when forwarded, 403 when not local. */
|
|
182
|
+
function publicRefusal(request) {
|
|
183
|
+
if (FORWARDED_MARKERS.some((name) => request.headers[name] !== void 0)) return 404;
|
|
184
|
+
const origin = request.headers.origin;
|
|
185
|
+
if (!LOOPBACK_HOST.test(request.headers.host ?? "") || !LOOPBACK_PEERS.has(request.socket.remoteAddress ?? "") || origin !== void 0 && !origin.startsWith(EXTENSION_ORIGIN_PREFIX)) return 403;
|
|
186
|
+
}
|
|
187
|
+
/** Headers a public route sees: never Host, and never the host token or caller stamps. */
|
|
188
|
+
function publicHeaders(request, token) {
|
|
189
|
+
const headers = new Headers();
|
|
190
|
+
for (const [name, value] of Object.entries(request.headers)) {
|
|
191
|
+
if (value === void 0 || name === "host") continue;
|
|
192
|
+
const joined = Array.isArray(value) ? value.join(", ") : value;
|
|
193
|
+
if (name === "authorization" && token !== void 0 && joined.startsWith("Bearer ") && tokenMatches(joined.slice(7), token)) continue;
|
|
194
|
+
headers.set(name, joined);
|
|
195
|
+
}
|
|
196
|
+
headers.set(require_packageApi.PO_API_PEER_ADDRESS_HEADER, request.socket.remoteAddress ?? "");
|
|
197
|
+
return headers;
|
|
198
|
+
}
|
|
199
|
+
/** Adapts an accepted `ws` socket. Its default binary type delivers every frame as one Buffer. */
|
|
200
|
+
function apiSocket(client) {
|
|
201
|
+
return {
|
|
202
|
+
get isOpen() {
|
|
203
|
+
return client.readyState === client.OPEN;
|
|
204
|
+
},
|
|
205
|
+
send: (data) => client.send(data),
|
|
206
|
+
close: (code, reason) => client.close(code, reason),
|
|
207
|
+
onMessage: (listener) => {
|
|
208
|
+
client.on("message", (data, isBinary) => {
|
|
209
|
+
const bytes = data;
|
|
210
|
+
listener(isBinary ? bytes : bytes.toString("utf8"));
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
onClose: (listener) => {
|
|
214
|
+
client.on("close", (code, reason) => listener(code, reason.toString("utf8")));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
}
|
|
124
218
|
function requestPath(request) {
|
|
125
219
|
return new URL(request.url ?? "/", "http://po.local");
|
|
126
220
|
}
|
|
@@ -140,91 +234,10 @@ function parseTranscriptRequest(url) {
|
|
|
140
234
|
if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > 100) throw new Error("Invalid transcript page limit");
|
|
141
235
|
request.limit = parsed;
|
|
142
236
|
}
|
|
237
|
+
const entry = url.searchParams.get("entry");
|
|
238
|
+
if (entry !== null) request.entryId = entry;
|
|
143
239
|
return request;
|
|
144
240
|
}
|
|
145
|
-
async function sessionFile(session, requestedPath, range, expectedVersion) {
|
|
146
|
-
if (!requestedPath || requestedPath.includes("\0")) return Response.json({ error: "Invalid session file path." }, { status: 400 });
|
|
147
|
-
let root;
|
|
148
|
-
let filePath;
|
|
149
|
-
try {
|
|
150
|
-
root = await node_fs.default.promises.realpath(session.cwd);
|
|
151
|
-
filePath = await node_fs.default.promises.realpath(node_path.default.resolve(root, requestedPath));
|
|
152
|
-
} catch {
|
|
153
|
-
return Response.json({ error: "Session file not found." }, { status: 404 });
|
|
154
|
-
}
|
|
155
|
-
const contained = node_path.default.relative(root, filePath);
|
|
156
|
-
if (contained === ".." || contained.startsWith(`..${node_path.default.sep}`) || node_path.default.isAbsolute(contained)) return Response.json({ error: "Session file is outside the working directory." }, { status: 403 });
|
|
157
|
-
let handle;
|
|
158
|
-
try {
|
|
159
|
-
handle = await node_fs.default.promises.open(filePath, "r");
|
|
160
|
-
} catch {
|
|
161
|
-
return Response.json({ error: "Session file not found." }, { status: 404 });
|
|
162
|
-
}
|
|
163
|
-
try {
|
|
164
|
-
const stat = await handle.stat();
|
|
165
|
-
if (!stat.isFile()) return Response.json({ error: "Session file not found." }, { status: 404 });
|
|
166
|
-
if (stat.size > 26214400) return Response.json({ error: "Session file is too large." }, { status: 413 });
|
|
167
|
-
const version = `"${stat.dev}-${stat.ino}-${stat.size}-${stat.mtimeMs}-${stat.ctimeMs}"`;
|
|
168
|
-
const headers = new Headers({
|
|
169
|
-
"content-type": require_sessionFiles.SESSION_FILE_CONTENT_TYPES[node_path.default.extname(filePath).toLowerCase()] ?? "application/octet-stream",
|
|
170
|
-
"cache-control": "no-store",
|
|
171
|
-
"x-content-type-options": "nosniff",
|
|
172
|
-
"accept-ranges": "bytes",
|
|
173
|
-
etag: version
|
|
174
|
-
});
|
|
175
|
-
if (expectedVersion !== void 0 && expectedVersion !== version) return new Response(null, {
|
|
176
|
-
status: 412,
|
|
177
|
-
headers
|
|
178
|
-
});
|
|
179
|
-
let start = 0;
|
|
180
|
-
let end = stat.size - 1;
|
|
181
|
-
if (range !== void 0) {
|
|
182
|
-
const match = /^bytes=(\d*)-(\d*)$/u.exec(range);
|
|
183
|
-
if (!match || !match[1] && !match[2] || [match[1], match[2]].some((value) => value !== "" && !Number.isSafeInteger(Number(value))) || stat.size === 0) {
|
|
184
|
-
headers.set("content-range", `bytes */${stat.size}`);
|
|
185
|
-
return new Response(null, {
|
|
186
|
-
status: 416,
|
|
187
|
-
headers
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
if (!match[1]) start = Math.max(0, stat.size - Number(match[2]));
|
|
191
|
-
else {
|
|
192
|
-
start = Number(match[1]);
|
|
193
|
-
if (match[2]) end = Math.min(Number(match[2]), end);
|
|
194
|
-
}
|
|
195
|
-
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start < 0 || start > end) {
|
|
196
|
-
headers.set("content-range", `bytes */${stat.size}`);
|
|
197
|
-
return new Response(null, {
|
|
198
|
-
status: 416,
|
|
199
|
-
headers
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
headers.set("content-range", `bytes ${start}-${end}/${stat.size}`);
|
|
203
|
-
}
|
|
204
|
-
const bytes = new Uint8Array(Math.max(0, end - start + 1));
|
|
205
|
-
let read = 0;
|
|
206
|
-
while (read < bytes.length) {
|
|
207
|
-
const part = await handle.read(bytes, read, bytes.length - read, start + read);
|
|
208
|
-
if (part.bytesRead === 0) return new Response(null, {
|
|
209
|
-
status: 412,
|
|
210
|
-
headers
|
|
211
|
-
});
|
|
212
|
-
read += part.bytesRead;
|
|
213
|
-
}
|
|
214
|
-
const after = await handle.stat();
|
|
215
|
-
if (after.size !== stat.size || after.mtimeMs !== stat.mtimeMs || after.ctimeMs !== stat.ctimeMs) return new Response(null, {
|
|
216
|
-
status: 412,
|
|
217
|
-
headers
|
|
218
|
-
});
|
|
219
|
-
headers.set("content-length", String(bytes.length));
|
|
220
|
-
return new Response(bytes, {
|
|
221
|
-
status: range === void 0 ? 200 : 206,
|
|
222
|
-
headers
|
|
223
|
-
});
|
|
224
|
-
} finally {
|
|
225
|
-
await handle.close();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
241
|
/** Expands a leading `~` the way a shell would, so typed paths match what the user sees in a terminal. */
|
|
229
242
|
function expandHome(value) {
|
|
230
243
|
if (value === HOME_PREFIX) return node_os.default.homedir();
|
|
@@ -237,15 +250,22 @@ function expandHome(value) {
|
|
|
237
250
|
function parseWorkspaceAdmission(body) {
|
|
238
251
|
if (typeof body !== "object" || body === null) return { error: "A workspace root or name is required." };
|
|
239
252
|
const record = body;
|
|
253
|
+
if ("kind" in record) return { error: "Workspace kind is managed by Po." };
|
|
240
254
|
if (record.root !== void 0 && typeof record.root !== "string") return { error: "The workspace root must be text." };
|
|
241
255
|
if (record.name !== void 0 && typeof record.name !== "string") return { error: "The workspace name must be text." };
|
|
256
|
+
if (record.declaration !== void 0 && typeof record.declaration !== "string") return { error: "The workspace declaration must be text." };
|
|
257
|
+
if (record.instructions !== void 0 && (typeof record.instructions !== "string" || record.instructions.length > WORKSPACE_INSTRUCTIONS_MAX_LENGTH)) return { error: `Workspace instructions must be text up to ${String(WORKSPACE_INSTRUCTIONS_MAX_LENGTH)} characters.` };
|
|
258
|
+
const declaration = typeof record.declaration === "string" ? record.declaration.trim() : void 0;
|
|
242
259
|
const root = typeof record.root === "string" && record.root.trim() !== "" ? expandHome(record.root.trim()) : void 0;
|
|
243
260
|
const name = typeof record.name === "string" && record.name.trim() !== "" ? record.name.trim() : void 0;
|
|
244
261
|
if (root === void 0 && name === void 0) return { error: "A workspace root or name is required." };
|
|
245
|
-
if (
|
|
262
|
+
if (root !== void 0 && !node_path.default.isAbsolute(root)) return { error: `Use a full folder path, such as ~/${root}, or pick a suggestion.` };
|
|
263
|
+
if ([name, declaration].some((value) => value !== void 0 && (value.length > WORKSPACE_NAME_MAX_LENGTH || !WORKSPACE_NAME_PATTERN.test(value) || value.includes("..")))) return { error: `Workspace names use letters, numbers, spaces, dots, dashes, or underscores (up to ${String(WORKSPACE_NAME_MAX_LENGTH)} characters).` };
|
|
246
264
|
return {
|
|
247
265
|
...root === void 0 ? {} : { root },
|
|
248
|
-
...name === void 0 ? {} : { name }
|
|
266
|
+
...name === void 0 ? {} : { name },
|
|
267
|
+
...declaration === void 0 ? {} : { declaration },
|
|
268
|
+
...typeof record.instructions === "string" ? { instructions: record.instructions } : {}
|
|
249
269
|
};
|
|
250
270
|
}
|
|
251
271
|
async function directorySuggestions(query, sessions) {
|
|
@@ -260,7 +280,7 @@ async function directorySuggestions(query, sessions) {
|
|
|
260
280
|
const parent = drilling ? candidate : node_path.default.dirname(candidate);
|
|
261
281
|
const partial = drilling ? "" : node_path.default.basename(candidate).toLowerCase();
|
|
262
282
|
try {
|
|
263
|
-
const entries = await
|
|
283
|
+
const entries = await node_fs_promises.default.readdir(parent, { withFileTypes: true });
|
|
264
284
|
completed.push(...entries.filter((entry) => entry.isDirectory() && entry.name.toLowerCase().includes(partial)).map((entry) => node_path.default.join(parent, entry.name)));
|
|
265
285
|
} catch {}
|
|
266
286
|
}
|
|
@@ -276,7 +296,7 @@ async function directoryChildren(requested) {
|
|
|
276
296
|
const resolved = node_path.default.resolve(directory);
|
|
277
297
|
let entries;
|
|
278
298
|
try {
|
|
279
|
-
entries = await
|
|
299
|
+
entries = await node_fs_promises.default.readdir(resolved, { withFileTypes: true });
|
|
280
300
|
} catch {
|
|
281
301
|
return;
|
|
282
302
|
}
|
|
@@ -306,14 +326,14 @@ async function poFolders() {
|
|
|
306
326
|
if (visited++ >= PO_FOLDER_SCAN_VISIT_LIMIT || found.length >= PO_FOLDER_LIMIT) return found;
|
|
307
327
|
let entries;
|
|
308
328
|
try {
|
|
309
|
-
entries = await
|
|
329
|
+
entries = await node_fs_promises.default.readdir(parent, { withFileTypes: true });
|
|
310
330
|
} catch {
|
|
311
331
|
continue;
|
|
312
332
|
}
|
|
313
333
|
for (const entry of entries) {
|
|
314
334
|
if (!entry.isDirectory() || entry.name.startsWith(".") || PO_FOLDER_SKIP.has(entry.name)) continue;
|
|
315
335
|
const child = node_path.default.join(parent, entry.name);
|
|
316
|
-
if (
|
|
336
|
+
if (await node_fs_promises.default.access(node_path.default.join(child, ".po")).then(() => true, () => false)) found.push(child);
|
|
317
337
|
else next.push(child);
|
|
318
338
|
}
|
|
319
339
|
}
|
|
@@ -326,13 +346,13 @@ var RequestBodyTooLargeError = class extends Error {
|
|
|
326
346
|
super("Request body is too large.");
|
|
327
347
|
}
|
|
328
348
|
};
|
|
329
|
-
async function readBody(request) {
|
|
349
|
+
async function readBody(request, limit = MAX_BODY_BYTES) {
|
|
330
350
|
const chunks = [];
|
|
331
351
|
let size = 0;
|
|
332
352
|
for await (const chunk of request) {
|
|
333
353
|
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
334
354
|
size += buffer.byteLength;
|
|
335
|
-
if (size >
|
|
355
|
+
if (size > limit) throw new RequestBodyTooLargeError();
|
|
336
356
|
chunks.push(buffer);
|
|
337
357
|
}
|
|
338
358
|
return Buffer.concat(chunks);
|
|
@@ -354,13 +374,25 @@ function webRequest(request, url, signal) {
|
|
|
354
374
|
}
|
|
355
375
|
});
|
|
356
376
|
}
|
|
357
|
-
async function writeResponse(response, result) {
|
|
377
|
+
async function writeResponse(response, result, onChunk) {
|
|
378
|
+
if (response.destroyed || response.writableEnded) {
|
|
379
|
+
await result.body?.cancel();
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
358
382
|
response.writeHead(result.status, Object.fromEntries(result.headers.entries()));
|
|
359
383
|
if (result.body === null) {
|
|
360
384
|
response.end();
|
|
361
385
|
return;
|
|
362
386
|
}
|
|
363
|
-
|
|
387
|
+
const body = node_stream.Readable.fromWeb(result.body);
|
|
388
|
+
if (onChunk === void 0) {
|
|
389
|
+
await (0, node_stream_promises.pipeline)(body, response);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
await (0, node_stream_promises.pipeline)(body, new node_stream.Transform({ transform(chunk, _encoding, callback) {
|
|
393
|
+
onChunk(chunk.byteLength);
|
|
394
|
+
callback(null, chunk);
|
|
395
|
+
} }), response);
|
|
364
396
|
}
|
|
365
397
|
/**
|
|
366
398
|
* Client-neutral HTTP and WebSocket boundary for the process-local headless hub.
|
|
@@ -369,6 +401,39 @@ async function writeResponse(response, result) {
|
|
|
369
401
|
*/
|
|
370
402
|
async function serveHeadlessServer(options) {
|
|
371
403
|
const clients = /* @__PURE__ */ new Set();
|
|
404
|
+
const sessionRecord = (sessionId) => options.headlessHub.session(sessionId) ?? options.dormantSessions?.().find((record) => record.sessionId === sessionId);
|
|
405
|
+
/** Children always inherit their parent's owner and share. Cycles and missing ancestry grant nothing. */
|
|
406
|
+
const sharingSession = (sessionId) => {
|
|
407
|
+
for (let depth = 0; depth <= 8; depth++) {
|
|
408
|
+
const record = sessionRecord(sessionId);
|
|
409
|
+
if (!record) return void 0;
|
|
410
|
+
if (record.parentSessionId === void 0) return sessionId;
|
|
411
|
+
sessionId = record.parentSessionId;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const starterOf = (sessionId) => {
|
|
415
|
+
const source = sharingSession(sessionId);
|
|
416
|
+
return source === void 0 ? null : sessionRecord(source)?.startedBy;
|
|
417
|
+
};
|
|
418
|
+
const shareOf = (sessionId) => {
|
|
419
|
+
const source = sharingSession(sessionId);
|
|
420
|
+
return source === void 0 ? void 0 : options.sessionShares?.get(source);
|
|
421
|
+
};
|
|
422
|
+
const sessionAccess = require_index.createSessionAccess({
|
|
423
|
+
teamMode: () => options.teamMode?.() === true,
|
|
424
|
+
member: (person) => options.teamMember?.(person) !== false,
|
|
425
|
+
starter: starterOf,
|
|
426
|
+
share: shareOf
|
|
427
|
+
});
|
|
428
|
+
/** Who the request acts as. Only a token holder can stamp a caller, so anyone else is the computer itself. */
|
|
429
|
+
const actorOf = (request) => {
|
|
430
|
+
const headers = new Headers();
|
|
431
|
+
if (options.token !== void 0 && authorized(request, options.token)) for (const name of require_packageApi.PO_API_CALLER_HEADERS) {
|
|
432
|
+
const value = request.headers[name];
|
|
433
|
+
if (typeof value === "string") headers.set(name, value);
|
|
434
|
+
}
|
|
435
|
+
return sessionAccess.actorFrom(headers);
|
|
436
|
+
};
|
|
372
437
|
const desktopAuthorized = (request) => {
|
|
373
438
|
const proof = request.headers["x-po-desktop"];
|
|
374
439
|
return typeof proof === "string" && options.headlessHub.computerUse?.authorize?.(new Headers({ "x-po-desktop": proof })) === true;
|
|
@@ -380,18 +445,6 @@ async function serveHeadlessServer(options) {
|
|
|
380
445
|
for (const [name, value] of Object.entries(request.headers)) if (value !== void 0) headers.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
381
446
|
return options.headlessHub.computerUse?.authorizeSession?.(sessionId, headers) === true;
|
|
382
447
|
};
|
|
383
|
-
const activationAuthorized = (request) => {
|
|
384
|
-
if (!authorized(request, options.token)) return false;
|
|
385
|
-
const headers = new Headers();
|
|
386
|
-
for (const [name, value] of Object.entries(request.headers)) if (value !== void 0) headers.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
387
|
-
return options.headlessHub.computerUse?.authorizeActivation?.(headers) === true;
|
|
388
|
-
};
|
|
389
|
-
const pendingAuthorized = (sessionId, request) => {
|
|
390
|
-
if (!authorized(request, options.token)) return false;
|
|
391
|
-
const headers = new Headers();
|
|
392
|
-
for (const [name, value] of Object.entries(request.headers)) if (value !== void 0) headers.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
393
|
-
return options.headlessHub.computerUse?.authorizePending?.(sessionId, headers) === true;
|
|
394
|
-
};
|
|
395
448
|
const recordingAuthorized = (sessionId, request) => {
|
|
396
449
|
if (!authorized(request, options.token)) return false;
|
|
397
450
|
const headers = new Headers();
|
|
@@ -399,34 +452,133 @@ async function serveHeadlessServer(options) {
|
|
|
399
452
|
return options.headlessHub.computerUse?.authorizeRecording?.(sessionId, headers) === true;
|
|
400
453
|
};
|
|
401
454
|
let closed = false;
|
|
402
|
-
const webSockets = new ws.WebSocketServer({
|
|
455
|
+
const webSockets = new ws.WebSocketServer({
|
|
456
|
+
noServer: true,
|
|
457
|
+
...options.webSocketMaxPayload === void 0 ? {} : { maxPayload: options.webSocketMaxPayload }
|
|
458
|
+
});
|
|
459
|
+
const publicRoutes = options.publicRoutes !== false;
|
|
460
|
+
const publicSockets = new ws.WebSocketServer({
|
|
461
|
+
noServer: true,
|
|
462
|
+
maxPayload: PUBLIC_MAX_BYTES
|
|
463
|
+
});
|
|
464
|
+
/** A declared public route of a global API; every other plugin path keeps the host token. */
|
|
465
|
+
const publicRouteFor = (url) => {
|
|
466
|
+
if (!publicRoutes) return void 0;
|
|
467
|
+
const match = PUBLIC_PLUGIN_PATH.exec(url.pathname);
|
|
468
|
+
if (match === null) return void 0;
|
|
469
|
+
let basePath;
|
|
470
|
+
try {
|
|
471
|
+
basePath = decodeURIComponent(match[1]);
|
|
472
|
+
} catch {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const api = options.headlessHub.publicApi(basePath);
|
|
476
|
+
const routePath = match[2] ?? "/";
|
|
477
|
+
const declared = api?.routes.paths.some((prefix) => routePath === prefix || routePath.startsWith(prefix.endsWith("/") ? prefix : `${prefix}/`));
|
|
478
|
+
return api === void 0 || declared !== true ? void 0 : {
|
|
479
|
+
path: routePath,
|
|
480
|
+
...api
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
/** The request a public route sees, without the host's own `token` query parameter. */
|
|
484
|
+
const publicRequest = (request, url, route, body) => {
|
|
485
|
+
const target = new URL(`http://po.local${route.path}${url.search}`);
|
|
486
|
+
target.searchParams.delete("token");
|
|
487
|
+
return new Request(target, {
|
|
488
|
+
method: request.method,
|
|
489
|
+
headers: publicHeaders(request, options.token),
|
|
490
|
+
...body === void 0 ? {} : { body: Buffer.from(body) }
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
const servePublicRoute = async (request, response, url, route) => {
|
|
494
|
+
const refusal = publicRefusal(request);
|
|
495
|
+
if (refusal !== void 0) {
|
|
496
|
+
json(response, refusal, { error: refusal === 404 ? "Not found." : "Forbidden." });
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
let body;
|
|
500
|
+
if (request.method !== "GET" && request.method !== "HEAD") try {
|
|
501
|
+
body = await readBody(request, PUBLIC_MAX_BYTES);
|
|
502
|
+
} catch (error) {
|
|
503
|
+
if (!(error instanceof RequestBodyTooLargeError)) throw error;
|
|
504
|
+
json(response, 413, { error: error.message });
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const forwarded = publicRequest(request, url, route, body);
|
|
508
|
+
if (!await route.routes.authenticate(forwarded.clone())) {
|
|
509
|
+
json(response, 401, { error: "Unauthorized." });
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
await writeResponse(response, await route.handler.fetch(forwarded));
|
|
513
|
+
};
|
|
514
|
+
const upgradePublicRoute = async (request, socket, head, route) => {
|
|
515
|
+
const refuse = (status) => {
|
|
516
|
+
socket.write(`HTTP/1.1 ${status}\r\n\r\n`);
|
|
517
|
+
socket.destroy();
|
|
518
|
+
};
|
|
519
|
+
const refusal = publicRefusal(request);
|
|
520
|
+
const upgrade = route.handler.upgrade?.bind(route.handler);
|
|
521
|
+
if (refusal === 404 || upgrade === void 0) return refuse("404 Not Found");
|
|
522
|
+
if (refusal === 403) return refuse("403 Forbidden");
|
|
523
|
+
const forwarded = publicRequest(request, requestPath(request), route);
|
|
524
|
+
if (!await route.routes.authenticate(forwarded.clone())) return refuse("401 Unauthorized");
|
|
525
|
+
if (closed || socket.destroyed) {
|
|
526
|
+
socket.destroy();
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
publicSockets.handleUpgrade(request, socket, head, (client) => {
|
|
530
|
+
const entry = { socket: client };
|
|
531
|
+
clients.add(entry);
|
|
532
|
+
client.on("close", () => clients.delete(entry));
|
|
533
|
+
client.on("error", (error) => options.onNotice?.(`Public socket failed: ${error.message}`));
|
|
534
|
+
try {
|
|
535
|
+
upgrade(forwarded, apiSocket(client));
|
|
536
|
+
} catch (error) {
|
|
537
|
+
options.onNotice?.(`Public socket handler failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
538
|
+
client.close(1011);
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
};
|
|
542
|
+
/** Sessions a Remove is tearing down: never listed as dormant, so nothing can revive them mid-removal. */
|
|
543
|
+
const removing = /* @__PURE__ */ new Set();
|
|
403
544
|
/**
|
|
404
545
|
* A recorded session is dormant exactly while the hub has no session for its
|
|
405
546
|
* id, so reviving one needs no bookkeeping beyond the hub itself.
|
|
406
547
|
*/
|
|
407
|
-
const dormant = () => (options.dormantSessions?.() ?? []).filter((record) => options.headlessHub.session(record.sessionId) === void 0);
|
|
548
|
+
const dormant = () => (options.dormantSessions?.() ?? []).filter((record) => options.headlessHub.session(record.sessionId) === void 0 && !removing.has(record.sessionId));
|
|
408
549
|
const protocol = require_headlessProtocol.createHeadlessProtocol({
|
|
409
550
|
hub: options.headlessHub,
|
|
410
551
|
telemetry: options.telemetry,
|
|
411
552
|
onNotice: options.onNotice,
|
|
412
553
|
dormantSessions: dormant
|
|
413
554
|
});
|
|
414
|
-
const
|
|
415
|
-
const sessionMcp =
|
|
555
|
+
const sessionMcpServer = options.sessionMcp;
|
|
556
|
+
const sessionMcp = await sessionMcpServer?.start({
|
|
416
557
|
headlessHub: options.headlessHub,
|
|
417
|
-
publicOrigin: options.sessionMcpPublicOrigin ?? (() => void 0),
|
|
418
|
-
publicOriginRevision: options.sessionMcpPublicOriginRevision,
|
|
419
558
|
onNotice: options.onNotice,
|
|
420
|
-
isSessionPersisted: options.isSessionPersisted
|
|
421
|
-
activityStore: require_index$1.createSessionMcpActivityStore(sessionMcpStateDir),
|
|
422
|
-
conversationStore: require_index$2.createSessionMcpConversationStore(sessionMcpStateDir),
|
|
423
|
-
registrationStore: require_index$3.createSessionMcpRegistrationStore({
|
|
424
|
-
stateDir: sessionMcpStateDir,
|
|
425
|
-
onNotice: options.onNotice
|
|
426
|
-
})
|
|
559
|
+
isSessionPersisted: options.isSessionPersisted
|
|
427
560
|
});
|
|
428
|
-
|
|
561
|
+
const removeSession = async (sessionId, cleanup) => {
|
|
562
|
+
if (cleanup) removing.add(sessionId);
|
|
563
|
+
let removed = false;
|
|
564
|
+
try {
|
|
565
|
+
await sessionMcp?.closeSessionBinding(sessionId);
|
|
566
|
+
await options.headlessHub.closeSession(sessionId, cleanup ? { keepDormant: true } : void 0);
|
|
567
|
+
if (cleanup) {
|
|
568
|
+
await cleanup();
|
|
569
|
+
removed = true;
|
|
570
|
+
options.headlessHub.notifySessionRemoved(sessionId);
|
|
571
|
+
options.headlessHub.notifySessionDeleted(sessionId);
|
|
572
|
+
}
|
|
573
|
+
} finally {
|
|
574
|
+
if (cleanup && removing.delete(sessionId) && !removed) options.headlessHub.notifyDormantChanged(sessionId);
|
|
575
|
+
}
|
|
576
|
+
};
|
|
577
|
+
/** Lifecycle changes keyed by session id, settled once the change succeeds or fails. */
|
|
429
578
|
const restarting = /* @__PURE__ */ new Map();
|
|
579
|
+
const movingWorkspaces = /* @__PURE__ */ new Map();
|
|
580
|
+
const reviving = /* @__PURE__ */ new Map();
|
|
581
|
+
const changingWorkspaces = /* @__PURE__ */ new Set();
|
|
430
582
|
/**
|
|
431
583
|
* Stores already-normalized groups where a session keeps them: the journal of a live
|
|
432
584
|
* session, which announces the change itself, or the record of a dormant one.
|
|
@@ -443,13 +595,28 @@ async function serveHeadlessServer(options) {
|
|
|
443
595
|
options.headlessHub.notifyDormantChanged(sessionId);
|
|
444
596
|
return true;
|
|
445
597
|
};
|
|
598
|
+
/**
|
|
599
|
+
* The person's Create bot request: `bot` is accepted only as the literal `true`, from the authenticated create
|
|
600
|
+
* routes. The marker is written here, never forwarded to a session service, so tool, spawn and fork paths cannot set it.
|
|
601
|
+
*/
|
|
602
|
+
const markBot = async (sessionId) => {
|
|
603
|
+
const runtime = options.headlessHub.runtime(sessionId);
|
|
604
|
+
const session = options.headlessHub.session(sessionId);
|
|
605
|
+
const name = session?.profile?.displayName ?? session?.profile?.name;
|
|
606
|
+
if (name && name !== session?.name) await runtime?.setName(name);
|
|
607
|
+
if ((await runtime?.setBot({
|
|
608
|
+
bot: {},
|
|
609
|
+
expectedRevision: 0
|
|
610
|
+
}))?.ok !== true) throw new Error("The new session could not be marked as a bot.");
|
|
611
|
+
};
|
|
446
612
|
const server = (0, node_http.createServer)((request, response) => {
|
|
447
613
|
handleRequest(request, response).catch((error) => {
|
|
614
|
+
if (response.destroyed && response.errored === null && error instanceof Error && "code" in error && error.code === "ERR_STREAM_PREMATURE_CLOSE") return;
|
|
615
|
+
options.onNotice?.(`Headless request failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
448
616
|
if (response.headersSent) {
|
|
449
617
|
response.destroy();
|
|
450
618
|
return;
|
|
451
619
|
}
|
|
452
|
-
options.onNotice?.(`Headless request failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
453
620
|
if (require_headless.isPoSessionSetupError(error)) json(response, 422, { error: error.message });
|
|
454
621
|
else json(response, 500, { error: "Internal server error." });
|
|
455
622
|
});
|
|
@@ -465,12 +632,24 @@ async function serveHeadlessServer(options) {
|
|
|
465
632
|
});
|
|
466
633
|
return;
|
|
467
634
|
}
|
|
635
|
+
if ((url.pathname.startsWith("/api/network/") || /^\/api\/networks\/[^/]+\/network\//.test(url.pathname)) && options.requestNetwork) {
|
|
636
|
+
const result = await options.requestNetwork(webRequest(request, url));
|
|
637
|
+
if (result) {
|
|
638
|
+
await writeResponse(response, result);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
const publicRoute = publicRouteFor(url);
|
|
643
|
+
if (publicRoute !== void 0) {
|
|
644
|
+
await servePublicRoute(request, response, url, publicRoute);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
468
647
|
const scopedSession = /^\/api\/workspaces\/[^/]+\/sessions\/([^/]+)(?:\/|$)/u.exec(url.pathname)?.[1];
|
|
469
|
-
if (scopedSession && options.headlessHub.computerUse?.ownsSession?.(decodeURIComponent(scopedSession)) && !computerUseAuthorized(decodeURIComponent(scopedSession), request) && !(request.method === "GET" && url.pathname.endsWith("/plugins/computer-use/artifact") && recordingAuthorized(decodeURIComponent(scopedSession), request))
|
|
648
|
+
if (scopedSession && options.headlessHub.computerUse?.ownsSession?.(decodeURIComponent(scopedSession)) && !computerUseAuthorized(decodeURIComponent(scopedSession), request) && !(request.method === "GET" && url.pathname.endsWith("/plugins/computer-use/artifact") && recordingAuthorized(decodeURIComponent(scopedSession), request))) {
|
|
470
649
|
json(response, 404, { error: "This session belongs to its Desktop instance." });
|
|
471
650
|
return;
|
|
472
651
|
}
|
|
473
|
-
if (
|
|
652
|
+
if (sessionMcpServer && sessionMcp && publicRoutes && sessionMcpServer.isPublicRoute(request.method ?? "GET", url.pathname)) {
|
|
474
653
|
const sessionMcpAbort = new AbortController();
|
|
475
654
|
const abortSessionMcp = () => {
|
|
476
655
|
if (!response.writableEnded) sessionMcpAbort.abort();
|
|
@@ -487,13 +666,115 @@ async function serveHeadlessServer(options) {
|
|
|
487
666
|
}
|
|
488
667
|
response.off("close", abortSessionMcp);
|
|
489
668
|
}
|
|
669
|
+
const identityApi = url.pathname.startsWith("/api/auth/") ? "auth" : url.pathname.startsWith("/api/account/") ? "account" : /^\/api\/networks\/(?![^/]+\/(?:network\/|relay$))/u.test(url.pathname) ? "networks" : void 0;
|
|
670
|
+
const identity = publicRoutes && identityApi ? options.headlessHub.publicApi(identityApi) : void 0;
|
|
671
|
+
if (identity) {
|
|
672
|
+
const forwarded = webRequest(request, url);
|
|
673
|
+
forwarded.headers.set(require_packageApi.PO_API_PEER_ADDRESS_HEADER, request.socket.remoteAddress ?? "");
|
|
674
|
+
await writeResponse(response, await identity.handler.fetch(forwarded));
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
490
677
|
if (!authorized(request, options.token)) {
|
|
491
678
|
json(response, 401, { error: "Unauthorized." });
|
|
492
679
|
return;
|
|
493
680
|
}
|
|
681
|
+
const actor = actorOf(request);
|
|
682
|
+
const person = actor.kind === "member" ? actor : actor.kind === "host" ? actor.person : void 0;
|
|
683
|
+
const deviceId = options.token === void 0 ? void 0 : request.headers[require_packageApi.PO_API_CALLER_DEVICE_ID_HEADER];
|
|
684
|
+
const audit = (outcome) => options.audit?.({
|
|
685
|
+
...person === void 0 ? {} : { actor: {
|
|
686
|
+
issuer: person.issuer,
|
|
687
|
+
subject: person.subject,
|
|
688
|
+
org: person.org
|
|
689
|
+
} },
|
|
690
|
+
...typeof deviceId === "string" ? { device: deviceId } : {},
|
|
691
|
+
action: request.method ?? "GET",
|
|
692
|
+
resource: url.pathname,
|
|
693
|
+
outcome
|
|
694
|
+
});
|
|
695
|
+
const refuse = (status, error) => {
|
|
696
|
+
audit("denied");
|
|
697
|
+
json(response, status, { error });
|
|
698
|
+
};
|
|
699
|
+
if (actor.kind === "refused") return refuse(401, "Sign in to this team on this device first.");
|
|
700
|
+
if (actor.kind === "member" && !sessionAccess.current(actor)) return refuse(401, "You are no longer on this team.");
|
|
701
|
+
if (person !== void 0) {
|
|
702
|
+
const need = require_index.memberRouteNeed(request.method ?? "GET", url.pathname);
|
|
703
|
+
const addressed = require_index.sessionOfRoute(url.pathname);
|
|
704
|
+
const session = need.kind === "session" ? need : actor.kind === "host" && addressed !== void 0 ? {
|
|
705
|
+
sessionId: addressed,
|
|
706
|
+
level: "own"
|
|
707
|
+
} : void 0;
|
|
708
|
+
if (actor.kind === "member" && need.kind === "deny") return refuse(403, "Only the owner of this computer can do that.");
|
|
709
|
+
if (session !== void 0) {
|
|
710
|
+
if (!sessionAccess.permits(actor, session.sessionId, "view")) return refuse(404, "Session not found.");
|
|
711
|
+
if (!sessionAccess.permits(actor, session.sessionId, session.level)) return refuse(403, session.level === "own" ? "Only the person who started this session can do that." : "You can view this session, but not act in it.");
|
|
712
|
+
}
|
|
713
|
+
if (request.method !== "GET" && request.method !== "HEAD") response.once("finish", () => audit(response.statusCode < 400 ? "allowed" : "failed"));
|
|
714
|
+
}
|
|
715
|
+
const reaches = (sessionId, level = "view") => sessionAccess.permits(actor, sessionId, level);
|
|
716
|
+
if (url.pathname === "/api/web-plugin-inventory" && options.requestNetwork) {
|
|
717
|
+
const result = await options.requestNetwork(webRequest(request, url));
|
|
718
|
+
if (result) {
|
|
719
|
+
await writeResponse(response, result);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
const clientMetadata = require_codec.poClientMetadataFrom({ header: typeof request.headers["x-po-client-metadata"] === "string" ? request.headers[require_codec.PO_CLIENT_METADATA_HEADER] : void 0 });
|
|
724
|
+
if (clientMetadata.status === "ok") await options.clientDevices?.observe(clientMetadata.metadata);
|
|
725
|
+
if (url.pathname === "/api/client-devices" && request.method === "GET" && options.clientDevices) {
|
|
726
|
+
json(response, 200, { devices: await options.clientDevices.list() });
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const deviceMatch = /^\/api\/client-devices\/([^/]+)$/u.exec(url.pathname);
|
|
730
|
+
if (deviceMatch && request.method === "PATCH" && options.clientDevices) {
|
|
731
|
+
const origin = request.headers.origin;
|
|
732
|
+
if (request.headers["x-po-csrf"] !== "1" || origin !== void 0 && origin !== `http://${request.headers.host}` && origin !== `https://${request.headers.host}`) {
|
|
733
|
+
json(response, 403, { error: "Invalid origin." });
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const body = parseJson(await readBody(request, 4096));
|
|
737
|
+
if (!require_codec.normalizeClientDeviceName(body?.deviceName)) {
|
|
738
|
+
json(response, 400, { error: "Invalid client device name." });
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
const device = await options.clientDevices.rename(decodeURIComponent(deviceMatch[1]), body?.deviceName);
|
|
742
|
+
json(response, device ? 200 : 404, device ? { device } : { error: "Device not found." });
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
let automaticRevive = false;
|
|
746
|
+
if (request.method === "POST" && /^\/api\/workspaces\/[^/]+\/sessions\/[^/]+\/revive$/u.test(url.pathname)) {
|
|
747
|
+
const bytes = await readBody(request, 4096);
|
|
748
|
+
if (bytes.length > 0) {
|
|
749
|
+
let body;
|
|
750
|
+
try {
|
|
751
|
+
body = parseJson(bytes);
|
|
752
|
+
} catch {
|
|
753
|
+
json(response, 400, { error: "Invalid revival JSON." });
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || Object.keys(body).some((key) => key !== "automatic") || "automatic" in body && body.automatic !== true) {
|
|
757
|
+
json(response, 400, { error: "Revival accepts only automatic: true." });
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
automaticRevive = "automatic" in body;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
const pendingRevive = scopedSession === void 0 ? void 0 : reviving.get(decodeURIComponent(scopedSession));
|
|
764
|
+
if (pendingRevive !== void 0 && request.method === "POST" && url.pathname === `/api/workspaces/${encodeURIComponent(pendingRevive.workspaceId)}/sessions/${scopedSession}/revive`) {
|
|
765
|
+
const result = await pendingRevive.promise;
|
|
766
|
+
if (pendingRevive.automatic === automaticRevive) {
|
|
767
|
+
json(response, result === "paused" ? 409 : 200, result === "paused" ? { error: "Automatic revival is paused. Use Wake to retry." } : { ok: true });
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
494
771
|
const reopening = scopedSession === void 0 ? void 0 : restarting.get(decodeURIComponent(scopedSession));
|
|
772
|
+
if (reopening !== void 0 && (request.method === "POST" && /^\/api\/workspaces\/[^/]+\/sessions\/[^/]+\/(?:move|restart|role|revive|resume)$/u.test(url.pathname) || request.method === "DELETE" && /^\/api\/workspaces\/[^/]+\/sessions\/[^/]+$/u.test(url.pathname))) {
|
|
773
|
+
json(response, 409, { error: "The session is already changing. Wait for it to finish." });
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
495
776
|
if (reopening !== void 0 && options.headlessHub.session(decodeURIComponent(scopedSession)) === void 0) await reopening;
|
|
496
|
-
if (
|
|
777
|
+
if (sessionMcpServer && sessionMcp && sessionMcpServer.isHostRoute(url.pathname)) {
|
|
497
778
|
const hostSessionMcp = await sessionMcp.handleHost(webRequest(request, url));
|
|
498
779
|
if (hostSessionMcp !== void 0) {
|
|
499
780
|
await writeResponse(response, hostSessionMcp);
|
|
@@ -503,7 +784,7 @@ async function serveHeadlessServer(options) {
|
|
|
503
784
|
if (url.pathname === "/api/remote" || url.pathname.startsWith("/api/remote/")) {
|
|
504
785
|
const headers = new Headers();
|
|
505
786
|
for (const [name, value] of Object.entries(request.headers)) if (value !== void 0 && name !== "authorization" && name !== "x-po-token") headers.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
506
|
-
await writeResponse(response, await options.headlessHub.requestApi({ scope: "
|
|
787
|
+
await writeResponse(response, await options.headlessHub.requestApi({ scope: "host" }, "remote", new Request(`http://po.local${url.pathname.slice(11)}${url.search}`, {
|
|
507
788
|
method: request.method,
|
|
508
789
|
headers,
|
|
509
790
|
...request.method === "GET" || request.method === "HEAD" ? {} : { body: Buffer.from(await readBody(request)) }
|
|
@@ -518,16 +799,33 @@ async function serveHeadlessServer(options) {
|
|
|
518
799
|
}
|
|
519
800
|
for (const event of body.events) {
|
|
520
801
|
if (!event || typeof event !== "object" || typeof event.name !== "string" || !/^web\.browser\.[a-z_]{1,40}$/u.test(event.name)) continue;
|
|
521
|
-
if (options.telemetry)
|
|
802
|
+
if (!options.telemetry) continue;
|
|
803
|
+
const attributes = {
|
|
522
804
|
...typeof event.duration_ms === "number" && Number.isFinite(event.duration_ms) && event.duration_ms >= 0 ? { duration_ms: event.duration_ms } : {},
|
|
523
805
|
...typeof event.count === "number" && Number.isFinite(event.count) && event.count >= 0 ? { count: event.count } : {}
|
|
524
|
-
}
|
|
806
|
+
};
|
|
807
|
+
if (event.attributes && typeof event.attributes === "object" && !Array.isArray(event.attributes)) {
|
|
808
|
+
for (const [key, value] of Object.entries(event.attributes).slice(0, 12)) if (/^[a-z_]{1,32}$/u.test(key) && (typeof value === "number" && Number.isFinite(value) || typeof value === "string" && value.length <= 256)) attributes[key] = value;
|
|
809
|
+
}
|
|
810
|
+
require_serverTelemetry.observe(event.level === "warn" ? options.telemetry.recordWarning(event.name, void 0, attributes) : options.telemetry.recordEvent(event.name, attributes));
|
|
525
811
|
}
|
|
526
812
|
json(response, 200, { ok: true });
|
|
527
813
|
return;
|
|
528
814
|
}
|
|
529
815
|
if (url.pathname === "/api/compositions" && request.method === "GET") {
|
|
530
|
-
|
|
816
|
+
const nativeClient = url.searchParams.get("client") === "native";
|
|
817
|
+
json(response, 200, await options.compositions?.({ nativeClient }) ?? { workspaces: [] });
|
|
818
|
+
return;
|
|
819
|
+
}
|
|
820
|
+
if (url.pathname === "/api/compositions/remote" && request.method === "GET") {
|
|
821
|
+
const pluginIds = (url.searchParams.get("plugins") ?? "").split(",");
|
|
822
|
+
if (pluginIds.length > MAX_REMOTE_PLUGINS || !pluginIds.every((id) => PLUGIN_ID.test(id))) {
|
|
823
|
+
json(response, 400, { error: "plugins must list up to 200 plugin ids." });
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
const remote = await options.remoteCompositions?.(pluginIds);
|
|
827
|
+
if (remote === void 0) json(response, 404, { error: "No web build is published yet." });
|
|
828
|
+
else json(response, 200, remote);
|
|
531
829
|
return;
|
|
532
830
|
}
|
|
533
831
|
if ((url.pathname.startsWith("/api/web-plugins/") || url.pathname === "/bundle-manifest.json" || url.pathname.startsWith("/bundle-assets/")) && options.requestAsset) {
|
|
@@ -537,6 +835,19 @@ async function serveHeadlessServer(options) {
|
|
|
537
835
|
return;
|
|
538
836
|
}
|
|
539
837
|
}
|
|
838
|
+
if (url.pathname === "/api/directories/workspaces" && request.method === "GET" && options.declaredWorkspaces) {
|
|
839
|
+
const requestedPath = url.searchParams.get("path");
|
|
840
|
+
if (!requestedPath?.trim()) {
|
|
841
|
+
json(response, 400, { error: "A folder path is required." });
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
try {
|
|
845
|
+
json(response, 200, await options.declaredWorkspaces(expandHome(requestedPath.trim())));
|
|
846
|
+
} catch (error) {
|
|
847
|
+
json(response, 422, { error: require_harnessErrorMessage.harnessErrorMessage(error) });
|
|
848
|
+
}
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
540
851
|
if (url.pathname === "/api/directories/children" && request.method === "GET") {
|
|
541
852
|
const listing = await directoryChildren(url.searchParams.get("path"));
|
|
542
853
|
if (listing === void 0) json(response, 404, { error: "That folder cannot be read." });
|
|
@@ -553,14 +864,92 @@ async function serveHeadlessServer(options) {
|
|
|
553
864
|
}
|
|
554
865
|
if (url.pathname === "/api/sessions" && request.method === "POST") {
|
|
555
866
|
const body = parseJson(await readBody(request));
|
|
556
|
-
if (!body || typeof body !== "object" ||
|
|
557
|
-
json(response, 400, { error: "A session
|
|
867
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || "name" in body && typeof body.name !== "string" || "cwd" in body && (typeof body.cwd !== "string" || !body.cwd.trim()) || "bot" in body && body.bot !== true || Object.keys(body).some((key) => key !== "name" && key !== "cwd" && key !== "selection" && key !== "bot")) {
|
|
868
|
+
json(response, 400, { error: "A session accepts an optional name, working directory and profile selection." });
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
const launch = "selection" in body ? require_hubChannel.parseLaunchSelection(body.selection) : {};
|
|
872
|
+
if ("error" in launch) {
|
|
873
|
+
json(response, 400, launch);
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if ("cwd" in body) {
|
|
877
|
+
if (actor.kind !== "host") {
|
|
878
|
+
json(response, 403, { error: "Only the owner of this computer can choose a folder." });
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
const startedBy = sessionStarter(request, options.token);
|
|
882
|
+
const created = await options.headlessHub.sessionService.create({
|
|
883
|
+
cwd: body.cwd,
|
|
884
|
+
name: "name" in body ? String(body.name) : node_path.default.basename(body.cwd),
|
|
885
|
+
...launch.selection === void 0 ? {} : { selection: launch.selection },
|
|
886
|
+
...startedBy === void 0 ? {} : { startedBy }
|
|
887
|
+
});
|
|
888
|
+
if ("bot" in body) await markBot(created.sessionId);
|
|
889
|
+
json(response, 201, { sessionId: created.sessionId });
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (options.createGeneralSession === void 0) {
|
|
893
|
+
json(response, 404, { error: "Workspace-free session creation is unavailable on this host." });
|
|
558
894
|
return;
|
|
559
895
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
896
|
+
const startedBy = sessionStarter(request, options.token);
|
|
897
|
+
const created = await options.createGeneralSession({
|
|
898
|
+
..."name" in body ? { name: String(body.name) } : {},
|
|
899
|
+
...launch.selection === void 0 ? {} : { selection: launch.selection },
|
|
900
|
+
...startedBy === void 0 ? {} : { startedBy }
|
|
901
|
+
});
|
|
902
|
+
if ("bot" in body) await markBot(created.sessionId);
|
|
903
|
+
const session = options.headlessHub.session(created.sessionId);
|
|
904
|
+
const workspace = session === void 0 ? void 0 : options.headlessHub.workspaces().find((entry) => entry.id === session.workspaceId);
|
|
905
|
+
json(response, 201, {
|
|
906
|
+
sessionId: created.sessionId,
|
|
907
|
+
...workspace === void 0 ? {} : { workspace },
|
|
908
|
+
...session === void 0 ? {} : { session: sessionView(session) }
|
|
909
|
+
});
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (url.pathname === "/api/coordinators/home" && request.method === "POST") {
|
|
913
|
+
if (options.ensureHomeCoordinator === void 0) {
|
|
914
|
+
json(response, 501, { error: "Coordinators are unavailable on this host." });
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
const body = parseJson(await readBody(request));
|
|
918
|
+
const text = (value) => typeof value === "string" && value.trim() !== "";
|
|
919
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || !("profile" in body) || !text(body.profile) || !("name" in body) || !text(body.name) || "model" in body && !text(body.model) || Object.keys(body).some((key) => key !== "profile" && key !== "model" && key !== "name")) {
|
|
920
|
+
json(response, 400, { error: "A home coordinator needs a profile and a name, and accepts a model." });
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
try {
|
|
924
|
+
json(response, 200, await options.ensureHomeCoordinator({
|
|
925
|
+
profile: body.profile.trim(),
|
|
926
|
+
name: body.name.trim(),
|
|
927
|
+
..."model" in body && text(body.model) ? { model: body.model.trim() } : {}
|
|
928
|
+
}));
|
|
929
|
+
} catch (error) {
|
|
930
|
+
json(response, 422, { error: require_harnessErrorMessage.harnessErrorMessage(error) });
|
|
931
|
+
}
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
934
|
+
if (url.pathname === "/api/coordinators" && request.method === "POST") {
|
|
935
|
+
if (options.addCoordinator === void 0) {
|
|
936
|
+
json(response, 501, { error: "Coordinators are unavailable on this host." });
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
const body = parseJson(await readBody(request));
|
|
940
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || "workspaceId" in body && (typeof body.workspaceId !== "string" || body.workspaceId === "") || "profile" in body && (typeof body.profile !== "string" || body.profile.trim() === "") || "bot" in body && body.bot !== true || Object.keys(body).some((key) => key !== "workspaceId" && key !== "profile" && key !== "bot")) {
|
|
941
|
+
json(response, 400, { error: "A coordinator accepts an optional workspace id and profile." });
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const workspaceId = "workspaceId" in body && typeof body.workspaceId === "string" ? body.workspaceId : void 0;
|
|
945
|
+
try {
|
|
946
|
+
const profile = "profile" in body && typeof body.profile === "string" ? body.profile.trim() : void 0;
|
|
947
|
+
const result = await options.addCoordinator(workspaceId, profile);
|
|
948
|
+
if ("bot" in body && !("profileRequired" in result) && result.created) await markBot(result.sessionId);
|
|
949
|
+
json(response, "profileRequired" in result ? 422 : 200, result);
|
|
950
|
+
} catch (error) {
|
|
951
|
+
json(response, 422, { error: require_harnessErrorMessage.harnessErrorMessage(error) });
|
|
952
|
+
}
|
|
564
953
|
return;
|
|
565
954
|
}
|
|
566
955
|
const workspaceSessions = /^\/api\/workspaces\/([^/]+)\/sessions$/u.exec(url.pathname);
|
|
@@ -572,23 +961,38 @@ async function serveHeadlessServer(options) {
|
|
|
572
961
|
return;
|
|
573
962
|
}
|
|
574
963
|
if (request.method === "GET") {
|
|
575
|
-
json(response, 200, { sessions: [...options.headlessHub.snapshot().filter((session) => session.workspaceId === workspaceId && (!options.headlessHub.computerUse?.ownsSession?.(session.id) || computerUseAuthorized(session.id, request))).map(sessionView), ...dormant().filter((record) => record.workspaceId === workspaceId && (!options.headlessHub.computerUse?.ownsSession?.(record.sessionId) || computerUseAuthorized(record.sessionId, request))).map(dormantView)] });
|
|
964
|
+
json(response, 200, { sessions: [...options.headlessHub.snapshot().filter((session) => session.workspaceId === workspaceId && reaches(session.id) && (!options.headlessHub.computerUse?.ownsSession?.(session.id) || computerUseAuthorized(session.id, request))).map(sessionView), ...dormant().filter((record) => record.workspaceId === workspaceId && reaches(record.sessionId) && (!options.headlessHub.computerUse?.ownsSession?.(record.sessionId) || computerUseAuthorized(record.sessionId, request))).map((record) => dormantView(record, options.headlessHub.sessionPendingApprovalCount?.(record.sessionId)))] });
|
|
576
965
|
return;
|
|
577
966
|
}
|
|
578
967
|
if (request.method === "POST") {
|
|
968
|
+
if (workspace.kind === "session") {
|
|
969
|
+
json(response, 409, { error: "Create a workspace-free session to allocate its working folder." });
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
579
972
|
if (workspace.available === false) {
|
|
580
973
|
json(response, 409, { error: "Workspace is unavailable." });
|
|
581
974
|
return;
|
|
582
975
|
}
|
|
583
976
|
const body = parseJson(await readBody(request));
|
|
584
|
-
if (!body || typeof body !== "object" || "name" in body && typeof body.name !== "string") {
|
|
977
|
+
if (!body || typeof body !== "object" || "name" in body && typeof body.name !== "string" || "sessionProvenance" in body || "bot" in body && body.bot !== true) {
|
|
585
978
|
json(response, 400, { error: "A session accepts an optional name." });
|
|
586
979
|
return;
|
|
587
980
|
}
|
|
588
|
-
|
|
981
|
+
const launch = "selection" in body ? require_hubChannel.parseLaunchSelection(body.selection) : {};
|
|
982
|
+
if ("error" in launch) {
|
|
983
|
+
json(response, 400, launch);
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
const startedBy = sessionStarter(request, options.token);
|
|
987
|
+
const created = await options.headlessHub.sessionService.create({
|
|
988
|
+
workspaceId,
|
|
589
989
|
cwd: workspace.root,
|
|
590
|
-
name: "name" in body ? String(body.name) : node_path.default.basename(workspace.root)
|
|
591
|
-
|
|
990
|
+
name: "name" in body ? String(body.name) : node_path.default.basename(workspace.root),
|
|
991
|
+
...launch.selection === void 0 ? {} : { selection: launch.selection },
|
|
992
|
+
...startedBy === void 0 ? {} : { startedBy }
|
|
993
|
+
});
|
|
994
|
+
if ("bot" in body) await markBot(created.sessionId);
|
|
995
|
+
json(response, 201, { sessionId: created.sessionId });
|
|
592
996
|
return;
|
|
593
997
|
}
|
|
594
998
|
}
|
|
@@ -611,7 +1015,7 @@ async function serveHeadlessServer(options) {
|
|
|
611
1015
|
})), ...dormant().map((record) => ({
|
|
612
1016
|
id: record.sessionId,
|
|
613
1017
|
groups: record.groups ?? []
|
|
614
|
-
}))].filter((member) => member.groups.includes(from) && (!options.headlessHub.computerUse?.ownsSession?.(member.id) || computerUseAuthorized(member.id, request)));
|
|
1018
|
+
}))].filter((member) => member.groups.includes(from) && reaches(member.id, "interact") && (!options.headlessHub.computerUse?.ownsSession?.(member.id) || computerUseAuthorized(member.id, request)));
|
|
615
1019
|
let updates;
|
|
616
1020
|
try {
|
|
617
1021
|
updates = members.map((member) => ({
|
|
@@ -684,28 +1088,128 @@ async function serveHeadlessServer(options) {
|
|
|
684
1088
|
json(response, 200, { sessionId: await options.resumeWorkspaceSession(workspaceId, targetSessionId) });
|
|
685
1089
|
return;
|
|
686
1090
|
}
|
|
1091
|
+
const workspaceRemovedMatch = /^\/api\/workspaces\/([^/]+)\/removed$/u.exec(url.pathname);
|
|
1092
|
+
if (workspaceRemovedMatch && request.method === "GET" && options.removedSessions) {
|
|
1093
|
+
const workspaceId = decodeURIComponent(workspaceRemovedMatch[1]);
|
|
1094
|
+
if (!options.headlessHub.workspaces().some((entry) => entry.id === workspaceId)) {
|
|
1095
|
+
json(response, 404, { error: "Workspace not found." });
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
json(response, 200, { sessions: await options.removedSessions(workspaceId) });
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
const workspaceRestoreMatch = /^\/api\/workspaces\/([^/]+)\/removed\/([^/]+)\/restore$/u.exec(url.pathname);
|
|
1102
|
+
if (workspaceRestoreMatch && request.method === "POST" && options.restoreRemovedSession) {
|
|
1103
|
+
const workspaceId = decodeURIComponent(workspaceRestoreMatch[1]);
|
|
1104
|
+
const sessionId = decodeURIComponent(workspaceRestoreMatch[2]);
|
|
1105
|
+
if (!options.headlessHub.workspaces().some((entry) => entry.id === workspaceId)) {
|
|
1106
|
+
json(response, 404, { error: "Workspace not found." });
|
|
1107
|
+
return;
|
|
1108
|
+
}
|
|
1109
|
+
if (!/^[A-Za-z0-9_-]+$/u.test(sessionId)) {
|
|
1110
|
+
json(response, 400, { error: "Invalid session id." });
|
|
1111
|
+
return;
|
|
1112
|
+
}
|
|
1113
|
+
if (!await options.restoreRemovedSession(workspaceId, sessionId)) {
|
|
1114
|
+
json(response, 409, { error: "This session is being deleted or is already gone." });
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
json(response, 200, { ok: true });
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
687
1120
|
const workspaceMatch = /^\/api\/workspaces\/([^/]+)$/u.exec(url.pathname);
|
|
1121
|
+
if (workspaceMatch && (request.method === "PATCH" || request.method === "DELETE")) {
|
|
1122
|
+
const id = decodeURIComponent(workspaceMatch[1]);
|
|
1123
|
+
if (changingWorkspaces.has(id) || [...movingWorkspaces.values()].some((ids) => ids.includes(id)) || [...reviving.values()].some((pending) => pending.workspaceId === id)) {
|
|
1124
|
+
json(response, 409, { error: "The workspace is already changing. Wait for it to finish." });
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
if (options.headlessHub.workspaces().find((entry) => entry.id === id)?.kind === "session") {
|
|
1128
|
+
json(response, 409, { error: "The session backing workspace is managed by Po." });
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
688
1132
|
if (workspaceMatch && request.method === "GET") {
|
|
689
1133
|
const workspace = options.headlessHub.workspaces().find((entry) => entry.id === decodeURIComponent(workspaceMatch[1]));
|
|
690
1134
|
json(response, workspace ? 200 : 404, workspace ? { workspace } : { error: "Workspace not found." });
|
|
691
1135
|
return;
|
|
692
1136
|
}
|
|
693
|
-
if (workspaceMatch && request.method === "
|
|
1137
|
+
if (workspaceMatch && request.method === "PATCH") {
|
|
694
1138
|
const id = decodeURIComponent(workspaceMatch[1]);
|
|
695
|
-
|
|
696
|
-
|
|
1139
|
+
changingWorkspaces.add(id);
|
|
1140
|
+
try {
|
|
1141
|
+
const body = parseJson(await readBody(request));
|
|
1142
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || Object.keys(body).length !== 1 || !("sandbox" in body) && !("instructions" in body)) {
|
|
1143
|
+
json(response, 400, { error: "Provide exactly one of sandbox or instructions." });
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const instructions = "instructions" in body ? body.instructions : void 0;
|
|
1147
|
+
const sandbox = "sandbox" in body ? body.sandbox : void 0;
|
|
1148
|
+
if ("instructions" in body) {
|
|
1149
|
+
if (typeof instructions !== "string" || instructions.length > WORKSPACE_INSTRUCTIONS_MAX_LENGTH) {
|
|
1150
|
+
json(response, 400, { error: `Workspace instructions must be text up to ${String(WORKSPACE_INSTRUCTIONS_MAX_LENGTH)} characters.` });
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
} else if (sandbox !== null && (typeof sandbox !== "string" || sandbox.trim() === "")) {
|
|
1154
|
+
json(response, 400, { error: "The sandbox must be a provider id, or null to run locally." });
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
if (!options.headlessHub.workspaces().some((workspace) => workspace.id === id)) {
|
|
1158
|
+
json(response, 404, { error: "Workspace not found." });
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
if (typeof instructions === "string" ? !options.setWorkspaceInstructions : !options.setWorkspaceSandbox) {
|
|
1162
|
+
json(response, 404, { error: "Workspace settings are unavailable." });
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
const result = typeof instructions === "string" ? await options.setWorkspaceInstructions(id, instructions) : await options.setWorkspaceSandbox(id, sandbox);
|
|
1166
|
+
json(response, "error" in result ? 409 : 200, result);
|
|
697
1167
|
return;
|
|
1168
|
+
} finally {
|
|
1169
|
+
changingWorkspaces.delete(id);
|
|
698
1170
|
}
|
|
699
|
-
|
|
700
|
-
|
|
1171
|
+
}
|
|
1172
|
+
if (workspaceMatch && request.method === "DELETE") {
|
|
1173
|
+
const id = decodeURIComponent(workspaceMatch[1]);
|
|
1174
|
+
changingWorkspaces.add(id);
|
|
1175
|
+
try {
|
|
1176
|
+
if (!options.headlessHub.workspaces().some((workspace) => workspace.id === id)) {
|
|
1177
|
+
json(response, 404, { error: "Workspace not found." });
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
if (url.searchParams.get("removeSessions") === "true") {
|
|
1181
|
+
const live = options.headlessHub.snapshot().filter((session) => session.workspaceId === id);
|
|
1182
|
+
const saved = dormant().filter((session) => session.workspaceId === id);
|
|
1183
|
+
if ([...live.map((session) => session.id), ...saved.map((record) => record.sessionId)].some((sessionId) => options.headlessHub.computerUse?.ownsSession?.(sessionId) && !computerUseAuthorized(sessionId, request))) {
|
|
1184
|
+
json(response, 409, { error: "Workspace contains a session managed by another Desktop instance." });
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
if (live.length > 0 && !options.removeSessionFiles || saved.length > 0 && !options.removeDormantSession) {
|
|
1188
|
+
json(response, 409, { error: "Session removal is unavailable." });
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
for (const session of live) await removeSession(session.id, () => options.removeSessionFiles(session.id));
|
|
1192
|
+
for (const record of saved) await removeSession(record.sessionId, () => options.removeDormantSession(record));
|
|
1193
|
+
}
|
|
1194
|
+
if (options.headlessHub.snapshot().some((session) => session.workspaceId === id) || dormant().some((session) => session.workspaceId === id)) {
|
|
1195
|
+
json(response, 409, { error: "Workspace still has sessions." });
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
await options.headlessHub.removeWorkspace(id);
|
|
1199
|
+
options.headlessHub.notifyWorkspaceDeleted(id);
|
|
1200
|
+
json(response, 200, { ok: true });
|
|
701
1201
|
return;
|
|
1202
|
+
} finally {
|
|
1203
|
+
changingWorkspaces.delete(id);
|
|
702
1204
|
}
|
|
703
|
-
await options.headlessHub.removeWorkspace(id);
|
|
704
|
-
json(response, 200, { ok: true });
|
|
705
|
-
return;
|
|
706
1205
|
}
|
|
707
1206
|
const pluginMatch = PO_PACKAGE_API_PATH_PATTERN.exec(url.pathname);
|
|
708
1207
|
if (pluginMatch !== null && request.method !== "CONNECT") {
|
|
1208
|
+
const basePath = pluginMatch[3] === void 0 ? "settings" : decodeURIComponent(pluginMatch[3]);
|
|
1209
|
+
if (pluginMatch[3] !== void 0 && pluginMatch[3] !== basePath || !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(basePath)) {
|
|
1210
|
+
json(response, 400, { error: "Invalid package API base path." });
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
709
1213
|
const workspaceId = pluginMatch[1] === void 0 ? void 0 : decodeURIComponent(pluginMatch[1]);
|
|
710
1214
|
const sessionId = pluginMatch[2] === void 0 ? void 0 : decodeURIComponent(pluginMatch[2]);
|
|
711
1215
|
if (workspaceId !== void 0 && !options.headlessHub.workspaces().some((entry) => entry.id === workspaceId)) {
|
|
@@ -714,12 +1218,13 @@ async function serveHeadlessServer(options) {
|
|
|
714
1218
|
}
|
|
715
1219
|
if (sessionId !== void 0 && options.headlessHub.session(sessionId)?.workspaceId !== workspaceId) {
|
|
716
1220
|
if (dormant().some((record) => record.sessionId === sessionId && record.workspaceId === workspaceId) && pluginMatch[3] === "context" && request.method === "GET") {
|
|
1221
|
+
const environment = options.environment ?? {};
|
|
717
1222
|
const detail = await require_runtimeContextApi.createContextApi({
|
|
718
1223
|
sessionId,
|
|
719
|
-
environment
|
|
1224
|
+
environment
|
|
720
1225
|
}).fetch(new Request(`http://po.local/${pluginMatch[4] ?? ""}${url.search}`));
|
|
721
1226
|
const body = await detail.json();
|
|
722
|
-
if (require_contextDetailStore.readContextDetail(sessionId,
|
|
1227
|
+
if (require_contextDetailStore.readContextDetail(sessionId, environment) === void 0) json(response, 404, { error: "This session is stopped. Wake it to read this item." });
|
|
723
1228
|
else json(response, detail.status, body);
|
|
724
1229
|
return;
|
|
725
1230
|
}
|
|
@@ -732,13 +1237,8 @@ async function serveHeadlessServer(options) {
|
|
|
732
1237
|
} : workspaceId !== void 0 ? {
|
|
733
1238
|
scope: "workspace",
|
|
734
1239
|
workspaceId
|
|
735
|
-
} : { scope: "
|
|
736
|
-
|
|
737
|
-
if (!/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/u.test(basePath)) {
|
|
738
|
-
json(response, 400, { error: "Invalid package API base path." });
|
|
739
|
-
return;
|
|
740
|
-
}
|
|
741
|
-
if (pluginMatch[3] === "settings" || sessionId !== void 0 && basePath === "settings") {
|
|
1240
|
+
} : { scope: "host" };
|
|
1241
|
+
if (basePath === "settings" && (pluginMatch[3] !== void 0 || sessionId !== void 0)) {
|
|
742
1242
|
json(response, 404, { error: "Not found." });
|
|
743
1243
|
return;
|
|
744
1244
|
}
|
|
@@ -749,7 +1249,7 @@ async function serveHeadlessServer(options) {
|
|
|
749
1249
|
"authorization",
|
|
750
1250
|
"x-po-token"
|
|
751
1251
|
].includes(name) && (trustedCaller || !require_packageApi.PO_API_CALLER_HEADERS.includes(name))) headers.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
752
|
-
if (!trustedCaller) {
|
|
1252
|
+
if (!trustedCaller || !headers.has("x-po-api-caller-locality")) {
|
|
753
1253
|
headers.set(require_packageApi.PO_API_CALLER_LOCALITY_HEADER, "local");
|
|
754
1254
|
headers.set(require_packageApi.PO_API_CALLER_STEP_UP_HEADER, "not-required");
|
|
755
1255
|
}
|
|
@@ -763,23 +1263,60 @@ async function serveHeadlessServer(options) {
|
|
|
763
1263
|
const attributes = {
|
|
764
1264
|
scope: mount.scope,
|
|
765
1265
|
"plugin.name": basePath,
|
|
766
|
-
"http.operation":
|
|
1266
|
+
"http.operation": `${[
|
|
1267
|
+
"GET",
|
|
1268
|
+
"HEAD",
|
|
1269
|
+
"POST",
|
|
1270
|
+
"PUT",
|
|
1271
|
+
"PATCH",
|
|
1272
|
+
"DELETE",
|
|
1273
|
+
"OPTIONS"
|
|
1274
|
+
].includes(request.method ?? "") ? request.method : "other"} ${[
|
|
1275
|
+
"status",
|
|
1276
|
+
"current",
|
|
1277
|
+
"runs",
|
|
1278
|
+
"artifacts",
|
|
1279
|
+
"settings",
|
|
1280
|
+
"refresh",
|
|
1281
|
+
"events",
|
|
1282
|
+
"history",
|
|
1283
|
+
"sessions",
|
|
1284
|
+
"files",
|
|
1285
|
+
"launch-profiles",
|
|
1286
|
+
"management"
|
|
1287
|
+
].includes((pluginMatch[4] ?? "").split("/")[0]) ? (pluginMatch[4] ?? "").split("/")[0] : "other"}`,
|
|
767
1288
|
...mount.scope === "workspace" ? { "workspace.id": mount.workspaceId } : {},
|
|
768
1289
|
...mount.scope === "session" ? { "session.id": mount.sessionId } : {}
|
|
769
1290
|
};
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1291
|
+
let requestBytes = 0;
|
|
1292
|
+
const dispatch = async () => {
|
|
1293
|
+
const body = request.method === "GET" || request.method === "HEAD" ? void 0 : Buffer.from(await readBody(request));
|
|
1294
|
+
requestBytes = body?.byteLength ?? 0;
|
|
1295
|
+
return options.headlessHub.requestApi(mount, basePath, new Request(`http://po.local/${pluginMatch[4] ?? ""}${url.search}`, {
|
|
1296
|
+
method: request.method,
|
|
1297
|
+
headers,
|
|
1298
|
+
signal: abort.signal,
|
|
1299
|
+
...body === void 0 ? {} : { body }
|
|
1300
|
+
}));
|
|
1301
|
+
};
|
|
776
1302
|
const result = options.telemetry ? await options.telemetry.runInSpan("po_server.plugin.request", attributes, dispatch) : await dispatch();
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
1303
|
+
const durationMs = performance.now() - started;
|
|
1304
|
+
let responseBytes = 0;
|
|
1305
|
+
try {
|
|
1306
|
+
await writeResponse(response, result, (bytes) => {
|
|
1307
|
+
responseBytes += bytes;
|
|
1308
|
+
});
|
|
1309
|
+
} finally {
|
|
1310
|
+
if (options.telemetry && !(result.status === 204 && responseBytes === 0)) require_serverTelemetry.observe(options.telemetry.recordEvent("po_server.plugin.response", {
|
|
1311
|
+
...attributes,
|
|
1312
|
+
status: result.status,
|
|
1313
|
+
durationMs,
|
|
1314
|
+
request_bytes: requestBytes,
|
|
1315
|
+
response_bytes: responseBytes,
|
|
1316
|
+
response_kind: require_packageApiServer.contentClass(result.headers.get("content-type")),
|
|
1317
|
+
flush_ms: performance.now() - started - durationMs
|
|
1318
|
+
}), options.onNotice);
|
|
1319
|
+
}
|
|
783
1320
|
} finally {
|
|
784
1321
|
response.off("close", disconnected);
|
|
785
1322
|
}
|
|
@@ -794,6 +1331,61 @@ async function serveHeadlessServer(options) {
|
|
|
794
1331
|
const workspaceId = decodeURIComponent(sessionMatch[1]);
|
|
795
1332
|
const session = options.headlessHub.session(sessionId);
|
|
796
1333
|
const suffix = sessionMatch[3] === void 0 ? "" : `/${sessionMatch[3]}`;
|
|
1334
|
+
if (suffix === "/move" && request.method === "POST") {
|
|
1335
|
+
if (!options.moveSession) {
|
|
1336
|
+
json(response, 501, { error: "Session moves are not supported by this host." });
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
const body = parseJson(await readBody(request));
|
|
1340
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || !("workspaceId" in body) || typeof body.workspaceId !== "string" || body.workspaceId.trim() === "" || Object.keys(body).length !== 1) {
|
|
1341
|
+
json(response, 400, { error: "A move needs only a destination workspaceId." });
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
if (restarting.has(sessionId)) {
|
|
1345
|
+
json(response, 409, { error: "The session is already changing. Wait for it to finish." });
|
|
1346
|
+
return;
|
|
1347
|
+
}
|
|
1348
|
+
const current = options.headlessHub.session(sessionId);
|
|
1349
|
+
if (!(current !== void 0 ? current.workspaceId === workspaceId : dormant().some((record) => record.sessionId === sessionId && record.workspaceId === workspaceId))) {
|
|
1350
|
+
json(response, 404, { error: "Session not found." });
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
const destinationId = body.workspaceId;
|
|
1354
|
+
if (changingWorkspaces.has(workspaceId) || changingWorkspaces.has(destinationId)) {
|
|
1355
|
+
json(response, 409, { error: "The workspace is already changing. Wait for it to finish." });
|
|
1356
|
+
return;
|
|
1357
|
+
}
|
|
1358
|
+
const workspaces = options.headlessHub.workspaces();
|
|
1359
|
+
const source = workspaces.find((workspace) => workspace.id === workspaceId);
|
|
1360
|
+
const destination = workspaces.find((workspace) => workspace.id === destinationId);
|
|
1361
|
+
if (!source || !destination || source.available === false || destination.available === false) {
|
|
1362
|
+
json(response, 404, { error: "Workspace not found or unavailable." });
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
if (source.sandbox || destination.sandbox) {
|
|
1366
|
+
json(response, 422, { error: "Sessions cannot move across containers." });
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
if (current !== void 0 && (current.phase ?? "idle") !== "idle") {
|
|
1370
|
+
json(response, 409, { error: "Stop the session or wait for it to finish before moving it." });
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
const change = Promise.resolve().then(() => options.moveSession(sessionId, destinationId));
|
|
1374
|
+
const settled = change.then(() => void 0, () => void 0);
|
|
1375
|
+
restarting.set(sessionId, settled);
|
|
1376
|
+
movingWorkspaces.set(sessionId, [workspaceId, destinationId]);
|
|
1377
|
+
try {
|
|
1378
|
+
await change;
|
|
1379
|
+
} catch (error) {
|
|
1380
|
+
json(response, 422, { error: require_harnessErrorMessage.harnessErrorMessage(error) });
|
|
1381
|
+
return;
|
|
1382
|
+
} finally {
|
|
1383
|
+
if (restarting.get(sessionId) === settled) restarting.delete(sessionId);
|
|
1384
|
+
movingWorkspaces.delete(sessionId);
|
|
1385
|
+
}
|
|
1386
|
+
json(response, 200, { ok: true });
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
797
1389
|
if (suffix === "/transcript" && request.method === "GET" && options.readDormantTranscript) {
|
|
798
1390
|
const record = dormant().find((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId);
|
|
799
1391
|
if (record === void 0) {
|
|
@@ -815,6 +1407,143 @@ async function serveHeadlessServer(options) {
|
|
|
815
1407
|
}
|
|
816
1408
|
return;
|
|
817
1409
|
}
|
|
1410
|
+
if (suffix === "/access" && (request.method === "GET" || request.method === "PUT")) {
|
|
1411
|
+
if (!(session?.workspaceId === workspaceId || dormant().some((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId))) {
|
|
1412
|
+
json(response, 404, { error: "Session not found." });
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
const source = sharingSession(sessionId);
|
|
1416
|
+
if (source === void 0) {
|
|
1417
|
+
json(response, 409, { error: "The parent sharing permissions are unavailable." });
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
if (request.method === "PUT") {
|
|
1421
|
+
if (source !== sessionId) {
|
|
1422
|
+
json(response, 409, { error: "Change sharing on the parent session." });
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
const share = require_index.parseSessionShare(parseJson(await readBody(request, 8192)));
|
|
1426
|
+
if (share === void 0) {
|
|
1427
|
+
json(response, 400, { error: "A share needs private or team visibility and valid named viewers and interactors." });
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
if (!sessionAccess.current(actor) || !sessionAccess.permits(actor, sessionId, "own")) {
|
|
1431
|
+
json(response, 403, { error: "Only the session owner can change sharing." });
|
|
1432
|
+
return;
|
|
1433
|
+
}
|
|
1434
|
+
const owner = starterOf(sessionId);
|
|
1435
|
+
if ([...share.view ?? [], ...share.interact].some((subject) => !owner?.org || options.teamMember?.({
|
|
1436
|
+
issuer: owner.issuer,
|
|
1437
|
+
org: owner.org,
|
|
1438
|
+
subject
|
|
1439
|
+
}) !== true)) {
|
|
1440
|
+
json(response, 400, { error: "Every named person must still belong to this session team." });
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
if (options.sessionShares === void 0 || !await options.sessionShares.set(sessionId, share)) {
|
|
1444
|
+
json(response, 409, { error: "This session cannot be shared right now." });
|
|
1445
|
+
return;
|
|
1446
|
+
}
|
|
1447
|
+
protocol.reauthorize();
|
|
1448
|
+
}
|
|
1449
|
+
if (!sessionAccess.current(actor) || !sessionAccess.permits(actor, sessionId, "view")) {
|
|
1450
|
+
json(response, 403, { error: "Your session access changed while sharing was saved." });
|
|
1451
|
+
return;
|
|
1452
|
+
}
|
|
1453
|
+
const share = shareOf(sessionId) ?? {
|
|
1454
|
+
visibility: "private",
|
|
1455
|
+
interact: []
|
|
1456
|
+
};
|
|
1457
|
+
const parent = source === sessionId ? void 0 : sessionRecord(source);
|
|
1458
|
+
json(response, 200, {
|
|
1459
|
+
...share,
|
|
1460
|
+
level: sessionAccess.level(actor, sessionId),
|
|
1461
|
+
owner: starterOf(sessionId),
|
|
1462
|
+
...parent === void 0 ? {} : { inheritedFrom: {
|
|
1463
|
+
sessionId: source,
|
|
1464
|
+
workspaceId: parent.workspaceId,
|
|
1465
|
+
name: parent.name
|
|
1466
|
+
} }
|
|
1467
|
+
});
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
if (suffix === "/bot" && (request.method === "GET" || request.method === "PUT")) {
|
|
1471
|
+
const record = dormant().find((candidate) => candidate.sessionId === sessionId);
|
|
1472
|
+
if (!(session?.workspaceId === workspaceId || record?.workspaceId === workspaceId)) {
|
|
1473
|
+
json(response, 404, { error: "Session not found." });
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
const level = request.method === "PUT" ? "interact" : "view";
|
|
1477
|
+
const allowed = () => sessionAccess.current(actor) && reaches(sessionId, level) && (!options.headlessHub.computerUse?.ownsSession?.(sessionId) || computerUseAuthorized(sessionId, request));
|
|
1478
|
+
if (!allowed()) {
|
|
1479
|
+
json(response, 403, { error: "You cannot change this session." });
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
const current = () => {
|
|
1483
|
+
const source = options.headlessHub.session(sessionId) ?? dormant().find((candidate) => candidate.sessionId === sessionId);
|
|
1484
|
+
return {
|
|
1485
|
+
...source?.bot === void 0 ? {} : { bot: source.bot },
|
|
1486
|
+
revision: source?.botRevision ?? 0
|
|
1487
|
+
};
|
|
1488
|
+
};
|
|
1489
|
+
if (request.method === "GET") {
|
|
1490
|
+
json(response, 200, current());
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1493
|
+
const body = parseJson(await readBody(request, 4096));
|
|
1494
|
+
const period = body && typeof body === "object" && !Array.isArray(body) ? body.wakePeriodMs : void 0;
|
|
1495
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || Object.keys(body).some((key) => key !== "wakePeriodMs" && key !== "revision") || !Number.isInteger(body.revision) || period !== null && !require_hubChannel.isBotWakePeriodMs(period)) {
|
|
1496
|
+
json(response, 400, { error: "A bot period needs the settings revision and wakePeriodMs between 15 minutes and 7 days, or null." });
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
const expectedRevision = body.revision;
|
|
1500
|
+
if (!allowed()) {
|
|
1501
|
+
json(response, 403, { error: "Your session access changed while the period was saved." });
|
|
1502
|
+
return;
|
|
1503
|
+
}
|
|
1504
|
+
if (current().bot === void 0) {
|
|
1505
|
+
json(response, 409, { error: "This session is not a bot." });
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1508
|
+
const next = period === null ? {} : { wakePeriodMs: period };
|
|
1509
|
+
const runtime = options.headlessHub.runtime(sessionId);
|
|
1510
|
+
if (runtime !== void 0) {
|
|
1511
|
+
const result = await runtime.setBot({
|
|
1512
|
+
bot: next,
|
|
1513
|
+
expectedRevision
|
|
1514
|
+
});
|
|
1515
|
+
if (!result.ok) {
|
|
1516
|
+
json(response, 409, {
|
|
1517
|
+
...current(),
|
|
1518
|
+
error: "The bot settings changed. Reload and try again."
|
|
1519
|
+
});
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
json(response, 200, {
|
|
1523
|
+
bot: next,
|
|
1524
|
+
revision: result.revision
|
|
1525
|
+
});
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
if (record === void 0 || options.setDormantBot === void 0) {
|
|
1529
|
+
json(response, 409, { error: "This bot cannot be changed right now." });
|
|
1530
|
+
return;
|
|
1531
|
+
}
|
|
1532
|
+
if (current().revision !== expectedRevision) {
|
|
1533
|
+
json(response, 409, {
|
|
1534
|
+
...current(),
|
|
1535
|
+
error: "The bot settings changed. Reload and try again."
|
|
1536
|
+
});
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
await options.setDormantBot(record, next, expectedRevision + 1);
|
|
1540
|
+
options.headlessHub.notifyDormantChanged(sessionId);
|
|
1541
|
+
json(response, 200, {
|
|
1542
|
+
bot: next,
|
|
1543
|
+
revision: expectedRevision + 1
|
|
1544
|
+
});
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
818
1547
|
if (suffix === "/groups" && request.method === "PUT") {
|
|
819
1548
|
if (!(session?.workspaceId === workspaceId || dormant().some((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId))) {
|
|
820
1549
|
json(response, 404, { error: "Session not found." });
|
|
@@ -835,23 +1564,70 @@ async function serveHeadlessServer(options) {
|
|
|
835
1564
|
json(response, 200, { groups });
|
|
836
1565
|
return;
|
|
837
1566
|
}
|
|
1567
|
+
if (suffix === "/role" && request.method === "POST" && options.setSessionRole) {
|
|
1568
|
+
if (!(session?.workspaceId === workspaceId || dormant().some((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId))) {
|
|
1569
|
+
json(response, 404, { error: "Session not found." });
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
const body = parseJson(await readBody(request));
|
|
1573
|
+
if (!body || typeof body !== "object" || Array.isArray(body) || !("coordinator" in body) || typeof body.coordinator !== "boolean" || Object.keys(body).length !== 1) {
|
|
1574
|
+
json(response, 400, { error: "A role change needs only a coordinator flag." });
|
|
1575
|
+
return;
|
|
1576
|
+
}
|
|
1577
|
+
if (restarting.has(sessionId)) {
|
|
1578
|
+
json(response, 409, { error: "The session is already changing. Wait for it to finish." });
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
if (session !== void 0 && (session.phase ?? "idle") !== "idle") {
|
|
1582
|
+
json(response, 409, { error: "The session is running a turn. Stop it or wait for it to finish before changing its role." });
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
const change = options.setSessionRole(sessionId, body.coordinator);
|
|
1586
|
+
const settled = change.then(() => void 0, () => void 0);
|
|
1587
|
+
if (session !== void 0) restarting.set(sessionId, settled);
|
|
1588
|
+
try {
|
|
1589
|
+
await change;
|
|
1590
|
+
} catch (error) {
|
|
1591
|
+
json(response, 422, { error: require_harnessErrorMessage.harnessErrorMessage(error) });
|
|
1592
|
+
return;
|
|
1593
|
+
} finally {
|
|
1594
|
+
if (restarting.get(sessionId) === settled) restarting.delete(sessionId);
|
|
1595
|
+
}
|
|
1596
|
+
json(response, 200, { ok: true });
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
838
1599
|
if (sessionMatch[3] === "revive" && request.method === "POST" && options.reviveSession) {
|
|
839
1600
|
const record = dormant().find((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId);
|
|
840
1601
|
if (record === void 0) {
|
|
841
1602
|
json(response, 404, { error: "Dormant session not found." });
|
|
842
1603
|
return;
|
|
843
1604
|
}
|
|
844
|
-
|
|
845
|
-
|
|
1605
|
+
if (changingWorkspaces.has(workspaceId)) {
|
|
1606
|
+
json(response, 409, { error: "The workspace is already changing. Wait for it to finish." });
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
const revive = Promise.resolve().then(() => automaticRevive ? options.reviveSession(record, { automatic: true }) : options.reviveSession(record));
|
|
1610
|
+
const settled = revive.then(() => void 0, () => void 0);
|
|
1611
|
+
restarting.set(sessionId, settled);
|
|
1612
|
+
reviving.set(sessionId, {
|
|
1613
|
+
workspaceId,
|
|
1614
|
+
automatic: automaticRevive,
|
|
1615
|
+
promise: revive
|
|
1616
|
+
});
|
|
1617
|
+
let result;
|
|
1618
|
+
try {
|
|
1619
|
+
result = await revive;
|
|
1620
|
+
} finally {
|
|
1621
|
+
if (restarting.get(sessionId) === settled) restarting.delete(sessionId);
|
|
1622
|
+
reviving.delete(sessionId);
|
|
1623
|
+
}
|
|
1624
|
+
json(response, result === "paused" ? 409 : 200, result === "paused" ? { error: "Automatic revival is paused. Use Wake to retry." } : { ok: true });
|
|
846
1625
|
return;
|
|
847
1626
|
}
|
|
848
1627
|
if (session === void 0 || session.workspaceId !== workspaceId) {
|
|
849
1628
|
const record = dormant().find((candidate) => candidate.sessionId === sessionId && candidate.workspaceId === workspaceId);
|
|
850
1629
|
if (suffix === "" && request.method === "DELETE" && record !== void 0 && options.removeDormantSession !== void 0) {
|
|
851
|
-
|
|
852
|
-
await options.headlessHub.closeSession(record.sessionId, { keepDormant: true });
|
|
853
|
-
await options.removeDormantSession(record);
|
|
854
|
-
options.headlessHub.notifySessionRemoved(record.sessionId);
|
|
1630
|
+
await removeSession(record.sessionId, () => options.removeDormantSession(record));
|
|
855
1631
|
json(response, 200, { ok: true });
|
|
856
1632
|
return;
|
|
857
1633
|
}
|
|
@@ -863,12 +1639,7 @@ async function serveHeadlessServer(options) {
|
|
|
863
1639
|
return;
|
|
864
1640
|
}
|
|
865
1641
|
if (suffix === "" && request.method === "DELETE") {
|
|
866
|
-
|
|
867
|
-
await options.headlessHub.closeSession(sessionId, options.removeSessionFiles ? { keepDormant: true } : void 0);
|
|
868
|
-
if (options.removeSessionFiles) {
|
|
869
|
-
await options.removeSessionFiles(sessionId);
|
|
870
|
-
options.headlessHub.notifySessionRemoved(sessionId);
|
|
871
|
-
}
|
|
1642
|
+
await removeSession(sessionId, options.removeSessionFiles ? () => options.removeSessionFiles(sessionId) : void 0);
|
|
872
1643
|
json(response, 200, { ok: true });
|
|
873
1644
|
return;
|
|
874
1645
|
}
|
|
@@ -893,7 +1664,18 @@ async function serveHeadlessServer(options) {
|
|
|
893
1664
|
return;
|
|
894
1665
|
}
|
|
895
1666
|
if (suffix === "/file" && request.method === "GET") {
|
|
896
|
-
|
|
1667
|
+
const forwarded = new Headers();
|
|
1668
|
+
for (const name of ["range", "if-match"]) {
|
|
1669
|
+
const value = request.headers[name];
|
|
1670
|
+
if (typeof value === "string") forwarded.set(name, value);
|
|
1671
|
+
}
|
|
1672
|
+
const target = new URL("http://po.local/");
|
|
1673
|
+
const requested = url.searchParams.get("path");
|
|
1674
|
+
if (requested !== null) target.searchParams.set("path", requested);
|
|
1675
|
+
await writeResponse(response, await options.headlessHub.requestApi({
|
|
1676
|
+
scope: "session",
|
|
1677
|
+
sessionId
|
|
1678
|
+
}, require_sessionFiles.SESSION_FILES_API, new Request(target, { headers: forwarded })));
|
|
897
1679
|
return;
|
|
898
1680
|
}
|
|
899
1681
|
if (suffix === "/attachments" && request.method === "POST") {
|
|
@@ -905,7 +1687,7 @@ async function serveHeadlessServer(options) {
|
|
|
905
1687
|
json(response, 413, { error: "The attachment exceeds the 8 MB upload limit." });
|
|
906
1688
|
return;
|
|
907
1689
|
}
|
|
908
|
-
json(response, 201, await require_index.writeSessionAttachment(sessionId, url.searchParams.get("name") ?? "file", bytes));
|
|
1690
|
+
json(response, 201, await require_index$1.writeSessionAttachment(sessionId, url.searchParams.get("name") ?? "file", bytes, options.environment ?? {}));
|
|
909
1691
|
return;
|
|
910
1692
|
}
|
|
911
1693
|
if (suffix === "/restart" && request.method === "POST" && options.restartSession) {
|
|
@@ -945,15 +1727,49 @@ async function serveHeadlessServer(options) {
|
|
|
945
1727
|
const mount = require_packageApi.parsePoSocketPath(requestPath(request).pathname);
|
|
946
1728
|
if (!mount) return 404;
|
|
947
1729
|
if (!authorized(request, options.token)) return 401;
|
|
948
|
-
if (mount.scope !== "
|
|
1730
|
+
if (mount.scope !== "host" && (!options.headlessHub.workspaces().some((entry) => entry.id === mount.workspaceId && entry.available !== false) || mount.scope === "session" && options.headlessHub.session(mount.sessionId)?.workspaceId !== mount.workspaceId)) return 404;
|
|
1731
|
+
const metadata = require_codec.poClientMetadataFrom({ query: requestPath(request).searchParams });
|
|
1732
|
+
const actor = actorOf(request);
|
|
1733
|
+
if (actor.kind === "refused") return 401;
|
|
949
1734
|
return {
|
|
950
1735
|
mount,
|
|
951
|
-
|
|
952
|
-
|
|
1736
|
+
...options.humanInputAttribution === false ? {} : { humanActor: actor },
|
|
1737
|
+
client: metadata.status === "ok" ? metadata.metadata : void 0,
|
|
1738
|
+
authorizeSession: (id) => sessionAccess.permits(actor, id, "view") && (!options.headlessHub.computerUse?.ownsSession?.(id) || computerUseAuthorized(id, request)),
|
|
1739
|
+
authorizeInteract: (id) => sessionAccess.permits(actor, id, "interact"),
|
|
1740
|
+
authorizeHost: () => actor.kind === "host",
|
|
1741
|
+
current: () => sessionAccess.current(actor),
|
|
1742
|
+
authorizeComputerUse: (id) => computerUseAuthorized(id, request) || actor.kind === "host" && options.headlessHub.computerUse?.approvalOf?.(id) !== void 0,
|
|
953
1743
|
authorizeDesktop: () => desktopAuthorized(request)
|
|
954
1744
|
};
|
|
955
1745
|
};
|
|
956
1746
|
server.on("upgrade", (request, socket, head) => {
|
|
1747
|
+
const networkUrl = requestPath(request);
|
|
1748
|
+
if (/^\/api\/networks\/[^/]+\/relay$/.test(networkUrl.pathname) && options.acceptNetworkRelay) {
|
|
1749
|
+
if (closed) {
|
|
1750
|
+
socket.destroy();
|
|
1751
|
+
return;
|
|
1752
|
+
}
|
|
1753
|
+
publicSockets.handleUpgrade(request, socket, head, (client) => {
|
|
1754
|
+
client.on("error", (error) => {
|
|
1755
|
+
options.onNotice?.(`Network relay socket failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
1756
|
+
client.close();
|
|
1757
|
+
});
|
|
1758
|
+
options.acceptNetworkRelay(apiSocket(client), networkUrl).catch((error) => {
|
|
1759
|
+
options.onNotice?.(`Network relay failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
1760
|
+
client.close();
|
|
1761
|
+
});
|
|
1762
|
+
});
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
const publicRoute = publicRouteFor(networkUrl);
|
|
1766
|
+
if (publicRoute !== void 0) {
|
|
1767
|
+
upgradePublicRoute(request, socket, head, publicRoute).catch((error) => {
|
|
1768
|
+
options.onNotice?.(`Public socket upgrade failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`);
|
|
1769
|
+
socket.destroy();
|
|
1770
|
+
});
|
|
1771
|
+
return;
|
|
1772
|
+
}
|
|
957
1773
|
const access = accessFor(request);
|
|
958
1774
|
if (typeof access === "number" || closed) {
|
|
959
1775
|
if (access === 401) socket.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
|
|
@@ -965,7 +1781,9 @@ async function serveHeadlessServer(options) {
|
|
|
965
1781
|
const entry = { socket: client };
|
|
966
1782
|
clients.add(entry);
|
|
967
1783
|
client.on("close", () => clients.delete(entry));
|
|
968
|
-
|
|
1784
|
+
client.on("error", (error) => options.onNotice?.(`Protocol socket failed: ${error.message}`));
|
|
1785
|
+
if (access.client) options.clientDevices?.observe(access.client).catch((error) => options.onNotice?.(`Client observation failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`));
|
|
1786
|
+
protocol.accept(require_protocolContracts.webSocketLink(client, { waitForPeer: true }), access);
|
|
969
1787
|
});
|
|
970
1788
|
});
|
|
971
1789
|
await new Promise((resolve, reject) => {
|
|
@@ -979,8 +1797,8 @@ async function serveHeadlessServer(options) {
|
|
|
979
1797
|
}
|
|
980
1798
|
return {
|
|
981
1799
|
url: `http://${options.host ?? "127.0.0.1"}:${address.port}`,
|
|
982
|
-
sessionReservations: sessionMcp.reservations,
|
|
983
|
-
acceptProtocol(pathname, link, headers) {
|
|
1800
|
+
...sessionMcp ? { sessionReservations: sessionMcp.reservations } : {},
|
|
1801
|
+
acceptProtocol(pathname, link, headers, client, policy) {
|
|
984
1802
|
const access = accessFor({
|
|
985
1803
|
url: pathname,
|
|
986
1804
|
headers: {
|
|
@@ -989,26 +1807,46 @@ async function serveHeadlessServer(options) {
|
|
|
989
1807
|
}
|
|
990
1808
|
});
|
|
991
1809
|
if (typeof access === "number" || closed) {
|
|
992
|
-
link.close(
|
|
1810
|
+
link.close();
|
|
993
1811
|
return false;
|
|
994
1812
|
}
|
|
995
|
-
|
|
1813
|
+
if (policy === "cloud-chat" && access.mount.scope !== "session") {
|
|
1814
|
+
link.close();
|
|
1815
|
+
return false;
|
|
1816
|
+
}
|
|
1817
|
+
const base = client ? {
|
|
1818
|
+
...access,
|
|
1819
|
+
client
|
|
1820
|
+
} : access;
|
|
1821
|
+
const admitted = policy === "cloud-chat" ? {
|
|
1822
|
+
...base,
|
|
1823
|
+
cloudChat: true,
|
|
1824
|
+
authorizeHost: () => false,
|
|
1825
|
+
authorizeDesktop: () => false,
|
|
1826
|
+
authorizeComputerUse: () => false
|
|
1827
|
+
} : base;
|
|
1828
|
+
if (admitted.client) options.clientDevices?.observe(admitted.client).catch((error) => options.onNotice?.(`Client observation failed: ${require_harnessErrorMessage.harnessErrorMessage(error)}`));
|
|
1829
|
+
protocol.accept(link, admitted);
|
|
996
1830
|
return true;
|
|
997
1831
|
},
|
|
1832
|
+
reauthorize: () => protocol.reauthorize(),
|
|
1833
|
+
reaches: (stamps, sessionId) => sessionAccess.permits(sessionAccess.actorFrom(new Headers(stamps)), sessionId, "view"),
|
|
998
1834
|
async close() {
|
|
999
1835
|
if (closed) return;
|
|
1000
1836
|
closed = true;
|
|
1001
1837
|
for (const client of clients) client.socket.terminate();
|
|
1002
1838
|
clients.clear();
|
|
1003
|
-
sessionMcp
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1839
|
+
await sessionMcp?.close();
|
|
1840
|
+
try {
|
|
1841
|
+
await options.clientDevices?.flush();
|
|
1842
|
+
} finally {
|
|
1843
|
+
await protocol.close();
|
|
1844
|
+
webSockets.close();
|
|
1845
|
+
for (const socket of publicSockets.clients) socket.terminate();
|
|
1846
|
+
publicSockets.close();
|
|
1847
|
+
server.closeAllConnections();
|
|
1848
|
+
await new Promise((resolve, reject) => server.close((error) => error === void 0 ? resolve() : reject(error)));
|
|
1849
|
+
}
|
|
1012
1850
|
}
|
|
1013
1851
|
};
|
|
1014
1852
|
}
|