@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,27 +1,72 @@
|
|
|
1
|
+
const require_agentSettled = require("../constants/agentSettled.cjs");
|
|
1
2
|
const require_headless = require("../schemas/headless.cjs");
|
|
3
|
+
const require_index = require("../services/piMessages/index.cjs");
|
|
2
4
|
const require_docs = require("../services/durableSession/docs.cjs");
|
|
3
5
|
require("../schemas/profileIdentity.cjs");
|
|
4
|
-
const require_index = require("../services/transcriptPages/index.cjs");
|
|
6
|
+
const require_index$1 = require("../services/transcriptPages/index.cjs");
|
|
7
|
+
const require_index$2 = require("../services/providerImages/index.cjs");
|
|
5
8
|
const require_sessionProtocol = require("../schemas/sessionProtocol.cjs");
|
|
6
|
-
const require_index$
|
|
7
|
-
const
|
|
8
|
-
const require_index$
|
|
9
|
-
const require_index$3 = require("../services/durableNavigation/index.cjs");
|
|
9
|
+
const require_index$3 = require("../services/skillPrompt/index.cjs");
|
|
10
|
+
const require_index$4 = require("../services/contextUsage/index.cjs");
|
|
11
|
+
const require_index$5 = require("../services/durableNavigation/index.cjs");
|
|
10
12
|
const require_docs$1 = require("../services/durableQueue/docs.cjs");
|
|
11
|
-
const require_index$
|
|
13
|
+
const require_index$6 = require("../services/durableQueue/index.cjs");
|
|
14
|
+
const require_index$7 = require("../services/durableResumeSnapshots/index.cjs");
|
|
12
15
|
const require_extension = require("../services/durableSubagents/extension.cjs");
|
|
13
|
-
const require_index$
|
|
14
|
-
const require_index$
|
|
16
|
+
const require_index$8 = require("../services/durableSubagents/index.cjs");
|
|
17
|
+
const require_index$9 = require("../services/modelDispatch/index.cjs");
|
|
18
|
+
const require_index$10 = require("../services/toolContinuation/index.cjs");
|
|
19
|
+
const require_conversationEvents = require("./conversationEvents.cjs");
|
|
15
20
|
let node_crypto = require("node:crypto");
|
|
16
|
-
let _earendil_works_pi_durable = require("@earendil-works/pi-durable");
|
|
17
21
|
let dist_interop_chordContext_mjs = require("../../../dist/interop/chordContext.mjs");
|
|
22
|
+
let _earendil_works_pi_durable = require("@earendil-works/pi-durable");
|
|
18
23
|
let _earendil_works_pi_ai = require("@earendil-works/pi-ai");
|
|
19
24
|
let node_util = require("node:util");
|
|
20
25
|
let _earendil_works_pi_ai_utils_transcript = require("@earendil-works/pi-ai/utils/transcript");
|
|
21
26
|
//#region src/server/directHarnessRuntime.ts
|
|
27
|
+
/** Freeze the detached streaming snapshot, including nested tool-call arguments. */
|
|
28
|
+
function freezeSnapshot(value, size) {
|
|
29
|
+
if (size) size.bytes += typeof value === "string" ? value.length * 2 : 8;
|
|
30
|
+
if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
|
|
31
|
+
for (const child of Object.values(value)) freezeSnapshot(child, size);
|
|
32
|
+
Object.freeze(value);
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
22
36
|
const AGENT_LOCKED_ERROR = "The local agent is locked. Unlock it to start a turn.";
|
|
23
|
-
|
|
24
|
-
const
|
|
37
|
+
/** What the model reads in place of a summary after the person clears the context. */
|
|
38
|
+
const CLEARED_SUMMARY = "The person cleared the conversation. Nothing before this point is available. Start fresh.";
|
|
39
|
+
/** The last prompt section, holding text whose key `systemPromptSections` did not list. */
|
|
40
|
+
const UNLISTED_PROMPT_SECTION = "po-unlisted";
|
|
41
|
+
/** Largest custom entry payload, in UTF-8 bytes. Every reader decodes a payload whole, so one entry must stay small. */
|
|
42
|
+
const MAX_CUSTOM_ENTRY_BYTES = 1048576;
|
|
43
|
+
const PO_ENTRY_KIND = "po.entry";
|
|
44
|
+
const PO_HOST_EXTENSION = "po.host";
|
|
45
|
+
/** Diagnostic codes of the error results pi-durable writes for a tool call that never ran to completion. */
|
|
46
|
+
const HARNESS_TOOL_CODES = /* @__PURE__ */ new Set([
|
|
47
|
+
"tool_unavailable",
|
|
48
|
+
"invalid_arguments",
|
|
49
|
+
"blocked",
|
|
50
|
+
"interrupted",
|
|
51
|
+
"restart_limit",
|
|
52
|
+
"aborted",
|
|
53
|
+
"abandoned"
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* Drops tail text that earlier sessions committed to the transcript, so it can never outlive its mode. A later system
|
|
57
|
+
* message that carried nothing else is dropped with it; the leading one always stays.
|
|
58
|
+
*/
|
|
59
|
+
function withoutTailSections(messages, isTail) {
|
|
60
|
+
return messages.flatMap((message, index) => {
|
|
61
|
+
if (message.role !== "system" || !message.sections || !Object.keys(message.sections).some(isTail)) return [message];
|
|
62
|
+
const sections = Object.fromEntries(Object.entries(message.sections).filter(([key]) => !isTail(key)));
|
|
63
|
+
const empty = !message.content && !Object.keys(sections).length && !message.toolsAdded?.length && !message.toolsRemoved?.length;
|
|
64
|
+
return index > 0 && empty ? [] : [{
|
|
65
|
+
...message,
|
|
66
|
+
sections
|
|
67
|
+
}];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
25
70
|
function nativeId(id) {
|
|
26
71
|
const value = Number(id);
|
|
27
72
|
if (!Number.isSafeInteger(value) || value < 0 || String(value) !== id) throw new Error(`Invalid durable identifier: ${id}`);
|
|
@@ -30,12 +75,63 @@ function nativeId(id) {
|
|
|
30
75
|
function json(value) {
|
|
31
76
|
return JSON.parse(JSON.stringify(value));
|
|
32
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* A fixed category for a tool that threw, kept for telemetry: pi-durable turns the throw into text and drops the error.
|
|
80
|
+
* The reason is the error's code (ENOENT, invalid_request) or class name, never its message.
|
|
81
|
+
*/
|
|
82
|
+
function thrownToolFailure(error) {
|
|
83
|
+
const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
84
|
+
const name = error instanceof Error ? error.name === "Error" ? error.constructor.name : error.name : "NonError";
|
|
85
|
+
const reason = typeof code === "string" && code !== "" ? code : name;
|
|
86
|
+
if (error instanceof Error && "operation" in error && "ran" in error && "phase" in error) {
|
|
87
|
+
const operation = error.operation;
|
|
88
|
+
if (operation && typeof operation === "object" && "kind" in operation && "name" in operation && (operation.kind === "tool" || operation.kind === "codemode") && typeof operation.name === "string" && operation.name.length <= 256 && typeof error.ran === "boolean" && (error.phase === "before" || error.phase === "after")) return {
|
|
89
|
+
kind: error.ran ? "review_failed" : "blocked",
|
|
90
|
+
reason,
|
|
91
|
+
operation: {
|
|
92
|
+
kind: operation.kind,
|
|
93
|
+
name: operation.name
|
|
94
|
+
},
|
|
95
|
+
...typeof code === "string" && code.length <= 256 ? { code } : {},
|
|
96
|
+
ran: error.ran,
|
|
97
|
+
phase: error.phase
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
if (name === "AbortError" || name === "OperationCancelledError") return {
|
|
101
|
+
kind: "aborted",
|
|
102
|
+
reason
|
|
103
|
+
};
|
|
104
|
+
if (name === "TimeoutError" || code === "ETIMEDOUT") return {
|
|
105
|
+
kind: "timeout",
|
|
106
|
+
reason
|
|
107
|
+
};
|
|
108
|
+
if (code === "ENOENT") return {
|
|
109
|
+
kind: "not_found",
|
|
110
|
+
reason
|
|
111
|
+
};
|
|
112
|
+
if (code === "EACCES" || code === "EPERM") return {
|
|
113
|
+
kind: "permission",
|
|
114
|
+
reason
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
kind: "unknown",
|
|
118
|
+
reason
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
/** A custom entry payload as JSON, refused rather than truncated when it exceeds the entry byte cap. */
|
|
122
|
+
function customEntryJson(customType, value) {
|
|
123
|
+
const serialized = JSON.stringify(value);
|
|
124
|
+
const bytes = serialized.length > MAX_CUSTOM_ENTRY_BYTES ? serialized.length : new TextEncoder().encode(serialized).length;
|
|
125
|
+
if (bytes > MAX_CUSTOM_ENTRY_BYTES) throw new Error(`Custom entry '${customType}' is ${bytes} bytes or more, over the ${MAX_CUSTOM_ENTRY_BYTES}-byte limit; store large data outside the session.`);
|
|
126
|
+
return JSON.parse(serialized);
|
|
127
|
+
}
|
|
33
128
|
function text(message) {
|
|
34
129
|
if (typeof message === "string") return message;
|
|
35
130
|
if (!("content" in message)) return "summary" in message ? message.summary : "output" in message ? message.output : "";
|
|
36
131
|
return typeof message.content === "string" ? message.content : message.content.map((p) => p.type === "text" ? p.text : "").join("");
|
|
37
132
|
}
|
|
38
|
-
function fromContent(content) {
|
|
133
|
+
function fromContent(content, data) {
|
|
134
|
+
content = require_index.humanInputProjection(data)?.display ?? content;
|
|
39
135
|
const images = (typeof content === "string" ? [{
|
|
40
136
|
type: "text",
|
|
41
137
|
text: content
|
|
@@ -49,17 +145,32 @@ function fromContent(content) {
|
|
|
49
145
|
...images.length ? { images } : {}
|
|
50
146
|
};
|
|
51
147
|
}
|
|
148
|
+
/** The sender humanEntry stamped, read only from host-admitted input (humanInputProjection verifies the author). */
|
|
149
|
+
function humanInputSender(data) {
|
|
150
|
+
if (!require_index.humanInputProjection(data)) return void 0;
|
|
151
|
+
const sender = data.message?.details?.sender;
|
|
152
|
+
if (typeof sender?.name !== "string") return void 0;
|
|
153
|
+
return {
|
|
154
|
+
kind: "human",
|
|
155
|
+
...typeof sender.id === "string" ? { id: sender.id } : {},
|
|
156
|
+
name: sender.name
|
|
157
|
+
};
|
|
158
|
+
}
|
|
52
159
|
/** Compatibility projection keeps protocol identities strings and retains fork ancestry. */
|
|
53
160
|
async function projectDurableConversationEntries(conversation, context, minEntryId) {
|
|
54
|
-
const
|
|
161
|
+
const pages = [];
|
|
55
162
|
let cursor;
|
|
56
163
|
do {
|
|
57
164
|
const page = await conversation.entries(minEntryId === void 0 ? {} : { minEntryId }, 256, cursor, context);
|
|
58
|
-
|
|
165
|
+
const newer = pages.at(-1);
|
|
166
|
+
if (newer && page.items.length) for (const entry of newer) {
|
|
167
|
+
if (entry.seq !== newer[0].seq) break;
|
|
168
|
+
entry.parentId = String(page.items[0].id);
|
|
169
|
+
}
|
|
170
|
+
pages.push(require_index$1.projectDurableEntries(page.items.toReversed()));
|
|
59
171
|
cursor = page.next;
|
|
60
172
|
} while (cursor);
|
|
61
|
-
|
|
62
|
-
return require_index.projectDurableEntries(records);
|
|
173
|
+
return pages.reverse().flat();
|
|
63
174
|
}
|
|
64
175
|
/**
|
|
65
176
|
* Runs one prompt and returns the newest assistant text it produced. `hold` keeps the run open
|
|
@@ -67,17 +178,16 @@ async function projectDurableConversationEntries(conversation, context, minEntry
|
|
|
67
178
|
* go idle and ask again. The returned text is the newest one across all of those turns. With a
|
|
68
179
|
* `requestId` the prompt is admitted once: a later call, such as one after a restart, waits for it.
|
|
69
180
|
*/
|
|
70
|
-
async function promptForAssistantText(runtime, prompt, hold, requestId) {
|
|
181
|
+
async function promptForAssistantText(runtime, prompt, hold, requestId, submit) {
|
|
71
182
|
const lane = runtime.lane;
|
|
72
183
|
const receipt = requestId === void 0 ? void 0 : await runtime.harness.commit((tx) => tx.submissionByRequest(lane.id, requestId), dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
73
|
-
const
|
|
74
|
-
const previous = new Set((receipt?.entry === void 0 ? before : before.filter((e) => Number(e.id) <= receipt.entry)).map((e) => e.id));
|
|
184
|
+
const after = receipt?.entry ?? Number((await runtime.scanEntries({ order: "descending" }, 1, void 0, dist_interop_chordContext_mjs.BACKGROUND_CONTEXT)).items[0]?.id ?? 0);
|
|
75
185
|
if (receipt) {
|
|
76
186
|
const settled = await (await runtime.harness.submission(receipt.id, dist_interop_chordContext_mjs.BACKGROUND_CONTEXT))?.wait(dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
77
187
|
if (settled?.status === "unanswered" && settled.reason === "aborted") throw Object.assign(/* @__PURE__ */ new Error("The prompt was stopped before it was answered"), { name: "AbortError" });
|
|
78
|
-
} else await (await runtime.submitInternalMessage(prompt, void 0, requestId)).settled;
|
|
188
|
+
} else await (await (submit ? submit() : runtime.submitInternalMessage(prompt, void 0, requestId))).settled;
|
|
79
189
|
while (hold && await hold()) await lane.waitForIdle(dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
80
|
-
return (await runtime.
|
|
190
|
+
return (await runtime.readEntriesFrom(after + 1)).entries.toReversed().flatMap((e) => e.type === "message" && e.message.role === "assistant" ? [text(e.message).trim()] : [])[0] || void 0;
|
|
81
191
|
}
|
|
82
192
|
function createDirectHarnessRuntime(options) {
|
|
83
193
|
return createLaneRuntime(options, void 0);
|
|
@@ -102,28 +212,43 @@ async function createLaneRuntime(options, attached) {
|
|
|
102
212
|
parentSessionId: options.parentSessionId,
|
|
103
213
|
existing: options.resume
|
|
104
214
|
}, context));
|
|
215
|
+
const projection = attached ? {
|
|
216
|
+
storage: storage.storage,
|
|
217
|
+
snapshots: attached.snapshots
|
|
218
|
+
} : require_index$7.createResumeSnapshots(storage.storage);
|
|
219
|
+
const snapshotValidators = /* @__PURE__ */ new Map();
|
|
105
220
|
let startupHarness;
|
|
221
|
+
let startupEnvironment;
|
|
106
222
|
try {
|
|
107
223
|
const registry = attached?.registry ?? (0, _earendil_works_pi_durable.createRegistry)();
|
|
108
224
|
const environment = attached ? void 0 : platform.env(options.cwd);
|
|
225
|
+
startupEnvironment = environment;
|
|
109
226
|
const laneProviderSessions = attached?.laneProviderSessions ?? /* @__PURE__ */ new Set();
|
|
110
227
|
const manualCompaction = attached?.manualCompaction ?? {};
|
|
111
|
-
const extensionName = attached ? laneExtensionName(attached.conversation.id) :
|
|
112
|
-
|
|
113
|
-
let quarantined = false;
|
|
114
|
-
let failure;
|
|
115
|
-
let preparationFailure;
|
|
228
|
+
const extensionName = attached ? laneExtensionName(attached.conversation.id) : PO_HOST_EXTENSION;
|
|
229
|
+
const fitProviderImages = require_index$2.createProviderImageFitter();
|
|
116
230
|
const terminatingCalls = /* @__PURE__ */ new Set();
|
|
117
|
-
|
|
118
|
-
|
|
231
|
+
const hookedArgs = /* @__PURE__ */ new Map();
|
|
232
|
+
const thrownFailures = /* @__PURE__ */ new Map();
|
|
119
233
|
const assertUnlocked = () => {
|
|
120
|
-
if (agentLocked) throw new Error(AGENT_LOCKED_ERROR);
|
|
234
|
+
if (state.agentLocked) throw new Error(AGENT_LOCKED_ERROR);
|
|
121
235
|
};
|
|
122
236
|
let resources = options.resources ?? {};
|
|
123
237
|
let tools = options.tools ?? [];
|
|
124
|
-
|
|
238
|
+
const state = {
|
|
239
|
+
disposed: false,
|
|
240
|
+
quarantined: false,
|
|
241
|
+
failure: void 0,
|
|
242
|
+
preparationFailure: void 0,
|
|
243
|
+
fastMode: false,
|
|
244
|
+
agentLocked: false,
|
|
245
|
+
activeNames: new Set(options.activeToolNames ?? tools.map((t) => t.name)),
|
|
246
|
+
endsWithTail: false,
|
|
247
|
+
sessionId: void 0
|
|
248
|
+
};
|
|
125
249
|
let settings = {
|
|
126
|
-
extensions: [{ name:
|
|
250
|
+
extensions: [{ name: PO_HOST_EXTENSION }],
|
|
251
|
+
documentRetentionMs: 6e4,
|
|
127
252
|
stream: options.streamOptions,
|
|
128
253
|
retry: options.retry,
|
|
129
254
|
compaction: options.compaction,
|
|
@@ -139,7 +264,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
139
264
|
const flushToolBoundary = () => {
|
|
140
265
|
if (toolBoundaryDrain) return toolBoundaryDrain;
|
|
141
266
|
toolBoundaryDrain = (async () => {
|
|
142
|
-
while (toolBoundaryQueue.length && !disposed && !disposePromise) await toolBoundaryQueue.shift().run();
|
|
267
|
+
while (toolBoundaryQueue.length && !state.disposed && !disposePromise) await toolBoundaryQueue.shift().run();
|
|
143
268
|
})().finally(() => {
|
|
144
269
|
toolBoundaryDrain = void 0;
|
|
145
270
|
});
|
|
@@ -156,7 +281,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
156
281
|
}
|
|
157
282
|
};
|
|
158
283
|
const writable = async (work) => {
|
|
159
|
-
if (disposed || quarantined) throw new Error("Direct harness writes are unavailable", { cause: failure });
|
|
284
|
+
if (state.disposed || state.quarantined) throw new Error("Direct harness writes are unavailable", { cause: state.failure });
|
|
160
285
|
try {
|
|
161
286
|
await storage.assertWritable();
|
|
162
287
|
return await work();
|
|
@@ -172,8 +297,8 @@ async function createLaneRuntime(options, attached) {
|
|
|
172
297
|
"EPERM",
|
|
173
298
|
"EROFS"
|
|
174
299
|
].includes(code)) {
|
|
175
|
-
quarantined = true;
|
|
176
|
-
failure = error;
|
|
300
|
+
state.quarantined = true;
|
|
301
|
+
state.failure = error;
|
|
177
302
|
emit({
|
|
178
303
|
type: "error",
|
|
179
304
|
code: "storage_quarantined",
|
|
@@ -195,131 +320,66 @@ async function createLaneRuntime(options, attached) {
|
|
|
195
320
|
if (!register) throw new Error("Models registry cannot register providers");
|
|
196
321
|
register(provider);
|
|
197
322
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
].includes(String(key))) return value.bind(target);
|
|
209
|
-
return (...args) => {
|
|
210
|
-
const requestOptions = args[2];
|
|
211
|
-
const lane = typeof requestOptions?.sessionId === "string" && laneProviderSessions.has(requestOptions.sessionId);
|
|
212
|
-
if (disposed || quarantined || !lane && preparationFailure) throw new Error("Model dispatch unavailable", { cause: preparationFailure });
|
|
213
|
-
if (!lane) options.guardModelRequest?.();
|
|
214
|
-
const request = args[1];
|
|
215
|
-
if (!lane && !["complete", "completeSimple"].includes(String(key)) && request?.tools?.some((t) => !activeNames.has(t.name))) throw new Error("Model request contains disabled tools");
|
|
216
|
-
const usePriority = fastMode && args[0].api === CODEX_API && args[0].provider === CODEX_PROVIDER;
|
|
217
|
-
const originalOnPayload = requestOptions?.onPayload;
|
|
218
|
-
args[2] = {
|
|
219
|
-
...requestOptions,
|
|
220
|
-
sessionId: lane ? requestOptions.sessionId : key === "complete" ? requestOptions?.sessionId ?? sessionId : sessionId,
|
|
221
|
-
...usePriority ? { serviceTier: "priority" } : {},
|
|
222
|
-
onPayload: async (payload, model) => {
|
|
223
|
-
if (!lane) options.guardModelRequest?.();
|
|
224
|
-
const original = typeof originalOnPayload === "function" ? await originalOnPayload(payload, model) : void 0;
|
|
225
|
-
const transformed = original === void 0 ? payload : original;
|
|
226
|
-
const patch = lane ? void 0 : await options.beforePayload?.({
|
|
227
|
-
payload: transformed,
|
|
228
|
-
model
|
|
229
|
-
}, context);
|
|
230
|
-
const finalPayload = patch === void 0 ? transformed : patch.payload;
|
|
231
|
-
if (!usePriority) return finalPayload;
|
|
232
|
-
if (typeof finalPayload !== "object" || finalPayload === null || Array.isArray(finalPayload)) throw new Error("Invalid Codex request payload");
|
|
233
|
-
return {
|
|
234
|
-
...finalPayload,
|
|
235
|
-
service_tier: "priority"
|
|
236
|
-
};
|
|
237
|
-
}
|
|
323
|
+
const operationModelPrompt = options.operationModelPrompt;
|
|
324
|
+
const operationGrants = /* @__PURE__ */ new Map();
|
|
325
|
+
const operationGrantKey = (conversationId, requestId) => JSON.stringify([conversationId, requestId]);
|
|
326
|
+
const operationAuthority = async (inputs, conversationId, ctx) => {
|
|
327
|
+
const placed = await Promise.all(inputs.map(async (id) => {
|
|
328
|
+
const submission = await storage.storage.submission(id, ctx);
|
|
329
|
+
const entry = submission?.type === "input" && submission.status === "placed" ? (await storage.storage.entry(conversationId, submission.entry, ctx))?.entry : void 0;
|
|
330
|
+
return {
|
|
331
|
+
submission,
|
|
332
|
+
data: entry?.kind === PO_ENTRY_KIND ? entry.data : void 0
|
|
238
333
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
role: "assistant",
|
|
252
|
-
content: [],
|
|
253
|
-
api: requestedModel.api,
|
|
254
|
-
provider: requestedModel.provider,
|
|
255
|
-
model: requestedModel.id,
|
|
256
|
-
timestamp: Date.now(),
|
|
257
|
-
stopReason: "pending",
|
|
258
|
-
usage: {
|
|
259
|
-
input: 0,
|
|
260
|
-
output: 0,
|
|
261
|
-
cacheRead: 0,
|
|
262
|
-
cacheWrite: 0,
|
|
263
|
-
totalTokens: 0,
|
|
264
|
-
cost: {
|
|
265
|
-
input: 0,
|
|
266
|
-
output: 0,
|
|
267
|
-
cacheRead: 0,
|
|
268
|
-
cacheWrite: 0,
|
|
269
|
-
total: 0
|
|
270
|
-
}
|
|
271
|
-
}
|
|
334
|
+
}));
|
|
335
|
+
const tagged = placed.filter(({ data }) => data?.operationModelPrompt === true);
|
|
336
|
+
if (!operationModelPrompt && !tagged.length) return void 0;
|
|
337
|
+
if (tagged.length && (tagged.length !== 1 || placed.length !== 1)) throw new Error("Operation-specific authority requires exactly one placed input.");
|
|
338
|
+
const actors = placed.map(({ submission, data }) => {
|
|
339
|
+
if (submission?.type !== "input" || submission.status !== "placed" || submission.conversationId !== conversationId) throw new Error("Verified operation actor unavailable.");
|
|
340
|
+
const actor = data?.operationActor;
|
|
341
|
+
if (actor?.kind !== "member" || typeof actor.issuer !== "string" || !actor.issuer || typeof actor.subject !== "string" || !actor.subject) throw new Error("Verified operation actor unavailable.");
|
|
342
|
+
return {
|
|
343
|
+
kind: "member",
|
|
344
|
+
issuer: actor.issuer,
|
|
345
|
+
subject: actor.subject
|
|
272
346
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
output.end();
|
|
347
|
+
});
|
|
348
|
+
let resolve;
|
|
349
|
+
if (tagged.length) {
|
|
350
|
+
const submission = tagged[0].submission;
|
|
351
|
+
const key = operationGrantKey(conversationId, submission.requestId ?? "");
|
|
352
|
+
const grant = operationGrants.get(key);
|
|
353
|
+
if (!operationModelPrompt || !grant || grant.submissionId !== submission.id) throw new Error("Operation-specific authority unavailable.");
|
|
354
|
+
resolve = async (context, expectedVersion) => {
|
|
355
|
+
if (state.disposed || operationGrants.get(key) !== grant) throw new Error("Operation-specific authority unavailable.");
|
|
356
|
+
const result = await grant.resolve(context, expectedVersion);
|
|
357
|
+
if (state.disposed || operationGrants.get(key) !== grant) throw new Error("Operation-specific authority unavailable.");
|
|
358
|
+
context.abortSignal?.throwIfAborted();
|
|
359
|
+
return result;
|
|
287
360
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
for await (const event of source) {
|
|
293
|
-
if (ended) break;
|
|
294
|
-
if ("partial" in event) current = event.partial;
|
|
295
|
-
output.push(event);
|
|
296
|
-
}
|
|
297
|
-
if (!ended) {
|
|
298
|
-
ended = true;
|
|
299
|
-
output.end(await source.result());
|
|
300
|
-
}
|
|
301
|
-
} catch (error) {
|
|
302
|
-
if (!ended) {
|
|
303
|
-
ended = true;
|
|
304
|
-
const failed = {
|
|
305
|
-
...current,
|
|
306
|
-
stopReason: "error",
|
|
307
|
-
errorMessage: String(error)
|
|
308
|
-
};
|
|
309
|
-
output.push({
|
|
310
|
-
type: "error",
|
|
311
|
-
reason: "error",
|
|
312
|
-
error: failed
|
|
313
|
-
});
|
|
314
|
-
output.end();
|
|
315
|
-
}
|
|
316
|
-
} finally {
|
|
317
|
-
signal?.removeEventListener("abort", cancel);
|
|
318
|
-
}
|
|
319
|
-
})();
|
|
320
|
-
return output;
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
actors,
|
|
364
|
+
resolve
|
|
321
365
|
};
|
|
322
|
-
}
|
|
366
|
+
};
|
|
367
|
+
const toolMembers = /* @__PURE__ */ new WeakMap();
|
|
368
|
+
const preparedRequests = /* @__PURE__ */ new WeakMap();
|
|
369
|
+
const models = require_index$9.createModelDispatch(sourceModels, {
|
|
370
|
+
state,
|
|
371
|
+
laneProviderSessions,
|
|
372
|
+
guardModelRequest: options.guardModelRequest,
|
|
373
|
+
beforePayload: options.beforePayload,
|
|
374
|
+
authorizeRequest: operationModelPrompt ? (method, request) => {
|
|
375
|
+
const tail = request?.messages?.at(-1);
|
|
376
|
+
const authorize = method === "streamSimple" && tail && preparedRequests.get(tail);
|
|
377
|
+
if (!authorize) throw new Error("Verified operation actor unavailable.");
|
|
378
|
+
preparedRequests.delete(tail);
|
|
379
|
+
return authorize;
|
|
380
|
+
} : void 0,
|
|
381
|
+
context
|
|
382
|
+
});
|
|
323
383
|
const resolveToolContext = async (ctx) => typeof options.toolContext === "function" ? options.toolContext(ctx) : options.toolContext;
|
|
324
384
|
const nativeTool = (tool) => ({
|
|
325
385
|
name: tool.name,
|
|
@@ -330,194 +390,375 @@ async function createLaneRuntime(options, attached) {
|
|
|
330
390
|
replay: tool.replay ?? "unsafe",
|
|
331
391
|
executionMode: tool.executionMode,
|
|
332
392
|
async execute(args, api, ctx) {
|
|
333
|
-
if (!activeNames.has(tool.name)) throw new Error(`Tool '${tool.name}' is no longer active`);
|
|
393
|
+
if (!state.activeNames.has(tool.name)) throw new Error(`Tool '${tool.name}' is no longer active`);
|
|
334
394
|
let reported = "";
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
395
|
+
const invocationContext = operationModelPrompt ? (0, dist_interop_chordContext_mjs.withAbortSignal)(AbortSignal.any([]), ctx) : ctx;
|
|
396
|
+
const signal = operationModelPrompt ? invocationContext.abortSignal : void 0;
|
|
397
|
+
let boundRun;
|
|
398
|
+
if (signal) toolMembers.set(signal, async () => {
|
|
399
|
+
const active = async () => {
|
|
400
|
+
signal.throwIfAborted();
|
|
401
|
+
const live = await api.snapshot(_earendil_works_pi_durable.LiveDoc, api.conversationId, ctx);
|
|
402
|
+
const slot = live?.tools?.find(({ taskId, callId }) => taskId === api.taskId && callId === api.callId);
|
|
403
|
+
if (slot?.status !== "running" || slot.name !== tool.name || !live?.run?.inputs.length || !toolMembers.has(signal)) throw new Error("Verified operation actor unavailable.");
|
|
404
|
+
return live.run;
|
|
405
|
+
};
|
|
406
|
+
const run = await active();
|
|
407
|
+
const authority = await operationAuthority(run.inputs, api.conversationId, ctx);
|
|
408
|
+
if (!authority) throw new Error("Verified operation actor unavailable.");
|
|
409
|
+
const { actors, resolve } = authority;
|
|
410
|
+
if (resolve) await resolve(ctx);
|
|
411
|
+
const current = await active();
|
|
412
|
+
const member = actors[0];
|
|
413
|
+
if (current.taskId !== run.taskId || !(0, node_util.isDeepStrictEqual)(current.inputs, run.inputs) || actors.some(({ issuer, subject }) => issuer !== member.issuer || subject !== member.subject) || boundRun && (boundRun.taskId !== run.taskId || !(0, node_util.isDeepStrictEqual)(boundRun.inputs, run.inputs))) throw new Error("Verified operation actor unavailable.");
|
|
414
|
+
boundRun ??= {
|
|
415
|
+
taskId: run.taskId,
|
|
416
|
+
inputs: [...run.inputs]
|
|
417
|
+
};
|
|
418
|
+
return member;
|
|
419
|
+
});
|
|
420
|
+
try {
|
|
421
|
+
const toolContext = await resolveToolContext(ctx);
|
|
422
|
+
const run = (await api.snapshot(_earendil_works_pi_durable.LiveDoc, api.conversationId, ctx))?.run;
|
|
423
|
+
if (run?.inputs.length) {
|
|
424
|
+
if ((await operationAuthority(run.inputs, api.conversationId, ctx))?.resolve) {
|
|
425
|
+
if (!signal) throw new Error("Operation-specific authority unavailable.");
|
|
426
|
+
await toolMembers.get(signal)();
|
|
427
|
+
}
|
|
352
428
|
}
|
|
353
|
-
|
|
354
|
-
|
|
429
|
+
const pending = tool.execute(api.callId, args, (partial) => {
|
|
430
|
+
const snapshot = partial.content.map((part) => part.type === "text" ? part.text : "").join("");
|
|
431
|
+
const chunk = snapshot.startsWith(reported) ? snapshot.slice(reported.length) : `\n${snapshot}`;
|
|
432
|
+
reported = snapshot;
|
|
433
|
+
if (chunk) api.output(chunk);
|
|
434
|
+
if (partial.details !== void 0) api.details(json(partial.details), ctx).catch((error) => emit({
|
|
435
|
+
type: "error",
|
|
436
|
+
error: String(error)
|
|
437
|
+
}));
|
|
438
|
+
}, toolContext, {
|
|
439
|
+
...options.beforeTool && options.afterTool ? { toolContinuation: require_index$10.createToolContinuation({
|
|
440
|
+
toolName: tool.name,
|
|
441
|
+
parameters: tool.parameters,
|
|
442
|
+
beforeTool: options.beforeTool,
|
|
443
|
+
afterTool: options.afterTool,
|
|
444
|
+
assertAvailable() {
|
|
445
|
+
assertUnlocked();
|
|
446
|
+
if (state.disposed || disposePromise || state.quarantined || !state.activeNames.has(tool.name) || !tools.includes(tool)) throw new Error(`Tool '${tool.name}' is no longer active`);
|
|
447
|
+
}
|
|
448
|
+
}) } : {},
|
|
449
|
+
invocationId: String(api.taskId),
|
|
450
|
+
operationId: String(api.taskId),
|
|
451
|
+
turnId: String(api.taskId),
|
|
452
|
+
getMemo: (name) => api.memo(name, ctx),
|
|
453
|
+
setMemo: async (name, value) => {
|
|
454
|
+
if (value === void 0) throw new Error("Durable invocation memos cannot be deleted");
|
|
455
|
+
await api.memo(name, value, ctx);
|
|
456
|
+
}
|
|
457
|
+
}, invocationContext);
|
|
458
|
+
const result = await (0, dist_interop_chordContext_mjs.awaitWithContext)(pending, ctx);
|
|
459
|
+
return {
|
|
460
|
+
output: result.content,
|
|
461
|
+
isError: result.isError,
|
|
462
|
+
...result.details === void 0 ? {} : { details: json(result.details) }
|
|
463
|
+
};
|
|
464
|
+
} catch (error) {
|
|
465
|
+
thrownFailures.set(api.callId, thrownToolFailure(error));
|
|
466
|
+
throw error;
|
|
467
|
+
} finally {
|
|
468
|
+
if (signal) toolMembers.delete(signal);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
let offered = [];
|
|
473
|
+
let shownOrder = [];
|
|
474
|
+
const inShownOrder = (previous, keys) => {
|
|
475
|
+
const rank = new Map(previous.map((key, index) => [key, index]));
|
|
476
|
+
const kept = keys.filter((key) => rank.has(key));
|
|
477
|
+
kept.sort((left, right) => rank.get(left) - rank.get(right));
|
|
478
|
+
return [...kept, ...keys.filter((key) => !rank.has(key))];
|
|
479
|
+
};
|
|
480
|
+
const inOfferedOrder = (candidates) => {
|
|
481
|
+
const rank = new Map(offered.map((tool, index) => [tool.name, index]));
|
|
482
|
+
const native = candidates.map(nativeTool);
|
|
483
|
+
const unchanged = (tool) => {
|
|
484
|
+
const index = rank.get(tool.name);
|
|
485
|
+
return index !== void 0 && (0, _earendil_works_pi_ai_utils_transcript.declarationsEqual)(offered[index], tool);
|
|
486
|
+
};
|
|
487
|
+
return [...native.filter(unchanged).sort((left, right) => rank.get(left.name) - rank.get(right.name)), ...native.filter((tool) => !unchanged(tool))];
|
|
488
|
+
};
|
|
489
|
+
const offeredTools = () => inOfferedOrder(tools.filter((t) => state.activeNames.has(t.name)));
|
|
490
|
+
const readTranscriptOrder = async (ctx) => {
|
|
491
|
+
const { messages } = await conversation.context(ctx);
|
|
492
|
+
const shown = /* @__PURE__ */ new Set();
|
|
493
|
+
for (const message of messages) if (message.role === "system") for (const [key, value] of Object.entries(message.sections ?? {})) if (value === null) shown.delete(key);
|
|
494
|
+
else shown.add(key);
|
|
495
|
+
shownOrder = [...shown];
|
|
496
|
+
offered = (0, _earendil_works_pi_ai_utils_transcript.getCurrentTools)(messages);
|
|
497
|
+
};
|
|
498
|
+
const listedSections = () => {
|
|
499
|
+
const listed = typeof options.systemPromptSections === "function" ? options.systemPromptSections() : options.systemPromptSections;
|
|
500
|
+
return listed?.length ? [...listed, UNLISTED_PROMPT_SECTION] : ["po"];
|
|
501
|
+
};
|
|
502
|
+
let rendered;
|
|
503
|
+
const renderPrompt = async (keys, ctx) => {
|
|
504
|
+
const prompt = typeof options.systemPrompt === "function" ? await options.systemPrompt(await resolveToolContext(ctx), ctx) : options.systemPrompt ?? "";
|
|
505
|
+
if (typeof prompt !== "string") {
|
|
506
|
+
const isTail = options.isTailSection ?? (() => false);
|
|
507
|
+
const parts = Object.entries(prompt);
|
|
508
|
+
const sections = Object.fromEntries(parts.filter(([key]) => !isTail(key)));
|
|
509
|
+
const tail = Object.fromEntries(parts.filter(([key]) => isTail(key)));
|
|
510
|
+
const unlisted = Object.keys(sections).filter((key) => !keys.includes(key));
|
|
355
511
|
return {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
512
|
+
sections: unlisted.length ? {
|
|
513
|
+
...sections,
|
|
514
|
+
[UNLISTED_PROMPT_SECTION]: unlisted.map((key) => sections[key]).join("\n\n")
|
|
515
|
+
} : sections,
|
|
516
|
+
tail
|
|
359
517
|
};
|
|
360
518
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
519
|
+
const skills = options.systemPrompt === void 0 ? require_index$3.formatSkillsForSystemPrompt(resources.skills ?? []) : "";
|
|
520
|
+
return {
|
|
521
|
+
sections: { [keys[0]]: [prompt, skills].filter(Boolean).join("\n\n") },
|
|
522
|
+
tail: {}
|
|
523
|
+
};
|
|
524
|
+
};
|
|
525
|
+
const install = () => {
|
|
526
|
+
const keys = inShownOrder(shownOrder, listedSections());
|
|
527
|
+
registry.install({
|
|
528
|
+
name: extensionName,
|
|
529
|
+
tools: inOfferedOrder(tools),
|
|
530
|
+
sections: keys.map((key, index) => ({
|
|
531
|
+
key,
|
|
532
|
+
tag: false,
|
|
533
|
+
async render(input, ctx) {
|
|
534
|
+
if (index === 0) {
|
|
535
|
+
state.preparationFailure = void 0;
|
|
536
|
+
rendered = void 0;
|
|
537
|
+
try {
|
|
538
|
+
rendered = await renderPrompt(keys, ctx);
|
|
539
|
+
} catch (error) {
|
|
540
|
+
state.preparationFailure = error;
|
|
541
|
+
throw error;
|
|
542
|
+
}
|
|
543
|
+
if (input.conversationId === conversation.id) {
|
|
544
|
+
const visible = keys.filter((key) => rendered.sections[key] !== void 0);
|
|
545
|
+
shownOrder = inShownOrder(Object.keys(input.shown), visible);
|
|
546
|
+
offered = input.agent.tools;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (!rendered) throw new Error("The system prompt was not prepared for this request.");
|
|
550
|
+
if (index === 0) options.onSystemPromptOrder?.([...inShownOrder(Object.keys(input.shown), keys.filter((key) => rendered.sections[key] !== void 0)), ...Object.keys(rendered.tail)]);
|
|
551
|
+
return rendered.sections[key];
|
|
375
552
|
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
553
|
+
})),
|
|
554
|
+
hooks: [
|
|
555
|
+
(0, _earendil_works_pi_durable.hook)(_earendil_works_pi_durable.GenerationTask, {
|
|
556
|
+
async afterTools(_assistant, _results, api, ctx) {
|
|
557
|
+
const lane = conversation;
|
|
558
|
+
if (lane.id !== api.conversationId) return;
|
|
559
|
+
await flushToolBoundary();
|
|
560
|
+
for (const registration of checkpointBoundaries) {
|
|
561
|
+
if (!registration.active || state.disposed || ctx.abortSignal?.aborted || external) continue;
|
|
562
|
+
let open = true;
|
|
563
|
+
try {
|
|
564
|
+
await registration.callback({
|
|
565
|
+
signal: ctx.abortSignal,
|
|
566
|
+
appendMessage: (message, messageOptions) => commitCheckpointMessage(registration, lane, message, ctx, () => open, api.taskId, messageOptions)
|
|
567
|
+
});
|
|
568
|
+
} finally {
|
|
569
|
+
open = false;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
async beforeRequest(request, api, ctx) {
|
|
574
|
+
assertUnlocked();
|
|
387
575
|
try {
|
|
388
|
-
await
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
576
|
+
const agent = await conversation.agent(ctx);
|
|
577
|
+
const model = agent.model ? models.getModel(agent.model.provider, agent.model.modelId) : void 0;
|
|
578
|
+
await options.beforeModelRequest?.({
|
|
579
|
+
phase: "turn",
|
|
580
|
+
model,
|
|
581
|
+
prompt: [...request.messages],
|
|
582
|
+
resources
|
|
583
|
+
}, ctx);
|
|
584
|
+
const systemPrompt = (0, _earendil_works_pi_ai_utils_transcript.getCurrentSystemPrompt)(request.messages);
|
|
585
|
+
const contextMessages = options.transformContext ? restoreCustomContextMessages(request.messages, await conversation.context(ctx)) : request.messages.filter((message) => message.role !== "system");
|
|
586
|
+
const originalContext = structuredClone(contextMessages);
|
|
587
|
+
const patch = await options.transformContext?.({
|
|
588
|
+
messages: contextMessages,
|
|
589
|
+
systemPrompt
|
|
590
|
+
}, ctx);
|
|
591
|
+
let messages = patch && (patch.systemPrompt !== void 0 && patch.systemPrompt !== systemPrompt || patch.messages !== void 0 && !(0, node_util.isDeepStrictEqual)(patch.messages, originalContext)) ? [{
|
|
592
|
+
role: "system",
|
|
593
|
+
content: patch.systemPrompt ?? systemPrompt,
|
|
594
|
+
timestamp: Date.now(),
|
|
595
|
+
toolsAdded: (0, _earendil_works_pi_ai_utils_transcript.getCurrentTools)(request.messages)
|
|
596
|
+
}, ...require_index.convertToLlm(patch.messages ?? request.messages.filter((m) => m.role !== "system"))] : [...request.messages];
|
|
597
|
+
if (options.toProviderMessages) messages = await options.toProviderMessages(messages, ctx);
|
|
598
|
+
if (options.isTailSection) messages = withoutTailSections(messages, options.isTailSection);
|
|
599
|
+
const tail = (rendered ?? await renderPrompt(listedSections(), ctx)).tail;
|
|
600
|
+
state.endsWithTail = Object.keys(tail).length > 0;
|
|
601
|
+
if (state.endsWithTail) messages = [...messages, {
|
|
602
|
+
role: "system",
|
|
603
|
+
content: "",
|
|
604
|
+
sections: { ...tail },
|
|
605
|
+
timestamp: Date.now()
|
|
606
|
+
}];
|
|
607
|
+
messages = await fitProviderImages(messages);
|
|
608
|
+
await options.beforeModelRequest?.({
|
|
609
|
+
phase: "request",
|
|
610
|
+
model,
|
|
611
|
+
resources
|
|
612
|
+
}, ctx);
|
|
613
|
+
const run = (await api.snapshot(_earendil_works_pi_durable.LiveDoc, api.conversationId, ctx))?.run;
|
|
614
|
+
const authority = run?.inputs.length ? await operationAuthority(run.inputs, api.conversationId, ctx) : void 0;
|
|
615
|
+
if (operationModelPrompt || authority) {
|
|
616
|
+
if (run?.taskId !== api.taskId || !run.inputs.length || !authority) throw new Error("Verified operation actor unavailable.");
|
|
617
|
+
const resolve = authority.resolve ?? ((context, expectedVersion) => expectedVersion === void 0 ? operationModelPrompt(authority.actors, context) : operationModelPrompt(authority.actors, context, expectedVersion));
|
|
618
|
+
const { content, version } = await resolve(ctx);
|
|
619
|
+
ctx.abortSignal?.throwIfAborted();
|
|
620
|
+
const persona = {
|
|
621
|
+
role: "system",
|
|
622
|
+
content,
|
|
623
|
+
timestamp: Date.now()
|
|
624
|
+
};
|
|
625
|
+
const inputs = [...run.inputs];
|
|
626
|
+
preparedRequests.set(persona, async () => {
|
|
627
|
+
const currentRun = (await api.snapshot(_earendil_works_pi_durable.LiveDoc, api.conversationId, ctx))?.run;
|
|
628
|
+
if (currentRun?.taskId !== api.taskId || !(0, node_util.isDeepStrictEqual)(currentRun.inputs, inputs)) throw new Error("Verified operation actor unavailable.");
|
|
629
|
+
await operationAuthority(inputs, api.conversationId, ctx);
|
|
630
|
+
const current = await resolve(ctx, version);
|
|
631
|
+
if (current.version !== version || current.content !== content) throw new Error("Pinned profile changed before dispatch.");
|
|
632
|
+
const checkedRun = (await api.snapshot(_earendil_works_pi_durable.LiveDoc, api.conversationId, ctx))?.run;
|
|
633
|
+
if (checkedRun?.taskId !== api.taskId || !(0, node_util.isDeepStrictEqual)(checkedRun.inputs, inputs)) throw new Error("Verified operation actor unavailable.");
|
|
634
|
+
ctx.abortSignal?.throwIfAborted();
|
|
635
|
+
});
|
|
636
|
+
messages.push(persona);
|
|
637
|
+
}
|
|
638
|
+
return { messages };
|
|
639
|
+
} catch (error) {
|
|
640
|
+
state.preparationFailure = error;
|
|
641
|
+
throw error;
|
|
394
642
|
}
|
|
395
643
|
}
|
|
396
|
-
},
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}, ctx);
|
|
408
|
-
const systemPrompt = (0, _earendil_works_pi_ai_utils_transcript.getCurrentSystemPrompt)(request.messages);
|
|
409
|
-
const contextMessages = options.transformContext ? restoreCustomContextMessages(request.messages, await conversation.context(ctx)) : request.messages.filter((message) => message.role !== "system");
|
|
410
|
-
const originalContext = structuredClone(contextMessages);
|
|
411
|
-
const patch = await options.transformContext?.({
|
|
412
|
-
messages: contextMessages,
|
|
413
|
-
systemPrompt
|
|
644
|
+
}),
|
|
645
|
+
(0, _earendil_works_pi_durable.hook)(_earendil_works_pi_durable.ToolTask, {
|
|
646
|
+
async beforeTool(call, _api, ctx) {
|
|
647
|
+
if (require_index$10.isBashSequenceEnvelope(call.name, call.arguments)) {
|
|
648
|
+
if (!options.beforeTool || !options.afterTool) throw new Error("Bash sequences require retained host policy support.");
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const patch = await options.beforeTool?.({
|
|
652
|
+
toolCallId: call.id,
|
|
653
|
+
toolName: call.name,
|
|
654
|
+
args: call.arguments
|
|
414
655
|
}, ctx);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
656
|
+
if (patch?.block?.terminate) terminatingCalls.add(call.id);
|
|
657
|
+
if (patch?.args) hookedArgs.set(call.id, patch.args);
|
|
658
|
+
return patch ? {
|
|
659
|
+
arguments: patch.args,
|
|
660
|
+
block: patch.block?.reason
|
|
661
|
+
} : void 0;
|
|
662
|
+
},
|
|
663
|
+
async afterTool(call, executed, _api, ctx) {
|
|
664
|
+
const thrown = thrownFailures.get(call.id);
|
|
665
|
+
thrownFailures.delete(call.id);
|
|
666
|
+
if (require_index$10.isBashSequenceEnvelope(call.name, call.arguments)) return void 0;
|
|
667
|
+
if (executed.diagnostics?.some((diagnostic) => HARNESS_TOOL_CODES.has(diagnostic.code ?? ""))) return terminatingCalls.delete(call.id) ? {
|
|
668
|
+
...executed,
|
|
669
|
+
control: {
|
|
670
|
+
...executed.control,
|
|
671
|
+
terminate: true
|
|
672
|
+
}
|
|
673
|
+
} : void 0;
|
|
674
|
+
const details = executed.details;
|
|
675
|
+
const detailsRecord = details !== null && typeof details === "object" && !Array.isArray(details) ? details : void 0;
|
|
676
|
+
const result = thrown && executed.isError && detailsRecord?.failure === void 0 ? {
|
|
677
|
+
...executed,
|
|
678
|
+
details: {
|
|
679
|
+
...detailsRecord,
|
|
680
|
+
failure: thrown
|
|
681
|
+
}
|
|
682
|
+
} : executed;
|
|
683
|
+
const patch = await options.afterTool?.({
|
|
684
|
+
toolCallId: call.id,
|
|
685
|
+
toolName: call.name,
|
|
686
|
+
args: call.arguments,
|
|
687
|
+
content: result.output ?? [],
|
|
688
|
+
details: result.details,
|
|
689
|
+
isError: result.isError ?? false,
|
|
690
|
+
usage: result.usage
|
|
426
691
|
}, ctx);
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
692
|
+
const { content: patchedOutput, terminate: _terminate, ...patchFields } = patch ?? {};
|
|
693
|
+
return patch ? {
|
|
694
|
+
...result,
|
|
695
|
+
...patchFields,
|
|
696
|
+
...patchedOutput === void 0 ? {} : { output: patchedOutput },
|
|
697
|
+
control: patch.terminate || terminatingCalls.delete(call.id) ? {
|
|
698
|
+
...result.control,
|
|
699
|
+
terminate: true
|
|
700
|
+
} : result.control
|
|
701
|
+
} : terminatingCalls.delete(call.id) ? {
|
|
702
|
+
...result,
|
|
703
|
+
control: {
|
|
704
|
+
...result.control,
|
|
705
|
+
terminate: true
|
|
706
|
+
}
|
|
707
|
+
} : result === executed ? void 0 : result;
|
|
431
708
|
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
terminate: true
|
|
465
|
-
} : result.control
|
|
466
|
-
} : terminatingCalls.delete(call.id) ? {
|
|
467
|
-
...result,
|
|
468
|
-
control: {
|
|
469
|
-
...result.control,
|
|
470
|
-
terminate: true
|
|
471
|
-
}
|
|
472
|
-
} : void 0;
|
|
473
|
-
}
|
|
474
|
-
}),
|
|
475
|
-
(0, _earendil_works_pi_durable.hook)(_earendil_works_pi_durable.CompactionTask, { async beforeCompact(input, api, ctx) {
|
|
476
|
-
const swapped = manualCompaction.conversationId;
|
|
477
|
-
if (input.reason === "threshold" && swapped !== void 0 && swapped !== String(api.conversationId)) return { decline: true };
|
|
478
|
-
if (!options.beforeCompaction) return;
|
|
479
|
-
const entries = require_index.projectDurableEntries(input.entries);
|
|
480
|
-
const patch = await options.beforeCompaction({
|
|
481
|
-
reason: input.reason,
|
|
482
|
-
customInstructions: input.instructions,
|
|
483
|
-
preparation: {
|
|
484
|
-
entries,
|
|
485
|
-
messages: [...input.messages],
|
|
486
|
-
tokensBefore: 0,
|
|
487
|
-
retainedTail: [],
|
|
488
|
-
firstKeptEntryId: String(input.firstKept),
|
|
489
|
-
messagesToSummarize: [...input.messages],
|
|
490
|
-
turnPrefixMessages: [],
|
|
491
|
-
isSplitTurn: false,
|
|
492
|
-
fileOps: {
|
|
493
|
-
read: /* @__PURE__ */ new Set(),
|
|
494
|
-
written: /* @__PURE__ */ new Set(),
|
|
495
|
-
edited: /* @__PURE__ */ new Set()
|
|
496
|
-
},
|
|
497
|
-
settings: {
|
|
498
|
-
enabled: options.compaction?.enabled ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.enabled,
|
|
499
|
-
reserveTokens: options.compaction?.reserveTokens ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.reserveTokens,
|
|
500
|
-
keepRecentTokens: options.compaction?.keepRecentTokens ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.keepRecentTokens
|
|
709
|
+
}),
|
|
710
|
+
(0, _earendil_works_pi_durable.hook)(_earendil_works_pi_durable.CompactionTask, { async beforeCompact(input, api, ctx) {
|
|
711
|
+
const swapped = manualCompaction.conversationId;
|
|
712
|
+
if (input.reason === "threshold" && swapped !== void 0 && swapped !== String(api.conversationId)) return { kind: "decline" };
|
|
713
|
+
if (manualCompaction.clear && swapped === String(api.conversationId)) return {
|
|
714
|
+
kind: "summary",
|
|
715
|
+
summary: CLEARED_SUMMARY
|
|
716
|
+
};
|
|
717
|
+
if (!options.beforeCompaction) return;
|
|
718
|
+
const entries = require_index$1.projectDurableEntries(input.entries);
|
|
719
|
+
const patch = await options.beforeCompaction({
|
|
720
|
+
reason: input.reason,
|
|
721
|
+
customInstructions: input.instructions,
|
|
722
|
+
preparation: {
|
|
723
|
+
entries,
|
|
724
|
+
messages: [...input.messages],
|
|
725
|
+
tokensBefore: 0,
|
|
726
|
+
retainedTail: [],
|
|
727
|
+
firstKeptEntryId: String(input.firstKept),
|
|
728
|
+
messagesToSummarize: [...input.messages],
|
|
729
|
+
turnPrefixMessages: [],
|
|
730
|
+
isSplitTurn: false,
|
|
731
|
+
fileOps: {
|
|
732
|
+
read: /* @__PURE__ */ new Set(),
|
|
733
|
+
written: /* @__PURE__ */ new Set(),
|
|
734
|
+
edited: /* @__PURE__ */ new Set()
|
|
735
|
+
},
|
|
736
|
+
settings: {
|
|
737
|
+
enabled: options.compaction?.enabled ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.enabled,
|
|
738
|
+
reserveTokens: options.compaction?.reserveTokens ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.reserveTokens,
|
|
739
|
+
keepRecentTokens: options.compaction?.keepRecentTokens ?? _earendil_works_pi_durable.DEFAULT_COMPACTION_POLICY.keepRecentTokens
|
|
740
|
+
}
|
|
501
741
|
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
742
|
+
}, ctx);
|
|
743
|
+
if (patch?.decline) return { kind: "decline" };
|
|
744
|
+
if (patch?.compaction) return {
|
|
745
|
+
kind: "summary",
|
|
746
|
+
summary: patch.compaction.summary
|
|
747
|
+
};
|
|
748
|
+
} })
|
|
749
|
+
]
|
|
750
|
+
});
|
|
751
|
+
};
|
|
509
752
|
install();
|
|
510
753
|
if (!attached) registry.install(require_extension.SubagentsExtension);
|
|
511
|
-
const harness = attached?.harness ?? await _earendil_works_pi_durable.Harness.open(
|
|
754
|
+
const harness = attached?.harness ?? await _earendil_works_pi_durable.Harness.open(projection.storage, {
|
|
512
755
|
models,
|
|
513
756
|
registry,
|
|
514
|
-
|
|
515
|
-
return settings;
|
|
516
|
-
},
|
|
757
|
+
settings: () => settings,
|
|
517
758
|
env: () => environment,
|
|
518
|
-
onReport: (
|
|
759
|
+
onReport: (report) => emit({
|
|
519
760
|
type: "handler_error",
|
|
520
|
-
error: String(error)
|
|
761
|
+
error: String(report.error)
|
|
521
762
|
})
|
|
522
763
|
}, context);
|
|
523
764
|
if (!attached) startupHarness = harness;
|
|
@@ -525,11 +766,14 @@ async function createLaneRuntime(options, attached) {
|
|
|
525
766
|
let sessionId;
|
|
526
767
|
if (attached) {
|
|
527
768
|
conversation = attached.conversation;
|
|
769
|
+
await readTranscriptOrder(context);
|
|
770
|
+
install();
|
|
528
771
|
if (!options.sessionId) throw new Error("A lane requires its session identity.");
|
|
529
772
|
sessionId = options.sessionId;
|
|
773
|
+
state.sessionId = sessionId;
|
|
530
774
|
await writable(() => conversation.configure({
|
|
531
775
|
extensions: [{ name: extensionName }],
|
|
532
|
-
tools:
|
|
776
|
+
tools: offeredTools(),
|
|
533
777
|
modelTools: null,
|
|
534
778
|
instructions: null,
|
|
535
779
|
cwd: options.cwd,
|
|
@@ -550,8 +794,10 @@ async function createLaneRuntime(options, attached) {
|
|
|
550
794
|
} } : {},
|
|
551
795
|
...options.thinkingLevel ? { thinkingLevel: options.thinkingLevel } : {}
|
|
552
796
|
} });
|
|
553
|
-
const activeId = await require_index$
|
|
797
|
+
const activeId = await require_index$5.initializeDurableNavigation(harness, root.id, context);
|
|
554
798
|
conversation = await harness.conversation(activeId, context);
|
|
799
|
+
await readTranscriptOrder(context);
|
|
800
|
+
install();
|
|
555
801
|
const storedAgent = await harness.snapshot(_earendil_works_pi_durable.AgentDoc, conversation.id, context);
|
|
556
802
|
const initialModel = options.model ?? models.getModels()[0];
|
|
557
803
|
await conversation.configure({
|
|
@@ -560,15 +806,15 @@ async function createLaneRuntime(options, attached) {
|
|
|
560
806
|
modelId: initialModel.id
|
|
561
807
|
} } : {},
|
|
562
808
|
...!storedAgent?.thinkingLevel && options.thinkingLevel ? { thinkingLevel: options.thinkingLevel } : {},
|
|
563
|
-
tools:
|
|
809
|
+
tools: offeredTools()
|
|
564
810
|
}, context);
|
|
565
811
|
const storedFastMode = await harness.snapshot(require_docs.FastModeDoc, context);
|
|
566
|
-
fastMode = storedFastMode?.enabled ?? options.initialFastMode ?? false;
|
|
812
|
+
state.fastMode = storedFastMode?.enabled ?? options.initialFastMode ?? false;
|
|
567
813
|
const storedAgentLock = await harness.snapshot(require_docs.AgentLockDoc, context);
|
|
568
|
-
agentLocked = storedAgentLock?.locked ?? options.initialAgentLocked ?? false;
|
|
569
|
-
const
|
|
570
|
-
const mainSessionId = storedIdentity?.id || options.sessionId || (0, node_crypto.randomUUID)();
|
|
814
|
+
state.agentLocked = storedAgentLock?.locked ?? options.initialAgentLocked ?? false;
|
|
815
|
+
const mainSessionId = (await harness.snapshot(require_docs.SessionIdentityDoc, context))?.id || options.sessionId || (0, node_crypto.randomUUID)();
|
|
571
816
|
sessionId = mainSessionId;
|
|
817
|
+
state.sessionId = sessionId;
|
|
572
818
|
const lane = conversation;
|
|
573
819
|
await writable(() => harness.commit(async (tx) => {
|
|
574
820
|
const identity = await tx.doc(require_docs.SessionIdentityDoc);
|
|
@@ -577,22 +823,23 @@ async function createLaneRuntime(options, attached) {
|
|
|
577
823
|
identity.createdAt = Date.now();
|
|
578
824
|
identity.parentSessionId = options.parentSessionId ?? "";
|
|
579
825
|
}
|
|
580
|
-
if (!storedAgentLock && options.initialAgentLocked !== void 0) (await tx.doc(require_docs.AgentLockDoc)).locked = agentLocked;
|
|
826
|
+
if (!storedAgentLock && options.initialAgentLocked !== void 0) (await tx.doc(require_docs.AgentLockDoc)).locked = state.agentLocked;
|
|
581
827
|
if (!storedFastMode) {
|
|
582
|
-
(await tx.doc(require_docs.FastModeDoc)).enabled = fastMode;
|
|
828
|
+
(await tx.doc(require_docs.FastModeDoc)).enabled = state.fastMode;
|
|
583
829
|
if (options.initialFastMode !== void 0) await tx.appendEntry(lane.id, {
|
|
584
830
|
kind: "po.fast-mode",
|
|
585
831
|
data: {
|
|
586
832
|
version: 1,
|
|
587
|
-
enabled: fastMode,
|
|
833
|
+
enabled: state.fastMode,
|
|
588
834
|
sessionId: mainSessionId
|
|
589
835
|
}
|
|
590
836
|
});
|
|
591
837
|
}
|
|
592
838
|
const metadata = await tx.doc(require_docs.SessionMetadataDoc);
|
|
839
|
+
const fresh = metadata.workspaceRoot === "";
|
|
593
840
|
metadata.workspaceRoot ||= options.cwd;
|
|
594
841
|
if (options.lane !== void 0) metadata.laneName = options.lane;
|
|
595
|
-
if (
|
|
842
|
+
if (fresh && options.sessionName !== void 0) metadata.name = options.sessionName;
|
|
596
843
|
}, context));
|
|
597
844
|
}
|
|
598
845
|
const laneName = options.lane ?? "main";
|
|
@@ -623,6 +870,18 @@ async function createLaneRuntime(options, attached) {
|
|
|
623
870
|
return result;
|
|
624
871
|
}, context));
|
|
625
872
|
};
|
|
873
|
+
let admissionRevision = 0;
|
|
874
|
+
let releaseAdmissions = 0;
|
|
875
|
+
const trackReleaseAdmission = (admit) => async (...args) => {
|
|
876
|
+
admissionRevision++;
|
|
877
|
+
releaseAdmissions++;
|
|
878
|
+
try {
|
|
879
|
+
return await admit(...args);
|
|
880
|
+
} finally {
|
|
881
|
+
releaseAdmissions--;
|
|
882
|
+
admissionRevision++;
|
|
883
|
+
}
|
|
884
|
+
};
|
|
626
885
|
let userAdmission = false;
|
|
627
886
|
let promptAdmissions = 0;
|
|
628
887
|
let userAdmissionSettled = Promise.resolve();
|
|
@@ -656,7 +915,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
656
915
|
status: "open"
|
|
657
916
|
} : null);
|
|
658
917
|
const runAtToolBoundary = (callback) => {
|
|
659
|
-
if (disposed || disposePromise) return Promise.reject(/* @__PURE__ */ new Error("Direct harness is disposed"));
|
|
918
|
+
if (state.disposed || disposePromise) return Promise.reject(/* @__PURE__ */ new Error("Direct harness is disposed"));
|
|
660
919
|
return new Promise((resolve, reject) => {
|
|
661
920
|
const pending = {
|
|
662
921
|
async run() {
|
|
@@ -684,13 +943,24 @@ async function createLaneRuntime(options, attached) {
|
|
|
684
943
|
const record = await readRecord();
|
|
685
944
|
const inbox = await harness.snapshot(_earendil_works_pi_durable.InboxDoc, conversation.id, context);
|
|
686
945
|
const handedOff = [];
|
|
946
|
+
const steers = [];
|
|
687
947
|
for (const item of inbox?.items ?? []) {
|
|
688
948
|
if (item.mode === "write") continue;
|
|
689
949
|
const requestId = (await storage.storage.submission(item.id, context))?.requestId;
|
|
690
|
-
if (!requestId?.startsWith(require_index$
|
|
950
|
+
if (!requestId?.startsWith(require_index$6.heldRequestId(""))) {
|
|
951
|
+
if (item.mode === "steer" && !(requestId !== void 0 && internalDeliveries.has(requestId))) {
|
|
952
|
+
const sender = humanInputSender(item.entry?.data);
|
|
953
|
+
steers.push({
|
|
954
|
+
id: String(item.id),
|
|
955
|
+
...fromContent(item.content, item.entry?.data),
|
|
956
|
+
...sender ? { sender } : {}
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
691
961
|
handedOff.push({
|
|
692
|
-
id: requestId.slice(require_index$
|
|
693
|
-
...fromContent(item.content),
|
|
962
|
+
id: requestId.slice(require_index$6.heldRequestId("").length),
|
|
963
|
+
...fromContent(item.content, item.entry?.data),
|
|
694
964
|
delivery: item.mode,
|
|
695
965
|
scheduling: "automatic",
|
|
696
966
|
disposition: "handoff"
|
|
@@ -703,16 +973,72 @@ async function createLaneRuntime(options, attached) {
|
|
|
703
973
|
...item,
|
|
704
974
|
disposition: "pending"
|
|
705
975
|
}))],
|
|
706
|
-
operation: await execution()
|
|
976
|
+
operation: await execution(),
|
|
977
|
+
...steers.length ? { steers } : {}
|
|
707
978
|
};
|
|
708
979
|
};
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
980
|
+
let publishChain = Promise.resolve();
|
|
981
|
+
const publish = () => {
|
|
982
|
+
const run = publishChain.then(async () => {
|
|
983
|
+
const lifecycle = await readLifecycle();
|
|
984
|
+
emit({
|
|
985
|
+
type: "lifecycle_update",
|
|
986
|
+
lifecycle
|
|
987
|
+
});
|
|
988
|
+
return lifecycle;
|
|
989
|
+
});
|
|
990
|
+
publishChain = run.catch(() => void 0);
|
|
991
|
+
return run;
|
|
992
|
+
};
|
|
713
993
|
let watcher;
|
|
714
994
|
let eventsSettled = Promise.resolve();
|
|
995
|
+
let updateDepth = 0;
|
|
996
|
+
let updateBytes = 0;
|
|
997
|
+
let peakUpdateDepth = 0;
|
|
998
|
+
let peakUpdateBytes = 0;
|
|
999
|
+
let updateDrainStarted = 0;
|
|
1000
|
+
const enqueueUpdate = (update, eventContext, bytes) => {
|
|
1001
|
+
if (!options.onQueueDiagnostics) {
|
|
1002
|
+
eventsSettled = eventsSettled.then(() => deliver(update, eventContext));
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
if (updateDepth++ === 0) updateDrainStarted = Date.now();
|
|
1006
|
+
updateBytes += bytes;
|
|
1007
|
+
peakUpdateDepth = Math.max(peakUpdateDepth, updateDepth);
|
|
1008
|
+
peakUpdateBytes = Math.max(peakUpdateBytes, updateBytes);
|
|
1009
|
+
eventsSettled = eventsSettled.then(async () => {
|
|
1010
|
+
try {
|
|
1011
|
+
await deliver(update, eventContext);
|
|
1012
|
+
} finally {
|
|
1013
|
+
updateDepth--;
|
|
1014
|
+
updateBytes -= bytes;
|
|
1015
|
+
if (updateDepth === 0) {
|
|
1016
|
+
try {
|
|
1017
|
+
options.onQueueDiagnostics?.({
|
|
1018
|
+
queue: "extension_updates",
|
|
1019
|
+
outcome: "drained",
|
|
1020
|
+
depth: updateDepth,
|
|
1021
|
+
max_depth: peakUpdateDepth,
|
|
1022
|
+
estimated_bytes: updateBytes,
|
|
1023
|
+
max_estimated_bytes: peakUpdateBytes,
|
|
1024
|
+
duration_ms: Date.now() - updateDrainStarted
|
|
1025
|
+
});
|
|
1026
|
+
} catch (error) {
|
|
1027
|
+
emit({
|
|
1028
|
+
type: "handler_error",
|
|
1029
|
+
error: String(error)
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
peakUpdateDepth = 0;
|
|
1033
|
+
peakUpdateBytes = 0;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
};
|
|
715
1038
|
let settling = 0;
|
|
1039
|
+
let settleCohort;
|
|
1040
|
+
let promotingCohort = false;
|
|
1041
|
+
let stopAdmissions = 0;
|
|
716
1042
|
const admittingInternal = /* @__PURE__ */ new Set();
|
|
717
1043
|
const reconcilingInternal = /* @__PURE__ */ new Map();
|
|
718
1044
|
const internalDelivery = /* @__PURE__ */ new Map();
|
|
@@ -728,12 +1054,12 @@ async function createLaneRuntime(options, attached) {
|
|
|
728
1054
|
type: "write",
|
|
729
1055
|
requestId: (0, node_crypto.randomUUID)(),
|
|
730
1056
|
entry: {
|
|
731
|
-
kind:
|
|
1057
|
+
kind: PO_ENTRY_KIND,
|
|
732
1058
|
data: json({
|
|
733
1059
|
type: "message",
|
|
734
1060
|
message
|
|
735
1061
|
}),
|
|
736
|
-
model: require_index
|
|
1062
|
+
model: require_index.convertToLlm([message])
|
|
737
1063
|
}
|
|
738
1064
|
}, context));
|
|
739
1065
|
} catch (error) {
|
|
@@ -745,6 +1071,8 @@ async function createLaneRuntime(options, attached) {
|
|
|
745
1071
|
let logicalLoopActive = false;
|
|
746
1072
|
let lastAssistant;
|
|
747
1073
|
let partial;
|
|
1074
|
+
let activeRunId;
|
|
1075
|
+
const runEntryIds = /* @__PURE__ */ new Map();
|
|
748
1076
|
let toolResults = [];
|
|
749
1077
|
const deliver = async (event, eventContext) => {
|
|
750
1078
|
for (const listener of eventListeners) try {
|
|
@@ -758,14 +1086,27 @@ async function createLaneRuntime(options, attached) {
|
|
|
758
1086
|
};
|
|
759
1087
|
const attach = async () => {
|
|
760
1088
|
if (watcher) await watcher.stop();
|
|
761
|
-
watcher = await
|
|
762
|
-
let predecessor = watcher.
|
|
1089
|
+
watcher = await require_conversationEvents.watchConversationEvents(harness, conversation.id, context);
|
|
1090
|
+
let predecessor = watcher.predecessorId;
|
|
763
1091
|
const toolOutputs = /* @__PURE__ */ new Map();
|
|
764
1092
|
lastAssistant = void 0;
|
|
765
1093
|
partial = void 0;
|
|
766
1094
|
toolResults = [];
|
|
1095
|
+
let trackedInbox = new Set(((await harness.snapshot(_earendil_works_pi_durable.InboxDoc, conversation.id, context))?.items ?? []).map((item) => item.id));
|
|
767
1096
|
watcher.start(async (events, eventContext) => {
|
|
1097
|
+
const placedByEntryId = /* @__PURE__ */ new Map();
|
|
768
1098
|
for (const event of events) {
|
|
1099
|
+
if (event.type !== "inbox_update") continue;
|
|
1100
|
+
const current = new Set(event.items.map((item) => item.id));
|
|
1101
|
+
for (const id of trackedInbox) {
|
|
1102
|
+
if (current.has(id)) continue;
|
|
1103
|
+
const record = await storage.storage.submission(id, eventContext);
|
|
1104
|
+
if (record?.status === "placed") placedByEntryId.set(String(record.entry), String(id));
|
|
1105
|
+
}
|
|
1106
|
+
trackedInbox = current;
|
|
1107
|
+
}
|
|
1108
|
+
for (const event of events) {
|
|
1109
|
+
admissionRevision++;
|
|
769
1110
|
let mapped;
|
|
770
1111
|
if (event.type === "turn_start" || event.type === "run_start") {
|
|
771
1112
|
lastAssistant = void 0;
|
|
@@ -773,36 +1114,54 @@ async function createLaneRuntime(options, attached) {
|
|
|
773
1114
|
toolResults = [];
|
|
774
1115
|
}
|
|
775
1116
|
if (event.type === "message_end" || event.type === "entry_appended") {
|
|
776
|
-
const
|
|
777
|
-
|
|
1117
|
+
const entries = require_index$1.projectDurableEntries([event.entry]);
|
|
1118
|
+
const submissionId = placedByEntryId.get(String(event.entry.id));
|
|
1119
|
+
const turnId = event.turnId ?? (submissionId === void 0 ? void 0 : activeRunId);
|
|
1120
|
+
for (const entry of entries) {
|
|
778
1121
|
entry.parentId = predecessor === void 0 ? null : String(predecessor);
|
|
1122
|
+
const verified = {
|
|
1123
|
+
...entry,
|
|
1124
|
+
...turnId === void 0 ? {} : { turnId },
|
|
1125
|
+
...submissionId === void 0 ? {} : { submissionId }
|
|
1126
|
+
};
|
|
1127
|
+
if (turnId !== void 0) {
|
|
1128
|
+
let members = runEntryIds.get(turnId);
|
|
1129
|
+
if (!members) runEntryIds.set(turnId, members = /* @__PURE__ */ new Set());
|
|
1130
|
+
members.add(entry.id);
|
|
1131
|
+
}
|
|
779
1132
|
const added = {
|
|
780
1133
|
type: "entry_appended",
|
|
781
|
-
entry
|
|
1134
|
+
entry: verified
|
|
782
1135
|
};
|
|
783
1136
|
emit({
|
|
784
1137
|
type: "entry_appended",
|
|
785
|
-
entry
|
|
1138
|
+
entry: verified
|
|
786
1139
|
});
|
|
787
1140
|
eventsSettled = eventsSettled.then(() => deliver(added, eventContext));
|
|
788
1141
|
}
|
|
789
1142
|
predecessor = event.entry.id;
|
|
790
1143
|
}
|
|
1144
|
+
if (event.type === "run_start") activeRunId = String(event.inputs[0]);
|
|
791
1145
|
if ([
|
|
792
|
-
"run_start",
|
|
793
1146
|
"run_end",
|
|
794
1147
|
"turn_start",
|
|
795
1148
|
"compaction_start"
|
|
796
1149
|
].includes(event.type)) mapped = { type: event.type };
|
|
1150
|
+
if (event.type === "run_start") mapped = {
|
|
1151
|
+
type: "run_start",
|
|
1152
|
+
runId: activeRunId
|
|
1153
|
+
};
|
|
797
1154
|
if (event.type === "message_start") {
|
|
798
1155
|
if (event.message.role === "assistant") partial = structuredClone(event.message);
|
|
1156
|
+
const end = events.find((next) => next.type === "message_end" && next.entry.model?.[0] === event.message);
|
|
799
1157
|
mapped = {
|
|
800
1158
|
type: "message_start",
|
|
801
|
-
message: event.message
|
|
1159
|
+
message: event.message,
|
|
1160
|
+
...end?.type === "message_end" ? { entryId: String(end.entry.id) } : {}
|
|
802
1161
|
};
|
|
803
1162
|
}
|
|
804
1163
|
if (event.type === "message_end" && event.entry.model?.[0]) {
|
|
805
|
-
const projected = require_index.projectDurableEntries([event.entry])[0];
|
|
1164
|
+
const projected = require_index$1.projectDurableEntries([event.entry])[0];
|
|
806
1165
|
const message = projected?.type === "message" && projected.message.role === "custom" ? projected.message : event.entry.model[0];
|
|
807
1166
|
if (message.role === "assistant") lastAssistant = message;
|
|
808
1167
|
if (message.role === "toolResult") toolResults.push(message);
|
|
@@ -815,11 +1174,15 @@ async function createLaneRuntime(options, attached) {
|
|
|
815
1174
|
}
|
|
816
1175
|
if (event.type === "tool_execution_start") mapped = {
|
|
817
1176
|
...event,
|
|
818
|
-
type: "tool_execution_start"
|
|
1177
|
+
type: "tool_execution_start",
|
|
1178
|
+
args: hookedArgs.get(event.toolCallId) ?? event.args,
|
|
1179
|
+
...activeRunId === void 0 ? {} : { runId: activeRunId }
|
|
819
1180
|
};
|
|
820
1181
|
if (event.type === "tool_execution_end") {
|
|
821
1182
|
toolOutputs.delete(event.toolCallId);
|
|
822
|
-
|
|
1183
|
+
hookedArgs.delete(event.toolCallId);
|
|
1184
|
+
const position = event.entry?.model?.findIndex((m) => m.role === "toolResult") ?? -1;
|
|
1185
|
+
const result = position < 0 ? void 0 : event.entry.model[position];
|
|
823
1186
|
mapped = {
|
|
824
1187
|
type: "tool_execution_end",
|
|
825
1188
|
toolCallId: event.toolCallId,
|
|
@@ -828,14 +1191,16 @@ async function createLaneRuntime(options, attached) {
|
|
|
828
1191
|
content: result?.content ?? [],
|
|
829
1192
|
details: result?.details === void 0 ? void 0 : json(result.details)
|
|
830
1193
|
},
|
|
831
|
-
isError: result?.isError ?? true
|
|
1194
|
+
isError: result?.isError ?? true,
|
|
1195
|
+
...position < 0 ? {} : { entryId: position ? `${event.entry.id}:${position}` : String(event.entry.id) }
|
|
832
1196
|
};
|
|
833
1197
|
}
|
|
834
1198
|
if (event.type === "turn_end" && lastAssistant) {
|
|
835
1199
|
mapped = {
|
|
836
1200
|
type: "turn_end",
|
|
837
1201
|
message: lastAssistant,
|
|
838
|
-
toolResults
|
|
1202
|
+
toolResults,
|
|
1203
|
+
runId: activeRunId
|
|
839
1204
|
};
|
|
840
1205
|
toolResults = [];
|
|
841
1206
|
lastAssistant = void 0;
|
|
@@ -848,24 +1213,26 @@ async function createLaneRuntime(options, attached) {
|
|
|
848
1213
|
if (change.type === "text_delta" && block?.type === "text") block.text += change.delta;
|
|
849
1214
|
if (change.type === "thinking_delta" && block?.type === "thinking") block.thinking += change.delta;
|
|
850
1215
|
{
|
|
1216
|
+
const size = options.onQueueDiagnostics ? { bytes: 0 } : void 0;
|
|
1217
|
+
const snapshot = freezeSnapshot(structuredClone(partial), size);
|
|
851
1218
|
const update = {
|
|
852
1219
|
type: "message_update",
|
|
853
|
-
message:
|
|
1220
|
+
message: snapshot,
|
|
854
1221
|
event: "delta" in change ? {
|
|
855
1222
|
type: change.type,
|
|
856
1223
|
contentIndex: change.contentIndex,
|
|
857
1224
|
delta: change.delta,
|
|
858
|
-
partial:
|
|
1225
|
+
partial: snapshot
|
|
859
1226
|
} : {
|
|
860
1227
|
type: "start",
|
|
861
|
-
partial:
|
|
1228
|
+
partial: snapshot
|
|
862
1229
|
}
|
|
863
1230
|
};
|
|
864
1231
|
emit({
|
|
865
1232
|
type: "message_update",
|
|
866
1233
|
message: update.message
|
|
867
1234
|
});
|
|
868
|
-
|
|
1235
|
+
enqueueUpdate(update, eventContext, size?.bytes ?? 0);
|
|
869
1236
|
}
|
|
870
1237
|
}
|
|
871
1238
|
if (event.type === "tool_execution_update") {
|
|
@@ -898,10 +1265,17 @@ async function createLaneRuntime(options, attached) {
|
|
|
898
1265
|
error: event.error === void 0 ? void 0 : new Error(event.error)
|
|
899
1266
|
};
|
|
900
1267
|
}
|
|
901
|
-
if (event.type === "inbox_update")
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1268
|
+
if (event.type === "inbox_update") {
|
|
1269
|
+
mapped = {
|
|
1270
|
+
type: "queue_update",
|
|
1271
|
+
queues: event.items.map((item) => ({ kind: item.mode }))
|
|
1272
|
+
};
|
|
1273
|
+
publish().catch((error) => emit({
|
|
1274
|
+
type: "error",
|
|
1275
|
+
code: "lifecycle_update",
|
|
1276
|
+
error: String(error)
|
|
1277
|
+
}));
|
|
1278
|
+
}
|
|
905
1279
|
if (event.type === "message_end") {
|
|
906
1280
|
for (const message of event.entry.model ?? []) if (message.role === "assistant") eventsSettled = eventsSettled.then(() => deliver({
|
|
907
1281
|
type: "usage",
|
|
@@ -913,9 +1287,13 @@ async function createLaneRuntime(options, attached) {
|
|
|
913
1287
|
}
|
|
914
1288
|
if (!mapped) continue;
|
|
915
1289
|
if (mapped.type === "run_end") {
|
|
1290
|
+
const runId = String(event.type === "run_end" ? event.inputs[0] : conversation.id);
|
|
1291
|
+
const members = runEntryIds.get(runId) ?? /* @__PURE__ */ new Set();
|
|
1292
|
+
runEntryIds.delete(runId);
|
|
916
1293
|
const settledEvent = {
|
|
917
|
-
runId
|
|
918
|
-
timestamp: Date.now()
|
|
1294
|
+
runId,
|
|
1295
|
+
timestamp: Date.now(),
|
|
1296
|
+
entryIds: []
|
|
919
1297
|
};
|
|
920
1298
|
settling++;
|
|
921
1299
|
let released = false;
|
|
@@ -928,6 +1306,17 @@ async function createLaneRuntime(options, attached) {
|
|
|
928
1306
|
eventsSettled = eventsSettled.then(async () => {
|
|
929
1307
|
if (!await nativeExecution() && !external) await flushToolBoundary();
|
|
930
1308
|
await reconcile();
|
|
1309
|
+
const statuses = await Promise.all(event.type === "run_end" ? event.inputs.map(async (id) => {
|
|
1310
|
+
const submission = await harness.submission(id, eventContext);
|
|
1311
|
+
if (!submission) throw new Error(`Settled submission ${id} is unavailable`);
|
|
1312
|
+
return submission.status(eventContext);
|
|
1313
|
+
}) : []);
|
|
1314
|
+
for (const status of statuses) {
|
|
1315
|
+
if (!("entry" in status) || status.entry === void 0) continue;
|
|
1316
|
+
const raw = await storage.storage.entry(conversation.id, status.entry, eventContext);
|
|
1317
|
+
if (raw) for (const entry of require_index$1.projectDurableEntries([raw.entry])) members.add(entry.id);
|
|
1318
|
+
}
|
|
1319
|
+
settledEvent.entryIds = [...members];
|
|
931
1320
|
try {
|
|
932
1321
|
await writable(() => harness.commit((tx) => tx.appendEntry(conversation.id, {
|
|
933
1322
|
kind: require_agentSettled.AGENT_SETTLED_ENTRY_TYPE,
|
|
@@ -942,11 +1331,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
942
1331
|
}
|
|
943
1332
|
const live = await harness.snapshot(_earendil_works_pi_durable.LiveDoc, conversation.id, eventContext);
|
|
944
1333
|
const successorActive = !!live?.run && String(live.run.inputs[0]) !== settledEvent.runId;
|
|
945
|
-
const aborted = (
|
|
946
|
-
const submission = await harness.submission(id, eventContext);
|
|
947
|
-
if (!submission) throw new Error(`Settled submission ${id} is unavailable`);
|
|
948
|
-
return submission.status(eventContext);
|
|
949
|
-
}) : [])).some((status) => status.status === "unanswered" && status.reason === "aborted");
|
|
1334
|
+
const aborted = statuses.some((status) => status.status === "unanswered" && status.reason === "aborted");
|
|
950
1335
|
mapped = {
|
|
951
1336
|
type: "run_end",
|
|
952
1337
|
runId: settledEvent.runId,
|
|
@@ -954,14 +1339,30 @@ async function createLaneRuntime(options, attached) {
|
|
|
954
1339
|
aborted
|
|
955
1340
|
};
|
|
956
1341
|
emit(mapped);
|
|
957
|
-
|
|
1342
|
+
const cohort = attached ? void 0 : {
|
|
1343
|
+
runId,
|
|
1344
|
+
writes: []
|
|
1345
|
+
};
|
|
1346
|
+
settleCohort = cohort;
|
|
1347
|
+
try {
|
|
1348
|
+
await deliver(mapped, eventContext);
|
|
1349
|
+
} finally {
|
|
1350
|
+
settleCohort = void 0;
|
|
1351
|
+
}
|
|
1352
|
+
if (cohort) {
|
|
1353
|
+
await Promise.allSettled(cohort.writes);
|
|
1354
|
+
try {
|
|
1355
|
+
await promoteCohort();
|
|
1356
|
+
} catch (error) {
|
|
1357
|
+
emit({
|
|
1358
|
+
type: "error",
|
|
1359
|
+
code: "settle_batch",
|
|
1360
|
+
error: String(error)
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
958
1364
|
release();
|
|
959
|
-
|
|
960
|
-
emit({
|
|
961
|
-
type: "lifecycle_update",
|
|
962
|
-
lifecycle
|
|
963
|
-
});
|
|
964
|
-
if (!lifecycle.operation) {
|
|
1365
|
+
if (!(await publish()).operation) {
|
|
965
1366
|
logicalLoopActive = false;
|
|
966
1367
|
emit({
|
|
967
1368
|
type: "agent_end",
|
|
@@ -1011,9 +1412,20 @@ async function createLaneRuntime(options, attached) {
|
|
|
1011
1412
|
}
|
|
1012
1413
|
const delivered = mapped;
|
|
1013
1414
|
eventsSettled = eventsSettled.then(() => deliver(delivered, eventContext));
|
|
1415
|
+
if (delivered.type === "compaction_end") eventsSettled = eventsSettled.finally(() => {
|
|
1416
|
+
dispatch().catch((error) => emit({
|
|
1417
|
+
type: "error",
|
|
1418
|
+
code: "dispatch",
|
|
1419
|
+
error: String(error)
|
|
1420
|
+
}));
|
|
1421
|
+
});
|
|
1014
1422
|
}
|
|
1015
1423
|
}
|
|
1016
|
-
})
|
|
1424
|
+
}, (error) => emit({
|
|
1425
|
+
type: "error",
|
|
1426
|
+
code: "conversation_events",
|
|
1427
|
+
error: String(error)
|
|
1428
|
+
}));
|
|
1017
1429
|
};
|
|
1018
1430
|
await attach();
|
|
1019
1431
|
const internalDeliveries = /* @__PURE__ */ new Map();
|
|
@@ -1026,7 +1438,9 @@ async function createLaneRuntime(options, attached) {
|
|
|
1026
1438
|
if (!target) throw new Error("Internal delivery conversation is unavailable");
|
|
1027
1439
|
let receipt = await storage.storage.submissionByRequest(target.id, requestId, context);
|
|
1028
1440
|
if (receipt?.status === "queued" && !(await harness.snapshot(_earendil_works_pi_durable.LiveDoc, target.id, context))?.run) {
|
|
1029
|
-
|
|
1441
|
+
const id = receipt.id;
|
|
1442
|
+
if ((await readRecord()).held.some((q) => q.cohort?.submissionId === id)) return;
|
|
1443
|
+
await harness.abortSubmission(id, context);
|
|
1030
1444
|
receipt = await storage.storage.submissionByRequest(target.id, requestId, context);
|
|
1031
1445
|
}
|
|
1032
1446
|
if (receipt?.status === "queued") return;
|
|
@@ -1036,13 +1450,13 @@ async function createLaneRuntime(options, attached) {
|
|
|
1036
1450
|
type: "write",
|
|
1037
1451
|
requestId: `${requestId}:context`,
|
|
1038
1452
|
entry: {
|
|
1039
|
-
kind:
|
|
1453
|
+
kind: PO_ENTRY_KIND,
|
|
1040
1454
|
data: json({
|
|
1041
1455
|
type: "message",
|
|
1042
1456
|
message: item.message,
|
|
1043
1457
|
timestamp: item.message.timestamp
|
|
1044
1458
|
}),
|
|
1045
|
-
model: require_index
|
|
1459
|
+
model: require_index.convertToLlm([item.message])
|
|
1046
1460
|
}
|
|
1047
1461
|
};
|
|
1048
1462
|
let fallback;
|
|
@@ -1067,11 +1481,41 @@ async function createLaneRuntime(options, attached) {
|
|
|
1067
1481
|
if (admittingInternal.has(requestId)) continue;
|
|
1068
1482
|
if ((await harness.snapshot(_earendil_works_pi_durable.LiveDoc, item.conversationId, context))?.run) continue;
|
|
1069
1483
|
const receipt = await storage.storage.submissionByRequest(item.conversationId, requestId, context);
|
|
1070
|
-
if (receipt?.status === "queued") await harness.abortSubmission(receipt.id, context);
|
|
1484
|
+
if (receipt?.status === "queued" && !(await readRecord()).held.some((q) => q.cohort?.submissionId === receipt.id)) await harness.abortSubmission(receipt.id, context);
|
|
1071
1485
|
}
|
|
1072
1486
|
for (const [requestId, item] of internalDeliveries) await reconcileInternal(requestId, item);
|
|
1073
1487
|
};
|
|
1074
|
-
const submitInput = async (draft) => {
|
|
1488
|
+
const submitInput = async (draft, resolve) => {
|
|
1489
|
+
if (draft.type === "input") {
|
|
1490
|
+
const content = require_index.humanInputProjection(draft.entry?.data)?.model;
|
|
1491
|
+
if (content !== void 0) draft = {
|
|
1492
|
+
...draft,
|
|
1493
|
+
content
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
if (resolve) {
|
|
1497
|
+
const lane = conversation;
|
|
1498
|
+
const key = operationGrantKey(lane.id, draft.requestId);
|
|
1499
|
+
let grant;
|
|
1500
|
+
try {
|
|
1501
|
+
const id = await writable(() => lane.commit(async (tx) => {
|
|
1502
|
+
if (await tx.submissionByRequest(lane.id, draft.requestId)) throw new Error("Operation-specific authority requires a new request ID.");
|
|
1503
|
+
const submissionId = await lane.admit(tx, draft);
|
|
1504
|
+
grant = {
|
|
1505
|
+
submissionId,
|
|
1506
|
+
resolve
|
|
1507
|
+
};
|
|
1508
|
+
operationGrants.set(key, grant);
|
|
1509
|
+
return submissionId;
|
|
1510
|
+
}, context));
|
|
1511
|
+
const submission = await harness.submission(id, context);
|
|
1512
|
+
if (!submission) throw new Error("Operation-specific submission unavailable.");
|
|
1513
|
+
return submission;
|
|
1514
|
+
} catch (error) {
|
|
1515
|
+
if (grant && operationGrants.get(key) === grant) operationGrants.delete(key);
|
|
1516
|
+
throw error;
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1075
1519
|
try {
|
|
1076
1520
|
return await writable(() => conversation.submit(draft, context));
|
|
1077
1521
|
} catch (error) {
|
|
@@ -1082,6 +1526,26 @@ async function createLaneRuntime(options, attached) {
|
|
|
1082
1526
|
}
|
|
1083
1527
|
};
|
|
1084
1528
|
const handingOff = /* @__PURE__ */ new Set();
|
|
1529
|
+
const canPromoteCohort = () => !state.disposed && !disposePromise && stopAdmissions === 0 && !state.agentLocked && !userAdmission && !promptAdmissions && !external && !compactionAdmission && handingOff.size === 0;
|
|
1530
|
+
const promoteCohort = trackReleaseAdmission(async () => {
|
|
1531
|
+
if (promotingCohort || !canPromoteCohort()) return false;
|
|
1532
|
+
promotingCohort = true;
|
|
1533
|
+
const fenced = /* @__PURE__ */ new Error("Settle batch promotion was fenced");
|
|
1534
|
+
try {
|
|
1535
|
+
const promoted = await writable(() => harness.commit(async (tx) => {
|
|
1536
|
+
const result = await require_index$6.admitCohort(tx, conversation.id, settings, canPromoteCohort);
|
|
1537
|
+
if (result && !canPromoteCohort()) throw fenced;
|
|
1538
|
+
return result;
|
|
1539
|
+
}, context));
|
|
1540
|
+
if (promoted) harness.resume();
|
|
1541
|
+
return promoted;
|
|
1542
|
+
} catch (error) {
|
|
1543
|
+
if (error === fenced) return false;
|
|
1544
|
+
throw error;
|
|
1545
|
+
} finally {
|
|
1546
|
+
promotingCohort = false;
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1085
1549
|
let dispatching;
|
|
1086
1550
|
let dispatchRequested = false;
|
|
1087
1551
|
const dispatch = () => {
|
|
@@ -1090,23 +1554,29 @@ async function createLaneRuntime(options, attached) {
|
|
|
1090
1554
|
return dispatching;
|
|
1091
1555
|
}
|
|
1092
1556
|
return dispatching = (async () => {
|
|
1093
|
-
while (!disposed) {
|
|
1557
|
+
while (!state.disposed && !disposePromise) {
|
|
1094
1558
|
const record = await readRecord();
|
|
1095
|
-
if (agentLocked || userAdmission || external || record.paused) break;
|
|
1559
|
+
if (state.agentLocked || userAdmission || external || compactionAdmission || record.paused) break;
|
|
1096
1560
|
const idle = !await execution();
|
|
1097
|
-
const item = record.held.find((q) => idle || !q.explicitQueue);
|
|
1561
|
+
const item = record.held.find((q) => q.cohort ? q.cohort.conversationId === conversation.id : idle || !q.explicitQueue);
|
|
1098
1562
|
if (!item || userAdmission || external) break;
|
|
1563
|
+
if (item.cohort) {
|
|
1564
|
+
if (!idle || settling || !await promoteCohort()) break;
|
|
1565
|
+
await publish();
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1099
1568
|
try {
|
|
1100
1569
|
if (!await changeRecord((r) => {
|
|
1570
|
+
if (state.agentLocked || userAdmission || external || compactionAdmission || r.paused) return false;
|
|
1101
1571
|
if (!r.held.some((q) => q.id === item.id)) return false;
|
|
1102
1572
|
handingOff.add(item.id);
|
|
1103
1573
|
return true;
|
|
1104
1574
|
})) continue;
|
|
1105
1575
|
await submitInput({
|
|
1106
1576
|
type: "input",
|
|
1107
|
-
content: require_index$
|
|
1577
|
+
content: require_index$6.heldContent(item.message ?? item.text, item.images),
|
|
1108
1578
|
whenBusy: "followUp",
|
|
1109
|
-
requestId: require_index$
|
|
1579
|
+
requestId: require_index$6.heldRequestId(item.id),
|
|
1110
1580
|
...item.entry ? { entry: item.entry } : {}
|
|
1111
1581
|
});
|
|
1112
1582
|
await changeRecord((r) => {
|
|
@@ -1129,7 +1599,38 @@ async function createLaneRuntime(options, attached) {
|
|
|
1129
1599
|
}
|
|
1130
1600
|
});
|
|
1131
1601
|
};
|
|
1132
|
-
const
|
|
1602
|
+
const humanEntry = async (message, images, actor) => {
|
|
1603
|
+
if (!actor) return void 0;
|
|
1604
|
+
const identity = await options.resolveHumanIdentity?.(actor);
|
|
1605
|
+
if (!identity) return void 0;
|
|
1606
|
+
const timestamp = Date.now();
|
|
1607
|
+
return {
|
|
1608
|
+
kind: PO_ENTRY_KIND,
|
|
1609
|
+
data: json({
|
|
1610
|
+
type: "message",
|
|
1611
|
+
message: {
|
|
1612
|
+
role: "custom",
|
|
1613
|
+
customType: "po-input",
|
|
1614
|
+
display: true,
|
|
1615
|
+
content: require_index$6.heldContent(message, images),
|
|
1616
|
+
timestamp,
|
|
1617
|
+
details: { sender: {
|
|
1618
|
+
kind: "human",
|
|
1619
|
+
id: identity.profileId,
|
|
1620
|
+
name: identity.name
|
|
1621
|
+
} }
|
|
1622
|
+
},
|
|
1623
|
+
humanAuthor: {
|
|
1624
|
+
version: 1,
|
|
1625
|
+
profileId: identity.profileId,
|
|
1626
|
+
sessionId
|
|
1627
|
+
},
|
|
1628
|
+
...options.operationModelPrompt && actor.kind === "member" ? { operationActor: actor } : {},
|
|
1629
|
+
timestamp
|
|
1630
|
+
})
|
|
1631
|
+
};
|
|
1632
|
+
};
|
|
1633
|
+
const enqueue = async (message, images, delivery, explicitQueue, entry) => {
|
|
1133
1634
|
const id = (0, node_crypto.randomUUID)();
|
|
1134
1635
|
await changeRecord((r) => {
|
|
1135
1636
|
r.held.push({
|
|
@@ -1139,32 +1640,41 @@ async function createLaneRuntime(options, attached) {
|
|
|
1139
1640
|
...typeof message === "string" ? {} : { message },
|
|
1140
1641
|
delivery,
|
|
1141
1642
|
scheduling: "automatic",
|
|
1142
|
-
explicitQueue
|
|
1643
|
+
explicitQueue,
|
|
1644
|
+
...entry ? { entry } : {}
|
|
1143
1645
|
});
|
|
1144
1646
|
});
|
|
1145
1647
|
await publish();
|
|
1648
|
+
dispatch().catch((error) => emit({
|
|
1649
|
+
type: "error",
|
|
1650
|
+
code: "dispatch",
|
|
1651
|
+
error: String(error)
|
|
1652
|
+
}));
|
|
1146
1653
|
return { id };
|
|
1147
1654
|
};
|
|
1148
|
-
const queued = async (message, images, delivery) => {
|
|
1655
|
+
const queued = async (message, images, delivery, actor) => {
|
|
1149
1656
|
guardUserAdmission();
|
|
1150
1657
|
assertUnlocked();
|
|
1658
|
+
const entry = await humanEntry(message, images, actor);
|
|
1151
1659
|
if (external || (await readRecord()).paused) {
|
|
1152
|
-
await enqueue(message, images, delivery, false);
|
|
1660
|
+
await enqueue(message, images, delivery, false, entry);
|
|
1153
1661
|
return;
|
|
1154
1662
|
}
|
|
1155
1663
|
await submitInput({
|
|
1156
1664
|
type: "input",
|
|
1157
|
-
content: require_index$
|
|
1665
|
+
content: require_index$6.heldContent(message, images),
|
|
1158
1666
|
whenBusy: "followUp",
|
|
1159
|
-
requestId: (0, node_crypto.randomUUID)()
|
|
1667
|
+
requestId: (0, node_crypto.randomUUID)(),
|
|
1668
|
+
...entry ? { entry } : {}
|
|
1160
1669
|
});
|
|
1161
1670
|
await publish();
|
|
1162
1671
|
};
|
|
1163
|
-
const dispatchCommand = async (value) => options.dispatchCommand?.(value) ?? false;
|
|
1164
|
-
const admit = async (message, images, mode) => {
|
|
1672
|
+
const dispatchCommand = async (value, clientMetadata) => options.dispatchCommand?.(value, clientMetadata) ?? false;
|
|
1673
|
+
const admit = async (message, images, mode, clientMetadata, actor, workflowActor, requestId = (0, node_crypto.randomUUID)(), authorize, resolveOperationModelPrompt) => {
|
|
1674
|
+
if (resolveOperationModelPrompt && (!requestId.trim() || !operationModelPrompt)) throw new Error("Operation-specific authority requires a stable request ID and operationModelPrompt.");
|
|
1165
1675
|
guardUserAdmission();
|
|
1166
1676
|
if (external) throw new Error("An operation is already running");
|
|
1167
|
-
if (typeof message === "string" && await dispatchCommand(message)) return {
|
|
1677
|
+
if (!workflowActor && typeof message === "string" && await dispatchCommand(message, clientMetadata)) return {
|
|
1168
1678
|
settled: Promise.resolve(),
|
|
1169
1679
|
handledCommand: true
|
|
1170
1680
|
};
|
|
@@ -1174,12 +1684,31 @@ async function createLaneRuntime(options, attached) {
|
|
|
1174
1684
|
try {
|
|
1175
1685
|
assertUnlocked();
|
|
1176
1686
|
await flushNextTurn();
|
|
1687
|
+
if (authorize) await authorize();
|
|
1688
|
+
const delegatedCustom = workflowActor && typeof message !== "string" && message.role === "custom" ? message : void 0;
|
|
1689
|
+
const content = delegatedCustom ? delegatedCustom.content : require_index$6.heldContent(message, images);
|
|
1690
|
+
const timestamp = Date.now();
|
|
1177
1691
|
const submission = await submitInput({
|
|
1178
1692
|
type: "input",
|
|
1179
|
-
content
|
|
1693
|
+
content,
|
|
1180
1694
|
whenBusy: mode ?? "reject",
|
|
1181
|
-
|
|
1182
|
-
|
|
1695
|
+
entry: workflowActor ? {
|
|
1696
|
+
kind: PO_ENTRY_KIND,
|
|
1697
|
+
data: json({
|
|
1698
|
+
type: "message",
|
|
1699
|
+
message: delegatedCustom ?? {
|
|
1700
|
+
role: "user",
|
|
1701
|
+
content,
|
|
1702
|
+
timestamp
|
|
1703
|
+
},
|
|
1704
|
+
operationActor: workflowActor,
|
|
1705
|
+
...resolveOperationModelPrompt ? { operationModelPrompt: true } : {},
|
|
1706
|
+
timestamp
|
|
1707
|
+
})
|
|
1708
|
+
} : await humanEntry(message, images, actor),
|
|
1709
|
+
requestId
|
|
1710
|
+
}, resolveOperationModelPrompt);
|
|
1711
|
+
const grantKey = operationGrantKey(conversation.id, requestId);
|
|
1183
1712
|
await publish();
|
|
1184
1713
|
let resolveDelivery;
|
|
1185
1714
|
const delivered = new Promise((resolve) => {
|
|
@@ -1197,10 +1726,14 @@ async function createLaneRuntime(options, attached) {
|
|
|
1197
1726
|
await eventsSettled;
|
|
1198
1727
|
await reconcile();
|
|
1199
1728
|
await publish();
|
|
1200
|
-
if (status.status === "unanswered" && status.reason !== "aborted")
|
|
1729
|
+
if (status.status === "unanswered" && status.reason !== "aborted") {
|
|
1730
|
+
const detail = status.reason === "model_error" ? "The model could not complete this response. Check the provider connection and try again." : status.detail;
|
|
1731
|
+
throw new Error(`Agent submission failed: ${status.reason}${typeof detail === "string" && detail ? `: ${detail}` : ""}`);
|
|
1732
|
+
}
|
|
1201
1733
|
await dispatch();
|
|
1202
1734
|
} finally {
|
|
1203
1735
|
internalDelivery.delete(submission.id);
|
|
1736
|
+
if (resolveOperationModelPrompt && operationGrants.get(grantKey)?.submissionId === submission.id) operationGrants.delete(grantKey);
|
|
1204
1737
|
}
|
|
1205
1738
|
})();
|
|
1206
1739
|
settled.catch((error) => emit({
|
|
@@ -1212,13 +1745,24 @@ async function createLaneRuntime(options, attached) {
|
|
|
1212
1745
|
promptAdmissions--;
|
|
1213
1746
|
}
|
|
1214
1747
|
};
|
|
1215
|
-
const abort = async (operationId) => {
|
|
1748
|
+
const abort = async (operationId, shutdown = false) => {
|
|
1216
1749
|
const current = await execution();
|
|
1217
|
-
if (!current ||
|
|
1750
|
+
if (!current || operationId && current.id !== operationId) return;
|
|
1218
1751
|
if (current.id === external) {
|
|
1219
1752
|
externalAbort?.abort();
|
|
1220
1753
|
return;
|
|
1221
1754
|
}
|
|
1755
|
+
if (current.id === "settling") {
|
|
1756
|
+
if (!attached && (!userAdmission || shutdown)) {
|
|
1757
|
+
await changeRecord((record) => {
|
|
1758
|
+
if (!shutdown) delete record.resumeOnStart;
|
|
1759
|
+
else if (!record.paused) record.resumeOnStart = true;
|
|
1760
|
+
record.paused = true;
|
|
1761
|
+
});
|
|
1762
|
+
await publish();
|
|
1763
|
+
}
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1222
1766
|
const stop = () => writable(async () => {
|
|
1223
1767
|
if (current.kind === "run") await conversation.abort(context);
|
|
1224
1768
|
else await harness.abortTask(nativeId(current.id), context);
|
|
@@ -1237,6 +1781,8 @@ async function createLaneRuntime(options, attached) {
|
|
|
1237
1781
|
await writable(() => harness.commit(async (tx) => {
|
|
1238
1782
|
const doc = await tx.doc(require_docs$1.HeldQueueDoc);
|
|
1239
1783
|
const record = JSON.parse(doc.json);
|
|
1784
|
+
if (!shutdown) delete record.resumeOnStart;
|
|
1785
|
+
else if (!record.paused) record.resumeOnStart = true;
|
|
1240
1786
|
record.paused = true;
|
|
1241
1787
|
record.abortOperationId = current.id;
|
|
1242
1788
|
const items = (await tx.doc(_earendil_works_pi_durable.InboxDoc, conversation.id)).items;
|
|
@@ -1246,7 +1792,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1246
1792
|
if (item.mode === "write" || !captured.has(item.id)) continue;
|
|
1247
1793
|
moved.unshift({
|
|
1248
1794
|
id: (0, node_crypto.randomUUID)(),
|
|
1249
|
-
...fromContent(item.content),
|
|
1795
|
+
...fromContent(item.content, item.entry?.data),
|
|
1250
1796
|
...item.entry ? { entry: item.entry } : {},
|
|
1251
1797
|
delivery: item.mode,
|
|
1252
1798
|
scheduling: "automatic",
|
|
@@ -1267,7 +1813,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1267
1813
|
await reconcile();
|
|
1268
1814
|
};
|
|
1269
1815
|
const interrupt = async () => {
|
|
1270
|
-
await abort();
|
|
1816
|
+
await abort(void 0, true);
|
|
1271
1817
|
await writable(() => conversation.abort(context));
|
|
1272
1818
|
await eventsSettled;
|
|
1273
1819
|
};
|
|
@@ -1282,9 +1828,14 @@ async function createLaneRuntime(options, attached) {
|
|
|
1282
1828
|
userAdmission = false;
|
|
1283
1829
|
releaseUserAdmission?.();
|
|
1284
1830
|
releaseUserAdmission = void 0;
|
|
1831
|
+
dispatch().catch((error) => emit({
|
|
1832
|
+
type: "error",
|
|
1833
|
+
code: "dispatch",
|
|
1834
|
+
error: String(error)
|
|
1835
|
+
}));
|
|
1285
1836
|
}
|
|
1286
1837
|
};
|
|
1287
|
-
const submitUserPrompt = async (message, images, submissionMode = "reject") => {
|
|
1838
|
+
const submitUserPrompt = async (message, images, submissionMode = "reject", actor) => {
|
|
1288
1839
|
guardUserAdmission();
|
|
1289
1840
|
if (external) throw new Error("An operation is already running");
|
|
1290
1841
|
if (typeof message === "string" ? !message && !images?.length : !message.content.length) throw new Error("User input must contain text or an image");
|
|
@@ -1305,8 +1856,9 @@ async function createLaneRuntime(options, attached) {
|
|
|
1305
1856
|
await flushNextTurn();
|
|
1306
1857
|
const submission = await submitInput({
|
|
1307
1858
|
type: "input",
|
|
1308
|
-
content: require_index$
|
|
1859
|
+
content: require_index$6.heldContent(message, images),
|
|
1309
1860
|
whenBusy: submissionMode,
|
|
1861
|
+
entry: await humanEntry(message, images, actor),
|
|
1310
1862
|
requestId: (0, node_crypto.randomUUID)()
|
|
1311
1863
|
});
|
|
1312
1864
|
const settled = (async () => {
|
|
@@ -1334,35 +1886,40 @@ async function createLaneRuntime(options, attached) {
|
|
|
1334
1886
|
else if (current) await harness.abortTask(nativeId(current.id), context);
|
|
1335
1887
|
}
|
|
1336
1888
|
const accepted = /* @__PURE__ */ new Set();
|
|
1337
|
-
for (const item of r.held) if (await storage.storage.submissionByRequest(conversation.id, require_index$
|
|
1889
|
+
for (const item of r.held) if (!item.cohort && await storage.storage.submissionByRequest(conversation.id, require_index$6.heldRequestId(item.id), context)) accepted.add(item.id);
|
|
1338
1890
|
await reconcile();
|
|
1339
1891
|
await changeRecord((record) => {
|
|
1340
1892
|
record.held = record.held.filter((q) => !accepted.has(q.id));
|
|
1893
|
+
if (record.resumeOnStart) {
|
|
1894
|
+
record.paused = false;
|
|
1895
|
+
delete record.resumeOnStart;
|
|
1896
|
+
delete record.abortOperationId;
|
|
1897
|
+
}
|
|
1341
1898
|
});
|
|
1342
1899
|
};
|
|
1343
|
-
const admissionBusy = () => userAdmission || promptAdmissions > 0 || settling > 0 || handingOff.size > 0 || admittingInternal.size > 0 || compactionAdmission;
|
|
1900
|
+
const admissionBusy = () => userAdmission || promptAdmissions > 0 || settling > 0 || promotingCohort || handingOff.size > 0 || admittingInternal.size > 0 || compactionAdmission;
|
|
1344
1901
|
const runExternalOperation = async (work, { signal, waitMs = 0 } = {}) => {
|
|
1345
1902
|
if (!Number.isFinite(waitMs) || waitMs < 0) throw new RangeError("waitMs must be finite and non-negative");
|
|
1346
1903
|
const deadline = Date.now() + waitMs;
|
|
1347
1904
|
const pendingFollowUp = async () => {
|
|
1348
|
-
if (waitMs === 0 || agentLocked) return false;
|
|
1905
|
+
if (waitMs === 0 || state.agentLocked) return false;
|
|
1349
1906
|
const record = await readRecord();
|
|
1350
|
-
return !record.paused && record.held.
|
|
1907
|
+
return !record.paused && record.held.some((q) => !q.cohort || q.cohort.conversationId === conversation.id);
|
|
1351
1908
|
};
|
|
1352
1909
|
for (;;) {
|
|
1353
1910
|
if (waitMs === 0) guardUserAdmission();
|
|
1354
1911
|
signal?.throwIfAborted();
|
|
1355
|
-
if (disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1912
|
+
if (state.disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1356
1913
|
const busy = await nativeExecution() || await pendingFollowUp();
|
|
1357
1914
|
signal?.throwIfAborted();
|
|
1358
|
-
if (disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1915
|
+
if (state.disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1359
1916
|
if (!busy && !external && !admissionBusy()) {
|
|
1360
1917
|
external = (0, node_crypto.randomUUID)();
|
|
1361
1918
|
let admitted = false;
|
|
1362
1919
|
try {
|
|
1363
1920
|
const changed = await nativeExecution() || await pendingFollowUp();
|
|
1364
1921
|
signal?.throwIfAborted();
|
|
1365
|
-
if (disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1922
|
+
if (state.disposed || disposePromise) throw new Error("Direct harness is disposed");
|
|
1366
1923
|
if (waitMs > 0 && Date.now() >= deadline) throw new require_headless.PoHeadlessToolBusyError();
|
|
1367
1924
|
admitted = !changed && !admissionBusy();
|
|
1368
1925
|
} finally {
|
|
@@ -1388,10 +1945,11 @@ async function createLaneRuntime(options, attached) {
|
|
|
1388
1945
|
clearTimeout(timer);
|
|
1389
1946
|
}
|
|
1390
1947
|
}
|
|
1391
|
-
|
|
1948
|
+
const abortController = new AbortController();
|
|
1949
|
+
externalAbort = abortController;
|
|
1392
1950
|
try {
|
|
1393
1951
|
await publish();
|
|
1394
|
-
return await writable(work);
|
|
1952
|
+
return await writable(() => work(abortController.signal));
|
|
1395
1953
|
} finally {
|
|
1396
1954
|
external = void 0;
|
|
1397
1955
|
externalAbort = void 0;
|
|
@@ -1412,39 +1970,48 @@ async function createLaneRuntime(options, attached) {
|
|
|
1412
1970
|
const restoreCustomContextMessages = (messages, view) => {
|
|
1413
1971
|
const contextContributions = /* @__PURE__ */ new Map();
|
|
1414
1972
|
for (const [index, raw] of view.entries.entries()) {
|
|
1415
|
-
const entry = require_index.projectDurableEntries([raw])[0];
|
|
1973
|
+
const entry = require_index$1.projectDurableEntries([raw])[0];
|
|
1416
1974
|
const contributions = view.contributions[index] ?? [];
|
|
1417
|
-
const custom = entry?.type === "message" && entry.message.role === "custom" && raw.
|
|
1418
|
-
for (const native of contributions) {
|
|
1975
|
+
const custom = entry?.type === "message" && entry.message.role === "custom" && require_index.humanInputProjection(raw.data) === void 0 && raw.model?.length && JSON.stringify(raw.model) === JSON.stringify(contributions) ? entry.message : void 0;
|
|
1976
|
+
for (const [position, native] of contributions.entries()) {
|
|
1419
1977
|
const key = JSON.stringify(native);
|
|
1420
1978
|
const restored = contextContributions.get(key) ?? [];
|
|
1421
|
-
restored.push(custom
|
|
1979
|
+
restored.push(custom ? position === 0 ? custom : void 0 : native);
|
|
1422
1980
|
contextContributions.set(key, restored);
|
|
1423
1981
|
}
|
|
1424
1982
|
}
|
|
1425
|
-
return messages.
|
|
1983
|
+
return messages.flatMap((message) => {
|
|
1984
|
+
if (message.role === "system") return [];
|
|
1985
|
+
const restored = contextContributions.get(JSON.stringify(message));
|
|
1986
|
+
if (!restored?.length) return [message];
|
|
1987
|
+
const next = restored.shift();
|
|
1988
|
+
return next ? [next] : [];
|
|
1989
|
+
});
|
|
1426
1990
|
};
|
|
1427
1991
|
const readEntries = async () => {
|
|
1428
1992
|
const entries = await projectDurableConversationEntries(conversation, context);
|
|
1993
|
+
options.onFullHistoryRead?.(sessionId, entries.length);
|
|
1429
1994
|
return {
|
|
1430
1995
|
entries,
|
|
1431
1996
|
leafId: entries.at(-1)?.id ?? null
|
|
1432
1997
|
};
|
|
1433
1998
|
};
|
|
1434
|
-
|
|
1999
|
+
const getContextUsage = async () => {
|
|
2000
|
+
const lane = conversation;
|
|
2001
|
+
const state = await projection.snapshots.statistics(lane.id, context);
|
|
2002
|
+
const agent = await lane.agent(context);
|
|
2003
|
+
const selected = agent.model ? models.getModel(agent.model.provider, agent.model.modelId) : void 0;
|
|
2004
|
+
return require_index$4.contextUsageOf(state?.contextTokens ?? null, selected?.contextWindow);
|
|
2005
|
+
};
|
|
1435
2006
|
const getSessionStats = async () => {
|
|
1436
2007
|
const lane = conversation;
|
|
1437
|
-
const
|
|
1438
|
-
|
|
1439
|
-
const
|
|
1440
|
-
const messages = entries.flatMap((e) => e.type === "message" ? [e.message] : []);
|
|
1441
|
-
const agent = await conversation.agent(context);
|
|
2008
|
+
const next = await projection.snapshots.statistics(lane.id, context);
|
|
2009
|
+
if (!next?.complete) throw new Error("Session statistics are unavailable for history without complete write-time snapshots.");
|
|
2010
|
+
const agent = await lane.agent(context);
|
|
1442
2011
|
const selected = agent.model ? models.getModel(agent.model.provider, agent.model.modelId) : void 0;
|
|
1443
|
-
const
|
|
1444
|
-
const
|
|
1445
|
-
const
|
|
1446
|
-
const usage = attached ? await harness.snapshot(_earendil_works_pi_durable.UsageDoc, conversation.id, context) : await harness.usage(context);
|
|
1447
|
-
const children = attached ? [] : await Promise.all((await require_index$5.subagentConversations(harness, context)).map((id) => harness.snapshot(_earendil_works_pi_durable.UsageDoc, id, context)));
|
|
2012
|
+
const contextUsage = require_index$4.contextUsageOf(next.contextTokens, selected?.contextWindow);
|
|
2013
|
+
const usage = attached ? await harness.snapshot(_earendil_works_pi_durable.UsageDoc, lane.id, context) : await harness.usage(context);
|
|
2014
|
+
const children = attached ? [] : await Promise.all((await require_index$8.subagentConversations(harness, context)).map((id) => harness.snapshot(_earendil_works_pi_durable.UsageDoc, id, context)));
|
|
1448
2015
|
const tokens = {
|
|
1449
2016
|
input: 0,
|
|
1450
2017
|
output: 0,
|
|
@@ -1466,17 +2033,6 @@ async function createLaneRuntime(options, attached) {
|
|
|
1466
2033
|
};
|
|
1467
2034
|
add(usage, 1);
|
|
1468
2035
|
for (const child of children) add(child, -1);
|
|
1469
|
-
const next = {
|
|
1470
|
-
conversation: lane,
|
|
1471
|
-
seq: entries.at(-1)?.seq ?? previous?.seq,
|
|
1472
|
-
contextTokens,
|
|
1473
|
-
messageCount: (previous?.messageCount ?? 0) + messages.length,
|
|
1474
|
-
userMessages: (previous?.userMessages ?? 0) + messages.filter((m) => m.role === "user").length,
|
|
1475
|
-
assistantMessages: (previous?.assistantMessages ?? 0) + messages.filter((m) => m.role === "assistant").length,
|
|
1476
|
-
toolCalls: (previous?.toolCalls ?? 0) + messages.flatMap((m) => m.role === "assistant" ? m.content.filter((c) => c.type === "toolCall") : []).length,
|
|
1477
|
-
toolResults: (previous?.toolResults ?? 0) + messages.filter((m) => m.role === "toolResult").length
|
|
1478
|
-
};
|
|
1479
|
-
if (conversation === lane && statsCache === cached) statsCache = next;
|
|
1480
2036
|
return {
|
|
1481
2037
|
sessionId,
|
|
1482
2038
|
...contextUsage === void 0 ? {} : { contextUsage },
|
|
@@ -1505,6 +2061,40 @@ async function createLaneRuntime(options, attached) {
|
|
|
1505
2061
|
}
|
|
1506
2062
|
};
|
|
1507
2063
|
};
|
|
2064
|
+
const getSessionUsage = async () => {
|
|
2065
|
+
const lane = conversation;
|
|
2066
|
+
const next = await projection.snapshots.statistics(lane.id, context);
|
|
2067
|
+
const ledger = await harness.snapshot(_earendil_works_pi_durable.UsageDoc, lane.id, context);
|
|
2068
|
+
const rows = [...Object.values(ledger?.models ?? {}), ...Object.values(ledger?.tools ?? {})];
|
|
2069
|
+
const measured = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
2070
|
+
const tokens = {
|
|
2071
|
+
input: 0,
|
|
2072
|
+
output: 0,
|
|
2073
|
+
cacheRead: 0,
|
|
2074
|
+
cacheWrite: 0,
|
|
2075
|
+
total: 0
|
|
2076
|
+
};
|
|
2077
|
+
const completeTokens = rows.length > 0 && rows.every((row) => [
|
|
2078
|
+
row.input,
|
|
2079
|
+
row.output,
|
|
2080
|
+
row.cacheRead,
|
|
2081
|
+
row.cacheWrite,
|
|
2082
|
+
row.totalTokens
|
|
2083
|
+
].every(measured));
|
|
2084
|
+
if (completeTokens) for (const row of rows) {
|
|
2085
|
+
tokens.input += row.input;
|
|
2086
|
+
tokens.output += row.output;
|
|
2087
|
+
tokens.cacheRead += row.cacheRead;
|
|
2088
|
+
tokens.cacheWrite += row.cacheWrite;
|
|
2089
|
+
tokens.total += row.totalTokens;
|
|
2090
|
+
}
|
|
2091
|
+
const completeCost = rows.length > 0 && rows.every((row) => measured(row.cost?.total));
|
|
2092
|
+
return {
|
|
2093
|
+
...next?.complete ? { toolCount: next.distinctToolCalls } : {},
|
|
2094
|
+
...completeTokens ? { tokens } : {},
|
|
2095
|
+
...completeCost ? { costUsd: rows.reduce((total, row) => total + row.cost.total, 0) } : {}
|
|
2096
|
+
};
|
|
2097
|
+
};
|
|
1508
2098
|
let disposePromise;
|
|
1509
2099
|
const dispose = () => disposePromise ??= (async () => {
|
|
1510
2100
|
for (const pending of toolBoundaryQueue.splice(0)) pending.reject(/* @__PURE__ */ new Error("Direct harness is disposed"));
|
|
@@ -1519,8 +2109,11 @@ async function createLaneRuntime(options, attached) {
|
|
|
1519
2109
|
}
|
|
1520
2110
|
};
|
|
1521
2111
|
if (!attached) await attempt(interrupt);
|
|
1522
|
-
disposed = true;
|
|
1523
|
-
|
|
2112
|
+
state.disposed = true;
|
|
2113
|
+
operationGrants.clear();
|
|
2114
|
+
for (const validator of snapshotValidators.values()) validator.dispose();
|
|
2115
|
+
snapshotValidators.clear();
|
|
2116
|
+
await attempt(async () => watcher?.stop());
|
|
1524
2117
|
await attempt(() => eventsSettled);
|
|
1525
2118
|
if (!attached) {
|
|
1526
2119
|
const harnessClosed = await attempt(() => harness.close(context));
|
|
@@ -1530,19 +2123,10 @@ async function createLaneRuntime(options, attached) {
|
|
|
1530
2123
|
resolveExited(failures.length ? 1 : 0);
|
|
1531
2124
|
if (failures.length) throw new AggregateError(failures, "Direct harness cleanup failed");
|
|
1532
2125
|
})();
|
|
1533
|
-
const recordUsage =
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
kind: "po.usage",
|
|
1538
|
-
data: json({
|
|
1539
|
-
usage,
|
|
1540
|
-
...usageOptions
|
|
1541
|
-
})
|
|
1542
|
-
}
|
|
1543
|
-
});
|
|
1544
|
-
await writable(() => harness.commit(async (tx) => {
|
|
1545
|
-
const ledger = await tx.doc(_earendil_works_pi_durable.UsageDoc, conversation.id);
|
|
2126
|
+
const recordUsage = (usage, usageOptions) => {
|
|
2127
|
+
const lane = conversation;
|
|
2128
|
+
return writable(() => lane.commit(async (tx) => {
|
|
2129
|
+
const ledger = await tx.doc(_earendil_works_pi_durable.UsageDoc, lane.id);
|
|
1546
2130
|
const key = "po/auxiliary";
|
|
1547
2131
|
const previous = ledger.models[key];
|
|
1548
2132
|
ledger.models[key] = previous ? {
|
|
@@ -1560,8 +2144,15 @@ async function createLaneRuntime(options, attached) {
|
|
|
1560
2144
|
total: previous.cost.total + usage.cost.total
|
|
1561
2145
|
}
|
|
1562
2146
|
} : usage;
|
|
2147
|
+
const entry = await tx.appendEntry(lane.id, {
|
|
2148
|
+
kind: "po.usage",
|
|
2149
|
+
data: json({
|
|
2150
|
+
usage,
|
|
2151
|
+
...usageOptions
|
|
2152
|
+
})
|
|
2153
|
+
});
|
|
2154
|
+
return String(entry.id);
|
|
1563
2155
|
}, context));
|
|
1564
|
-
return entryId;
|
|
1565
2156
|
};
|
|
1566
2157
|
const removeQueued = async (id) => {
|
|
1567
2158
|
const held = await changeRecord((r) => {
|
|
@@ -1573,15 +2164,16 @@ async function createLaneRuntime(options, attached) {
|
|
|
1573
2164
|
});
|
|
1574
2165
|
if (held === "in_flight") return held;
|
|
1575
2166
|
if (held === "not_held") {
|
|
1576
|
-
const accepted = await storage.storage.submissionByRequest(conversation.id, require_index$
|
|
2167
|
+
const accepted = await storage.storage.submissionByRequest(conversation.id, require_index$6.heldRequestId(id), context);
|
|
1577
2168
|
if (!accepted) return "not_found";
|
|
1578
2169
|
return accepted.status === "queued" ? "in_flight" : "already_consumed";
|
|
1579
2170
|
}
|
|
1580
2171
|
await publish();
|
|
1581
2172
|
return "removed";
|
|
1582
2173
|
};
|
|
1583
|
-
const commitCheckpointMessage = async (registration, lane, message, ctx, scopeIsOpen = () => true, taskId) => {
|
|
1584
|
-
const
|
|
2174
|
+
const commitCheckpointMessage = async (registration, lane, message, ctx, scopeIsOpen = () => true, taskId, messageOptions) => {
|
|
2175
|
+
const reset = messageOptions?.resetContext;
|
|
2176
|
+
const usable = () => registration.active && scopeIsOpen() && !state.disposed && !state.quarantined && !external && conversation.id === lane.id && !ctx.abortSignal?.aborted;
|
|
1585
2177
|
if (!usable()) return;
|
|
1586
2178
|
return writable(async () => {
|
|
1587
2179
|
if (!usable()) return;
|
|
@@ -1591,13 +2183,14 @@ async function createLaneRuntime(options, attached) {
|
|
|
1591
2183
|
const inbox = await tx.doc(_earendil_works_pi_durable.InboxDoc, lane.id);
|
|
1592
2184
|
if (!usable() || live.compactions?.length || inbox.items.some((item) => item.mode !== "write") || (taskId === void 0 ? live.run !== void 0 : live.run?.taskId !== taskId)) return;
|
|
1593
2185
|
const entry = await tx.appendEntry(lane.id, {
|
|
1594
|
-
kind:
|
|
2186
|
+
kind: PO_ENTRY_KIND,
|
|
1595
2187
|
data: json({
|
|
1596
2188
|
type: "message",
|
|
1597
2189
|
message,
|
|
1598
2190
|
timestamp: message.timestamp
|
|
1599
2191
|
}),
|
|
1600
|
-
model: require_index
|
|
2192
|
+
model: require_index.convertToLlm(reset ? [message, ...reset.retainedMessages] : [message]),
|
|
2193
|
+
...reset ? { head: "self" } : {}
|
|
1601
2194
|
});
|
|
1602
2195
|
return String(entry.id);
|
|
1603
2196
|
}, ctx);
|
|
@@ -1607,19 +2200,50 @@ async function createLaneRuntime(options, attached) {
|
|
|
1607
2200
|
type: "write",
|
|
1608
2201
|
...requestId === void 0 ? {} : { requestId },
|
|
1609
2202
|
entry: {
|
|
1610
|
-
kind:
|
|
2203
|
+
kind: PO_ENTRY_KIND,
|
|
1611
2204
|
data: json({
|
|
1612
2205
|
type: "message",
|
|
1613
2206
|
message,
|
|
1614
2207
|
timestamp: message.timestamp
|
|
1615
2208
|
}),
|
|
1616
|
-
model: require_index
|
|
2209
|
+
model: require_index.convertToLlm([message])
|
|
1617
2210
|
}
|
|
1618
2211
|
});
|
|
2212
|
+
const appendMessageOnce = (message, requestId) => {
|
|
2213
|
+
const lane = conversation;
|
|
2214
|
+
return writable(() => harness.commit(async (tx) => {
|
|
2215
|
+
const accepted = await tx.submissionByRequest(lane.id, requestId);
|
|
2216
|
+
if (accepted?.entry !== void 0) return String(accepted.entry);
|
|
2217
|
+
const key = accepted?.type === "input" && accepted.status === "unanswered" ? `${requestId}:context` : requestId;
|
|
2218
|
+
const previous = key === requestId ? accepted : await tx.submissionByRequest(lane.id, key);
|
|
2219
|
+
if (previous?.entry !== void 0) return String(previous.entry);
|
|
2220
|
+
if (previous) throw new Error("Message delivery has not been placed.");
|
|
2221
|
+
const live = await tx.doc(_earendil_works_pi_durable.LiveDoc, lane.id);
|
|
2222
|
+
const inbox = await tx.doc(_earendil_works_pi_durable.InboxDoc, lane.id);
|
|
2223
|
+
if (state.disposed || conversation !== lane || live.run || live.compactions?.length || inbox.items.length) throw new Error("The session is busy. Message not appended.");
|
|
2224
|
+
const entry = await tx.appendEntry(lane.id, {
|
|
2225
|
+
kind: PO_ENTRY_KIND,
|
|
2226
|
+
data: json({
|
|
2227
|
+
type: "message",
|
|
2228
|
+
message,
|
|
2229
|
+
timestamp: message.timestamp
|
|
2230
|
+
}),
|
|
2231
|
+
model: require_index.convertToLlm([message])
|
|
2232
|
+
});
|
|
2233
|
+
await tx.createSubmission({
|
|
2234
|
+
conversationId: lane.id,
|
|
2235
|
+
type: "write",
|
|
2236
|
+
requestId: key,
|
|
2237
|
+
status: "done",
|
|
2238
|
+
entry: entry.id
|
|
2239
|
+
});
|
|
2240
|
+
return String(entry.id);
|
|
2241
|
+
}, context));
|
|
2242
|
+
};
|
|
1619
2243
|
const mainOnly = () => {
|
|
1620
2244
|
if (attached) throw new Error("Session state belongs to the main lane.");
|
|
1621
2245
|
};
|
|
1622
|
-
|
|
2246
|
+
const runtime = {
|
|
1623
2247
|
sessionId,
|
|
1624
2248
|
laneName,
|
|
1625
2249
|
harnessId: options.harnessId ?? `${sessionId}:${laneName}`,
|
|
@@ -1630,7 +2254,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1630
2254
|
},
|
|
1631
2255
|
exited,
|
|
1632
2256
|
get storageQuarantined() {
|
|
1633
|
-
return quarantined;
|
|
2257
|
+
return state.quarantined;
|
|
1634
2258
|
},
|
|
1635
2259
|
completeModel: models.complete?.bind(models),
|
|
1636
2260
|
onPresentationFrame(listener) {
|
|
@@ -1665,11 +2289,25 @@ async function createLaneRuntime(options, attached) {
|
|
|
1665
2289
|
leafId: entries.at(-1)?.id ?? null
|
|
1666
2290
|
};
|
|
1667
2291
|
},
|
|
1668
|
-
scanEntries
|
|
2292
|
+
async scanEntries(query, limit, cursor, scanContext) {
|
|
2293
|
+
const page = await conversation.entries(query, limit, cursor, scanContext);
|
|
2294
|
+
return {
|
|
2295
|
+
...page,
|
|
2296
|
+
items: page.items.map((entry) => {
|
|
2297
|
+
const { data } = entry;
|
|
2298
|
+
if (entry.kind !== PO_ENTRY_KIND || !data || typeof data !== "object" || !("operationActor" in data) && !("operationModelPrompt" in data)) return entry;
|
|
2299
|
+
const { operationActor: _operationActor, operationModelPrompt: _operationModelPrompt, ...display } = data;
|
|
2300
|
+
return {
|
|
2301
|
+
...entry,
|
|
2302
|
+
data: display
|
|
2303
|
+
};
|
|
2304
|
+
})
|
|
2305
|
+
};
|
|
2306
|
+
},
|
|
1669
2307
|
readIdentities: (readContext) => harness.snapshot(require_docs.IdentityHistoryDoc, conversation.id, readContext),
|
|
1670
2308
|
async getContextMessages() {
|
|
1671
2309
|
const assertReadable = () => {
|
|
1672
|
-
if (disposed || quarantined) throw new Error("Direct harness context is unavailable", { cause: failure });
|
|
2310
|
+
if (state.disposed || state.quarantined) throw new Error("Direct harness context is unavailable", { cause: state.failure });
|
|
1673
2311
|
};
|
|
1674
2312
|
assertReadable();
|
|
1675
2313
|
const view = await conversation.context(context);
|
|
@@ -1681,13 +2319,21 @@ async function createLaneRuntime(options, attached) {
|
|
|
1681
2319
|
readLifecycle,
|
|
1682
2320
|
dispatchCommand,
|
|
1683
2321
|
listCommands: () => [...options.listCommands?.() ?? []],
|
|
2322
|
+
async runIfIdle(action) {
|
|
2323
|
+
if (state.disposed || state.quarantined || releaseAdmissions > 0 || admissionBusy() || external) return false;
|
|
2324
|
+
const revision = admissionRevision;
|
|
2325
|
+
const snapshot = await runtime.readState();
|
|
2326
|
+
if (revision !== admissionRevision || state.disposed || state.quarantined || releaseAdmissions > 0 || admissionBusy() || external || snapshot.isIdle !== true || Number(snapshot.pendingMessageCount) !== 0 || nextTurnMessages.length > 0 || deferredInternalCount > 0) return false;
|
|
2327
|
+
action();
|
|
2328
|
+
return true;
|
|
2329
|
+
},
|
|
1684
2330
|
async readState() {
|
|
1685
2331
|
const lifecycle = await readLifecycle();
|
|
1686
2332
|
const agent = await conversation.agent(context);
|
|
1687
2333
|
const metadata = await harness.snapshot(require_docs.SessionMetadataDoc, context);
|
|
1688
|
-
const stats = await
|
|
2334
|
+
const stats = await projection.snapshots.statistics(conversation.id, context);
|
|
1689
2335
|
const inbox = await harness.snapshot(_earendil_works_pi_durable.InboxDoc, conversation.id, context);
|
|
1690
|
-
const held = (await readRecord()).held.length;
|
|
2336
|
+
const held = (await readRecord()).held.filter((q) => !q.cohort || q.cohort.conversationId === conversation.id).length;
|
|
1691
2337
|
const nativePending = inbox?.items.filter((item) => item.mode !== "write").length ?? 0;
|
|
1692
2338
|
return json({
|
|
1693
2339
|
sessionId,
|
|
@@ -1702,25 +2348,20 @@ async function createLaneRuntime(options, attached) {
|
|
|
1702
2348
|
isCompacting: lifecycle.operation?.kind === "compaction",
|
|
1703
2349
|
operationId: lifecycle.operation?.id,
|
|
1704
2350
|
executionStatus: lifecycle.operation?.status,
|
|
1705
|
-
fastMode,
|
|
1706
|
-
agentLocked,
|
|
2351
|
+
fastMode: state.fastMode,
|
|
2352
|
+
agentLocked: state.agentLocked,
|
|
1707
2353
|
queuePaused: lifecycle.paused,
|
|
1708
2354
|
queueRevision: lifecycle.revision,
|
|
1709
2355
|
steeringMode: settings.steeringMode ?? "one-at-a-time",
|
|
1710
2356
|
followUpMode: settings.followUpMode ?? "one-at-a-time",
|
|
1711
2357
|
autoCompactionEnabled: settings.compaction?.enabled ?? true,
|
|
1712
|
-
messageCount: stats.messageCount,
|
|
2358
|
+
messageCount: stats?.complete ? stats.messageCount : void 0,
|
|
1713
2359
|
pendingMessageCount: held + nativePending + nextTurnMessages.length + deferredInternalCount
|
|
1714
2360
|
});
|
|
1715
2361
|
},
|
|
1716
|
-
enqueueAutomatic: async (value, images) => {
|
|
2362
|
+
enqueueAutomatic: async (value, images, actor) => {
|
|
1717
2363
|
assertUnlocked();
|
|
1718
|
-
|
|
1719
|
-
dispatch().catch((error) => emit({
|
|
1720
|
-
type: "error",
|
|
1721
|
-
error: String(error)
|
|
1722
|
-
}));
|
|
1723
|
-
return result;
|
|
2364
|
+
return enqueue(value, images, "nextRun", true, await humanEntry(value, images, actor));
|
|
1724
2365
|
},
|
|
1725
2366
|
removeQueued,
|
|
1726
2367
|
async promoteQueued(id, operationId) {
|
|
@@ -1729,12 +2370,12 @@ async function createLaneRuntime(options, attached) {
|
|
|
1729
2370
|
if (handingOff.has(id)) return "in_flight";
|
|
1730
2371
|
const result = await admitUser(() => writable(async () => {
|
|
1731
2372
|
try {
|
|
1732
|
-
return await harness.commit((tx) => require_index$
|
|
2373
|
+
return await harness.commit((tx) => require_index$6.admitSelected(tx, conversation.id, {
|
|
1733
2374
|
id,
|
|
1734
2375
|
operationId
|
|
1735
2376
|
}, settings, false), context);
|
|
1736
2377
|
} catch (error) {
|
|
1737
|
-
if (await storage.storage.submissionByRequest(conversation.id, require_index$
|
|
2378
|
+
if (await storage.storage.submissionByRequest(conversation.id, require_index$6.heldRequestId(id), context)) return "promoted";
|
|
1738
2379
|
throw error;
|
|
1739
2380
|
}
|
|
1740
2381
|
}));
|
|
@@ -1751,6 +2392,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1751
2392
|
await changeRecord((r) => {
|
|
1752
2393
|
r.paused = false;
|
|
1753
2394
|
delete r.abortOperationId;
|
|
2395
|
+
delete r.resumeOnStart;
|
|
1754
2396
|
});
|
|
1755
2397
|
await publish();
|
|
1756
2398
|
dispatch().catch((error) => emit({
|
|
@@ -1764,7 +2406,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1764
2406
|
if (enabled) {
|
|
1765
2407
|
const selected = (await conversation.agent(context)).model;
|
|
1766
2408
|
const model = selected ? models.getModel(selected.provider, selected.modelId) : void 0;
|
|
1767
|
-
if (model?.api !==
|
|
2409
|
+
if (model?.api !== "openai-codex-responses" || model.provider !== "openai-codex") throw new Error("Fast mode requires an OpenAI Codex model");
|
|
1768
2410
|
}
|
|
1769
2411
|
await writable(() => harness.commit(async (tx) => {
|
|
1770
2412
|
(await tx.doc(require_docs.FastModeDoc)).enabled = enabled;
|
|
@@ -1777,27 +2419,34 @@ async function createLaneRuntime(options, attached) {
|
|
|
1777
2419
|
}
|
|
1778
2420
|
});
|
|
1779
2421
|
}, context));
|
|
1780
|
-
fastMode = enabled;
|
|
2422
|
+
state.fastMode = enabled;
|
|
1781
2423
|
emit({
|
|
1782
2424
|
type: "fast_mode_changed",
|
|
1783
2425
|
enabled
|
|
1784
2426
|
});
|
|
1785
2427
|
},
|
|
1786
|
-
agentLocked: () => agentLocked,
|
|
2428
|
+
agentLocked: () => state.agentLocked,
|
|
1787
2429
|
async setAgentLock(locked) {
|
|
1788
2430
|
mainOnly();
|
|
1789
2431
|
if (typeof locked !== "boolean") throw new Error("Agent lock must be a boolean.");
|
|
1790
2432
|
await writable(() => harness.commit(async (tx) => {
|
|
1791
2433
|
(await tx.doc(require_docs.AgentLockDoc)).locked = locked;
|
|
1792
2434
|
}, context));
|
|
1793
|
-
agentLocked = locked;
|
|
2435
|
+
state.agentLocked = locked;
|
|
1794
2436
|
emit({
|
|
1795
2437
|
type: "agent_lock_changed",
|
|
1796
2438
|
locked
|
|
1797
2439
|
});
|
|
1798
|
-
if (!locked)
|
|
2440
|
+
if (!locked) {
|
|
2441
|
+
dispatch().catch((error) => emit({
|
|
2442
|
+
type: "error",
|
|
2443
|
+
code: "dispatch",
|
|
2444
|
+
error: String(error)
|
|
2445
|
+
}));
|
|
2446
|
+
return;
|
|
2447
|
+
}
|
|
1799
2448
|
const current = await execution();
|
|
1800
|
-
if (current?.kind === "run") await abort(current.id);
|
|
2449
|
+
if (current?.kind === "run" && current.id !== "settling") await abort(current.id);
|
|
1801
2450
|
},
|
|
1802
2451
|
async setModel(model) {
|
|
1803
2452
|
const previous = (await conversation.agent(context)).model;
|
|
@@ -1827,7 +2476,13 @@ async function createLaneRuntime(options, attached) {
|
|
|
1827
2476
|
if (!model) throw new Error("No model is selected");
|
|
1828
2477
|
return (0, _earendil_works_pi_ai.getSupportedThinkingLevels)(model);
|
|
1829
2478
|
},
|
|
1830
|
-
setThinkingLevel
|
|
2479
|
+
async setThinkingLevel(level) {
|
|
2480
|
+
await writable(() => conversation.configure({ thinkingLevel: level }, context));
|
|
2481
|
+
emit({
|
|
2482
|
+
type: "thinking_level_changed",
|
|
2483
|
+
level: (await conversation.agent(context)).thinkingLevel
|
|
2484
|
+
});
|
|
2485
|
+
},
|
|
1831
2486
|
async setSteeringMode(mode) {
|
|
1832
2487
|
settings = {
|
|
1833
2488
|
...settings,
|
|
@@ -1844,8 +2499,10 @@ async function createLaneRuntime(options, attached) {
|
|
|
1844
2499
|
mainOnly();
|
|
1845
2500
|
try {
|
|
1846
2501
|
const expected = conversation.id;
|
|
2502
|
+
if ((await readRecord()).held.some((q) => q.cohort?.conversationId === expected)) throw new Error("Resume the pending settle batch before changing conversation branches.");
|
|
1847
2503
|
if (targetId !== null && !await storage.storage.entry(conversation.id, nativeId(targetId), context)) throw new Error("Navigation target is not in the selected conversation");
|
|
1848
|
-
const
|
|
2504
|
+
const readTip = async () => require_index$1.projectDurableEntries((await conversation.entries({ order: "descending" }, 1, void 0, context)).items);
|
|
2505
|
+
const oldTip = (await readTip()).at(-1)?.id ?? null;
|
|
1849
2506
|
await deliver({ type: "navigation_start" }, context);
|
|
1850
2507
|
emit({
|
|
1851
2508
|
type: "navigation_start",
|
|
@@ -1890,10 +2547,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
1890
2547
|
type: "navigation_end",
|
|
1891
2548
|
status: "aborted"
|
|
1892
2549
|
});
|
|
1893
|
-
return {
|
|
1894
|
-
cancelled: true,
|
|
1895
|
-
entries: (await readEntries()).entries
|
|
1896
|
-
};
|
|
2550
|
+
return { cancelled: true };
|
|
1897
2551
|
}
|
|
1898
2552
|
throw error;
|
|
1899
2553
|
}
|
|
@@ -1912,14 +2566,11 @@ async function createLaneRuntime(options, attached) {
|
|
|
1912
2566
|
type: "navigation_end",
|
|
1913
2567
|
status: "aborted"
|
|
1914
2568
|
});
|
|
1915
|
-
return {
|
|
1916
|
-
cancelled: true,
|
|
1917
|
-
entries: (await readEntries()).entries
|
|
1918
|
-
};
|
|
2569
|
+
return { cancelled: true };
|
|
1919
2570
|
}
|
|
1920
2571
|
if (summary !== void 0 && typeof summary !== "string") throw new Error("Navigation summary must be a string");
|
|
1921
|
-
const id = await require_index$
|
|
1922
|
-
kind:
|
|
2572
|
+
const id = await require_index$5.navigateDurableConversation(harness, expected, targetId === null ? null : nativeId(targetId), context, typeof summary === "string" ? { summary: {
|
|
2573
|
+
kind: PO_ENTRY_KIND,
|
|
1923
2574
|
data: {
|
|
1924
2575
|
type: "branch_summary",
|
|
1925
2576
|
summary,
|
|
@@ -1934,35 +2585,33 @@ async function createLaneRuntime(options, attached) {
|
|
|
1934
2585
|
} } : void 0);
|
|
1935
2586
|
const agent = await conversation.agent(context);
|
|
1936
2587
|
conversation = await harness.conversation(id, context);
|
|
1937
|
-
|
|
2588
|
+
await readTranscriptOrder(context);
|
|
2589
|
+
install();
|
|
1938
2590
|
if (targetId === null) await conversation.configure({
|
|
1939
2591
|
model: agent.model,
|
|
1940
2592
|
thinkingLevel: agent.thinkingLevel,
|
|
1941
2593
|
cwd: agent.cwd,
|
|
1942
|
-
tools:
|
|
2594
|
+
tools: offeredTools(),
|
|
1943
2595
|
instructions: agent.instructions
|
|
1944
2596
|
}, context);
|
|
1945
2597
|
await attach();
|
|
1946
|
-
const
|
|
2598
|
+
const tip = await readTip();
|
|
1947
2599
|
if (typeof navigationOptions?.label === "string" && targetId !== null) await harness.commit(async (tx) => {
|
|
1948
2600
|
(await tx.doc(require_docs.LabelsDoc)).labels[targetId] = navigationOptions.label;
|
|
1949
2601
|
}, context);
|
|
1950
|
-
for (const entry of
|
|
2602
|
+
for (const entry of tip) if (entry.type === "branch_summary") await deliver({
|
|
1951
2603
|
type: "entry_appended",
|
|
1952
2604
|
entry
|
|
1953
2605
|
}, context);
|
|
1954
2606
|
const event = {
|
|
1955
2607
|
type: "navigation_end",
|
|
1956
2608
|
status: "completed",
|
|
1957
|
-
tipId:
|
|
2609
|
+
tipId: tip.at(-1)?.id ?? null,
|
|
1958
2610
|
fromTipId: oldTip
|
|
1959
2611
|
};
|
|
1960
2612
|
await deliver(event, context);
|
|
1961
2613
|
emit({ ...event });
|
|
1962
|
-
return {
|
|
1963
|
-
cancelled: false,
|
|
1964
|
-
entries: result.entries
|
|
1965
|
-
};
|
|
2614
|
+
return { cancelled: false };
|
|
1966
2615
|
} catch (error) {
|
|
1967
2616
|
await deliver({
|
|
1968
2617
|
type: "navigation_end",
|
|
@@ -2008,12 +2657,66 @@ async function createLaneRuntime(options, attached) {
|
|
|
2008
2657
|
groups: [...groups]
|
|
2009
2658
|
});
|
|
2010
2659
|
},
|
|
2660
|
+
async setBot({ bot, expectedRevision }) {
|
|
2661
|
+
mainOnly();
|
|
2662
|
+
let outcome = {
|
|
2663
|
+
ok: false,
|
|
2664
|
+
revision: 0
|
|
2665
|
+
};
|
|
2666
|
+
await writable(() => harness.commit(async (tx) => {
|
|
2667
|
+
const metadata = await tx.doc(require_docs.SessionMetadataDoc);
|
|
2668
|
+
const revision = typeof metadata.botRevision === "number" ? metadata.botRevision : 0;
|
|
2669
|
+
if (revision !== expectedRevision) {
|
|
2670
|
+
outcome = {
|
|
2671
|
+
ok: false,
|
|
2672
|
+
revision
|
|
2673
|
+
};
|
|
2674
|
+
return;
|
|
2675
|
+
}
|
|
2676
|
+
metadata.bot = bot === null ? null : { ...bot };
|
|
2677
|
+
metadata.botRevision = revision + 1;
|
|
2678
|
+
outcome = {
|
|
2679
|
+
ok: true,
|
|
2680
|
+
revision: revision + 1
|
|
2681
|
+
};
|
|
2682
|
+
}, context));
|
|
2683
|
+
if (outcome.ok) emit({
|
|
2684
|
+
type: require_sessionProtocol.SESSION_BOT_CHANGED_FRAME,
|
|
2685
|
+
bot,
|
|
2686
|
+
revision: outcome.revision
|
|
2687
|
+
});
|
|
2688
|
+
return outcome.ok ? {
|
|
2689
|
+
ok: true,
|
|
2690
|
+
revision: outcome.revision
|
|
2691
|
+
} : {
|
|
2692
|
+
ok: false,
|
|
2693
|
+
revision: outcome.revision
|
|
2694
|
+
};
|
|
2695
|
+
},
|
|
2011
2696
|
getSessionStats,
|
|
2697
|
+
getContextUsage,
|
|
2698
|
+
readResumeStatistics: () => projection.snapshots.statistics(conversation.id, context),
|
|
2699
|
+
readCustomSnapshots: () => projection.snapshots.customEntries(conversation.id, context),
|
|
2700
|
+
tokenSnapshot: (customTypes = []) => projection.snapshots.tokens(conversation.id, customTypes, context),
|
|
2701
|
+
async customSnapshot(customType, validator) {
|
|
2702
|
+
if (validator) {
|
|
2703
|
+
const previous = snapshotValidators.get(customType);
|
|
2704
|
+
if (!previous || previous.schemaId !== validator.schemaId || previous.accepts !== validator.accepts) {
|
|
2705
|
+
previous?.dispose();
|
|
2706
|
+
snapshotValidators.set(customType, {
|
|
2707
|
+
...validator,
|
|
2708
|
+
dispose: projection.snapshots.registerValidator(customType, validator.schemaId, validator.accepts)
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
return projection.snapshots.custom(conversation.id, customType, context);
|
|
2713
|
+
},
|
|
2714
|
+
getSessionUsage,
|
|
2012
2715
|
async replaceTools(replacement) {
|
|
2013
2716
|
tools = replacement;
|
|
2014
|
-
activeNames = new Set(tools.map((t) => t.name));
|
|
2717
|
+
state.activeNames = new Set(tools.map((t) => t.name));
|
|
2015
2718
|
install();
|
|
2016
|
-
await writable(() => conversation.configure({ tools:
|
|
2719
|
+
await writable(() => conversation.configure({ tools: offeredTools() }, context));
|
|
2017
2720
|
},
|
|
2018
2721
|
async replaceResources(replacement) {
|
|
2019
2722
|
resources = replacement;
|
|
@@ -2026,18 +2729,19 @@ async function createLaneRuntime(options, attached) {
|
|
|
2026
2729
|
runAtToolBoundary,
|
|
2027
2730
|
appendCustomEntry: async (customType, data) => {
|
|
2028
2731
|
const lane = conversation;
|
|
2732
|
+
const payload = data === void 0 ? void 0 : customEntryJson(customType, data);
|
|
2029
2733
|
return String((await writable(() => lane.commit(async (tx) => {
|
|
2030
2734
|
const entry = await tx.appendEntry(lane.id, {
|
|
2031
2735
|
kind: customType,
|
|
2032
|
-
...
|
|
2033
|
-
...options.entryProjectors?.[customType] ? { model: require_index
|
|
2736
|
+
...payload === void 0 ? {} : { data: payload },
|
|
2737
|
+
...options.entryProjectors?.[customType] ? { model: require_index.convertToLlm(options.entryProjectors[customType]({
|
|
2034
2738
|
type: "custom",
|
|
2035
2739
|
id: "",
|
|
2036
2740
|
parentId: null,
|
|
2037
2741
|
timestamp: Date.now(),
|
|
2038
2742
|
seq: 0,
|
|
2039
2743
|
customType,
|
|
2040
|
-
...
|
|
2744
|
+
...payload === void 0 ? {} : { data: payload }
|
|
2041
2745
|
})) } : {}
|
|
2042
2746
|
});
|
|
2043
2747
|
if (customType === "po-profile-identity") {
|
|
@@ -2051,7 +2755,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
2051
2755
|
return entry;
|
|
2052
2756
|
}, context))).id);
|
|
2053
2757
|
},
|
|
2054
|
-
appendMessage: (message) => appendMessage(message),
|
|
2758
|
+
appendMessage: (message, requestId) => requestId === void 0 ? appendMessage(message) : appendMessageOnce(message, requestId),
|
|
2055
2759
|
registerCheckpointBoundary(callback) {
|
|
2056
2760
|
const registration = {
|
|
2057
2761
|
active: true,
|
|
@@ -2059,7 +2763,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
2059
2763
|
};
|
|
2060
2764
|
checkpointBoundaries.add(registration);
|
|
2061
2765
|
return {
|
|
2062
|
-
appendMessage: (message) => commitCheckpointMessage(registration, conversation, message, context),
|
|
2766
|
+
appendMessage: (message, messageOptions) => commitCheckpointMessage(registration, conversation, message, context, void 0, void 0, messageOptions),
|
|
2063
2767
|
dispose() {
|
|
2064
2768
|
registration.active = false;
|
|
2065
2769
|
checkpointBoundaries.delete(registration);
|
|
@@ -2075,7 +2779,12 @@ async function createLaneRuntime(options, attached) {
|
|
|
2075
2779
|
}, context);
|
|
2076
2780
|
}),
|
|
2077
2781
|
recordUsage,
|
|
2078
|
-
submitPrompt: admit,
|
|
2782
|
+
submitPrompt: (value, images, mode, metadata, actor) => admit(value, images, mode, metadata, actor),
|
|
2783
|
+
submitWorkflowPrompt: (value, actor, requestId, authorize, resolveOperationModelPrompt) => {
|
|
2784
|
+
if (resolveOperationModelPrompt && (typeof requestId !== "string" || !requestId.trim())) return Promise.reject(/* @__PURE__ */ new Error("Operation-specific authority requires a stable request ID."));
|
|
2785
|
+
return admit(value, void 0, void 0, void 0, void 0, actor, requestId, authorize, resolveOperationModelPrompt);
|
|
2786
|
+
},
|
|
2787
|
+
...operationModelPrompt ? { toolOperationMember: (signal) => toolMembers.get(signal)?.() } : {},
|
|
2079
2788
|
submitUserPrompt,
|
|
2080
2789
|
prompt: async (value, images) => {
|
|
2081
2790
|
await (await admit(value, images)).settled;
|
|
@@ -2096,7 +2805,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
2096
2805
|
content: message,
|
|
2097
2806
|
timestamp: Date.now()
|
|
2098
2807
|
} : message;
|
|
2099
|
-
if (agentLocked) {
|
|
2808
|
+
if (state.agentLocked) {
|
|
2100
2809
|
try {
|
|
2101
2810
|
await appendMessage(preserved, requestId);
|
|
2102
2811
|
} catch (error) {
|
|
@@ -2108,7 +2817,8 @@ async function createLaneRuntime(options, attached) {
|
|
|
2108
2817
|
message: preserved,
|
|
2109
2818
|
conversationId: conversation.id
|
|
2110
2819
|
};
|
|
2111
|
-
|
|
2820
|
+
const cohort = settleCohort;
|
|
2821
|
+
if (!cohort && userAdmission) {
|
|
2112
2822
|
deferredInternalCount++;
|
|
2113
2823
|
admittingInternal.add(requestId);
|
|
2114
2824
|
internalDeliveries.set(requestId, deliveryRecord);
|
|
@@ -2131,25 +2841,42 @@ async function createLaneRuntime(options, attached) {
|
|
|
2131
2841
|
};
|
|
2132
2842
|
}
|
|
2133
2843
|
if (external) throw new Error("An operation is already running");
|
|
2134
|
-
const
|
|
2844
|
+
const entry = preserved.role === "custom" ? {
|
|
2845
|
+
kind: PO_ENTRY_KIND,
|
|
2846
|
+
data: json({
|
|
2847
|
+
type: "message",
|
|
2848
|
+
message: preserved,
|
|
2849
|
+
timestamp: preserved.timestamp
|
|
2850
|
+
})
|
|
2851
|
+
} : void 0;
|
|
2135
2852
|
admittingInternal.add(requestId);
|
|
2136
2853
|
let submission;
|
|
2137
2854
|
try {
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2855
|
+
if (cohort) {
|
|
2856
|
+
const conversationId = conversation.id;
|
|
2857
|
+
const staged = writable(() => harness.commit((tx) => require_index$6.stageCohortInput(tx, conversationId, cohort.runId, requestId, {
|
|
2858
|
+
text: text(message),
|
|
2859
|
+
message: preserved,
|
|
2860
|
+
entry,
|
|
2861
|
+
delivery,
|
|
2862
|
+
scheduling: "automatic"
|
|
2863
|
+
}), context));
|
|
2864
|
+
cohort.writes.push(staged);
|
|
2865
|
+
const id = await staged;
|
|
2866
|
+
const stored = await harness.submission(id, context);
|
|
2867
|
+
if (!stored) throw new Error(`Staged submission ${id} is unavailable`);
|
|
2868
|
+
submission = stored;
|
|
2869
|
+
internalDeliveries.set(requestId, deliveryRecord);
|
|
2870
|
+
} else {
|
|
2871
|
+
internalDeliveries.set(requestId, deliveryRecord);
|
|
2872
|
+
submission = await submitInput({
|
|
2873
|
+
type: "input",
|
|
2874
|
+
content: typeof message === "string" ? message : message.content,
|
|
2875
|
+
whenBusy: delivery,
|
|
2876
|
+
requestId,
|
|
2877
|
+
entry
|
|
2878
|
+
});
|
|
2879
|
+
}
|
|
2153
2880
|
} finally {
|
|
2154
2881
|
admittingInternal.delete(requestId);
|
|
2155
2882
|
}
|
|
@@ -2190,18 +2917,30 @@ async function createLaneRuntime(options, attached) {
|
|
|
2190
2917
|
}));
|
|
2191
2918
|
return { settled };
|
|
2192
2919
|
},
|
|
2193
|
-
steer: async (message, images) => {
|
|
2920
|
+
steer: async (message, images, _targetOperationId, actor) => {
|
|
2194
2921
|
if (typeof message !== "string" && message.role !== "user") throw new Error("Only user messages can steer an agent run");
|
|
2195
|
-
await submitUserPrompt(message, images, "steer");
|
|
2922
|
+
await submitUserPrompt(message, images, "steer", actor);
|
|
2196
2923
|
},
|
|
2197
|
-
followUp: (message, images) => queued(message, images, "followUp"),
|
|
2924
|
+
followUp: (message, images, actor) => queued(message, images, "followUp", actor),
|
|
2198
2925
|
nextRun: (message, images) => queued(message, images, "nextRun"),
|
|
2199
|
-
abort
|
|
2926
|
+
async abort(operationId) {
|
|
2927
|
+
stopAdmissions++;
|
|
2928
|
+
try {
|
|
2929
|
+
await abort(operationId);
|
|
2930
|
+
} finally {
|
|
2931
|
+
stopAdmissions--;
|
|
2932
|
+
dispatch().catch((error) => emit({
|
|
2933
|
+
type: "error",
|
|
2934
|
+
code: "dispatch",
|
|
2935
|
+
error: String(error)
|
|
2936
|
+
}));
|
|
2937
|
+
}
|
|
2938
|
+
},
|
|
2200
2939
|
interrupt,
|
|
2201
|
-
async compact(instructions) {
|
|
2940
|
+
async compact(instructions, clear = false) {
|
|
2202
2941
|
if (attached) throw new Error("Manual compaction runs on the main lane only.");
|
|
2203
2942
|
guardUserAdmission();
|
|
2204
|
-
if (external || compactionAdmission) throw new Error("An operation is already running");
|
|
2943
|
+
if (external || compactionAdmission || handingOff.size > 0) throw new Error("An operation is already running");
|
|
2205
2944
|
compactionAdmission = true;
|
|
2206
2945
|
const previous = settings;
|
|
2207
2946
|
try {
|
|
@@ -2214,6 +2953,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
2214
2953
|
}
|
|
2215
2954
|
};
|
|
2216
2955
|
manualCompaction.conversationId = String(conversation.id);
|
|
2956
|
+
if (clear) manualCompaction.clear = true;
|
|
2217
2957
|
const task = await writable(() => conversation.compact(instructions, context));
|
|
2218
2958
|
const receipt = await harness.waitForTask(task, context);
|
|
2219
2959
|
await eventsSettled;
|
|
@@ -2225,8 +2965,17 @@ async function createLaneRuntime(options, attached) {
|
|
|
2225
2965
|
} finally {
|
|
2226
2966
|
settings = previous;
|
|
2227
2967
|
delete manualCompaction.conversationId;
|
|
2968
|
+
delete manualCompaction.clear;
|
|
2228
2969
|
compactionAdmission = false;
|
|
2229
|
-
|
|
2970
|
+
try {
|
|
2971
|
+
if (!await nativeExecution()) await flushToolBoundary();
|
|
2972
|
+
} finally {
|
|
2973
|
+
dispatch().catch((error) => emit({
|
|
2974
|
+
type: "error",
|
|
2975
|
+
code: "dispatch",
|
|
2976
|
+
error: String(error)
|
|
2977
|
+
}));
|
|
2978
|
+
}
|
|
2230
2979
|
}
|
|
2231
2980
|
},
|
|
2232
2981
|
async admitResume() {
|
|
@@ -2265,6 +3014,9 @@ async function createLaneRuntime(options, attached) {
|
|
|
2265
3014
|
openLane(laneConversation, laneOptions) {
|
|
2266
3015
|
if (attached) return Promise.reject(/* @__PURE__ */ new Error("Lanes open on the main lane."));
|
|
2267
3016
|
return createLaneRuntime({
|
|
3017
|
+
...options.onFullHistoryRead ? { onFullHistoryRead: options.onFullHistoryRead } : {},
|
|
3018
|
+
...options.onStatsScan ? { onStatsScan: options.onStatsScan } : {},
|
|
3019
|
+
...options.onQueueDiagnostics ? { onQueueDiagnostics: options.onQueueDiagnostics } : {},
|
|
2268
3020
|
...laneOptions,
|
|
2269
3021
|
platform,
|
|
2270
3022
|
models: sourceModels
|
|
@@ -2272,6 +3024,7 @@ async function createLaneRuntime(options, attached) {
|
|
|
2272
3024
|
harness,
|
|
2273
3025
|
storage,
|
|
2274
3026
|
registry,
|
|
3027
|
+
snapshots: projection.snapshots,
|
|
2275
3028
|
conversation: laneConversation,
|
|
2276
3029
|
laneProviderSessions,
|
|
2277
3030
|
manualCompaction
|
|
@@ -2283,6 +3036,24 @@ async function createLaneRuntime(options, attached) {
|
|
|
2283
3036
|
},
|
|
2284
3037
|
dispose
|
|
2285
3038
|
};
|
|
3039
|
+
runtime.submitPrompt = trackReleaseAdmission(runtime.submitPrompt.bind(runtime));
|
|
3040
|
+
runtime.submitWorkflowPrompt = trackReleaseAdmission(runtime.submitWorkflowPrompt.bind(runtime));
|
|
3041
|
+
runtime.submitUserPrompt = trackReleaseAdmission(runtime.submitUserPrompt.bind(runtime));
|
|
3042
|
+
runtime.prompt = trackReleaseAdmission(runtime.prompt.bind(runtime));
|
|
3043
|
+
runtime.admitMessage = trackReleaseAdmission(runtime.admitMessage.bind(runtime));
|
|
3044
|
+
runtime.submitInternalMessage = trackReleaseAdmission(runtime.submitInternalMessage.bind(runtime));
|
|
3045
|
+
runtime.appendMessage = trackReleaseAdmission(runtime.appendMessage.bind(runtime));
|
|
3046
|
+
runtime.steer = trackReleaseAdmission(runtime.steer.bind(runtime));
|
|
3047
|
+
runtime.followUp = trackReleaseAdmission(runtime.followUp.bind(runtime));
|
|
3048
|
+
runtime.nextRun = trackReleaseAdmission(runtime.nextRun.bind(runtime));
|
|
3049
|
+
runtime.enqueueAutomatic = trackReleaseAdmission(runtime.enqueueAutomatic.bind(runtime));
|
|
3050
|
+
runtime.promoteQueued = trackReleaseAdmission(runtime.promoteQueued.bind(runtime));
|
|
3051
|
+
runtime.resumeQueue = trackReleaseAdmission(runtime.resumeQueue.bind(runtime));
|
|
3052
|
+
runtime.admitResume = trackReleaseAdmission(runtime.admitResume.bind(runtime));
|
|
3053
|
+
runtime.resume = trackReleaseAdmission(runtime.resume.bind(runtime));
|
|
3054
|
+
runtime.compact = trackReleaseAdmission(runtime.compact.bind(runtime));
|
|
3055
|
+
runtime.runExternalOperation = trackReleaseAdmission(runtime.runExternalOperation.bind(runtime));
|
|
3056
|
+
return runtime;
|
|
2286
3057
|
} catch (error) {
|
|
2287
3058
|
if (attached) throw error;
|
|
2288
3059
|
const failures = [error];
|
|
@@ -2297,6 +3068,11 @@ async function createLaneRuntime(options, attached) {
|
|
|
2297
3068
|
} catch (closeError) {
|
|
2298
3069
|
failures.push(closeError);
|
|
2299
3070
|
}
|
|
3071
|
+
try {
|
|
3072
|
+
await startupEnvironment?.cleanup(context);
|
|
3073
|
+
} catch (cleanupError) {
|
|
3074
|
+
failures.push(cleanupError);
|
|
3075
|
+
}
|
|
2300
3076
|
if (failures.length > 1) throw new AggregateError(failures, "Direct harness startup and cleanup failed");
|
|
2301
3077
|
throw error;
|
|
2302
3078
|
}
|
|
@@ -2305,5 +3081,6 @@ async function createLaneRuntime(options, attached) {
|
|
|
2305
3081
|
exports.createDirectHarnessRuntime = createDirectHarnessRuntime;
|
|
2306
3082
|
exports.projectDurableConversationEntries = projectDurableConversationEntries;
|
|
2307
3083
|
exports.promptForAssistantText = promptForAssistantText;
|
|
3084
|
+
exports.thrownToolFailure = thrownToolFailure;
|
|
2308
3085
|
|
|
2309
3086
|
//# sourceMappingURL=directHarnessRuntime.cjs.map
|