@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,38 @@
|
|
|
1
|
+
export type AgySubscriptionRealm = Readonly<{
|
|
2
|
+
busAddress: string;
|
|
3
|
+
close(): Promise<void>;
|
|
4
|
+
}>;
|
|
5
|
+
export type AgySubscriptionRealmOptions = Readonly<{
|
|
6
|
+
dbusDaemon?: string;
|
|
7
|
+
durablePath?: string;
|
|
8
|
+
flock?: string;
|
|
9
|
+
gnomeKeyringDaemon?: string;
|
|
10
|
+
shell?: string;
|
|
11
|
+
socketReady?: (socketPath: string) => Promise<boolean>;
|
|
12
|
+
temporaryRoot?: string;
|
|
13
|
+
unlockSecretPath?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const createAgyRealmCommands: (input: {
|
|
16
|
+
busSocketPath: string;
|
|
17
|
+
controlDirectory: string;
|
|
18
|
+
dbusDaemon?: string;
|
|
19
|
+
flock?: string;
|
|
20
|
+
gnomeKeyringDaemon?: string;
|
|
21
|
+
shell?: string;
|
|
22
|
+
}) => Readonly<{
|
|
23
|
+
bus: {
|
|
24
|
+
command: string;
|
|
25
|
+
args: string[];
|
|
26
|
+
};
|
|
27
|
+
keyring: {
|
|
28
|
+
command: string;
|
|
29
|
+
args: string[];
|
|
30
|
+
};
|
|
31
|
+
lease: {
|
|
32
|
+
command: string;
|
|
33
|
+
args: string[];
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export declare function startAgySubscriptionRealm(options?: AgySubscriptionRealmOptions): Promise<AgySubscriptionRealm>;
|
|
37
|
+
export declare function readAgyRealmUnlockSecret(sourcePath: string): Promise<Buffer>;
|
|
38
|
+
//# sourceMappingURL=agySubscriptionRealm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agySubscriptionRealm.d.ts","sourceRoot":"","sources":["../../src/runtime/agySubscriptionRealm.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC,CAAC;AAUH,eAAO,MAAM,sBAAsB,GAAI,OAAO;IAC5C,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KAAG,QAAQ,CAAC;IACX,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACzC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IAC7C,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CAC5C,CAkBC,CAAC;AAEH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,oBAAoB,CAAC,CA6C/B;AAED,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqBlF"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { constants } from "node:fs";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { chmod, lstat, mkdir, mkdtemp, open, realpath, rm } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { terminateChild, trackCliChild } from "../pi/cliProcess.js";
|
|
7
|
+
import { AGY_SUBSCRIPTION_REALM } from "./contractManifest.js";
|
|
8
|
+
const START_TIMEOUT_MS = 5_000;
|
|
9
|
+
export const createAgyRealmCommands = (input) => ({
|
|
10
|
+
bus: {
|
|
11
|
+
command: input.dbusDaemon ?? "dbus-daemon",
|
|
12
|
+
args: ["--session", "--nofork", "--nopidfile", `--address=unix:path=${input.busSocketPath}`]
|
|
13
|
+
},
|
|
14
|
+
keyring: {
|
|
15
|
+
command: input.gnomeKeyringDaemon ?? "gnome-keyring-daemon",
|
|
16
|
+
args: ["--foreground", "--components=secrets", "--unlock", `--control-directory=${input.controlDirectory}`]
|
|
17
|
+
},
|
|
18
|
+
lease: {
|
|
19
|
+
command: input.shell ?? "/bin/sh",
|
|
20
|
+
args: [
|
|
21
|
+
"-c",
|
|
22
|
+
"\"$1\" --exclusive --nonblock --conflict-exit-code 73 3 || exit 73; printf 'ready\\n'; IFS= read -r _daimon_hold || :",
|
|
23
|
+
"daimon-agy-lease",
|
|
24
|
+
input.flock ?? "flock"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export async function startAgySubscriptionRealm(options = {}) {
|
|
29
|
+
const durablePath = options.durablePath ?? AGY_SUBSCRIPTION_REALM.durableMountPath;
|
|
30
|
+
const unlockSecretPath = options.unlockSecretPath ?? AGY_SUBSCRIPTION_REALM.unlockMountPath;
|
|
31
|
+
await verifyPrivateDirectory(durablePath);
|
|
32
|
+
const unlockBytes = await readAgyRealmUnlockSecret(unlockSecretPath);
|
|
33
|
+
const ephemeralPath = await mkdtemp(path.join(options.temporaryRoot ?? os.tmpdir(), "daimon-agy-realm-"));
|
|
34
|
+
await chmod(ephemeralPath, 0o700);
|
|
35
|
+
const busSocketPath = path.join(ephemeralPath, "bus");
|
|
36
|
+
const controlDirectory = path.join(ephemeralPath, "keyring");
|
|
37
|
+
await mkdir(controlDirectory, { mode: 0o700 });
|
|
38
|
+
const commands = createAgyRealmCommands({
|
|
39
|
+
busSocketPath,
|
|
40
|
+
controlDirectory,
|
|
41
|
+
dbusDaemon: options.dbusDaemon,
|
|
42
|
+
flock: options.flock,
|
|
43
|
+
gnomeKeyringDaemon: options.gnomeKeyringDaemon,
|
|
44
|
+
shell: options.shell
|
|
45
|
+
});
|
|
46
|
+
const children = [];
|
|
47
|
+
let closePromise;
|
|
48
|
+
try {
|
|
49
|
+
const lease = await acquireLease(durablePath, commands.lease);
|
|
50
|
+
children.push(lease);
|
|
51
|
+
const bus = ownedSpawn(commands.bus.command, commands.bus.args, realmEnvironment(durablePath, ephemeralPath), ["ignore", "ignore", "ignore"]);
|
|
52
|
+
children.push(bus);
|
|
53
|
+
await waitForSocket(busSocketPath, bus, options.socketReady);
|
|
54
|
+
const busAddress = `unix:path=${busSocketPath}`;
|
|
55
|
+
const environment = { ...realmEnvironment(durablePath, ephemeralPath), DBUS_SESSION_BUS_ADDRESS: busAddress };
|
|
56
|
+
const keyring = ownedSpawn(commands.keyring.command, commands.keyring.args, environment, ["pipe", "ignore", "ignore"]);
|
|
57
|
+
children.push(keyring);
|
|
58
|
+
await deliverUnlockSecret(keyring, unlockBytes);
|
|
59
|
+
await waitForSocket(path.join(controlDirectory, "control"), keyring, options.socketReady);
|
|
60
|
+
const close = () => closePromise ??= cleanup(children, ephemeralPath);
|
|
61
|
+
return { busAddress, close };
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
try {
|
|
65
|
+
await cleanup(children, ephemeralPath);
|
|
66
|
+
}
|
|
67
|
+
catch (cleanupError) {
|
|
68
|
+
throw redactRealmFailure(new AggregateError([error, cleanupError], "AGY subscription realm startup cleanup failed"));
|
|
69
|
+
}
|
|
70
|
+
throw redactRealmFailure(error);
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
unlockBytes.fill(0);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function readAgyRealmUnlockSecret(sourcePath) {
|
|
77
|
+
let handle;
|
|
78
|
+
try {
|
|
79
|
+
const before = await lstat(sourcePath);
|
|
80
|
+
assertUnlockIdentity(before);
|
|
81
|
+
handle = await open(sourcePath, constants.O_RDONLY | noFollow());
|
|
82
|
+
const opened = await handle.stat();
|
|
83
|
+
assertUnlockIdentity(opened);
|
|
84
|
+
if (!sameIdentity(identity(before), identity(opened)))
|
|
85
|
+
throw new Error("changed");
|
|
86
|
+
const bytes = Buffer.alloc(Number(opened.size));
|
|
87
|
+
const { bytesRead } = await handle.read(bytes, 0, bytes.length, 0);
|
|
88
|
+
if (bytesRead !== bytes.length || bytes.includes(0) || bytes.includes(10) || bytes.includes(13)) {
|
|
89
|
+
bytes.fill(0);
|
|
90
|
+
throw new Error("invalid bytes");
|
|
91
|
+
}
|
|
92
|
+
return bytes;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
throw new Error("AGY subscription realm unlock secret is unavailable or unsafe");
|
|
96
|
+
}
|
|
97
|
+
finally {
|
|
98
|
+
await handle?.close().catch(() => undefined);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function verifyPrivateDirectory(directory) {
|
|
102
|
+
try {
|
|
103
|
+
const before = await lstat(directory);
|
|
104
|
+
if (!before.isDirectory() || before.isSymbolicLink() || before.uid !== process.getuid?.()
|
|
105
|
+
|| (before.mode & 0o777) !== AGY_SUBSCRIPTION_REALM.directoryMode)
|
|
106
|
+
throw new Error("unsafe");
|
|
107
|
+
const canonical = await realpath(directory);
|
|
108
|
+
if (canonical !== path.resolve(directory))
|
|
109
|
+
throw new Error("linked");
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
throw new Error("AGY subscription realm durable state is unavailable or unsafe");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function acquireLease(durablePath, command) {
|
|
116
|
+
const lockPath = path.join(durablePath, ".daimon-lease");
|
|
117
|
+
let lock;
|
|
118
|
+
try {
|
|
119
|
+
lock = await open(lockPath, constants.O_CREAT | constants.O_RDWR | noFollow(), 0o600);
|
|
120
|
+
const entry = await lock.stat();
|
|
121
|
+
if (!entry.isFile() || entry.isSymbolicLink() || entry.uid !== process.getuid?.()
|
|
122
|
+
|| entry.nlink !== 1 || (entry.mode & 0o777) !== 0o600)
|
|
123
|
+
throw new Error("unsafe lease");
|
|
124
|
+
const child = ownedSpawn(command.command, command.args, leaseEnvironment(), ["pipe", "pipe", "ignore", lock.fd]);
|
|
125
|
+
try {
|
|
126
|
+
await waitForReady(child);
|
|
127
|
+
return child;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
try {
|
|
131
|
+
await terminateChild(child);
|
|
132
|
+
}
|
|
133
|
+
catch (cleanupError) {
|
|
134
|
+
throw new AggregateError([error, cleanupError], "lease acquisition cleanup failed");
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
throw new Error("AGY subscription realm is already in use or cannot be leased");
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
await lock?.close().catch(() => undefined);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function deliverUnlockSecret(keyring, secret) {
|
|
147
|
+
if (keyring.stdin === null)
|
|
148
|
+
throw new Error("keyring input is unavailable");
|
|
149
|
+
await new Promise((resolve, reject) => {
|
|
150
|
+
const fail = () => reject(new Error("keyring stopped before unlock"));
|
|
151
|
+
keyring.once("close", fail);
|
|
152
|
+
keyring.once("error", fail);
|
|
153
|
+
keyring.stdin.once("error", fail);
|
|
154
|
+
keyring.stdin.end(secret, () => {
|
|
155
|
+
keyring.off("close", fail);
|
|
156
|
+
keyring.off("error", fail);
|
|
157
|
+
keyring.stdin.off("error", fail);
|
|
158
|
+
resolve();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function ownedSpawn(command, args, env, stdio) {
|
|
163
|
+
return trackCliChild(spawn(command, args, {
|
|
164
|
+
detached: process.platform !== "win32",
|
|
165
|
+
env,
|
|
166
|
+
stdio
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
async function waitForSocket(socketPath, child, socketReady) {
|
|
170
|
+
const deadline = Date.now() + START_TIMEOUT_MS;
|
|
171
|
+
while (Date.now() < deadline) {
|
|
172
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
173
|
+
throw new Error("bus stopped");
|
|
174
|
+
try {
|
|
175
|
+
if (socketReady ? await socketReady(socketPath) : await defaultSocketReady(socketPath))
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
catch { /* not ready */ }
|
|
179
|
+
await delay(20);
|
|
180
|
+
}
|
|
181
|
+
throw new Error("bus startup timed out");
|
|
182
|
+
}
|
|
183
|
+
async function defaultSocketReady(socketPath) {
|
|
184
|
+
const entry = await lstat(socketPath);
|
|
185
|
+
return entry.isSocket() && entry.uid === process.getuid?.();
|
|
186
|
+
}
|
|
187
|
+
function waitForReady(child) {
|
|
188
|
+
return new Promise((resolve, reject) => {
|
|
189
|
+
const timer = setTimeout(() => reject(new Error("lease startup timed out")), START_TIMEOUT_MS);
|
|
190
|
+
child.stdout?.once("data", (chunk) => {
|
|
191
|
+
clearTimeout(timer);
|
|
192
|
+
if (chunk.toString("utf8") === "ready\n")
|
|
193
|
+
resolve();
|
|
194
|
+
else
|
|
195
|
+
reject(new Error("lease response invalid"));
|
|
196
|
+
});
|
|
197
|
+
child.once("close", () => { clearTimeout(timer); reject(new Error("lease rejected")); });
|
|
198
|
+
child.once("error", () => { clearTimeout(timer); reject(new Error("lease failed")); });
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
async function cleanup(children, ephemeralPath) {
|
|
202
|
+
const failures = [];
|
|
203
|
+
for (const child of [...children].reverse()) {
|
|
204
|
+
child.stdin?.end();
|
|
205
|
+
try {
|
|
206
|
+
await terminateChild(child);
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
failures.push(error);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
await rm(ephemeralPath, { recursive: true, force: true });
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
failures.push(error);
|
|
217
|
+
}
|
|
218
|
+
if (failures.length > 0)
|
|
219
|
+
throw new AggregateError(failures, "AGY subscription realm cleanup failed");
|
|
220
|
+
}
|
|
221
|
+
const realmEnvironment = (durablePath, ephemeralPath) => ({
|
|
222
|
+
HOME: durablePath,
|
|
223
|
+
LANG: "C",
|
|
224
|
+
LC_ALL: "C",
|
|
225
|
+
PATH: process.env.PATH,
|
|
226
|
+
XDG_DATA_HOME: durablePath,
|
|
227
|
+
XDG_RUNTIME_DIR: ephemeralPath
|
|
228
|
+
});
|
|
229
|
+
const leaseEnvironment = () => ({ LANG: "C", LC_ALL: "C", PATH: process.env.PATH });
|
|
230
|
+
const delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
231
|
+
const noFollow = () => constants.O_NOFOLLOW ?? 0;
|
|
232
|
+
const identity = (value) => ({ dev: Number(value.dev), ino: Number(value.ino), mode: Number(value.mode) & 0o7777, nlink: Number(value.nlink), size: Number(value.size), uid: Number(value.uid) });
|
|
233
|
+
const sameIdentity = (left, right) => left.dev === right.dev && left.ino === right.ino && left.mode === right.mode && left.nlink === right.nlink && left.size === right.size && left.uid === right.uid;
|
|
234
|
+
const assertUnlockIdentity = (entry) => {
|
|
235
|
+
const value = identity(entry);
|
|
236
|
+
if (!entry.isFile() || entry.isSymbolicLink() || value.uid !== process.getuid?.() || value.nlink !== 1
|
|
237
|
+
|| (value.mode & 0o777) !== AGY_SUBSCRIPTION_REALM.fileMode || value.size < 1 || value.size > AGY_SUBSCRIPTION_REALM.maxUnlockBytes)
|
|
238
|
+
throw new Error("unsafe");
|
|
239
|
+
};
|
|
240
|
+
const redactRealmFailure = (error) => error instanceof Error && /^AGY subscription realm/u.test(error.message)
|
|
241
|
+
? error
|
|
242
|
+
: new Error("AGY subscription realm could not be started", { cause: error });
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AttentionConfig } from "../contracts/attentionContract.js";
|
|
3
|
+
export type { AttentionConfig } from "../contracts/attentionContract.js";
|
|
4
|
+
export type AttentionMessage = Readonly<{
|
|
5
|
+
delivery_id: string;
|
|
6
|
+
acceptance_id: string;
|
|
7
|
+
kind: string;
|
|
8
|
+
text: string;
|
|
9
|
+
occurred_at: string;
|
|
10
|
+
}>;
|
|
11
|
+
export type AttentionTurn = Readonly<{
|
|
12
|
+
executionId: string;
|
|
13
|
+
messages: readonly AttentionMessage[];
|
|
14
|
+
budget(): Promise<unknown>;
|
|
15
|
+
disposition(deliveryId: string, disposition: "complete" | "defer"): Promise<void>;
|
|
16
|
+
}>;
|
|
17
|
+
/** Owned by one control host; never shared across hosts or agent identities. */
|
|
18
|
+
export type AttentionRegistry = Map<string, AttentionTurn>;
|
|
19
|
+
export declare function attentionTools(agentId: string, registry: AttentionRegistry): ToolDefinition[];
|
|
20
|
+
export declare function parseAttention(value: unknown): AttentionConfig;
|
|
21
|
+
//# sourceMappingURL=attention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../../src/runtime/attention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,YAAY,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACzI,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACtC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnF,CAAC,CAAC;AACH,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAqB7F;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAS9D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function attentionTools(agentId, registry) {
|
|
2
|
+
const current = () => { const turn = registry.get(agentId); if (!turn)
|
|
3
|
+
throw new Error("No active inbox turn"); return turn; };
|
|
4
|
+
return [{
|
|
5
|
+
name: "daimon_inbox", label: "Current inbox", description: "Read this turn's selected deliveries and remaining execution allowance. Reading does not complete a delivery. Explicitly complete or defer each selected message.",
|
|
6
|
+
parameters: { type: "object", additionalProperties: false, properties: {} },
|
|
7
|
+
async execute() {
|
|
8
|
+
const turn = current();
|
|
9
|
+
const details = { version: "noopolis.daimon.inbox.v1", execution_id: turn.executionId, messages: turn.messages, budget: await turn.budget() };
|
|
10
|
+
return { content: [{ type: "text", text: JSON.stringify(details) }], details };
|
|
11
|
+
}
|
|
12
|
+
}, {
|
|
13
|
+
name: "daimon_inbox_disposition", label: "Resolve an inbox delivery", description: "Mark one selected delivery complete only after handling it, or defer it until a later external wake. Unmarked deliveries stay pending. Completion is durable and cannot be undone.",
|
|
14
|
+
parameters: { type: "object", additionalProperties: false, required: ["delivery_id", "disposition"], properties: { delivery_id: { type: "string", minLength: 1 }, disposition: { enum: ["complete", "defer"] } } },
|
|
15
|
+
async execute(_id, params) {
|
|
16
|
+
const input = params;
|
|
17
|
+
if (input.disposition !== "complete" && input.disposition !== "defer")
|
|
18
|
+
throw new Error("Invalid inbox disposition");
|
|
19
|
+
await current().disposition(input.delivery_id, input.disposition);
|
|
20
|
+
const details = { delivery_id: input.delivery_id, disposition: input.disposition };
|
|
21
|
+
return { content: [{ type: "text", text: JSON.stringify(details) }], details };
|
|
22
|
+
}
|
|
23
|
+
}];
|
|
24
|
+
}
|
|
25
|
+
export function parseAttention(value) {
|
|
26
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
27
|
+
throw new TypeError("attention must be an object");
|
|
28
|
+
const result = value;
|
|
29
|
+
const bounds = { maxBatchMessages: [1, 32], maxBatchBytes: [1024, 12000], maxExecutions: [1, Number.MAX_SAFE_INTEGER], maxTokens: [1, Number.MAX_SAFE_INTEGER] };
|
|
30
|
+
for (const [key, value] of Object.entries(result)) {
|
|
31
|
+
const bound = bounds[key];
|
|
32
|
+
if (!Object.hasOwn(bounds, key) || !bound || typeof value !== "number" || !Number.isSafeInteger(value) || value < bound[0] || value > bound[1])
|
|
33
|
+
throw new TypeError(`attention.${key} is outside its bound`);
|
|
34
|
+
}
|
|
35
|
+
return { ...result };
|
|
36
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AttentionRegistry } from "./attention.js";
|
|
2
|
+
import type { OrganizationRuntimeAgentConfig, OrganizationRuntimeHost } from "./organizationRuntime.js";
|
|
3
|
+
import { WakeAcceptanceStore } from "./wakeAcceptanceStore.js";
|
|
4
|
+
import type { StoredWakeAcceptanceRecord } from "./wakeAcceptanceRecord.js";
|
|
5
|
+
import { WakeFuse } from "./wakeFuse.js";
|
|
6
|
+
type Options = Readonly<{
|
|
7
|
+
store: WakeAcceptanceStore;
|
|
8
|
+
host: OrganizationRuntimeHost;
|
|
9
|
+
fuse: WakeFuse;
|
|
10
|
+
agents: readonly OrganizationRuntimeAgentConfig[];
|
|
11
|
+
registry: AttentionRegistry;
|
|
12
|
+
token: string | undefined;
|
|
13
|
+
onIdle(agentId: string): void;
|
|
14
|
+
}>;
|
|
15
|
+
/** Durable deliveries wait here; only a selected execution reserves a budget slot. */
|
|
16
|
+
export declare class AttentionDispatcher {
|
|
17
|
+
private readonly options;
|
|
18
|
+
private readonly owner;
|
|
19
|
+
private readonly work;
|
|
20
|
+
private readonly observed;
|
|
21
|
+
private readonly generations;
|
|
22
|
+
private readonly waiters;
|
|
23
|
+
private readonly active;
|
|
24
|
+
private readonly errors;
|
|
25
|
+
private stopping;
|
|
26
|
+
private fatal;
|
|
27
|
+
constructor(options: Options);
|
|
28
|
+
notify(agentId: string, fresh?: boolean): void;
|
|
29
|
+
fatalReason(): "ledger_unavailable" | undefined;
|
|
30
|
+
busy(agentId: string): boolean;
|
|
31
|
+
activeExecutions(): {
|
|
32
|
+
state: "running";
|
|
33
|
+
execution_id: string;
|
|
34
|
+
delivery_ids: string[];
|
|
35
|
+
agent_id: string;
|
|
36
|
+
}[];
|
|
37
|
+
failure(agentId: string): string | undefined;
|
|
38
|
+
stop(): Promise<void>;
|
|
39
|
+
halt(): void;
|
|
40
|
+
private drain;
|
|
41
|
+
private execute;
|
|
42
|
+
private failClosed;
|
|
43
|
+
private waitUntil;
|
|
44
|
+
}
|
|
45
|
+
export declare function selectBatch(records: readonly StoredWakeAcceptanceRecord[], agent: OrganizationRuntimeAgentConfig, revisitDeferred: boolean): StoredWakeAcceptanceRecord[];
|
|
46
|
+
/**
|
|
47
|
+
* The inbox turn, task first.
|
|
48
|
+
*
|
|
49
|
+
* A delivery's own text *is* the work. Leading with bookkeeping and handing the
|
|
50
|
+
* model `JSON.stringify(messages)` buried the task: an agent read the JSON, did
|
|
51
|
+
* the accounting and deferred without doing the job (observed on Grok: nine
|
|
52
|
+
* model requests, no tool calls, nothing filed). The deliveries are therefore
|
|
53
|
+
* rendered as labelled blocks and the `daimon_inbox` accounting follows them as
|
|
54
|
+
* what to do *after* the work, with the machine-readable payload kept as a
|
|
55
|
+
* trailing appendix while it fits the same budget.
|
|
56
|
+
*
|
|
57
|
+
* Both tools are named the way the agent's own engine can call them. On Grok a
|
|
58
|
+
* Daimon tool is an MCP tool of server `daimon` and its bare name reaches
|
|
59
|
+
* nothing (`grokDaimonToolName`, the same contract module the worker's system
|
|
60
|
+
* prompt and identity envelope render from), so an agent handed the bare name
|
|
61
|
+
* cannot mark its work complete — and an unmarked, finished wake is recorded as
|
|
62
|
+
* deferred.
|
|
63
|
+
*/
|
|
64
|
+
export declare function inboxPrompt(messages: readonly unknown[], engine: OrganizationRuntimeAgentConfig["engine"]["kind"], maxBytes?: number): string;
|
|
65
|
+
export {};
|
|
66
|
+
//# sourceMappingURL=attentionDispatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attentionDispatcher.d.ts","sourceRoot":"","sources":["../../src/runtime/attentionDispatcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,8BAA8B,EAAE,uBAAuB,EAAiC,MAAM,0BAA0B,CAAC;AAEvI,OAAO,EAAE,mBAAmB,EAAwD,MAAM,0BAA0B,CAAC;AACrH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,KAAK,OAAO,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,mBAAmB,CAAC;IAAC,IAAI,EAAE,uBAAuB,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,SAAS,8BAA8B,EAAE,CAAC;IAAC,QAAQ,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAAC;AAEjP,sFAAsF;AACtF,qBAAa,mBAAmB;IAUlB,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgB;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoC;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuE;IAC9F,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAmC;gBACnB,OAAO,EAAE,OAAO;IAE7C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI;IAW5C,WAAW,IAAI,oBAAoB,GAAG,SAAS;IAC/C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAC9B,gBAAgB;;sBAnB0C,MAAM;sBAAgB,MAAM,EAAE;;;IAoBxF,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IACtC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,IAAI,IAAI,IAAI;YAEE,KAAK;YA2BL,OAAO;IAqErB,OAAO,CAAC,UAAU;YASJ,SAAS;CAOxB;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,0BAA0B,EAAE,EAAE,KAAK,EAAE,8BAA8B,EAAE,eAAe,EAAE,OAAO,GAAG,0BAA0B,EAAE,CAmBzK;AAcD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,MAAM,EAAE,8BAA8B,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAsB5I"}
|