@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,145 @@
|
|
|
1
|
+
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
export class McpToolTurnLimitError extends Error {
|
|
5
|
+
constructor(maxToolTurns) {
|
|
6
|
+
super(`McpToolTurnLimitError: maximum ${maxToolTurns} calls per wake`);
|
|
7
|
+
this.name = "McpToolTurnLimitError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class McpWakeDeadlineError extends Error {
|
|
11
|
+
constructor() {
|
|
12
|
+
super("McpWakeDeadlineError: wake deadline exceeded");
|
|
13
|
+
this.name = "McpWakeDeadlineError";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A non-standard request AGY issues during its MCP handshake.
|
|
18
|
+
*
|
|
19
|
+
* Captured live from `agy --print … --output-format stream-json`, the client
|
|
20
|
+
* sends `initialize`, `notifications/initialized`, **`server/discover`**,
|
|
21
|
+
* `tools/list`, `tools/call`. `server/discover` is not in the MCP
|
|
22
|
+
* specification, and the throwaway probe that proved AGY's headless tool
|
|
23
|
+
* calling answered it with `{}`. Codex and Grok never send it.
|
|
24
|
+
*
|
|
25
|
+
* This server answers it the same way that working probe did, rather than the
|
|
26
|
+
* SDK default of `MethodNotFound`, because a refusal here is the one observable
|
|
27
|
+
* difference between this server and the one AGY is known to work against, and
|
|
28
|
+
* the cost of being wrong is that every AGY agent silently loses every tool.
|
|
29
|
+
* The allowance is exactly this one method: any other unknown method still gets
|
|
30
|
+
* `MethodNotFound`, so a genuine protocol mistake is never hidden.
|
|
31
|
+
*/
|
|
32
|
+
export const AGY_SERVER_DISCOVER_METHOD = "server/discover";
|
|
33
|
+
const jsonSchema = (parameters) => {
|
|
34
|
+
if (parameters === null || typeof parameters !== "object" || Array.isArray(parameters)) {
|
|
35
|
+
throw new TypeError("Pi tool parameters must be a JSON schema object");
|
|
36
|
+
}
|
|
37
|
+
return Object.fromEntries(Object.entries(parameters));
|
|
38
|
+
};
|
|
39
|
+
const toolResult = (result) => ({
|
|
40
|
+
content: result.content,
|
|
41
|
+
...(result.details !== undefined && typeof result.details === "object" && result.details !== null
|
|
42
|
+
? { structuredContent: Object.fromEntries(Object.entries(result.details)) }
|
|
43
|
+
: {})
|
|
44
|
+
});
|
|
45
|
+
/** Bound on the rendered Ajv violations, so a pathological schema cannot flood a turn. */
|
|
46
|
+
const MAX_SCHEMA_VIOLATION_BYTES = 2_048;
|
|
47
|
+
/**
|
|
48
|
+
* Why the arguments were rejected, in the schema's own words.
|
|
49
|
+
*
|
|
50
|
+
* A bare `Invalid arguments for tool X` tells an agent that its call was wrong
|
|
51
|
+
* and nothing about how, which leaves trial and error as the only way to learn
|
|
52
|
+
* a tool's argument shape. Ajv already knows which instance path failed and
|
|
53
|
+
* which keyword it failed on; saying so turns a guessing loop into one
|
|
54
|
+
* correction.
|
|
55
|
+
*/
|
|
56
|
+
const schemaViolations = (validator) => {
|
|
57
|
+
const rendered = (validator.errors ?? [])
|
|
58
|
+
.map((issue) => `${issue.instancePath === "" ? "(root)" : issue.instancePath} ${issue.message ?? "is invalid"}`.trim())
|
|
59
|
+
.join("; ");
|
|
60
|
+
if (rendered.length === 0)
|
|
61
|
+
return "the arguments do not match the tool's declared input schema";
|
|
62
|
+
return rendered.length > MAX_SCHEMA_VIOLATION_BYTES ? `${rendered.slice(0, MAX_SCHEMA_VIOLATION_BYTES)}…` : rendered;
|
|
63
|
+
};
|
|
64
|
+
const toolError = (error) => ({
|
|
65
|
+
content: [{ type: "text", text: error instanceof Error ? `${error.name}: ${error.message}` : String(error) }],
|
|
66
|
+
isError: true
|
|
67
|
+
});
|
|
68
|
+
// Pi's ExtensionContext has no meaning outside a Pi session. Mounted tools
|
|
69
|
+
// must not read it; this named value documents the explicit absence.
|
|
70
|
+
// The MCP mount deliberately has no Pi session context; `never` preserves typed positional checks.
|
|
71
|
+
const NO_PI_EXTENSION_CONTEXT = undefined;
|
|
72
|
+
const validateOptions = (options) => {
|
|
73
|
+
if (options.maxToolTurns !== undefined && (!Number.isSafeInteger(options.maxToolTurns) || options.maxToolTurns < 1)) {
|
|
74
|
+
throw new TypeError("maxToolTurns must be a positive safe integer");
|
|
75
|
+
}
|
|
76
|
+
if (options.wakeDeadline !== undefined && !Number.isFinite(options.wakeDeadline)) {
|
|
77
|
+
throw new TypeError("wakeDeadline must be a finite epoch-millisecond deadline");
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export const createPiToolMcpServer = (tools, options) => {
|
|
81
|
+
validateOptions(options);
|
|
82
|
+
const server = new Server({ name: "daimon-pi-tools", version: "0.1.2" });
|
|
83
|
+
server.fallbackRequestHandler = async (request) => {
|
|
84
|
+
if (request.method !== AGY_SERVER_DISCOVER_METHOD) {
|
|
85
|
+
throw new McpError(ErrorCode.MethodNotFound, `Method not found: ${request.method}`);
|
|
86
|
+
}
|
|
87
|
+
return {};
|
|
88
|
+
};
|
|
89
|
+
const validators = new Map(tools.map((tool) => {
|
|
90
|
+
const schema = jsonSchema(tool.parameters);
|
|
91
|
+
return [tool.name, new Ajv2020({ strict: false }).compile(schema)];
|
|
92
|
+
}));
|
|
93
|
+
let toolTurns = 0;
|
|
94
|
+
server.registerCapabilities({ tools: { listChanged: true } });
|
|
95
|
+
server.setRequestHandler(ListToolsRequestSchema, () => ({
|
|
96
|
+
tools: tools.map((tool) => ({
|
|
97
|
+
name: tool.name,
|
|
98
|
+
title: tool.label,
|
|
99
|
+
description: tool.description,
|
|
100
|
+
inputSchema: jsonSchema(tool.parameters)
|
|
101
|
+
}))
|
|
102
|
+
}));
|
|
103
|
+
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
104
|
+
try {
|
|
105
|
+
if (options.wakeDeadline !== undefined && Date.now() >= options.wakeDeadline)
|
|
106
|
+
throw new McpWakeDeadlineError();
|
|
107
|
+
if (options.maxToolTurns !== undefined && toolTurns >= options.maxToolTurns)
|
|
108
|
+
throw new McpToolTurnLimitError(options.maxToolTurns);
|
|
109
|
+
const tool = tools.find((candidate) => candidate.name === request.params.name);
|
|
110
|
+
const validator = validators.get(request.params.name);
|
|
111
|
+
if (tool === undefined || validator === undefined) {
|
|
112
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown tool: ${request.params.name}`);
|
|
113
|
+
}
|
|
114
|
+
const args = request.params.arguments ?? {};
|
|
115
|
+
if (!validator(args)) {
|
|
116
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${tool.name}: ${schemaViolations(validator)}`);
|
|
117
|
+
}
|
|
118
|
+
toolTurns += 1;
|
|
119
|
+
// Ajv validated this value against this tool's own schema immediately above.
|
|
120
|
+
const validatedArgs = args;
|
|
121
|
+
const deadlineController = options.wakeDeadline === undefined ? undefined : new AbortController();
|
|
122
|
+
const remainingMs = options.wakeDeadline === undefined ? undefined : Math.max(0, options.wakeDeadline - Date.now());
|
|
123
|
+
const deadlineTimer = deadlineController === undefined ? undefined : setTimeout(() => deadlineController.abort(), remainingMs);
|
|
124
|
+
const signal = deadlineController === undefined ? extra.signal
|
|
125
|
+
: extra.signal === undefined ? deadlineController.signal : AbortSignal.any([extra.signal, deadlineController.signal]);
|
|
126
|
+
const deadline = deadlineController === undefined ? undefined : new Promise((_resolve, reject) => {
|
|
127
|
+
deadlineController.signal.addEventListener("abort", () => reject(new McpWakeDeadlineError()), { once: true });
|
|
128
|
+
});
|
|
129
|
+
let result;
|
|
130
|
+
try {
|
|
131
|
+
const execution = tool.execute(`mcp-tool-turn-${toolTurns}`, validatedArgs, signal, undefined, NO_PI_EXTENSION_CONTEXT);
|
|
132
|
+
result = deadline === undefined ? await execution : await Promise.race([execution, deadline]);
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
if (deadlineTimer !== undefined)
|
|
136
|
+
clearTimeout(deadlineTimer);
|
|
137
|
+
}
|
|
138
|
+
return toolResult(result);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
return toolError(error);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return server;
|
|
145
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daimon's own copy of the `noopolis.causal-event.v1` wire envelope. Field-
|
|
3
|
+
* for-field the canonical shape in `specs/causal-event.v1.schema.json` and
|
|
4
|
+
* `specs/CAUSAL.md` (root repo) — daimon is an independent repo and does not
|
|
5
|
+
* import that schema, it only conforms to it. The wire JSON emitted by
|
|
6
|
+
* `appendCausalEvent` is the actual contract; this type is local sugar over
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const CAUSAL_EVENT_VERSION: "noopolis.causal-event.v1";
|
|
10
|
+
export type CausalEventSystem = "simfile" | "moltnet" | "mneme" | "daimon";
|
|
11
|
+
export interface CausalEventEmitter {
|
|
12
|
+
system: CausalEventSystem;
|
|
13
|
+
stream_id: string;
|
|
14
|
+
seq: number;
|
|
15
|
+
}
|
|
16
|
+
export interface CausalEvent<TPayload = Record<string, unknown>> {
|
|
17
|
+
cause_event_ids: string[];
|
|
18
|
+
emitter: CausalEventEmitter;
|
|
19
|
+
event_id: string;
|
|
20
|
+
payload: TPayload;
|
|
21
|
+
principal_id: string;
|
|
22
|
+
recorded_at: string;
|
|
23
|
+
run_id: string;
|
|
24
|
+
type: string;
|
|
25
|
+
version: typeof CAUSAL_EVENT_VERSION;
|
|
26
|
+
}
|
|
27
|
+
/** Payload for `turn.input.submitted`, stamped just before a Pi session prompt call. */
|
|
28
|
+
export interface TurnInputSubmittedPayload extends Record<string, unknown> {
|
|
29
|
+
input_content_sha256: string;
|
|
30
|
+
input_message_ids: string[];
|
|
31
|
+
prompt_sha256: string;
|
|
32
|
+
turn_id: string;
|
|
33
|
+
}
|
|
34
|
+
/** Payload for `turn.output.completed`, stamped once a Pi turn finishes successfully. */
|
|
35
|
+
export interface TurnOutputCompletedPayload extends Record<string, unknown> {
|
|
36
|
+
output_sha256: string;
|
|
37
|
+
turn_id: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const TURN_INPUT_SUBMITTED_TYPE: "turn.input.submitted";
|
|
40
|
+
export declare const TURN_OUTPUT_COMPLETED_TYPE: "turn.output.completed";
|
|
41
|
+
/** Name of the environment variable every Noopolis authority reads `run_id` from. Never model output. */
|
|
42
|
+
export declare const NOOPOLIS_RUN_ID_ENV = "NOOPOLIS_RUN_ID";
|
|
43
|
+
/**
|
|
44
|
+
* Resolves `run_id` from the `NOOPOLIS_RUN_ID` environment variable, per
|
|
45
|
+
* `specs/CAUSAL.md`. Never derived from a WakeEvent, model output, or any
|
|
46
|
+
* other in-turn data. A causal event cannot be emitted without a real run id.
|
|
47
|
+
*/
|
|
48
|
+
export declare const resolveRunId: (env?: NodeJS.ProcessEnv) => string;
|
|
49
|
+
export declare const sha256Hex: (value: string) => string;
|
|
50
|
+
/** Deterministic, non-model-derived event id for a turn's `turn.input.submitted` record. */
|
|
51
|
+
export declare const turnInputSubmittedEventId: (turnId: string) => string;
|
|
52
|
+
/** Deterministic, non-model-derived event id for a turn's `turn.output.completed` record. */
|
|
53
|
+
export declare const turnOutputCompletedEventId: (turnId: string) => string;
|
|
54
|
+
/**
|
|
55
|
+
* The `cause_event_ids` an outbound Moltnet reply for `turnId` should carry.
|
|
56
|
+
* Pure and deterministic from `turn_id` alone — the harness owns this value,
|
|
57
|
+
* never the model. Daimon does not construct Moltnet `SendMessageRequest`
|
|
58
|
+
* values itself (see repo AGENTS.md: Moltnet wiring belongs to the caller,
|
|
59
|
+
* not this package), so this helper is what a caller sending the reply on
|
|
60
|
+
* Daimon's behalf attaches to that request's `cause_event_ids`.
|
|
61
|
+
*/
|
|
62
|
+
export declare const replyCauseEventIds: (turnId: string) => string[];
|
|
63
|
+
/**
|
|
64
|
+
* Allocates the next contiguous seq number for `(run_id, stream_id)`,
|
|
65
|
+
* persisted under `runtimeHome/telemetry/causal.seq.json`. Allocation is
|
|
66
|
+
* serialized in-process and mutually excluded across processes by a lock
|
|
67
|
+
* file; the counter is written atomically and fsynced.
|
|
68
|
+
*/
|
|
69
|
+
export declare const nextCausalSeq: (input: {
|
|
70
|
+
runId: string;
|
|
71
|
+
runtimeHomePath: string;
|
|
72
|
+
streamId: string;
|
|
73
|
+
}) => Promise<number>;
|
|
74
|
+
/** Appends one CausalEvent record as a line of `runtimeHome/telemetry/causal.jsonl`. */
|
|
75
|
+
export declare const appendCausalEvent: (runtimeHomePath: string, event: CausalEvent) => Promise<void>;
|
|
76
|
+
export interface EmitCausalEventInput<TPayload extends Record<string, unknown>> {
|
|
77
|
+
agentId: string;
|
|
78
|
+
causeEventIds: string[];
|
|
79
|
+
eventId: string;
|
|
80
|
+
payload: TPayload;
|
|
81
|
+
principalId: string;
|
|
82
|
+
runId: string;
|
|
83
|
+
runtimeHomePath: string;
|
|
84
|
+
type: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Stamps and appends one causal event for this agent's stream
|
|
88
|
+
* (`agent:<agentId>`). `run_id` and `principal_id` are always caller-
|
|
89
|
+
* supplied values (never read from `payload` or model output) — see
|
|
90
|
+
* `piHarness.ts`, which is the only caller and always passes the resolved
|
|
91
|
+
* `NOOPOLIS_RUN_ID` and the authenticated agent identity.
|
|
92
|
+
*/
|
|
93
|
+
export declare const emitCausalEvent: <TPayload extends Record<string, unknown>>(input: EmitCausalEventInput<TPayload>) => Promise<CausalEvent<TPayload>>;
|
|
94
|
+
export interface EmitTurnInputSubmittedInput {
|
|
95
|
+
agentId: string;
|
|
96
|
+
causeEventIds: string[];
|
|
97
|
+
inputContentSha256: string;
|
|
98
|
+
inputMessageIds: string[];
|
|
99
|
+
principalId: string;
|
|
100
|
+
promptSha256: string;
|
|
101
|
+
runId: string;
|
|
102
|
+
runtimeHomePath: string;
|
|
103
|
+
turnId: string;
|
|
104
|
+
}
|
|
105
|
+
/** Stamps `turn.input.submitted` for one Pi turn, right before the engine prompt call. */
|
|
106
|
+
export declare const emitTurnInputSubmitted: (input: EmitTurnInputSubmittedInput) => Promise<CausalEvent<TurnInputSubmittedPayload>>;
|
|
107
|
+
export interface EmitTurnOutputCompletedInput {
|
|
108
|
+
agentId: string;
|
|
109
|
+
causeEventIds: string[];
|
|
110
|
+
outputSha256: string;
|
|
111
|
+
principalId: string;
|
|
112
|
+
runId: string;
|
|
113
|
+
runtimeHomePath: string;
|
|
114
|
+
turnId: string;
|
|
115
|
+
}
|
|
116
|
+
/** Stamps `turn.output.completed` once a Pi turn finishes successfully. */
|
|
117
|
+
export declare const emitTurnOutputCompleted: (input: EmitTurnOutputCompletedInput) => Promise<CausalEvent<TurnOutputCompletedPayload>>;
|
|
118
|
+
//# sourceMappingURL=causalEvents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"causalEvents.d.ts","sourceRoot":"","sources":["../../src/observability/causalEvents.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;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MAAM,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0FAA0F;AAC1F,eAAO,MAAM,sBAAsB,GACjC,OAAO,2BAA2B,KACjC,OAAO,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAe7C,CAAC;AAEL,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,GAClC,OAAO,4BAA4B,KAClC,OAAO,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAa9C,CAAC"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { constants } from "node:fs";
|
|
3
|
+
import { appendFile, open, readFile, rename, stat, unlink } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { ensureRuntimeHomeDirectory } from "../runtime/runtimeHomeLayout.js";
|
|
6
|
+
/**
|
|
7
|
+
* Daimon's own copy of the `noopolis.causal-event.v1` wire envelope. Field-
|
|
8
|
+
* for-field the canonical shape in `specs/causal-event.v1.schema.json` and
|
|
9
|
+
* `specs/CAUSAL.md` (root repo) — daimon is an independent repo and does not
|
|
10
|
+
* import that schema, it only conforms to it. The wire JSON emitted by
|
|
11
|
+
* `appendCausalEvent` is the actual contract; this type is local sugar over
|
|
12
|
+
* it.
|
|
13
|
+
*/
|
|
14
|
+
export const CAUSAL_EVENT_VERSION = "noopolis.causal-event.v1";
|
|
15
|
+
export const TURN_INPUT_SUBMITTED_TYPE = "turn.input.submitted";
|
|
16
|
+
export const TURN_OUTPUT_COMPLETED_TYPE = "turn.output.completed";
|
|
17
|
+
/** Name of the environment variable every Noopolis authority reads `run_id` from. Never model output. */
|
|
18
|
+
export const NOOPOLIS_RUN_ID_ENV = "NOOPOLIS_RUN_ID";
|
|
19
|
+
/**
|
|
20
|
+
* Resolves `run_id` from the `NOOPOLIS_RUN_ID` environment variable, per
|
|
21
|
+
* `specs/CAUSAL.md`. Never derived from a WakeEvent, model output, or any
|
|
22
|
+
* other in-turn data. A causal event cannot be emitted without a real run id.
|
|
23
|
+
*/
|
|
24
|
+
export const resolveRunId = (env = process.env) => {
|
|
25
|
+
const value = env[NOOPOLIS_RUN_ID_ENV];
|
|
26
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
27
|
+
throw new Error(`${NOOPOLIS_RUN_ID_ENV} must be set to a non-blank value`);
|
|
28
|
+
}
|
|
29
|
+
return value.trim();
|
|
30
|
+
};
|
|
31
|
+
export const sha256Hex = (value) => createHash("sha256").update(value, "utf8").digest("hex");
|
|
32
|
+
/** Deterministic, non-model-derived event id for a turn's `turn.input.submitted` record. */
|
|
33
|
+
export const turnInputSubmittedEventId = (turnId) => `daimon:${turnId}:turn.input.submitted`;
|
|
34
|
+
/** Deterministic, non-model-derived event id for a turn's `turn.output.completed` record. */
|
|
35
|
+
export const turnOutputCompletedEventId = (turnId) => `daimon:${turnId}:turn.output.completed`;
|
|
36
|
+
/**
|
|
37
|
+
* The `cause_event_ids` an outbound Moltnet reply for `turnId` should carry.
|
|
38
|
+
* Pure and deterministic from `turn_id` alone — the harness owns this value,
|
|
39
|
+
* never the model. Daimon does not construct Moltnet `SendMessageRequest`
|
|
40
|
+
* values itself (see repo AGENTS.md: Moltnet wiring belongs to the caller,
|
|
41
|
+
* not this package), so this helper is what a caller sending the reply on
|
|
42
|
+
* Daimon's behalf attaches to that request's `cause_event_ids`.
|
|
43
|
+
*/
|
|
44
|
+
export const replyCauseEventIds = (turnId) => [turnOutputCompletedEventId(turnId)];
|
|
45
|
+
const telemetryDir = (runtimeHomePath) => path.join(runtimeHomePath, "telemetry");
|
|
46
|
+
const seqFilePath = (runtimeHomePath) => path.join(telemetryDir(runtimeHomePath), "causal.seq.json");
|
|
47
|
+
const jsonlFilePath = (runtimeHomePath) => path.join(telemetryDir(runtimeHomePath), "causal.jsonl");
|
|
48
|
+
const STALE_LOCK_MS = 30_000;
|
|
49
|
+
const seqAllocationQueues = new Map();
|
|
50
|
+
const readSeqStore = async (runtimeHomePath) => {
|
|
51
|
+
try {
|
|
52
|
+
const raw = await readFile(seqFilePath(runtimeHomePath), "utf8");
|
|
53
|
+
return JSON.parse(raw);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
57
|
+
return {};
|
|
58
|
+
}
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const writeSeqStore = async (runtimeHomePath, store) => {
|
|
63
|
+
const directory = await ensureRuntimeHomeDirectory(runtimeHomePath, "telemetry");
|
|
64
|
+
const file = seqFilePath(runtimeHomePath);
|
|
65
|
+
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
66
|
+
const handle = await open(temporary, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o600);
|
|
67
|
+
try {
|
|
68
|
+
await handle.writeFile(`${JSON.stringify(store, null, 2)}\n`, "utf8");
|
|
69
|
+
await handle.sync();
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
await handle.close();
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
await rename(temporary, file);
|
|
76
|
+
await syncDirectory(directory);
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
await unlink(temporary).catch((error) => {
|
|
80
|
+
if (error.code !== "ENOENT")
|
|
81
|
+
throw error;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const syncDirectory = async (directory) => {
|
|
86
|
+
const handle = await open(directory, constants.O_RDONLY);
|
|
87
|
+
try {
|
|
88
|
+
await handle.sync();
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
await handle.close();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const acquireSeqLock = async (lockPath) => {
|
|
95
|
+
const startedAt = Date.now();
|
|
96
|
+
let backoffMs = 2;
|
|
97
|
+
while (Date.now() - startedAt < 5_000) {
|
|
98
|
+
try {
|
|
99
|
+
const handle = await open(lockPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY, 0o600);
|
|
100
|
+
await handle.close();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (!(error && typeof error === "object" && "code" in error && error.code === "EEXIST"))
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const observed = await stat(lockPath);
|
|
109
|
+
if (Date.now() - observed.mtimeMs > STALE_LOCK_MS) {
|
|
110
|
+
const confirmed = await stat(lockPath);
|
|
111
|
+
if (confirmed.mtimeMs === observed.mtimeMs) {
|
|
112
|
+
await unlink(lockPath).catch((error) => {
|
|
113
|
+
if (error.code !== "ENOENT")
|
|
114
|
+
throw error;
|
|
115
|
+
});
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (!(error && typeof error === "object" && "code" in error && error.code === "ENOENT"))
|
|
122
|
+
throw error;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
await new Promise((resolve) => setTimeout(resolve, backoffMs));
|
|
126
|
+
backoffMs = Math.min(backoffMs * 2, 25);
|
|
127
|
+
}
|
|
128
|
+
throw new Error(`Timed out acquiring causal sequence lock: ${lockPath}`);
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Allocates the next contiguous seq number for `(run_id, stream_id)`,
|
|
132
|
+
* persisted under `runtimeHome/telemetry/causal.seq.json`. Allocation is
|
|
133
|
+
* serialized in-process and mutually excluded across processes by a lock
|
|
134
|
+
* file; the counter is written atomically and fsynced.
|
|
135
|
+
*/
|
|
136
|
+
export const nextCausalSeq = async (input) => {
|
|
137
|
+
const lockPath = path.resolve(telemetryDir(input.runtimeHomePath), "causal.seq.lock");
|
|
138
|
+
const previous = seqAllocationQueues.get(lockPath) ?? Promise.resolve();
|
|
139
|
+
const allocation = previous.catch(() => undefined).then(async () => {
|
|
140
|
+
await ensureRuntimeHomeDirectory(input.runtimeHomePath, "telemetry");
|
|
141
|
+
await acquireSeqLock(lockPath);
|
|
142
|
+
try {
|
|
143
|
+
const store = await readSeqStore(input.runtimeHomePath);
|
|
144
|
+
const forRun = store[input.runId] ?? {};
|
|
145
|
+
const next = (forRun[input.streamId] ?? 0) + 1;
|
|
146
|
+
forRun[input.streamId] = next;
|
|
147
|
+
store[input.runId] = forRun;
|
|
148
|
+
await writeSeqStore(input.runtimeHomePath, store);
|
|
149
|
+
return next;
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
await unlink(lockPath).catch((error) => {
|
|
153
|
+
if (error.code !== "ENOENT")
|
|
154
|
+
throw error;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
seqAllocationQueues.set(lockPath, allocation);
|
|
159
|
+
void allocation.finally(() => {
|
|
160
|
+
if (seqAllocationQueues.get(lockPath) === allocation)
|
|
161
|
+
seqAllocationQueues.delete(lockPath);
|
|
162
|
+
}).catch(() => undefined);
|
|
163
|
+
return allocation;
|
|
164
|
+
};
|
|
165
|
+
/** Appends one CausalEvent record as a line of `runtimeHome/telemetry/causal.jsonl`. */
|
|
166
|
+
export const appendCausalEvent = async (runtimeHomePath, event) => {
|
|
167
|
+
await ensureRuntimeHomeDirectory(runtimeHomePath, "telemetry");
|
|
168
|
+
await appendFile(jsonlFilePath(runtimeHomePath), `${JSON.stringify(event)}\n`, "utf8");
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Stamps and appends one causal event for this agent's stream
|
|
172
|
+
* (`agent:<agentId>`). `run_id` and `principal_id` are always caller-
|
|
173
|
+
* supplied values (never read from `payload` or model output) — see
|
|
174
|
+
* `piHarness.ts`, which is the only caller and always passes the resolved
|
|
175
|
+
* `NOOPOLIS_RUN_ID` and the authenticated agent identity.
|
|
176
|
+
*/
|
|
177
|
+
export const emitCausalEvent = async (input) => {
|
|
178
|
+
const streamId = `agent:${input.agentId}`;
|
|
179
|
+
const seq = await nextCausalSeq({ runId: input.runId, runtimeHomePath: input.runtimeHomePath, streamId });
|
|
180
|
+
const event = {
|
|
181
|
+
cause_event_ids: [...input.causeEventIds],
|
|
182
|
+
emitter: { system: "daimon", stream_id: streamId, seq },
|
|
183
|
+
event_id: input.eventId,
|
|
184
|
+
payload: input.payload,
|
|
185
|
+
principal_id: input.principalId,
|
|
186
|
+
recorded_at: new Date().toISOString(),
|
|
187
|
+
run_id: input.runId,
|
|
188
|
+
type: input.type,
|
|
189
|
+
version: CAUSAL_EVENT_VERSION
|
|
190
|
+
};
|
|
191
|
+
await appendCausalEvent(input.runtimeHomePath, event);
|
|
192
|
+
return event;
|
|
193
|
+
};
|
|
194
|
+
/** Stamps `turn.input.submitted` for one Pi turn, right before the engine prompt call. */
|
|
195
|
+
export const emitTurnInputSubmitted = (input) => emitCausalEvent({
|
|
196
|
+
agentId: input.agentId,
|
|
197
|
+
causeEventIds: input.causeEventIds,
|
|
198
|
+
eventId: turnInputSubmittedEventId(input.turnId),
|
|
199
|
+
payload: {
|
|
200
|
+
input_content_sha256: input.inputContentSha256,
|
|
201
|
+
input_message_ids: [...input.inputMessageIds],
|
|
202
|
+
prompt_sha256: input.promptSha256,
|
|
203
|
+
turn_id: input.turnId
|
|
204
|
+
},
|
|
205
|
+
principalId: input.principalId,
|
|
206
|
+
runId: input.runId,
|
|
207
|
+
runtimeHomePath: input.runtimeHomePath,
|
|
208
|
+
type: TURN_INPUT_SUBMITTED_TYPE
|
|
209
|
+
});
|
|
210
|
+
/** Stamps `turn.output.completed` once a Pi turn finishes successfully. */
|
|
211
|
+
export const emitTurnOutputCompleted = (input) => emitCausalEvent({
|
|
212
|
+
agentId: input.agentId,
|
|
213
|
+
causeEventIds: input.causeEventIds,
|
|
214
|
+
eventId: turnOutputCompletedEventId(input.turnId),
|
|
215
|
+
payload: {
|
|
216
|
+
output_sha256: input.outputSha256,
|
|
217
|
+
turn_id: input.turnId
|
|
218
|
+
},
|
|
219
|
+
principalId: input.principalId,
|
|
220
|
+
runId: input.runId,
|
|
221
|
+
runtimeHomePath: input.runtimeHomePath,
|
|
222
|
+
type: TURN_OUTPUT_COMPLETED_TYPE
|
|
223
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { type CausalEvent } from "./causalEvents.js";
|
|
2
|
+
/**
|
|
3
|
+
* Control-wake causal emitters for root's two wake-acceptance surfaces
|
|
4
|
+
* (`src/runtime/pi/appControlSource.ts`, root repo, out of scope here):
|
|
5
|
+
* the operator-only control endpoint and the Moltnet loopback delivery
|
|
6
|
+
* endpoint (`/agents/:slug/wake`). Both stamp `control.wake.accepted` —
|
|
7
|
+
* enforcement point #3 in `specs/CAUSAL.md` §"Enforcement points" — but with
|
|
8
|
+
* different `principal_id` authorities, per the B62 fix (Option B): the
|
|
9
|
+
* operator endpoint stamps `operator:<name>` (`emitControlWakeAccepted`),
|
|
10
|
+
* the delivery endpoint stamps the fixed `system:moltnet` authority
|
|
11
|
+
* (`emitDeliveryWakeAccepted`), never a caller-supplied `from`/agent field.
|
|
12
|
+
* `control.wake.denied` (`emitControlWakeDenied`) stays operator-only: the
|
|
13
|
+
* delivery endpoint has no bearer-token deny path to stamp. Root's generated
|
|
14
|
+
* app calls these directly; this file has no knowledge of HTTP, tokens, or
|
|
15
|
+
* the request shape, only the causal envelope contract.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CONTROL_WAKE_ACCEPTED_TYPE: "control.wake.accepted";
|
|
18
|
+
export declare const CONTROL_WAKE_DENIED_TYPE: "control.wake.denied";
|
|
19
|
+
/** Payload for `control.wake.accepted`. */
|
|
20
|
+
export interface ControlWakeAcceptedPayload extends Record<string, unknown> {
|
|
21
|
+
target_agent_id: string;
|
|
22
|
+
wake_kind: string;
|
|
23
|
+
}
|
|
24
|
+
/** Payload for `control.wake.denied`. */
|
|
25
|
+
export interface ControlWakeDeniedPayload extends Record<string, unknown> {
|
|
26
|
+
reason: string;
|
|
27
|
+
target_agent_id: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Payload for a Moltnet-delivered `control.wake.accepted` (same event type
|
|
31
|
+
* as the operator path — it is still an accepted wake; `principal_id` is
|
|
32
|
+
* what distinguishes authority). Adds `delivered_by` so downstream readers
|
|
33
|
+
* can tell a delivery-stamped event from an operator-stamped one without
|
|
34
|
+
* inspecting `principal_id`.
|
|
35
|
+
*/
|
|
36
|
+
export interface DeliveryWakeAcceptedPayload extends ControlWakeAcceptedPayload {
|
|
37
|
+
delivered_by: "moltnet";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Principal grammar per `specs/CAUSAL.md` §3 (`^(agent|operator|system):.+`):
|
|
41
|
+
* an authenticated operator identity, e.g. `operator:control`. Callers must
|
|
42
|
+
* pass the identity behind the verified bearer token, never a value read
|
|
43
|
+
* from the request body or model output.
|
|
44
|
+
*/
|
|
45
|
+
export declare const operatorPrincipalId: (operatorName: string) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Fixed principal for wakes accepted through the Moltnet loopback delivery
|
|
48
|
+
* endpoint (`/agents/:slug/wake`): the delivering authority itself, never an
|
|
49
|
+
* identity derived from a caller-supplied `from`/agent field on the request.
|
|
50
|
+
*/
|
|
51
|
+
export declare const DELIVERY_PRINCIPAL_ID: "system:moltnet";
|
|
52
|
+
/** Deterministic, non-model-derived event id for a control wake acceptance. */
|
|
53
|
+
export declare const controlWakeAcceptedEventId: (requestId: string) => string;
|
|
54
|
+
/** Deterministic, non-model-derived event id for a control wake denial. */
|
|
55
|
+
export declare const controlWakeDeniedEventId: (requestId: string) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Deterministic, non-model-derived event id for a Moltnet-delivered wake
|
|
58
|
+
* acceptance. Distinct from `controlWakeAcceptedEventId` (own `.delivery.`
|
|
59
|
+
* segment) so the two paths never collide even if a future caller reused a
|
|
60
|
+
* `requestId` across both endpoints for the same target.
|
|
61
|
+
*/
|
|
62
|
+
export declare const deliveryWakeAcceptedEventId: (requestId: string) => string;
|
|
63
|
+
export interface EmitControlWakeAcceptedInput {
|
|
64
|
+
causeEventIds?: string[];
|
|
65
|
+
operatorName: string;
|
|
66
|
+
requestId: string;
|
|
67
|
+
runId?: string;
|
|
68
|
+
runtimeHomePath: string;
|
|
69
|
+
targetAgentId: string;
|
|
70
|
+
wakeKind: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Stamps `control.wake.accepted` once root's operator-control endpoint has
|
|
74
|
+
* verified the bearer token and is about to wake `targetAgentId`.
|
|
75
|
+
* `principal_id` is always `operator:<operatorName>` (the authenticated
|
|
76
|
+
* operator behind the verified token), never derived from the request body.
|
|
77
|
+
* `run_id` defaults to `resolveRunId()` like every other daimon emitter.
|
|
78
|
+
*/
|
|
79
|
+
export declare const emitControlWakeAccepted: (input: EmitControlWakeAcceptedInput) => Promise<CausalEvent<ControlWakeAcceptedPayload>>;
|
|
80
|
+
export interface EmitDeliveryWakeAcceptedInput {
|
|
81
|
+
causeEventIds?: string[];
|
|
82
|
+
requestId: string;
|
|
83
|
+
runId?: string;
|
|
84
|
+
runtimeHomePath: string;
|
|
85
|
+
targetAgentId: string;
|
|
86
|
+
wakeKind: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Stamps `control.wake.accepted` once root's Moltnet loopback delivery
|
|
90
|
+
* endpoint (`/agents/:slug/wake`) is about to wake `targetAgentId` on behalf
|
|
91
|
+
* of an inter-agent message. `principal_id` is always the fixed
|
|
92
|
+
* `DELIVERY_PRINCIPAL_ID` (`system:moltnet`) — the delivering authority —
|
|
93
|
+
* never derived from a caller-supplied `from`/agent field, and never
|
|
94
|
+
* `operator:<name>` (that principal is reserved for the operator-only
|
|
95
|
+
* control endpoint; see `emitControlWakeAccepted`). `run_id` defaults to
|
|
96
|
+
* `resolveRunId()` like every other daimon emitter.
|
|
97
|
+
*/
|
|
98
|
+
export declare const emitDeliveryWakeAccepted: (input: EmitDeliveryWakeAcceptedInput) => Promise<CausalEvent<DeliveryWakeAcceptedPayload>>;
|
|
99
|
+
export interface EmitControlWakeDeniedInput {
|
|
100
|
+
causeEventIds?: string[];
|
|
101
|
+
operatorName: string;
|
|
102
|
+
reason: string;
|
|
103
|
+
requestId: string;
|
|
104
|
+
runId?: string;
|
|
105
|
+
runtimeHomePath: string;
|
|
106
|
+
targetAgentId: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Stamps `control.wake.denied` when root's operator-control endpoint rejects
|
|
110
|
+
* a wake request over a missing or invalid bearer token. Deny paths must
|
|
111
|
+
* never drop silently (see `specs/CAUSAL.md` enforcement point #3 / T5):
|
|
112
|
+
* every 401 the endpoint returns should carry exactly one of these. As with
|
|
113
|
+
* `emitControlWakeAccepted`, `principal_id` is always the authenticated
|
|
114
|
+
* operator identity, never a value read from the request.
|
|
115
|
+
*/
|
|
116
|
+
export declare const emitControlWakeDenied: (input: EmitControlWakeDeniedInput) => Promise<CausalEvent<ControlWakeDeniedPayload>>;
|
|
117
|
+
//# sourceMappingURL=controlCausal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlCausal.d.ts","sourceRoot":"","sources":["../../src/observability/controlCausal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,WAAW,EAA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