@noopolis/daimon 0.1.1 → 0.2.0
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/README.md +307 -45
- package/dist/contracts/attentionContract.d.ts +117 -0
- package/dist/contracts/attentionContract.d.ts.map +1 -0
- package/dist/contracts/attentionContract.js +14 -0
- package/dist/contracts/canonicalJson.d.ts +3 -0
- package/dist/contracts/canonicalJson.d.ts.map +1 -0
- package/dist/contracts/canonicalJson.js +54 -0
- package/dist/contracts/grokWorkerContract.d.ts +74 -0
- package/dist/contracts/grokWorkerContract.d.ts.map +1 -0
- package/dist/contracts/grokWorkerContract.js +88 -0
- package/dist/contracts/organizationRuntimeContract.d.ts +765 -0
- package/dist/contracts/organizationRuntimeContract.d.ts.map +1 -0
- package/dist/contracts/organizationRuntimeContract.js +121 -0
- package/dist/contracts/runtimeContractManifest.d.ts +1615 -0
- package/dist/contracts/runtimeContractManifest.d.ts.map +1 -0
- package/dist/contracts/runtimeContractManifest.js +181 -0
- package/dist/core/credentialRedaction.d.ts +4 -0
- package/dist/core/credentialRedaction.d.ts.map +1 -0
- package/dist/core/credentialRedaction.js +28 -0
- package/dist/core/siblingBuildFreshness.d.ts +21 -0
- package/dist/core/siblingBuildFreshness.d.ts.map +1 -0
- package/dist/core/siblingBuildFreshness.js +25 -0
- package/dist/core/types.d.ts +10 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/examples/exampleCausalId.d.ts +3 -0
- package/dist/examples/exampleCausalId.d.ts.map +1 -0
- package/dist/examples/exampleCausalId.js +8 -0
- package/dist/examples/jungian-play-org.js +3 -2
- package/dist/examples/jungian-triad-org.js +3 -2
- package/dist/examples/jungianPlayAgent.d.ts +1 -1
- package/dist/examples/jungianPlayAgent.d.ts.map +1 -1
- package/dist/examples/jungianPlayAgent.js +1 -1
- package/dist/examples/jungianProfiles.d.ts +1 -1
- package/dist/examples/jungianProfiles.d.ts.map +1 -1
- package/dist/examples/jungianTriadProfiles.d.ts +1 -1
- package/dist/examples/jungianTriadProfiles.d.ts.map +1 -1
- package/dist/examples/pi-agent.js +3 -2
- package/dist/examples/pi-memory-org.js +6 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/mcp/toolServer.d.ts +31 -0
- package/dist/mcp/toolServer.d.ts.map +1 -0
- package/dist/mcp/toolServer.js +145 -0
- package/dist/observability/causalEvents.d.ts +118 -0
- package/dist/observability/causalEvents.d.ts.map +1 -0
- package/dist/observability/causalEvents.js +223 -0
- package/dist/observability/controlCausal.d.ts +117 -0
- package/dist/observability/controlCausal.d.ts.map +1 -0
- package/dist/observability/controlCausal.js +107 -0
- package/dist/observability/emitCausalFixture.d.ts +25 -0
- package/dist/observability/emitCausalFixture.d.ts.map +1 -0
- package/dist/observability/emitCausalFixture.js +98 -0
- package/dist/observability/index.d.ts +2 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +2 -0
- package/dist/observability/orgObserver.d.ts.map +1 -1
- package/dist/observability/orgObserver.js +3 -3
- package/dist/pi/agyHeadlessResult.d.ts +60 -0
- package/dist/pi/agyHeadlessResult.d.ts.map +1 -0
- package/dist/pi/agyHeadlessResult.js +95 -0
- package/dist/pi/cliChildOutput.d.ts +67 -0
- package/dist/pi/cliChildOutput.d.ts.map +1 -0
- package/dist/pi/cliChildOutput.js +269 -0
- package/dist/pi/cliEngineRun.d.ts +16 -0
- package/dist/pi/cliEngineRun.d.ts.map +1 -0
- package/dist/pi/cliEngineRun.js +27 -0
- package/dist/pi/cliEngineSpawn.d.ts +55 -0
- package/dist/pi/cliEngineSpawn.d.ts.map +1 -0
- package/dist/pi/cliEngineSpawn.js +164 -0
- package/dist/pi/cliEnvironment.d.ts +12 -0
- package/dist/pi/cliEnvironment.d.ts.map +1 -0
- package/dist/pi/cliEnvironment.js +32 -0
- package/dist/pi/cliMcpRegistration.d.ts +61 -0
- package/dist/pi/cliMcpRegistration.d.ts.map +1 -0
- package/dist/pi/cliMcpRegistration.js +75 -0
- package/dist/pi/cliProcess.d.ts +7 -0
- package/dist/pi/cliProcess.d.ts.map +1 -0
- package/dist/pi/cliProcess.js +132 -0
- package/dist/pi/cliSession.d.ts +106 -0
- package/dist/pi/cliSession.d.ts.map +1 -0
- package/dist/pi/cliSession.js +379 -0
- package/dist/pi/cliTurnMetering.d.ts +60 -0
- package/dist/pi/cliTurnMetering.d.ts.map +1 -0
- package/dist/pi/cliTurnMetering.js +60 -0
- package/dist/pi/codexFilesystemRules.d.ts +3 -0
- package/dist/pi/codexFilesystemRules.d.ts.map +1 -0
- package/dist/pi/codexFilesystemRules.js +28 -0
- package/dist/pi/codexHeadlessResult.d.ts +68 -0
- package/dist/pi/codexHeadlessResult.d.ts.map +1 -0
- package/dist/pi/codexHeadlessResult.js +122 -0
- package/dist/pi/codexRolloutUsage.d.ts +95 -0
- package/dist/pi/codexRolloutUsage.d.ts.map +1 -0
- package/dist/pi/codexRolloutUsage.js +221 -0
- package/dist/pi/engineWakeLimits.d.ts +39 -0
- package/dist/pi/engineWakeLimits.d.ts.map +1 -0
- package/dist/pi/engineWakeLimits.js +55 -0
- package/dist/pi/grokHeadlessResult.d.ts +36 -0
- package/dist/pi/grokHeadlessResult.d.ts.map +1 -0
- package/dist/pi/grokHeadlessResult.js +118 -0
- package/dist/pi/grokHomeMcpRegistration.d.ts +21 -0
- package/dist/pi/grokHomeMcpRegistration.d.ts.map +1 -0
- package/dist/pi/grokHomeMcpRegistration.js +57 -0
- package/dist/pi/grokSandbox.d.ts +11 -0
- package/dist/pi/grokSandbox.d.ts.map +1 -0
- package/dist/pi/grokSandbox.js +216 -0
- package/dist/pi/grokStreamUsage.d.ts +31 -0
- package/dist/pi/grokStreamUsage.d.ts.map +1 -0
- package/dist/pi/grokStreamUsage.js +51 -0
- package/dist/pi/index.d.ts +5 -0
- package/dist/pi/index.d.ts.map +1 -1
- package/dist/pi/index.js +5 -0
- package/dist/pi/memoryTools.d.ts +55 -1
- package/dist/pi/memoryTools.d.ts.map +1 -1
- package/dist/pi/memoryTools.js +144 -24
- package/dist/pi/modelRegistry.d.ts +13 -0
- package/dist/pi/modelRegistry.d.ts.map +1 -0
- package/dist/pi/modelRegistry.js +19 -0
- package/dist/pi/piAgentHandle.d.ts +46 -0
- package/dist/pi/piAgentHandle.d.ts.map +1 -0
- package/dist/pi/piAgentHandle.js +351 -0
- package/dist/pi/piAgentWakeSupport.d.ts +103 -0
- package/dist/pi/piAgentWakeSupport.d.ts.map +1 -0
- package/dist/pi/piAgentWakeSupport.js +151 -0
- package/dist/pi/piHarness.d.ts +40 -5
- package/dist/pi/piHarness.d.ts.map +1 -1
- package/dist/pi/piHarness.js +151 -256
- package/dist/pi/prompts.d.ts +10 -0
- package/dist/pi/prompts.d.ts.map +1 -0
- package/dist/pi/prompts.js +63 -0
- package/dist/pi/rawTrainingCapture.d.ts +59 -0
- package/dist/pi/rawTrainingCapture.d.ts.map +1 -0
- package/dist/pi/rawTrainingCapture.js +175 -0
- package/dist/pi/turnCausal.d.ts +73 -0
- package/dist/pi/turnCausal.d.ts.map +1 -0
- package/dist/pi/turnCausal.js +75 -0
- package/dist/pi/turnTrace.d.ts +128 -0
- package/dist/pi/turnTrace.d.ts.map +1 -0
- package/dist/pi/turnTrace.js +138 -0
- package/dist/pi/wakeAcceptance.d.ts +49 -0
- package/dist/pi/wakeAcceptance.d.ts.map +1 -0
- package/dist/pi/wakeAcceptance.js +281 -0
- package/dist/pi/wakeAcceptanceFs.d.ts +44 -0
- package/dist/pi/wakeAcceptanceFs.d.ts.map +1 -0
- package/dist/pi/wakeAcceptanceFs.js +318 -0
- package/dist/pi/wakeAcceptanceSchema.d.ts +75 -0
- package/dist/pi/wakeAcceptanceSchema.d.ts.map +1 -0
- package/dist/pi/wakeAcceptanceSchema.js +265 -0
- package/dist/pi/wakeModes.d.ts +9 -0
- package/dist/pi/wakeModes.d.ts.map +1 -0
- package/dist/pi/wakeModes.js +19 -0
- package/dist/pi/worldNudge.d.ts +22 -0
- package/dist/pi/worldNudge.d.ts.map +1 -0
- package/dist/pi/worldNudge.js +62 -0
- package/dist/pi/worldToolProtocol.d.ts +13 -0
- package/dist/pi/worldToolProtocol.d.ts.map +1 -0
- package/dist/pi/worldToolProtocol.js +49 -0
- package/dist/pi/worldTools.d.ts +32 -0
- package/dist/pi/worldTools.d.ts.map +1 -0
- package/dist/pi/worldTools.js +373 -0
- package/dist/pi/worldTrajectory.d.ts +52 -0
- package/dist/pi/worldTrajectory.d.ts.map +1 -0
- package/dist/pi/worldTrajectory.js +131 -0
- package/dist/runtime/agySubscriptionBootstrap.d.ts +16 -0
- package/dist/runtime/agySubscriptionBootstrap.d.ts.map +1 -0
- package/dist/runtime/agySubscriptionBootstrap.js +80 -0
- package/dist/runtime/agySubscriptionRealm.d.ts +38 -0
- package/dist/runtime/agySubscriptionRealm.d.ts.map +1 -0
- package/dist/runtime/agySubscriptionRealm.js +242 -0
- package/dist/runtime/attention.d.ts +21 -0
- package/dist/runtime/attention.d.ts.map +1 -0
- package/dist/runtime/attention.js +36 -0
- package/dist/runtime/attentionDispatcher.d.ts +66 -0
- package/dist/runtime/attentionDispatcher.d.ts.map +1 -0
- package/dist/runtime/attentionDispatcher.js +271 -0
- package/dist/runtime/cli.d.ts +7 -0
- package/dist/runtime/cli.d.ts.map +1 -0
- package/dist/runtime/cli.js +251 -0
- package/dist/runtime/codexSandboxProjection.d.ts +17 -0
- package/dist/runtime/codexSandboxProjection.d.ts.map +1 -0
- package/dist/runtime/codexSandboxProjection.js +40 -0
- package/dist/runtime/contract-manifest.json +1 -0
- package/dist/runtime/contract-manifest.sha256 +1 -0
- package/dist/runtime/contractManifest.d.ts +8 -0
- package/dist/runtime/contractManifest.d.ts.map +1 -0
- package/dist/runtime/contractManifest.js +4 -0
- package/dist/runtime/engineBrokerCapabilities.d.ts +30 -0
- package/dist/runtime/engineBrokerCapabilities.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCapabilities.js +59 -0
- package/dist/runtime/engineBrokerControlClient.d.ts +44 -0
- package/dist/runtime/engineBrokerControlClient.d.ts.map +1 -0
- package/dist/runtime/engineBrokerControlClient.js +132 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts +10 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCredentialJournal.js +17 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts +52 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerInferenceProtocol.js +65 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts +160 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpCallLog.js +219 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts +56 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpFacade.js +343 -0
- package/dist/runtime/engineBrokerNativeClient.d.ts +52 -0
- package/dist/runtime/engineBrokerNativeClient.d.ts.map +1 -0
- package/dist/runtime/engineBrokerNativeClient.js +151 -0
- package/dist/runtime/engineBrokerProtocol.d.ts +135 -0
- package/dist/runtime/engineBrokerProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerProtocol.js +274 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts +70 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts.map +1 -0
- package/dist/runtime/engineBrokerSealLedger.js +123 -0
- package/dist/runtime/engineBrokerService.d.ts +37 -0
- package/dist/runtime/engineBrokerService.d.ts.map +1 -0
- package/dist/runtime/engineBrokerService.js +138 -0
- package/dist/runtime/engineBrokerServiceCli.d.ts +5 -0
- package/dist/runtime/engineBrokerServiceCli.d.ts.map +1 -0
- package/dist/runtime/engineBrokerServiceCli.js +32 -0
- package/dist/runtime/engineBrokerServiceConfig.d.ts +50 -0
- package/dist/runtime/engineBrokerServiceConfig.d.ts.map +1 -0
- package/dist/runtime/engineBrokerServiceConfig.js +92 -0
- package/dist/runtime/engineBrokerSingleflight.d.ts +13 -0
- package/dist/runtime/engineBrokerSingleflight.d.ts.map +1 -0
- package/dist/runtime/engineBrokerSingleflight.js +24 -0
- package/dist/runtime/engineBrokerTurnAccounting.d.ts +76 -0
- package/dist/runtime/engineBrokerTurnAccounting.d.ts.map +1 -0
- package/dist/runtime/engineBrokerTurnAccounting.js +108 -0
- package/dist/runtime/engineBrokerTurnRegistry.d.ts +57 -0
- package/dist/runtime/engineBrokerTurnRegistry.d.ts.map +1 -0
- package/dist/runtime/engineBrokerTurnRegistry.js +158 -0
- package/dist/runtime/engineDispatcher.d.ts +36 -0
- package/dist/runtime/engineDispatcher.d.ts.map +1 -0
- package/dist/runtime/engineDispatcher.js +216 -0
- package/dist/runtime/engineReadiness.d.ts +23 -0
- package/dist/runtime/engineReadiness.d.ts.map +1 -0
- package/dist/runtime/engineReadiness.js +222 -0
- package/dist/runtime/grokAuthenticationError.d.ts +8 -0
- package/dist/runtime/grokAuthenticationError.d.ts.map +1 -0
- package/dist/runtime/grokAuthenticationError.js +20 -0
- package/dist/runtime/grokBrokerCredentialAuthority.d.ts +22 -0
- package/dist/runtime/grokBrokerCredentialAuthority.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialAuthority.js +124 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts +5 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialReader.js +37 -0
- package/dist/runtime/grokBrokerModelPolicy.d.ts +23 -0
- package/dist/runtime/grokBrokerModelPolicy.d.ts.map +1 -0
- package/dist/runtime/grokBrokerModelPolicy.js +28 -0
- package/dist/runtime/grokBrokerProjection.d.ts +106 -0
- package/dist/runtime/grokBrokerProjection.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProjection.js +94 -0
- package/dist/runtime/grokBrokerProxy.d.ts +55 -0
- package/dist/runtime/grokBrokerProxy.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxy.js +262 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts +30 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxyRequest.js +74 -0
- package/dist/runtime/grokBrokerRealmLease.d.ts +4 -0
- package/dist/runtime/grokBrokerRealmLease.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRealmLease.js +33 -0
- package/dist/runtime/grokBrokerRefresh.d.ts +2 -0
- package/dist/runtime/grokBrokerRefresh.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRefresh.js +15 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts +128 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts.map +1 -0
- package/dist/runtime/grokBrokerTurnMeter.js +251 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts +86 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts.map +1 -0
- package/dist/runtime/grokBrokerWorkerConfig.js +135 -0
- package/dist/runtime/grokEngineBroker.d.ts +48 -0
- package/dist/runtime/grokEngineBroker.d.ts.map +1 -0
- package/dist/runtime/grokEngineBroker.js +114 -0
- package/dist/runtime/grokEngineBrokerLedger.d.ts +52 -0
- package/dist/runtime/grokEngineBrokerLedger.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerLedger.js +114 -0
- package/dist/runtime/grokEngineBrokerMetering.d.ts +51 -0
- package/dist/runtime/grokEngineBrokerMetering.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerMetering.js +34 -0
- package/dist/runtime/grokEngineBrokerTurn.d.ts +58 -0
- package/dist/runtime/grokEngineBrokerTurn.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerTurn.js +165 -0
- package/dist/runtime/grokInferenceClientConfig.d.ts +41 -0
- package/dist/runtime/grokInferenceClientConfig.d.ts.map +1 -0
- package/dist/runtime/grokInferenceClientConfig.js +62 -0
- package/dist/runtime/grokInferenceGrants.d.ts +77 -0
- package/dist/runtime/grokInferenceGrants.d.ts.map +1 -0
- package/dist/runtime/grokInferenceGrants.js +116 -0
- package/dist/runtime/grokInferenceProxy.d.ts +29 -0
- package/dist/runtime/grokInferenceProxy.d.ts.map +1 -0
- package/dist/runtime/grokInferenceProxy.js +82 -0
- package/dist/runtime/grokInferenceProxyRequest.d.ts +23 -0
- package/dist/runtime/grokInferenceProxyRequest.d.ts.map +1 -0
- package/dist/runtime/grokInferenceProxyRequest.js +63 -0
- package/dist/runtime/grokSlotPreflightReceipt.d.ts +70 -0
- package/dist/runtime/grokSlotPreflightReceipt.d.ts.map +1 -0
- package/dist/runtime/grokSlotPreflightReceipt.js +101 -0
- package/dist/runtime/grokSubscriptionRealm.d.ts +4 -0
- package/dist/runtime/grokSubscriptionRealm.d.ts.map +1 -0
- package/dist/runtime/grokSubscriptionRealm.js +435 -0
- package/dist/runtime/grokSubscriptionRealmTypes.d.ts +26 -0
- package/dist/runtime/grokSubscriptionRealmTypes.d.ts.map +1 -0
- package/dist/runtime/grokSubscriptionRealmTypes.js +1 -0
- package/dist/runtime/grokWorkerAttestation.d.ts +170 -0
- package/dist/runtime/grokWorkerAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerAttestation.js +266 -0
- package/dist/runtime/grokWorkerDenyPlacement.d.ts +80 -0
- package/dist/runtime/grokWorkerDenyPlacement.d.ts.map +1 -0
- package/dist/runtime/grokWorkerDenyPlacement.js +128 -0
- package/dist/runtime/grokWorkerHomeAttestation.d.ts +30 -0
- package/dist/runtime/grokWorkerHomeAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerHomeAttestation.js +69 -0
- package/dist/runtime/grokWorkerSandboxProfile.d.ts +27 -0
- package/dist/runtime/grokWorkerSandboxProfile.d.ts.map +1 -0
- package/dist/runtime/grokWorkerSandboxProfile.js +44 -0
- package/dist/runtime/grokWorkerTmpAttestation.d.ts +55 -0
- package/dist/runtime/grokWorkerTmpAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerTmpAttestation.js +63 -0
- package/dist/runtime/index.d.ts +26 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +23 -0
- package/dist/runtime/inferenceUsageLedger.d.ts +38 -0
- package/dist/runtime/inferenceUsageLedger.d.ts.map +1 -0
- package/dist/runtime/inferenceUsageLedger.js +53 -0
- package/dist/runtime/mcpToolResult.d.ts +127 -0
- package/dist/runtime/mcpToolResult.d.ts.map +1 -0
- package/dist/runtime/mcpToolResult.js +214 -0
- package/dist/runtime/moltnetMachineRead.d.ts +97 -0
- package/dist/runtime/moltnetMachineRead.d.ts.map +1 -0
- package/dist/runtime/moltnetMachineRead.js +183 -0
- package/dist/runtime/native/daimon-engine-broker +0 -0
- package/dist/runtime/organizationRuntime.d.ts +165 -0
- package/dist/runtime/organizationRuntime.d.ts.map +1 -0
- package/dist/runtime/organizationRuntime.js +3 -0
- package/dist/runtime/organizationRuntimeControl.d.ts +42 -0
- package/dist/runtime/organizationRuntimeControl.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeControl.js +235 -0
- package/dist/runtime/organizationRuntimeHost.d.ts +19 -0
- package/dist/runtime/organizationRuntimeHost.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeHost.js +359 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts +6 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeParsing.js +370 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts +12 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeReadiness.js +59 -0
- package/dist/runtime/physicalReadiness.d.ts +47 -0
- package/dist/runtime/physicalReadiness.d.ts.map +1 -0
- package/dist/runtime/physicalReadiness.js +142 -0
- package/dist/runtime/portableCredentialAuth.d.ts +6 -0
- package/dist/runtime/portableCredentialAuth.d.ts.map +1 -0
- package/dist/runtime/portableCredentialAuth.js +70 -0
- package/dist/runtime/portableCredentialMaterial.d.ts +8 -0
- package/dist/runtime/portableCredentialMaterial.d.ts.map +1 -0
- package/dist/runtime/portableCredentialMaterial.js +169 -0
- package/dist/runtime/productionAgentTools.d.ts +5 -0
- package/dist/runtime/productionAgentTools.d.ts.map +1 -0
- package/dist/runtime/productionAgentTools.js +328 -0
- package/dist/runtime/runtimeHomeLayout.d.ts +48 -0
- package/dist/runtime/runtimeHomeLayout.d.ts.map +1 -0
- package/dist/runtime/runtimeHomeLayout.js +84 -0
- package/dist/runtime/schedule.d.ts +40 -0
- package/dist/runtime/schedule.d.ts.map +1 -0
- package/dist/runtime/schedule.js +371 -0
- package/dist/runtime/storeCoordination.d.ts +23 -0
- package/dist/runtime/storeCoordination.d.ts.map +1 -0
- package/dist/runtime/storeCoordination.js +94 -0
- package/dist/runtime/toolResultSpill.d.ts +152 -0
- package/dist/runtime/toolResultSpill.d.ts.map +1 -0
- package/dist/runtime/toolResultSpill.js +351 -0
- package/dist/runtime/turnRequestLedger.d.ts +160 -0
- package/dist/runtime/turnRequestLedger.d.ts.map +1 -0
- package/dist/runtime/turnRequestLedger.js +249 -0
- package/dist/runtime/turnUsageLedger.d.ts +143 -0
- package/dist/runtime/turnUsageLedger.d.ts.map +1 -0
- package/dist/runtime/turnUsageLedger.js +203 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts +17 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.js +50 -0
- package/dist/runtime/wakeAcceptanceReconciliation.d.ts +211 -0
- package/dist/runtime/wakeAcceptanceReconciliation.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceReconciliation.js +289 -0
- package/dist/runtime/wakeAcceptanceRecord.d.ts +23 -0
- package/dist/runtime/wakeAcceptanceRecord.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRecord.js +56 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts +12 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRetention.js +12 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts +113 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceStore.js +558 -0
- package/dist/runtime/wakeAcceptanceTypes.d.ts +179 -0
- package/dist/runtime/wakeAcceptanceTypes.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceTypes.js +95 -0
- package/dist/runtime/wakeFuse.d.ts +69 -0
- package/dist/runtime/wakeFuse.d.ts.map +1 -0
- package/dist/runtime/wakeFuse.js +367 -0
- package/package.json +25 -17
- package/dist/examples/mixed-engine-org.d.ts +0 -2
- package/dist/examples/mixed-engine-org.d.ts.map +0 -1
- package/dist/examples/mixed-engine-org.js +0 -351
- package/dist/examples/mixedEngineCli.d.ts +0 -15
- package/dist/examples/mixedEngineCli.d.ts.map +0 -1
- package/dist/examples/mixedEngineCli.js +0 -174
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowering an upstream MCP server's `CallToolResult` onto a Pi tool result.
|
|
3
|
+
*
|
|
4
|
+
* Every `mcp_*` tool is a *passthrough*: Daimon calls a declared MCP server and
|
|
5
|
+
* has to hand the model back what that server actually said. It used to hand
|
|
6
|
+
* back routing metadata instead — `details: { server, tool, is_error }` — and
|
|
7
|
+
* because the MCP mount lowers `details` to `structuredContent`
|
|
8
|
+
* (`src/mcp/toolServer.ts`) and the engines render `structuredContent` in
|
|
9
|
+
* preference to `content`, an agent calling any declared MCP tool saw
|
|
10
|
+
* `{"server":"newsroom","tool":"file_article","is_error":true}` and nothing
|
|
11
|
+
* else. The tool's own answer, and the reason for its own failure, never
|
|
12
|
+
* reached the model. `moltnet_read` was the same defect in a Daimon-authored
|
|
13
|
+
* tool; this is the wider one, in the tools Daimon does not author.
|
|
14
|
+
*
|
|
15
|
+
* Three rules follow, and they are the whole design:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Both channels always carry the payload.** `content` and
|
|
18
|
+
* `structuredContent` are each filled with the result, mirroring whichever
|
|
19
|
+
* one the server did not send. Daimon has already been wrong once about
|
|
20
|
+
* which channel an engine renders; carrying the answer in both is the only
|
|
21
|
+
* shape where being wrong again costs nothing. A server that sent
|
|
22
|
+
* `structuredContent` gets it forwarded *verbatim*, so a declared
|
|
23
|
+
* `outputSchema` still describes what the model sees.
|
|
24
|
+
*
|
|
25
|
+
* 2. **`isError` is raised, not reported.** Pi's `AgentToolResult` has no
|
|
26
|
+
* error channel — a Pi tool signals failure by throwing, and
|
|
27
|
+
* `toolServer.ts` lowers a throw to `isError: true` plus the message. So an
|
|
28
|
+
* upstream `isError: true` becomes a thrown {@link McpToolCallError}
|
|
29
|
+
* carrying the server's own reason text. The model then gets a result
|
|
30
|
+
* flagged as a failure *and* the sentence explaining it, which is the
|
|
31
|
+
* difference between correcting a call and guessing at it.
|
|
32
|
+
*
|
|
33
|
+
* 3. **The bound truncates; it never throws the payload away.** An oversized
|
|
34
|
+
* result used to be refused outright, so the agent got
|
|
35
|
+
* `Error: MCP tool result exceeds bound` and none of the data. It is now
|
|
36
|
+
* degraded to a head of the serialized result plus an explicit marker
|
|
37
|
+
* naming both sizes.
|
|
38
|
+
*
|
|
39
|
+
* Daimon deliberately does *not* re-declare the upstream `outputSchema` on its
|
|
40
|
+
* own mount. A declared output schema obliges every result to carry conforming
|
|
41
|
+
* `structuredContent`, which neither a content-only server response nor rule 3's
|
|
42
|
+
* truncation marker can satisfy — declaring it would turn a degraded result into
|
|
43
|
+
* a client-side protocol error and lose the payload all over again.
|
|
44
|
+
*/
|
|
45
|
+
/** Bound on the whole receipt record, mirrored from `productionAgentTools.ts`. */
|
|
46
|
+
const MAX_RECEIPT_BYTES = 65_536;
|
|
47
|
+
/**
|
|
48
|
+
* Headroom left inside the receipt bound for the receipt's own envelope.
|
|
49
|
+
*
|
|
50
|
+
* A successful MCP result is stored in its receipt so a replayed identical call
|
|
51
|
+
* in the same wake answers with the result rather than with a digest of it. The
|
|
52
|
+
* envelope (`kind`, ids, engine, server, tool, digest, `is_error`, `at`) is a
|
|
53
|
+
* few hundred bytes for any sane name; 4096 is generous enough that a stored
|
|
54
|
+
* result can never push the receipt past its own bound.
|
|
55
|
+
*/
|
|
56
|
+
export const MCP_RECEIPT_ENVELOPE_RESERVE_BYTES = 4_096;
|
|
57
|
+
/** Bound on one lowered MCP tool result, model-facing and receipt-facing alike. */
|
|
58
|
+
export const MCP_TOOL_RESULT_MAX_BYTES = MAX_RECEIPT_BYTES - MCP_RECEIPT_ENVELOPE_RESERVE_BYTES;
|
|
59
|
+
/** Rendered for a server that answered with neither content nor structured content. */
|
|
60
|
+
export const MCP_EMPTY_RESULT_TEXT = "[daimon: the MCP server returned a result with no content]";
|
|
61
|
+
/** Reason used when a server flags an error but supplies no text for it. */
|
|
62
|
+
export const MCP_ERROR_WITHOUT_DETAIL = "the MCP server reported an error and gave no reason";
|
|
63
|
+
/**
|
|
64
|
+
* An upstream MCP tool that answered with `isError: true`.
|
|
65
|
+
*
|
|
66
|
+
* The reason is the server's own words. `toolServer.ts` renders a thrown error
|
|
67
|
+
* as `"<name>: <message>"` inside an `isError: true` result, so the model
|
|
68
|
+
* receives both the failure flag and the explanation.
|
|
69
|
+
*/
|
|
70
|
+
export class McpToolCallError extends Error {
|
|
71
|
+
server;
|
|
72
|
+
tool;
|
|
73
|
+
reason;
|
|
74
|
+
constructor(server, tool, reason) {
|
|
75
|
+
super(`${server}/${tool} failed: ${reason}`);
|
|
76
|
+
this.name = "McpToolCallError";
|
|
77
|
+
this.server = server;
|
|
78
|
+
this.tool = tool;
|
|
79
|
+
this.reason = reason;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
|
+
/** Flatten an MCP content array to text, naming the parts that are not text. */
|
|
84
|
+
export function mcpContentText(content) {
|
|
85
|
+
if (!Array.isArray(content))
|
|
86
|
+
return "";
|
|
87
|
+
return content
|
|
88
|
+
.map((part) => {
|
|
89
|
+
if (!isRecord(part))
|
|
90
|
+
return "";
|
|
91
|
+
if (part.type === "text" && typeof part.text === "string")
|
|
92
|
+
return part.text;
|
|
93
|
+
return `[${typeof part.type === "string" ? part.type : "unknown"} content part]`;
|
|
94
|
+
})
|
|
95
|
+
.filter((text) => text.length > 0)
|
|
96
|
+
.join("\n");
|
|
97
|
+
}
|
|
98
|
+
/** Truncate to a byte budget without splitting a UTF-8 code point. */
|
|
99
|
+
export function truncateUtf8(value, maxBytes) {
|
|
100
|
+
const bytes = Buffer.from(value, "utf8");
|
|
101
|
+
if (bytes.byteLength <= maxBytes)
|
|
102
|
+
return { text: value, truncated: false, originalBytes: bytes.byteLength };
|
|
103
|
+
let end = Math.max(0, maxBytes);
|
|
104
|
+
while (end > 0 && (bytes[end] & 0xc0) === 0x80)
|
|
105
|
+
end -= 1;
|
|
106
|
+
return { text: bytes.subarray(0, end).toString("utf8"), truncated: true, originalBytes: bytes.byteLength };
|
|
107
|
+
}
|
|
108
|
+
const truncationMarker = (resultBytes, boundBytes) => `\n[daimon: truncated — the MCP tool result was ${resultBytes} bytes, above the ${boundBytes}-byte tool result bound]`;
|
|
109
|
+
/**
|
|
110
|
+
* The server's own explanation for an `isError: true` result.
|
|
111
|
+
*
|
|
112
|
+
* Both channels are consulted, because a server may put a human sentence in
|
|
113
|
+
* `content` and a machine-readable code in `structuredContent`, and an agent
|
|
114
|
+
* that has to fix its own call needs whichever one it was given.
|
|
115
|
+
*/
|
|
116
|
+
export function mcpErrorReason(result, maxBytes) {
|
|
117
|
+
const text = mcpContentText(result.content);
|
|
118
|
+
const structured = result.structuredContent === undefined ? "" : safeStringify(result.structuredContent);
|
|
119
|
+
const reason = [text, structured].filter((piece) => piece.length > 0).join(" ");
|
|
120
|
+
if (reason.length === 0)
|
|
121
|
+
return MCP_ERROR_WITHOUT_DETAIL;
|
|
122
|
+
const bounded = truncateUtf8(reason, maxBytes);
|
|
123
|
+
return bounded.truncated ? `${bounded.text}${truncationMarker(bounded.originalBytes, maxBytes)}` : bounded.text;
|
|
124
|
+
}
|
|
125
|
+
function safeStringify(value) {
|
|
126
|
+
try {
|
|
127
|
+
return JSON.stringify(value) ?? "";
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
return "[daimon: the MCP server returned a value that is not JSON-serialisable]";
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Everything a result carries beyond the three fields this module names. */
|
|
134
|
+
function otherFields(result) {
|
|
135
|
+
if (!isRecord(result))
|
|
136
|
+
return undefined;
|
|
137
|
+
const rest = Object.fromEntries(Object.entries(result).filter(([key]) => key !== "content" && key !== "structuredContent" && key !== "isError"));
|
|
138
|
+
return Object.keys(rest).length === 0 ? undefined : rest;
|
|
139
|
+
}
|
|
140
|
+
const measure = (content, details) => Buffer.byteLength(safeStringify({ content, structuredContent: details }), "utf8");
|
|
141
|
+
/**
|
|
142
|
+
* Lower one upstream result, or throw {@link McpToolCallError} when it is an
|
|
143
|
+
* error result.
|
|
144
|
+
*/
|
|
145
|
+
export function renderMcpToolResult(input) {
|
|
146
|
+
const maxBytes = input.maxBytes ?? MCP_TOOL_RESULT_MAX_BYTES;
|
|
147
|
+
if (input.result.isError === true) {
|
|
148
|
+
throw new McpToolCallError(input.server, input.tool, mcpErrorReason(input.result, Math.floor(maxBytes / 2)));
|
|
149
|
+
}
|
|
150
|
+
const upstreamContent = Array.isArray(input.result.content) ? input.result.content : undefined;
|
|
151
|
+
// A server predating the `content` field answers in some other shape entirely
|
|
152
|
+
// (the SDK still types `toolResult` for those). Forward whatever it did send
|
|
153
|
+
// rather than reporting an empty result over the top of a real one.
|
|
154
|
+
const legacy = upstreamContent === undefined && !isRecord(input.result.structuredContent) ? otherFields(input.result) : undefined;
|
|
155
|
+
const structured = isRecord(input.result.structuredContent) ? input.result.structuredContent : legacy;
|
|
156
|
+
const content = upstreamContent !== undefined && upstreamContent.length > 0
|
|
157
|
+
? upstreamContent
|
|
158
|
+
: structured !== undefined
|
|
159
|
+
? [{ type: "text", text: safeStringify(structured) }]
|
|
160
|
+
: [{ type: "text", text: MCP_EMPTY_RESULT_TEXT }];
|
|
161
|
+
// Rule 1: the channel the server left empty mirrors the one it filled, so the
|
|
162
|
+
// payload is present whichever one the engine chooses to render.
|
|
163
|
+
const details = structured ?? { content: upstreamContent ?? [] };
|
|
164
|
+
if (measure(content, details) <= maxBytes)
|
|
165
|
+
return { content, details, truncated: false };
|
|
166
|
+
return degrade(input.result, measure(content, details), maxBytes);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Rule 3: an oversized result becomes a bounded head of itself plus a marker.
|
|
170
|
+
*
|
|
171
|
+
* Both channels still mirror each other, so the head is written twice; the
|
|
172
|
+
* budget is halved to pay for that and then shrunk until the whole record
|
|
173
|
+
* genuinely fits, rather than trusting an estimate of the JSON overhead.
|
|
174
|
+
*/
|
|
175
|
+
function degrade(result, resultBytes, maxBytes) {
|
|
176
|
+
const serialized = safeStringify({
|
|
177
|
+
...(result.content === undefined ? {} : { content: result.content }),
|
|
178
|
+
...(result.structuredContent === undefined ? {} : { structured_content: result.structuredContent })
|
|
179
|
+
});
|
|
180
|
+
const marker = truncationMarker(resultBytes, maxBytes);
|
|
181
|
+
const build = (head) => ({
|
|
182
|
+
content: [{ type: "text", text: `${head}${marker}` }],
|
|
183
|
+
details: { daimon_truncated: true, bound_bytes: maxBytes, result_bytes: resultBytes, result_json_head: head },
|
|
184
|
+
truncated: true
|
|
185
|
+
});
|
|
186
|
+
let budget = Math.max(0, Math.floor(maxBytes / 2));
|
|
187
|
+
let candidate = build(truncateUtf8(serialized, budget).text);
|
|
188
|
+
for (let attempt = 0; attempt < 8 && budget > 0; attempt += 1) {
|
|
189
|
+
const size = measure(candidate.content, candidate.details);
|
|
190
|
+
if (size <= maxBytes)
|
|
191
|
+
return candidate;
|
|
192
|
+
budget = Math.max(0, budget - Math.ceil((size - maxBytes) / 2) - 16);
|
|
193
|
+
candidate = build(truncateUtf8(serialized, budget).text);
|
|
194
|
+
}
|
|
195
|
+
return candidate;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Rebuild a tool answer from a receipt written by an earlier identical call.
|
|
199
|
+
*
|
|
200
|
+
* The wake-scoped receipt exists so a repeated identical call is not sent
|
|
201
|
+
* upstream twice. It used to be *returned* to the model in place of the result,
|
|
202
|
+
* so a retried call answered with `{"kind":"mcp",…,"digest":"sha256:…"}` — the
|
|
203
|
+
* least useful thing an agent stuck in a retry loop could possibly receive.
|
|
204
|
+
* A recorded failure is replayed as the same failure, with the same reason.
|
|
205
|
+
*/
|
|
206
|
+
export function replayMcpReceipt(server, tool, receipt) {
|
|
207
|
+
if (typeof receipt.error === "string")
|
|
208
|
+
throw new McpToolCallError(server, tool, receipt.error);
|
|
209
|
+
const stored = receipt.result;
|
|
210
|
+
if (isRecord(stored) && Array.isArray(stored.content) && isRecord(stored.details)) {
|
|
211
|
+
return { content: stored.content, details: stored.details, truncated: receipt.truncated === true };
|
|
212
|
+
}
|
|
213
|
+
throw new McpToolCallError(server, tool, "an identical earlier call in this wake was recorded without its result, so it cannot be replayed; change the arguments to make a new call");
|
|
214
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paging and error semantics for Moltnet's frozen `machine` read wire.
|
|
3
|
+
*
|
|
4
|
+
* The wire is a strict v1 with two caps that a naive read ignores, and both are
|
|
5
|
+
* enforced *server side* by `projectRead` in the Moltnet CLI
|
|
6
|
+
* (`moltnet/internal/machine/service.go`), which answers
|
|
7
|
+
* `{"error":{"code":"transport"}}` rather than truncating:
|
|
8
|
+
*
|
|
9
|
+
* - `MachineMaxOutputLineBytes` (16384) bounds the whole encoded response
|
|
10
|
+
* line. `MachineReadPage.Validate` measures it against a *worst case*
|
|
11
|
+
* envelope — a maximum-length correlation id and target id — so the
|
|
12
|
+
* effective payload budget is roughly 250 bytes tighter than the line an
|
|
13
|
+
* agent actually receives.
|
|
14
|
+
* - `MachineMaxReadPartTextBytes` (4096) bounds any single message part.
|
|
15
|
+
*
|
|
16
|
+
* An agent asking for `limit: 100` on a room of six ~2000-byte messages
|
|
17
|
+
* therefore never got a page at all: seven such messages already overflow the
|
|
18
|
+
* line. Reading in small pages and following the returned cursor is the only
|
|
19
|
+
* way to get a busy room across this wire, so that behaviour lives here rather
|
|
20
|
+
* than in the tool that happens to call it.
|
|
21
|
+
*/
|
|
22
|
+
/** `protocol.MachineMaxOutputLineBytes`, quoted for diagnostics only. */
|
|
23
|
+
export declare const MOLTNET_MACHINE_MAX_OUTPUT_LINE_BYTES = 16384;
|
|
24
|
+
/** `protocol.MachineMaxReadPartTextBytes`, quoted for diagnostics only. */
|
|
25
|
+
export declare const MOLTNET_MACHINE_MAX_READ_PART_TEXT_BYTES = 4096;
|
|
26
|
+
/**
|
|
27
|
+
* Messages requested per wire page.
|
|
28
|
+
*
|
|
29
|
+
* Six ~2000-byte messages were the largest page observed to encode inside the
|
|
30
|
+
* line cap against the real 0.1.17 binary, so five leaves headroom for a page
|
|
31
|
+
* of unusually large messages before the adaptive halving below is needed.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MOLTNET_READ_PAGE_LIMIT = 5;
|
|
34
|
+
/** Hard stop on wire round trips, so a misbehaving cursor cannot spin forever. */
|
|
35
|
+
export declare const MOLTNET_READ_MAX_PAGES = 64;
|
|
36
|
+
/**
|
|
37
|
+
* A `machine` response that carried `error.code`.
|
|
38
|
+
*
|
|
39
|
+
* The code is the whole diagnosis — a `transport` is a cap overflow, a
|
|
40
|
+
* `not_found` is an undeclared target, a `canceled` is a stdin race — and
|
|
41
|
+
* collapsing all of them into one generic string is what hid a never-working
|
|
42
|
+
* tool for as long as it did.
|
|
43
|
+
*/
|
|
44
|
+
export declare class MoltnetMachineError extends Error {
|
|
45
|
+
readonly code: string;
|
|
46
|
+
constructor(operation: string, code: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Unwrap one `machine` response, surfacing `error.code` as a thrown
|
|
50
|
+
* {@link MoltnetMachineError} rather than an anonymous refusal.
|
|
51
|
+
*/
|
|
52
|
+
export declare function moltnetOperationResult(response: Record<string, unknown>, key: string, operation: string): Record<string, unknown> | undefined;
|
|
53
|
+
export interface MoltnetReadWirePage {
|
|
54
|
+
readonly messages: readonly unknown[];
|
|
55
|
+
readonly hasMore: boolean;
|
|
56
|
+
readonly nextBefore?: string;
|
|
57
|
+
readonly nextAfter?: string;
|
|
58
|
+
readonly target?: unknown;
|
|
59
|
+
}
|
|
60
|
+
export type MoltnetReadFetch = (request: {
|
|
61
|
+
readonly limit: number;
|
|
62
|
+
readonly before?: string;
|
|
63
|
+
readonly after?: string;
|
|
64
|
+
}) => Promise<MoltnetReadWirePage>;
|
|
65
|
+
export interface MoltnetReadTruncation {
|
|
66
|
+
readonly reason: "message_exceeds_machine_wire_caps" | "result_bound" | "page_bound";
|
|
67
|
+
readonly detail: string;
|
|
68
|
+
readonly cursor?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface MoltnetPagedRead {
|
|
71
|
+
readonly target?: unknown;
|
|
72
|
+
readonly messages: readonly unknown[];
|
|
73
|
+
readonly hasMore: boolean;
|
|
74
|
+
readonly nextBefore?: string;
|
|
75
|
+
readonly nextAfter?: string;
|
|
76
|
+
readonly pages: number;
|
|
77
|
+
readonly truncated?: MoltnetReadTruncation;
|
|
78
|
+
}
|
|
79
|
+
export interface MoltnetPagedReadOptions {
|
|
80
|
+
readonly requested: number;
|
|
81
|
+
readonly before?: string;
|
|
82
|
+
readonly after?: string;
|
|
83
|
+
readonly maxBytes: number;
|
|
84
|
+
readonly pageLimit?: number;
|
|
85
|
+
readonly fetch: MoltnetReadFetch;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Read `requested` messages by walking the wire in pages small enough to encode.
|
|
89
|
+
*
|
|
90
|
+
* Direction follows the caller's cursor: an `after` read walks forward through
|
|
91
|
+
* `next_after`, everything else walks backward from the newest message through
|
|
92
|
+
* `next_before`. Either way the returned messages are in one stable
|
|
93
|
+
* chronological order, oldest first, matching the order a single page arrives
|
|
94
|
+
* in.
|
|
95
|
+
*/
|
|
96
|
+
export declare function readMoltnetPages(options: MoltnetPagedReadOptions): Promise<MoltnetPagedRead>;
|
|
97
|
+
//# sourceMappingURL=moltnetMachineRead.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moltnetMachineRead.d.ts","sourceRoot":"","sources":["../../src/runtime/moltnetMachineRead.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,yEAAyE;AACzE,eAAO,MAAM,qCAAqC,QAAS,CAAC;AAC5D,2EAA2E;AAC3E,eAAO,MAAM,wCAAwC,OAAQ,CAAC;AAC9D;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEV,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAKnD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAUrC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,gBAAgB,GAAG,CAC7B,OAAO,EAAE;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KACnF,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,mCAAmC,GAAG,cAAc,GAAG,YAAY,CAAC;IACrF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuElG"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Paging and error semantics for Moltnet's frozen `machine` read wire.
|
|
3
|
+
*
|
|
4
|
+
* The wire is a strict v1 with two caps that a naive read ignores, and both are
|
|
5
|
+
* enforced *server side* by `projectRead` in the Moltnet CLI
|
|
6
|
+
* (`moltnet/internal/machine/service.go`), which answers
|
|
7
|
+
* `{"error":{"code":"transport"}}` rather than truncating:
|
|
8
|
+
*
|
|
9
|
+
* - `MachineMaxOutputLineBytes` (16384) bounds the whole encoded response
|
|
10
|
+
* line. `MachineReadPage.Validate` measures it against a *worst case*
|
|
11
|
+
* envelope — a maximum-length correlation id and target id — so the
|
|
12
|
+
* effective payload budget is roughly 250 bytes tighter than the line an
|
|
13
|
+
* agent actually receives.
|
|
14
|
+
* - `MachineMaxReadPartTextBytes` (4096) bounds any single message part.
|
|
15
|
+
*
|
|
16
|
+
* An agent asking for `limit: 100` on a room of six ~2000-byte messages
|
|
17
|
+
* therefore never got a page at all: seven such messages already overflow the
|
|
18
|
+
* line. Reading in small pages and following the returned cursor is the only
|
|
19
|
+
* way to get a busy room across this wire, so that behaviour lives here rather
|
|
20
|
+
* than in the tool that happens to call it.
|
|
21
|
+
*/
|
|
22
|
+
/** `protocol.MachineMaxOutputLineBytes`, quoted for diagnostics only. */
|
|
23
|
+
export const MOLTNET_MACHINE_MAX_OUTPUT_LINE_BYTES = 16_384;
|
|
24
|
+
/** `protocol.MachineMaxReadPartTextBytes`, quoted for diagnostics only. */
|
|
25
|
+
export const MOLTNET_MACHINE_MAX_READ_PART_TEXT_BYTES = 4_096;
|
|
26
|
+
/**
|
|
27
|
+
* Messages requested per wire page.
|
|
28
|
+
*
|
|
29
|
+
* Six ~2000-byte messages were the largest page observed to encode inside the
|
|
30
|
+
* line cap against the real 0.1.17 binary, so five leaves headroom for a page
|
|
31
|
+
* of unusually large messages before the adaptive halving below is needed.
|
|
32
|
+
*/
|
|
33
|
+
export const MOLTNET_READ_PAGE_LIMIT = 5;
|
|
34
|
+
/** Hard stop on wire round trips, so a misbehaving cursor cannot spin forever. */
|
|
35
|
+
export const MOLTNET_READ_MAX_PAGES = 64;
|
|
36
|
+
/**
|
|
37
|
+
* A `machine` response that carried `error.code`.
|
|
38
|
+
*
|
|
39
|
+
* The code is the whole diagnosis — a `transport` is a cap overflow, a
|
|
40
|
+
* `not_found` is an undeclared target, a `canceled` is a stdin race — and
|
|
41
|
+
* collapsing all of them into one generic string is what hid a never-working
|
|
42
|
+
* tool for as long as it did.
|
|
43
|
+
*/
|
|
44
|
+
export class MoltnetMachineError extends Error {
|
|
45
|
+
code;
|
|
46
|
+
constructor(operation, code) {
|
|
47
|
+
super(`Moltnet ${operation} failed: ${code}`);
|
|
48
|
+
this.name = "MoltnetMachineError";
|
|
49
|
+
this.code = code;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Unwrap one `machine` response, surfacing `error.code` as a thrown
|
|
54
|
+
* {@link MoltnetMachineError} rather than an anonymous refusal.
|
|
55
|
+
*/
|
|
56
|
+
export function moltnetOperationResult(response, key, operation) {
|
|
57
|
+
const error = response.error;
|
|
58
|
+
if (error !== undefined && error !== null) {
|
|
59
|
+
const code = typeof error === "object" && typeof error.code === "string"
|
|
60
|
+
? error.code
|
|
61
|
+
: "unknown";
|
|
62
|
+
throw new MoltnetMachineError(operation, code);
|
|
63
|
+
}
|
|
64
|
+
const result = response[key];
|
|
65
|
+
return typeof result === "object" && result !== null ? result : undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Read `requested` messages by walking the wire in pages small enough to encode.
|
|
69
|
+
*
|
|
70
|
+
* Direction follows the caller's cursor: an `after` read walks forward through
|
|
71
|
+
* `next_after`, everything else walks backward from the newest message through
|
|
72
|
+
* `next_before`. Either way the returned messages are in one stable
|
|
73
|
+
* chronological order, oldest first, matching the order a single page arrives
|
|
74
|
+
* in.
|
|
75
|
+
*/
|
|
76
|
+
export async function readMoltnetPages(options) {
|
|
77
|
+
const forward = options.after !== undefined;
|
|
78
|
+
const pageLimit = Math.max(1, options.pageLimit ?? MOLTNET_READ_PAGE_LIMIT);
|
|
79
|
+
const collected = [];
|
|
80
|
+
const visited = new Set();
|
|
81
|
+
let cursor = forward ? options.after : options.before;
|
|
82
|
+
let target;
|
|
83
|
+
let total = 0;
|
|
84
|
+
let pages = 0;
|
|
85
|
+
let bytes = 0;
|
|
86
|
+
let hasMore = false;
|
|
87
|
+
let nextCursor;
|
|
88
|
+
let truncated;
|
|
89
|
+
while (total < options.requested && pages < MOLTNET_READ_MAX_PAGES) {
|
|
90
|
+
const wanted = Math.min(pageLimit, options.requested - total);
|
|
91
|
+
const page = await fetchWithinCaps(options.fetch, wanted, forward, cursor);
|
|
92
|
+
if (page instanceof MoltnetMachineError) {
|
|
93
|
+
// A cursor the caller supplied that yields nothing is a bad cursor, not a
|
|
94
|
+
// message too large to encode: the two are indistinguishable on this wire
|
|
95
|
+
// (both are `transport`), and an empty truncated read hides the mistake
|
|
96
|
+
// where the code names it.
|
|
97
|
+
if (pages === 0 && (options.before !== undefined || options.after !== undefined))
|
|
98
|
+
throw page;
|
|
99
|
+
truncated = oversizedMessage(cursor);
|
|
100
|
+
hasMore = true;
|
|
101
|
+
nextCursor = cursor;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
const pageBytes = Buffer.byteLength(JSON.stringify(page.messages));
|
|
105
|
+
if (pages > 0 && bytes + pageBytes > options.maxBytes) {
|
|
106
|
+
truncated = {
|
|
107
|
+
reason: "result_bound",
|
|
108
|
+
detail: `the concatenated read reached the ${options.maxBytes} byte tool result bound`,
|
|
109
|
+
...(cursor === undefined ? {} : { cursor })
|
|
110
|
+
};
|
|
111
|
+
hasMore = true;
|
|
112
|
+
nextCursor = cursor;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (target === undefined)
|
|
116
|
+
target = page.target;
|
|
117
|
+
collected.push(page.messages);
|
|
118
|
+
bytes += pageBytes;
|
|
119
|
+
total += page.messages.length;
|
|
120
|
+
pages += 1;
|
|
121
|
+
const next = forward ? page.nextAfter : page.nextBefore;
|
|
122
|
+
const resumable = page.hasMore && typeof next === "string" && next.length > 0;
|
|
123
|
+
hasMore = resumable;
|
|
124
|
+
nextCursor = resumable ? next : undefined;
|
|
125
|
+
// A repeated cursor or an empty page means the wire stopped making
|
|
126
|
+
// progress; continuing would spin without ever satisfying `requested`.
|
|
127
|
+
if (!resumable || page.messages.length === 0 || visited.has(next))
|
|
128
|
+
break;
|
|
129
|
+
visited.add(next);
|
|
130
|
+
cursor = next;
|
|
131
|
+
}
|
|
132
|
+
if (hasMore && truncated === undefined && pages >= MOLTNET_READ_MAX_PAGES) {
|
|
133
|
+
truncated = {
|
|
134
|
+
reason: "page_bound",
|
|
135
|
+
detail: `the read stopped after ${MOLTNET_READ_MAX_PAGES} wire pages`,
|
|
136
|
+
...(nextCursor === undefined ? {} : { cursor: nextCursor })
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
...(target === undefined ? {} : { target }),
|
|
141
|
+
messages: forward ? collected.flat() : collected.reverse().flat(),
|
|
142
|
+
hasMore,
|
|
143
|
+
...(nextCursor === undefined ? {} : forward ? { nextAfter: nextCursor } : { nextBefore: nextCursor }),
|
|
144
|
+
pages,
|
|
145
|
+
...(truncated === undefined ? {} : { truncated })
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Fetch one page, halving the requested limit on every `transport` refusal.
|
|
150
|
+
*
|
|
151
|
+
* A returned {@link MoltnetMachineError} means even a single message could not
|
|
152
|
+
* be projected onto the wire. The wire offers no way to name or skip that
|
|
153
|
+
* message — a cursor only ever comes back inside a page that encoded — so the
|
|
154
|
+
* caller decides between reporting the blockage and failing outright.
|
|
155
|
+
*/
|
|
156
|
+
async function fetchWithinCaps(fetch, wanted, forward, cursor) {
|
|
157
|
+
let limit = wanted;
|
|
158
|
+
for (;;) {
|
|
159
|
+
try {
|
|
160
|
+
return await fetch({
|
|
161
|
+
limit,
|
|
162
|
+
...(cursor === undefined ? {} : forward ? { after: cursor } : { before: cursor })
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
if (!(error instanceof MoltnetMachineError) || error.code !== "transport")
|
|
167
|
+
throw error;
|
|
168
|
+
if (limit <= 1)
|
|
169
|
+
return error;
|
|
170
|
+
limit = Math.max(1, Math.floor(limit / 2));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function oversizedMessage(cursor) {
|
|
175
|
+
return {
|
|
176
|
+
reason: "message_exceeds_machine_wire_caps",
|
|
177
|
+
detail: "one Moltnet message could not be encoded onto the machine read wire"
|
|
178
|
+
+ ` (part text limit ${MOLTNET_MACHINE_MAX_READ_PART_TEXT_BYTES} bytes,`
|
|
179
|
+
+ ` response line limit ${MOLTNET_MACHINE_MAX_OUTPUT_LINE_BYTES} bytes);`
|
|
180
|
+
+ " the read returned everything up to it rather than failing",
|
|
181
|
+
...(cursor === undefined ? {} : { cursor })
|
|
182
|
+
};
|
|
183
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { AttentionConfig } from "../contracts/attentionContract.js";
|
|
2
|
+
import { ORGANIZATION_RUNTIME_CODEX_REASONING_EFFORTS, ORGANIZATION_RUNTIME_CODEX_WORKSPACE_NO_NETWORK_POLICY, ORGANIZATION_RUNTIME_CONFIG_SCHEMA, ORGANIZATION_RUNTIME_CONFIG_V2_SCHEMA, ORGANIZATION_RUNTIME_MAX_AGENTS, ORGANIZATION_RUNTIME_MAX_CONFIG_BYTES, ORGANIZATION_RUNTIME_MAX_INSTRUCTIONS_CODEPOINTS, ORGANIZATION_RUNTIME_MAX_STRING_BYTES, ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS, ORGANIZATION_RUNTIME_MAX_WAKE_TEXT_BYTES, ORGANIZATION_RUNTIME_MAX_SCHEDULE_INTERVAL_MS, ORGANIZATION_RUNTIME_MAX_SCHEDULE_JITTER_SECONDS, ORGANIZATION_RUNTIME_V2_VERSION, ORGANIZATION_RUNTIME_VERSION } from "../contracts/organizationRuntimeContract.js";
|
|
3
|
+
export { ORGANIZATION_RUNTIME_CODEX_REASONING_EFFORTS, ORGANIZATION_RUNTIME_CODEX_WORKSPACE_NO_NETWORK_POLICY, ORGANIZATION_RUNTIME_CONFIG_SCHEMA, ORGANIZATION_RUNTIME_CONFIG_V2_SCHEMA, ORGANIZATION_RUNTIME_MAX_AGENTS, ORGANIZATION_RUNTIME_MAX_CONFIG_BYTES, ORGANIZATION_RUNTIME_MAX_INSTRUCTIONS_CODEPOINTS, ORGANIZATION_RUNTIME_MAX_STRING_BYTES, ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS, ORGANIZATION_RUNTIME_MAX_WAKE_TEXT_BYTES, ORGANIZATION_RUNTIME_MAX_SCHEDULE_INTERVAL_MS, ORGANIZATION_RUNTIME_MAX_SCHEDULE_JITTER_SECONDS, ORGANIZATION_RUNTIME_V2_VERSION, ORGANIZATION_RUNTIME_VERSION };
|
|
4
|
+
export type OrganizationRuntimeEngineKind = "codex" | "grok" | "agy";
|
|
5
|
+
/**
|
|
6
|
+
* `model`/`reasoningEffort` are accepted for codex (open model name) and for
|
|
7
|
+
* grok (closed broker lists, declared together); agy owns its own model
|
|
8
|
+
* selection and `organizationRuntimeParsing.ts` rejects either field there at
|
|
9
|
+
* parse time rather than silently ignoring it. The type stays flat
|
|
10
|
+
* — not a `kind`-discriminated union — because every parsed value already
|
|
11
|
+
* satisfies the invariant; callers that need it narrow on `kind === "codex"`.
|
|
12
|
+
*/
|
|
13
|
+
export type OrganizationRuntimeCodexSandboxPolicy = Readonly<{
|
|
14
|
+
mode: "workspace-write";
|
|
15
|
+
networkAccess: false;
|
|
16
|
+
webSearch: "disabled";
|
|
17
|
+
}>;
|
|
18
|
+
export type OrganizationRuntimeEngineIntent = Readonly<{
|
|
19
|
+
kind: OrganizationRuntimeEngineKind;
|
|
20
|
+
model?: string;
|
|
21
|
+
reasoningEffort?: string;
|
|
22
|
+
codexSandbox?: OrganizationRuntimeCodexSandboxPolicy;
|
|
23
|
+
}>;
|
|
24
|
+
export type OrganizationRuntimeMcpServer = Readonly<{
|
|
25
|
+
name: string;
|
|
26
|
+
transport: "stdio" | "sse" | "streamable_http";
|
|
27
|
+
command?: string;
|
|
28
|
+
args: readonly string[];
|
|
29
|
+
env: Readonly<Record<string, string>>;
|
|
30
|
+
authSecretEnv?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
tools: readonly string[];
|
|
33
|
+
}>;
|
|
34
|
+
export type OrganizationRuntimeMoltnet = Readonly<{
|
|
35
|
+
cliPath: string;
|
|
36
|
+
configPath: string;
|
|
37
|
+
networks: readonly Readonly<{
|
|
38
|
+
id: string;
|
|
39
|
+
rooms: readonly string[];
|
|
40
|
+
dms: boolean;
|
|
41
|
+
}>[];
|
|
42
|
+
}>;
|
|
43
|
+
export type OrganizationRuntimeMemory = Readonly<{
|
|
44
|
+
runtimeHomePath: string;
|
|
45
|
+
source?: string;
|
|
46
|
+
tokenBudget?: number;
|
|
47
|
+
}>;
|
|
48
|
+
export type OrganizationRuntimeSchedule = Readonly<{
|
|
49
|
+
kind: "disabled";
|
|
50
|
+
}> | Readonly<{
|
|
51
|
+
kind: "every";
|
|
52
|
+
interval_ms: number;
|
|
53
|
+
prompt: string;
|
|
54
|
+
jitter_seconds?: number;
|
|
55
|
+
}> | Readonly<{
|
|
56
|
+
kind: "cron";
|
|
57
|
+
cron: string;
|
|
58
|
+
timezone: string;
|
|
59
|
+
prompt: string;
|
|
60
|
+
jitter_seconds?: number;
|
|
61
|
+
}>;
|
|
62
|
+
export type OrganizationRuntimeAgentConfig = Readonly<{
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
instructions: string;
|
|
66
|
+
workspacePath: string;
|
|
67
|
+
runtimeHomePath: string;
|
|
68
|
+
engine: OrganizationRuntimeEngineIntent;
|
|
69
|
+
attention?: AttentionConfig;
|
|
70
|
+
schedule?: OrganizationRuntimeSchedule;
|
|
71
|
+
mcp?: readonly OrganizationRuntimeMcpServer[];
|
|
72
|
+
moltnet?: OrganizationRuntimeMoltnet;
|
|
73
|
+
memory?: OrganizationRuntimeMemory;
|
|
74
|
+
}>;
|
|
75
|
+
export type OrganizationRuntimeHostConfig = Readonly<{
|
|
76
|
+
bindHost: string;
|
|
77
|
+
port: number; /** Variable name only; never secret configuration data. */
|
|
78
|
+
controlTokenEnv: string;
|
|
79
|
+
}>;
|
|
80
|
+
export type OrganizationRuntimeConfig = Readonly<{
|
|
81
|
+
version: typeof ORGANIZATION_RUNTIME_VERSION | typeof ORGANIZATION_RUNTIME_V2_VERSION;
|
|
82
|
+
host: OrganizationRuntimeHostConfig;
|
|
83
|
+
agents: readonly OrganizationRuntimeAgentConfig[];
|
|
84
|
+
}>;
|
|
85
|
+
export type OrganizationRuntimeLifecycleState = "starting" | "running" | "stopping" | "stopped";
|
|
86
|
+
export type OrganizationRuntimeWakeEvent = Readonly<{
|
|
87
|
+
version: "noopolis.daimon.wake.v1";
|
|
88
|
+
id: string;
|
|
89
|
+
kind: "manual" | "message" | "schedule" | "external";
|
|
90
|
+
text: string;
|
|
91
|
+
occurredAt: string;
|
|
92
|
+
}>;
|
|
93
|
+
export type OrganizationRuntimeWakeRequest = Readonly<{
|
|
94
|
+
token: string | undefined;
|
|
95
|
+
agentId: string;
|
|
96
|
+
event: OrganizationRuntimeWakeEvent;
|
|
97
|
+
}>;
|
|
98
|
+
export type OrganizationRuntimeWakeResult = Readonly<{
|
|
99
|
+
version: "noopolis.daimon.wake-result.v1";
|
|
100
|
+
status: "completed";
|
|
101
|
+
agentId: string;
|
|
102
|
+
wakeId: string;
|
|
103
|
+
text: string;
|
|
104
|
+
durationMs: number;
|
|
105
|
+
}> | Readonly<{
|
|
106
|
+
version: "noopolis.daimon.wake-result.v1";
|
|
107
|
+
status: "rejected";
|
|
108
|
+
agentId: string;
|
|
109
|
+
wakeId: string;
|
|
110
|
+
code: "invalid_request" | "unauthorized" | "unknown_agent" | "queue_full" | "durable_inbox_required";
|
|
111
|
+
}> | Readonly<{
|
|
112
|
+
version: "noopolis.daimon.wake-result.v1";
|
|
113
|
+
status: "stopped";
|
|
114
|
+
agentId: string;
|
|
115
|
+
wakeId: string;
|
|
116
|
+
code: "host_stopping" | "host_stopped" | "queued_wake_stopped" | "active_wake_aborted";
|
|
117
|
+
}> | Readonly<{
|
|
118
|
+
version: "noopolis.daimon.wake-result.v1";
|
|
119
|
+
status: "failed";
|
|
120
|
+
agentId: string;
|
|
121
|
+
wakeId: string;
|
|
122
|
+
code: "engine_failed";
|
|
123
|
+
detail?: string;
|
|
124
|
+
}>;
|
|
125
|
+
export type OrganizationRuntimeAgentHealth = Readonly<{
|
|
126
|
+
agentId: string;
|
|
127
|
+
engine: OrganizationRuntimeEngineIntent["kind"];
|
|
128
|
+
state: OrganizationRuntimeLifecycleState | "idle" | "running" | "failed";
|
|
129
|
+
}>;
|
|
130
|
+
export type OrganizationRuntimeHealth = Readonly<{
|
|
131
|
+
version: "noopolis.daimon.organization-runtime-health.v1";
|
|
132
|
+
state: OrganizationRuntimeLifecycleState;
|
|
133
|
+
agents: readonly OrganizationRuntimeAgentHealth[];
|
|
134
|
+
}>;
|
|
135
|
+
export type OrganizationRuntimeActivityRequest = Readonly<{
|
|
136
|
+
agentId?: string;
|
|
137
|
+
cursor?: string;
|
|
138
|
+
limit: number;
|
|
139
|
+
}>;
|
|
140
|
+
export type OrganizationRuntimeActivity = Readonly<{
|
|
141
|
+
id: string;
|
|
142
|
+
agentId: string;
|
|
143
|
+
wakeId?: string;
|
|
144
|
+
kind: "wake_started" | "wake_completed" | "wake_rejected" | "wake_aborted" | "agent_stopped";
|
|
145
|
+
occurredAt: string;
|
|
146
|
+
}>;
|
|
147
|
+
export type OrganizationRuntimeActivityPage = Readonly<{
|
|
148
|
+
version: "noopolis.daimon.organization-runtime-activity.v1";
|
|
149
|
+
items: readonly OrganizationRuntimeActivity[];
|
|
150
|
+
nextCursor?: string;
|
|
151
|
+
}>;
|
|
152
|
+
export type OrganizationRuntimeShutdownCompletion = Readonly<{
|
|
153
|
+
version: "noopolis.daimon.organization-runtime-stop.v1";
|
|
154
|
+
state: "stopped";
|
|
155
|
+
}>;
|
|
156
|
+
/** One host runs isolated agents; it never coordinates their work. */
|
|
157
|
+
export interface OrganizationRuntimeHost {
|
|
158
|
+
start(): Promise<void>;
|
|
159
|
+
wake(request: OrganizationRuntimeWakeRequest): Promise<OrganizationRuntimeWakeResult>;
|
|
160
|
+
health(agentId?: string): Promise<OrganizationRuntimeHealth>;
|
|
161
|
+
activity(request: OrganizationRuntimeActivityRequest): Promise<OrganizationRuntimeActivityPage>;
|
|
162
|
+
stop(): Promise<OrganizationRuntimeShutdownCompletion>;
|
|
163
|
+
}
|
|
164
|
+
export { isOrganizationRuntimeConfig, parseOrganizationRuntimeConfig, parseOrganizationRuntimeWakeRequest, validateOrganizationRuntimeConfig } from "./organizationRuntimeParsing.js";
|
|
165
|
+
//# sourceMappingURL=organizationRuntime.d.ts.map
|