@agimon-ai/po-core 0.0.0-alpha.21 → 0.0.0-alpha.210
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
|
@@ -1,36 +1,55 @@
|
|
|
1
1
|
import { piAgentDirectory } from "../../../services/piSettings/core.mjs";
|
|
2
|
+
import { canonicalLocale, personLocaleLine } from "../../../schemas/locale.mjs";
|
|
2
3
|
import { PO_AGENT_MODEL_ENTRY_TYPE } from "../../../schemas/agentModel.mjs";
|
|
3
|
-
import {
|
|
4
|
+
import { readPoServerScope } from "../../../schemas/serverScope.mjs";
|
|
5
|
+
import { isApprovalUnavailable } from "../../../services/approvalGate/index.mjs";
|
|
6
|
+
import { PO_BACKGROUND_WORK_CHANGED_EVENT, PO_BACKGROUND_WORK_SERVICE, awaitsCompletion, readPoBackgroundWorkService } from "../../../schemas/backgroundWork.mjs";
|
|
4
7
|
import "../../../../backgroundWork.mjs";
|
|
5
8
|
import { CHATGPT_AUTH_PROVIDER_ID } from "../../../services/chatgptAuth/index.mjs";
|
|
6
9
|
import { PO_CHILD_SESSION_HOOKS_SERVICE, PO_CHILD_SESSION_HOOK_REGISTRY_SERVICE, PO_CHILD_SESSION_MCP_TOOL_SERVICE, PO_CHILD_SESSION_SERVICE } from "../../child/types/childSession.mjs";
|
|
10
|
+
import { PO_CODEMODE_SERVICE, readPoCodemode } from "../../../schemas/codemode.mjs";
|
|
11
|
+
import "../../../../codemode.mjs";
|
|
12
|
+
import { PO_CONTEXT_CONTRIBUTIONS_SERVICE } from "../../../schemas/contextContributions.mjs";
|
|
13
|
+
import { createPoContextContributionsService } from "../../../services/contextContributions/index.mjs";
|
|
7
14
|
import { registerPoSessionEnvironment } from "../../../../runtimeCordisHost.mjs";
|
|
8
15
|
import "../../../../cordisHost.mjs";
|
|
9
|
-
import { PoHeadlessPromptAdmissionError, isPoHeadlessToolModelVisible } from "../../../schemas/headless.mjs";
|
|
16
|
+
import { PoHeadlessPromptAdmissionError, dropInvalidImages, isPoHeadlessToolModelVisible } from "../../../schemas/headless.mjs";
|
|
17
|
+
import "../../../../headless.mjs";
|
|
18
|
+
import { PO_HELP_WHEN } from "../../../schemas/help.mjs";
|
|
19
|
+
import { PO_CONTEXT_ENTRY_TYPE, assertPackageEntryType, findRetiredSessionEntries, projectContext, readProjectedSelection } from "../../../../contextProjection.mjs";
|
|
10
20
|
import { SessionMetadataDoc } from "../../../services/durableSession/docs.mjs";
|
|
21
|
+
import { durableEntriesNewestFirst, findNewestDurableEntry } from "../../../services/transcriptPages/index.mjs";
|
|
22
|
+
import { parseStoredBot } from "../../../schemas/hubChannel.mjs";
|
|
23
|
+
import "../../../../hubChannel.mjs";
|
|
11
24
|
import { validationDetails } from "../../../../runtimeProtocol.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
25
|
+
import { PO_PERSON_LOCALE_SERVICE, readPoLang } from "../../../schemas/lang.mjs";
|
|
26
|
+
import { readPoIsolate } from "../../../schemas/platform.mjs";
|
|
27
|
+
import { readPoHumanIdentity } from "../../../schemas/humanIdentity.mjs";
|
|
28
|
+
import { isOwnerSelected } from "../../../schemas/serverBundle.mjs";
|
|
29
|
+
import { PO_SESSION_ARTIFACT_DIR, PO_SESSION_TEMP_DIR, prepareSessionEnvironment } from "../../../services/sessionFiles/index.mjs";
|
|
30
|
+
import { removeContextDetail, writeContextDetail } from "../../../../contextDetailStore.mjs";
|
|
31
|
+
import { observe } from "../../../../serverTelemetry.mjs";
|
|
32
|
+
import { formatSkillForSystemPrompt } from "../../../services/skillPrompt/index.mjs";
|
|
33
|
+
import { HeadlessHost, describeSkillTool, headlessHarnessSkill, systemPromptSkills } from "./headlessHost.mjs";
|
|
34
|
+
import { PO_PERSON_TIME_ZONE_SERVICE, isTimeZone, personTimeZoneLine } from "../../../schemas/personTimeZone.mjs";
|
|
35
|
+
import { PO_WORKFLOW_CONTEXT_SERVICE, readPoWorkflowProfileAdmission } from "../../../schemas/workflow.mjs";
|
|
14
36
|
import { abandonSubagent } from "../../../services/durableSubagents/index.mjs";
|
|
37
|
+
import { createToolContinuation, isBashSequenceEnvelope } from "../../../services/toolContinuation/index.mjs";
|
|
15
38
|
import { createDirectHarnessRuntime } from "../../../server/directHarnessRuntime.mjs";
|
|
16
39
|
import { harnessErrorMessage } from "../../../server/harnessErrorMessage.mjs";
|
|
17
40
|
import { createChatgptImageClient } from "../../../services/chatgptImages/index.mjs";
|
|
18
41
|
import { createChatgptWebSearchClient } from "../../../services/chatgptWebSearch/index.mjs";
|
|
19
42
|
import { buildContextDetail } from "../../../../contextDetail.mjs";
|
|
20
|
-
import { removeContextDetail, writeContextDetail } from "../../../../contextDetailStore.mjs";
|
|
21
|
-
import { PO_CONTEXT_ENTRY_TYPE, projectContext } from "../../../../contextProjection.mjs";
|
|
22
43
|
import { createHeadlessClient } from "../../../services/headlessClient/index.mjs";
|
|
23
44
|
import { createNodeModelDependencies } from "../../../services/nodeModelDependencies/index.mjs";
|
|
24
45
|
import { validateDirectHeadlessArgs } from "../../../services/piArgs/index.mjs";
|
|
25
46
|
import { summarize } from "../../../services/piSummary/index.mjs";
|
|
26
|
-
import { observe } from "../../../../serverTelemetry.mjs";
|
|
27
|
-
import { PO_SESSION_TEMP_DIR, prepareSessionEnvironment } from "../../../services/sessionFiles/index.mjs";
|
|
28
47
|
import { formatToolPrompt } from "../../../services/toolPrompt/index.mjs";
|
|
29
48
|
import { composeChildSessionHooks, createHeadlessChildSessionServiceProvider, createPoChildSessionHookRegistry } from "../../child/adapters/headlessChildSessionService.mjs";
|
|
30
|
-
import { randomUUID } from "node:crypto";
|
|
49
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
31
50
|
import path from "node:path";
|
|
32
|
-
import { Value } from "typebox/value";
|
|
33
51
|
import { BACKGROUND_CONTEXT, withAbortSignal } from "@earendil-works/chord/context";
|
|
52
|
+
import { Value } from "typebox/value";
|
|
34
53
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
35
54
|
import { createAssistantMessageEventStream, isContextOverflow } from "@earendil-works/pi-ai";
|
|
36
55
|
import { clampMaxTokensToContext } from "@earendil-works/pi-ai/api/simple-options";
|
|
@@ -38,27 +57,82 @@ import { clampMaxTokensToContext } from "@earendil-works/pi-ai/api/simple-option
|
|
|
38
57
|
const EXTERNAL_OPERATION = "external";
|
|
39
58
|
const REMOTE_TOOL_WAIT_MS = 3e4;
|
|
40
59
|
const PROMPT_PREPARATION_FAILED_EVENT = "po_server.system_prompt_preparation_failed";
|
|
60
|
+
const MAX_AUXILIARY_IMAGES = 4;
|
|
61
|
+
const MAX_AUXILIARY_IMAGE_BYTES = 5242880;
|
|
62
|
+
const AUXILIARY_IMAGE_TYPES = /* @__PURE__ */ new Set([
|
|
63
|
+
"image/png",
|
|
64
|
+
"image/jpeg",
|
|
65
|
+
"image/webp"
|
|
66
|
+
]);
|
|
67
|
+
/** Slash commands renamed away, so they fail with the new name instead of reaching the model as text. */
|
|
68
|
+
const RETIRED_COMMANDS = { minor: "mode" };
|
|
41
69
|
function isRecord(value) {
|
|
42
70
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
43
71
|
}
|
|
44
|
-
|
|
45
|
-
|
|
72
|
+
/**
|
|
73
|
+
* A section key for a name, inside pi-durable's `[a-z0-9_-]` key alphabet. Any other character, `_` included,
|
|
74
|
+
* becomes `_<hex>_`, so two names never share a key and kebab-case names stay readable.
|
|
75
|
+
*/
|
|
76
|
+
function sectionName(name) {
|
|
77
|
+
return name.replace(/[^a-z0-9-]/gu, (char) => `_${char.codePointAt(0).toString(16)}_`);
|
|
78
|
+
}
|
|
79
|
+
/** The section of one skill, context resource or mode, so one plugin adding or removing it never resends the rest. */
|
|
80
|
+
const promptSection = {
|
|
81
|
+
skill: (name) => `po-skill-${sectionName(name)}`,
|
|
82
|
+
context: (name) => `po-context-${sectionName(name)}`,
|
|
83
|
+
mode: (name) => `po-mode-${sectionName(name)}`
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Context resources as prompt sections, in resource order; a name repeated by another package is numbered.
|
|
87
|
+
*
|
|
88
|
+
* Deliberately unwrapped. A generic "this is data, not instructions" fence here would also wrap
|
|
89
|
+
* po/profile-config, which carries the operator's persona and *is* authoritative instruction, and demoting it
|
|
90
|
+
* would be worse than the anonymity it fixes. A resource whose body is untrusted owns its own boundary, the way
|
|
91
|
+
* po-goal fences a user objective in escaped <goal_objective>.
|
|
92
|
+
*/
|
|
93
|
+
function contextSections(resources) {
|
|
94
|
+
const seen = /* @__PURE__ */ new Map();
|
|
95
|
+
return resources.filter((resource) => resource.kind !== "skill" && resource.kind !== "prompt").map((resource) => {
|
|
96
|
+
const count = (seen.get(resource.name) ?? 0) + 1;
|
|
97
|
+
seen.set(resource.name, count);
|
|
98
|
+
const key = promptSection.context(resource.name);
|
|
99
|
+
return [count === 1 ? key : `${key}_${count}`, resource.text];
|
|
100
|
+
});
|
|
46
101
|
}
|
|
47
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Every committed section the prompt can fill for these resources, base sections first. Listing one that stays empty
|
|
104
|
+
* is harmless: a section with no text is never shown. Mode sections are not listed: they ride each request's tail.
|
|
105
|
+
*/
|
|
106
|
+
function systemPromptSectionKeys(resources) {
|
|
107
|
+
return [
|
|
108
|
+
"po",
|
|
109
|
+
"po-tools",
|
|
110
|
+
...new Set(resources.filter(({ kind }) => kind === "skill").map(({ name }) => promptSection.skill(name))),
|
|
111
|
+
...contextSections(resources).map(([key]) => key),
|
|
112
|
+
"po-session",
|
|
113
|
+
"po-hooks"
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Restores the last accepted live selection from journal projections, falling back on launch configuration.
|
|
118
|
+
* Saved state keys come back too, such as approved plugins and extensions; a key the launch sets, like `mode`, wins.
|
|
119
|
+
*/
|
|
48
120
|
function restoreHeadlessSelection(entries, fallback) {
|
|
49
121
|
let projected;
|
|
50
122
|
for (let index = entries.length - 1; index >= 0 && projected === void 0; index -= 1) {
|
|
51
123
|
const entry = entries[index];
|
|
52
124
|
if (!isRecord(entry) || entry.type !== "custom" || !isRecord(entry.data)) continue;
|
|
53
125
|
if (projected === void 0 && entry.customType === "po-context") {
|
|
54
|
-
const selection = entry.data
|
|
55
|
-
if (
|
|
56
|
-
const domains = stringArray(selection.domains);
|
|
57
|
-
if (domains === void 0 || selection.profile !== void 0 && typeof selection.profile !== "string") continue;
|
|
126
|
+
const selection = readProjectedSelection(entry.data);
|
|
127
|
+
if (selection === void 0) continue;
|
|
58
128
|
projected = {
|
|
59
|
-
|
|
60
|
-
domains,
|
|
61
|
-
|
|
129
|
+
preset: selection.preset,
|
|
130
|
+
domains: selection.domains,
|
|
131
|
+
profile: selection.profile,
|
|
132
|
+
...selection.state === void 0 ? {} : { state: {
|
|
133
|
+
...selection.state,
|
|
134
|
+
...fallback.state
|
|
135
|
+
} }
|
|
62
136
|
};
|
|
63
137
|
}
|
|
64
138
|
}
|
|
@@ -73,7 +147,7 @@ function isJsonValue(value) {
|
|
|
73
147
|
if (Array.isArray(value)) return value.every(isJsonValue);
|
|
74
148
|
return isRecord(value) && Object.values(value).every(isJsonValue);
|
|
75
149
|
}
|
|
76
|
-
function
|
|
150
|
+
function assertJsonMessageData(value) {
|
|
77
151
|
const seen = /* @__PURE__ */ new Set();
|
|
78
152
|
const visit = (item, depth) => {
|
|
79
153
|
if (depth > 128) throw new TypeError("Message data is too deeply nested.");
|
|
@@ -85,8 +159,13 @@ function boundedJsonCopy(value) {
|
|
|
85
159
|
seen.delete(item);
|
|
86
160
|
};
|
|
87
161
|
visit(value, 0);
|
|
162
|
+
}
|
|
163
|
+
const MAX_MESSAGE_CHARACTERS = 16777216;
|
|
164
|
+
const MAX_CANONICAL_MESSAGE_CHARACTERS = 268435456;
|
|
165
|
+
function boundedJsonCopy(value, limit = MAX_MESSAGE_CHARACTERS) {
|
|
166
|
+
assertJsonMessageData(value);
|
|
88
167
|
const encoded = JSON.stringify(value);
|
|
89
|
-
if (encoded.length >
|
|
168
|
+
if (encoded.length > limit) throw new TypeError("Message data exceeds the serialization limit.");
|
|
90
169
|
return JSON.parse(encoded);
|
|
91
170
|
}
|
|
92
171
|
function isSummaryMessage(value) {
|
|
@@ -186,30 +265,21 @@ function modelMetadata(model) {
|
|
|
186
265
|
api: model.api,
|
|
187
266
|
name: model.name,
|
|
188
267
|
...baseUrl ? { baseUrl } : {},
|
|
189
|
-
compat: Object.freeze(compat)
|
|
268
|
+
compat: Object.freeze(compat),
|
|
269
|
+
input: Object.freeze([...model.input])
|
|
190
270
|
});
|
|
191
271
|
}
|
|
192
272
|
function mapResources(resources) {
|
|
193
273
|
const skills = [];
|
|
194
|
-
const advertised = [];
|
|
195
274
|
const promptTemplates = [];
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
const skill = headlessHarnessSkill(resource);
|
|
199
|
-
skills.push(skill);
|
|
200
|
-
if (resource.path !== void 0 && !advertised.some((entry) => entry.name === skill.name)) advertised.push(skill);
|
|
201
|
-
} else if (resource.kind === "prompt") promptTemplates.push({
|
|
275
|
+
for (const resource of resources) if (resource.kind === "skill") skills.push(headlessHarnessSkill(resource));
|
|
276
|
+
else if (resource.kind === "prompt") promptTemplates.push({
|
|
202
277
|
name: resource.name,
|
|
203
278
|
content: resource.text
|
|
204
279
|
});
|
|
205
|
-
else context.push(resource.text);
|
|
206
280
|
return {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
promptTemplates
|
|
210
|
-
},
|
|
211
|
-
context,
|
|
212
|
-
advertised
|
|
281
|
+
skills,
|
|
282
|
+
promptTemplates
|
|
213
283
|
};
|
|
214
284
|
}
|
|
215
285
|
function toolAdapter(tool, executionContext, reportedErrors) {
|
|
@@ -222,14 +292,20 @@ function toolAdapter(tool, executionContext, reportedErrors) {
|
|
|
222
292
|
...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines },
|
|
223
293
|
...tool.executionMode === void 0 ? {} : { executionMode: tool.executionMode === "parallel" ? "parallel" : "sequential" },
|
|
224
294
|
async execute(toolCallId, parameters, onUpdate, _toolContext, _invocation, context) {
|
|
295
|
+
const continuation = _invocation?.toolContinuation;
|
|
225
296
|
const result = await tool.execute(toolCallId, parameters, context.abortSignal, (partial) => onUpdate({
|
|
226
297
|
content: partial.content,
|
|
227
298
|
details: partial.details
|
|
228
|
-
}),
|
|
229
|
-
|
|
299
|
+
}), {
|
|
300
|
+
...executionContext(),
|
|
301
|
+
...continuation ? { toolContinuation: continuation } : {}
|
|
302
|
+
});
|
|
303
|
+
const sequence = isBashSequenceEnvelope(tool.name, parameters);
|
|
304
|
+
if (result.isError === true && !sequence) reportedErrors.add(toolCallId);
|
|
230
305
|
return {
|
|
231
|
-
content: result.content,
|
|
232
|
-
details: result.details
|
|
306
|
+
content: dropInvalidImages(result.content),
|
|
307
|
+
details: result.details,
|
|
308
|
+
...sequence && result.isError === true ? { isError: true } : {}
|
|
233
309
|
};
|
|
234
310
|
}
|
|
235
311
|
};
|
|
@@ -252,13 +328,15 @@ function eventHook(event) {
|
|
|
252
328
|
navigation_end: "session_tree"
|
|
253
329
|
}[event];
|
|
254
330
|
}
|
|
255
|
-
function emitTo(listeners, frame) {
|
|
331
|
+
function emitTo(listeners, frame, onError) {
|
|
256
332
|
const snapshot = [...listeners];
|
|
257
333
|
for (const listener of snapshot) try {
|
|
258
334
|
listener(frame);
|
|
259
|
-
} catch {
|
|
335
|
+
} catch (error) {
|
|
336
|
+
onError(error);
|
|
337
|
+
}
|
|
260
338
|
}
|
|
261
|
-
function createHeadlessCompositionPublisher(runtime, host, environment, groups, readSystemPrompt, alive) {
|
|
339
|
+
function createHeadlessCompositionPublisher(runtime, host, environment, groups, readSystemPrompt, readRequestedProfile, alive) {
|
|
262
340
|
let countTokens;
|
|
263
341
|
let contextRevision = 0;
|
|
264
342
|
let publishedContext;
|
|
@@ -275,10 +353,11 @@ function createHeadlessCompositionPublisher(runtime, host, environment, groups,
|
|
|
275
353
|
};
|
|
276
354
|
const context = projectContext({
|
|
277
355
|
revision: contextRevision + 1,
|
|
278
|
-
|
|
279
|
-
...selection.profile === void 0 ? {} : { profile: selection.profile },
|
|
356
|
+
preset: selection.preset,
|
|
357
|
+
...selection.profile === void 0 ? { requestedProfile: readRequestedProfile() } : { profile: selection.profile },
|
|
280
358
|
groups: groups(selection),
|
|
281
359
|
domains: selection.domains,
|
|
360
|
+
...selection.state === void 0 ? {} : { state: selection.state },
|
|
282
361
|
sources: inventory.sources,
|
|
283
362
|
skills: inventory.skills,
|
|
284
363
|
attribution: inventory.attribution,
|
|
@@ -354,6 +433,17 @@ async function repositoryInstructions(platform, repoRoot, agentDir, files) {
|
|
|
354
433
|
await env.cleanup(BACKGROUND_CONTEXT);
|
|
355
434
|
}
|
|
356
435
|
}
|
|
436
|
+
/** A workflow's instructions file. Unreadable fails the step session rather than running it without them. */
|
|
437
|
+
async function readWorkflowInstructions(platform, cwd, filePath) {
|
|
438
|
+
const env = platform.env(cwd);
|
|
439
|
+
try {
|
|
440
|
+
const result = await env.readTextFile(filePath, BACKGROUND_CONTEXT);
|
|
441
|
+
if (!result.ok) throw new Error(`Workflow instructions ${filePath} could not be read: ${result.error.message}`, { cause: result.error });
|
|
442
|
+
return result.value;
|
|
443
|
+
} finally {
|
|
444
|
+
await env.cleanup(BACKGROUND_CONTEXT);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
357
447
|
/** Create the gated, same-process host used by direct-headless startup tests. */
|
|
358
448
|
/**
|
|
359
449
|
* Composes one server session's host.
|
|
@@ -362,6 +452,9 @@ async function repositoryInstructions(platform, repoRoot, agentDir, files) {
|
|
|
362
452
|
* registered under its id for them to read instead of `process.env`, and released with it.
|
|
363
453
|
*/
|
|
364
454
|
async function createHeadlessSessionHost(options) {
|
|
455
|
+
if (options.workflowContext !== void 0 && (options.parentSessionId !== options.workflowContext.run.ownerSessionId || options.sessionProvenance !== "workflow")) throw new Error("Workflow context requires a step session owned by its workflow session.");
|
|
456
|
+
if (options.resume === true && options.sessionProvenance === "workflow" && options.workflowContext === void 0) throw new Error("Workflow step sessions cannot be resumed without their creation-only workflow context.");
|
|
457
|
+
const initialEnvironment = options.environment;
|
|
365
458
|
let releaseEnvironment;
|
|
366
459
|
try {
|
|
367
460
|
options = {
|
|
@@ -372,6 +465,7 @@ async function createHeadlessSessionHost(options) {
|
|
|
372
465
|
return await composeHeadlessSessionHost(options, releaseEnvironment);
|
|
373
466
|
} catch (error) {
|
|
374
467
|
removeContextDetail(options.sessionId, options.environment);
|
|
468
|
+
if (initialEnvironment !== options.environment) removeContextDetail(options.sessionId, initialEnvironment);
|
|
375
469
|
releaseEnvironment?.();
|
|
376
470
|
throw error;
|
|
377
471
|
}
|
|
@@ -379,8 +473,13 @@ async function createHeadlessSessionHost(options) {
|
|
|
379
473
|
async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
380
474
|
const parsed = validateDirectHeadlessArgs(options.agentArgs);
|
|
381
475
|
const models = await (options.modelDependencies ?? createNodeModelDependencies)(options);
|
|
382
|
-
const { agentDir, modelRuntime
|
|
476
|
+
const { agentDir, modelRuntime } = models;
|
|
383
477
|
const { platform } = options;
|
|
478
|
+
const workflowInstructions = options.workflowContext?.instructions;
|
|
479
|
+
const projectContextFiles = workflowInstructions === void 0 ? models.projectContextFiles : [{
|
|
480
|
+
path: workflowInstructions,
|
|
481
|
+
content: await readWorkflowInstructions(platform, options.cwd, workflowInstructions)
|
|
482
|
+
}];
|
|
384
483
|
const instructions = await repositoryInstructions(platform, options.repoRoot, agentDir, projectContextFiles);
|
|
385
484
|
for (const override of options.providerOverrides?.() ?? []) {
|
|
386
485
|
if (!override.name.trim() || override.name !== override.name.trim()) throw new Error("Invalid native provider identity.");
|
|
@@ -389,12 +488,18 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
389
488
|
if (modelRuntime.getRegisteredNativeProvider(override.name)) continue;
|
|
390
489
|
modelRuntime.registerProvider(override.name, { baseUrl: override.baseUrl });
|
|
391
490
|
}
|
|
491
|
+
try {
|
|
492
|
+
await options.registerModelProviders?.(modelRuntime);
|
|
493
|
+
} catch (error) {
|
|
494
|
+
options.onNotice?.(`Consumer model providers failed to register: ${harnessErrorMessage(error)}`);
|
|
495
|
+
}
|
|
392
496
|
const resolved = await models.resolveModel(parsed);
|
|
393
497
|
if (parsed.apiKey !== void 0) await modelRuntime.setRuntimeApiKey(resolved.model.provider, parsed.apiKey);
|
|
394
498
|
const reportedToolErrors = /* @__PURE__ */ new Set();
|
|
395
499
|
let promptPreparationFailed = false;
|
|
396
500
|
let promptPreparationError;
|
|
397
501
|
let headlessReady = false;
|
|
502
|
+
let sessionStarted = false;
|
|
398
503
|
let toolGuidance = [];
|
|
399
504
|
const initialSystemPrompt = [parsed.systemPrompt, ...parsed.appendSystemPrompt ?? []].filter(Boolean).join("\n\n");
|
|
400
505
|
/**
|
|
@@ -402,7 +507,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
402
507
|
*
|
|
403
508
|
* The server had none of this: its prompt began at the --system-prompt flag, so a
|
|
404
509
|
* repository's own instructions reached a terminal session and never a cockpit one.
|
|
405
|
-
* Mirrors @earendil-works/pi-coding-agent@0.86.0 dist/core/system-prompt.js:21-27
|
|
510
|
+
* Mirrors @earendil-works/pi-coding-agent@0.86.0 dist/core/system-prompt.js:21-27 (earendil-deps-ignore)
|
|
406
511
|
* (the customPrompt branch, which is the shape this host matches). `buildSystemPrompt`
|
|
407
512
|
* is not exported and the package exports map has no wildcard, so the four literals
|
|
408
513
|
* below are copied; re-diff them against that file on upgrade.
|
|
@@ -421,6 +526,200 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
421
526
|
return `<project_context>\n\nProject-specific instructions and guidelines:\n\n${projectContextFiles.map(({ path: filePath, content }) => `<project_instructions path="${filePath}">\n${content}\n</project_instructions>\n`).join("\n")}\n</project_context>`;
|
|
422
527
|
})();
|
|
423
528
|
const workingDirectoryLine = `Current working directory: ${options.cwd.replace(/\\/g, "/")}`;
|
|
529
|
+
let deviceTimeZone;
|
|
530
|
+
let profileTimeZone;
|
|
531
|
+
let deviceLocale;
|
|
532
|
+
const readPersonTimeZone = () => profileTimeZone !== void 0 ? {
|
|
533
|
+
timeZone: profileTimeZone,
|
|
534
|
+
source: "profile"
|
|
535
|
+
} : deviceTimeZone !== void 0 ? {
|
|
536
|
+
timeZone: deviceTimeZone,
|
|
537
|
+
source: "device"
|
|
538
|
+
} : void 0;
|
|
539
|
+
const personTimeZone = {
|
|
540
|
+
read: readPersonTimeZone,
|
|
541
|
+
setProfile(timeZone) {
|
|
542
|
+
profileTimeZone = isTimeZone(timeZone) ? timeZone : void 0;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
const { countTokens } = await import("gpt-tokenizer");
|
|
546
|
+
let promptSnapshot;
|
|
547
|
+
let promptTexts = {};
|
|
548
|
+
const contribution = (entries, section, owner, text, start = 0, operation = "base") => {
|
|
549
|
+
entries.push({
|
|
550
|
+
id: `contribution-${entries.length + 1}`,
|
|
551
|
+
section,
|
|
552
|
+
owner,
|
|
553
|
+
operation,
|
|
554
|
+
attribution: owner.sources.length > 1 ? "shared" : "exact",
|
|
555
|
+
span: {
|
|
556
|
+
start,
|
|
557
|
+
end: start + text.length
|
|
558
|
+
},
|
|
559
|
+
tokens: countTokens(text)
|
|
560
|
+
});
|
|
561
|
+
};
|
|
562
|
+
const savePrompt = (texts, entries, stage) => {
|
|
563
|
+
const visible = Object.entries(texts).filter(([, text]) => text);
|
|
564
|
+
if (promptSnapshot?.stage === stage && JSON.stringify(promptTexts) === JSON.stringify(Object.fromEntries(visible)) && JSON.stringify(promptSnapshot.contributions) === JSON.stringify(entries)) return;
|
|
565
|
+
const previous = new Map(promptSnapshot?.sections.map((section) => [section.key, section.fingerprint]));
|
|
566
|
+
promptTexts = Object.fromEntries(visible);
|
|
567
|
+
promptSnapshot = {
|
|
568
|
+
revision: (promptSnapshot?.revision ?? 0) + 1,
|
|
569
|
+
stage,
|
|
570
|
+
estimator: "gpt-tokenizer",
|
|
571
|
+
totalTokens: countTokens(visible.map(([, text]) => text).join("\n\n")),
|
|
572
|
+
sections: visible.map(([key, text]) => {
|
|
573
|
+
const fingerprint = createHash("sha256").update(text).digest("hex");
|
|
574
|
+
return {
|
|
575
|
+
key,
|
|
576
|
+
placement: key.startsWith(promptSection.mode("")) ? "request-tail" : "committed",
|
|
577
|
+
fingerprint,
|
|
578
|
+
tokens: countTokens(text),
|
|
579
|
+
changed: previous.get(key) !== fingerprint
|
|
580
|
+
};
|
|
581
|
+
}),
|
|
582
|
+
removed: [...previous.keys()].filter((key) => !Object.hasOwn(promptTexts, key)),
|
|
583
|
+
contributions: entries
|
|
584
|
+
};
|
|
585
|
+
};
|
|
586
|
+
const inspectPrompt = () => {
|
|
587
|
+
if (!headlessHost) return void 0;
|
|
588
|
+
if (builtSystemPrompt === void 0) {
|
|
589
|
+
const entries = [];
|
|
590
|
+
const parts = composeSystemPromptParts(headlessHost.appliedResources, entries);
|
|
591
|
+
savePrompt(parts, entries, "base");
|
|
592
|
+
}
|
|
593
|
+
return structuredClone(promptSnapshot);
|
|
594
|
+
};
|
|
595
|
+
const readPromptText = (input) => {
|
|
596
|
+
const snapshot = inspectPrompt();
|
|
597
|
+
if (snapshot?.revision !== input.revision) return void 0;
|
|
598
|
+
if (input.contribution !== void 0) {
|
|
599
|
+
const entry = snapshot.contributions.find(({ id }) => id === input.contribution);
|
|
600
|
+
return entry?.span ? promptTexts[entry.section]?.slice(entry.span.start, entry.span.end) : void 0;
|
|
601
|
+
}
|
|
602
|
+
return input.section === void 0 ? void 0 : promptTexts[input.section];
|
|
603
|
+
};
|
|
604
|
+
const previewPrompt = (input) => {
|
|
605
|
+
const snapshot = inspectPrompt();
|
|
606
|
+
if (snapshot?.revision !== input.revision) return void 0;
|
|
607
|
+
const rejected = [];
|
|
608
|
+
const edits = /* @__PURE__ */ new Map();
|
|
609
|
+
for (const change of input.changes) {
|
|
610
|
+
const entry = snapshot.contributions.find(({ id }) => id === change.contribution);
|
|
611
|
+
const previous = entry ? edits.get(entry.section) ?? [] : [];
|
|
612
|
+
const span = entry?.span;
|
|
613
|
+
const reason = !span ? "Contribution span unavailable" : change.operation === "replace" && typeof change.text !== "string" ? "Replacement text required" : previous.some((edit) => span.start < edit.end && span.end > edit.start) ? "Overlapping contribution changes" : void 0;
|
|
614
|
+
if (reason) {
|
|
615
|
+
rejected.push({
|
|
616
|
+
contribution: change.contribution,
|
|
617
|
+
reason
|
|
618
|
+
});
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
previous.push({
|
|
622
|
+
...span,
|
|
623
|
+
text: change.operation === "exclude" ? "" : change.text
|
|
624
|
+
});
|
|
625
|
+
edits.set(entry.section, previous);
|
|
626
|
+
}
|
|
627
|
+
const candidate = { ...promptTexts };
|
|
628
|
+
for (const [key, changes] of edits) for (const edit of changes.sort((a, b) => b.start - a.start)) candidate[key] = candidate[key].slice(0, edit.start) + edit.text + candidate[key].slice(edit.end);
|
|
629
|
+
const changed = snapshot.sections.filter(({ key }) => candidate[key] !== promptTexts[key]);
|
|
630
|
+
const totalTokens = countTokens(snapshot.sections.map(({ key }) => candidate[key]).filter(Boolean).join("\n\n"));
|
|
631
|
+
return {
|
|
632
|
+
revision: snapshot.revision,
|
|
633
|
+
totalTokens,
|
|
634
|
+
deltaTokens: totalTokens - snapshot.totalTokens,
|
|
635
|
+
sections: snapshot.sections.map(({ key, tokens }) => ({
|
|
636
|
+
key,
|
|
637
|
+
tokens: countTokens(candidate[key]),
|
|
638
|
+
deltaTokens: countTokens(candidate[key]) - tokens
|
|
639
|
+
})),
|
|
640
|
+
firstChangedCommitted: changed.find(({ placement }) => placement === "committed")?.key ?? null,
|
|
641
|
+
tailOnly: changed.length > 0 && changed.every(({ placement }) => placement === "request-tail"),
|
|
642
|
+
rejected
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
/** The base prompt as named parts, in prompt order. */
|
|
646
|
+
const composeSystemPromptParts = (resources, entries) => {
|
|
647
|
+
const hasLoader = toolGuidance.some((entry) => entry.name === "load_skill") || headlessHost?.hasSkillLoader() === true;
|
|
648
|
+
const skills = systemPromptSkills(resources, hasLoader).flatMap((resource) => {
|
|
649
|
+
const text = formatSkillForSystemPrompt(headlessHarnessSkill(resource), !hasLoader);
|
|
650
|
+
return text ? [[promptSection.skill(resource.name), text]] : [];
|
|
651
|
+
});
|
|
652
|
+
const join = (parts) => parts.filter(Boolean).join("\n\n");
|
|
653
|
+
const parts = {
|
|
654
|
+
po: join([initialSystemPrompt, projectContextBlock]),
|
|
655
|
+
"po-tools": formatToolPrompt(toolGuidance),
|
|
656
|
+
...Object.fromEntries(skills),
|
|
657
|
+
...Object.fromEntries(contextSections(resources)),
|
|
658
|
+
"po-session": join([
|
|
659
|
+
workingDirectoryLine,
|
|
660
|
+
personTimeZoneLine(readPersonTimeZone()),
|
|
661
|
+
personLocaleLine(deviceLocale),
|
|
662
|
+
options.environment["PO_SESSION_TEMP_DIR"] ? `Session temporary folder: ${options.environment[PO_SESSION_TEMP_DIR]}\nUse this folder for generated scratch files outside the workspace. Keep workspace edits in place and save important deliverables in session artifacts. Temporary files may be removed by the operating system.` : ""
|
|
663
|
+
])
|
|
664
|
+
};
|
|
665
|
+
if (entries) {
|
|
666
|
+
const core = {
|
|
667
|
+
kind: "core",
|
|
668
|
+
sources: ["@agimon-ai/po-core"],
|
|
669
|
+
name: null
|
|
670
|
+
};
|
|
671
|
+
for (const key of ["po", "po-session"]) if (parts[key]) contribution(entries, key, core, parts[key]);
|
|
672
|
+
const skillResources = systemPromptSkills(resources, hasLoader);
|
|
673
|
+
const resolvedSkills = new Map(skillResources.map((resource) => [promptSection.skill(resource.name), resource]));
|
|
674
|
+
for (const [key, resource] of resolvedSkills) {
|
|
675
|
+
const text = parts[key];
|
|
676
|
+
if (text) contribution(entries, key, {
|
|
677
|
+
kind: "resource",
|
|
678
|
+
sources: [resource.source],
|
|
679
|
+
name: resource.name
|
|
680
|
+
}, text);
|
|
681
|
+
}
|
|
682
|
+
const contexts = resources.filter((resource) => resource.kind !== "skill" && resource.kind !== "prompt");
|
|
683
|
+
contextSections(resources).forEach(([key, text], index) => {
|
|
684
|
+
const resource = contexts[index];
|
|
685
|
+
if (text) contribution(entries, key, {
|
|
686
|
+
kind: "resource",
|
|
687
|
+
sources: [resource.source],
|
|
688
|
+
name: resource.name
|
|
689
|
+
}, text);
|
|
690
|
+
});
|
|
691
|
+
const tools = headlessHost?.inspectCapabilities().capabilities.filter((entry) => entry.kind === "tool" && entry.active) ?? [];
|
|
692
|
+
const sources = (name) => tools.filter((entry) => entry.name === name).map((entry) => entry.source);
|
|
693
|
+
let offset = 17;
|
|
694
|
+
for (const tool of toolGuidance.filter((entry) => (entry.promptSnippet ?? "").trim())) {
|
|
695
|
+
const text = `- ${tool.name}: ${tool.promptSnippet}`;
|
|
696
|
+
contribution(entries, "po-tools", {
|
|
697
|
+
kind: "tool",
|
|
698
|
+
sources: sources(tool.name),
|
|
699
|
+
name: tool.name
|
|
700
|
+
}, text, offset);
|
|
701
|
+
offset += text.length + 1;
|
|
702
|
+
}
|
|
703
|
+
const guidelines = [...new Set(toolGuidance.flatMap((tool) => tool.promptGuidelines ?? []).filter((line) => line.trim()))];
|
|
704
|
+
offset = (toolGuidance.some((tool) => (tool.promptSnippet ?? "").trim()) ? offset + 1 : 0) + 12;
|
|
705
|
+
for (const line of guidelines) {
|
|
706
|
+
const owners = toolGuidance.filter((tool) => tool.promptGuidelines?.includes(line));
|
|
707
|
+
const text = `- ${line}`;
|
|
708
|
+
contribution(entries, "po-tools", {
|
|
709
|
+
kind: "tool",
|
|
710
|
+
sources: [...new Set(owners.flatMap((tool) => sources(tool.name)))],
|
|
711
|
+
name: owners.length === 1 ? owners[0].name : null
|
|
712
|
+
}, text, offset);
|
|
713
|
+
if (owners.length > 1) entries[entries.length - 1] = {
|
|
714
|
+
...entries.at(-1),
|
|
715
|
+
attribution: "shared"
|
|
716
|
+
};
|
|
717
|
+
offset += text.length + 1;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
return parts;
|
|
721
|
+
};
|
|
722
|
+
const joinPromptSections = (sections) => Object.values(sections).filter(Boolean).join("\n\n");
|
|
424
723
|
/**
|
|
425
724
|
* Everything the prompt is made of before a package has had a say.
|
|
426
725
|
*
|
|
@@ -428,19 +727,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
428
727
|
* pure; the hook pass that follows it there is not, which is why the context
|
|
429
728
|
* panel is shown this rather than a prompt built for the panel's sake.
|
|
430
729
|
*/
|
|
431
|
-
const composeSystemPrompt = (resources) =>
|
|
432
|
-
const mapped = mapResources(resources);
|
|
433
|
-
const skills = toolGuidance.some((entry) => entry.name === "load_skill") ? "" : formatSkillsForSystemPrompt(mapped.advertised).trim();
|
|
434
|
-
return [
|
|
435
|
-
initialSystemPrompt,
|
|
436
|
-
projectContextBlock,
|
|
437
|
-
formatToolPrompt(toolGuidance),
|
|
438
|
-
skills,
|
|
439
|
-
...mapped.context,
|
|
440
|
-
workingDirectoryLine,
|
|
441
|
-
options.environment["PO_SESSION_TEMP_DIR"] ? `Session temporary folder: ${options.environment[PO_SESSION_TEMP_DIR]}\nUse this folder for generated scratch files outside the workspace. Keep workspace edits in place and save important deliverables in session artifacts. Temporary files may be removed by the operating system.` : ""
|
|
442
|
-
].filter(Boolean).join("\n\n");
|
|
443
|
-
};
|
|
730
|
+
const composeSystemPrompt = (resources) => joinPromptSections(composeSystemPromptParts(resources));
|
|
444
731
|
/** The last prompt a turn actually built, once one has. */
|
|
445
732
|
let builtSystemPrompt;
|
|
446
733
|
/**
|
|
@@ -466,6 +753,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
466
753
|
};
|
|
467
754
|
const beforeTool = async (event, context) => {
|
|
468
755
|
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
756
|
+
if (isBashSequenceEnvelope(event.toolName, event.args)) return void 0;
|
|
469
757
|
const patches = await headlessHost.dispatchHook("tool_call", event, context.abortSignal);
|
|
470
758
|
let args = event.args;
|
|
471
759
|
let block;
|
|
@@ -490,6 +778,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
490
778
|
};
|
|
491
779
|
const afterTool = async (event, context) => {
|
|
492
780
|
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
781
|
+
if (isBashSequenceEnvelope(event.toolName, event.args)) return void 0;
|
|
493
782
|
const original = reportedToolErrors.delete(event.toolCallId) ? {
|
|
494
783
|
...event,
|
|
495
784
|
isError: true
|
|
@@ -531,9 +820,41 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
531
820
|
};
|
|
532
821
|
};
|
|
533
822
|
const selectionCommand = new AsyncLocalStorage();
|
|
823
|
+
let headlessHost;
|
|
534
824
|
const runtime = await createDirectHarnessRuntime({
|
|
825
|
+
resolveHumanIdentity: (actor) => mcpServiceRoot ? readPoHumanIdentity(mcpServiceRoot)?.resolve(actor) ?? Promise.resolve(void 0) : Promise.resolve(void 0),
|
|
826
|
+
systemPromptSections: () => headlessHost ? systemPromptSectionKeys(headlessHost.appliedResources) : [],
|
|
827
|
+
isTailSection: (key) => key.startsWith(promptSection.mode("")),
|
|
828
|
+
onSystemPromptOrder: (keys) => {
|
|
829
|
+
if (!promptSnapshot) return;
|
|
830
|
+
const sections = keys.flatMap((key) => promptSnapshot.sections.filter((section) => section.key === key));
|
|
831
|
+
promptSnapshot = {
|
|
832
|
+
...promptSnapshot,
|
|
833
|
+
sections,
|
|
834
|
+
totalTokens: countTokens(sections.map(({ key }) => promptTexts[key]).join("\n\n"))
|
|
835
|
+
};
|
|
836
|
+
},
|
|
535
837
|
cwd: options.cwd,
|
|
536
838
|
sessionId: options.sessionId,
|
|
839
|
+
onFullHistoryRead: (sessionId, entryCount) => {
|
|
840
|
+
observe(Promise.resolve().then(() => options.telemetry?.recordEvent?.("po_server.history_full_read", {
|
|
841
|
+
session_id: sessionId,
|
|
842
|
+
entry_count: entryCount
|
|
843
|
+
})));
|
|
844
|
+
},
|
|
845
|
+
onQueueDiagnostics: (diagnostics) => {
|
|
846
|
+
if (diagnostics.max_depth < 8 && diagnostics.duration_ms < 100 && diagnostics.max_estimated_bytes < 1e6) return;
|
|
847
|
+
observe(Promise.resolve().then(() => options.telemetry?.recordEvent?.("po_server.streaming_queue", diagnostics)));
|
|
848
|
+
},
|
|
849
|
+
onStatsScan: (sessionId, entryCount, pageCount, durationMs, outcome) => {
|
|
850
|
+
observe(Promise.resolve().then(() => options.telemetry?.recordEvent?.("po_server.stats_scan", {
|
|
851
|
+
session_id: sessionId,
|
|
852
|
+
entry_count: entryCount,
|
|
853
|
+
page_count: pageCount,
|
|
854
|
+
duration_ms: durationMs,
|
|
855
|
+
outcome
|
|
856
|
+
})));
|
|
857
|
+
},
|
|
537
858
|
...options.initialFastMode === void 0 ? {} : { initialFastMode: options.initialFastMode },
|
|
538
859
|
...options.initialAgentLocked === void 0 ? {} : { initialAgentLocked: options.initialAgentLocked },
|
|
539
860
|
...options.parentSessionId === void 0 ? {} : { parentSessionId: options.parentSessionId },
|
|
@@ -543,6 +864,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
543
864
|
models: modelRuntime,
|
|
544
865
|
model: resolved.model,
|
|
545
866
|
...resolved.thinkingLevel === void 0 ? {} : { thinkingLevel: resolved.thinkingLevel },
|
|
867
|
+
operationModelPrompt: options.operationModelPrompt,
|
|
546
868
|
beforeModelRequest: async ({ phase }) => {
|
|
547
869
|
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
548
870
|
if (phase === "turn" && options.inheritedSelection) await headlessHost.inheritSelection(await options.inheritedSelection());
|
|
@@ -616,20 +938,83 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
616
938
|
let stage = "resources";
|
|
617
939
|
try {
|
|
618
940
|
if (!headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
619
|
-
|
|
620
|
-
|
|
941
|
+
const entries = [];
|
|
942
|
+
const base = composeSystemPromptParts(await headlessHost.readResources(), entries);
|
|
943
|
+
let prompt = joinPromptSections(base);
|
|
944
|
+
const appended = /* @__PURE__ */ new Map([["po-hooks", ""]]);
|
|
945
|
+
let rewritten = false;
|
|
621
946
|
stage = "before_agent_start hooks";
|
|
622
|
-
|
|
623
|
-
|
|
947
|
+
await headlessHost.dispatchHook("before_agent_start", { systemPrompt: prompt }, void 0, (hook, patch, source) => {
|
|
948
|
+
if (!isRecord(patch) || typeof patch.systemPrompt !== "string") return;
|
|
949
|
+
if (patch.systemPrompt.startsWith(prompt)) {
|
|
950
|
+
const text = patch.systemPrompt.slice(prompt.length);
|
|
951
|
+
const attribution = hook.when?.attribution;
|
|
952
|
+
const key = attribution?.kind === "mode" && attribution.name ? promptSection.mode(attribution.name) : "po-hooks";
|
|
953
|
+
const section = rewritten ? "po" : key;
|
|
954
|
+
const start = rewritten ? prompt.length : (appended.get(key) ?? "").length;
|
|
955
|
+
contribution(entries, section, {
|
|
956
|
+
kind: "hook",
|
|
957
|
+
sources: [source],
|
|
958
|
+
name: hook.name ?? null
|
|
959
|
+
}, text, start, "append");
|
|
960
|
+
appended.set(key, (appended.get(key) ?? "") + text);
|
|
961
|
+
} else {
|
|
962
|
+
rewritten = true;
|
|
963
|
+
for (let index = 0; index < entries.length; index++) entries[index] = {
|
|
964
|
+
...entries[index],
|
|
965
|
+
attribution: "unavailable",
|
|
966
|
+
span: null
|
|
967
|
+
};
|
|
968
|
+
contribution(entries, "po", {
|
|
969
|
+
kind: "hook",
|
|
970
|
+
sources: [source],
|
|
971
|
+
name: hook.name ?? null
|
|
972
|
+
}, patch.systemPrompt, 0, "rewrite");
|
|
973
|
+
}
|
|
974
|
+
prompt = patch.systemPrompt;
|
|
975
|
+
});
|
|
976
|
+
const sections = rewritten ? { po: prompt } : Object.fromEntries([...Object.entries(base), ...[...appended].map(([key, text]) => [key, text.trim()])].filter(([, text]) => text));
|
|
977
|
+
if (!rewritten) for (let index = 0; index < entries.length; index++) {
|
|
978
|
+
const entry = entries[index];
|
|
979
|
+
if (entry.operation !== "append" || !entry.span) continue;
|
|
980
|
+
const raw = appended.get(entry.section) ?? "";
|
|
981
|
+
const leading = raw.length - raw.trimStart().length;
|
|
982
|
+
const length = sections[entry.section]?.length ?? 0;
|
|
983
|
+
entries[index] = {
|
|
984
|
+
...entry,
|
|
985
|
+
span: {
|
|
986
|
+
start: Math.min(length, Math.max(0, entry.span.start - leading)),
|
|
987
|
+
end: Math.min(length, Math.max(0, entry.span.end - leading))
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
for (let index = 0; index < entries.length; index++) {
|
|
992
|
+
const entry = entries[index];
|
|
993
|
+
if (entry.span) entries[index] = {
|
|
994
|
+
...entry,
|
|
995
|
+
tokens: countTokens((sections[entry.section] ?? "").slice(entry.span.start, entry.span.end))
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
const expectedIdentity = options.workflowContext?.identity;
|
|
999
|
+
if (expectedIdentity !== void 0) {
|
|
1000
|
+
stage = "workflow profile admission";
|
|
1001
|
+
const admission = mcpServiceRoot === void 0 ? void 0 : readPoWorkflowProfileAdmission(mcpServiceRoot);
|
|
1002
|
+
if (admission === void 0) throw new Error("Workflow identity admission requires a po-profile version that provides po/workflow-profile-admission. Upgrade po-profile, then reopen this session.");
|
|
1003
|
+
await admission.assertReady(expectedIdentity);
|
|
1004
|
+
}
|
|
1005
|
+
savePrompt(sections, entries, "effective");
|
|
624
1006
|
promptPreparationFailed = false;
|
|
625
1007
|
promptPreparationError = void 0;
|
|
626
1008
|
if (prompt !== builtSystemPrompt) {
|
|
627
1009
|
builtSystemPrompt = prompt;
|
|
628
1010
|
try {
|
|
629
1011
|
await publishComposition();
|
|
630
|
-
} catch {
|
|
1012
|
+
} catch (error) {
|
|
1013
|
+
if (options.onNotice) options.onNotice(`Composition publication failed: ${harnessErrorMessage(error)}`);
|
|
1014
|
+
else throw error;
|
|
1015
|
+
}
|
|
631
1016
|
}
|
|
632
|
-
return
|
|
1017
|
+
return sections;
|
|
633
1018
|
} catch (error) {
|
|
634
1019
|
promptPreparationFailed = true;
|
|
635
1020
|
promptPreparationError = error;
|
|
@@ -644,7 +1029,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
644
1029
|
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
645
1030
|
return headlessHost.listCommands();
|
|
646
1031
|
},
|
|
647
|
-
dispatchCommand: async (text) => {
|
|
1032
|
+
dispatchCommand: async (text, clientMetadata) => {
|
|
648
1033
|
if (!headlessReady || !headlessHost) throw new Error("Headless capabilities are not installed.");
|
|
649
1034
|
const match = /^\/(\S+)(?:\s+([\s\S]*))?$/.exec(text);
|
|
650
1035
|
if (!match) {
|
|
@@ -654,16 +1039,19 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
654
1039
|
}
|
|
655
1040
|
const name = match[1];
|
|
656
1041
|
const args = match[2] ?? "";
|
|
1042
|
+
if (!headlessHost.status.ready) await headlessHost.settled();
|
|
657
1043
|
if (!headlessHost.listCommands().some((entry) => entry.name === name)) {
|
|
658
1044
|
headlessHost.assertActive();
|
|
1045
|
+
const renamed = Object.hasOwn(RETIRED_COMMANDS, name) ? RETIRED_COMMANDS[name] : void 0;
|
|
1046
|
+
if (renamed !== void 0) throw new Error(`/${name} was renamed to /${renamed}`);
|
|
659
1047
|
return false;
|
|
660
1048
|
}
|
|
661
1049
|
await selectionCommand.run([
|
|
662
|
-
"
|
|
1050
|
+
"preset",
|
|
663
1051
|
"domains",
|
|
664
1052
|
"profile",
|
|
665
|
-
"
|
|
666
|
-
].includes(name), () => headlessHost.dispatchCommand(name, args));
|
|
1053
|
+
"mode"
|
|
1054
|
+
].includes(name), () => headlessHost.dispatchCommand(name, args, clientMetadata));
|
|
667
1055
|
return true;
|
|
668
1056
|
},
|
|
669
1057
|
guardModelRequest: () => {
|
|
@@ -682,16 +1070,20 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
682
1070
|
groupingRoot: options.groupingRoot ?? options.repoRoot,
|
|
683
1071
|
parentSessionId: options.parentSessionId,
|
|
684
1072
|
sessionProvenance: options.sessionProvenance,
|
|
1073
|
+
interaction: options.interaction,
|
|
685
1074
|
files: {
|
|
686
1075
|
agentDirectory: path.resolve(piAgentDirectory(options.environment, options.platform.homeDirectory)),
|
|
687
|
-
...options.environment["PO_SESSION_TEMP_DIR"] === void 0 ? {} : { temporaryDirectory: options.environment[PO_SESSION_TEMP_DIR] }
|
|
1076
|
+
...options.environment["PO_SESSION_TEMP_DIR"] === void 0 ? {} : { temporaryDirectory: options.environment[PO_SESSION_TEMP_DIR] },
|
|
1077
|
+
...options.environment["PO_SESSION_ARTIFACT_DIR"] === void 0 ? {} : { artifactDirectory: options.environment[PO_SESSION_ARTIFACT_DIR] }
|
|
688
1078
|
}
|
|
689
1079
|
});
|
|
690
1080
|
}, BACKGROUND_CONTEXT);
|
|
691
1081
|
const agent = await runtime.lane.agent(BACKGROUND_CONTEXT);
|
|
1082
|
+
const model = agent.model ? modelRuntime.getModel(agent.model.provider, agent.model.modelId) : void 0;
|
|
1083
|
+
const latest = await findNewestDurableEntry(runtime.scanEntries.bind(runtime), BACKGROUND_CONTEXT, (entry) => entry.type === "custom" && entry.customType === "po-context");
|
|
692
1084
|
return {
|
|
693
|
-
model
|
|
694
|
-
entries:
|
|
1085
|
+
model,
|
|
1086
|
+
entries: latest ? [latest] : []
|
|
695
1087
|
};
|
|
696
1088
|
})().catch(async (error) => {
|
|
697
1089
|
await runtime.dispose().catch((disposeError) => options.onNotice?.(`Session runtime failed to close: ${String(disposeError)}`));
|
|
@@ -706,7 +1098,8 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
706
1098
|
checkoutRoot: options.repoRoot,
|
|
707
1099
|
cwd: options.cwd,
|
|
708
1100
|
...options.parentSessionId === void 0 ? {} : { parentSessionId: options.parentSessionId },
|
|
709
|
-
...options.sessionProvenance === void 0 ? {} : { provenance: options.sessionProvenance }
|
|
1101
|
+
...options.sessionProvenance === void 0 ? {} : { provenance: options.sessionProvenance },
|
|
1102
|
+
...options.interaction === void 0 ? {} : { interaction: options.interaction }
|
|
710
1103
|
});
|
|
711
1104
|
const entries = opened.entries;
|
|
712
1105
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -716,7 +1109,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
716
1109
|
let backgroundWorkBinding;
|
|
717
1110
|
let latestSelection = options.selection;
|
|
718
1111
|
const initialSelection = restoreHeadlessSelection(entries, options.selection);
|
|
719
|
-
let
|
|
1112
|
+
let requestedProfile = options.requestedProfile;
|
|
720
1113
|
let mcpServiceRoot;
|
|
721
1114
|
let mcpLifecycle = new AbortController();
|
|
722
1115
|
const chatgptLifecycle = new AbortController();
|
|
@@ -724,16 +1117,21 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
724
1117
|
let client;
|
|
725
1118
|
let disposed = false;
|
|
726
1119
|
let disposePromise;
|
|
1120
|
+
let closeReason;
|
|
727
1121
|
let publishComposition = async () => {
|
|
728
1122
|
throw new Error("Direct headless composition publisher is not installed.");
|
|
729
1123
|
};
|
|
730
|
-
const
|
|
1124
|
+
const emitFrame = (frame) => emitTo(listeners, frame, (error) => {
|
|
1125
|
+
if (mcpServiceRoot) mcpServiceRoot.logger.warn("Session frame listener failed", error);
|
|
1126
|
+
else if (options.onNotice) options.onNotice(`Session frame listener failed: ${harnessErrorMessage(error)}`);
|
|
1127
|
+
else throw error;
|
|
1128
|
+
});
|
|
1129
|
+
const readAppliedContext = (signal) => {
|
|
731
1130
|
signal.throwIfAborted();
|
|
732
1131
|
const host = headlessHost;
|
|
733
1132
|
if (!host || disposed) throw new Error("Session context is unavailable.");
|
|
734
1133
|
const status = host.status;
|
|
735
1134
|
if (!status.ready || status.requestedRevision !== status.appliedRevision) throw new Error("Session context is unavailable.");
|
|
736
|
-
if (instructions instanceof Error) throw instructions;
|
|
737
1135
|
const selection = host.context.selection;
|
|
738
1136
|
const persona = host.appliedResources.find(({ name, kind }) => name === "po/profile-config" && kind === "context")?.text;
|
|
739
1137
|
signal.throwIfAborted();
|
|
@@ -751,18 +1149,28 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
751
1149
|
selection: {
|
|
752
1150
|
profile: selection.profile ?? null,
|
|
753
1151
|
domains: [...selection.domains],
|
|
754
|
-
|
|
1152
|
+
preset: selection.preset,
|
|
755
1153
|
activeLayers: [...selection.activeLayers],
|
|
756
|
-
|
|
1154
|
+
modes: [...selection.state?.["mode"] ?? []]
|
|
757
1155
|
},
|
|
758
|
-
instructions,
|
|
759
1156
|
persona: persona ?? null
|
|
760
1157
|
};
|
|
761
1158
|
};
|
|
1159
|
+
const readMcpContext = (signal) => {
|
|
1160
|
+
const snapshot = readAppliedContext(signal);
|
|
1161
|
+
if (instructions instanceof Error) throw instructions;
|
|
1162
|
+
return {
|
|
1163
|
+
...snapshot,
|
|
1164
|
+
instructions
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
let appliedChildTools = [];
|
|
1168
|
+
let bindChildTools = () => appliedChildTools;
|
|
762
1169
|
const childHookRegistry = createPoChildSessionHookRegistry();
|
|
763
|
-
const childSessionProvider = createHeadlessChildSessionServiceProvider({
|
|
1170
|
+
const childSessionProvider = (options.childSessions ?? createHeadlessChildSessionServiceProvider)({
|
|
764
1171
|
runtime,
|
|
765
1172
|
cwd: options.cwd,
|
|
1173
|
+
fs: platform.env(options.cwd),
|
|
766
1174
|
subscribeMcpTool: (listener) => {
|
|
767
1175
|
return mcpServiceRoot?.on("internal/service", (name) => {
|
|
768
1176
|
if (name === "po/child-session-mcp-tool") listener();
|
|
@@ -775,20 +1183,48 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
775
1183
|
mcpTool: () => {
|
|
776
1184
|
if (disposed || !headlessReady || !headlessHost?.status.ready) return void 0;
|
|
777
1185
|
return mcpServiceRoot?.get(PO_CHILD_SESSION_MCP_TOOL_SERVICE);
|
|
1186
|
+
},
|
|
1187
|
+
parentTools: () => {
|
|
1188
|
+
if (disposed || !headlessReady || !headlessHost?.status.ready) return void 0;
|
|
1189
|
+
return {
|
|
1190
|
+
tools: appliedChildTools,
|
|
1191
|
+
bindChild: bindChildTools,
|
|
1192
|
+
allows: (name) => headlessHost.allowsTool(name)
|
|
1193
|
+
};
|
|
778
1194
|
}
|
|
779
1195
|
});
|
|
1196
|
+
const settleHost = async () => {
|
|
1197
|
+
if (!disposed && headlessReady && !promptPreparationFailed && headlessHost?.status.ready === false) await headlessHost.settled();
|
|
1198
|
+
};
|
|
780
1199
|
const completeAuxiliaryModel = async (reference, request) => {
|
|
1200
|
+
await settleHost();
|
|
781
1201
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
782
1202
|
request.signal?.throwIfAborted();
|
|
783
1203
|
const separator = reference.indexOf("/");
|
|
784
1204
|
const model = separator > 0 ? modelRuntime.getModel(reference.slice(0, separator), reference.slice(separator + 1)) : void 0;
|
|
785
1205
|
if (!model || !modelRuntime.hasConfiguredAuth(model.provider)) throw new Error(`Model is not configured: ${reference}`);
|
|
786
1206
|
if (!runtime.completeModel) throw new Error("The runtime does not support auxiliary model requests.");
|
|
1207
|
+
const images = request.images ?? [];
|
|
1208
|
+
if (images.length > 0) {
|
|
1209
|
+
if (!model.input.includes("image")) throw new Error(`Model does not accept images: ${reference}`);
|
|
1210
|
+
if (images.length > MAX_AUXILIARY_IMAGES) throw new Error(`At most ${MAX_AUXILIARY_IMAGES} images per request.`);
|
|
1211
|
+
for (const image of images) {
|
|
1212
|
+
if (!AUXILIARY_IMAGE_TYPES.has(image.mimeType)) throw new Error(`Unsupported image type: ${image.mimeType}`);
|
|
1213
|
+
if (Math.ceil(image.data.length * .75) > MAX_AUXILIARY_IMAGE_BYTES) throw new Error("Image exceeds 5 MiB.");
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
787
1216
|
const response = await runtime.completeModel(model, {
|
|
788
1217
|
systemPrompt: request.systemPrompt,
|
|
789
1218
|
messages: [{
|
|
790
1219
|
role: "user",
|
|
791
|
-
content: request.input
|
|
1220
|
+
content: images.length === 0 ? request.input : [{
|
|
1221
|
+
type: "text",
|
|
1222
|
+
text: request.input
|
|
1223
|
+
}, ...images.map((image) => ({
|
|
1224
|
+
type: "image",
|
|
1225
|
+
data: image.data,
|
|
1226
|
+
mimeType: image.mimeType
|
|
1227
|
+
}))],
|
|
792
1228
|
timestamp: Date.now()
|
|
793
1229
|
}],
|
|
794
1230
|
...request.tools ? { tools: [...request.tools] } : {}
|
|
@@ -796,10 +1232,15 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
796
1232
|
signal: request.signal,
|
|
797
1233
|
maxTokens: request.maxTokens,
|
|
798
1234
|
cacheRetention: request.cacheRetention,
|
|
799
|
-
reasoningEffort: "none",
|
|
1235
|
+
reasoningEffort: model.reasoning && request.thinkingLevel && request.thinkingLevel !== "off" ? request.thinkingLevel : "none",
|
|
800
1236
|
maxRetries: 0
|
|
801
1237
|
});
|
|
1238
|
+
if (request.recordUsage) await runtime.recordUsage(response.usage, { details: {
|
|
1239
|
+
purpose: "auxiliary_completion",
|
|
1240
|
+
model: reference
|
|
1241
|
+
} });
|
|
802
1242
|
request.signal?.throwIfAborted();
|
|
1243
|
+
if (request.recordUsage && response.stopReason === "length") throw new Error("Auxiliary model request exceeded its output limit.");
|
|
803
1244
|
if (response.stopReason === "error" || response.stopReason === "aborted") throw new Error(response.errorMessage ?? `Model stopped: ${response.stopReason}`);
|
|
804
1245
|
return response;
|
|
805
1246
|
};
|
|
@@ -816,11 +1257,51 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
816
1257
|
timestamp: Date.now()
|
|
817
1258
|
};
|
|
818
1259
|
};
|
|
1260
|
+
async function* entriesNewestFirst(query) {
|
|
1261
|
+
const limit = query?.limit;
|
|
1262
|
+
if (limit !== void 0 && (!Number.isSafeInteger(limit) || limit < 0)) throw new TypeError("History limit must be a non-negative safe integer.");
|
|
1263
|
+
if (limit === 0) return;
|
|
1264
|
+
let count = 0;
|
|
1265
|
+
for await (const entry of durableEntriesNewestFirst(runtime.scanEntries.bind(runtime), BACKGROUND_CONTEXT)) {
|
|
1266
|
+
if (query?.type && entry.type !== query.type) continue;
|
|
1267
|
+
if (query?.customType && (entry.type !== "custom" || entry.customType !== query.customType)) continue;
|
|
1268
|
+
yield entry;
|
|
1269
|
+
if (++count === limit) return;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
819
1272
|
const executionContext = (selection) => ({
|
|
820
1273
|
cwd: options.cwd,
|
|
1274
|
+
readRuntimeSetup: () => {
|
|
1275
|
+
const snapshot = readAppliedContext(mcpLifecycle.signal);
|
|
1276
|
+
const loaded = mcpServiceRoot && readPoServerScope(mcpServiceRoot)?.loadedPackages?.();
|
|
1277
|
+
if (!loaded) throw new Error("Loaded session package identities are unavailable.");
|
|
1278
|
+
const isolate = mcpServiceRoot && readPoIsolate(mcpServiceRoot);
|
|
1279
|
+
const namespaces = mcpServiceRoot && isolate ? (readPoCodemode(mcpServiceRoot)?.list() ?? []).filter((namespace) => isolate.liveObjects || namespace.portable === true) : [];
|
|
1280
|
+
return {
|
|
1281
|
+
revision: snapshot.session.revision,
|
|
1282
|
+
selection: {
|
|
1283
|
+
...snapshot.selection,
|
|
1284
|
+
modes: snapshot.selection.modes ?? []
|
|
1285
|
+
},
|
|
1286
|
+
persona: snapshot.persona,
|
|
1287
|
+
packages: loaded.filter((entry) => headlessHost.isSourceActive(entry.packageName)),
|
|
1288
|
+
capabilities: [...headlessHost.inspectCapabilities().capabilities.filter((entry) => entry.active).map(({ source, name, kind }) => ({
|
|
1289
|
+
source,
|
|
1290
|
+
name,
|
|
1291
|
+
kind
|
|
1292
|
+
})), ...namespaces.map(({ name, declarations }) => ({
|
|
1293
|
+
source: PO_CODEMODE_SERVICE,
|
|
1294
|
+
name,
|
|
1295
|
+
kind: "namespace",
|
|
1296
|
+
declarations
|
|
1297
|
+
}))]
|
|
1298
|
+
};
|
|
1299
|
+
},
|
|
821
1300
|
repoRoot: options.repoRoot,
|
|
822
1301
|
sessionId: runtime.sessionId,
|
|
1302
|
+
isBotSession: async () => parseStoredBot((await runtime.session.snapshot(SessionMetadataDoc, BACKGROUND_CONTEXT))?.bot) !== void 0,
|
|
823
1303
|
...sessionContext === void 0 ? {} : { sessionContext },
|
|
1304
|
+
...options.interaction === void 0 ? {} : { interaction: options.interaction },
|
|
824
1305
|
environment: options.environment,
|
|
825
1306
|
client: client.client,
|
|
826
1307
|
model: currentModel === void 0 ? void 0 : modelMetadata(currentModel),
|
|
@@ -830,15 +1311,17 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
830
1311
|
},
|
|
831
1312
|
async getAvailableModels() {
|
|
832
1313
|
if (disposed) throw new Error("The session is closed.");
|
|
833
|
-
return (await modelRuntime.getAvailable()).filter((model) => modelRuntime.hasConfiguredAuth(model.provider)).map(({ provider, id }) => ({
|
|
1314
|
+
return (await modelRuntime.getAvailable()).filter((model) => modelRuntime.hasConfiguredAuth(model.provider)).map(({ provider, id, input }) => ({
|
|
834
1315
|
provider,
|
|
835
|
-
id
|
|
1316
|
+
id,
|
|
1317
|
+
input: [...input]
|
|
836
1318
|
}));
|
|
837
1319
|
},
|
|
838
1320
|
selection,
|
|
839
1321
|
imageGeneration: {
|
|
840
1322
|
available: () => !disposed && modelRuntime.isUsingSubscription("po-chatgpt"),
|
|
841
1323
|
async generate(request) {
|
|
1324
|
+
await settleHost();
|
|
842
1325
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
843
1326
|
return createChatgptImageClient({
|
|
844
1327
|
available: () => modelRuntime.isUsingSubscription(CHATGPT_AUTH_PROVIDER_ID),
|
|
@@ -852,6 +1335,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
852
1335
|
webSearch: {
|
|
853
1336
|
available: () => !disposed && modelRuntime.isUsingSubscription("po-chatgpt"),
|
|
854
1337
|
async search(request) {
|
|
1338
|
+
await settleHost();
|
|
855
1339
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
856
1340
|
return createChatgptWebSearchClient({
|
|
857
1341
|
available: () => modelRuntime.isUsingSubscription(CHATGPT_AUTH_PROVIDER_ID),
|
|
@@ -870,14 +1354,19 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
870
1354
|
return separator > 0 && !!modelRuntime.getModel(reference.slice(0, separator), reference.slice(separator + 1)) && modelRuntime.hasConfiguredAuth(reference.slice(0, separator));
|
|
871
1355
|
},
|
|
872
1356
|
async summarize(reference, request) {
|
|
1357
|
+
await settleHost();
|
|
873
1358
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
874
1359
|
request.signal?.throwIfAborted();
|
|
875
1360
|
const separator = reference.indexOf("/");
|
|
876
1361
|
const model = separator > 0 ? modelRuntime.getModel(reference.slice(0, separator), reference.slice(separator + 1)) : void 0;
|
|
877
1362
|
if (!model || !modelRuntime.hasConfiguredAuth(model.provider)) throw new Error(`Model is not configured: ${reference}`);
|
|
878
1363
|
if (!runtime.completeModel) throw new Error("The runtime does not support auxiliary model requests.");
|
|
879
|
-
|
|
880
|
-
if (!Array.isArray(messages) || !messages.every(isSummaryMessage)) throw new TypeError("Summary requests require supported native messages.");
|
|
1364
|
+
assertJsonMessageData(request.messages);
|
|
1365
|
+
if (!Array.isArray(request.messages) || !request.messages.every(isSummaryMessage)) throw new TypeError("Summary requests require supported native messages.");
|
|
1366
|
+
const messages = boundedJsonCopy(request.messages.map((message) => "content" in message && Array.isArray(message.content) ? {
|
|
1367
|
+
...message,
|
|
1368
|
+
content: message.content.filter((part) => !isRecord(part) || part.type !== "image" && part.type !== "thinking")
|
|
1369
|
+
} : message), MAX_CANONICAL_MESSAGE_CHARACTERS);
|
|
881
1370
|
if (typeof request.instructions !== "string" || request.previousSummary !== void 0 && typeof request.previousSummary !== "string") throw new TypeError("Summary instructions and previous summary must be strings.");
|
|
882
1371
|
if (request.thinkingLevel !== void 0 && ![
|
|
883
1372
|
"off",
|
|
@@ -891,6 +1380,16 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
891
1380
|
let summaryFailure;
|
|
892
1381
|
let overflowed = false;
|
|
893
1382
|
const attempt = (target) => summarize(messages, target, request.signal, request.instructions, request.previousSummary, request.thinkingLevel, (_model, context, options) => {
|
|
1383
|
+
const size = JSON.stringify(context).length;
|
|
1384
|
+
if (size > MAX_MESSAGE_CHARACTERS) {
|
|
1385
|
+
summaryFailure = Object.assign(/* @__PURE__ */ new RangeError("Summary input exceeds the serialization limit."), {
|
|
1386
|
+
code: "SUMMARY_INPUT_TOO_LARGE",
|
|
1387
|
+
phase: "summary_input",
|
|
1388
|
+
size,
|
|
1389
|
+
limit: MAX_MESSAGE_CHARACTERS
|
|
1390
|
+
});
|
|
1391
|
+
throw summaryFailure;
|
|
1392
|
+
}
|
|
894
1393
|
const stream = createAssistantMessageEventStream();
|
|
895
1394
|
const maxTokens = target.maxTokens > 0 ? clampMaxTokensToContext(target, context, target.maxTokens) : options?.maxTokens;
|
|
896
1395
|
runtime.completeModel(target, context, {
|
|
@@ -937,7 +1436,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
937
1436
|
summary = await attempt(model);
|
|
938
1437
|
} catch (error) {
|
|
939
1438
|
const widest = overflowed && !request.signal?.aborted ? (await modelRuntime.getAvailable()).reduce((best, item) => item.contextWindow > best.contextWindow ? item : best, model) : model;
|
|
940
|
-
if (widest === model) throw error;
|
|
1439
|
+
if (widest === model) throw summaryFailure ?? error;
|
|
941
1440
|
summaryFailure = void 0;
|
|
942
1441
|
summary = await attempt(widest);
|
|
943
1442
|
}
|
|
@@ -962,6 +1461,12 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
962
1461
|
};
|
|
963
1462
|
} },
|
|
964
1463
|
session: {
|
|
1464
|
+
get started() {
|
|
1465
|
+
return sessionStarted && !disposed;
|
|
1466
|
+
},
|
|
1467
|
+
get closeReason() {
|
|
1468
|
+
return closeReason;
|
|
1469
|
+
},
|
|
965
1470
|
setFastMode: (enabled) => runtime.setFastMode(enabled),
|
|
966
1471
|
async readModelSettings() {
|
|
967
1472
|
const selected = (await runtime.lane.agent(BACKGROUND_CONTEXT)).model;
|
|
@@ -977,46 +1482,60 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
977
1482
|
if (settings.thinkingLevel !== void 0) await runtime.setThinkingLevel(settings.thinkingLevel);
|
|
978
1483
|
},
|
|
979
1484
|
async forkSource() {
|
|
980
|
-
const {
|
|
981
|
-
return {
|
|
1485
|
+
for await (const entry of entriesNewestFirst({ limit: 1 })) return {
|
|
982
1486
|
kind: "fork",
|
|
983
|
-
|
|
1487
|
+
entryId: String(entry.id)
|
|
984
1488
|
};
|
|
1489
|
+
return { kind: "fork" };
|
|
985
1490
|
},
|
|
1491
|
+
entriesNewestFirst,
|
|
1492
|
+
customSnapshot: (customType, validator) => runtime.customSnapshot(customType, validator),
|
|
1493
|
+
tokenSnapshot: (customTypes) => runtime.tokenSnapshot(customTypes),
|
|
986
1494
|
entries: async (query) => {
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return entries;
|
|
1495
|
+
const entries = [];
|
|
1496
|
+
for await (const entry of entriesNewestFirst(query)) entries.push(entry);
|
|
1497
|
+
return query?.limit === void 0 ? entries.reverse() : entries;
|
|
990
1498
|
},
|
|
991
1499
|
async appendMessage(message) {
|
|
992
1500
|
return runtime.appendMessage(informationalMessage(message));
|
|
993
1501
|
},
|
|
994
|
-
async
|
|
1502
|
+
async appendMessageOnce(message, requestId) {
|
|
1503
|
+
if (disposed) throw new Error("The session is closed.");
|
|
1504
|
+
if (typeof requestId !== "string" || !requestId.trim()) throw new TypeError("Custom message requestId must be a non-empty string.");
|
|
1505
|
+
return runtime.appendMessage(informationalMessage(message), requestId);
|
|
1506
|
+
},
|
|
1507
|
+
async admitMessage(message, delivery = "followUp", requestId = randomUUID()) {
|
|
995
1508
|
try {
|
|
1509
|
+
await settleHost();
|
|
996
1510
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
997
|
-
if (delivery !== "steer" && delivery !== "followUp") throw new TypeError("Custom message delivery must be steer or
|
|
998
|
-
if (
|
|
1511
|
+
if (delivery !== "steer" && delivery !== "followUp" && delivery !== "nextTurn") throw new TypeError("Custom message delivery must be steer, followUp or nextTurn.");
|
|
1512
|
+
if (typeof requestId !== "string" || !requestId.trim()) throw new TypeError("Custom message requestId must be a non-empty string.");
|
|
999
1513
|
const submission = await runtime.submitInternalMessage(informationalMessage(message), delivery, requestId);
|
|
1000
1514
|
submission.settled.catch((error) => client.client.notify({
|
|
1001
1515
|
body: error instanceof Error ? error.message : String(error),
|
|
1002
1516
|
level: "error"
|
|
1003
1517
|
}));
|
|
1004
1518
|
if ("admitted" in submission) await submission.admitted;
|
|
1519
|
+
return {
|
|
1520
|
+
requestId,
|
|
1521
|
+
settled: submission.settled
|
|
1522
|
+
};
|
|
1005
1523
|
} catch (error) {
|
|
1006
1524
|
throw new PoHeadlessPromptAdmissionError(error);
|
|
1007
1525
|
}
|
|
1008
1526
|
},
|
|
1009
1527
|
registerCheckpointBoundary(callback) {
|
|
1010
1528
|
if (!runtime.registerCheckpointBoundary) throw new Error("Native checkpoint boundaries are unavailable.");
|
|
1529
|
+
const checkpointOptions = (options) => options?.resetContext && { resetContext: { retainedMessages: boundedJsonCopy(options.resetContext.retainedMessages) } };
|
|
1011
1530
|
const registration = runtime.registerCheckpointBoundary(async (boundary) => {
|
|
1012
1531
|
if (disposed || !headlessReady || !headlessHost?.status.ready) return;
|
|
1013
1532
|
await callback({
|
|
1014
1533
|
signal: boundary.signal,
|
|
1015
|
-
appendMessage: (message) => boundary.appendMessage(informationalMessage(message))
|
|
1534
|
+
appendMessage: (message, options) => boundary.appendMessage(informationalMessage(message), checkpointOptions(options))
|
|
1016
1535
|
});
|
|
1017
1536
|
});
|
|
1018
1537
|
return {
|
|
1019
|
-
appendMessage: (message) => disposed || !headlessReady || !headlessHost?.status.ready ? Promise.resolve(void 0) : registration.appendMessage(informationalMessage(message)),
|
|
1538
|
+
appendMessage: (message, options) => disposed || !headlessReady || !headlessHost?.status.ready ? Promise.resolve(void 0) : registration.appendMessage(informationalMessage(message), checkpointOptions(options)),
|
|
1020
1539
|
dispose: () => registration.dispose()
|
|
1021
1540
|
};
|
|
1022
1541
|
},
|
|
@@ -1025,12 +1544,12 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1025
1544
|
if (disposed || !headlessReady || promptPreparationFailed || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready.");
|
|
1026
1545
|
};
|
|
1027
1546
|
assertReadable();
|
|
1028
|
-
const messages = boundedJsonCopy(await runtime.getContextMessages());
|
|
1547
|
+
const messages = boundedJsonCopy(await runtime.getContextMessages(), MAX_CANONICAL_MESSAGE_CHARACTERS);
|
|
1029
1548
|
assertReadable();
|
|
1030
1549
|
return messages;
|
|
1031
1550
|
},
|
|
1032
1551
|
async contextUsage() {
|
|
1033
|
-
const usage =
|
|
1552
|
+
const usage = await runtime.getContextUsage();
|
|
1034
1553
|
return usage ? {
|
|
1035
1554
|
tokens: usage.tokens,
|
|
1036
1555
|
contextWindow: usage.contextWindow
|
|
@@ -1038,6 +1557,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1038
1557
|
},
|
|
1039
1558
|
setLabel: (entryId, label) => runtime.setLabel(entryId, label),
|
|
1040
1559
|
async appendCustomEntry(type, data) {
|
|
1560
|
+
assertPackageEntryType(type);
|
|
1041
1561
|
await runtime.appendCustomEntry(type, data);
|
|
1042
1562
|
},
|
|
1043
1563
|
async prompt(text, delivery) {
|
|
@@ -1056,26 +1576,32 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1056
1576
|
throw new PoHeadlessPromptAdmissionError(error);
|
|
1057
1577
|
}
|
|
1058
1578
|
},
|
|
1059
|
-
abort: () => runtime.abort(),
|
|
1579
|
+
abort: (expectedOperationId) => runtime.abort(expectedOperationId),
|
|
1060
1580
|
compact: (instructions) => runtime.compact(instructions),
|
|
1061
1581
|
async activity() {
|
|
1062
1582
|
const state = await runtime.readState();
|
|
1583
|
+
const isIdle = (!state.isStreaming || state.operationId === "settling") && !state.isCompacting;
|
|
1063
1584
|
return {
|
|
1064
1585
|
hasPendingMessages: Number(state.pendingMessageCount) > 0,
|
|
1065
|
-
isIdle
|
|
1586
|
+
isIdle,
|
|
1587
|
+
...isIdle || typeof state.operationId !== "string" ? {} : { operationId: state.operationId }
|
|
1066
1588
|
};
|
|
1067
1589
|
},
|
|
1068
1590
|
setName: (name) => runtime.setName(name)
|
|
1069
1591
|
},
|
|
1070
|
-
shutdown: () => stop()
|
|
1592
|
+
shutdown: () => options.requestShutdown ? options.requestShutdown() : stop()
|
|
1071
1593
|
});
|
|
1072
1594
|
client = createHeadlessClient({
|
|
1073
1595
|
appendCustomEntry: async (type, data) => {
|
|
1074
1596
|
await runtime.appendCustomEntry(type, data);
|
|
1075
1597
|
},
|
|
1076
|
-
emitFrame
|
|
1598
|
+
emitFrame
|
|
1599
|
+
});
|
|
1600
|
+
if (findRetiredSessionEntries(entries)) client.client.notify({
|
|
1601
|
+
body: (mcpServiceRoot && readPoLang(mcpServiceRoot))?.t(deviceLocale, "core.notifications.retiredSession", "This session was saved by an older Po. Its preset and modes were not restored. Choose them again with /preset and /mode.") ?? "This session was saved by an older Po. Its preset and modes were not restored. Choose them again with /preset and /mode.",
|
|
1602
|
+
level: "warning"
|
|
1077
1603
|
});
|
|
1078
|
-
const unsubscribePresentation = runtime.onPresentationFrame(
|
|
1604
|
+
const unsubscribePresentation = runtime.onPresentationFrame(emitFrame);
|
|
1079
1605
|
let logicalRunActive = false;
|
|
1080
1606
|
let runMessages = [];
|
|
1081
1607
|
let requiredServerPackages = [];
|
|
@@ -1159,7 +1685,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1159
1685
|
const nextUiResources = /* @__PURE__ */ new Map();
|
|
1160
1686
|
for (const loaded of options.mcpPlugins ?? []) {
|
|
1161
1687
|
const selection = headlessHost.context.selection;
|
|
1162
|
-
if (!loaded.declaration.owners.some((owner) =>
|
|
1688
|
+
if (!loaded.declaration.owners.some((owner) => isOwnerSelected(owner, selection))) continue;
|
|
1163
1689
|
const scope = typeof loaded.plugin.session === "function" ? await loaded.plugin.session(pluginContext) : loaded.plugin.session;
|
|
1164
1690
|
lifecycle.signal.throwIfAborted();
|
|
1165
1691
|
const resources = scope.uiResources ?? [];
|
|
@@ -1218,18 +1744,29 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1218
1744
|
};
|
|
1219
1745
|
const applyToolSurface = async (tools) => {
|
|
1220
1746
|
toolSurfaceReady = false;
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1747
|
+
const presence = {
|
|
1748
|
+
caller: "main",
|
|
1749
|
+
...options.interaction === void 0 ? {} : { interaction: options.interaction }
|
|
1750
|
+
};
|
|
1751
|
+
const modelTools = tools.filter((tool) => isPoHeadlessToolModelVisible(tool) && !isApprovalUnavailable(tool.approval, presence));
|
|
1752
|
+
const packageTools = modelTools.map((tool) => toolAdapter({
|
|
1223
1753
|
...tool,
|
|
1224
|
-
description:
|
|
1225
|
-
}
|
|
1754
|
+
description: describeSkillTool(tool, headlessHost?.appliedResources ?? [])
|
|
1755
|
+
}, () => ({
|
|
1756
|
+
...headlessHost.context,
|
|
1757
|
+
caller: "main"
|
|
1758
|
+
}), reportedToolErrors));
|
|
1226
1759
|
const packageNames = headlessHost?.declaredToolNames ?? new Set(packageTools.map((tool) => tool.name));
|
|
1227
1760
|
const piTools = (piHost?.tools ?? []).filter((tool) => !packageNames.has(tool.name) && headlessHost?.allowsTool(tool.name) !== false).map((tool) => ({
|
|
1228
1761
|
...tool,
|
|
1229
1762
|
async execute(...args) {
|
|
1230
1763
|
headlessHost.assertActive();
|
|
1231
1764
|
if (!toolSurfaceReady || !headlessHost.allowsTool(tool.name)) throw new Error(`Tool '${tool.name}' is no longer active`);
|
|
1232
|
-
|
|
1765
|
+
const result = await tool.execute(...args);
|
|
1766
|
+
return Array.isArray(result.content) ? {
|
|
1767
|
+
...result,
|
|
1768
|
+
content: dropInvalidImages(result.content)
|
|
1769
|
+
} : result;
|
|
1233
1770
|
}
|
|
1234
1771
|
}));
|
|
1235
1772
|
const piNames = new Set(piTools.map((tool) => tool.name));
|
|
@@ -1239,6 +1776,20 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1239
1776
|
...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines }
|
|
1240
1777
|
}))];
|
|
1241
1778
|
await runtime.replaceTools([...piTools, ...packageTools]);
|
|
1779
|
+
const borrowableModelTools = modelTools.filter((tool) => !tool.mainAgentOnly && !isApprovalUnavailable(tool.approval, { caller: "child" }));
|
|
1780
|
+
const adaptChild = (callerToolNames) => {
|
|
1781
|
+
const names = callerToolNames === void 0 ? void 0 : Object.freeze([...callerToolNames]);
|
|
1782
|
+
return borrowableModelTools.map((tool) => toolAdapter({
|
|
1783
|
+
...tool,
|
|
1784
|
+
description: describeSkillTool(tool, headlessHost?.appliedResources ?? [])
|
|
1785
|
+
}, () => ({
|
|
1786
|
+
...headlessHost.context,
|
|
1787
|
+
caller: "child",
|
|
1788
|
+
...names === void 0 ? {} : { callerToolNames: names }
|
|
1789
|
+
}), reportedToolErrors));
|
|
1790
|
+
};
|
|
1791
|
+
bindChildTools = adaptChild;
|
|
1792
|
+
appliedChildTools = adaptChild();
|
|
1242
1793
|
const next = /* @__PURE__ */ new Map();
|
|
1243
1794
|
for (const tool of piTools) next.set(tool.name, {
|
|
1244
1795
|
descriptor: {
|
|
@@ -1253,13 +1804,13 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1253
1804
|
descriptor: {
|
|
1254
1805
|
name: tool.name,
|
|
1255
1806
|
label: tool.label ?? tool.name,
|
|
1256
|
-
description: tool
|
|
1807
|
+
description: describeSkillTool(tool, headlessHost?.appliedResources ?? []),
|
|
1257
1808
|
parameters: tool.parameters,
|
|
1258
1809
|
...tool.annotations === void 0 ? {} : { annotations: tool.annotations },
|
|
1259
1810
|
...tool.outputSchema === void 0 ? {} : { outputSchema: tool.outputSchema },
|
|
1260
1811
|
...tool._meta === void 0 ? {} : { _meta: tool._meta }
|
|
1261
1812
|
},
|
|
1262
|
-
execute: (toolCallId, parameters, signal, onUpdate) => tool.execute(toolCallId, parameters, signal, onUpdate, headlessHost.context)
|
|
1813
|
+
execute: (toolCallId, parameters, signal, onUpdate, execution) => tool.execute(toolCallId, parameters, signal, onUpdate, execution ?? headlessHost.context)
|
|
1263
1814
|
});
|
|
1264
1815
|
toolGuidance = nextToolGuidance;
|
|
1265
1816
|
appliedSessionTools = next;
|
|
@@ -1293,8 +1844,11 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1293
1844
|
for (const listener of backgroundWorkListeners) listener(active);
|
|
1294
1845
|
};
|
|
1295
1846
|
let admittedToolSurface;
|
|
1847
|
+
let candidates = options.candidates;
|
|
1296
1848
|
const preparePackages = (root) => {
|
|
1297
1849
|
mcpServiceRoot = root;
|
|
1850
|
+
options.bindSessionLifecycle?.(root);
|
|
1851
|
+
if (options.workflowContext !== void 0) root.provide(PO_WORKFLOW_CONTEXT_SERVICE, options.workflowContext);
|
|
1298
1852
|
backgroundWorkBinding = root.inject([PO_BACKGROUND_WORK_SERVICE], (context) => {
|
|
1299
1853
|
const service = readPoBackgroundWorkService(context);
|
|
1300
1854
|
if (service === void 0) return void 0;
|
|
@@ -1303,7 +1857,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1303
1857
|
if (disposed || !active) return;
|
|
1304
1858
|
try {
|
|
1305
1859
|
const snapshot = service.snapshot(options.sessionId);
|
|
1306
|
-
publishBackgroundWork(snapshot.items.
|
|
1860
|
+
publishBackgroundWork(snapshot.items.some(awaitsCompletion) ? true : snapshot.errors.length > 0 ? null : false);
|
|
1307
1861
|
} catch {
|
|
1308
1862
|
publishBackgroundWork(null);
|
|
1309
1863
|
}
|
|
@@ -1319,48 +1873,86 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1319
1873
|
root.plugin((context) => {
|
|
1320
1874
|
context.provide(PO_CHILD_SESSION_SERVICE, childSessionProvider.get());
|
|
1321
1875
|
context.provide(PO_CHILD_SESSION_HOOK_REGISTRY_SERVICE, childHookRegistry);
|
|
1876
|
+
context.provide(PO_PERSON_TIME_ZONE_SERVICE, personTimeZone);
|
|
1877
|
+
context.provide(PO_PERSON_LOCALE_SERVICE, { read: () => deviceLocale });
|
|
1878
|
+
context.provide(PO_CONTEXT_CONTRIBUTIONS_SERVICE, createPoContextContributionsService(randomUUID()));
|
|
1322
1879
|
context.effect(() => () => childSessionProvider.close(), "headless child session service lifetime");
|
|
1323
1880
|
});
|
|
1324
1881
|
if (headlessHost !== void 0) throw new Error("Direct headless packages were prepared more than once.");
|
|
1325
|
-
if (models.piExtensions !== void 0)
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1882
|
+
if (models.piExtensions !== void 0) {
|
|
1883
|
+
let historyMiB = 0;
|
|
1884
|
+
piHost = models.piExtensions({
|
|
1885
|
+
runtime,
|
|
1886
|
+
getModel: () => currentModel,
|
|
1887
|
+
getThinkingLevel: () => resolved.thinkingLevel ?? "off",
|
|
1888
|
+
client: () => client?.client,
|
|
1889
|
+
onActiveToolsChanged: scheduleToolReapply,
|
|
1890
|
+
onHistorySize: (bytes) => {
|
|
1891
|
+
const mib = Math.floor(bytes / 1048576);
|
|
1892
|
+
if (mib === historyMiB) return;
|
|
1893
|
+
historyMiB = mib;
|
|
1894
|
+
observe(Promise.resolve().then(() => options.telemetry?.recordEvent?.("po_server.pi_history_size", {
|
|
1895
|
+
session_id: options.sessionId,
|
|
1896
|
+
bytes
|
|
1897
|
+
})));
|
|
1898
|
+
},
|
|
1899
|
+
serverServices: {
|
|
1900
|
+
sessionId: options.sessionId,
|
|
1901
|
+
get: (name) => root.get(name)
|
|
1902
|
+
},
|
|
1903
|
+
...options.onNotice === void 0 ? {} : { onNotice: options.onNotice }
|
|
1904
|
+
});
|
|
1905
|
+
}
|
|
1337
1906
|
headlessHost = new HeadlessHost(root, {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1907
|
+
inspectPrompt,
|
|
1908
|
+
readPromptText,
|
|
1909
|
+
previewPrompt,
|
|
1910
|
+
scheduleSelection: (change, apply, scheduling) => {
|
|
1911
|
+
const applySelection = async (next) => {
|
|
1912
|
+
if (next.axis !== "profile") return apply(next);
|
|
1913
|
+
if (options.operationModelPrompt) throw new Error("The session has a pinned profile.");
|
|
1914
|
+
const previousRequest = requestedProfile;
|
|
1915
|
+
requestedProfile = next.profile ?? null;
|
|
1916
|
+
try {
|
|
1917
|
+
await apply(next);
|
|
1918
|
+
} catch (error) {
|
|
1919
|
+
requestedProfile = previousRequest;
|
|
1920
|
+
throw error;
|
|
1921
|
+
}
|
|
1922
|
+
await publishComposition();
|
|
1923
|
+
};
|
|
1924
|
+
if (!selectionCommand.getStore() && !scheduling?.atToolBoundary) return applySelection(change);
|
|
1925
|
+
const previous = headlessHost.context.selection.state?.["mode"] ?? [];
|
|
1341
1926
|
return runtime.runAtToolBoundary(() => selectionCommand.run(false, () => {
|
|
1342
|
-
if (change.axis !== "state" || change.key !== "
|
|
1927
|
+
if (change.axis !== "state" || change.key !== "mode") return applySelection(change);
|
|
1343
1928
|
const removed = previous.filter((name) => !change.values.includes(name));
|
|
1344
1929
|
const added = change.values.filter((name) => !previous.includes(name));
|
|
1345
|
-
const current = headlessHost.context.selection.state?.["
|
|
1930
|
+
const current = headlessHost.context.selection.state?.["mode"] ?? [];
|
|
1346
1931
|
return apply({
|
|
1347
1932
|
...change,
|
|
1348
1933
|
values: [.../* @__PURE__ */ new Set([...current.filter((name) => !removed.includes(name)), ...added])]
|
|
1349
1934
|
});
|
|
1350
1935
|
}));
|
|
1351
1936
|
},
|
|
1352
|
-
candidates
|
|
1937
|
+
candidates,
|
|
1353
1938
|
toolSurface: () => admittedToolSurface,
|
|
1354
1939
|
selection: initialSelection,
|
|
1355
1940
|
selectionOverrides: [.../* @__PURE__ */ new Set([...options.selectionOverrides ?? [], ...[
|
|
1356
|
-
"
|
|
1941
|
+
"preset",
|
|
1357
1942
|
"domains",
|
|
1358
1943
|
"profile"
|
|
1359
1944
|
].filter((axis) => JSON.stringify(initialSelection[axis]) !== JSON.stringify(options.selection[axis]))])],
|
|
1360
1945
|
context: executionContext,
|
|
1361
1946
|
resolveSelection: options.resolveSelection,
|
|
1947
|
+
...options.extensionLayers === void 0 ? {} : { extensionLayers: options.extensionLayers },
|
|
1362
1948
|
validateSelection: (selection) => {
|
|
1363
|
-
|
|
1949
|
+
if (options.workflowContext !== void 0) {
|
|
1950
|
+
if (selection.state?.["mode"]?.includes(PO_HELP_WHEN.state["mode"])) throw new Error("Help mode cannot be activated in a workflow step session.");
|
|
1951
|
+
const expected = options.workflowContext.identity;
|
|
1952
|
+
const expectedProfile = expected?.kind === "profile" ? expected.profile : void 0;
|
|
1953
|
+
if (expected !== void 0 && selection.profile !== expectedProfile) throw new Error("The selected profile does not match the workflow step identity.");
|
|
1954
|
+
}
|
|
1955
|
+
for (const packageName of requiredServerPackages) if (!candidates.some((entry) => entry.packageName === packageName && entry.scopes.includes("session") && entry.owners.some((owner) => isOwnerSelected(owner, selection))) || !installedServerPackages.includes(packageName)) throw new Error(`Required headless package '${packageName}' is unavailable. Run po sync, then reopen this session.`);
|
|
1364
1956
|
},
|
|
1365
1957
|
...options.allowedTools === void 0 ? {} : { allowedTools: () => options.allowedTools },
|
|
1366
1958
|
applyTools: async (tools) => {
|
|
@@ -1369,11 +1961,11 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1369
1961
|
},
|
|
1370
1962
|
applyResources: async (next) => {
|
|
1371
1963
|
const mapped = mapResources(next);
|
|
1372
|
-
const packageNames = new Set((mapped.
|
|
1964
|
+
const packageNames = new Set((mapped.skills ?? []).map((skill) => skill.name));
|
|
1373
1965
|
const piSkills = (piHost?.skills ?? []).filter((skill) => !packageNames.has(skill.name));
|
|
1374
|
-
const mergedSkills = [...piSkills, ...mapped.
|
|
1375
|
-
await runtime.replaceResources(piSkills.length === 0 ? mapped
|
|
1376
|
-
...mapped
|
|
1966
|
+
const mergedSkills = [...piSkills, ...mapped.skills ?? []];
|
|
1967
|
+
await runtime.replaceResources(piSkills.length === 0 ? mapped : {
|
|
1968
|
+
...mapped,
|
|
1377
1969
|
skills: mergedSkills
|
|
1378
1970
|
});
|
|
1379
1971
|
appliedSkills = new Map(mergedSkills.map((skill) => {
|
|
@@ -1388,16 +1980,22 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1388
1980
|
}];
|
|
1389
1981
|
}));
|
|
1390
1982
|
surfaceRevision += 1;
|
|
1391
|
-
if (appliedPackageTools.some((tool) => tool.name === "load_skill")) await applyLatestTools();
|
|
1983
|
+
if (appliedPackageTools.some((tool) => tool.name === "load_skill" || tool.name === "search_skills")) await applyLatestTools();
|
|
1392
1984
|
},
|
|
1393
1985
|
onApplied: async (selection) => {
|
|
1394
1986
|
options.publishSelectionStatus?.((source, text) => client.client.setStatus(source, text), selection);
|
|
1395
1987
|
latestSelection = selection;
|
|
1396
1988
|
for (const listener of selectionListeners) listener(selection);
|
|
1397
1989
|
},
|
|
1990
|
+
onSelectionStep: options.telemetry?.recordEvent ? (phase, durationMs, packageName) => options.telemetry?.recordEvent?.("po_server.session_selection_step", {
|
|
1991
|
+
session_id: runtime.sessionId,
|
|
1992
|
+
phase,
|
|
1993
|
+
duration_ms: durationMs,
|
|
1994
|
+
...packageName === void 0 ? {} : { "selection.package": packageName }
|
|
1995
|
+
}) : void 0,
|
|
1398
1996
|
onError: (error, source) => options.onNotice?.(`Headless ${source ?? "host"} failed: ${harnessErrorMessage(error)}`)
|
|
1399
1997
|
});
|
|
1400
|
-
publishComposition = createHeadlessCompositionPublisher(runtime, headlessHost, options.environment, (selection) => options.contextGroups?.(root, selection) ?? [], readSystemPrompt, () => !disposed);
|
|
1998
|
+
publishComposition = createHeadlessCompositionPublisher(runtime, headlessHost, options.environment, (selection) => options.contextGroups?.(root, selection) ?? [], readSystemPrompt, () => requestedProfile, () => !disposed);
|
|
1401
1999
|
headlessHost.subscribeSelection(async (selection) => {
|
|
1402
2000
|
if (!headlessReady || !headlessHost?.status.ready) return;
|
|
1403
2001
|
try {
|
|
@@ -1412,28 +2010,53 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1412
2010
|
if (headlessHost === void 0) throw new Error("Direct headless host was not prepared.");
|
|
1413
2011
|
const host = headlessHost;
|
|
1414
2012
|
const assertLive = () => {
|
|
2013
|
+
options.startupSignal?.throwIfAborted();
|
|
1415
2014
|
if (disposed) throw new Error("The session was closed while it was starting.");
|
|
1416
2015
|
};
|
|
2016
|
+
const timed = async (phase, run) => {
|
|
2017
|
+
const started = performance.now();
|
|
2018
|
+
try {
|
|
2019
|
+
return await run();
|
|
2020
|
+
} finally {
|
|
2021
|
+
const durationMs = Math.round(performance.now() - started);
|
|
2022
|
+
observe(Promise.resolve().then(() => options.telemetry?.recordEvent?.("po_server.session_activation_phase", {
|
|
2023
|
+
session_id: runtime.sessionId,
|
|
2024
|
+
phase,
|
|
2025
|
+
duration_ms: durationMs
|
|
2026
|
+
})));
|
|
2027
|
+
}
|
|
2028
|
+
};
|
|
2029
|
+
assertLive();
|
|
1417
2030
|
requiredServerPackages = await options.requiredServerPackages?.() ?? [];
|
|
1418
2031
|
installedServerPackages = installedPackages;
|
|
1419
2032
|
assertLive();
|
|
1420
2033
|
host.setAvailableSources(installedPackages);
|
|
1421
2034
|
if (piHost !== void 0) try {
|
|
1422
|
-
await piHost.load();
|
|
2035
|
+
await timed("pi_extensions", () => piHost.load());
|
|
1423
2036
|
} catch (error) {
|
|
1424
2037
|
options.onNotice?.(`Pi extensions failed to load: ${error instanceof Error ? error.message : String(error)}`);
|
|
1425
2038
|
}
|
|
1426
2039
|
assertLive();
|
|
1427
|
-
await host.select(initialSelection);
|
|
2040
|
+
await timed("initial_selection", () => host.select(initialSelection));
|
|
1428
2041
|
assertLive();
|
|
1429
2042
|
if (!host.status.ready) throw new Error(`Session capabilities failed to start: ${host.status.error ?? "selection is not ready"}`);
|
|
2043
|
+
await timed("session_start", () => host.dispatchHook("session_start", {}, options.startupSignal));
|
|
2044
|
+
assertLive();
|
|
2045
|
+
if (options.admitStartup !== void 0) await timed("admission", options.admitStartup);
|
|
2046
|
+
assertLive();
|
|
2047
|
+
sessionStarted = true;
|
|
1430
2048
|
headlessReady = true;
|
|
1431
|
-
|
|
2049
|
+
try {
|
|
2050
|
+
await timed("mcp_surface", prepareMcpSurface);
|
|
2051
|
+
} catch (error) {
|
|
2052
|
+
options.onNotice?.(`MCP tools failed to start: ${error instanceof Error ? error.message : String(error)}`);
|
|
2053
|
+
}
|
|
1432
2054
|
assertLive();
|
|
1433
|
-
await runtime.recover();
|
|
2055
|
+
await timed("recovery", () => runtime.recover());
|
|
1434
2056
|
assertLive();
|
|
1435
|
-
await host.dispatchHook("
|
|
1436
|
-
|
|
2057
|
+
await timed("session_ready", () => host.dispatchHook("session_ready", {}, options.startupSignal));
|
|
2058
|
+
assertLive();
|
|
2059
|
+
await timed("composition", () => publishComposition());
|
|
1437
2060
|
const children = childSessionProvider.get();
|
|
1438
2061
|
for (const run of await children.stored?.() ?? []) {
|
|
1439
2062
|
if (run.settled) continue;
|
|
@@ -1450,10 +2073,11 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1450
2073
|
}
|
|
1451
2074
|
}
|
|
1452
2075
|
assertLive();
|
|
1453
|
-
(await runtime.admitResume()).settled.catch((error) => options.onNotice?.(`Session resume failed: ${harnessErrorMessage(error)}`));
|
|
2076
|
+
(await timed("resume_admission", () => runtime.admitResume())).settled.catch((error) => options.onNotice?.(`Session resume failed: ${harnessErrorMessage(error)}`));
|
|
1454
2077
|
assertLive();
|
|
1455
2078
|
};
|
|
1456
|
-
const dispose = () => {
|
|
2079
|
+
const dispose = (closeOptions) => {
|
|
2080
|
+
if (disposePromise === void 0) closeReason = closeOptions?.reason;
|
|
1457
2081
|
disposePromise ??= (async () => {
|
|
1458
2082
|
if (disposed) return;
|
|
1459
2083
|
const wasReady = headlessReady;
|
|
@@ -1519,12 +2143,13 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1519
2143
|
if (applied === void 0) throw new Error(`Tool '${invocation.name}' is not active`);
|
|
1520
2144
|
if (!Value.Check(applied.descriptor.parameters, invocation.arguments)) throw new Error(`Invalid arguments for tool '${invocation.name}': ${validationDetails(applied.descriptor.parameters, invocation.arguments)}`);
|
|
1521
2145
|
const signals = [invocation.signal, lifecycleSignal].filter((signal) => signal !== void 0);
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1524
|
-
return runtime.runExternalOperation(async () => {
|
|
1525
|
-
signal
|
|
2146
|
+
const admissionSignal = signals.length === 0 ? void 0 : AbortSignal.any(signals);
|
|
2147
|
+
admissionSignal?.throwIfAborted();
|
|
2148
|
+
return runtime.runExternalOperation(async (operationSignal) => {
|
|
2149
|
+
const signal = AbortSignal.any([...signals, operationSignal]);
|
|
2150
|
+
signal.throwIfAborted();
|
|
1526
2151
|
await invocation.authorize?.();
|
|
1527
|
-
signal
|
|
2152
|
+
signal.throwIfAborted();
|
|
1528
2153
|
if (disposed || !headlessReady || !ready() || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready. Retry in a few seconds.");
|
|
1529
2154
|
if (invocation.revision !== readRevision() || readTools().get(invocation.name) !== applied) throw new Error(`Tool '${invocation.name}' is no longer active`);
|
|
1530
2155
|
const toolCallId = `external-${randomUUID()}`;
|
|
@@ -1532,7 +2157,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1532
2157
|
toolCallId,
|
|
1533
2158
|
toolName: invocation.name,
|
|
1534
2159
|
args: invocation.arguments
|
|
1535
|
-
},
|
|
2160
|
+
}, withAbortSignal(signal, BACKGROUND_CONTEXT));
|
|
1536
2161
|
if (before?.block !== void 0) return {
|
|
1537
2162
|
content: [{
|
|
1538
2163
|
type: "text",
|
|
@@ -1543,7 +2168,7 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1543
2168
|
const args = before?.args ?? invocation.arguments;
|
|
1544
2169
|
if (!Value.Check(applied.descriptor.parameters, args)) throw new Error(`A tool hook produced invalid arguments for '${invocation.name}': ${validationDetails(applied.descriptor.parameters, args)}`);
|
|
1545
2170
|
await invocation.authorize?.();
|
|
1546
|
-
signal
|
|
2171
|
+
signal.throwIfAborted();
|
|
1547
2172
|
if (disposed || !headlessReady || !ready() || !headlessHost?.status.ready) throw new Error("Headless capability preparation is not ready. Retry in a few seconds.");
|
|
1548
2173
|
if (invocation.revision !== readRevision() || readTools().get(invocation.name) !== applied) throw new Error(`Tool '${invocation.name}' is no longer active`);
|
|
1549
2174
|
const startEvent = {
|
|
@@ -1554,12 +2179,12 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1554
2179
|
toolName: invocation.name,
|
|
1555
2180
|
args
|
|
1556
2181
|
};
|
|
1557
|
-
|
|
2182
|
+
emitFrame(startEvent);
|
|
1558
2183
|
await headlessHost.dispatchHook("tool_execution_start", startEvent);
|
|
1559
2184
|
let result;
|
|
1560
2185
|
try {
|
|
1561
2186
|
result = await applied.execute(toolCallId, args, signal, (partial) => {
|
|
1562
|
-
|
|
2187
|
+
emitFrame({
|
|
1563
2188
|
type: "tool_execution_update",
|
|
1564
2189
|
runId: EXTERNAL_OPERATION,
|
|
1565
2190
|
turnId: EXTERNAL_OPERATION,
|
|
@@ -1568,9 +2193,20 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1568
2193
|
partialResult: partial
|
|
1569
2194
|
});
|
|
1570
2195
|
invocation.onUpdate?.(partial);
|
|
1571
|
-
},
|
|
2196
|
+
}, {
|
|
1572
2197
|
...headlessHost.context,
|
|
1573
|
-
mcpSkills: invocation.mcpSkills
|
|
2198
|
+
...invocation.mcpSkills === void 0 ? {} : { mcpSkills: invocation.mcpSkills },
|
|
2199
|
+
toolContinuation: createToolContinuation({
|
|
2200
|
+
toolName: invocation.name,
|
|
2201
|
+
parameters: applied.descriptor.parameters,
|
|
2202
|
+
beforeTool,
|
|
2203
|
+
afterTool,
|
|
2204
|
+
authorize: invocation.authorize,
|
|
2205
|
+
lifecycleSignal,
|
|
2206
|
+
assertAvailable() {
|
|
2207
|
+
if (disposed || !headlessReady || !ready() || !headlessHost?.status.ready || invocation.revision !== readRevision() || readTools().get(invocation.name) !== applied) throw new Error(`Tool '${invocation.name}' is no longer active`);
|
|
2208
|
+
}
|
|
2209
|
+
})
|
|
1574
2210
|
});
|
|
1575
2211
|
} catch (error) {
|
|
1576
2212
|
result = {
|
|
@@ -1581,14 +2217,14 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1581
2217
|
isError: true
|
|
1582
2218
|
};
|
|
1583
2219
|
}
|
|
1584
|
-
const patch = signal
|
|
2220
|
+
const patch = signal.aborted ? void 0 : await afterTool({
|
|
1585
2221
|
toolCallId,
|
|
1586
2222
|
toolName: invocation.name,
|
|
1587
2223
|
args,
|
|
1588
2224
|
content: result.content,
|
|
1589
2225
|
...isJsonValue(result.details) ? { details: result.details } : {},
|
|
1590
2226
|
isError: result.isError === true
|
|
1591
|
-
},
|
|
2227
|
+
}, withAbortSignal(signal, BACKGROUND_CONTEXT));
|
|
1592
2228
|
const patched = {
|
|
1593
2229
|
content: patch?.content ?? result.content,
|
|
1594
2230
|
...patch?.content !== void 0 || patch?.isError !== void 0 || result.structuredContent === void 0 ? {} : { structuredContent: result.structuredContent },
|
|
@@ -1606,11 +2242,11 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1606
2242
|
isError: patched.isError,
|
|
1607
2243
|
terminate: patch?.terminate ?? false
|
|
1608
2244
|
};
|
|
1609
|
-
|
|
2245
|
+
emitFrame(endEvent);
|
|
1610
2246
|
await headlessHost.dispatchHook("tool_execution_end", endEvent);
|
|
1611
2247
|
return patched;
|
|
1612
2248
|
}, {
|
|
1613
|
-
signal,
|
|
2249
|
+
signal: admissionSignal,
|
|
1614
2250
|
waitMs
|
|
1615
2251
|
});
|
|
1616
2252
|
};
|
|
@@ -1670,13 +2306,36 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1670
2306
|
};
|
|
1671
2307
|
return {
|
|
1672
2308
|
runtime,
|
|
2309
|
+
translate(key, fallback) {
|
|
2310
|
+
return (mcpServiceRoot && readPoLang(mcpServiceRoot))?.t(deviceLocale, key, fallback) ?? fallback;
|
|
2311
|
+
},
|
|
2312
|
+
async runIfIdle(action) {
|
|
2313
|
+
let released = false;
|
|
2314
|
+
await runtime.runIfIdle(() => {
|
|
2315
|
+
const work = mcpServiceRoot === void 0 ? void 0 : readPoBackgroundWorkService(mcpServiceRoot)?.snapshot(options.sessionId);
|
|
2316
|
+
if (work !== void 0 && (work.items.length > 0 || work.errors.length > 0)) return;
|
|
2317
|
+
action();
|
|
2318
|
+
released = true;
|
|
2319
|
+
});
|
|
2320
|
+
return released;
|
|
2321
|
+
},
|
|
2322
|
+
async readMessages(limit) {
|
|
2323
|
+
const entries = [];
|
|
2324
|
+
for await (const entry of entriesNewestFirst({
|
|
2325
|
+
type: "message",
|
|
2326
|
+
limit
|
|
2327
|
+
})) entries.push(entry);
|
|
2328
|
+
return entries;
|
|
2329
|
+
},
|
|
1673
2330
|
async readExecutionState() {
|
|
1674
2331
|
const state = await runtime.readState();
|
|
2332
|
+
const usage = await runtime.getSessionUsage?.();
|
|
1675
2333
|
const backgroundWork = mcpServiceRoot === void 0 ? void 0 : readPoBackgroundWorkService(mcpServiceRoot)?.snapshot(options.sessionId);
|
|
1676
2334
|
return {
|
|
1677
2335
|
isIdle: state.isIdle === true,
|
|
1678
2336
|
hasPendingMessages: Number(state.pendingMessageCount) > 0,
|
|
1679
|
-
...backgroundWork === void 0 ? {} : { backgroundWork }
|
|
2337
|
+
...backgroundWork === void 0 ? {} : { backgroundWork },
|
|
2338
|
+
...usage === void 0 ? {} : { usage }
|
|
1680
2339
|
};
|
|
1681
2340
|
},
|
|
1682
2341
|
...sessionContext === void 0 ? {} : { sessionContext },
|
|
@@ -1687,8 +2346,21 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1687
2346
|
mcpSurface,
|
|
1688
2347
|
preparePackages,
|
|
1689
2348
|
activatePackages,
|
|
2349
|
+
async reloadPackages(next, installedPackages) {
|
|
2350
|
+
if (headlessHost === void 0 || disposed) throw new Error("The session is not running.");
|
|
2351
|
+
candidates = next;
|
|
2352
|
+
installedServerPackages = installedPackages;
|
|
2353
|
+
headlessHost.replaceCandidates(next);
|
|
2354
|
+
headlessHost.setAvailableSources(installedPackages);
|
|
2355
|
+
await headlessHost.select({});
|
|
2356
|
+
},
|
|
2357
|
+
async refreshSelection(axes) {
|
|
2358
|
+
if (headlessHost === void 0 || disposed) throw new Error("The session is not running.");
|
|
2359
|
+
await headlessHost.select({}, { refresh: axes });
|
|
2360
|
+
},
|
|
1690
2361
|
canDispatch: () => !disposed && headlessReady && !promptPreparationFailed && headlessHost?.status.ready === true,
|
|
1691
2362
|
childThread: (runId) => childSessionProvider.get().thread(runId),
|
|
2363
|
+
takeNotificationLocalization: (ref) => client?.takeNotificationLocalization(ref),
|
|
1692
2364
|
onPresentationFrame(listener) {
|
|
1693
2365
|
listeners.add(listener);
|
|
1694
2366
|
client?.replay(listener);
|
|
@@ -1710,10 +2382,16 @@ async function composeHeadlessSessionHost(options, releaseEnvironment) {
|
|
|
1710
2382
|
respondToExtensionUi(frame) {
|
|
1711
2383
|
return client?.receive(frame) ?? false;
|
|
1712
2384
|
},
|
|
2385
|
+
setDeviceTimeZone(timeZone) {
|
|
2386
|
+
if (isTimeZone(timeZone)) deviceTimeZone = timeZone;
|
|
2387
|
+
},
|
|
2388
|
+
setDeviceLocale(locale) {
|
|
2389
|
+
deviceLocale = canonicalLocale(locale);
|
|
2390
|
+
},
|
|
1713
2391
|
dispose
|
|
1714
2392
|
};
|
|
1715
2393
|
}
|
|
1716
2394
|
//#endregion
|
|
1717
|
-
export { createHeadlessSessionHost, restoreHeadlessSelection, validateDirectHeadlessArgs };
|
|
2395
|
+
export { RETIRED_COMMANDS, createHeadlessSessionHost, promptSection, restoreHeadlessSelection, systemPromptSectionKeys, toolAdapter, validateDirectHeadlessArgs };
|
|
1718
2396
|
|
|
1719
2397
|
//# sourceMappingURL=headlessSessionHost.mjs.map
|