@agimon-ai/po-core 0.0.0-alpha.2 → 0.0.0-alpha.21
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 +149 -21
- package/NOTICE +41 -0
- package/dist/agentModel.cjs +1 -1
- package/dist/agentModel.d.mts +2 -2
- package/dist/agentModel.mjs +1 -2
- package/dist/apiContracts.cjs +623 -802
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +277 -615
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +617 -794
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/askUser.cjs +2 -2
- package/dist/askUser.d.mts +2 -2
- package/dist/askUser.mjs +1 -2
- package/dist/authorTools.mjs +1 -2
- package/dist/backgroundWork.cjs +3 -3
- package/dist/backgroundWork.d.mts +2 -2
- package/dist/backgroundWork.mjs +1 -2
- package/dist/bundleAssetPolicy.mjs +1 -2
- package/dist/chatgptAuth.cjs +3 -2
- package/dist/chatgptAuth.d.mts +3 -2
- package/dist/chatgptAuth.mjs +2 -1
- package/dist/childProcess.cjs +1 -1
- package/dist/childProcess.d.mts +2 -2
- package/dist/childProcess.mjs +1 -2
- package/dist/childSession.cjs +11 -6
- package/dist/childSession.d.mts +3 -3
- package/dist/childSession.mjs +3 -3
- package/dist/cockpitContainer.mjs +1 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +1 -2
- package/dist/contextApi.cjs +1 -0
- package/dist/contextApi.d.mts +2 -2
- package/dist/contextApi.mjs +2 -2
- package/dist/contextContributions.cjs +4 -4
- package/dist/contextContributions.d.mts +3 -3
- package/dist/contextContributions.mjs +3 -3
- package/dist/contextDetailStore.cjs +7 -5
- package/dist/contextDetailStore.cjs.map +1 -1
- package/dist/contextDetailStore.d.mts +2 -1
- package/dist/contextDetailStore.d.mts.map +1 -1
- package/dist/contextDetailStore.mjs +6 -4
- package/dist/contextDetailStore.mjs.map +1 -1
- package/dist/contextProjection.cjs +7 -2
- package/dist/contextProjection.cjs.map +1 -1
- package/dist/contextProjection.d.mts +4 -1
- package/dist/contextProjection.d.mts.map +1 -1
- package/dist/contextProjection.mjs +5 -2
- package/dist/contextProjection.mjs.map +1 -1
- package/dist/cordisHost.cjs +11 -11
- package/dist/cordisHost.d.mts +2 -2
- package/dist/cordisHost.mjs +1 -2
- package/dist/delegation.cjs +8 -8
- package/dist/delegation.d.mts +2 -2
- package/dist/delegation.mjs +1 -2
- package/dist/executionBudget.cjs +4 -3
- package/dist/executionBudget.cjs.map +1 -1
- package/dist/executionBudget.d.mts +2 -2
- package/dist/executionBudget.d.mts.map +1 -1
- package/dist/executionBudget.mjs +4 -3
- package/dist/executionBudget.mjs.map +1 -1
- package/dist/extensionFile.cjs +5 -0
- package/dist/extensionFile.d.mts +4 -2
- package/dist/extensionFile.mjs +4 -2
- package/dist/footer.d.mts +2 -2
- package/dist/footer.mjs +1 -2
- package/dist/headless.cjs +14 -14
- package/dist/headless.d.mts +2 -2
- package/dist/headless.mjs +1 -2
- package/dist/headlessHub.cjs +308 -109
- package/dist/headlessHub.cjs.map +1 -1
- package/dist/headlessHub.d.mts +71 -36
- package/dist/headlessHub.d.mts.map +1 -1
- package/dist/headlessHub.mjs +309 -110
- package/dist/headlessHub.mjs.map +1 -1
- package/dist/headlessProtocol.cjs +327 -0
- package/dist/headlessProtocol.cjs.map +1 -0
- package/dist/headlessProtocol.d.mts +30 -0
- package/dist/headlessProtocol.d.mts.map +1 -0
- package/dist/headlessProtocol.mjs +326 -0
- package/dist/headlessProtocol.mjs.map +1 -0
- package/dist/headlessServer.cjs +166 -151
- package/dist/headlessServer.cjs.map +1 -1
- package/dist/headlessServer.d.mts +13 -5
- package/dist/headlessServer.d.mts.map +1 -1
- package/dist/headlessServer.mjs +166 -151
- package/dist/headlessServer.mjs.map +1 -1
- package/dist/headlessSessionHost.d.mts +58 -21
- package/dist/headlessSessionHost.d.mts.map +1 -1
- package/dist/help.cjs +20 -20
- package/dist/help.d.mts +2 -2
- package/dist/help.mjs +2 -2
- package/dist/history.cjs +16 -20
- package/dist/history.d.mts +9 -7
- package/dist/history.mjs +6 -7
- package/dist/historyOwnership.cjs.map +1 -1
- package/dist/historyOwnership.d.mts +1 -1
- package/dist/historyOwnership.mjs.map +1 -1
- package/dist/hubChannel.cjs +9 -0
- package/dist/hubChannel.d.mts +3 -2
- package/dist/hubChannel.mjs +3 -2
- package/dist/index.cjs +26 -28
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +6 -6
- package/dist/interop/chord.mjs +1 -0
- package/dist/interop/chordContext.mjs +1 -0
- package/dist/json.cjs +11 -5
- package/dist/json.d.mts +4 -2
- package/dist/json.mjs +4 -2
- package/dist/kernel.cjs +1 -1
- package/dist/kernel.d.mts +3 -3
- package/dist/kernel.mjs +1 -2
- package/dist/leader.d.mts +2 -2
- package/dist/leader.mjs +1 -2
- package/dist/logSinkTelemetry.mjs +1 -2
- package/dist/machineApi.cjs +80 -74
- package/dist/machineApi.cjs.map +1 -1
- package/dist/machineApi.d.mts +5 -2
- package/dist/machineApi.d.mts.map +1 -1
- package/dist/machineApi.mjs +78 -71
- package/dist/machineApi.mjs.map +1 -1
- package/dist/main.cjs +2 -1
- package/dist/main.d.mts +2 -1
- package/dist/main.mjs +2 -1
- package/dist/mcpFacet.d.mts +3 -3
- package/dist/mcpProjection.cjs +13 -13
- package/dist/mcpProjection.d.mts +2 -2
- package/dist/mcpProjection.mjs +1 -2
- package/dist/mcpSchemaCost.cjs +4 -4
- package/dist/mcpSchemaCost.cjs.map +1 -1
- package/dist/mcpSchemaCost.d.mts +2 -2
- package/dist/mcpSchemaCost.mjs +4 -4
- package/dist/mcpSchemaCost.mjs.map +1 -1
- package/dist/mcpSession.cjs +7 -7
- package/dist/mcpSession.d.mts +2 -2
- package/dist/mcpSession.mjs +1 -2
- package/dist/mcpStatus.cjs +2 -2
- package/dist/mcpStatus.d.mts +2 -2
- package/dist/mcpStatus.mjs +1 -2
- package/dist/mcpToolResolver.cjs +3 -3
- package/dist/mcpToolResolver.d.mts +2 -2
- package/dist/mcpToolResolver.mjs +1 -2
- package/dist/mcpWidget.d.mts +2 -2
- package/dist/moduleResolution.cjs +43 -8
- package/dist/moduleResolution.cjs.map +1 -1
- package/dist/moduleResolution.d.mts +10 -1
- package/dist/moduleResolution.d.mts.map +1 -1
- package/dist/moduleResolution.mjs +40 -7
- package/dist/moduleResolution.mjs.map +1 -1
- package/dist/narration.cjs +3 -3
- package/dist/narration.d.mts +2 -2
- package/dist/narration.mjs +1 -2
- package/dist/native.cjs +9 -0
- package/dist/native.d.mts +4 -3
- package/dist/native.mjs +3 -2
- package/dist/nodePlatform.cjs +77 -0
- package/dist/nodePlatform.cjs.map +1 -0
- package/dist/nodePlatform.d.mts +17 -0
- package/dist/nodePlatform.d.mts.map +1 -0
- package/dist/nodePlatform.mjs +72 -0
- package/dist/nodePlatform.mjs.map +1 -0
- package/dist/notification.cjs +15 -15
- package/dist/notification.d.mts +2 -2
- package/dist/notification.mjs +1 -2
- package/dist/packageApi.cjs +11 -11
- package/dist/packageApi.d.mts +2 -2
- package/dist/packageApi.mjs +2 -2
- package/dist/packageApiServer.cjs +45 -27
- package/dist/packageApiServer.cjs.map +1 -1
- package/dist/packageApiServer.d.mts +36 -26
- package/dist/packageApiServer.d.mts.map +1 -1
- package/dist/packageApiServer.mjs +44 -26
- package/dist/packageApiServer.mjs.map +1 -1
- package/dist/piSettings.cjs +41 -20
- package/dist/piSettings.d.mts +4 -2
- package/dist/piSettings.mjs +4 -2
- package/dist/platform.cjs +62 -0
- package/dist/platform.d.mts +10 -0
- package/dist/platform.mjs +10 -0
- package/dist/pluginProtocol.cjs +7 -8
- package/dist/pluginProtocol.d.mts +2 -2
- package/dist/pluginProtocol.mjs +1 -2
- package/dist/poPackage.cjs +12 -0
- package/dist/poPackage.d.mts +3 -0
- package/dist/poPackage.mjs +3 -0
- package/dist/profileIdentity.cjs +1 -1
- package/dist/profileIdentity.d.mts +2 -2
- package/dist/profileIdentity.mjs +1 -2
- package/dist/protocol.cjs +3 -3
- package/dist/protocol.d.mts +2 -2
- package/dist/protocol.mjs +1 -2
- package/dist/readiness.cjs +6 -6
- package/dist/readiness.d.mts +2 -2
- package/dist/readiness.mjs +1 -2
- package/dist/remoteApi.cjs.map +1 -1
- package/dist/remoteApi.d.mts +2 -2
- package/dist/remoteApi.mjs.map +1 -1
- package/dist/remoteRuntime.cjs +42 -65
- package/dist/remoteRuntime.cjs.map +1 -1
- package/dist/remoteRuntime.d.mts +3 -2
- package/dist/remoteRuntime.d.mts.map +1 -1
- package/dist/remoteRuntime.mjs +41 -62
- package/dist/remoteRuntime.mjs.map +1 -1
- package/dist/runtimeConfig.cjs +4 -4
- package/dist/runtimeConfig.cjs.map +1 -1
- package/dist/runtimeConfig.d.mts +10 -9
- package/dist/runtimeConfig.d.mts.map +1 -1
- package/dist/runtimeConfig.mjs +4 -4
- package/dist/runtimeConfig.mjs.map +1 -1
- package/dist/runtimeContextApi.cjs +10 -3
- package/dist/runtimeContextApi.cjs.map +1 -1
- package/dist/runtimeContextApi.d.mts +3 -3
- package/dist/runtimeContextApi.d.mts.map +1 -1
- package/dist/runtimeContextApi.mjs +10 -3
- package/dist/runtimeContextApi.mjs.map +1 -1
- package/dist/runtimeCordisHost.cjs +46 -46
- package/dist/runtimeCordisHost.cjs.map +1 -1
- package/dist/runtimeCordisHost.d.mts +29 -28
- package/dist/runtimeCordisHost.d.mts.map +1 -1
- package/dist/runtimeCordisHost.mjs +42 -42
- package/dist/runtimeCordisHost.mjs.map +1 -1
- package/dist/runtimeIdentity.cjs +6 -9
- package/dist/runtimeIdentity.cjs.map +1 -1
- package/dist/runtimeIdentity.d.mts +5 -1
- package/dist/runtimeIdentity.d.mts.map +1 -1
- package/dist/runtimeIdentity.mjs +5 -8
- package/dist/runtimeIdentity.mjs.map +1 -1
- package/dist/runtimeJson.cjs +10 -45
- package/dist/runtimeJson.d.mts +3 -22
- package/dist/runtimeJson.mjs +3 -39
- package/dist/runtimeLogSinkTelemetry.cjs +19 -19
- package/dist/runtimeLogSinkTelemetry.cjs.map +1 -1
- package/dist/runtimeLogSinkTelemetry.d.mts +19 -19
- package/dist/runtimeLogSinkTelemetry.mjs +19 -19
- package/dist/runtimeLogSinkTelemetry.mjs.map +1 -1
- package/dist/runtimePackages.cjs +7 -2
- package/dist/runtimePackages.cjs.map +1 -1
- package/dist/runtimePackages.d.mts +4 -1
- package/dist/runtimePackages.d.mts.map +1 -1
- package/dist/runtimePackages.mjs +7 -2
- package/dist/runtimePackages.mjs.map +1 -1
- package/dist/runtimePiSettings.cjs +40 -263
- package/dist/runtimePiSettings.d.mts +3 -72
- package/dist/runtimePiSettings.mjs +3 -241
- package/dist/runtimeProtocol.cjs +19 -19
- package/dist/runtimeProtocol.cjs.map +1 -1
- package/dist/runtimeProtocol.d.mts +7 -7
- package/dist/runtimeProtocol.d.mts.map +1 -1
- package/dist/runtimeProtocol.mjs +17 -17
- package/dist/runtimeProtocol.mjs.map +1 -1
- package/dist/runtimeTransition.cjs +9 -9
- package/dist/runtimeTransition.cjs.map +1 -1
- package/dist/runtimeTransition.d.mts +10 -10
- package/dist/runtimeTransition.d.mts.map +1 -1
- package/dist/runtimeTransition.mjs +7 -7
- package/dist/runtimeTransition.mjs.map +1 -1
- package/dist/sandboxHarness.mjs +1 -2
- package/dist/server.cjs +3 -7
- package/dist/server.d.mts +6 -6
- package/dist/server.mjs +3 -4
- package/dist/serverPlugin.cjs +39 -0
- package/dist/serverPlugin.d.mts +12 -0
- package/dist/serverPlugin.mjs +11 -0
- package/dist/serverTelemetry.cjs +1 -1
- package/dist/serverTelemetry.cjs.map +1 -1
- package/dist/serverTelemetry.d.mts +2 -2
- package/dist/serverTelemetry.mjs +2 -2
- package/dist/serverTelemetry.mjs.map +1 -1
- package/dist/sessionFilesApi.cjs +41 -37
- package/dist/sessionFilesApi.cjs.map +1 -1
- package/dist/sessionFilesApi.d.mts +6 -3
- package/dist/sessionFilesApi.d.mts.map +1 -1
- package/dist/sessionFilesApi.mjs +41 -36
- package/dist/sessionFilesApi.mjs.map +1 -1
- package/dist/sessionProtocol.cjs +31 -6
- package/dist/sessionProtocol.d.mts +8 -3
- package/dist/sessionProtocol.mjs +8 -2
- package/dist/skills.cjs +5 -5
- package/dist/skills.d.mts +2 -2
- package/dist/skills.mjs +1 -2
- package/dist/sqliteSessionStorage.cjs +28 -50
- package/dist/sqliteSessionStorage.cjs.map +1 -1
- package/dist/sqliteSessionStorage.d.mts +13 -20
- package/dist/sqliteSessionStorage.d.mts.map +1 -1
- package/dist/sqliteSessionStorage.mjs +25 -48
- package/dist/sqliteSessionStorage.mjs.map +1 -1
- package/dist/src/constants/agentSettled.cjs +7 -0
- package/dist/src/constants/agentSettled.cjs.map +1 -0
- package/dist/src/constants/agentSettled.mjs +7 -0
- package/dist/src/constants/agentSettled.mjs.map +1 -0
- package/dist/src/constants/contextApi.cjs +3 -1
- package/dist/src/constants/contextApi.cjs.map +1 -1
- package/dist/src/constants/contextApi.d.mts +2 -1
- package/dist/src/constants/contextApi.d.mts.map +1 -1
- package/dist/src/constants/contextApi.mjs +3 -2
- package/dist/src/constants/contextApi.mjs.map +1 -1
- package/dist/src/constants/voiceTools.cjs +6 -6
- package/dist/src/constants/voiceTools.cjs.map +1 -1
- package/dist/src/constants/voiceTools.d.mts +3 -3
- package/dist/src/constants/voiceTools.mjs +4 -4
- package/dist/src/constants/voiceTools.mjs.map +1 -1
- package/dist/src/extensions/extensionFile.cjs +22 -5
- package/dist/src/extensions/extensionFile.cjs.map +1 -1
- package/dist/src/extensions/extensionFile.d.mts +17 -4
- package/dist/src/extensions/extensionFile.d.mts.map +1 -1
- package/dist/src/extensions/extensionFile.mjs +22 -6
- package/dist/src/extensions/extensionFile.mjs.map +1 -1
- package/dist/src/extensions/serverPlugin.cjs +231 -92
- package/dist/src/extensions/serverPlugin.cjs.map +1 -1
- package/dist/src/extensions/serverPlugin.d.mts +2 -2
- package/dist/src/extensions/serverPlugin.d.mts.map +1 -1
- package/dist/src/extensions/serverPlugin.mjs +232 -93
- package/dist/src/extensions/serverPlugin.mjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.cjs +349 -142
- package/dist/src/pi/piSessionRuntime.cjs.map +1 -1
- package/dist/src/pi/piSessionRuntime.d.mts +18 -17
- package/dist/src/pi/piSessionRuntime.d.mts.map +1 -1
- package/dist/src/pi/piSessionRuntime.mjs +342 -135
- package/dist/src/pi/piSessionRuntime.mjs.map +1 -1
- package/dist/src/schemas/agentModel.cjs +2 -2
- package/dist/src/schemas/agentModel.cjs.map +1 -1
- package/dist/src/schemas/agentModel.d.mts +1 -1
- package/dist/src/schemas/agentModel.mjs +2 -2
- package/dist/src/schemas/agentModel.mjs.map +1 -1
- package/dist/src/schemas/apiContracts.d.mts +2 -2
- package/dist/src/schemas/apiContracts.d.mts.map +1 -1
- package/dist/src/schemas/askUser.cjs +4 -4
- package/dist/src/schemas/askUser.cjs.map +1 -1
- package/dist/src/schemas/askUser.d.mts +4 -4
- package/dist/src/schemas/askUser.d.mts.map +1 -1
- package/dist/src/schemas/askUser.mjs +3 -3
- package/dist/src/schemas/askUser.mjs.map +1 -1
- package/dist/src/schemas/backgroundWork.cjs +10 -10
- package/dist/src/schemas/backgroundWork.cjs.map +1 -1
- package/dist/src/schemas/backgroundWork.d.mts +9 -9
- package/dist/src/schemas/backgroundWork.d.mts.map +1 -1
- package/dist/src/schemas/backgroundWork.mjs +8 -8
- package/dist/src/schemas/backgroundWork.mjs.map +1 -1
- package/dist/src/schemas/childProcess.cjs +5 -5
- package/dist/src/schemas/childProcess.cjs.map +1 -1
- package/dist/src/schemas/childProcess.d.mts +2 -2
- package/dist/src/schemas/childProcess.mjs +5 -5
- package/dist/src/schemas/childProcess.mjs.map +1 -1
- package/dist/src/schemas/contextContributions.cjs +10 -10
- package/dist/src/schemas/contextContributions.cjs.map +1 -1
- package/dist/src/schemas/contextContributions.d.mts +16 -16
- package/dist/src/schemas/contextContributions.d.mts.map +1 -1
- package/dist/src/schemas/contextContributions.mjs +8 -8
- package/dist/src/schemas/contextContributions.mjs.map +1 -1
- package/dist/src/schemas/delegation.cjs +17 -17
- package/dist/src/schemas/delegation.cjs.map +1 -1
- package/dist/src/schemas/delegation.d.mts +16 -16
- package/dist/src/schemas/delegation.d.mts.map +1 -1
- package/dist/src/schemas/delegation.mjs +10 -10
- package/dist/src/schemas/delegation.mjs.map +1 -1
- package/dist/src/schemas/extensionFile.d.mts +23 -19
- package/dist/src/schemas/extensionFile.d.mts.map +1 -1
- package/dist/src/schemas/footer.cjs.map +1 -1
- package/dist/src/schemas/footer.d.mts +5 -5
- package/dist/src/schemas/footer.d.mts.map +1 -1
- package/dist/src/schemas/footer.mjs.map +1 -1
- package/dist/src/schemas/headless.cjs +37 -37
- package/dist/src/schemas/headless.cjs.map +1 -1
- package/dist/src/schemas/headless.d.mts +100 -101
- package/dist/src/schemas/headless.d.mts.map +1 -1
- package/dist/src/schemas/headless.mjs +24 -24
- package/dist/src/schemas/headless.mjs.map +1 -1
- package/dist/src/schemas/help.cjs +60 -60
- package/dist/src/schemas/help.cjs.map +1 -1
- package/dist/src/schemas/help.d.mts +43 -43
- package/dist/src/schemas/help.d.mts.map +1 -1
- package/dist/src/schemas/help.mjs +41 -41
- package/dist/src/schemas/help.mjs.map +1 -1
- package/dist/src/schemas/home.cjs +127 -0
- package/dist/src/schemas/home.cjs.map +1 -0
- package/dist/src/schemas/home.d.mts +63 -0
- package/dist/src/schemas/home.d.mts.map +1 -0
- package/dist/src/schemas/home.mjs +121 -0
- package/dist/src/schemas/home.mjs.map +1 -0
- package/dist/src/schemas/httpApiContracts.cjs +441 -0
- package/dist/src/schemas/httpApiContracts.cjs.map +1 -0
- package/dist/src/schemas/httpApiContracts.d.mts +78 -0
- package/dist/src/schemas/httpApiContracts.d.mts.map +1 -0
- package/dist/src/schemas/httpApiContracts.mjs +434 -0
- package/dist/src/schemas/httpApiContracts.mjs.map +1 -0
- package/dist/src/schemas/hubChannel.cjs +3 -0
- package/dist/src/schemas/hubChannel.cjs.map +1 -1
- package/dist/src/schemas/hubChannel.d.mts +84 -60
- package/dist/src/schemas/hubChannel.d.mts.map +1 -1
- package/dist/src/schemas/hubChannel.mjs +3 -1
- package/dist/src/schemas/hubChannel.mjs.map +1 -1
- package/dist/src/schemas/leader.cjs.map +1 -1
- package/dist/src/schemas/leader.d.mts +3 -3
- package/dist/src/schemas/leader.d.mts.map +1 -1
- package/dist/src/schemas/leader.mjs.map +1 -1
- package/dist/src/schemas/mcpBundle.d.mts +3 -3
- package/dist/src/schemas/mcpFacet.cjs.map +1 -1
- package/dist/src/schemas/mcpFacet.d.mts +22 -22
- 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 +41 -41
- package/dist/src/schemas/mcpProjection.cjs.map +1 -1
- package/dist/src/schemas/mcpProjection.d.mts +31 -30
- package/dist/src/schemas/mcpProjection.d.mts.map +1 -1
- package/dist/src/schemas/mcpProjection.mjs +29 -29
- package/dist/src/schemas/mcpProjection.mjs.map +1 -1
- package/dist/src/schemas/mcpSession.cjs +23 -23
- package/dist/src/schemas/mcpSession.cjs.map +1 -1
- package/dist/src/schemas/mcpSession.d.mts +12 -12
- package/dist/src/schemas/mcpSession.d.mts.map +1 -1
- package/dist/src/schemas/mcpSession.mjs +18 -18
- package/dist/src/schemas/mcpSession.mjs.map +1 -1
- package/dist/src/schemas/mcpStatus.cjs +5 -5
- package/dist/src/schemas/mcpStatus.cjs.map +1 -1
- package/dist/src/schemas/mcpStatus.d.mts +4 -4
- package/dist/src/schemas/mcpStatus.d.mts.map +1 -1
- package/dist/src/schemas/mcpStatus.mjs +4 -4
- package/dist/src/schemas/mcpStatus.mjs.map +1 -1
- package/dist/src/schemas/mcpToolResolver.cjs +9 -9
- package/dist/src/schemas/mcpToolResolver.cjs.map +1 -1
- package/dist/src/schemas/mcpToolResolver.d.mts +7 -7
- package/dist/src/schemas/mcpToolResolver.d.mts.map +1 -1
- package/dist/src/schemas/mcpToolResolver.mjs +7 -7
- package/dist/src/schemas/mcpToolResolver.mjs.map +1 -1
- package/dist/src/schemas/narration.cjs +9 -9
- package/dist/src/schemas/narration.cjs.map +1 -1
- package/dist/src/schemas/narration.d.mts +5 -5
- package/dist/src/schemas/narration.d.mts.map +1 -1
- package/dist/src/schemas/narration.mjs +7 -7
- package/dist/src/schemas/narration.mjs.map +1 -1
- package/dist/src/schemas/notification.cjs +45 -45
- package/dist/src/schemas/notification.cjs.map +1 -1
- package/dist/src/schemas/notification.d.mts +22 -22
- package/dist/src/schemas/notification.d.mts.map +1 -1
- package/dist/src/schemas/notification.mjs +31 -31
- package/dist/src/schemas/notification.mjs.map +1 -1
- package/dist/src/schemas/packageApi.cjs +28 -28
- package/dist/src/schemas/packageApi.cjs.map +1 -1
- package/dist/src/schemas/packageApi.d.mts +91 -65
- package/dist/src/schemas/packageApi.d.mts.map +1 -1
- package/dist/src/schemas/packageApi.mjs +18 -18
- package/dist/src/schemas/packageApi.mjs.map +1 -1
- package/dist/src/schemas/platform.cjs +34 -0
- package/dist/src/schemas/platform.cjs.map +1 -0
- package/dist/src/schemas/platform.d.mts +75 -0
- package/dist/src/schemas/platform.d.mts.map +1 -0
- package/dist/src/schemas/platform.mjs +27 -0
- package/dist/src/schemas/platform.mjs.map +1 -0
- package/dist/src/schemas/pluginContributions.cjs.map +1 -1
- package/dist/src/schemas/pluginContributions.d.mts +12 -12
- 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 +24 -27
- package/dist/src/schemas/pluginProtocol.cjs.map +1 -1
- package/dist/src/schemas/pluginProtocol.d.mts +21 -21
- package/dist/src/schemas/pluginProtocol.d.mts.map +1 -1
- package/dist/src/schemas/pluginProtocol.mjs +18 -20
- package/dist/src/schemas/pluginProtocol.mjs.map +1 -1
- package/dist/src/schemas/profileIdentity.cjs +2 -2
- package/dist/src/schemas/profileIdentity.cjs.map +1 -1
- package/dist/src/schemas/profileIdentity.d.mts +1 -1
- package/dist/src/schemas/profileIdentity.mjs +2 -2
- package/dist/src/schemas/profileIdentity.mjs.map +1 -1
- package/dist/src/schemas/protocolChannelsContract.cjs +27 -0
- package/dist/src/schemas/protocolChannelsContract.cjs.map +1 -0
- package/dist/src/schemas/protocolChannelsContract.d.mts +37 -0
- package/dist/src/schemas/protocolChannelsContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolChannelsContract.mjs +25 -0
- package/dist/src/schemas/protocolChannelsContract.mjs.map +1 -0
- package/dist/src/schemas/protocolContracts.cjs +168 -0
- package/dist/src/schemas/protocolContracts.cjs.map +1 -0
- package/dist/src/schemas/protocolContracts.d.mts +69 -0
- package/dist/src/schemas/protocolContracts.d.mts.map +1 -0
- package/dist/src/schemas/protocolContracts.mjs +164 -0
- package/dist/src/schemas/protocolContracts.mjs.map +1 -0
- package/dist/src/schemas/protocolHubContract.cjs +51 -0
- package/dist/src/schemas/protocolHubContract.cjs.map +1 -0
- package/dist/src/schemas/protocolHubContract.d.mts +218 -0
- package/dist/src/schemas/protocolHubContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolHubContract.mjs +49 -0
- package/dist/src/schemas/protocolHubContract.mjs.map +1 -0
- package/dist/src/schemas/protocolSessionContract.cjs +22 -0
- package/dist/src/schemas/protocolSessionContract.cjs.map +1 -0
- package/dist/src/schemas/protocolSessionContract.d.mts +324 -0
- package/dist/src/schemas/protocolSessionContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolSessionContract.mjs +22 -0
- package/dist/src/schemas/protocolSessionContract.mjs.map +1 -0
- package/dist/src/schemas/protocolThreadContract.cjs +21 -0
- package/dist/src/schemas/protocolThreadContract.cjs.map +1 -0
- package/dist/src/schemas/protocolThreadContract.d.mts +29 -0
- package/dist/src/schemas/protocolThreadContract.d.mts.map +1 -0
- package/dist/src/schemas/protocolThreadContract.mjs +20 -0
- package/dist/src/schemas/protocolThreadContract.mjs.map +1 -0
- package/dist/src/schemas/readiness.cjs +36 -36
- package/dist/src/schemas/readiness.cjs.map +1 -1
- package/dist/src/schemas/readiness.d.mts +37 -37
- package/dist/src/schemas/readiness.d.mts.map +1 -1
- package/dist/src/schemas/readiness.mjs +31 -31
- package/dist/src/schemas/readiness.mjs.map +1 -1
- package/dist/src/schemas/serverBundle.d.mts +5 -5
- package/dist/src/schemas/serverPlugin.cjs +103 -0
- package/dist/src/schemas/serverPlugin.cjs.map +1 -0
- package/dist/src/schemas/serverPlugin.d.mts +176 -0
- package/dist/src/schemas/serverPlugin.d.mts.map +1 -0
- package/dist/src/schemas/serverPlugin.mjs +95 -0
- package/dist/src/schemas/serverPlugin.mjs.map +1 -0
- package/dist/src/schemas/serverScope.cjs +37 -0
- package/dist/src/schemas/serverScope.cjs.map +1 -0
- package/dist/src/schemas/serverScope.d.mts +77 -0
- package/dist/src/schemas/serverScope.d.mts.map +1 -0
- package/dist/src/schemas/serverScope.mjs +33 -0
- package/dist/src/schemas/serverScope.mjs.map +1 -0
- package/dist/src/schemas/sessionApiContracts.cjs +320 -0
- package/dist/src/schemas/sessionApiContracts.cjs.map +1 -0
- package/dist/src/schemas/sessionApiContracts.mjs +318 -0
- package/dist/src/schemas/sessionApiContracts.mjs.map +1 -0
- package/dist/src/schemas/sessionProtocol.cjs +20 -13
- package/dist/src/schemas/sessionProtocol.cjs.map +1 -1
- package/dist/src/schemas/sessionProtocol.d.mts +37 -54
- package/dist/src/schemas/sessionProtocol.d.mts.map +1 -1
- package/dist/src/schemas/sessionProtocol.mjs +17 -8
- package/dist/src/schemas/sessionProtocol.mjs.map +1 -1
- package/dist/src/schemas/skills.cjs +16 -16
- package/dist/src/schemas/skills.cjs.map +1 -1
- package/dist/src/schemas/skills.d.mts +7 -7
- package/dist/src/schemas/skills.d.mts.map +1 -1
- package/dist/src/schemas/skills.mjs +12 -12
- package/dist/src/schemas/skills.mjs.map +1 -1
- package/dist/src/schemas/toolOverrides.cjs +9 -9
- package/dist/src/schemas/toolOverrides.cjs.map +1 -1
- package/dist/src/schemas/toolOverrides.d.mts +8 -8
- package/dist/src/schemas/toolOverrides.d.mts.map +1 -1
- package/dist/src/schemas/toolOverrides.mjs +7 -7
- package/dist/src/schemas/toolOverrides.mjs.map +1 -1
- package/dist/src/schemas/toolSurface.cjs +9 -9
- package/dist/src/schemas/toolSurface.cjs.map +1 -1
- package/dist/src/schemas/toolSurface.d.mts +13 -13
- package/dist/src/schemas/toolSurface.d.mts.map +1 -1
- package/dist/src/schemas/toolSurface.mjs +7 -7
- package/dist/src/schemas/toolSurface.mjs.map +1 -1
- package/dist/src/schemas/uiHub.cjs +9 -9
- package/dist/src/schemas/uiHub.cjs.map +1 -1
- package/dist/src/schemas/uiHub.d.mts +12 -12
- package/dist/src/schemas/uiHub.d.mts.map +1 -1
- package/dist/src/schemas/uiHub.mjs +7 -7
- package/dist/src/schemas/uiHub.mjs.map +1 -1
- package/dist/src/server/directHarnessRuntime.cjs +691 -775
- package/dist/src/server/directHarnessRuntime.cjs.map +1 -1
- package/dist/src/server/directHarnessRuntime.d.mts +5 -1
- package/dist/src/server/directHarnessRuntime.d.mts.map +1 -0
- package/dist/src/server/directHarnessRuntime.mjs +671 -754
- package/dist/src/server/directHarnessRuntime.mjs.map +1 -1
- package/dist/src/server/largeFrameLink.cjs +47 -0
- package/dist/src/server/largeFrameLink.cjs.map +1 -0
- package/dist/src/server/largeFrameLink.mjs +47 -0
- package/dist/src/server/largeFrameLink.mjs.map +1 -0
- package/dist/src/server/liveImport.cjs +1 -1
- package/dist/src/server/liveImport.cjs.map +1 -1
- package/dist/src/server/liveImport.d.mts +1 -1
- package/dist/src/server/liveImport.mjs +1 -1
- package/dist/src/server/liveImport.mjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.cjs.map +1 -1
- package/dist/src/server/mcpBundleLoader.d.mts +6 -6
- package/dist/src/server/mcpBundleLoader.d.mts.map +1 -1
- package/dist/src/server/mcpBundleLoader.mjs.map +1 -1
- package/dist/src/server/serverPackages.cjs +60 -0
- package/dist/src/server/serverPackages.cjs.map +1 -0
- package/dist/src/server/serverPackages.d.mts +44 -0
- package/dist/src/server/serverPackages.d.mts.map +1 -0
- package/dist/src/server/serverPackages.mjs +59 -0
- package/dist/src/server/serverPackages.mjs.map +1 -0
- package/dist/src/server/serverScope.cjs +510 -0
- package/dist/src/server/serverScope.cjs.map +1 -0
- package/dist/src/server/serverScope.d.mts +123 -0
- package/dist/src/server/serverScope.d.mts.map +1 -0
- package/dist/src/server/serverScope.mjs +510 -0
- package/dist/src/server/serverScope.mjs.map +1 -0
- package/dist/src/server/sessionMcpHandler.cjs +3 -3
- package/dist/src/server/sessionMcpHandler.cjs.map +1 -1
- package/dist/src/server/sessionMcpHandler.mjs +4 -4
- package/dist/src/server/sessionMcpHandler.mjs.map +1 -1
- package/dist/src/server/sessionMcpRoutes.cjs +2 -1
- package/dist/src/server/sessionMcpRoutes.cjs.map +1 -1
- package/dist/src/server/sessionMcpRoutes.mjs +2 -1
- package/dist/src/server/sessionMcpRoutes.mjs.map +1 -1
- package/dist/src/server/threadJournals.cjs +38 -107
- package/dist/src/server/threadJournals.cjs.map +1 -1
- package/dist/src/server/threadJournals.mjs +38 -104
- package/dist/src/server/threadJournals.mjs.map +1 -1
- package/dist/src/services/apiSurfaceAssert/index.cjs +1 -1
- package/dist/src/services/apiSurfaceAssert/index.cjs.map +1 -1
- package/dist/src/services/apiSurfaceAssert/index.d.mts +6 -6
- package/dist/src/services/apiSurfaceAssert/index.mjs +1 -1
- package/dist/src/services/apiSurfaceAssert/index.mjs.map +1 -1
- package/dist/src/services/chatgptAuth/index.cjs +1 -220
- package/dist/src/services/chatgptAuth/index.cjs.map +1 -1
- package/dist/src/services/chatgptAuth/index.d.mts +0 -18
- package/dist/src/services/chatgptAuth/index.d.mts.map +1 -1
- package/dist/src/services/chatgptAuth/index.mjs +1 -217
- package/dist/src/services/chatgptAuth/index.mjs.map +1 -1
- package/dist/src/services/chatgptImages/index.cjs +1 -1
- package/dist/src/services/chatgptImages/index.cjs.map +1 -1
- package/dist/src/services/chatgptImages/index.mjs +1 -1
- package/dist/src/services/chatgptImages/index.mjs.map +1 -1
- package/dist/src/services/chatgptLogin/index.cjs +230 -0
- package/dist/src/services/chatgptLogin/index.cjs.map +1 -0
- package/dist/src/services/chatgptLogin/index.d.mts +21 -0
- package/dist/src/services/chatgptLogin/index.d.mts.map +1 -0
- package/dist/src/services/chatgptLogin/index.mjs +227 -0
- package/dist/src/services/chatgptLogin/index.mjs.map +1 -0
- package/dist/src/services/chatgptWebSearch/index.cjs +1 -1
- package/dist/src/services/chatgptWebSearch/index.cjs.map +1 -1
- package/dist/src/services/chatgptWebSearch/index.mjs +1 -1
- package/dist/src/services/chatgptWebSearch/index.mjs.map +1 -1
- package/dist/src/services/contextContributions/index.cjs +8 -8
- package/dist/src/services/contextContributions/index.cjs.map +1 -1
- package/dist/src/services/contextContributions/index.d.mts +3 -3
- package/dist/src/services/contextContributions/index.d.mts.map +1 -1
- package/dist/src/services/contextContributions/index.mjs +8 -8
- package/dist/src/services/contextContributions/index.mjs.map +1 -1
- package/dist/src/services/devProxyStore/devProxyRecords.cjs +59 -0
- package/dist/src/services/devProxyStore/devProxyRecords.cjs.map +1 -0
- package/dist/src/services/devProxyStore/devProxyRecords.mjs +56 -0
- package/dist/src/services/devProxyStore/devProxyRecords.mjs.map +1 -0
- package/dist/src/services/devProxyStore/index.cjs +7 -101
- package/dist/src/services/devProxyStore/index.cjs.map +1 -1
- package/dist/src/services/devProxyStore/index.mjs +7 -101
- package/dist/src/services/devProxyStore/index.mjs.map +1 -1
- package/dist/src/services/devProxyStore/sync.cjs +66 -0
- package/dist/src/services/devProxyStore/sync.cjs.map +1 -0
- package/dist/src/services/devProxyStore/sync.mjs +63 -0
- package/dist/src/services/devProxyStore/sync.mjs.map +1 -0
- package/dist/src/services/durableNavigation/docs.cjs +15 -0
- package/dist/src/services/durableNavigation/docs.cjs.map +1 -0
- package/dist/src/services/durableNavigation/docs.mjs +16 -0
- package/dist/src/services/durableNavigation/docs.mjs.map +1 -0
- package/dist/src/services/durableNavigation/index.cjs +3 -18
- package/dist/src/services/durableNavigation/index.cjs.map +1 -1
- package/dist/src/services/durableNavigation/index.mjs +2 -17
- package/dist/src/services/durableNavigation/index.mjs.map +1 -1
- package/dist/src/services/durableQueue/docs.cjs +12 -0
- package/dist/src/services/durableQueue/docs.cjs.map +1 -0
- package/dist/src/services/durableQueue/docs.mjs +13 -0
- package/dist/src/services/durableQueue/docs.mjs.map +1 -0
- package/dist/src/services/durableQueue/index.cjs +151 -0
- package/dist/src/services/durableQueue/index.cjs.map +1 -0
- package/dist/src/services/durableQueue/index.mjs +149 -0
- package/dist/src/services/durableQueue/index.mjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/docs.cjs +11 -0
- package/dist/src/services/durableRequestReceipts/docs.cjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/docs.mjs +12 -0
- package/dist/src/services/durableRequestReceipts/docs.mjs.map +1 -0
- package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.cjs +10 -16
- package/dist/src/services/durableRequestReceipts/index.cjs.map +1 -0
- package/dist/src/services/durableRequestReceipts/index.d.mts +12 -0
- package/dist/src/services/durableRequestReceipts/index.d.mts.map +1 -0
- package/dist/src/services/{requestReceipts → durableRequestReceipts}/index.mjs +7 -13
- package/dist/src/services/durableRequestReceipts/index.mjs.map +1 -0
- package/dist/src/services/durableSession/docs.cjs +65 -0
- package/dist/src/services/durableSession/docs.cjs.map +1 -0
- package/dist/src/services/durableSession/docs.d.mts +17 -0
- package/dist/src/services/durableSession/docs.d.mts.map +1 -0
- package/dist/src/services/durableSession/docs.mjs +60 -0
- package/dist/src/services/durableSession/docs.mjs.map +1 -0
- package/dist/src/services/durableSession/index.cjs +21 -0
- package/dist/src/services/durableSession/index.cjs.map +1 -0
- package/dist/src/services/durableSession/index.d.mts +13 -0
- package/dist/src/services/durableSession/index.d.mts.map +1 -0
- package/dist/src/services/durableSession/index.mjs +20 -0
- package/dist/src/services/durableSession/index.mjs.map +1 -0
- package/dist/src/services/durableSubagents/docs.cjs +15 -0
- package/dist/src/services/durableSubagents/docs.cjs.map +1 -0
- package/dist/src/services/durableSubagents/docs.mjs +16 -0
- package/dist/src/services/durableSubagents/docs.mjs.map +1 -0
- package/dist/src/services/durableSubagents/extension.cjs +11 -0
- package/dist/src/services/durableSubagents/extension.cjs.map +1 -0
- package/dist/src/services/durableSubagents/extension.mjs +12 -0
- package/dist/src/services/durableSubagents/extension.mjs.map +1 -0
- package/dist/src/services/durableSubagents/index.cjs +95 -0
- package/dist/src/services/durableSubagents/index.cjs.map +1 -0
- package/dist/src/services/durableSubagents/index.mjs +90 -0
- package/dist/src/services/durableSubagents/index.mjs.map +1 -0
- package/dist/src/services/durableSubagents/tasks.cjs +25 -0
- package/dist/src/services/durableSubagents/tasks.cjs.map +1 -0
- package/dist/src/services/durableSubagents/tasks.mjs +26 -0
- package/dist/src/services/durableSubagents/tasks.mjs.map +1 -0
- package/dist/src/services/headlessClient/index.cjs +20 -13
- package/dist/src/services/headlessClient/index.cjs.map +1 -1
- package/dist/src/services/headlessClient/index.mjs +21 -14
- package/dist/src/services/headlessClient/index.mjs.map +1 -1
- package/dist/src/services/historyOwnership/type.d.mts +15 -0
- package/dist/src/services/historyOwnership/type.d.mts.map +1 -0
- package/dist/src/services/hubChannelHarness/index.cjs +2 -2
- package/dist/src/services/hubChannelHarness/index.cjs.map +1 -1
- package/dist/src/services/hubChannelHarness/index.d.mts +8 -8
- package/dist/src/services/hubChannelHarness/index.d.mts.map +1 -1
- package/dist/src/services/hubChannelHarness/index.mjs +2 -2
- package/dist/src/services/hubChannelHarness/index.mjs.map +1 -1
- package/dist/src/services/json/core.cjs +30 -0
- package/dist/src/services/json/core.cjs.map +1 -0
- package/dist/src/services/json/core.d.mts +21 -0
- package/dist/src/services/json/core.d.mts.map +1 -0
- package/dist/src/services/json/core.mjs +26 -0
- package/dist/src/services/json/core.mjs.map +1 -0
- package/dist/src/services/json/sync.cjs +48 -0
- package/dist/src/services/json/sync.cjs.map +1 -0
- package/dist/src/services/json/sync.d.mts +22 -0
- package/dist/src/services/json/sync.d.mts.map +1 -0
- package/dist/src/services/json/sync.mjs +43 -0
- package/dist/src/services/json/sync.mjs.map +1 -0
- package/dist/src/services/kernel/index.cjs +2 -2
- package/dist/src/services/kernel/index.cjs.map +1 -1
- package/dist/src/services/kernel/index.d.mts +3 -3
- package/dist/src/services/kernel/index.d.mts.map +1 -1
- package/dist/src/services/kernel/index.mjs +2 -2
- package/dist/src/services/kernel/index.mjs.map +1 -1
- package/dist/src/services/nativeChildTools/index.cjs +16 -0
- package/dist/src/services/nativeChildTools/index.cjs.map +1 -0
- package/dist/src/services/nativeChildTools/index.mjs +16 -0
- package/dist/src/services/nativeChildTools/index.mjs.map +1 -0
- package/dist/src/services/nodeHost/index.cjs +30 -0
- package/dist/src/services/nodeHost/index.cjs.map +1 -0
- package/dist/src/services/nodeHost/index.d.mts +16 -0
- package/dist/src/services/nodeHost/index.d.mts.map +1 -0
- package/dist/src/services/nodeHost/index.mjs +27 -0
- package/dist/src/services/nodeHost/index.mjs.map +1 -0
- package/dist/src/services/nodeModelDependencies/index.cjs +89 -0
- package/dist/src/services/nodeModelDependencies/index.cjs.map +1 -0
- package/dist/src/services/nodeModelDependencies/index.mjs +86 -0
- package/dist/src/services/nodeModelDependencies/index.mjs.map +1 -0
- package/dist/src/services/openSessionRegistry/index.cjs +6 -128
- package/dist/src/services/openSessionRegistry/index.cjs.map +1 -1
- package/dist/src/services/openSessionRegistry/index.d.mts +5 -36
- package/dist/src/services/openSessionRegistry/index.mjs +6 -128
- package/dist/src/services/openSessionRegistry/index.mjs.map +1 -1
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs +87 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.cjs.map +1 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts +30 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.d.mts.map +1 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs +81 -0
- package/dist/src/services/openSessionRegistry/openSessionRecords.mjs.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.cjs +71 -0
- package/dist/src/services/openSessionRegistry/sync.cjs.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.d.mts +14 -0
- package/dist/src/services/openSessionRegistry/sync.d.mts.map +1 -0
- package/dist/src/services/openSessionRegistry/sync.mjs +68 -0
- package/dist/src/services/openSessionRegistry/sync.mjs.map +1 -0
- package/dist/src/services/packageApiHarness/index.cjs +1 -1
- package/dist/src/services/packageApiHarness/index.cjs.map +1 -1
- package/dist/src/services/packageApiHarness/index.d.mts +6 -6
- package/dist/src/services/packageApiHarness/index.d.mts.map +1 -1
- package/dist/src/services/packageApiHarness/index.mjs +2 -2
- package/dist/src/services/packageApiHarness/index.mjs.map +1 -1
- package/dist/src/services/piArgs/index.cjs +53 -0
- package/dist/src/services/piArgs/index.cjs.map +1 -0
- package/dist/src/services/piArgs/index.d.mts +6 -0
- package/dist/src/services/piArgs/index.d.mts.map +1 -0
- package/dist/src/services/piArgs/index.mjs +53 -0
- package/dist/src/services/piArgs/index.mjs.map +1 -0
- package/dist/src/services/piExtensionHost/index.cjs +47 -39
- package/dist/src/services/piExtensionHost/index.cjs.map +1 -1
- package/dist/src/services/piExtensionHost/index.d.mts +83 -0
- package/dist/src/services/piExtensionHost/index.d.mts.map +1 -0
- package/dist/src/services/piExtensionHost/index.mjs +47 -38
- package/dist/src/services/piExtensionHost/index.mjs.map +1 -1
- package/dist/src/services/piHelpTools/index.cjs +5 -5
- package/dist/src/services/piHelpTools/index.cjs.map +1 -1
- package/dist/src/services/piHelpTools/index.d.mts.map +1 -1
- package/dist/src/services/piHelpTools/index.mjs +7 -7
- package/dist/src/services/piHelpTools/index.mjs.map +1 -1
- package/dist/src/services/piMessages/index.cjs +106 -0
- package/dist/src/services/piMessages/index.cjs.map +1 -0
- package/dist/src/services/piMessages/index.mjs +105 -0
- package/dist/src/services/piMessages/index.mjs.map +1 -0
- package/dist/src/services/piSessionEntries/index.cjs +4 -4
- package/dist/src/services/piSessionEntries/index.cjs.map +1 -1
- package/dist/src/services/piSessionEntries/index.mjs +3 -3
- package/dist/src/services/piSessionEntries/index.mjs.map +1 -1
- package/dist/src/services/piSettings/core.cjs +308 -0
- package/dist/src/services/piSettings/core.cjs.map +1 -0
- package/dist/src/services/piSettings/core.d.mts +102 -0
- package/dist/src/services/piSettings/core.d.mts.map +1 -0
- package/dist/src/services/piSettings/core.mjs +276 -0
- package/dist/src/services/piSettings/core.mjs.map +1 -0
- package/dist/src/services/piSettings/sync.cjs +119 -0
- package/dist/src/services/piSettings/sync.cjs.map +1 -0
- package/dist/src/services/piSettings/sync.d.mts +44 -0
- package/dist/src/services/piSettings/sync.d.mts.map +1 -0
- package/dist/src/services/piSettings/sync.mjs +110 -0
- package/dist/src/services/piSettings/sync.mjs.map +1 -0
- package/dist/src/services/piSummary/index.cjs +7 -0
- package/dist/src/services/piSummary/index.cjs.map +1 -0
- package/dist/src/services/piSummary/index.mjs +7 -0
- package/dist/src/services/piSummary/index.mjs.map +1 -0
- package/dist/src/services/platformFiles/index.cjs +44 -0
- package/dist/src/services/platformFiles/index.cjs.map +1 -0
- package/dist/src/services/platformFiles/index.d.mts +16 -0
- package/dist/src/services/platformFiles/index.d.mts.map +1 -0
- package/dist/src/services/platformFiles/index.mjs +39 -0
- package/dist/src/services/platformFiles/index.mjs.map +1 -0
- package/dist/src/services/pluginLifecycle/index.cjs +19 -13
- package/dist/src/services/pluginLifecycle/index.cjs.map +1 -1
- package/dist/src/services/pluginLifecycle/index.d.mts +2 -0
- package/dist/src/services/pluginLifecycle/index.d.mts.map +1 -1
- package/dist/src/services/pluginLifecycle/index.mjs +19 -14
- package/dist/src/services/pluginLifecycle/index.mjs.map +1 -1
- package/dist/src/services/poPackage/core.cjs +73 -0
- package/dist/src/services/poPackage/core.cjs.map +1 -0
- package/dist/src/services/poPackage/core.d.mts +32 -0
- package/dist/src/services/poPackage/core.d.mts.map +1 -0
- package/dist/src/services/poPackage/core.mjs +66 -0
- package/dist/src/services/poPackage/core.mjs.map +1 -0
- package/dist/src/services/poPackage/sync.cjs +55 -0
- package/dist/src/services/poPackage/sync.cjs.map +1 -0
- package/dist/src/services/poPackage/sync.d.mts +21 -0
- package/dist/src/services/poPackage/sync.d.mts.map +1 -0
- package/dist/src/services/poPackage/sync.mjs +50 -0
- package/dist/src/services/poPackage/sync.mjs.map +1 -0
- package/dist/src/services/providerAuth/index.cjs +11 -7
- package/dist/src/services/providerAuth/index.cjs.map +1 -1
- package/dist/src/services/providerAuth/index.mjs +11 -7
- package/dist/src/services/providerAuth/index.mjs.map +1 -1
- package/dist/src/services/publicFileShares/index.cjs +1 -1
- package/dist/src/services/publicFileShares/index.cjs.map +1 -1
- package/dist/src/services/publicFileShares/index.d.mts +2 -2
- package/dist/src/services/publicFileShares/index.mjs +2 -2
- package/dist/src/services/publicFileShares/index.mjs.map +1 -1
- package/dist/src/services/remoteAccess/index.d.mts +1 -0
- package/dist/src/services/remoteAccess/index.d.mts.map +1 -1
- package/dist/src/services/remoteAccessStore/index.cjs +8 -190
- package/dist/src/services/remoteAccessStore/index.cjs.map +1 -1
- package/dist/src/services/remoteAccessStore/index.d.mts +2 -0
- package/dist/src/services/remoteAccessStore/index.mjs +7 -187
- package/dist/src/services/remoteAccessStore/index.mjs.map +1 -1
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs +98 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.cjs.map +1 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs +88 -0
- package/dist/src/services/remoteAccessStore/remoteAccessRecords.mjs.map +1 -0
- package/dist/src/services/remoteAccessStore/sync.cjs +111 -0
- package/dist/src/services/remoteAccessStore/sync.cjs.map +1 -0
- package/dist/src/services/remoteAccessStore/sync.mjs +108 -0
- package/dist/src/services/remoteAccessStore/sync.mjs.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.cjs +23 -0
- package/dist/src/services/runtimeIdentity/sync.cjs.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.d.mts +9 -0
- package/dist/src/services/runtimeIdentity/sync.d.mts.map +1 -0
- package/dist/src/services/runtimeIdentity/sync.mjs +20 -0
- package/dist/src/services/runtimeIdentity/sync.mjs.map +1 -0
- package/dist/src/services/serialRunner/index.cjs +25 -0
- package/dist/src/services/serialRunner/index.cjs.map +1 -0
- package/dist/src/services/serialRunner/index.d.mts +10 -0
- package/dist/src/services/serialRunner/index.d.mts.map +1 -0
- package/dist/src/services/serialRunner/index.mjs +25 -0
- package/dist/src/services/serialRunner/index.mjs.map +1 -0
- package/dist/src/services/{serverFacet → serverHost}/index.cjs +5 -5
- package/dist/src/services/serverHost/index.cjs.map +1 -0
- package/dist/src/services/serverHost/index.d.mts +31 -0
- package/dist/src/services/serverHost/index.d.mts.map +1 -0
- package/dist/src/services/{serverFacet → serverHost}/index.mjs +5 -5
- package/dist/src/services/serverHost/index.mjs.map +1 -0
- package/dist/src/services/sessionAttachments/index.cjs +4 -3
- package/dist/src/services/sessionAttachments/index.cjs.map +1 -1
- package/dist/src/services/sessionAttachments/index.d.mts +1 -6
- package/dist/src/services/sessionAttachments/index.d.mts.map +1 -1
- package/dist/src/services/sessionAttachments/index.mjs +3 -2
- package/dist/src/services/sessionAttachments/index.mjs.map +1 -1
- package/dist/src/services/sessionAttachments/type.d.mts +9 -0
- package/dist/src/services/sessionAttachments/type.d.mts.map +1 -0
- package/dist/src/services/sessionFiles/index.cjs +96 -0
- package/dist/src/services/sessionFiles/index.cjs.map +1 -0
- package/dist/src/services/sessionFiles/index.d.mts +33 -0
- package/dist/src/services/sessionFiles/index.d.mts.map +1 -0
- package/dist/src/services/sessionFiles/index.mjs +89 -0
- package/dist/src/services/sessionFiles/index.mjs.map +1 -0
- package/dist/src/services/sessionFiles/sessionDirectory.cjs +66 -0
- package/dist/src/services/sessionFiles/sessionDirectory.cjs.map +1 -0
- package/dist/src/services/sessionFiles/sessionDirectory.mjs +62 -0
- package/dist/src/services/sessionFiles/sessionDirectory.mjs.map +1 -0
- package/dist/src/services/sessionGitStatus/index.cjs +31 -33
- package/dist/src/services/sessionGitStatus/index.cjs.map +1 -1
- package/dist/src/services/sessionGitStatus/index.mjs +31 -33
- package/dist/src/services/sessionGitStatus/index.mjs.map +1 -1
- package/dist/src/services/sessionPresentation/index.cjs +3 -27
- package/dist/src/services/sessionPresentation/index.cjs.map +1 -1
- package/dist/src/services/sessionPresentation/index.mjs +3 -27
- package/dist/src/services/sessionPresentation/index.mjs.map +1 -1
- package/dist/src/services/skillPrompt/index.cjs +11 -0
- package/dist/src/services/skillPrompt/index.cjs.map +1 -0
- package/dist/src/services/skillPrompt/index.mjs +11 -0
- package/dist/src/services/skillPrompt/index.mjs.map +1 -0
- package/dist/src/services/sqliteSessionHistory/index.cjs +44 -30
- package/dist/src/services/sqliteSessionHistory/index.cjs.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.d.mts +7 -4
- package/dist/src/services/sqliteSessionHistory/index.d.mts.map +1 -1
- package/dist/src/services/sqliteSessionHistory/index.mjs +43 -28
- package/dist/src/services/sqliteSessionHistory/index.mjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.cjs +21 -45
- package/dist/src/services/sqliteTranscriptReader/index.cjs.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.d.mts +3 -2
- package/dist/src/services/sqliteTranscriptReader/index.d.mts.map +1 -1
- package/dist/src/services/sqliteTranscriptReader/index.mjs +16 -38
- package/dist/src/services/sqliteTranscriptReader/index.mjs.map +1 -1
- package/dist/src/services/testMode/index.cjs +162 -0
- package/dist/src/services/testMode/index.cjs.map +1 -0
- package/dist/src/services/testMode/index.d.mts +17 -0
- package/dist/src/services/testMode/index.d.mts.map +1 -0
- package/dist/src/services/testMode/index.mjs +155 -0
- package/dist/src/services/testMode/index.mjs.map +1 -0
- package/dist/src/services/toolOverrides/index.cjs +6 -6
- package/dist/src/services/toolOverrides/index.cjs.map +1 -1
- package/dist/src/services/toolOverrides/index.d.mts +3 -3
- package/dist/src/services/toolOverrides/index.d.mts.map +1 -1
- package/dist/src/services/toolOverrides/index.mjs +6 -6
- package/dist/src/services/toolOverrides/index.mjs.map +1 -1
- package/dist/src/services/toolPrompt/index.d.mts +17 -0
- package/dist/src/services/toolPrompt/index.d.mts.map +1 -0
- package/dist/src/services/toolSurface/index.cjs +3 -3
- package/dist/src/services/toolSurface/index.cjs.map +1 -1
- package/dist/src/services/toolSurface/index.d.mts +3 -3
- package/dist/src/services/toolSurface/index.d.mts.map +1 -1
- package/dist/src/services/toolSurface/index.mjs +4 -4
- package/dist/src/services/toolSurface/index.mjs.map +1 -1
- 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 +159 -33
- package/dist/src/services/transcriptPages/index.cjs.map +1 -1
- package/dist/src/services/transcriptPages/index.mjs +158 -34
- package/dist/src/services/transcriptPages/index.mjs.map +1 -1
- package/dist/src/services/voiceToolsContract/index.cjs +7 -7
- package/dist/src/services/voiceToolsContract/index.cjs.map +1 -1
- package/dist/src/services/voiceToolsContract/index.d.mts +4 -4
- package/dist/src/services/voiceToolsContract/index.d.mts.map +1 -1
- package/dist/src/services/voiceToolsContract/index.mjs +7 -7
- package/dist/src/services/voiceToolsContract/index.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/index.cjs +9 -179
- package/dist/src/services/workspaceRegistry/index.cjs.map +1 -1
- package/dist/src/services/workspaceRegistry/index.d.mts +5 -47
- package/dist/src/services/workspaceRegistry/index.mjs +7 -176
- package/dist/src/services/workspaceRegistry/index.mjs.map +1 -1
- package/dist/src/services/workspaceRegistry/sync.cjs +148 -0
- package/dist/src/services/workspaceRegistry/sync.cjs.map +1 -0
- package/dist/src/services/workspaceRegistry/sync.d.mts +34 -0
- package/dist/src/services/workspaceRegistry/sync.d.mts.map +1 -0
- package/dist/src/services/workspaceRegistry/sync.mjs +140 -0
- package/dist/src/services/workspaceRegistry/sync.mjs.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs +114 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.cjs.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts +31 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.d.mts.map +1 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs +101 -0
- package/dist/src/services/workspaceRegistry/workspaceRecords.mjs.map +1 -0
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs +339 -202
- package/dist/src/systems/child/adapters/headlessChildSessionService.cjs.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts +16 -21
- package/dist/src/systems/child/adapters/headlessChildSessionService.d.mts.map +1 -1
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs +329 -191
- package/dist/src/systems/child/adapters/headlessChildSessionService.mjs.map +1 -1
- package/dist/src/systems/child/services/childSession/index.cjs +94 -20
- package/dist/src/systems/child/services/childSession/index.cjs.map +1 -1
- package/dist/src/systems/child/services/childSession/index.d.mts +12 -3
- package/dist/src/systems/child/services/childSession/index.d.mts.map +1 -1
- package/dist/src/systems/child/services/childSession/index.mjs +94 -20
- package/dist/src/systems/child/services/childSession/index.mjs.map +1 -1
- package/dist/src/systems/child/types/childSession.cjs +33 -13
- package/dist/src/systems/child/types/childSession.cjs.map +1 -1
- package/dist/src/systems/child/types/childSession.d.mts +143 -80
- package/dist/src/systems/child/types/childSession.d.mts.map +1 -1
- package/dist/src/systems/child/types/childSession.mjs +24 -9
- package/dist/src/systems/child/types/childSession.mjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.cjs +30 -27
- package/dist/src/systems/main/adapters/headlessHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.d.mts +22 -22
- package/dist/src/systems/main/adapters/headlessHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessHost.mjs +33 -30
- package/dist/src/systems/main/adapters/headlessHost.mjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs +248 -229
- package/dist/src/systems/main/adapters/headlessSessionHost.cjs.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts +4 -5
- package/dist/src/systems/main/adapters/headlessSessionHost.d.mts.map +1 -1
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs +239 -219
- package/dist/src/systems/main/adapters/headlessSessionHost.mjs.map +1 -1
- package/dist/src/systems/main/types/headlessHost.d.mts +16 -14
- package/dist/src/systems/main/types/headlessHost.d.mts.map +1 -1
- package/dist/src/testing/pi/testHost.cjs +2 -2
- package/dist/src/testing/pi/testHost.cjs.map +1 -1
- package/dist/src/testing/pi/testHost.d.mts +3 -2
- package/dist/src/testing/pi/testHost.mjs +3 -3
- package/dist/src/testing/pi/testHost.mjs.map +1 -1
- package/dist/src/types/config.d.mts +1 -1
- package/dist/src/types/config.d.mts.map +1 -1
- package/dist/src/types/kernel.d.mts +3 -3
- package/dist/src/types/server/directHarnessRuntime.d.mts +54 -25
- package/dist/src/types/server/directHarnessRuntime.d.mts.map +1 -1
- package/dist/src/types/server/sessionToolSurface.d.mts +9 -9
- package/dist/src/web/services/apiClient/index.d.mts +1 -0
- 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.map +1 -1
- package/dist/src/web/services/mcpWidget.cjs.map +1 -1
- package/dist/src/web/services/mcpWidget.d.mts +2 -2
- package/dist/src/web/services/mcpWidget.d.mts.map +1 -1
- package/dist/src/web/services/mcpWidget.mjs.map +1 -1
- package/dist/src/web/services/testing/templateRail.cjs +3 -0
- package/dist/src/web/services/testing/templateRail.cjs.map +1 -1
- package/dist/src/web/services/testing/templateRail.mjs +3 -0
- package/dist/src/web/services/testing/templateRail.mjs.map +1 -1
- package/dist/src/web/types/mcpWidget.d.mts +1 -1
- package/dist/src/web/types/nativeTemplate.d.mts +1 -1
- package/dist/src/web/types/nativeTemplate.d.mts.map +1 -1
- package/dist/src/web/types/template.d.mts +8 -0
- package/dist/src/web/types/template.d.mts.map +1 -1
- package/dist/src/web/types/webPlugin.d.mts +17 -5
- package/dist/src/web/types/webPlugin.d.mts.map +1 -1
- package/dist/testMode.cjs +4 -0
- package/dist/testMode.d.mts +2 -0
- package/dist/testMode.mjs +1 -0
- package/dist/testing.cjs +1 -1
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +2 -2
- package/dist/toolInventory.cjs.map +1 -1
- package/dist/toolInventory.mjs.map +1 -1
- package/dist/toolNames.mjs +1 -2
- package/dist/toolOverrides.cjs +4 -4
- package/dist/toolOverrides.d.mts +3 -3
- package/dist/toolOverrides.mjs +3 -3
- package/dist/toolSurface.cjs +4 -4
- package/dist/toolSurface.d.mts +3 -3
- package/dist/toolSurface.mjs +3 -3
- package/dist/transition.cjs +3 -3
- package/dist/transition.d.cjs +3 -3
- package/dist/transition.d.mts +2 -2
- package/dist/transition.mjs +1 -2
- package/dist/transitionClassifier.cjs.map +1 -1
- package/dist/transitionClassifier.d.mts +2 -2
- package/dist/transitionClassifier.d.mts.map +1 -1
- package/dist/transitionClassifier.mjs.map +1 -1
- package/dist/transitionCoordinator.cjs +3 -3
- package/dist/transitionCoordinator.cjs.map +1 -1
- package/dist/transitionCoordinator.d.mts +4 -4
- package/dist/transitionCoordinator.d.mts.map +1 -1
- package/dist/transitionCoordinator.mjs +3 -3
- package/dist/transitionCoordinator.mjs.map +1 -1
- package/dist/typesContextApi.d.mts +2 -1
- package/dist/typesContextApi.d.mts.map +1 -1
- package/dist/uiHub.cjs +3 -3
- package/dist/uiHub.d.mts +2 -2
- package/dist/uiHub.mjs +1 -2
- package/dist/voiceTools.cjs +5 -5
- package/dist/voiceTools.d.mts +3 -3
- package/dist/voiceTools.mjs +3 -3
- package/dist/web.cjs +8 -0
- package/dist/web.d.mts +3 -2
- package/dist/web.mjs +2 -1
- package/dist/webCompositions.cjs.map +1 -1
- package/dist/webCompositions.d.mts +7 -7
- package/dist/webCompositions.d.mts.map +1 -1
- package/dist/webCompositions.mjs.map +1 -1
- package/licenses/Codex-Apache-2.0.txt +201 -0
- package/package.json +58 -53
- package/dist/doomPackage.cjs +0 -61
- package/dist/doomPackage.cjs.map +0 -1
- package/dist/doomPackage.d.mts +0 -17
- package/dist/doomPackage.d.mts.map +0 -1
- package/dist/doomPackage.mjs +0 -54
- package/dist/doomPackage.mjs.map +0 -1
- package/dist/jsonlSessionRepo.cjs +0 -44
- package/dist/jsonlSessionRepo.cjs.map +0 -1
- package/dist/jsonlSessionRepo.d.mts +0 -7
- package/dist/jsonlSessionRepo.d.mts.map +0 -1
- package/dist/jsonlSessionRepo.mjs +0 -42
- package/dist/jsonlSessionRepo.mjs.map +0 -1
- package/dist/runtimeJson.cjs.map +0 -1
- package/dist/runtimeJson.d.mts.map +0 -1
- package/dist/runtimeJson.mjs.map +0 -1
- package/dist/runtimePiSettings.cjs.map +0 -1
- package/dist/runtimePiSettings.d.mts.map +0 -1
- package/dist/runtimePiSettings.mjs.map +0 -1
- package/dist/serverFacet.cjs +0 -34
- package/dist/serverFacet.d.mts +0 -10
- package/dist/serverFacet.mjs +0 -9
- package/dist/src/pi/piWebSocketListener.cjs +0 -115
- package/dist/src/pi/piWebSocketListener.cjs.map +0 -1
- package/dist/src/pi/piWebSocketListener.mjs +0 -115
- package/dist/src/pi/piWebSocketListener.mjs.map +0 -1
- package/dist/src/schemas/serverFacet.cjs +0 -111
- package/dist/src/schemas/serverFacet.cjs.map +0 -1
- package/dist/src/schemas/serverFacet.d.mts +0 -152
- package/dist/src/schemas/serverFacet.d.mts.map +0 -1
- package/dist/src/schemas/serverFacet.mjs +0 -101
- package/dist/src/schemas/serverFacet.mjs.map +0 -1
- package/dist/src/schemas/sessionUpdates.d.mts +0 -34
- package/dist/src/schemas/sessionUpdates.d.mts.map +0 -1
- package/dist/src/server/headlessProtocol.cjs +0 -382
- package/dist/src/server/headlessProtocol.cjs.map +0 -1
- package/dist/src/server/headlessProtocol.mjs +0 -382
- package/dist/src/server/headlessProtocol.mjs.map +0 -1
- package/dist/src/server/nativeChildTranscriptReader.cjs +0 -20
- package/dist/src/server/nativeChildTranscriptReader.cjs.map +0 -1
- package/dist/src/server/nativeChildTranscriptReader.mjs +0 -18
- package/dist/src/server/nativeChildTranscriptReader.mjs.map +0 -1
- package/dist/src/server/serverFacetLoader.cjs +0 -214
- package/dist/src/server/serverFacetLoader.cjs.map +0 -1
- package/dist/src/server/serverFacetLoader.d.mts +0 -72
- package/dist/src/server/serverFacetLoader.d.mts.map +0 -1
- package/dist/src/server/serverFacetLoader.mjs +0 -212
- package/dist/src/server/serverFacetLoader.mjs.map +0 -1
- package/dist/src/services/acpSessionUpdates/index.cjs +0 -129
- package/dist/src/services/acpSessionUpdates/index.cjs.map +0 -1
- package/dist/src/services/acpSessionUpdates/index.mjs +0 -129
- package/dist/src/services/acpSessionUpdates/index.mjs.map +0 -1
- package/dist/src/services/historyImport/index.cjs +0 -8
- package/dist/src/services/historyImport/index.cjs.map +0 -1
- package/dist/src/services/historyImport/index.d.mts +0 -68
- package/dist/src/services/historyImport/index.d.mts.map +0 -1
- package/dist/src/services/historyImport/index.mjs +0 -8
- package/dist/src/services/historyImport/index.mjs.map +0 -1
- package/dist/src/services/openSessionRegistry/index.d.mts.map +0 -1
- package/dist/src/services/requestReceipts/index.cjs.map +0 -1
- package/dist/src/services/requestReceipts/index.d.mts +0 -11
- package/dist/src/services/requestReceipts/index.d.mts.map +0 -1
- package/dist/src/services/requestReceipts/index.mjs.map +0 -1
- package/dist/src/services/rpcTranscript/index.cjs +0 -633
- package/dist/src/services/rpcTranscript/index.cjs.map +0 -1
- package/dist/src/services/rpcTranscript/index.d.mts +0 -50
- package/dist/src/services/rpcTranscript/index.d.mts.map +0 -1
- package/dist/src/services/rpcTranscript/index.mjs +0 -632
- package/dist/src/services/rpcTranscript/index.mjs.map +0 -1
- package/dist/src/services/serverFacet/index.cjs.map +0 -1
- package/dist/src/services/serverFacet/index.d.mts +0 -31
- package/dist/src/services/serverFacet/index.d.mts.map +0 -1
- package/dist/src/services/serverFacet/index.mjs.map +0 -1
- package/dist/src/services/workspaceRegistry/index.d.mts.map +0 -1
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs +0 -28
- package/dist/src/systems/child/adapters/nativeChildRuntimes.cjs.map +0 -1
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs +0 -25
- package/dist/src/systems/child/adapters/nativeChildRuntimes.mjs.map +0 -1
- package/dist/terminalPiChildSessionService.cjs +0 -324
- package/dist/terminalPiChildSessionService.cjs.map +0 -1
- package/dist/terminalPiChildSessionService.d.mts +0 -46
- package/dist/terminalPiChildSessionService.d.mts.map +0 -1
- package/dist/terminalPiChildSessionService.mjs +0 -318
- package/dist/terminalPiChildSessionService.mjs.map +0 -1
- package/dist/v3Export.cjs +0 -10
- package/dist/v3Export.cjs.map +0 -1
- package/dist/v3Export.d.mts +0 -35
- package/dist/v3Export.d.mts.map +0 -1
- package/dist/v3Export.mjs +0 -9
- package/dist/v3Export.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//#region src/services/
|
|
2
|
-
function
|
|
1
|
+
//#region src/services/serverHost/index.ts
|
|
2
|
+
function createPoServerHost(options) {
|
|
3
3
|
const { scope, context } = options;
|
|
4
4
|
const notice = (message) => context.onNotice(message);
|
|
5
5
|
const mounts = [];
|
|
@@ -18,7 +18,7 @@ function createDoomServerHost(options) {
|
|
|
18
18
|
return noop;
|
|
19
19
|
}
|
|
20
20
|
if (mounts.find((mount) => mount.basePath === api.basePath) !== void 0) {
|
|
21
|
-
notice(`package API '${api.basePath}' is skipped: another
|
|
21
|
+
notice(`package API '${api.basePath}' is skipped: another package already claims it.`);
|
|
22
22
|
return noop;
|
|
23
23
|
}
|
|
24
24
|
let handler;
|
|
@@ -94,7 +94,7 @@ function createDoomServerHost(options) {
|
|
|
94
94
|
return noop;
|
|
95
95
|
}
|
|
96
96
|
if (channels.some((mount) => mount.channel.frameType === channel.frameType)) {
|
|
97
|
-
notice(`hub channel '${channel.frameType}' is skipped: another
|
|
97
|
+
notice(`hub channel '${channel.frameType}' is skipped: another package already claims it.`);
|
|
98
98
|
return noop;
|
|
99
99
|
}
|
|
100
100
|
let source;
|
|
@@ -192,6 +192,6 @@ function createDoomServerHost(options) {
|
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
//#endregion
|
|
195
|
-
export {
|
|
195
|
+
export { createPoServerHost };
|
|
196
196
|
|
|
197
197
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/serverHost/index.ts"],"sourcesContent":["/**\n * The server host a package registers through at one scope level.\n *\n * DESIGN PATTERNS:\n * - One mount table per level. Every package registers through this service, so\n * the level has a single ordered record of what is mounted and under what.\n * - Base paths are first-come. A collision is reported and skipped, so one\n * misdeclared package cannot take a server down.\n * - Handlers are started lazily on first mount and closed on dispose, so a\n * package that registers and immediately unwinds leaves nothing running.\n *\n * AVOID:\n * - Letting a throwing `start` escape. A package whose API cannot start is\n * reported and skipped; the remaining packages still mount.\n * - Reaching for node:*. The host owns the listener; this only owns the table.\n */\n\nimport type { PoHubChannel, PoHubChannelHost, PoHubChannelSource } from '../../schemas/hubChannel';\nimport type { PoApi, PoApiContext, PoApiHandler, PoApiScope } from '../../schemas/packageApi';\nimport type { PoPluginRegistry } from '../../schemas/pluginProtocol';\nimport type { PoServerHostService, PoServerRegistration } from '../../schemas/serverPlugin';\n\ninterface MountedApi {\n readonly basePath: string;\n readonly handler: PoApiHandler;\n}\n\ninterface MountedChannel {\n readonly channel: PoHubChannel;\n readonly source?: PoHubChannelSource;\n readonly registration?: PoServerRegistration;\n}\n\nexport interface CreatePoServerHostOptions {\n scope: PoApiScope;\n context: PoApiContext;\n /** Required when packages may register live channels. */\n channelHost?: PoHubChannelHost;\n /** Supplies a channel-specific host when one host serves multiple channels. */\n channelHostFor?: (channel: PoHubChannel) => PoHubChannelHost;\n /** Delegates channel mounting to an owner of the canonical channel table. */\n mountChannel?: (channel: PoHubChannel) => PoServerRegistration;\n /** Shared exact-scope dispatch table, owned by the server composition. */\n pluginRegistry?: PoPluginRegistry;\n /** Called when an API mount table entry appears or disappears. */\n onChange?: (mounted: readonly string[]) => void;\n /** Called when a channel mount table entry appears or disappears. */\n onChannelsChange?: (mounted: readonly string[]) => void;\n}\n\n/** The mount table a server host exposes to its packages, plus the router's read side. */\nexport interface PoServerHost extends PoServerHostService {\n /** The handler owning a base path, for the router that dispatches to it. */\n handlerFor(basePath: string): PoApiHandler | undefined;\n /** Close every mounted handler and empty the table. */\n dispose(): void;\n}\n\nexport function createPoServerHost(options: CreatePoServerHostOptions): PoServerHost {\n const { scope, context } = options;\n const notice = (message: string): void => context.onNotice(message);\n const mounts: MountedApi[] = [];\n const channels: MountedChannel[] = [];\n const methods = new Set<() => void>();\n let disposed = false;\n\n const changed = (): void => options.onChange?.(mounts.map((mount) => mount.basePath));\n const channelsChanged = (): void => options.onChannelsChange?.(channels.map((mount) => mount.channel.frameType));\n\n const noop: PoServerRegistration = { mounted: false, dispose: () => undefined };\n\n const registerApi = (api: PoApi): PoServerRegistration => {\n if (disposed) {\n notice(`package API '${api.basePath}' is skipped: the server host is already disposed.`);\n return noop;\n }\n const holder = mounts.find((mount) => mount.basePath === api.basePath);\n if (holder !== undefined) {\n notice(`package API '${api.basePath}' is skipped: another package already claims it.`);\n return noop;\n }\n let handler: PoApiHandler;\n try {\n handler = api.start(context);\n } catch (error) {\n notice(`package API '${api.basePath}' did not start (${String(error)}); it is skipped.`);\n return noop;\n }\n const mount: MountedApi = { basePath: api.basePath, handler };\n mounts.push(mount);\n changed();\n let released = false;\n return {\n mounted: true,\n dispose: () => {\n if (released) return;\n released = true;\n const index = mounts.indexOf(mount);\n if (index >= 0) mounts.splice(index, 1);\n try {\n handler.close();\n } catch (error) {\n notice(`package API '${mount.basePath}' did not close cleanly (${String(error)}).`);\n }\n changed();\n },\n };\n };\n\n const registerChannel = (channel: PoHubChannel): PoServerRegistration => {\n if (disposed) {\n notice(`hub channel '${channel.frameType}' is skipped: the server host is already disposed.`);\n return noop;\n }\n if (options.mountChannel !== undefined) {\n let registration: PoServerRegistration;\n try {\n registration = options.mountChannel(channel);\n } catch (error) {\n notice(`hub channel '${channel.frameType}' did not mount (${String(error)}); it is skipped.`);\n return noop;\n }\n if (registration.mounted !== true) return registration;\n const mount: MountedChannel = { channel, registration };\n channels.push(mount);\n channelsChanged();\n let released = false;\n return {\n mounted: true,\n dispose: () => {\n if (released) return;\n released = true;\n const index = channels.indexOf(mount);\n if (index >= 0) channels.splice(index, 1);\n try {\n registration.dispose();\n } catch (error) {\n notice(`hub channel '${channel.frameType}' did not close cleanly (${String(error)}).`);\n }\n channelsChanged();\n },\n };\n }\n const channelHost = options.channelHostFor?.(channel) ?? options.channelHost;\n if (!channelHost) {\n notice(`hub channel '${channel.frameType}' is skipped: this server host has no channel capability.`);\n return noop;\n }\n if (channels.some((mount) => mount.channel.frameType === channel.frameType)) {\n notice(`hub channel '${channel.frameType}' is skipped: another package already claims it.`);\n return noop;\n }\n let source: PoHubChannelSource;\n try {\n source = channel.start(channelHost);\n } catch (error) {\n notice(`hub channel '${channel.frameType}' did not start (${String(error)}); it is skipped.`);\n return noop;\n }\n const mount: MountedChannel = { channel, source };\n channels.push(mount);\n channelsChanged();\n let released = false;\n return {\n mounted: true,\n dispose: () => {\n if (released) return;\n released = true;\n const index = channels.indexOf(mount);\n if (index >= 0) channels.splice(index, 1);\n try {\n source.close();\n } catch (error) {\n notice(`hub channel '${channel.frameType}' did not close cleanly (${String(error)}).`);\n }\n channelsChanged();\n },\n };\n };\n\n const registerMethod: PoServerHostService['registerMethod'] = (definition, handler) => {\n if (disposed || !options.pluginRegistry) {\n notice(\n `plugin method '${definition.service}.${definition.method}' is skipped: this host has no plugin dispatcher.`,\n );\n return noop;\n }\n const mount =\n scope === 'global'\n ? { scope: 'global' as const }\n : scope === 'workspace' && context.workspaceId\n ? { scope: 'workspace' as const, workspaceId: context.workspaceId }\n : scope === 'session' && context.sessionId\n ? { scope: 'session' as const, sessionId: context.sessionId }\n : undefined;\n if (!mount) {\n notice(`plugin method '${definition.service}.${definition.method}' is skipped: this host has no mount identity.`);\n return noop;\n }\n try {\n const release = options.pluginRegistry.register(mount, definition, handler);\n let released = false;\n const dispose = () => {\n if (released) return;\n released = true;\n methods.delete(dispose);\n release();\n };\n methods.add(dispose);\n return { mounted: true, dispose };\n } catch (error) {\n notice(`plugin method '${definition.service}.${definition.method}' did not mount (${String(error)}).`);\n return noop;\n }\n };\n\n return {\n scope,\n context,\n registerApi,\n registerChannel,\n registerMethod,\n mounted: () => mounts.map((mount) => mount.basePath),\n mountedChannels: () => channels.map((mount) => mount.channel.frameType),\n handlerFor: (basePath) => mounts.find((mount) => mount.basePath === basePath)?.handler,\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const release of [...methods].reverse()) release();\n for (const mount of channels.splice(0).reverse()) {\n try {\n if (mount.registration !== undefined) mount.registration.dispose();\n else mount.source?.close();\n } catch (error) {\n notice(`hub channel '${mount.channel.frameType}' did not close cleanly (${String(error)}).`);\n }\n }\n for (const mount of mounts.splice(0).reverse()) {\n try {\n mount.handler.close();\n } catch (error) {\n notice(`package API '${mount.basePath}' did not close cleanly (${String(error)}).`);\n }\n }\n channelsChanged();\n changed();\n },\n };\n}\n"],"mappings":";AA0DA,SAAgB,mBAAmB,SAAkD;CACnF,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,UAAU,YAA0B,QAAQ,SAAS,OAAO;CAClE,MAAM,SAAuB,CAAC;CAC9B,MAAM,WAA6B,CAAC;CACpC,MAAM,0BAAU,IAAI,IAAgB;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CAAC,CAAC,QAAQ,GAC7C,IAAI;IACF,IAAI,MAAM,iBAAiB,KAAA,GAAW,MAAM,aAAa,QAAQ;SAC5D,MAAM,QAAQ,MAAM;GAC3B,SAAS,OAAO;IACd,OAAO,gBAAgB,MAAM,QAAQ,UAAU,2BAA2B,OAAO,KAAK,EAAE,GAAG;GAC7F;GAEF,KAAK,MAAM,SAAS,OAAO,OAAO,CAAC,CAAC,CAAC,QAAQ,GAC3C,IAAI;IACF,MAAM,QAAQ,MAAM;GACtB,SAAS,OAAO;IACd,OAAO,gBAAgB,MAAM,SAAS,2BAA2B,OAAO,KAAK,EAAE,GAAG;GACpF;GAEF,gBAAgB;GAChB,QAAQ;EACV;CACF;AACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const
|
|
2
|
+
const require_core = require("../piSettings/core.cjs");
|
|
3
|
+
require("../../../runtimePiSettings.cjs");
|
|
3
4
|
const require_contextDetailStore = require("../../../contextDetailStore.cjs");
|
|
4
5
|
const require_sessionFiles = require("../../constants/sessionFiles.cjs");
|
|
5
6
|
let node_crypto = require("node:crypto");
|
|
@@ -15,7 +16,7 @@ node_path = require_runtime.__toESM(node_path, 1);
|
|
|
15
16
|
* two files with the same name apart and lets the original name survive. The
|
|
16
17
|
* directory is owner-only because an attachment is whatever the user dropped in.
|
|
17
18
|
*/
|
|
18
|
-
const DIRECTORY_NAME = "
|
|
19
|
+
const DIRECTORY_NAME = "po-attachments";
|
|
19
20
|
const PRIVATE_DIRECTORY_MODE = 448;
|
|
20
21
|
const PRIVATE_FILE_MODE = 384;
|
|
21
22
|
const MAX_NAME_BYTES = 200;
|
|
@@ -25,7 +26,7 @@ const RETENTION_MS = 6048e5;
|
|
|
25
26
|
function sessionAttachmentRoot(sessionId, environment = process.env) {
|
|
26
27
|
const directory = require_contextDetailStore.safeName(sessionId);
|
|
27
28
|
if (directory === "" || directory === "." || directory === "..") throw new Error("This session id cannot hold attachments.");
|
|
28
|
-
return node_path.default.join(
|
|
29
|
+
return node_path.default.join(require_core.piAgentDirectory(environment), DIRECTORY_NAME, directory);
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* One plain file name: no separators or control characters, and no leading dot, so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["safeName","path","piAgentDirectory","fs","randomUUID","SESSION_FILE_CONTENT_TYPES"],"sources":["../../../../src/services/sessionAttachments/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { SESSION_FILE_CONTENT_TYPES, SESSION_FILE_DEFAULT_CONTENT_TYPE } from '../../constants/sessionFiles';\nimport { safeName } from '../contextDetailStore';\nimport { piAgentDirectory } from '../piSettings';\n\n/**\n * Where composer attachments live on the host, so a tool can be handed one by path.\n *\n * Each upload gets its own random directory under the session's root, which keeps\n * two files with the same name apart and lets the original name survive. The\n * directory is owner-only because an attachment is whatever the user dropped in.\n */\n\nconst DIRECTORY_NAME = '
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["safeName","path","piAgentDirectory","fs","randomUUID","SESSION_FILE_CONTENT_TYPES"],"sources":["../../../../src/services/sessionAttachments/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { SESSION_FILE_CONTENT_TYPES, SESSION_FILE_DEFAULT_CONTENT_TYPE } from '../../constants/sessionFiles';\nimport { safeName } from '../contextDetailStore';\nimport { piAgentDirectory } from '../piSettings';\nimport type { SessionAttachment } from './type';\n\n/**\n * Where composer attachments live on the host, so a tool can be handed one by path.\n *\n * Each upload gets its own random directory under the session's root, which keeps\n * two files with the same name apart and lets the original name survive. The\n * directory is owner-only because an attachment is whatever the user dropped in.\n */\n\nconst DIRECTORY_NAME = 'po-attachments';\nconst PRIVATE_DIRECTORY_MODE = 0o700;\nconst PRIVATE_FILE_MODE = 0o600;\nconst MAX_NAME_BYTES = 200;\nconst FALLBACK_NAME = 'file';\nconst RETENTION_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport type { SessionAttachment } from './type';\n\n/** Throws for an id whose directory would be the attachment root itself or its parent. */\nexport function sessionAttachmentRoot(\n sessionId: string,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): string {\n const directory = safeName(sessionId);\n if (directory === '' || directory === '.' || directory === '..')\n throw new Error('This session id cannot hold attachments.');\n return path.join(piAgentDirectory(environment), DIRECTORY_NAME, directory);\n}\n\n/**\n * One plain file name: no separators or control characters, and no leading dot, so\n * an attachment is never hidden and never `.` or `..`. Cut on a code point boundary\n * to fit common file-name limits.\n */\nfunction attachmentName(name: string): string {\n // oxlint-disable-next-line no-control-regex -- stripping control characters is the point\n const plain = name.replace(/[\\u0000-\\u001f\\u007f/\\\\]/gu, '').replace(/^\\.+/u, '');\n let fitted = '';\n for (const character of plain) {\n if (Buffer.byteLength(fitted + character) > MAX_NAME_BYTES) break;\n fitted += character;\n }\n return fitted === '' ? FALLBACK_NAME : fitted;\n}\n\n/** Best effort: a sweep that cannot read or remove a directory leaves it for the next write. */\nasync function sweepExpired(root: string): Promise<void> {\n const cutoff = Date.now() - RETENTION_MS;\n let sessions: fs.Dirent[];\n try {\n sessions = await fs.promises.readdir(root, { withFileTypes: true });\n } catch {\n return;\n }\n for (const session of sessions) {\n if (!session.isDirectory()) continue;\n const sessionDirectory = path.join(root, session.name);\n let uploads: fs.Dirent[];\n try {\n uploads = await fs.promises.readdir(sessionDirectory, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const upload of uploads) {\n if (!upload.isDirectory()) continue;\n const uploadDirectory = path.join(sessionDirectory, upload.name);\n try {\n if ((await fs.promises.lstat(uploadDirectory)).mtimeMs < cutoff)\n await fs.promises.rm(uploadDirectory, { recursive: true, force: true });\n } catch {\n // Left for the next sweep.\n }\n }\n }\n}\n\n/** Stores one attachment and returns where it landed. Written through a temporary file, then renamed. */\nexport async function writeSessionAttachment(\n sessionId: string,\n name: string,\n bytes: Uint8Array,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<SessionAttachment> {\n const root = sessionAttachmentRoot(sessionId, environment);\n const fileName = attachmentName(name);\n await fs.promises.mkdir(root, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });\n await sweepExpired(path.dirname(root));\n const directory = path.join(root, randomUUID());\n await fs.promises.mkdir(directory, { mode: PRIVATE_DIRECTORY_MODE });\n const target = path.join(directory, fileName);\n const temporary = path.join(directory, `.${randomUUID()}.tmp`);\n try {\n await fs.promises.writeFile(temporary, bytes, { mode: PRIVATE_FILE_MODE, flag: 'wx' });\n await fs.promises.rename(temporary, target);\n } catch (error) {\n await fs.promises.rm(directory, { recursive: true, force: true });\n throw error;\n }\n return {\n path: target,\n name: fileName,\n size: bytes.byteLength,\n mimeType: SESSION_FILE_CONTENT_TYPES[path.extname(fileName).toLowerCase()] ?? SESSION_FILE_DEFAULT_CONTENT_TYPE,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,eAAe;;AAKrB,SAAgB,sBACd,WACA,cAA4D,QAAQ,KAC5D;CACR,MAAM,YAAYA,2BAAAA,SAAS,SAAS;CACpC,IAAI,cAAc,MAAM,cAAc,OAAO,cAAc,MACzD,MAAM,IAAI,MAAM,0CAA0C;CAC5D,OAAOC,UAAAA,QAAK,KAAKC,aAAAA,iBAAiB,WAAW,GAAG,gBAAgB,SAAS;AAC3E;;;;;;AAOA,SAAS,eAAe,MAAsB;CAE5C,MAAM,QAAQ,KAAK,QAAQ,8BAA8B,EAAE,CAAC,CAAC,QAAQ,SAAS,EAAE;CAChF,IAAI,SAAS;CACb,KAAK,MAAM,aAAa,OAAO;EAC7B,IAAI,OAAO,WAAW,SAAS,SAAS,IAAI,gBAAgB;EAC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,MAAM,SAASF,UAAAA,QAAK,KAAK,WAAW,QAAQ;CAC5C,MAAM,YAAYA,UAAAA,QAAK,KAAK,WAAW,KAAA,GAAIG,YAAAA,WAAAA,CAAW,EAAE,KAAK;CAC7D,IAAI;EACF,MAAMD,QAAAA,QAAG,SAAS,UAAU,WAAW,OAAO;GAAE,MAAM;GAAmB,MAAM;EAAK,CAAC;EACrF,MAAMA,QAAAA,QAAG,SAAS,OAAO,WAAW,MAAM;CAC5C,SAAS,OAAO;EACd,MAAMA,QAAAA,QAAG,SAAS,GAAG,WAAW;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EAChE,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;EACN,MAAM,MAAM;EACZ,UAAUE,qBAAAA,2BAA2BJ,UAAAA,QAAK,QAAQ,QAAQ,CAAC,CAAC,YAAY,MAAA;CAC1E;AACF"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
+
import { SessionAttachment } from "./type.mjs";
|
|
1
2
|
//#region src/services/sessionAttachments/index.d.ts
|
|
2
|
-
export interface SessionAttachment {
|
|
3
|
-
path: string;
|
|
4
|
-
name: string;
|
|
5
|
-
size: number;
|
|
6
|
-
mimeType: string;
|
|
7
|
-
}
|
|
8
3
|
/** Stores one attachment and returns where it landed. Written through a temporary file, then renamed. */
|
|
9
4
|
export declare function writeSessionAttachment(sessionId: string, name: string, bytes: Uint8Array, environment?: Readonly<Record<string, string | undefined>>): Promise<SessionAttachment>;
|
|
10
5
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/sessionAttachments/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/sessionAttachments/index.ts"],"mappings":";;;wBAqFsB,uBACpB,mBACA,cACA,OAAO,YACP,cAAa,SAAS,sCACrB,QAAQ"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { piAgentDirectory } from "
|
|
1
|
+
import { piAgentDirectory } from "../piSettings/core.mjs";
|
|
2
|
+
import "../../../runtimePiSettings.mjs";
|
|
2
3
|
import { safeName } from "../../../contextDetailStore.mjs";
|
|
3
4
|
import { SESSION_FILE_CONTENT_TYPES } from "../../constants/sessionFiles.mjs";
|
|
4
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -12,7 +13,7 @@ import path from "node:path";
|
|
|
12
13
|
* two files with the same name apart and lets the original name survive. The
|
|
13
14
|
* directory is owner-only because an attachment is whatever the user dropped in.
|
|
14
15
|
*/
|
|
15
|
-
const DIRECTORY_NAME = "
|
|
16
|
+
const DIRECTORY_NAME = "po-attachments";
|
|
16
17
|
const PRIVATE_DIRECTORY_MODE = 448;
|
|
17
18
|
const PRIVATE_FILE_MODE = 384;
|
|
18
19
|
const MAX_NAME_BYTES = 200;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/sessionAttachments/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { SESSION_FILE_CONTENT_TYPES, SESSION_FILE_DEFAULT_CONTENT_TYPE } from '../../constants/sessionFiles';\nimport { safeName } from '../contextDetailStore';\nimport { piAgentDirectory } from '../piSettings';\n\n/**\n * Where composer attachments live on the host, so a tool can be handed one by path.\n *\n * Each upload gets its own random directory under the session's root, which keeps\n * two files with the same name apart and lets the original name survive. The\n * directory is owner-only because an attachment is whatever the user dropped in.\n */\n\nconst DIRECTORY_NAME = '
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/sessionAttachments/index.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { SESSION_FILE_CONTENT_TYPES, SESSION_FILE_DEFAULT_CONTENT_TYPE } from '../../constants/sessionFiles';\nimport { safeName } from '../contextDetailStore';\nimport { piAgentDirectory } from '../piSettings';\nimport type { SessionAttachment } from './type';\n\n/**\n * Where composer attachments live on the host, so a tool can be handed one by path.\n *\n * Each upload gets its own random directory under the session's root, which keeps\n * two files with the same name apart and lets the original name survive. The\n * directory is owner-only because an attachment is whatever the user dropped in.\n */\n\nconst DIRECTORY_NAME = 'po-attachments';\nconst PRIVATE_DIRECTORY_MODE = 0o700;\nconst PRIVATE_FILE_MODE = 0o600;\nconst MAX_NAME_BYTES = 200;\nconst FALLBACK_NAME = 'file';\nconst RETENTION_MS = 7 * 24 * 60 * 60 * 1000;\n\nexport type { SessionAttachment } from './type';\n\n/** Throws for an id whose directory would be the attachment root itself or its parent. */\nexport function sessionAttachmentRoot(\n sessionId: string,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): string {\n const directory = safeName(sessionId);\n if (directory === '' || directory === '.' || directory === '..')\n throw new Error('This session id cannot hold attachments.');\n return path.join(piAgentDirectory(environment), DIRECTORY_NAME, directory);\n}\n\n/**\n * One plain file name: no separators or control characters, and no leading dot, so\n * an attachment is never hidden and never `.` or `..`. Cut on a code point boundary\n * to fit common file-name limits.\n */\nfunction attachmentName(name: string): string {\n // oxlint-disable-next-line no-control-regex -- stripping control characters is the point\n const plain = name.replace(/[\\u0000-\\u001f\\u007f/\\\\]/gu, '').replace(/^\\.+/u, '');\n let fitted = '';\n for (const character of plain) {\n if (Buffer.byteLength(fitted + character) > MAX_NAME_BYTES) break;\n fitted += character;\n }\n return fitted === '' ? FALLBACK_NAME : fitted;\n}\n\n/** Best effort: a sweep that cannot read or remove a directory leaves it for the next write. */\nasync function sweepExpired(root: string): Promise<void> {\n const cutoff = Date.now() - RETENTION_MS;\n let sessions: fs.Dirent[];\n try {\n sessions = await fs.promises.readdir(root, { withFileTypes: true });\n } catch {\n return;\n }\n for (const session of sessions) {\n if (!session.isDirectory()) continue;\n const sessionDirectory = path.join(root, session.name);\n let uploads: fs.Dirent[];\n try {\n uploads = await fs.promises.readdir(sessionDirectory, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const upload of uploads) {\n if (!upload.isDirectory()) continue;\n const uploadDirectory = path.join(sessionDirectory, upload.name);\n try {\n if ((await fs.promises.lstat(uploadDirectory)).mtimeMs < cutoff)\n await fs.promises.rm(uploadDirectory, { recursive: true, force: true });\n } catch {\n // Left for the next sweep.\n }\n }\n }\n}\n\n/** Stores one attachment and returns where it landed. Written through a temporary file, then renamed. */\nexport async function writeSessionAttachment(\n sessionId: string,\n name: string,\n bytes: Uint8Array,\n environment: Readonly<Record<string, string | undefined>> = process.env,\n): Promise<SessionAttachment> {\n const root = sessionAttachmentRoot(sessionId, environment);\n const fileName = attachmentName(name);\n await fs.promises.mkdir(root, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });\n await sweepExpired(path.dirname(root));\n const directory = path.join(root, randomUUID());\n await fs.promises.mkdir(directory, { mode: PRIVATE_DIRECTORY_MODE });\n const target = path.join(directory, fileName);\n const temporary = path.join(directory, `.${randomUUID()}.tmp`);\n try {\n await fs.promises.writeFile(temporary, bytes, { mode: PRIVATE_FILE_MODE, flag: 'wx' });\n await fs.promises.rename(temporary, target);\n } catch (error) {\n await fs.promises.rm(directory, { recursive: true, force: true });\n throw error;\n }\n return {\n path: target,\n name: fileName,\n size: bytes.byteLength,\n mimeType: SESSION_FILE_CONTENT_TYPES[path.extname(fileName).toLowerCase()] ?? SESSION_FILE_DEFAULT_CONTENT_TYPE,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,iBAAiB;AACvB,MAAM,yBAAyB;AAC/B,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB;AACvB,MAAM,gBAAgB;AACtB,MAAM,eAAe;;AAKrB,SAAgB,sBACd,WACA,cAA4D,QAAQ,KAC5D;CACR,MAAM,YAAY,SAAS,SAAS;CACpC,IAAI,cAAc,MAAM,cAAc,OAAO,cAAc,MACzD,MAAM,IAAI,MAAM,0CAA0C;CAC5D,OAAO,KAAK,KAAK,iBAAiB,WAAW,GAAG,gBAAgB,SAAS;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CACrC,MAAM,YAAY,KAAK,KAAK,MAAM,WAAW,CAAC;CAC9C,MAAM,GAAG,SAAS,MAAM,WAAW,EAAE,MAAM,uBAAuB,CAAC;CACnE,MAAM,SAAS,KAAK,KAAK,WAAW,QAAQ;CAC5C,MAAM,YAAY,KAAK,KAAK,WAAW,IAAI,WAAW,EAAE,KAAK;CAC7D,IAAI;EACF,MAAM,GAAG,SAAS,UAAU,WAAW,OAAO;GAAE,MAAM;GAAmB,MAAM;EAAK,CAAC;EACrF,MAAM,GAAG,SAAS,OAAO,WAAW,MAAM;CAC5C,SAAS,OAAO;EACd,MAAM,GAAG,SAAS,GAAG,WAAW;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EAChE,MAAM;CACR;CACA,OAAO;EACL,MAAM;EACN,MAAM;EACN,MAAM,MAAM;EACZ,UAAU,2BAA2B,KAAK,QAAQ,QAAQ,CAAC,CAAC,YAAY,MAAA;CAC1E;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.mts","names":[],"sources":["../../../../src/services/sessionAttachments/type.ts"],"mappings":";iBAAiB;EACf;EACA;EACA;EACA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_core = require("../piSettings/core.cjs");
|
|
3
|
+
const require_docs = require("../durableSession/docs.cjs");
|
|
4
|
+
const require_sessionDirectory = require("./sessionDirectory.cjs");
|
|
5
|
+
let node_crypto = require("node:crypto");
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
8
|
+
let _earendil_works_pi_durable = require("@earendil-works/pi-durable");
|
|
9
|
+
let dist_interop_chordContext_mjs = require("../../../../dist/interop/chordContext.mjs");
|
|
10
|
+
//#region src/services/sessionFiles/index.ts
|
|
11
|
+
const PO_SESSION_TEMP_DIR = "PO_SESSION_TEMP_DIR";
|
|
12
|
+
const PO_SESSION_FILES_SERVICE = "po/session-files";
|
|
13
|
+
/** A host-owned path, never a client-selected root or an inherited parent session path. */
|
|
14
|
+
function sessionTempDirectory(options) {
|
|
15
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error("Invalid temporary-file session identity.");
|
|
16
|
+
if (!node_path.default.isAbsolute(options.temporaryDirectory)) throw new Error("The host temporary directory must be absolute.");
|
|
17
|
+
const namespace = (0, node_crypto.createHash)("sha256").update(options.homeDirectory).update("\0").update(require_core.poHomeDirectory(options.homeDirectory, options.environment)).digest("hex").slice(0, 24);
|
|
18
|
+
return node_path.default.join(options.temporaryDirectory, `po-${namespace}`, "sessions", options.sessionId);
|
|
19
|
+
}
|
|
20
|
+
/** Both the execution host and package APIs call this with their admitted session identity. */
|
|
21
|
+
async function prepareSessionEnvironment(input) {
|
|
22
|
+
const environment = { ...input.environment };
|
|
23
|
+
delete environment[PO_SESSION_TEMP_DIR];
|
|
24
|
+
if (input.platform.temporaryDirectory === void 0) return Object.freeze(environment);
|
|
25
|
+
const directory = sessionTempDirectory({
|
|
26
|
+
sessionId: input.sessionId,
|
|
27
|
+
homeDirectory: input.platform.homeDirectory,
|
|
28
|
+
environment,
|
|
29
|
+
temporaryDirectory: input.platform.temporaryDirectory
|
|
30
|
+
});
|
|
31
|
+
const preparedDirectory = await require_sessionDirectory.prepareSessionDirectory(input.platform, directory);
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
...environment,
|
|
34
|
+
[PO_SESSION_TEMP_DIR]: preparedDirectory
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function checkedDirectories(value, sessionId) {
|
|
38
|
+
if (!value || typeof value !== "object") throw new Error("Invalid saved session output directories.");
|
|
39
|
+
const files = value;
|
|
40
|
+
const absolute = (directory) => typeof directory === "string" && !directory.includes("\0") && node_path.default.isAbsolute(directory) && node_path.default.resolve(directory) === directory;
|
|
41
|
+
if (!absolute(files.agentDirectory)) throw new Error("Invalid saved session agent directory.");
|
|
42
|
+
if (files.temporaryDirectory !== void 0) {
|
|
43
|
+
const directory = files.temporaryDirectory;
|
|
44
|
+
if (!absolute(directory) || node_path.default.basename(directory) !== sessionId || node_path.default.basename(node_path.default.dirname(directory)) !== "sessions" || !/^po-[a-f0-9]{24}$/u.test(node_path.default.basename(node_path.default.dirname(node_path.default.dirname(directory))))) throw new Error("Invalid saved session temporary directory.");
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
agentDirectory: files.agentDirectory,
|
|
48
|
+
...files.temporaryDirectory === void 0 ? {} : { temporaryDirectory: files.temporaryDirectory }
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** Narrow server-written output metadata, without exposing a session's environment or accepting request roots. */
|
|
52
|
+
async function readSessionFileDirectories(sessions, sessionId) {
|
|
53
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error("Invalid session output identity.");
|
|
54
|
+
const storage = await sessions.openReadOnly(sessionId, dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
55
|
+
const session = (0, _earendil_works_pi_durable.createSession)(storage);
|
|
56
|
+
try {
|
|
57
|
+
if ((await session.snapshot(require_docs.SessionIdentityDoc, dist_interop_chordContext_mjs.BACKGROUND_CONTEXT))?.id !== sessionId) throw new Error("Saved output does not belong to this session.");
|
|
58
|
+
const metadata = await session.snapshot(require_docs.SessionMetadataDoc, dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
59
|
+
if (!metadata?.execution) return void 0;
|
|
60
|
+
const execution = JSON.parse(metadata.execution);
|
|
61
|
+
if (!execution || typeof execution !== "object" || !("files" in execution) || execution.files === void 0) return void 0;
|
|
62
|
+
return checkedDirectories(execution.files, sessionId);
|
|
63
|
+
} finally {
|
|
64
|
+
await session.close(dist_interop_chordContext_mjs.BACKGROUND_CONTEXT);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Explicit session removal only. Ordinary close, release and host shutdown preserve output. */
|
|
68
|
+
async function removeSessionFiles(input) {
|
|
69
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(input.sessionId) || node_path.default.basename(input.artifactDirectory) !== input.sessionId) throw new Error("Invalid session output cleanup identity.");
|
|
70
|
+
const directories = input.directories === void 0 ? void 0 : checkedDirectories(input.directories, input.sessionId);
|
|
71
|
+
const removals = [require_sessionDirectory.removeSessionOutputDirectory(input.platform, input.artifactDirectory)];
|
|
72
|
+
const temporaryDirectory = directories?.temporaryDirectory ?? (input.platform.temporaryDirectory === void 0 ? void 0 : sessionTempDirectory({
|
|
73
|
+
sessionId: input.sessionId,
|
|
74
|
+
homeDirectory: input.platform.homeDirectory,
|
|
75
|
+
environment: input.environment,
|
|
76
|
+
temporaryDirectory: input.platform.temporaryDirectory
|
|
77
|
+
}));
|
|
78
|
+
if (temporaryDirectory !== void 0) {
|
|
79
|
+
const originalBase = node_path.default.dirname(node_path.default.dirname(node_path.default.dirname(temporaryDirectory)));
|
|
80
|
+
removals.push(require_sessionDirectory.removeSessionDirectory({
|
|
81
|
+
...input.platform,
|
|
82
|
+
temporaryDirectory: originalBase
|
|
83
|
+
}, temporaryDirectory));
|
|
84
|
+
}
|
|
85
|
+
const failures = (await Promise.allSettled(removals)).filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
86
|
+
if (failures.length > 0) throw new AggregateError(failures, `Session '${input.sessionId}' output cleanup failed`);
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
exports.PO_SESSION_FILES_SERVICE = PO_SESSION_FILES_SERVICE;
|
|
90
|
+
exports.PO_SESSION_TEMP_DIR = PO_SESSION_TEMP_DIR;
|
|
91
|
+
exports.prepareSessionEnvironment = prepareSessionEnvironment;
|
|
92
|
+
exports.readSessionFileDirectories = readSessionFileDirectories;
|
|
93
|
+
exports.removeSessionFiles = removeSessionFiles;
|
|
94
|
+
exports.sessionTempDirectory = sessionTempDirectory;
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["path","createHash","poHomeDirectory","prepareSessionDirectory","BACKGROUND_CONTEXT","createSession","SessionIdentityDoc","SessionMetadataDoc","removeSessionOutputDirectory","removeSessionDirectory"],"sources":["../../../../src/services/sessionFiles/index.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport path from 'node:path';\n\nimport { BACKGROUND_CONTEXT } from '@earendil-works/chord/context';\nimport { createSession } from '@earendil-works/pi-durable';\n\nimport type { PoPlatform, PoSessionStorageService } from '../../schemas/platform';\nimport { SessionIdentityDoc, SessionMetadataDoc } from '../durableSession/docs';\nimport { poHomeDirectory } from '../piSettings/core';\nimport { prepareSessionDirectory, removeSessionDirectory, removeSessionOutputDirectory } from './sessionDirectory';\n\nexport const PO_SESSION_TEMP_DIR = 'PO_SESSION_TEMP_DIR';\nexport const PO_SESSION_FILES_SERVICE = 'po/session-files';\n\nexport interface PoSessionFiles {\n readonly temporaryDirectory: string;\n}\n\nexport interface SessionTempDirectoryOptions {\n readonly sessionId: string;\n readonly homeDirectory: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n readonly temporaryDirectory: string;\n}\n\n/** A host-owned path, never a client-selected root or an inherited parent session path. */\nexport function sessionTempDirectory(options: SessionTempDirectoryOptions): string {\n if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error('Invalid temporary-file session identity.');\n if (!path.isAbsolute(options.temporaryDirectory)) throw new Error('The host temporary directory must be absolute.');\n const namespace = createHash('sha256')\n .update(options.homeDirectory)\n .update('\\0')\n .update(poHomeDirectory(options.homeDirectory, options.environment))\n .digest('hex')\n .slice(0, 24);\n return path.join(options.temporaryDirectory, `po-${namespace}`, 'sessions', options.sessionId);\n}\n\n/** Both the execution host and package APIs call this with their admitted session identity. */\nexport async function prepareSessionEnvironment(input: {\n readonly platform: PoPlatform;\n readonly sessionId: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n}): Promise<Readonly<Record<string, string | undefined>>> {\n const environment = { ...input.environment };\n // A child must never inherit its parent's browsable directory. Older embedders may lack this capability.\n delete environment[PO_SESSION_TEMP_DIR];\n if (input.platform.temporaryDirectory === undefined) return Object.freeze(environment);\n const directory = sessionTempDirectory({\n sessionId: input.sessionId,\n homeDirectory: input.platform.homeDirectory,\n environment,\n temporaryDirectory: input.platform.temporaryDirectory,\n });\n // ponytail: resumption uses the same host temp base; pinning across host temp changes needs durable session metadata.\n const preparedDirectory = await prepareSessionDirectory(input.platform, directory);\n return Object.freeze({ ...environment, [PO_SESSION_TEMP_DIR]: preparedDirectory });\n}\n\nexport interface PoSessionFileDirectories {\n readonly agentDirectory: string;\n readonly temporaryDirectory?: string;\n}\n\nfunction checkedDirectories(value: unknown, sessionId: string): PoSessionFileDirectories {\n if (!value || typeof value !== 'object') throw new Error('Invalid saved session output directories.');\n const files = value as Record<string, unknown>;\n const absolute = (directory: unknown): directory is string =>\n typeof directory === 'string' &&\n !directory.includes('\\0') &&\n path.isAbsolute(directory) &&\n path.resolve(directory) === directory;\n if (!absolute(files.agentDirectory)) throw new Error('Invalid saved session agent directory.');\n if (files.temporaryDirectory !== undefined) {\n const directory = files.temporaryDirectory;\n if (\n !absolute(directory) ||\n path.basename(directory) !== sessionId ||\n path.basename(path.dirname(directory)) !== 'sessions' ||\n !/^po-[a-f0-9]{24}$/u.test(path.basename(path.dirname(path.dirname(directory))))\n )\n throw new Error('Invalid saved session temporary directory.');\n }\n return {\n agentDirectory: files.agentDirectory,\n ...(files.temporaryDirectory === undefined ? {} : { temporaryDirectory: files.temporaryDirectory as string }),\n };\n}\n\n/** Narrow server-written output metadata, without exposing a session's environment or accepting request roots. */\nexport async function readSessionFileDirectories(\n sessions: PoSessionStorageService,\n sessionId: string,\n): Promise<PoSessionFileDirectories | undefined> {\n if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error('Invalid session output identity.');\n const storage = await sessions.openReadOnly(sessionId, BACKGROUND_CONTEXT);\n const session = createSession(storage);\n try {\n const identity = await session.snapshot(SessionIdentityDoc, BACKGROUND_CONTEXT);\n if (identity?.id !== sessionId) throw new Error('Saved output does not belong to this session.');\n const metadata = await session.snapshot(SessionMetadataDoc, BACKGROUND_CONTEXT);\n if (!metadata?.execution) return undefined;\n const execution: unknown = JSON.parse(metadata.execution);\n if (!execution || typeof execution !== 'object' || !('files' in execution) || execution.files === undefined)\n return undefined;\n return checkedDirectories(execution.files, sessionId);\n } finally {\n await session.close(BACKGROUND_CONTEXT);\n }\n}\n\n/** Explicit session removal only. Ordinary close, release and host shutdown preserve output. */\nexport async function removeSessionFiles(input: {\n readonly platform: PoPlatform;\n readonly sessionId: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n /** Exact session artifact directory selected by the composition root, never by a request. */\n readonly artifactDirectory: string;\n /** Previously stored roots, read by the host from the session's own durable metadata. */\n readonly directories?: PoSessionFileDirectories;\n}): Promise<void> {\n if (!/^[a-zA-Z0-9_-]+$/u.test(input.sessionId) || path.basename(input.artifactDirectory) !== input.sessionId)\n throw new Error('Invalid session output cleanup identity.');\n const directories =\n input.directories === undefined ? undefined : checkedDirectories(input.directories, input.sessionId);\n const removals = [removeSessionOutputDirectory(input.platform, input.artifactDirectory)];\n const temporaryDirectory =\n directories?.temporaryDirectory ??\n (input.platform.temporaryDirectory === undefined\n ? undefined\n : sessionTempDirectory({\n sessionId: input.sessionId,\n homeDirectory: input.platform.homeDirectory,\n environment: input.environment,\n temporaryDirectory: input.platform.temporaryDirectory,\n }));\n if (temporaryDirectory !== undefined) {\n const originalBase = path.dirname(path.dirname(path.dirname(temporaryDirectory)));\n removals.push(removeSessionDirectory({ ...input.platform, temporaryDirectory: originalBase }, temporaryDirectory));\n }\n const results = await Promise.allSettled(removals);\n const failures = results\n .filter((result): result is PromiseRejectedResult => result.status === 'rejected')\n .map((result) => result.reason);\n if (failures.length > 0) throw new AggregateError(failures, `Session '${input.sessionId}' output cleanup failed`);\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,sBAAsB;A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OAQvB;CAChB,IAAI,CAAC,oBAAoB,KAAK,MAAM,SAAS,KAAKJ,UAAAA,QAAK,SAAS,MAAM,iBAAiB,MAAM,MAAM,WACjG,MAAM,IAAI,MAAM,0CAA0C;CAC5D,MAAM,cACJ,MAAM,gBAAgB,KAAA,IAAY,KAAA,IAAY,mBAAmB,MAAM,aAAa,MAAM,SAAS;CACrG,MAAM,WAAW,CAACQ,yBAAAA,6BAA6B,MAAM,UAAU,MAAM,iBAAiB,CAAC;CACvF,MAAM,qBACJ,aAAa,uBACZ,MAAM,SAAS,uBAAuB,KAAA,IACnC,KAAA,IACA,qBAAqB;EACnB,WAAW,MAAM;EACjB,eAAe,MAAM,SAAS;EAC9B,aAAa,MAAM;EACnB,oBAAoB,MAAM,SAAS;CACrC,CAAC;CACP,IAAI,uBAAuB,KAAA,GAAW;EACpC,MAAM,eAAeR,UAAAA,QAAK,QAAQA,UAAAA,QAAK,QAAQA,UAAAA,QAAK,QAAQ,kBAAkB,CAAC,CAAC;EAChF,SAAS,KAAKS,yBAAAA,uBAAuB;GAAE,GAAG,MAAM;GAAU,oBAAoB;EAAa,GAAG,kBAAkB,CAAC;CACnH;CAEA,MAAM,YAAW,MADK,QAAQ,WAAW,QAAQ,EAAA,CAE9C,QAAQ,WAA4C,OAAO,WAAW,UAAU,CAAC,CACjF,KAAK,WAAW,OAAO,MAAM;CAChC,IAAI,SAAS,SAAS,GAAG,MAAM,IAAI,eAAe,UAAU,YAAY,MAAM,UAAU,wBAAwB;AAClH"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PoPlatform, PoSessionStorageService } from "../../schemas/platform.mjs";
|
|
2
|
+
//#region src/services/sessionFiles/index.d.ts
|
|
3
|
+
export declare const PO_SESSION_TEMP_DIR = "PO_SESSION_TEMP_DIR";
|
|
4
|
+
export declare const PO_SESSION_FILES_SERVICE = "po/session-files";
|
|
5
|
+
export interface PoSessionFiles {
|
|
6
|
+
readonly temporaryDirectory: string;
|
|
7
|
+
}
|
|
8
|
+
export interface SessionTempDirectoryOptions {
|
|
9
|
+
readonly sessionId: string;
|
|
10
|
+
readonly homeDirectory: string;
|
|
11
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
12
|
+
readonly temporaryDirectory: string;
|
|
13
|
+
}
|
|
14
|
+
/** A host-owned path, never a client-selected root or an inherited parent session path. */
|
|
15
|
+
export declare function sessionTempDirectory(options: SessionTempDirectoryOptions): string;
|
|
16
|
+
export interface PoSessionFileDirectories {
|
|
17
|
+
readonly agentDirectory: string;
|
|
18
|
+
readonly temporaryDirectory?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Narrow server-written output metadata, without exposing a session's environment or accepting request roots. */
|
|
21
|
+
export declare function readSessionFileDirectories(sessions: PoSessionStorageService, sessionId: string): Promise<PoSessionFileDirectories | undefined>;
|
|
22
|
+
/** Explicit session removal only. Ordinary close, release and host shutdown preserve output. */
|
|
23
|
+
export declare function removeSessionFiles(input: {
|
|
24
|
+
readonly platform: PoPlatform;
|
|
25
|
+
readonly sessionId: string;
|
|
26
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
27
|
+
/** Exact session artifact directory selected by the composition root, never by a request. */
|
|
28
|
+
readonly artifactDirectory: string;
|
|
29
|
+
/** Previously stored roots, read by the host from the session's own durable metadata. */
|
|
30
|
+
readonly directories?: PoSessionFileDirectories;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/sessionFiles/index.ts"],"mappings":";;qBAWa;qBACA;iBAEI;WACN;;iBAGM;WACN;WACA;WACA,aAAa,SAAS;WACtB;;;wBAIK,qBAAqB,SAAS;iBAiC7B;WACN;WACA;;;wBA6BW,2BACpB,UAAU,yBACV,oBACC,QAAQ;;wBAmBW,mBAAmB;WAC9B,UAAU;WACV;WACA,aAAa,SAAS;;WAEtB;;WAEA,cAAc;IACrB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { poHomeDirectory } from "../piSettings/core.mjs";
|
|
2
|
+
import { SessionIdentityDoc, SessionMetadataDoc } from "../durableSession/docs.mjs";
|
|
3
|
+
import { prepareSessionDirectory, removeSessionDirectory, removeSessionOutputDirectory } from "./sessionDirectory.mjs";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { createSession } from "@earendil-works/pi-durable";
|
|
7
|
+
import { BACKGROUND_CONTEXT } from "@earendil-works/chord/context";
|
|
8
|
+
//#region src/services/sessionFiles/index.ts
|
|
9
|
+
const PO_SESSION_TEMP_DIR = "PO_SESSION_TEMP_DIR";
|
|
10
|
+
const PO_SESSION_FILES_SERVICE = "po/session-files";
|
|
11
|
+
/** A host-owned path, never a client-selected root or an inherited parent session path. */
|
|
12
|
+
function sessionTempDirectory(options) {
|
|
13
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error("Invalid temporary-file session identity.");
|
|
14
|
+
if (!path.isAbsolute(options.temporaryDirectory)) throw new Error("The host temporary directory must be absolute.");
|
|
15
|
+
const namespace = createHash("sha256").update(options.homeDirectory).update("\0").update(poHomeDirectory(options.homeDirectory, options.environment)).digest("hex").slice(0, 24);
|
|
16
|
+
return path.join(options.temporaryDirectory, `po-${namespace}`, "sessions", options.sessionId);
|
|
17
|
+
}
|
|
18
|
+
/** Both the execution host and package APIs call this with their admitted session identity. */
|
|
19
|
+
async function prepareSessionEnvironment(input) {
|
|
20
|
+
const environment = { ...input.environment };
|
|
21
|
+
delete environment[PO_SESSION_TEMP_DIR];
|
|
22
|
+
if (input.platform.temporaryDirectory === void 0) return Object.freeze(environment);
|
|
23
|
+
const directory = sessionTempDirectory({
|
|
24
|
+
sessionId: input.sessionId,
|
|
25
|
+
homeDirectory: input.platform.homeDirectory,
|
|
26
|
+
environment,
|
|
27
|
+
temporaryDirectory: input.platform.temporaryDirectory
|
|
28
|
+
});
|
|
29
|
+
const preparedDirectory = await prepareSessionDirectory(input.platform, directory);
|
|
30
|
+
return Object.freeze({
|
|
31
|
+
...environment,
|
|
32
|
+
[PO_SESSION_TEMP_DIR]: preparedDirectory
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function checkedDirectories(value, sessionId) {
|
|
36
|
+
if (!value || typeof value !== "object") throw new Error("Invalid saved session output directories.");
|
|
37
|
+
const files = value;
|
|
38
|
+
const absolute = (directory) => typeof directory === "string" && !directory.includes("\0") && path.isAbsolute(directory) && path.resolve(directory) === directory;
|
|
39
|
+
if (!absolute(files.agentDirectory)) throw new Error("Invalid saved session agent directory.");
|
|
40
|
+
if (files.temporaryDirectory !== void 0) {
|
|
41
|
+
const directory = files.temporaryDirectory;
|
|
42
|
+
if (!absolute(directory) || path.basename(directory) !== sessionId || path.basename(path.dirname(directory)) !== "sessions" || !/^po-[a-f0-9]{24}$/u.test(path.basename(path.dirname(path.dirname(directory))))) throw new Error("Invalid saved session temporary directory.");
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
agentDirectory: files.agentDirectory,
|
|
46
|
+
...files.temporaryDirectory === void 0 ? {} : { temporaryDirectory: files.temporaryDirectory }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/** Narrow server-written output metadata, without exposing a session's environment or accepting request roots. */
|
|
50
|
+
async function readSessionFileDirectories(sessions, sessionId) {
|
|
51
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error("Invalid session output identity.");
|
|
52
|
+
const storage = await sessions.openReadOnly(sessionId, BACKGROUND_CONTEXT);
|
|
53
|
+
const session = createSession(storage);
|
|
54
|
+
try {
|
|
55
|
+
if ((await session.snapshot(SessionIdentityDoc, BACKGROUND_CONTEXT))?.id !== sessionId) throw new Error("Saved output does not belong to this session.");
|
|
56
|
+
const metadata = await session.snapshot(SessionMetadataDoc, BACKGROUND_CONTEXT);
|
|
57
|
+
if (!metadata?.execution) return void 0;
|
|
58
|
+
const execution = JSON.parse(metadata.execution);
|
|
59
|
+
if (!execution || typeof execution !== "object" || !("files" in execution) || execution.files === void 0) return void 0;
|
|
60
|
+
return checkedDirectories(execution.files, sessionId);
|
|
61
|
+
} finally {
|
|
62
|
+
await session.close(BACKGROUND_CONTEXT);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** Explicit session removal only. Ordinary close, release and host shutdown preserve output. */
|
|
66
|
+
async function removeSessionFiles(input) {
|
|
67
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(input.sessionId) || path.basename(input.artifactDirectory) !== input.sessionId) throw new Error("Invalid session output cleanup identity.");
|
|
68
|
+
const directories = input.directories === void 0 ? void 0 : checkedDirectories(input.directories, input.sessionId);
|
|
69
|
+
const removals = [removeSessionOutputDirectory(input.platform, input.artifactDirectory)];
|
|
70
|
+
const temporaryDirectory = directories?.temporaryDirectory ?? (input.platform.temporaryDirectory === void 0 ? void 0 : sessionTempDirectory({
|
|
71
|
+
sessionId: input.sessionId,
|
|
72
|
+
homeDirectory: input.platform.homeDirectory,
|
|
73
|
+
environment: input.environment,
|
|
74
|
+
temporaryDirectory: input.platform.temporaryDirectory
|
|
75
|
+
}));
|
|
76
|
+
if (temporaryDirectory !== void 0) {
|
|
77
|
+
const originalBase = path.dirname(path.dirname(path.dirname(temporaryDirectory)));
|
|
78
|
+
removals.push(removeSessionDirectory({
|
|
79
|
+
...input.platform,
|
|
80
|
+
temporaryDirectory: originalBase
|
|
81
|
+
}, temporaryDirectory));
|
|
82
|
+
}
|
|
83
|
+
const failures = (await Promise.allSettled(removals)).filter((result) => result.status === "rejected").map((result) => result.reason);
|
|
84
|
+
if (failures.length > 0) throw new AggregateError(failures, `Session '${input.sessionId}' output cleanup failed`);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { PO_SESSION_FILES_SERVICE, PO_SESSION_TEMP_DIR, prepareSessionEnvironment, readSessionFileDirectories, removeSessionFiles, sessionTempDirectory };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/sessionFiles/index.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport path from 'node:path';\n\nimport { BACKGROUND_CONTEXT } from '@earendil-works/chord/context';\nimport { createSession } from '@earendil-works/pi-durable';\n\nimport type { PoPlatform, PoSessionStorageService } from '../../schemas/platform';\nimport { SessionIdentityDoc, SessionMetadataDoc } from '../durableSession/docs';\nimport { poHomeDirectory } from '../piSettings/core';\nimport { prepareSessionDirectory, removeSessionDirectory, removeSessionOutputDirectory } from './sessionDirectory';\n\nexport const PO_SESSION_TEMP_DIR = 'PO_SESSION_TEMP_DIR';\nexport const PO_SESSION_FILES_SERVICE = 'po/session-files';\n\nexport interface PoSessionFiles {\n readonly temporaryDirectory: string;\n}\n\nexport interface SessionTempDirectoryOptions {\n readonly sessionId: string;\n readonly homeDirectory: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n readonly temporaryDirectory: string;\n}\n\n/** A host-owned path, never a client-selected root or an inherited parent session path. */\nexport function sessionTempDirectory(options: SessionTempDirectoryOptions): string {\n if (!/^[a-zA-Z0-9_-]+$/u.test(options.sessionId)) throw new Error('Invalid temporary-file session identity.');\n if (!path.isAbsolute(options.temporaryDirectory)) throw new Error('The host temporary directory must be absolute.');\n const namespace = createHash('sha256')\n .update(options.homeDirectory)\n .update('\\0')\n .update(poHomeDirectory(options.homeDirectory, options.environment))\n .digest('hex')\n .slice(0, 24);\n return path.join(options.temporaryDirectory, `po-${namespace}`, 'sessions', options.sessionId);\n}\n\n/** Both the execution host and package APIs call this with their admitted session identity. */\nexport async function prepareSessionEnvironment(input: {\n readonly platform: PoPlatform;\n readonly sessionId: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n}): Promise<Readonly<Record<string, string | undefined>>> {\n const environment = { ...input.environment };\n // A child must never inherit its parent's browsable directory. Older embedders may lack this capability.\n delete environment[PO_SESSION_TEMP_DIR];\n if (input.platform.temporaryDirectory === undefined) return Object.freeze(environment);\n const directory = sessionTempDirectory({\n sessionId: input.sessionId,\n homeDirectory: input.platform.homeDirectory,\n environment,\n temporaryDirectory: input.platform.temporaryDirectory,\n });\n // ponytail: resumption uses the same host temp base; pinning across host temp changes needs durable session metadata.\n const preparedDirectory = await prepareSessionDirectory(input.platform, directory);\n return Object.freeze({ ...environment, [PO_SESSION_TEMP_DIR]: preparedDirectory });\n}\n\nexport interface PoSessionFileDirectories {\n readonly agentDirectory: string;\n readonly temporaryDirectory?: string;\n}\n\nfunction checkedDirectories(value: unknown, sessionId: string): PoSessionFileDirectories {\n if (!value || typeof value !== 'object') throw new Error('Invalid saved session output directories.');\n const files = value as Record<string, unknown>;\n const absolute = (directory: unknown): directory is string =>\n typeof directory === 'string' &&\n !directory.includes('\\0') &&\n path.isAbsolute(directory) &&\n path.resolve(directory) === directory;\n if (!absolute(files.agentDirectory)) throw new Error('Invalid saved session agent directory.');\n if (files.temporaryDirectory !== undefined) {\n const directory = files.temporaryDirectory;\n if (\n !absolute(directory) ||\n path.basename(directory) !== sessionId ||\n path.basename(path.dirname(directory)) !== 'sessions' ||\n !/^po-[a-f0-9]{24}$/u.test(path.basename(path.dirname(path.dirname(directory))))\n )\n throw new Error('Invalid saved session temporary directory.');\n }\n return {\n agentDirectory: files.agentDirectory,\n ...(files.temporaryDirectory === undefined ? {} : { temporaryDirectory: files.temporaryDirectory as string }),\n };\n}\n\n/** Narrow server-written output metadata, without exposing a session's environment or accepting request roots. */\nexport async function readSessionFileDirectories(\n sessions: PoSessionStorageService,\n sessionId: string,\n): Promise<PoSessionFileDirectories | undefined> {\n if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error('Invalid session output identity.');\n const storage = await sessions.openReadOnly(sessionId, BACKGROUND_CONTEXT);\n const session = createSession(storage);\n try {\n const identity = await session.snapshot(SessionIdentityDoc, BACKGROUND_CONTEXT);\n if (identity?.id !== sessionId) throw new Error('Saved output does not belong to this session.');\n const metadata = await session.snapshot(SessionMetadataDoc, BACKGROUND_CONTEXT);\n if (!metadata?.execution) return undefined;\n const execution: unknown = JSON.parse(metadata.execution);\n if (!execution || typeof execution !== 'object' || !('files' in execution) || execution.files === undefined)\n return undefined;\n return checkedDirectories(execution.files, sessionId);\n } finally {\n await session.close(BACKGROUND_CONTEXT);\n }\n}\n\n/** Explicit session removal only. Ordinary close, release and host shutdown preserve output. */\nexport async function removeSessionFiles(input: {\n readonly platform: PoPlatform;\n readonly sessionId: string;\n readonly environment: Readonly<Record<string, string | undefined>>;\n /** Exact session artifact directory selected by the composition root, never by a request. */\n readonly artifactDirectory: string;\n /** Previously stored roots, read by the host from the session's own durable metadata. */\n readonly directories?: PoSessionFileDirectories;\n}): Promise<void> {\n if (!/^[a-zA-Z0-9_-]+$/u.test(input.sessionId) || path.basename(input.artifactDirectory) !== input.sessionId)\n throw new Error('Invalid session output cleanup identity.');\n const directories =\n input.directories === undefined ? undefined : checkedDirectories(input.directories, input.sessionId);\n const removals = [removeSessionOutputDirectory(input.platform, input.artifactDirectory)];\n const temporaryDirectory =\n directories?.temporaryDirectory ??\n (input.platform.temporaryDirectory === undefined\n ? undefined\n : sessionTempDirectory({\n sessionId: input.sessionId,\n homeDirectory: input.platform.homeDirectory,\n environment: input.environment,\n temporaryDirectory: input.platform.temporaryDirectory,\n }));\n if (temporaryDirectory !== undefined) {\n const originalBase = path.dirname(path.dirname(path.dirname(temporaryDirectory)));\n removals.push(removeSessionDirectory({ ...input.platform, temporaryDirectory: originalBase }, temporaryDirectory));\n }\n const results = await Promise.allSettled(removals);\n const failures = results\n .filter((result): result is PromiseRejectedResult => result.status === 'rejected')\n .map((result) => result.reason);\n if (failures.length > 0) throw new AggregateError(failures, `Session '${input.sessionId}' output cleanup failed`);\n}\n"],"mappings":";;;;;;;;AAWA,MAAa,sBAAsB;AACnC,MAAa,2BAA2B;;AAcx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ACrG,MAAM,WAAW,CAAC,6BAA6B,MAAM,UAAU,MAAM,iBAAiB,CAAC;CACvF,MAAM,qBACJ,aAAa,uBACZ,MAAM,SAAS,uBAAuB,KAAA,IACnC,KAAA,IACA,qBAAqB;EACnB,WAAW,MAAM;EACjB,eAAe,MAAM,SAAS;EAC9B,aAAa,MAAM;EACnB,oBAAoB,MAAM,SAAS;CACrC,CAAC;CACP,IAAI,uBAAuB,KAAA,GAAW;EACpC,MAAM,eAAe,KAAK,QAAQ,KAAK,QAAQ,KAAK,QAAQ,kBAAkB,CAAC,CAAC;EAChF,SAAS,KAAK,uBAAuB;GAAE,GAAG,MAAM;GAAU,oBAAoB;EAAa,GAAG,kBAAkB,CAAC;CACnH;CAEA,MAAM,YAAW,MADK,QAAQ,WAAW,QAAQ,EAAA,CAE9C,QAAQ,WAA4C,OAAO,WAAW,UAAU,CAAC,CACjF,KAAK,WAAW,OAAO,MAAM;CAChC,IAAI,SAAS,SAAS,GAAG,MAAM,IAAI,eAAe,UAAU,YAAY,MAAM,UAAU,wBAAwB;AAClH"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_os = require("node:os");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
5
|
+
let node_fs_promises = require("node:fs/promises");
|
|
6
|
+
//#region src/services/sessionFiles/sessionDirectory.ts
|
|
7
|
+
/** Validate every Po-owned ancestor. OS temp itself may be shared. */
|
|
8
|
+
async function checkedSessionDirectory(platform, directory, create) {
|
|
9
|
+
const base = await (0, node_fs_promises.realpath)(platform.temporaryDirectory);
|
|
10
|
+
const relative = node_path.default.relative(platform.temporaryDirectory, directory);
|
|
11
|
+
if (!relative || relative.startsWith("..") || node_path.default.isAbsolute(relative)) throw new Error("Unsafe session temp root.");
|
|
12
|
+
let current = base;
|
|
13
|
+
const uid = (0, node_os.userInfo)().uid;
|
|
14
|
+
for (const segment of relative.split(node_path.default.sep)) {
|
|
15
|
+
current = node_path.default.join(current, segment);
|
|
16
|
+
if (create) try {
|
|
17
|
+
await (0, node_fs_promises.mkdir)(current, { mode: 448 });
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (!(error instanceof Error && "code" in error && error.code === "EEXIST")) throw error;
|
|
20
|
+
}
|
|
21
|
+
const info = await (0, node_fs_promises.lstat)(current);
|
|
22
|
+
if (!info.isDirectory() || info.isSymbolicLink() || info.uid !== uid || (info.mode & 63) !== 0) throw new Error("Unsafe session temporary directory.");
|
|
23
|
+
if (await (0, node_fs_promises.realpath)(current) !== current) throw new Error("Session temporary directory changed during access.");
|
|
24
|
+
}
|
|
25
|
+
return current;
|
|
26
|
+
}
|
|
27
|
+
async function prepareSessionDirectory(platform, directory) {
|
|
28
|
+
return checkedSessionDirectory(platform, directory, true);
|
|
29
|
+
}
|
|
30
|
+
/** Remove only an existing session temp tree, never creating missing cleanup targets. */
|
|
31
|
+
async function removeSessionDirectory(platform, directory) {
|
|
32
|
+
try {
|
|
33
|
+
const checked = await checkedSessionDirectory(platform, directory, false);
|
|
34
|
+
await (0, node_fs_promises.rm)(checked, {
|
|
35
|
+
recursive: true,
|
|
36
|
+
force: true
|
|
37
|
+
});
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Persistent output roots may contain symlinks as files, but the owned root and parent must not redirect removal. */
|
|
43
|
+
async function removeSessionOutputDirectory(_platform, directory) {
|
|
44
|
+
try {
|
|
45
|
+
const parent = node_path.default.dirname(directory);
|
|
46
|
+
for (const target of [parent, directory]) {
|
|
47
|
+
const info = await (0, node_fs_promises.lstat)(target);
|
|
48
|
+
if (!info.isDirectory() || info.isSymbolicLink()) throw new Error("Unsafe session output cleanup target.");
|
|
49
|
+
}
|
|
50
|
+
const realParent = await (0, node_fs_promises.realpath)(parent);
|
|
51
|
+
const realDirectory = await (0, node_fs_promises.realpath)(directory);
|
|
52
|
+
if (realDirectory !== node_path.default.join(realParent, node_path.default.basename(directory))) throw new Error("Session output cleanup target changed during access.");
|
|
53
|
+
await (0, node_fs_promises.rm)(realDirectory, {
|
|
54
|
+
recursive: true,
|
|
55
|
+
force: true
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
exports.prepareSessionDirectory = prepareSessionDirectory;
|
|
63
|
+
exports.removeSessionDirectory = removeSessionDirectory;
|
|
64
|
+
exports.removeSessionOutputDirectory = removeSessionOutputDirectory;
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=sessionDirectory.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionDirectory.cjs","names":["realpath","path","userInfo","mkdir","lstat","rm"],"sources":["../../../../src/services/sessionFiles/sessionDirectory.ts"],"sourcesContent":["import { lstat, mkdir, realpath, rm } from 'node:fs/promises';\nimport { userInfo } from 'node:os';\nimport path from 'node:path';\n\nimport type { PoPlatform } from '../../schemas/platform';\n\n/** Validate every Po-owned ancestor. OS temp itself may be shared. */\nasync function checkedSessionDirectory(platform: PoPlatform, directory: string, create: boolean): Promise<string> {\n const base = await realpath(platform.temporaryDirectory!);\n const relative = path.relative(platform.temporaryDirectory!, directory);\n if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) throw new Error('Unsafe session temp root.');\n let current = base;\n const uid = userInfo().uid;\n for (const segment of relative.split(path.sep)) {\n current = path.join(current, segment);\n if (create) {\n try {\n await mkdir(current, { mode: 0o700 });\n } catch (error) {\n if (!(error instanceof Error && 'code' in error && error.code === 'EEXIST')) throw error;\n }\n }\n const info = await lstat(current);\n if (!info.isDirectory() || info.isSymbolicLink() || info.uid !== uid || (info.mode & 0o077) !== 0)\n throw new Error('Unsafe session temporary directory.');\n if ((await realpath(current)) !== current) throw new Error('Session temporary directory changed during access.');\n }\n return current;\n}\n\nexport async function prepareSessionDirectory(platform: PoPlatform, directory: string): Promise<string> {\n return checkedSessionDirectory(platform, directory, true);\n}\n\n/** Remove only an existing session temp tree, never creating missing cleanup targets. */\nexport async function removeSessionDirectory(platform: PoPlatform, directory: string): Promise<void> {\n try {\n const checked = await checkedSessionDirectory(platform, directory, false);\n await rm(checked, { recursive: true, force: true });\n } catch (error) {\n if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) throw error;\n }\n}\n\n/** Persistent output roots may contain symlinks as files, but the owned root and parent must not redirect removal. */\nexport async function removeSessionOutputDirectory(_platform: PoPlatform, directory: string): Promise<void> {\n try {\n const parent = path.dirname(directory);\n for (const target of [parent, directory]) {\n const info = await lstat(target);\n if (!info.isDirectory() || info.isSymbolicLink()) throw new Error('Unsafe session output cleanup target.');\n }\n const realParent = await realpath(parent);\n const realDirectory = await realpath(directory);\n if (realDirectory !== path.join(realParent, path.basename(directory)))\n throw new Error('Session output cleanup target changed during access.');\n await rm(realDirectory, { recursive: true, force: true });\n } catch (error) {\n if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT')) throw error;\n }\n}\n"],"mappings":";;;;;;;AAOA,eAAe,wBAAwB,UAAsB,WAAmB,QAAkC;CAChH,MAAM,OAAO,OAAA,GAAMA,iBAAAA,SAAAA,CAAS,SAAS,kBAAmB;CACxD,MAAM,WAAWC,UAAAA,QAAK,SAAS,SAAS,oBAAqB,SAAS;CACtE,IAAI,CAAC,YAAY,SAAS,WAAW,IAAI,KAAKA,UAAAA,QAAK,WAAW,QAAQ,GAAG,MAAM,IAAI,MAAM,2BAA2B;CACpH,IAAI,UAAU;CACd,MAAM,OAAA,GAAMC,QAAAA,SAAAA,CAAS,CAAC,CAAC;CACvB,KAAK,MAAM,WAAW,SAAS,MAAMD,UAAAA,QAAK,GAAG,GAAG;EAC9C,UAAUA,UAAAA,QAAK,KAAK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