@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,44 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { assertGrokWorkerDenyPathShape } from "./grokWorkerDenyPlacement.js";
|
|
4
|
+
export const GROK_WORKER_SANDBOX_PROFILE = "daimon-strict";
|
|
5
|
+
export const GROK_WORKER_SANDBOX_EVENTS_RELATIVE_PATH = "sessions/sandbox-events.jsonl";
|
|
6
|
+
/**
|
|
7
|
+
* The only source of `daimon-strict` sandbox profile bytes.
|
|
8
|
+
*
|
|
9
|
+
* Grok 1.0.34 runs every Landlock profile inside bubblewrap, and there a
|
|
10
|
+
* non-empty `deny` list works: each entry is bind-masked for both the shell
|
|
11
|
+
* tool and in-process `read_file` (P0: `/run/paideia` denied, controls intact).
|
|
12
|
+
* The strict base still reads all of `/run`, `/var`, `/tmp` and `/etc`, so the
|
|
13
|
+
* deny list — not Landlock's allowlist — is what keeps evaluator and host-bind
|
|
14
|
+
* paths away from the worker. Which paths to deny is a registration input
|
|
15
|
+
* supplied by the deployment; Daimon only renders, pins, and attests them.
|
|
16
|
+
*
|
|
17
|
+
* Entries are sorted and deduplicated so equal sets render equal bytes (and the
|
|
18
|
+
* same `profileSha256`). A path that is not absolute and canonical, or that
|
|
19
|
+
* carries a character TOML or Grok would reinterpret, is refused — and so is
|
|
20
|
+
* one that equals or contains a base-profile grant, the first half of the
|
|
21
|
+
* deny-placement policy (`grokWorkerDenyPlacement.ts`). The other half —
|
|
22
|
+
* the entry exists and every ancestor is searchable by the worker uid — needs
|
|
23
|
+
* a filesystem, so it is asserted by whoever provisions the paths and, on the
|
|
24
|
+
* direct path, before every turn.
|
|
25
|
+
*/
|
|
26
|
+
export function renderGrokWorkerSandboxProfile(denyPaths = []) {
|
|
27
|
+
const denied = [...new Set(denyPaths)].sort();
|
|
28
|
+
for (const entry of denied) {
|
|
29
|
+
if (!path.posix.isAbsolute(entry) || path.posix.normalize(entry) !== entry || entry === "/" || entry.endsWith("/") || /["\\\u0000-\u001f\u007f*?[\]]/u.test(entry)) {
|
|
30
|
+
throw new TypeError("invalid Grok worker sandbox deny path");
|
|
31
|
+
}
|
|
32
|
+
assertGrokWorkerDenyPathShape(entry);
|
|
33
|
+
}
|
|
34
|
+
return [
|
|
35
|
+
`[profiles.${GROK_WORKER_SANDBOX_PROFILE}]`,
|
|
36
|
+
'extends = "strict"',
|
|
37
|
+
"restrict_network = true",
|
|
38
|
+
`deny = [${denied.map((entry) => JSON.stringify(entry)).join(", ")}]`,
|
|
39
|
+
""
|
|
40
|
+
].join("\n");
|
|
41
|
+
}
|
|
42
|
+
export const grokWorkerSandboxProfileSha256 = (denyPaths = []) => createHash("sha256").update(renderGrokWorkerSandboxProfile(denyPaths)).digest("hex");
|
|
43
|
+
/** `$GROK_HOME` is the profile's directory; 1.0.34 logs sandbox events under `sessions/`. */
|
|
44
|
+
export const grokWorkerEventsPathFor = (profilePath) => path.posix.join(path.posix.dirname(profilePath), GROK_WORKER_SANDBOX_EVENTS_RELATIVE_PATH);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Stats } from "node:fs";
|
|
2
|
+
type Entry = Pick<Stats, "uid" | "gid" | "mode"> & Readonly<{
|
|
3
|
+
isDirectory(): boolean;
|
|
4
|
+
}>;
|
|
5
|
+
export type GrokWorkerTmpWorker = Readonly<{
|
|
6
|
+
home: string;
|
|
7
|
+
uid: number;
|
|
8
|
+
}>;
|
|
9
|
+
/** Test seams only; production uses the manifest defaults. */
|
|
10
|
+
export type GrokWorkerTmpOptions = Readonly<{
|
|
11
|
+
sharedRoots?: readonly string[];
|
|
12
|
+
sharedOwnerUid?: number;
|
|
13
|
+
firstWorkerUid?: number;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Temp-directory isolation, checked before every turn for *every* registered
|
|
17
|
+
* worker, not only the one about to run: a misprovisioned sibling temp
|
|
18
|
+
* directory (group- or world-writable) would be a place this worker could
|
|
19
|
+
* write into and that sibling would read from.
|
|
20
|
+
*
|
|
21
|
+
* Grok 1.0.34's strict profile grants shared `/tmp` and `/var/tmp`
|
|
22
|
+
* read-write, and it refuses to start when either (or any ancestor of a
|
|
23
|
+
* granted path) is in `deny` — verified live: `deny = ["/tmp"]`,
|
|
24
|
+
* `["/var/tmp"]`, `["/run"]`, `["/etc"]` all fail with "could not apply the
|
|
25
|
+
* sandbox profile", while `["/tmp/sub"]` works. So the kernel profile cannot
|
|
26
|
+
* keep evaluator temp files away from the worker. Unix modes can, because the
|
|
27
|
+
* launcher drops the worker to its own uid/gid with no supplementary groups:
|
|
28
|
+
*
|
|
29
|
+
* - shared temp roots are root-owned, owned by a group below the worker range,
|
|
30
|
+
* and give "other" at most read (Grok opens the directory; without search
|
|
31
|
+
* the worker can list names but cannot open, stat, or create anything); a
|
|
32
|
+
* deployment that lets workers traverse or write them is refused;
|
|
33
|
+
* - the worker's own `<home>/tmp` (the launcher's compiled `TMPDIR`, which
|
|
34
|
+
* strict grants read-write) is a real directory owned by the worker with no
|
|
35
|
+
* group or other access, and every registered worker's is checked.
|
|
36
|
+
*
|
|
37
|
+
*
|
|
38
|
+
* Entries come from `lstat`, so a symlink is never a directory here: a
|
|
39
|
+
* symlinked temp root or private temp is refused by the directory check.
|
|
40
|
+
*
|
|
41
|
+
* Pure so every refusal is testable without root.
|
|
42
|
+
*/
|
|
43
|
+
export declare function assertGrokWorkerTmpEntries(entries: Readonly<{
|
|
44
|
+
privateTmps: readonly Readonly<{
|
|
45
|
+
uid: number;
|
|
46
|
+
entry: Entry | undefined;
|
|
47
|
+
}>[];
|
|
48
|
+
shared: readonly (Entry | undefined)[];
|
|
49
|
+
}>, options?: GrokWorkerTmpOptions): void;
|
|
50
|
+
/** `workers` must list every registered worker (the running one included). */
|
|
51
|
+
export declare function verifyGrokWorkerTmp(workers: readonly GrokWorkerTmpWorker[], options?: GrokWorkerTmpOptions): Promise<void>;
|
|
52
|
+
/** A registration's worker home is the parent of its `<home>/.grok/sandbox.toml`. */
|
|
53
|
+
export declare const grokWorkerHomeForProfile: (profilePath: string) => string | undefined;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=grokWorkerTmpAttestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grokWorkerTmpAttestation.d.ts","sourceRoot":"","sources":["../../src/runtime/grokWorkerTmpAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMrC,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC;IAAE,WAAW,IAAI,OAAO,CAAA;CAAE,CAAC,CAAC;AAIxF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC1E,8DAA8D;AAC9D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAAE,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEnI;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAE,WAAW,EAAE,SAAS,QAAQ,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;KAAE,CAAC,EAAE,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,CAAA;CAAE,CAAC,EAAE,OAAO,GAAE,oBAAyB,GAAG,IAAI,CAU/N;AAED,8EAA8E;AAC9E,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpI;AAED,qFAAqF;AACrF,eAAO,MAAM,wBAAwB,GAAI,aAAa,MAAM,KAAG,MAAM,GAAG,SACoC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { lstat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { GROK_ENGINE_BROKER } from "../contracts/runtimeContractManifest.js";
|
|
4
|
+
const HOME = GROK_ENGINE_BROKER.worker.home;
|
|
5
|
+
const FIRST_WORKER_UID = GROK_ENGINE_BROKER.identities.firstWorkerUid;
|
|
6
|
+
/**
|
|
7
|
+
* Temp-directory isolation, checked before every turn for *every* registered
|
|
8
|
+
* worker, not only the one about to run: a misprovisioned sibling temp
|
|
9
|
+
* directory (group- or world-writable) would be a place this worker could
|
|
10
|
+
* write into and that sibling would read from.
|
|
11
|
+
*
|
|
12
|
+
* Grok 1.0.34's strict profile grants shared `/tmp` and `/var/tmp`
|
|
13
|
+
* read-write, and it refuses to start when either (or any ancestor of a
|
|
14
|
+
* granted path) is in `deny` — verified live: `deny = ["/tmp"]`,
|
|
15
|
+
* `["/var/tmp"]`, `["/run"]`, `["/etc"]` all fail with "could not apply the
|
|
16
|
+
* sandbox profile", while `["/tmp/sub"]` works. So the kernel profile cannot
|
|
17
|
+
* keep evaluator temp files away from the worker. Unix modes can, because the
|
|
18
|
+
* launcher drops the worker to its own uid/gid with no supplementary groups:
|
|
19
|
+
*
|
|
20
|
+
* - shared temp roots are root-owned, owned by a group below the worker range,
|
|
21
|
+
* and give "other" at most read (Grok opens the directory; without search
|
|
22
|
+
* the worker can list names but cannot open, stat, or create anything); a
|
|
23
|
+
* deployment that lets workers traverse or write them is refused;
|
|
24
|
+
* - the worker's own `<home>/tmp` (the launcher's compiled `TMPDIR`, which
|
|
25
|
+
* strict grants read-write) is a real directory owned by the worker with no
|
|
26
|
+
* group or other access, and every registered worker's is checked.
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
* Entries come from `lstat`, so a symlink is never a directory here: a
|
|
30
|
+
* symlinked temp root or private temp is refused by the directory check.
|
|
31
|
+
*
|
|
32
|
+
* Pure so every refusal is testable without root.
|
|
33
|
+
*/
|
|
34
|
+
export function assertGrokWorkerTmpEntries(entries, options = {}) {
|
|
35
|
+
const shared = HOME.sharedTmp;
|
|
36
|
+
const firstWorkerUid = options.firstWorkerUid ?? FIRST_WORKER_UID;
|
|
37
|
+
if (entries.shared.length === 0 || entries.privateTmps.length === 0)
|
|
38
|
+
throw unavailable();
|
|
39
|
+
for (const entry of entries.shared) {
|
|
40
|
+
if (entry === undefined || !entry.isDirectory() || entry.uid !== (options.sharedOwnerUid ?? shared.uid) || entry.gid >= shared.maxGroupExclusive || (Number(entry.mode) & 0o007 & ~shared.otherMode) !== 0)
|
|
41
|
+
throw unavailable();
|
|
42
|
+
}
|
|
43
|
+
for (const { uid, entry } of entries.privateTmps) {
|
|
44
|
+
if (!Number.isSafeInteger(uid) || uid < firstWorkerUid || entry === undefined || !entry.isDirectory() || entry.uid !== uid || (Number(entry.mode) & 0o077) !== 0)
|
|
45
|
+
throw unavailable();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** `workers` must list every registered worker (the running one included). */
|
|
49
|
+
export async function verifyGrokWorkerTmp(workers, options = {}) {
|
|
50
|
+
const inspect = async (file) => { try {
|
|
51
|
+
return await lstat(file);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
} };
|
|
56
|
+
assertGrokWorkerTmpEntries({
|
|
57
|
+
privateTmps: await Promise.all(workers.map(async (worker) => ({ uid: worker.uid, entry: await inspect(path.join(worker.home, HOME.privateTmp.relativeToWorkerHome)) }))),
|
|
58
|
+
shared: await Promise.all((options.sharedRoots ?? HOME.sharedTmp.paths).map(inspect))
|
|
59
|
+
}, options);
|
|
60
|
+
}
|
|
61
|
+
/** A registration's worker home is the parent of its `<home>/.grok/sandbox.toml`. */
|
|
62
|
+
export const grokWorkerHomeForProfile = (profilePath) => path.basename(path.dirname(profilePath)) === ".grok" ? path.dirname(path.dirname(profilePath)) : undefined;
|
|
63
|
+
const unavailable = () => new Error("Grok worker temp isolation attestation unavailable");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export * from "./organizationRuntime.js";
|
|
2
|
+
export * from "./contractManifest.js";
|
|
3
|
+
export * from "./agySubscriptionRealm.js";
|
|
4
|
+
export { createOrganizationRuntimeHost } from "./organizationRuntimeHost.js";
|
|
5
|
+
export { createOrganizationRuntimeControlHost } from "./organizationRuntimeControl.js";
|
|
6
|
+
export { CODEX_SANDBOX_PROJECTION_VERSION, resolveOrganizationCodexSandboxProjection, type OrganizationCodexSandboxProjection } from "./codexSandboxProjection.js";
|
|
7
|
+
export { GROK_BROKER_PROJECTION_VERSION, grokBrokerProjectionSha256, grokBrokerServiceRegistrationFor, resolveOrganizationGrokBrokerProjection, verifyGrokBrokerRegistrationMatchesProjection, type OrganizationGrokBrokerProjection, type OrganizationGrokBrokerProjectionOptions } from "./grokBrokerProjection.js";
|
|
8
|
+
export { GROK_SLOT_PREFLIGHT_VERSION, grokSlotPreflightCanarySchema, grokSlotPreflightReceiptSchema, parseGrokSlotPreflightReceipt, type GrokSlotPreflightFreshness, verifyGrokSlotPreflightReceipt, type GrokSlotPreflightReceipt } from "./grokSlotPreflightReceipt.js";
|
|
9
|
+
export { grokBrokerWorkerConfigSha256, renderGrokBrokerWorkerConfig } from "./grokBrokerWorkerConfig.js";
|
|
10
|
+
export { GROK_INFERENCE_CLIENT_MODEL_ID, GROK_INFERENCE_GRANT_ENV, grokInferenceClientConfigSha256, renderGrokInferenceClientConfig, renderProductionGrokInferenceClientConfig, type GrokInferenceClientConfigInput } from "./grokInferenceClientConfig.js";
|
|
11
|
+
export { GROK_INFERENCE_PROXY_BASE_URL, ENGINE_BROKER_INFERENCE_FAILURE_CODES, type EngineBrokerInferenceFailureCode } from "./engineBrokerInferenceProtocol.js";
|
|
12
|
+
export { dedupeInferenceUsageRows, INFERENCE_USAGE_LEDGER_VERSION, GROK_INFERENCE_PURPOSES, type GrokInferencePurpose } from "./inferenceUsageLedger.js";
|
|
13
|
+
export { GROK_INFERENCE_AUTH_STALE_BODY } from "./grokInferenceProxy.js";
|
|
14
|
+
export { assertGrokWorkerDenyPathPlacement, assertGrokWorkerDenyPathShape, assertGrokWorkerDenyPathsPlaceable, GROK_WORKER_BASE_PROFILE_GRANTS, grokWorkerCanSearch, grokWorkerDenyPathChain, GrokWorkerDenyPlacementError, readGrokWorkerDenyPathChain } from "./grokWorkerDenyPlacement.js";
|
|
15
|
+
export type { GrokWorkerDenyPathEntry, GrokWorkerDenyPathStep, GrokWorkerDenyPathWorker } from "./grokWorkerDenyPlacement.js";
|
|
16
|
+
export { grokWorkerSandboxProfileSha256, renderGrokWorkerSandboxProfile } from "./grokWorkerSandboxProfile.js";
|
|
17
|
+
export { engineBrokerRequestLedgerPathFor, engineBrokerSealLedgerPathFor, parseEngineBrokerServiceConfig, type EngineBrokerServiceConfig, type EngineBrokerServiceRegistration } from "./engineBrokerServiceConfig.js";
|
|
18
|
+
export { TURN_SEAL_LEDGER, TURN_SEAL_LEDGER_VERSION } from "./engineBrokerSealLedger.js";
|
|
19
|
+
export { DEFAULT_GROK_BROKER_TURN_LIMITS, ENGINE_BROKER_LIMIT_REASONS, type EngineBrokerLimitReason, type EngineBrokerTurnAccounting, type EngineBrokerTurnLimits, type EngineBrokerTurnUsage } from "./engineBrokerTurnAccounting.js";
|
|
20
|
+
export { dedupeTurnUsageRows } from "./turnUsageLedger.js";
|
|
21
|
+
export { WakeTransitionLockBlockedError } from "./wakeAcceptanceStore.js";
|
|
22
|
+
export { OFFLINE_RECONCILIATION_BLOCKED_CODE, OFFLINE_RECONCILIATION_REQUEST_SCHEMA, OFFLINE_RECONCILIATION_VERSION, assertOfflineReconciliationLeaseAvailable, OfflineTransitionReconciliationBlockedError, parseOfflineTransitionReconciliationRequest, reconcileOfflineWakeTransition, type OfflineDeploymentAttestation, type OfflineTransitionReconciliationAuthorizationContext, type OfflineTransitionReconciliationOptions, type OfflineTransitionReconciliationProofReceipt, type OfflineTransitionReconciliationReceipt, type OfflineTransitionReconciliationRequest, type OfflineTransitionReconciliationResult } from "./wakeAcceptanceReconciliation.js";
|
|
23
|
+
export { MAX_WAKE_ACCEPTANCE_BYTES, MAX_WAKE_ACCEPTANCE_RECORD_BYTES, WAKE_ACCEPTANCE_VERSION, WAKE_ACCEPTANCE_REQUEST_SCHEMA, WAKE_RECEIPT_STATUS_VERSION, WAKE_RECEIPT_STATUS_SCHEMA, WAKE_V2_VERSION, parseWakeAcceptanceRequest, wakeAcceptanceDigest, type OrganizationRuntimeWakeAcceptance, type OrganizationRuntimeWakeAcceptanceRequest, type OrganizationRuntimeWakeAcceptanceResult, type OrganizationRuntimeWakeReceiptStatus, type WakeReceiptCode, type WakeReceiptState } from "./wakeAcceptanceTypes.js";
|
|
24
|
+
export type { OrganizationRuntimeControlHost, OrganizationRuntimeControlOptions } from "./organizationRuntimeControl.js";
|
|
25
|
+
export { EngineBrokerControlClient, EngineBrokerInferenceGrantRefused, type EngineBrokerInferenceGrant } from "./engineBrokerControlClient.js";
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AACvF,OAAO,EAAE,gCAAgC,EAAE,yCAAyC,EAClF,KAAK,kCAAkC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,8BAA8B,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,uCAAuC,EAC5I,6CAA6C,EAAE,KAAK,gCAAgC,EAAE,KAAK,uCAAuC,EAAE,MAAM,2BAA2B,CAAC;AACxK,OAAO,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,6BAA6B,EAAE,KAAK,0BAA0B,EACjK,8BAA8B,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AACzG,OAAO,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,yCAAyC,EAAE,KAAK,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAC5P,OAAO,EAAE,6BAA6B,EAAE,qCAAqC,EAAE,KAAK,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACjK,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACzJ,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,iCAAiC,EAAE,6BAA6B,EAAE,kCAAkC,EAAE,+BAA+B,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC9R,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC9H,OAAO,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,EAAE,gCAAgC,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,KAAK,yBAAyB,EAAE,KAAK,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACvN,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,+BAA+B,EAAE,2BAA2B,EAAE,KAAK,uBAAuB,EAAE,KAAK,0BAA0B,EAClI,KAAK,sBAAsB,EAAE,KAAK,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EACL,mCAAmC,EACnC,qCAAqC,EACrC,8BAA8B,EAC9B,yCAAyC,EACzC,2CAA2C,EAC3C,2CAA2C,EAC3C,8BAA8B,EAC9B,KAAK,4BAA4B,EACjC,KAAK,mDAAmD,EACxD,KAAK,sCAAsC,EAC3C,KAAK,2CAA2C,EAChD,KAAK,sCAAsC,EAC3C,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC3C,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,0BAA0B,EAC1B,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,iCAAiC,EACtC,KAAK,wCAAwC,EAC7C,KAAK,uCAAuC,EAC5C,KAAK,oCAAoC,EACzC,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,8BAA8B,EAAE,iCAAiC,EAAE,MAAM,iCAAiC,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAE,iCAAiC,EAAE,KAAK,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export * from "./organizationRuntime.js";
|
|
2
|
+
export * from "./contractManifest.js";
|
|
3
|
+
export * from "./agySubscriptionRealm.js";
|
|
4
|
+
export { createOrganizationRuntimeHost } from "./organizationRuntimeHost.js";
|
|
5
|
+
export { createOrganizationRuntimeControlHost } from "./organizationRuntimeControl.js";
|
|
6
|
+
export { CODEX_SANDBOX_PROJECTION_VERSION, resolveOrganizationCodexSandboxProjection } from "./codexSandboxProjection.js";
|
|
7
|
+
export { GROK_BROKER_PROJECTION_VERSION, grokBrokerProjectionSha256, grokBrokerServiceRegistrationFor, resolveOrganizationGrokBrokerProjection, verifyGrokBrokerRegistrationMatchesProjection } from "./grokBrokerProjection.js";
|
|
8
|
+
export { GROK_SLOT_PREFLIGHT_VERSION, grokSlotPreflightCanarySchema, grokSlotPreflightReceiptSchema, parseGrokSlotPreflightReceipt, verifyGrokSlotPreflightReceipt } from "./grokSlotPreflightReceipt.js";
|
|
9
|
+
export { grokBrokerWorkerConfigSha256, renderGrokBrokerWorkerConfig } from "./grokBrokerWorkerConfig.js";
|
|
10
|
+
export { GROK_INFERENCE_CLIENT_MODEL_ID, GROK_INFERENCE_GRANT_ENV, grokInferenceClientConfigSha256, renderGrokInferenceClientConfig, renderProductionGrokInferenceClientConfig } from "./grokInferenceClientConfig.js";
|
|
11
|
+
export { GROK_INFERENCE_PROXY_BASE_URL, ENGINE_BROKER_INFERENCE_FAILURE_CODES } from "./engineBrokerInferenceProtocol.js";
|
|
12
|
+
export { dedupeInferenceUsageRows, INFERENCE_USAGE_LEDGER_VERSION, GROK_INFERENCE_PURPOSES } from "./inferenceUsageLedger.js";
|
|
13
|
+
export { GROK_INFERENCE_AUTH_STALE_BODY } from "./grokInferenceProxy.js";
|
|
14
|
+
export { assertGrokWorkerDenyPathPlacement, assertGrokWorkerDenyPathShape, assertGrokWorkerDenyPathsPlaceable, GROK_WORKER_BASE_PROFILE_GRANTS, grokWorkerCanSearch, grokWorkerDenyPathChain, GrokWorkerDenyPlacementError, readGrokWorkerDenyPathChain } from "./grokWorkerDenyPlacement.js";
|
|
15
|
+
export { grokWorkerSandboxProfileSha256, renderGrokWorkerSandboxProfile } from "./grokWorkerSandboxProfile.js";
|
|
16
|
+
export { engineBrokerRequestLedgerPathFor, engineBrokerSealLedgerPathFor, parseEngineBrokerServiceConfig } from "./engineBrokerServiceConfig.js";
|
|
17
|
+
export { TURN_SEAL_LEDGER, TURN_SEAL_LEDGER_VERSION } from "./engineBrokerSealLedger.js";
|
|
18
|
+
export { DEFAULT_GROK_BROKER_TURN_LIMITS, ENGINE_BROKER_LIMIT_REASONS } from "./engineBrokerTurnAccounting.js";
|
|
19
|
+
export { dedupeTurnUsageRows } from "./turnUsageLedger.js";
|
|
20
|
+
export { WakeTransitionLockBlockedError } from "./wakeAcceptanceStore.js";
|
|
21
|
+
export { OFFLINE_RECONCILIATION_BLOCKED_CODE, OFFLINE_RECONCILIATION_REQUEST_SCHEMA, OFFLINE_RECONCILIATION_VERSION, assertOfflineReconciliationLeaseAvailable, OfflineTransitionReconciliationBlockedError, parseOfflineTransitionReconciliationRequest, reconcileOfflineWakeTransition } from "./wakeAcceptanceReconciliation.js";
|
|
22
|
+
export { MAX_WAKE_ACCEPTANCE_BYTES, MAX_WAKE_ACCEPTANCE_RECORD_BYTES, WAKE_ACCEPTANCE_VERSION, WAKE_ACCEPTANCE_REQUEST_SCHEMA, WAKE_RECEIPT_STATUS_VERSION, WAKE_RECEIPT_STATUS_SCHEMA, WAKE_V2_VERSION, parseWakeAcceptanceRequest, wakeAcceptanceDigest } from "./wakeAcceptanceTypes.js";
|
|
23
|
+
export { EngineBrokerControlClient, EngineBrokerInferenceGrantRefused } from "./engineBrokerControlClient.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EngineBrokerTurnUsage } from "./engineBrokerTurnAccounting.js";
|
|
2
|
+
import type { GrokBrokerModel } from "./grokBrokerModelPolicy.js";
|
|
3
|
+
/**
|
|
4
|
+
* Evaluator inference spend, one row per upstream model request of one grant.
|
|
5
|
+
*
|
|
6
|
+
* This is a separate stream at a separate path (`service.json`
|
|
7
|
+
* `inferenceLedgerPath`), never the subject usage ledger: the org wake fuse and
|
|
8
|
+
* Spawnfile's subject accounting sum that ledger, and a judge's tokens are not
|
|
9
|
+
* a subject wake's. Rows carry `kind: "inference"` so a reader that is pointed
|
|
10
|
+
* at the wrong file can still tell them apart (`wakeFuse.ts` skips them).
|
|
11
|
+
*
|
|
12
|
+
* Grants are not sealed in a durable registry: each request is appended when
|
|
13
|
+
* it settles. `(grant, request)` identifies a row; readers dedupe on it
|
|
14
|
+
* ({@link dedupeInferenceUsageRows}).
|
|
15
|
+
*/
|
|
16
|
+
export declare const INFERENCE_USAGE_LEDGER_VERSION: "noopolis.daimon.inference-usage.v1";
|
|
17
|
+
export declare const GROK_INFERENCE_PURPOSES: readonly ["judge", "optimizer"];
|
|
18
|
+
export type GrokInferencePurpose = (typeof GROK_INFERENCE_PURPOSES)[number];
|
|
19
|
+
export type InferenceUsageEntry = Readonly<{
|
|
20
|
+
grant: string;
|
|
21
|
+
purpose: GrokInferencePurpose;
|
|
22
|
+
model: GrokBrokerModel;
|
|
23
|
+
request: number;
|
|
24
|
+
usage: EngineBrokerTurnUsage;
|
|
25
|
+
usageSource: "upstream" | "estimated";
|
|
26
|
+
startedAt: string;
|
|
27
|
+
endedAt: string;
|
|
28
|
+
at?: string;
|
|
29
|
+
}>;
|
|
30
|
+
export declare const renderInferenceUsageLine: (entry: InferenceUsageEntry) => string;
|
|
31
|
+
/** Advisory, never rejects: an evaluator request that already spent tokens must not fail on its ledger. */
|
|
32
|
+
export declare const recordInferenceUsage: (file: string, entry: InferenceUsageEntry) => Promise<boolean>;
|
|
33
|
+
/** Keeps the first row of each `(grant, request)`; rows without both keys are not inference rows and are dropped. */
|
|
34
|
+
export declare const dedupeInferenceUsageRows: <T extends Readonly<{
|
|
35
|
+
grant?: unknown;
|
|
36
|
+
request?: unknown;
|
|
37
|
+
}>>(rows: readonly T[]) => T[];
|
|
38
|
+
//# sourceMappingURL=inferenceUsageLedger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inferenceUsageLedger.d.ts","sourceRoot":"","sources":["../../src/runtime/inferenceUsageLedger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,8BAA8B,sCAAmD,CAAC;AAC/F,eAAO,MAAM,uBAAuB,iCAA8C,CAAC;AACnF,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,oBAAoB,CAAC;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,qBAAqB,CAAC;IAC7B,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC,CAAC;AAEH,eAAO,MAAM,wBAAwB,GAAI,OAAO,mBAAmB,KAAG,MASrE,CAAC;AAEF,2GAA2G;AAC3G,eAAO,MAAM,oBAAoB,GAAU,MAAM,MAAM,EAAE,OAAO,mBAAmB,KAAG,OAAO,CAAC,OAAO,CAIpG,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,wBAAwB,GAAI,CAAC,SAAS,QAAQ,CAAC;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,MAAM,SAAS,CAAC,EAAE,KAAG,CAAC,EAQ1H,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { GROK_BROKER_MODELS } from "../contracts/grokWorkerContract.js";
|
|
2
|
+
import { GROK_ENGINE_BROKER } from "../contracts/runtimeContractManifest.js";
|
|
3
|
+
import { recordLedgerLines } from "./turnRequestLedger.js";
|
|
4
|
+
/**
|
|
5
|
+
* Evaluator inference spend, one row per upstream model request of one grant.
|
|
6
|
+
*
|
|
7
|
+
* This is a separate stream at a separate path (`service.json`
|
|
8
|
+
* `inferenceLedgerPath`), never the subject usage ledger: the org wake fuse and
|
|
9
|
+
* Spawnfile's subject accounting sum that ledger, and a judge's tokens are not
|
|
10
|
+
* a subject wake's. Rows carry `kind: "inference"` so a reader that is pointed
|
|
11
|
+
* at the wrong file can still tell them apart (`wakeFuse.ts` skips them).
|
|
12
|
+
*
|
|
13
|
+
* Grants are not sealed in a durable registry: each request is appended when
|
|
14
|
+
* it settles. `(grant, request)` identifies a row; readers dedupe on it
|
|
15
|
+
* ({@link dedupeInferenceUsageRows}).
|
|
16
|
+
*/
|
|
17
|
+
export const INFERENCE_USAGE_LEDGER_VERSION = GROK_ENGINE_BROKER.inferenceGrants.ledgerVersion;
|
|
18
|
+
export const GROK_INFERENCE_PURPOSES = GROK_ENGINE_BROKER.inferenceGrants.purposes;
|
|
19
|
+
export const renderInferenceUsageLine = (entry) => {
|
|
20
|
+
if (!/^[a-f0-9]{32}$/u.test(entry.grant) || !GROK_INFERENCE_PURPOSES.includes(entry.purpose) || !GROK_BROKER_MODELS.includes(entry.model) || !Number.isSafeInteger(entry.request) || entry.request < 0)
|
|
21
|
+
throw new TypeError("invalid inference usage entry");
|
|
22
|
+
const { usage } = entry;
|
|
23
|
+
return `${JSON.stringify({
|
|
24
|
+
v: INFERENCE_USAGE_LEDGER_VERSION, kind: "inference", purpose: entry.purpose, grant: entry.grant, request: entry.request,
|
|
25
|
+
at: entry.at ?? new Date().toISOString(), started_at: entry.startedAt, ended_at: entry.endedAt, model: entry.model,
|
|
26
|
+
input: usage.input, cache_read: usage.cacheRead, cache_write: usage.cacheWrite, output: usage.output, total: usage.total,
|
|
27
|
+
usage_source: entry.usageSource
|
|
28
|
+
})}\n`;
|
|
29
|
+
};
|
|
30
|
+
/** Advisory, never rejects: an evaluator request that already spent tokens must not fail on its ledger. */
|
|
31
|
+
export const recordInferenceUsage = async (file, entry) => {
|
|
32
|
+
let line;
|
|
33
|
+
try {
|
|
34
|
+
line = renderInferenceUsageLine(entry);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return recordLedgerLines(file, line);
|
|
40
|
+
};
|
|
41
|
+
/** Keeps the first row of each `(grant, request)`; rows without both keys are not inference rows and are dropped. */
|
|
42
|
+
export const dedupeInferenceUsageRows = (rows) => {
|
|
43
|
+
const seen = new Set();
|
|
44
|
+
return rows.filter((row) => {
|
|
45
|
+
if (typeof row.grant !== "string" || typeof row.request !== "number")
|
|
46
|
+
return false;
|
|
47
|
+
const key = `${row.grant}\0${row.request}`;
|
|
48
|
+
if (seen.has(key))
|
|
49
|
+
return false;
|
|
50
|
+
seen.add(key);
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowering an upstream MCP server's `CallToolResult` onto a Pi tool result.
|
|
3
|
+
*
|
|
4
|
+
* Every `mcp_*` tool is a *passthrough*: Daimon calls a declared MCP server and
|
|
5
|
+
* has to hand the model back what that server actually said. It used to hand
|
|
6
|
+
* back routing metadata instead — `details: { server, tool, is_error }` — and
|
|
7
|
+
* because the MCP mount lowers `details` to `structuredContent`
|
|
8
|
+
* (`src/mcp/toolServer.ts`) and the engines render `structuredContent` in
|
|
9
|
+
* preference to `content`, an agent calling any declared MCP tool saw
|
|
10
|
+
* `{"server":"newsroom","tool":"file_article","is_error":true}` and nothing
|
|
11
|
+
* else. The tool's own answer, and the reason for its own failure, never
|
|
12
|
+
* reached the model. `moltnet_read` was the same defect in a Daimon-authored
|
|
13
|
+
* tool; this is the wider one, in the tools Daimon does not author.
|
|
14
|
+
*
|
|
15
|
+
* Three rules follow, and they are the whole design:
|
|
16
|
+
*
|
|
17
|
+
* 1. **Both channels always carry the payload.** `content` and
|
|
18
|
+
* `structuredContent` are each filled with the result, mirroring whichever
|
|
19
|
+
* one the server did not send. Daimon has already been wrong once about
|
|
20
|
+
* which channel an engine renders; carrying the answer in both is the only
|
|
21
|
+
* shape where being wrong again costs nothing. A server that sent
|
|
22
|
+
* `structuredContent` gets it forwarded *verbatim*, so a declared
|
|
23
|
+
* `outputSchema` still describes what the model sees.
|
|
24
|
+
*
|
|
25
|
+
* 2. **`isError` is raised, not reported.** Pi's `AgentToolResult` has no
|
|
26
|
+
* error channel — a Pi tool signals failure by throwing, and
|
|
27
|
+
* `toolServer.ts` lowers a throw to `isError: true` plus the message. So an
|
|
28
|
+
* upstream `isError: true` becomes a thrown {@link McpToolCallError}
|
|
29
|
+
* carrying the server's own reason text. The model then gets a result
|
|
30
|
+
* flagged as a failure *and* the sentence explaining it, which is the
|
|
31
|
+
* difference between correcting a call and guessing at it.
|
|
32
|
+
*
|
|
33
|
+
* 3. **The bound truncates; it never throws the payload away.** An oversized
|
|
34
|
+
* result used to be refused outright, so the agent got
|
|
35
|
+
* `Error: MCP tool result exceeds bound` and none of the data. It is now
|
|
36
|
+
* degraded to a head of the serialized result plus an explicit marker
|
|
37
|
+
* naming both sizes.
|
|
38
|
+
*
|
|
39
|
+
* Daimon deliberately does *not* re-declare the upstream `outputSchema` on its
|
|
40
|
+
* own mount. A declared output schema obliges every result to carry conforming
|
|
41
|
+
* `structuredContent`, which neither a content-only server response nor rule 3's
|
|
42
|
+
* truncation marker can satisfy — declaring it would turn a degraded result into
|
|
43
|
+
* a client-side protocol error and lose the payload all over again.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Headroom left inside the receipt bound for the receipt's own envelope.
|
|
47
|
+
*
|
|
48
|
+
* A successful MCP result is stored in its receipt so a replayed identical call
|
|
49
|
+
* in the same wake answers with the result rather than with a digest of it. The
|
|
50
|
+
* envelope (`kind`, ids, engine, server, tool, digest, `is_error`, `at`) is a
|
|
51
|
+
* few hundred bytes for any sane name; 4096 is generous enough that a stored
|
|
52
|
+
* result can never push the receipt past its own bound.
|
|
53
|
+
*/
|
|
54
|
+
export declare const MCP_RECEIPT_ENVELOPE_RESERVE_BYTES = 4096;
|
|
55
|
+
/** Bound on one lowered MCP tool result, model-facing and receipt-facing alike. */
|
|
56
|
+
export declare const MCP_TOOL_RESULT_MAX_BYTES: number;
|
|
57
|
+
/** Rendered for a server that answered with neither content nor structured content. */
|
|
58
|
+
export declare const MCP_EMPTY_RESULT_TEXT = "[daimon: the MCP server returned a result with no content]";
|
|
59
|
+
/** Reason used when a server flags an error but supplies no text for it. */
|
|
60
|
+
export declare const MCP_ERROR_WITHOUT_DETAIL = "the MCP server reported an error and gave no reason";
|
|
61
|
+
/**
|
|
62
|
+
* An upstream MCP tool that answered with `isError: true`.
|
|
63
|
+
*
|
|
64
|
+
* The reason is the server's own words. `toolServer.ts` renders a thrown error
|
|
65
|
+
* as `"<name>: <message>"` inside an `isError: true` result, so the model
|
|
66
|
+
* receives both the failure flag and the explanation.
|
|
67
|
+
*/
|
|
68
|
+
export declare class McpToolCallError extends Error {
|
|
69
|
+
readonly server: string;
|
|
70
|
+
readonly tool: string;
|
|
71
|
+
readonly reason: string;
|
|
72
|
+
constructor(server: string, tool: string, reason: string);
|
|
73
|
+
}
|
|
74
|
+
/** The fields of an upstream `CallToolResult` that Daimon reads. */
|
|
75
|
+
export interface McpUpstreamResult {
|
|
76
|
+
readonly content?: unknown;
|
|
77
|
+
readonly structuredContent?: unknown;
|
|
78
|
+
readonly isError?: unknown;
|
|
79
|
+
}
|
|
80
|
+
/** A lowered result, ready to be returned from a Pi `ToolDefinition.execute`. */
|
|
81
|
+
export interface RenderedMcpToolResult {
|
|
82
|
+
readonly content: readonly unknown[];
|
|
83
|
+
readonly details: Record<string, unknown>;
|
|
84
|
+
readonly truncated: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Flatten an MCP content array to text, naming the parts that are not text. */
|
|
87
|
+
export declare function mcpContentText(content: unknown): string;
|
|
88
|
+
/** Truncate to a byte budget without splitting a UTF-8 code point. */
|
|
89
|
+
export declare function truncateUtf8(value: string, maxBytes: number): {
|
|
90
|
+
text: string;
|
|
91
|
+
truncated: boolean;
|
|
92
|
+
originalBytes: number;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The server's own explanation for an `isError: true` result.
|
|
96
|
+
*
|
|
97
|
+
* Both channels are consulted, because a server may put a human sentence in
|
|
98
|
+
* `content` and a machine-readable code in `structuredContent`, and an agent
|
|
99
|
+
* that has to fix its own call needs whichever one it was given.
|
|
100
|
+
*/
|
|
101
|
+
export declare function mcpErrorReason(result: McpUpstreamResult, maxBytes: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* Lower one upstream result, or throw {@link McpToolCallError} when it is an
|
|
104
|
+
* error result.
|
|
105
|
+
*/
|
|
106
|
+
export declare function renderMcpToolResult(input: {
|
|
107
|
+
readonly server: string;
|
|
108
|
+
readonly tool: string;
|
|
109
|
+
readonly result: McpUpstreamResult;
|
|
110
|
+
readonly maxBytes?: number;
|
|
111
|
+
}): RenderedMcpToolResult;
|
|
112
|
+
/** The result of one MCP call, as stored in its receipt for replay. */
|
|
113
|
+
export interface McpReceiptResult {
|
|
114
|
+
readonly content: readonly unknown[];
|
|
115
|
+
readonly details: Record<string, unknown>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Rebuild a tool answer from a receipt written by an earlier identical call.
|
|
119
|
+
*
|
|
120
|
+
* The wake-scoped receipt exists so a repeated identical call is not sent
|
|
121
|
+
* upstream twice. It used to be *returned* to the model in place of the result,
|
|
122
|
+
* so a retried call answered with `{"kind":"mcp",…,"digest":"sha256:…"}` — the
|
|
123
|
+
* least useful thing an agent stuck in a retry loop could possibly receive.
|
|
124
|
+
* A recorded failure is replayed as the same failure, with the same reason.
|
|
125
|
+
*/
|
|
126
|
+
export declare function replayMcpReceipt(server: string, tool: string, receipt: Record<string, unknown>): RenderedMcpToolResult;
|
|
127
|
+
//# sourceMappingURL=mcpToolResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpToolResult.d.ts","sourceRoot":"","sources":["../../src/runtime/mcpToolResult.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,OAAQ,CAAC;AAExD,mFAAmF;AACnF,eAAO,MAAM,yBAAyB,QAAyD,CAAC;AAEhG,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,+DAA+D,CAAC;AAElG,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,wDAAwD,CAAC;AAE9F;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAOhE;AAED,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B;AAKD,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAUvD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAMzH;AAKD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOlF;AAoBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,qBAAqB,CAqBxB;AA+BD,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,CAWtH"}
|