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