@noopolis/daimon 0.1.2 → 0.2.1
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 +275 -51
- package/dist/contracts/attentionContract.d.ts +142 -0
- package/dist/contracts/attentionContract.d.ts.map +1 -0
- package/dist/contracts/attentionContract.js +21 -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/grokBrokerTaskClock.d.ts +18 -0
- package/dist/contracts/grokBrokerTaskClock.d.ts.map +1 -0
- package/dist/contracts/grokBrokerTaskClock.js +16 -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 +841 -0
- package/dist/contracts/organizationRuntimeContract.d.ts.map +1 -0
- package/dist/contracts/organizationRuntimeContract.js +123 -0
- package/dist/contracts/runtimeContractManifest.d.ts +1822 -0
- package/dist/contracts/runtimeContractManifest.d.ts.map +1 -0
- package/dist/contracts/runtimeContractManifest.js +206 -0
- package/dist/contracts/shellEnvironmentPolicy.d.ts +3 -0
- package/dist/contracts/shellEnvironmentPolicy.d.ts.map +1 -0
- package/dist/contracts/shellEnvironmentPolicy.js +5 -0
- package/dist/contracts/wakeMomentContract.d.ts +61 -0
- package/dist/contracts/wakeMomentContract.d.ts.map +1 -0
- package/dist/contracts/wakeMomentContract.js +27 -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/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/examples/jungianPlayAgent.d.ts +1 -0
- package/dist/examples/jungianPlayAgent.d.ts.map +1 -1
- package/dist/examples/jungianPlayAgent.js +6 -2
- package/dist/mcp/toolServer.d.ts +19 -2
- package/dist/mcp/toolServer.d.ts.map +1 -1
- package/dist/mcp/toolServer.js +57 -17
- package/dist/observability/causalEvents.d.ts +6 -6
- package/dist/observability/causalEvents.d.ts.map +1 -1
- package/dist/observability/causalEvents.js +107 -19
- 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 +169 -0
- package/dist/pi/cliEnvironment.d.ts +12 -0
- package/dist/pi/cliEnvironment.d.ts.map +1 -0
- package/dist/pi/cliEnvironment.js +34 -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 +86 -24
- package/dist/pi/cliSession.d.ts.map +1 -1
- package/dist/pi/cliSession.js +251 -173
- package/dist/pi/cliSessionMcp.d.ts +9 -0
- package/dist/pi/cliSessionMcp.d.ts.map +1 -0
- package/dist/pi/cliSessionMcp.js +80 -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/engineTaskClock.d.ts +9 -0
- package/dist/pi/engineTaskClock.d.ts.map +1 -0
- package/dist/pi/engineTaskClock.js +28 -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 +58 -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/memoryClock.d.ts +25 -0
- package/dist/pi/memoryClock.d.ts.map +1 -0
- package/dist/pi/memoryClock.js +18 -0
- package/dist/pi/piAgentHandle.d.ts +6 -3
- package/dist/pi/piAgentHandle.d.ts.map +1 -1
- package/dist/pi/piAgentHandle.js +42 -12
- package/dist/pi/piAgentWakeSupport.d.ts +35 -0
- package/dist/pi/piAgentWakeSupport.d.ts.map +1 -1
- package/dist/pi/piAgentWakeSupport.js +4 -0
- package/dist/pi/piHarness.d.ts +18 -3
- package/dist/pi/piHarness.d.ts.map +1 -1
- package/dist/pi/piHarness.js +83 -14
- package/dist/pi/prompts.d.ts +1 -0
- package/dist/pi/prompts.d.ts.map +1 -1
- package/dist/pi/prompts.js +24 -0
- package/dist/pi/taskClockProcess.d.ts +6 -0
- package/dist/pi/taskClockProcess.d.ts.map +1 -0
- package/dist/pi/taskClockProcess.js +8 -0
- package/dist/pi/turnCausal.d.ts +4 -2
- package/dist/pi/turnCausal.d.ts.map +1 -1
- package/dist/pi/turnCausal.js +4 -4
- package/dist/pi/turnTrace.d.ts.map +1 -1
- package/dist/pi/turnTrace.js +5 -8
- package/dist/pi/wakeAcceptance.d.ts +1 -1
- package/dist/pi/wakeAcceptance.d.ts.map +1 -1
- package/dist/pi/wakeAcceptance.js +2 -2
- package/dist/pi/worldTrajectory.d.ts +1 -1
- package/dist/pi/worldTrajectory.d.ts.map +1 -1
- package/dist/pi/worldTrajectory.js +3 -3
- 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 +26 -0
- package/dist/runtime/attention.d.ts.map +1 -0
- package/dist/runtime/attention.js +49 -0
- package/dist/runtime/attentionDispatcher.d.ts +78 -0
- package/dist/runtime/attentionDispatcher.d.ts.map +1 -0
- package/dist/runtime/attentionDispatcher.js +365 -0
- package/dist/runtime/cli.d.ts +7 -0
- package/dist/runtime/cli.d.ts.map +1 -0
- package/dist/runtime/cli.js +256 -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 +40 -0
- package/dist/runtime/engineBrokerCapabilities.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCapabilities.js +69 -0
- package/dist/runtime/engineBrokerControlClient.d.ts +55 -0
- package/dist/runtime/engineBrokerControlClient.d.ts.map +1 -0
- package/dist/runtime/engineBrokerControlClient.js +228 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts +12 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCredentialJournal.js +26 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts +53 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerInferenceProtocol.js +65 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts +171 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpCallLog.js +231 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts +59 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpFacade.js +346 -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 +167 -0
- package/dist/runtime/engineBrokerProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerProtocol.js +357 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts +70 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts.map +1 -0
- package/dist/runtime/engineBrokerSealLedger.js +132 -0
- package/dist/runtime/engineBrokerService.d.ts +43 -0
- package/dist/runtime/engineBrokerService.d.ts.map +1 -0
- package/dist/runtime/engineBrokerService.js +196 -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 +55 -0
- package/dist/runtime/engineBrokerServiceConfig.d.ts.map +1 -0
- package/dist/runtime/engineBrokerServiceConfig.js +130 -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 +159 -0
- package/dist/runtime/engineDispatcher.d.ts +38 -0
- package/dist/runtime/engineDispatcher.d.ts.map +1 -0
- package/dist/runtime/engineDispatcher.js +228 -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 +23 -0
- package/dist/runtime/grokBrokerCredentialAuthority.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialAuthority.js +150 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts +6 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialReader.js +38 -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 +114 -0
- package/dist/runtime/grokBrokerProjection.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProjection.js +101 -0
- package/dist/runtime/grokBrokerProviderClock.d.ts +26 -0
- package/dist/runtime/grokBrokerProviderClock.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProviderClock.js +133 -0
- package/dist/runtime/grokBrokerProxy.d.ts +69 -0
- package/dist/runtime/grokBrokerProxy.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxy.js +326 -0
- package/dist/runtime/grokBrokerProxyJson.d.ts +10 -0
- package/dist/runtime/grokBrokerProxyJson.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxyJson.js +31 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts +30 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxyRequest.js +85 -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/grokBrokerRunBudget.d.ts +20 -0
- package/dist/runtime/grokBrokerRunBudget.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRunBudget.js +85 -0
- package/dist/runtime/grokBrokerSlot.d.ts +6 -0
- package/dist/runtime/grokBrokerSlot.d.ts.map +1 -0
- package/dist/runtime/grokBrokerSlot.js +21 -0
- package/dist/runtime/grokBrokerTaskClock.d.ts +32 -0
- package/dist/runtime/grokBrokerTaskClock.d.ts.map +1 -0
- package/dist/runtime/grokBrokerTaskClock.js +120 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts +180 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts.map +1 -0
- package/dist/runtime/grokBrokerTurnMeter.js +337 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts +89 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts.map +1 -0
- package/dist/runtime/grokBrokerWorkerConfig.js +154 -0
- package/dist/runtime/grokEngineBroker.d.ts +88 -0
- package/dist/runtime/grokEngineBroker.d.ts.map +1 -0
- package/dist/runtime/grokEngineBroker.js +202 -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 +82 -0
- package/dist/runtime/grokEngineBrokerTurn.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerTurn.js +348 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.d.ts +88 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.js +148 -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 +85 -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 +175 -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 +32 -0
- package/dist/runtime/grokWorkerHomeAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerHomeAttestation.js +75 -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 +31 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +27 -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 +168 -0
- package/dist/runtime/organizationRuntime.d.ts.map +1 -0
- package/dist/runtime/organizationRuntime.js +3 -0
- package/dist/runtime/organizationRuntimeAdmission.d.ts +6 -0
- package/dist/runtime/organizationRuntimeAdmission.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeAdmission.js +22 -0
- package/dist/runtime/organizationRuntimeControl.d.ts +51 -0
- package/dist/runtime/organizationRuntimeControl.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeControl.js +283 -0
- package/dist/runtime/organizationRuntimeHost.d.ts +19 -0
- package/dist/runtime/organizationRuntimeHost.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeHost.js +368 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts +6 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeParsing.js +373 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts +12 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeReadiness.js +67 -0
- package/dist/runtime/organizationRuntimeRecording.d.ts +7 -0
- package/dist/runtime/organizationRuntimeRecording.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeRecording.js +58 -0
- package/dist/runtime/physicalReadiness.d.ts +59 -0
- package/dist/runtime/physicalReadiness.d.ts.map +1 -0
- package/dist/runtime/physicalReadiness.js +176 -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 +336 -0
- package/dist/runtime/relocateRuntimeConfig.d.ts +14 -0
- package/dist/runtime/relocateRuntimeConfig.d.ts.map +1 -0
- package/dist/runtime/relocateRuntimeConfig.js +38 -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 +376 -0
- package/dist/runtime/storeCoordination.d.ts +33 -0
- package/dist/runtime/storeCoordination.d.ts.map +1 -0
- package/dist/runtime/storeCoordination.js +117 -0
- package/dist/runtime/taskClock.d.ts +42 -0
- package/dist/runtime/taskClock.d.ts.map +1 -0
- package/dist/runtime/taskClock.js +102 -0
- package/dist/runtime/taskClockProcess.d.ts +17 -0
- package/dist/runtime/taskClockProcess.d.ts.map +1 -0
- package/dist/runtime/taskClockProcess.js +58 -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 +155 -0
- package/dist/runtime/turnRequestLedger.d.ts.map +1 -0
- package/dist/runtime/turnRequestLedger.js +251 -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/wakeAcceptanceClaimDiagnostics.d.ts +34 -0
- package/dist/runtime/wakeAcceptanceClaimDiagnostics.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceClaimDiagnostics.js +79 -0
- package/dist/runtime/wakeAcceptanceIndex.d.ts +55 -0
- package/dist/runtime/wakeAcceptanceIndex.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceIndex.js +158 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts +25 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.js +54 -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 +25 -0
- package/dist/runtime/wakeAcceptanceRecord.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRecord.js +58 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts +36 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRetention.js +38 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts +113 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceStore.js +561 -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 +124 -0
- package/dist/runtime/wakeFuse.d.ts.map +1 -0
- package/dist/runtime/wakeFuse.js +466 -0
- package/dist/runtime/wakeMomentFs.d.ts +27 -0
- package/dist/runtime/wakeMomentFs.d.ts.map +1 -0
- package/dist/runtime/wakeMomentFs.js +223 -0
- package/dist/runtime/wakeMomentHistory.d.ts +26 -0
- package/dist/runtime/wakeMomentHistory.d.ts.map +1 -0
- package/dist/runtime/wakeMomentHistory.js +109 -0
- package/dist/runtime/wakeMomentIo.d.ts +22 -0
- package/dist/runtime/wakeMomentIo.d.ts.map +1 -0
- package/dist/runtime/wakeMomentIo.js +114 -0
- package/dist/runtime/wakeMomentRecorder.d.ts +33 -0
- package/dist/runtime/wakeMomentRecorder.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRecorder.js +81 -0
- package/dist/runtime/wakeMomentRetention.d.ts +7 -0
- package/dist/runtime/wakeMomentRetention.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRetention.js +143 -0
- package/dist/runtime/wakeMomentRows.d.ts +8 -0
- package/dist/runtime/wakeMomentRows.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRows.js +66 -0
- package/dist/runtime/wakeMomentSnapshot.d.ts +56 -0
- package/dist/runtime/wakeMomentSnapshot.d.ts.map +1 -0
- package/dist/runtime/wakeMomentSnapshot.js +248 -0
- package/package.json +22 -11
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
export declare const WAKE_ACCEPTANCE_VERSION: "noopolis.daimon.wake-acceptance.v2";
|
|
2
|
+
export declare const WAKE_RECEIPT_STATUS_VERSION: "noopolis.daimon.wake-receipt-status.v2";
|
|
3
|
+
export declare const WAKE_V2_VERSION: "noopolis.daimon.wake.v2";
|
|
4
|
+
export declare const ACTIVITY_V2_VERSION: "noopolis.daimon.organization-runtime-activity.v2";
|
|
5
|
+
export declare const MAX_WAKE_ACCEPTANCE_BYTES = 16384;
|
|
6
|
+
export declare const MAX_WAKE_ACCEPTANCE_RECORD_BYTES = 65536;
|
|
7
|
+
export declare const MAX_WAKE_COMPLETION_TEXT_BYTES = 16384;
|
|
8
|
+
/** Public HTTP body schema; bearer authentication is intentionally a header. */
|
|
9
|
+
export declare const WAKE_ACCEPTANCE_REQUEST_SCHEMA: {
|
|
10
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
11
|
+
readonly $id: "noopolis.daimon.wake-request.v2";
|
|
12
|
+
readonly type: "object";
|
|
13
|
+
readonly additionalProperties: false;
|
|
14
|
+
readonly required: readonly ["agent_id", "delivery_id", "event"];
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly agent_id: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly minLength: 1;
|
|
19
|
+
readonly maxLength: 16384;
|
|
20
|
+
readonly pattern: "\\S";
|
|
21
|
+
};
|
|
22
|
+
readonly delivery_id: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
readonly minLength: 1;
|
|
25
|
+
readonly maxLength: 16384;
|
|
26
|
+
readonly pattern: "\\S";
|
|
27
|
+
};
|
|
28
|
+
readonly event: {
|
|
29
|
+
readonly type: "object";
|
|
30
|
+
readonly additionalProperties: false;
|
|
31
|
+
readonly required: readonly ["version", "kind", "text", "occurred_at"];
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly version: {
|
|
34
|
+
readonly const: "noopolis.daimon.wake.v2";
|
|
35
|
+
};
|
|
36
|
+
readonly kind: {
|
|
37
|
+
readonly enum: readonly ["manual", "message", "schedule", "external"];
|
|
38
|
+
};
|
|
39
|
+
readonly text: {
|
|
40
|
+
readonly type: "string";
|
|
41
|
+
readonly maxLength: 16384;
|
|
42
|
+
};
|
|
43
|
+
readonly occurred_at: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
readonly pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export declare const WAKE_RECEIPT_STATUS_SCHEMA: {
|
|
52
|
+
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
53
|
+
readonly $id: "noopolis.daimon.wake-receipt-status.v2";
|
|
54
|
+
readonly type: "object";
|
|
55
|
+
readonly additionalProperties: false;
|
|
56
|
+
readonly required: readonly ["version", "acceptance_id", "agent_id", "delivery_id", "request_digest", "state", "accepted_at", "updated_at"];
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly version: {
|
|
59
|
+
readonly const: "noopolis.daimon.wake-receipt-status.v2";
|
|
60
|
+
};
|
|
61
|
+
readonly acceptance_id: {
|
|
62
|
+
readonly type: "string";
|
|
63
|
+
readonly pattern: "^[0-9a-f-]{36}$";
|
|
64
|
+
};
|
|
65
|
+
readonly agent_id: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
readonly delivery_id: {
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
};
|
|
71
|
+
readonly request_digest: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly pattern: "^[a-f0-9]{64}$";
|
|
74
|
+
};
|
|
75
|
+
readonly state: {
|
|
76
|
+
readonly enum: readonly ["accepted", "running", "completed", "failed", "stopped"];
|
|
77
|
+
};
|
|
78
|
+
readonly accepted_at: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
};
|
|
81
|
+
readonly updated_at: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
};
|
|
84
|
+
readonly execution_id: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
readonly pattern: "^[0-9a-f-]{36}$";
|
|
87
|
+
};
|
|
88
|
+
readonly deferred: {
|
|
89
|
+
readonly type: "boolean";
|
|
90
|
+
};
|
|
91
|
+
readonly code: {
|
|
92
|
+
readonly enum: readonly ["engine_failed", "host_stopped", "host_stopping", "queued_wake_stopped", "active_wake_aborted", "queue_full", "unknown_agent"];
|
|
93
|
+
};
|
|
94
|
+
readonly text: {
|
|
95
|
+
readonly type: "string";
|
|
96
|
+
readonly maxLength: 16384;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export type WakeReceiptState = "accepted" | "running" | "completed" | "failed" | "stopped";
|
|
101
|
+
/**
|
|
102
|
+
* Why a receipt reached its state, and every member is a state the runtime really
|
|
103
|
+
* produces: `queued_wake_stopped` and `active_wake_aborted` are the two shapes a
|
|
104
|
+
* shutdown gives a wake (`organizationRuntimeHost.ts` settles a queued job with the
|
|
105
|
+
* first and the in-flight one with the second), and a delivery reclaimed for restart
|
|
106
|
+
* used to record neither, because the only caller that could name them passed no
|
|
107
|
+
* code at all. A code that cannot be determined stays ABSENT: a plausible name for
|
|
108
|
+
* an undetermined cause is worse than no name, because it is acted on.
|
|
109
|
+
*/
|
|
110
|
+
export type WakeReceiptCode = "engine_failed" | "host_stopped" | "host_stopping" | "queued_wake_stopped" | "active_wake_aborted" | "queue_full" | "unknown_agent";
|
|
111
|
+
export type OrganizationRuntimeWakeAcceptanceRequest = Readonly<{
|
|
112
|
+
token: string | undefined;
|
|
113
|
+
agent_id: string;
|
|
114
|
+
delivery_id: string;
|
|
115
|
+
event: Readonly<{
|
|
116
|
+
version: typeof WAKE_V2_VERSION;
|
|
117
|
+
kind: "manual" | "message" | "schedule" | "external";
|
|
118
|
+
text: string;
|
|
119
|
+
occurred_at: string;
|
|
120
|
+
}>;
|
|
121
|
+
}>;
|
|
122
|
+
export type OrganizationRuntimeWakeAcceptance = Readonly<{
|
|
123
|
+
version: typeof WAKE_ACCEPTANCE_VERSION;
|
|
124
|
+
acceptance_id: string;
|
|
125
|
+
agent_id: string;
|
|
126
|
+
delivery_id: string;
|
|
127
|
+
request_digest: string;
|
|
128
|
+
state: "accepted";
|
|
129
|
+
accepted_at: string;
|
|
130
|
+
}>;
|
|
131
|
+
export type OrganizationRuntimeWakeReceiptStatus = Readonly<{
|
|
132
|
+
version: typeof WAKE_RECEIPT_STATUS_VERSION;
|
|
133
|
+
acceptance_id: string;
|
|
134
|
+
agent_id: string;
|
|
135
|
+
delivery_id: string;
|
|
136
|
+
request_digest: string;
|
|
137
|
+
state: WakeReceiptState;
|
|
138
|
+
accepted_at: string;
|
|
139
|
+
updated_at: string;
|
|
140
|
+
execution_id?: string;
|
|
141
|
+
deferred?: boolean;
|
|
142
|
+
code?: WakeReceiptCode;
|
|
143
|
+
text?: string;
|
|
144
|
+
}>;
|
|
145
|
+
/** Bounded authenticated reply payload; strips common credential shapes before persistence. */
|
|
146
|
+
export declare function sanitizeWakeCompletionText(value: string): string;
|
|
147
|
+
export type OrganizationRuntimeActivityV2Item = OrganizationRuntimeWakeReceiptStatus & Readonly<{
|
|
148
|
+
active: boolean;
|
|
149
|
+
queue_position?: number;
|
|
150
|
+
}>;
|
|
151
|
+
export type OrganizationRuntimeActivityV2 = Readonly<{
|
|
152
|
+
version: typeof ACTIVITY_V2_VERSION;
|
|
153
|
+
/**
|
|
154
|
+
* Whether this projection was read from a live runtime or sealed as the host
|
|
155
|
+
* stopped. Optional on the wire because a projection published before the seal
|
|
156
|
+
* existed must still parse; its absence means "not stated", never "running".
|
|
157
|
+
*/
|
|
158
|
+
state?: "running" | "stopped";
|
|
159
|
+
items: readonly OrganizationRuntimeActivityV2Item[];
|
|
160
|
+
executions?: readonly Readonly<{
|
|
161
|
+
agent_id: string;
|
|
162
|
+
execution_id: string;
|
|
163
|
+
state: "running";
|
|
164
|
+
delivery_ids: readonly string[];
|
|
165
|
+
}>[];
|
|
166
|
+
}>;
|
|
167
|
+
export type OrganizationRuntimeWakeAcceptanceResult = OrganizationRuntimeWakeAcceptance | Readonly<{
|
|
168
|
+
version: typeof WAKE_ACCEPTANCE_VERSION;
|
|
169
|
+
state: "rejected" | "stopped";
|
|
170
|
+
blocked?: Readonly<{
|
|
171
|
+
version: "noopolis.daimon.work-blocked.v1";
|
|
172
|
+
reason: "operator_stop" | "ledger_unavailable" | "host_stopping" | "host_stopped" | "queue_full";
|
|
173
|
+
retry_after_ms: number;
|
|
174
|
+
}>;
|
|
175
|
+
code: "unauthorized" | "invalid_request" | "unknown_agent" | "host_stopping" | "host_stopped" | "delivery_conflict";
|
|
176
|
+
}>;
|
|
177
|
+
export declare function parseWakeAcceptanceRequest(value: unknown): OrganizationRuntimeWakeAcceptanceRequest;
|
|
178
|
+
export declare function wakeAcceptanceDigest(request: OrganizationRuntimeWakeAcceptanceRequest): string;
|
|
179
|
+
//# sourceMappingURL=wakeAcceptanceTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wakeAcceptanceTypes.d.ts","sourceRoot":"","sources":["../../src/runtime/wakeAcceptanceTypes.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,uBAAuB,EAAG,oCAA6C,CAAC;AACrF,eAAO,MAA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AiC,GAAG,QAAQ,CAAC;IACjG,OAAO,EAAE,OAAO,uBAAuB,CAAC;IACxC,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,QAAQ,CAAC;QAAE,OAAO,EAAE,iCAAiC,CAAC;QAAC,MAAM,EAAE,eAAe,GAAG,oBAAoB,GAAG,eAAe,GAAG,cAAc,GAAG,YAAY,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7L,IAAI,EAAE,cAAc,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,mBAAmB,CAAC;CACrH,CAAC,CAAC;AAEH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,wCAAwC,CAgBnG;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wCAAwC,GAAG,MAAM,CAG9F"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { ORGANIZATION_RUNTIME_ACTIVITY_V2_VERSION } from "../contracts/runtimeContractManifest.js";
|
|
3
|
+
import { redactCredentialText } from "../core/credentialRedaction.js";
|
|
4
|
+
export const WAKE_ACCEPTANCE_VERSION = "noopolis.daimon.wake-acceptance.v2";
|
|
5
|
+
export const WAKE_RECEIPT_STATUS_VERSION = "noopolis.daimon.wake-receipt-status.v2";
|
|
6
|
+
export const WAKE_V2_VERSION = "noopolis.daimon.wake.v2";
|
|
7
|
+
export const ACTIVITY_V2_VERSION = ORGANIZATION_RUNTIME_ACTIVITY_V2_VERSION;
|
|
8
|
+
export const MAX_WAKE_ACCEPTANCE_BYTES = 16_384;
|
|
9
|
+
export const MAX_WAKE_ACCEPTANCE_RECORD_BYTES = 65_536;
|
|
10
|
+
export const MAX_WAKE_COMPLETION_TEXT_BYTES = 16_384;
|
|
11
|
+
/** Public HTTP body schema; bearer authentication is intentionally a header. */
|
|
12
|
+
export const WAKE_ACCEPTANCE_REQUEST_SCHEMA = {
|
|
13
|
+
$schema: "https://json-schema.org/draft/2020-12/schema", $id: "noopolis.daimon.wake-request.v2", type: "object", additionalProperties: false,
|
|
14
|
+
required: ["agent_id", "delivery_id", "event"], properties: {
|
|
15
|
+
agent_id: { type: "string", minLength: 1, maxLength: MAX_WAKE_ACCEPTANCE_BYTES, pattern: "\\S" },
|
|
16
|
+
delivery_id: { type: "string", minLength: 1, maxLength: MAX_WAKE_ACCEPTANCE_BYTES, pattern: "\\S" },
|
|
17
|
+
event: { type: "object", additionalProperties: false, required: ["version", "kind", "text", "occurred_at"], properties: {
|
|
18
|
+
version: { const: WAKE_V2_VERSION }, kind: { enum: ["manual", "message", "schedule", "external"] }, text: { type: "string", maxLength: MAX_WAKE_ACCEPTANCE_BYTES }, occurred_at: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$" }
|
|
19
|
+
} }
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const WAKE_RECEIPT_STATUS_SCHEMA = {
|
|
23
|
+
$schema: "https://json-schema.org/draft/2020-12/schema", $id: WAKE_RECEIPT_STATUS_VERSION, type: "object", additionalProperties: false,
|
|
24
|
+
required: ["version", "acceptance_id", "agent_id", "delivery_id", "request_digest", "state", "accepted_at", "updated_at"], properties: {
|
|
25
|
+
version: { const: WAKE_RECEIPT_STATUS_VERSION }, acceptance_id: { type: "string", pattern: "^[0-9a-f-]{36}$" }, agent_id: { type: "string" }, delivery_id: { type: "string" }, request_digest: { type: "string", pattern: "^[a-f0-9]{64}$" }, state: { enum: ["accepted", "running", "completed", "failed", "stopped"] }, accepted_at: { type: "string" }, updated_at: { type: "string" }, execution_id: { type: "string", pattern: "^[0-9a-f-]{36}$" }, deferred: { type: "boolean" }, code: { enum: ["engine_failed", "host_stopped", "host_stopping", "queued_wake_stopped", "active_wake_aborted", "queue_full", "unknown_agent"] }, text: { type: "string", maxLength: MAX_WAKE_COMPLETION_TEXT_BYTES }
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/** Bounded authenticated reply payload; strips common credential shapes before persistence. */
|
|
29
|
+
export function sanitizeWakeCompletionText(value) {
|
|
30
|
+
return redactCredentialText(value, [], MAX_WAKE_COMPLETION_TEXT_BYTES);
|
|
31
|
+
}
|
|
32
|
+
export function parseWakeAcceptanceRequest(value) {
|
|
33
|
+
const root = record(snapshot(value, "wake acceptance"), "wake acceptance");
|
|
34
|
+
exact(root, ["token", "agent_id", "delivery_id", "event"], "wake acceptance");
|
|
35
|
+
const event = record(root.event, "wake acceptance.event");
|
|
36
|
+
exact(event, ["version", "kind", "text", "occurred_at"], "wake acceptance.event");
|
|
37
|
+
const kind = text(event.kind, "wake acceptance.event.kind");
|
|
38
|
+
if (kind !== "manual" && kind !== "message" && kind !== "schedule" && kind !== "external")
|
|
39
|
+
throw new TypeError("wake acceptance.event.kind is not supported");
|
|
40
|
+
const body = text(event.text, "wake acceptance.event.text");
|
|
41
|
+
if (Buffer.byteLength(body, "utf8") > MAX_WAKE_ACCEPTANCE_BYTES)
|
|
42
|
+
throw new TypeError("wake acceptance.event.text exceeds the wake text limit");
|
|
43
|
+
if (text(event.version, "wake acceptance.event.version") !== WAKE_V2_VERSION)
|
|
44
|
+
throw new TypeError("wake acceptance.event.version is not supported");
|
|
45
|
+
return {
|
|
46
|
+
token: root.token === undefined ? undefined : text(root.token, "wake acceptance.token"),
|
|
47
|
+
agent_id: nonBlank(root.agent_id, "wake acceptance.agent_id"),
|
|
48
|
+
delivery_id: nonBlank(root.delivery_id, "wake acceptance.delivery_id"),
|
|
49
|
+
event: { version: WAKE_V2_VERSION, kind, text: body, occurred_at: rfc3339(event.occurred_at) }
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function wakeAcceptanceDigest(request) {
|
|
53
|
+
const canonical = JSON.stringify({ agent_id: request.agent_id, delivery_id: request.delivery_id, event: request.event });
|
|
54
|
+
return createHash("sha256").update(canonical).digest("hex");
|
|
55
|
+
}
|
|
56
|
+
function snapshot(value, label) {
|
|
57
|
+
if (value === undefined || value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number")
|
|
58
|
+
return value;
|
|
59
|
+
if (Array.isArray(value))
|
|
60
|
+
throw new TypeError(`${label} must be an object`);
|
|
61
|
+
if (typeof value !== "object" || Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
|
|
62
|
+
throw new TypeError(`${label} must be a plain own-properties object`);
|
|
63
|
+
const copied = Object.create(null);
|
|
64
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
65
|
+
if (typeof key !== "string")
|
|
66
|
+
throw new TypeError(`${label} must not contain symbol properties`);
|
|
67
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
68
|
+
if (descriptor === undefined || !descriptor.enumerable || !("value" in descriptor))
|
|
69
|
+
throw new TypeError(`${label}.${key} must be an enumerable data property`);
|
|
70
|
+
copied[key] = snapshot(descriptor.value, `${label}.${key}`);
|
|
71
|
+
}
|
|
72
|
+
return copied;
|
|
73
|
+
}
|
|
74
|
+
function record(value, label) {
|
|
75
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null)
|
|
76
|
+
throw new TypeError(`${label} must be a plain own-properties object`);
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function exact(value, expected, label) {
|
|
80
|
+
if (Object.keys(value).some((key) => !expected.includes(key)) || expected.some((key) => !Object.hasOwn(value, key)))
|
|
81
|
+
throw new TypeError(`${label} must contain exactly ${expected.join(", ")}`);
|
|
82
|
+
}
|
|
83
|
+
function text(value, label) {
|
|
84
|
+
if (typeof value !== "string" || Buffer.byteLength(value, "utf8") > MAX_WAKE_ACCEPTANCE_BYTES)
|
|
85
|
+
throw new TypeError(`${label} must be a bounded string`);
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
function nonBlank(value, label) { const result = text(value, label); if (!result.trim())
|
|
89
|
+
throw new TypeError(`${label} must not be blank`); return result; }
|
|
90
|
+
function rfc3339(value) {
|
|
91
|
+
const result = nonBlank(value, "wake acceptance.event.occurred_at");
|
|
92
|
+
if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(result) || Number.isNaN(Date.parse(result)) || new Date(result).toISOString() !== result)
|
|
93
|
+
throw new TypeError("wake acceptance.event.occurred_at must be an exact RFC3339 timestamp");
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export declare const WAKE_FUSE_VERSION: "noopolis.daimon.wake-fuse.v1";
|
|
2
|
+
export declare const WAKE_FUSE_DIRECTORY_ENV: "DAIMON_WAKE_FUSE_DIRECTORY";
|
|
3
|
+
export declare const WAKE_FUSE_EPOCH_ZONE_ENV: "DAIMON_WAKE_FUSE_EPOCH_ZONE";
|
|
4
|
+
export declare const DEFAULT_WAKE_FUSE_MAX_WAKES = 100;
|
|
5
|
+
export declare const DEFAULT_WAKE_FUSE_MAX_TOKENS = 5000000;
|
|
6
|
+
export type WakeFuseTripReason = "wake_ceiling" | "token_ceiling" | "operator_stop" | "ledger_unavailable";
|
|
7
|
+
export type WakeBudgetLimits = Readonly<{
|
|
8
|
+
maxExecutions?: number;
|
|
9
|
+
maxTokens?: number;
|
|
10
|
+
}>;
|
|
11
|
+
export type WakeBudgetSnapshot = Readonly<{
|
|
12
|
+
armed: boolean;
|
|
13
|
+
epoch: string;
|
|
14
|
+
state: "available" | "paused" | "stopped";
|
|
15
|
+
reason?: string;
|
|
16
|
+
executions_used: number;
|
|
17
|
+
executions_remaining: number;
|
|
18
|
+
tokens_used: number;
|
|
19
|
+
tokens_remaining: number;
|
|
20
|
+
agent_executions_used: number;
|
|
21
|
+
agent_executions_remaining?: number;
|
|
22
|
+
agent_tokens_used: number;
|
|
23
|
+
agent_tokens_remaining?: number;
|
|
24
|
+
}>;
|
|
25
|
+
export type WakeFuseVerdict = Readonly<{
|
|
26
|
+
state: "admitted";
|
|
27
|
+
}> | Readonly<{
|
|
28
|
+
state: "tripped";
|
|
29
|
+
reason: WakeFuseTripReason;
|
|
30
|
+
}> | Readonly<{
|
|
31
|
+
state: "paused";
|
|
32
|
+
reason: "agent_execution_ceiling" | "agent_token_ceiling";
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* The counting window, when the operator has not named one.
|
|
36
|
+
*
|
|
37
|
+
* WHY THIS IS DERIVED AND NOT CONFIGURED
|
|
38
|
+
* --------------------------------------
|
|
39
|
+
* `DAIMON_WAKE_FUSE_EPOCH` is read from the container's env file, and an env
|
|
40
|
+
* file is applied at container CREATION only. So an operator who wants a daily
|
|
41
|
+
* budget has to rewrite that file and RECREATE THE CONTAINER every day, and
|
|
42
|
+
* the only thing that ever did that was a daily rebuild. The budget was
|
|
43
|
+
* therefore coupled to a deploy: stop deploying daily and the wake ceiling
|
|
44
|
+
* never resets, and the organization stops admitting wakes for good.
|
|
45
|
+
*
|
|
46
|
+
* A date-derived epoch removes the coupling instead of moving it. There is no
|
|
47
|
+
* file to rewrite, no deploy, no restart, and no clock for anybody to forget.
|
|
48
|
+
*
|
|
49
|
+
* An explicitly configured epoch still wins, unchanged: an operator pinning one
|
|
50
|
+
* window is doing it deliberately, and this must not roll it out from under
|
|
51
|
+
* them.
|
|
52
|
+
*/
|
|
53
|
+
export declare function derivedEpoch(organizationKey: string, at: Date, zone: string): string;
|
|
54
|
+
export type WakeFuseOptions = Readonly<{
|
|
55
|
+
organizationKey: string;
|
|
56
|
+
environment?: NodeJS.ProcessEnv;
|
|
57
|
+
now?: () => Date;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Durable catastrophic-wake admission fuse for one organization/container.
|
|
61
|
+
*
|
|
62
|
+
* Operator trip: `docker exec <container> touch /var/lib/spawnfile/daimon/usage/fuse.stop`.
|
|
63
|
+
* Unlike `recordTurnUsage` ("advisory: never rejects"), every storage or
|
|
64
|
+
* evaluation failure here rejects admission: this safety boundary fails closed.
|
|
65
|
+
*/
|
|
66
|
+
export declare class WakeFuse {
|
|
67
|
+
private readonly armed;
|
|
68
|
+
private readonly directory;
|
|
69
|
+
private epoch;
|
|
70
|
+
private epochStartedAt;
|
|
71
|
+
private readonly maxWakes;
|
|
72
|
+
private readonly maxTokens;
|
|
73
|
+
private admissions;
|
|
74
|
+
private readonly usageLedgerPath;
|
|
75
|
+
private readonly now;
|
|
76
|
+
private readonly nextEpoch;
|
|
77
|
+
private serial;
|
|
78
|
+
private reason;
|
|
79
|
+
private tripMarkerMissing;
|
|
80
|
+
private constructor();
|
|
81
|
+
static open(options: WakeFuseOptions): Promise<WakeFuse>;
|
|
82
|
+
admit(agentId: string, deliveryId: string, limits?: WakeBudgetLimits): Promise<WakeFuseVerdict>;
|
|
83
|
+
/**
|
|
84
|
+
* The budget as the caller should act on it NOW — which means after the day
|
|
85
|
+
* has been allowed to roll.
|
|
86
|
+
*
|
|
87
|
+
* This is the gate the scheduler actually consults: `AttentionDispatcher.drain()`
|
|
88
|
+
* returns at `snapshot().state !== "available"` before it ever reaches
|
|
89
|
+
* `admit()`. Rolling only inside `admitNow` therefore never fired for an
|
|
90
|
+
* organization that had hit its ceiling — it stayed paused across midnight
|
|
91
|
+
* and only a process restart could renew the budget. The roll is serialized
|
|
92
|
+
* with admissions so a snapshot and an admission never see two windows.
|
|
93
|
+
*/
|
|
94
|
+
snapshot(agentId: string, limits?: WakeBudgetLimits): Promise<WakeBudgetSnapshot>;
|
|
95
|
+
private snapshotNow;
|
|
96
|
+
pollOperatorStop(): Promise<WakeFuseTripReason | undefined>;
|
|
97
|
+
tripped(): WakeFuseTripReason | undefined;
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Moves the counting window when the derived day has changed.
|
|
101
|
+
*
|
|
102
|
+
* Called at admission, which is the only moment the answer can matter: the
|
|
103
|
+
* organization runtime is a long-lived process, so an epoch computed once at
|
|
104
|
+
* open() would be the same epoch a week later.
|
|
105
|
+
*
|
|
106
|
+
* WHAT ROLLS AND WHAT DOES NOT
|
|
107
|
+
* ----------------------------
|
|
108
|
+
* A new window clears a CEILING trip, exactly as selecting a new epoch by
|
|
109
|
+
* hand always did: `readTripMarker` only honours a marker belonging to the
|
|
110
|
+
* current epoch. It does NOT clear an operator stop. `fuse.stop` is checked
|
|
111
|
+
* by existence and is deliberately not epoch-scoped, so a parked newsroom
|
|
112
|
+
* stays parked across midnight. That asymmetry is the whole point: a budget
|
|
113
|
+
* is a thing that renews, an operator stop is a decision that does not.
|
|
114
|
+
*
|
|
115
|
+
* Admissions are rebuilt from the ledger rather than emptied, so a clock that
|
|
116
|
+
* steps BACKWARD into a window that already spent wakes does not hand the
|
|
117
|
+
* organization a fresh budget.
|
|
118
|
+
*/
|
|
119
|
+
private rollEpochIfDue;
|
|
120
|
+
private admitNow;
|
|
121
|
+
private trip;
|
|
122
|
+
}
|
|
123
|
+
export declare function resolveWakeFuseDirectory(environment?: NodeJS.ProcessEnv): string;
|
|
124
|
+
//# sourceMappingURL=wakeFuse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wakeFuse.d.ts","sourceRoot":"","sources":["../../src/runtime/wakeFuse.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,EAAG,8BAAuC,CAAC;AACzE,eAAO,MAAM,uBAAuB,EAAG,4BAAqC,CAAC;AAC7E,eAAO,MAAM,wBAAwB,EAAG,6BAAsC,CAAC;AAC/E,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,eAAO,MAAM,4BAA4B,UAAY,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,oBAAoB,CAAC;AAC3G,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,C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