@noopolis/daimon 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +275 -51
- package/dist/contracts/attentionContract.d.ts +142 -0
- package/dist/contracts/attentionContract.d.ts.map +1 -0
- package/dist/contracts/attentionContract.js +21 -0
- package/dist/contracts/canonicalJson.d.ts +3 -0
- package/dist/contracts/canonicalJson.d.ts.map +1 -0
- package/dist/contracts/canonicalJson.js +54 -0
- package/dist/contracts/grokBrokerTaskClock.d.ts +18 -0
- package/dist/contracts/grokBrokerTaskClock.d.ts.map +1 -0
- package/dist/contracts/grokBrokerTaskClock.js +16 -0
- package/dist/contracts/grokWorkerContract.d.ts +74 -0
- package/dist/contracts/grokWorkerContract.d.ts.map +1 -0
- package/dist/contracts/grokWorkerContract.js +88 -0
- package/dist/contracts/organizationRuntimeContract.d.ts +841 -0
- package/dist/contracts/organizationRuntimeContract.d.ts.map +1 -0
- package/dist/contracts/organizationRuntimeContract.js +123 -0
- package/dist/contracts/runtimeContractManifest.d.ts +1822 -0
- package/dist/contracts/runtimeContractManifest.d.ts.map +1 -0
- package/dist/contracts/runtimeContractManifest.js +206 -0
- package/dist/contracts/shellEnvironmentPolicy.d.ts +3 -0
- package/dist/contracts/shellEnvironmentPolicy.d.ts.map +1 -0
- package/dist/contracts/shellEnvironmentPolicy.js +5 -0
- package/dist/contracts/wakeMomentContract.d.ts +61 -0
- package/dist/contracts/wakeMomentContract.d.ts.map +1 -0
- package/dist/contracts/wakeMomentContract.js +27 -0
- package/dist/core/credentialRedaction.d.ts +4 -0
- package/dist/core/credentialRedaction.d.ts.map +1 -0
- package/dist/core/credentialRedaction.js +28 -0
- package/dist/core/types.d.ts +2 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/examples/jungianPlayAgent.d.ts +1 -0
- package/dist/examples/jungianPlayAgent.d.ts.map +1 -1
- package/dist/examples/jungianPlayAgent.js +6 -2
- package/dist/mcp/toolServer.d.ts +19 -2
- package/dist/mcp/toolServer.d.ts.map +1 -1
- package/dist/mcp/toolServer.js +57 -17
- package/dist/observability/causalEvents.d.ts +6 -6
- package/dist/observability/causalEvents.d.ts.map +1 -1
- package/dist/observability/causalEvents.js +107 -19
- package/dist/observability/orgObserver.d.ts.map +1 -1
- package/dist/observability/orgObserver.js +3 -3
- package/dist/pi/agyHeadlessResult.d.ts +60 -0
- package/dist/pi/agyHeadlessResult.d.ts.map +1 -0
- package/dist/pi/agyHeadlessResult.js +95 -0
- package/dist/pi/cliChildOutput.d.ts +67 -0
- package/dist/pi/cliChildOutput.d.ts.map +1 -0
- package/dist/pi/cliChildOutput.js +269 -0
- package/dist/pi/cliEngineRun.d.ts +16 -0
- package/dist/pi/cliEngineRun.d.ts.map +1 -0
- package/dist/pi/cliEngineRun.js +27 -0
- package/dist/pi/cliEngineSpawn.d.ts +55 -0
- package/dist/pi/cliEngineSpawn.d.ts.map +1 -0
- package/dist/pi/cliEngineSpawn.js +169 -0
- package/dist/pi/cliEnvironment.d.ts +12 -0
- package/dist/pi/cliEnvironment.d.ts.map +1 -0
- package/dist/pi/cliEnvironment.js +34 -0
- package/dist/pi/cliMcpRegistration.d.ts +61 -0
- package/dist/pi/cliMcpRegistration.d.ts.map +1 -0
- package/dist/pi/cliMcpRegistration.js +75 -0
- package/dist/pi/cliProcess.d.ts +7 -0
- package/dist/pi/cliProcess.d.ts.map +1 -0
- package/dist/pi/cliProcess.js +132 -0
- package/dist/pi/cliSession.d.ts +86 -24
- package/dist/pi/cliSession.d.ts.map +1 -1
- package/dist/pi/cliSession.js +251 -173
- package/dist/pi/cliSessionMcp.d.ts +9 -0
- package/dist/pi/cliSessionMcp.d.ts.map +1 -0
- package/dist/pi/cliSessionMcp.js +80 -0
- package/dist/pi/cliTurnMetering.d.ts +60 -0
- package/dist/pi/cliTurnMetering.d.ts.map +1 -0
- package/dist/pi/cliTurnMetering.js +60 -0
- package/dist/pi/codexFilesystemRules.d.ts +3 -0
- package/dist/pi/codexFilesystemRules.d.ts.map +1 -0
- package/dist/pi/codexFilesystemRules.js +28 -0
- package/dist/pi/codexHeadlessResult.d.ts +68 -0
- package/dist/pi/codexHeadlessResult.d.ts.map +1 -0
- package/dist/pi/codexHeadlessResult.js +122 -0
- package/dist/pi/codexRolloutUsage.d.ts +95 -0
- package/dist/pi/codexRolloutUsage.d.ts.map +1 -0
- package/dist/pi/codexRolloutUsage.js +221 -0
- package/dist/pi/engineTaskClock.d.ts +9 -0
- package/dist/pi/engineTaskClock.d.ts.map +1 -0
- package/dist/pi/engineTaskClock.js +28 -0
- package/dist/pi/engineWakeLimits.d.ts +39 -0
- package/dist/pi/engineWakeLimits.d.ts.map +1 -0
- package/dist/pi/engineWakeLimits.js +55 -0
- package/dist/pi/grokHeadlessResult.d.ts +36 -0
- package/dist/pi/grokHeadlessResult.d.ts.map +1 -0
- package/dist/pi/grokHeadlessResult.js +118 -0
- package/dist/pi/grokHomeMcpRegistration.d.ts +21 -0
- package/dist/pi/grokHomeMcpRegistration.d.ts.map +1 -0
- package/dist/pi/grokHomeMcpRegistration.js +58 -0
- package/dist/pi/grokSandbox.d.ts +11 -0
- package/dist/pi/grokSandbox.d.ts.map +1 -0
- package/dist/pi/grokSandbox.js +216 -0
- package/dist/pi/grokStreamUsage.d.ts +31 -0
- package/dist/pi/grokStreamUsage.d.ts.map +1 -0
- package/dist/pi/grokStreamUsage.js +51 -0
- package/dist/pi/memoryClock.d.ts +25 -0
- package/dist/pi/memoryClock.d.ts.map +1 -0
- package/dist/pi/memoryClock.js +18 -0
- package/dist/pi/piAgentHandle.d.ts +6 -3
- package/dist/pi/piAgentHandle.d.ts.map +1 -1
- package/dist/pi/piAgentHandle.js +42 -12
- package/dist/pi/piAgentWakeSupport.d.ts +35 -0
- package/dist/pi/piAgentWakeSupport.d.ts.map +1 -1
- package/dist/pi/piAgentWakeSupport.js +4 -0
- package/dist/pi/piHarness.d.ts +18 -3
- package/dist/pi/piHarness.d.ts.map +1 -1
- package/dist/pi/piHarness.js +83 -14
- package/dist/pi/prompts.d.ts +1 -0
- package/dist/pi/prompts.d.ts.map +1 -1
- package/dist/pi/prompts.js +24 -0
- package/dist/pi/taskClockProcess.d.ts +6 -0
- package/dist/pi/taskClockProcess.d.ts.map +1 -0
- package/dist/pi/taskClockProcess.js +8 -0
- package/dist/pi/turnCausal.d.ts +4 -2
- package/dist/pi/turnCausal.d.ts.map +1 -1
- package/dist/pi/turnCausal.js +4 -4
- package/dist/pi/turnTrace.d.ts.map +1 -1
- package/dist/pi/turnTrace.js +5 -8
- package/dist/pi/wakeAcceptance.d.ts +1 -1
- package/dist/pi/wakeAcceptance.d.ts.map +1 -1
- package/dist/pi/wakeAcceptance.js +2 -2
- package/dist/pi/worldTrajectory.d.ts +1 -1
- package/dist/pi/worldTrajectory.d.ts.map +1 -1
- package/dist/pi/worldTrajectory.js +3 -3
- package/dist/runtime/agySubscriptionBootstrap.d.ts +16 -0
- package/dist/runtime/agySubscriptionBootstrap.d.ts.map +1 -0
- package/dist/runtime/agySubscriptionBootstrap.js +80 -0
- package/dist/runtime/agySubscriptionRealm.d.ts +38 -0
- package/dist/runtime/agySubscriptionRealm.d.ts.map +1 -0
- package/dist/runtime/agySubscriptionRealm.js +242 -0
- package/dist/runtime/attention.d.ts +26 -0
- package/dist/runtime/attention.d.ts.map +1 -0
- package/dist/runtime/attention.js +49 -0
- package/dist/runtime/attentionDispatcher.d.ts +78 -0
- package/dist/runtime/attentionDispatcher.d.ts.map +1 -0
- package/dist/runtime/attentionDispatcher.js +365 -0
- package/dist/runtime/cli.d.ts +7 -0
- package/dist/runtime/cli.d.ts.map +1 -0
- package/dist/runtime/cli.js +256 -0
- package/dist/runtime/codexSandboxProjection.d.ts +17 -0
- package/dist/runtime/codexSandboxProjection.d.ts.map +1 -0
- package/dist/runtime/codexSandboxProjection.js +40 -0
- package/dist/runtime/contract-manifest.json +1 -0
- package/dist/runtime/contract-manifest.sha256 +1 -0
- package/dist/runtime/contractManifest.d.ts +8 -0
- package/dist/runtime/contractManifest.d.ts.map +1 -0
- package/dist/runtime/contractManifest.js +4 -0
- package/dist/runtime/engineBrokerCapabilities.d.ts +40 -0
- package/dist/runtime/engineBrokerCapabilities.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCapabilities.js +69 -0
- package/dist/runtime/engineBrokerControlClient.d.ts +55 -0
- package/dist/runtime/engineBrokerControlClient.d.ts.map +1 -0
- package/dist/runtime/engineBrokerControlClient.js +228 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts +12 -0
- package/dist/runtime/engineBrokerCredentialJournal.d.ts.map +1 -0
- package/dist/runtime/engineBrokerCredentialJournal.js +26 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts +53 -0
- package/dist/runtime/engineBrokerInferenceProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerInferenceProtocol.js +65 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts +171 -0
- package/dist/runtime/engineBrokerMcpCallLog.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpCallLog.js +231 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts +59 -0
- package/dist/runtime/engineBrokerMcpFacade.d.ts.map +1 -0
- package/dist/runtime/engineBrokerMcpFacade.js +346 -0
- package/dist/runtime/engineBrokerNativeClient.d.ts +52 -0
- package/dist/runtime/engineBrokerNativeClient.d.ts.map +1 -0
- package/dist/runtime/engineBrokerNativeClient.js +151 -0
- package/dist/runtime/engineBrokerProtocol.d.ts +167 -0
- package/dist/runtime/engineBrokerProtocol.d.ts.map +1 -0
- package/dist/runtime/engineBrokerProtocol.js +357 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts +70 -0
- package/dist/runtime/engineBrokerSealLedger.d.ts.map +1 -0
- package/dist/runtime/engineBrokerSealLedger.js +132 -0
- package/dist/runtime/engineBrokerService.d.ts +43 -0
- package/dist/runtime/engineBrokerService.d.ts.map +1 -0
- package/dist/runtime/engineBrokerService.js +196 -0
- package/dist/runtime/engineBrokerServiceCli.d.ts +5 -0
- package/dist/runtime/engineBrokerServiceCli.d.ts.map +1 -0
- package/dist/runtime/engineBrokerServiceCli.js +32 -0
- package/dist/runtime/engineBrokerServiceConfig.d.ts +55 -0
- package/dist/runtime/engineBrokerServiceConfig.d.ts.map +1 -0
- package/dist/runtime/engineBrokerServiceConfig.js +130 -0
- package/dist/runtime/engineBrokerSingleflight.d.ts +13 -0
- package/dist/runtime/engineBrokerSingleflight.d.ts.map +1 -0
- package/dist/runtime/engineBrokerSingleflight.js +24 -0
- package/dist/runtime/engineBrokerTurnAccounting.d.ts +76 -0
- package/dist/runtime/engineBrokerTurnAccounting.d.ts.map +1 -0
- package/dist/runtime/engineBrokerTurnAccounting.js +108 -0
- package/dist/runtime/engineBrokerTurnRegistry.d.ts +57 -0
- package/dist/runtime/engineBrokerTurnRegistry.d.ts.map +1 -0
- package/dist/runtime/engineBrokerTurnRegistry.js +159 -0
- package/dist/runtime/engineDispatcher.d.ts +38 -0
- package/dist/runtime/engineDispatcher.d.ts.map +1 -0
- package/dist/runtime/engineDispatcher.js +228 -0
- package/dist/runtime/engineReadiness.d.ts +23 -0
- package/dist/runtime/engineReadiness.d.ts.map +1 -0
- package/dist/runtime/engineReadiness.js +222 -0
- package/dist/runtime/grokAuthenticationError.d.ts +8 -0
- package/dist/runtime/grokAuthenticationError.d.ts.map +1 -0
- package/dist/runtime/grokAuthenticationError.js +20 -0
- package/dist/runtime/grokBrokerCredentialAuthority.d.ts +23 -0
- package/dist/runtime/grokBrokerCredentialAuthority.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialAuthority.js +150 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts +6 -0
- package/dist/runtime/grokBrokerCredentialReader.d.ts.map +1 -0
- package/dist/runtime/grokBrokerCredentialReader.js +38 -0
- package/dist/runtime/grokBrokerModelPolicy.d.ts +23 -0
- package/dist/runtime/grokBrokerModelPolicy.d.ts.map +1 -0
- package/dist/runtime/grokBrokerModelPolicy.js +28 -0
- package/dist/runtime/grokBrokerProjection.d.ts +114 -0
- package/dist/runtime/grokBrokerProjection.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProjection.js +101 -0
- package/dist/runtime/grokBrokerProviderClock.d.ts +26 -0
- package/dist/runtime/grokBrokerProviderClock.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProviderClock.js +133 -0
- package/dist/runtime/grokBrokerProxy.d.ts +69 -0
- package/dist/runtime/grokBrokerProxy.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxy.js +326 -0
- package/dist/runtime/grokBrokerProxyJson.d.ts +10 -0
- package/dist/runtime/grokBrokerProxyJson.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxyJson.js +31 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts +30 -0
- package/dist/runtime/grokBrokerProxyRequest.d.ts.map +1 -0
- package/dist/runtime/grokBrokerProxyRequest.js +85 -0
- package/dist/runtime/grokBrokerRealmLease.d.ts +4 -0
- package/dist/runtime/grokBrokerRealmLease.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRealmLease.js +33 -0
- package/dist/runtime/grokBrokerRefresh.d.ts +2 -0
- package/dist/runtime/grokBrokerRefresh.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRefresh.js +15 -0
- package/dist/runtime/grokBrokerRunBudget.d.ts +20 -0
- package/dist/runtime/grokBrokerRunBudget.d.ts.map +1 -0
- package/dist/runtime/grokBrokerRunBudget.js +85 -0
- package/dist/runtime/grokBrokerSlot.d.ts +6 -0
- package/dist/runtime/grokBrokerSlot.d.ts.map +1 -0
- package/dist/runtime/grokBrokerSlot.js +21 -0
- package/dist/runtime/grokBrokerTaskClock.d.ts +32 -0
- package/dist/runtime/grokBrokerTaskClock.d.ts.map +1 -0
- package/dist/runtime/grokBrokerTaskClock.js +120 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts +180 -0
- package/dist/runtime/grokBrokerTurnMeter.d.ts.map +1 -0
- package/dist/runtime/grokBrokerTurnMeter.js +337 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts +89 -0
- package/dist/runtime/grokBrokerWorkerConfig.d.ts.map +1 -0
- package/dist/runtime/grokBrokerWorkerConfig.js +154 -0
- package/dist/runtime/grokEngineBroker.d.ts +88 -0
- package/dist/runtime/grokEngineBroker.d.ts.map +1 -0
- package/dist/runtime/grokEngineBroker.js +202 -0
- package/dist/runtime/grokEngineBrokerLedger.d.ts +52 -0
- package/dist/runtime/grokEngineBrokerLedger.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerLedger.js +114 -0
- package/dist/runtime/grokEngineBrokerMetering.d.ts +51 -0
- package/dist/runtime/grokEngineBrokerMetering.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerMetering.js +34 -0
- package/dist/runtime/grokEngineBrokerTurn.d.ts +82 -0
- package/dist/runtime/grokEngineBrokerTurn.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerTurn.js +348 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.d.ts +88 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.d.ts.map +1 -0
- package/dist/runtime/grokEngineBrokerTurnEnd.js +148 -0
- package/dist/runtime/grokInferenceClientConfig.d.ts +41 -0
- package/dist/runtime/grokInferenceClientConfig.d.ts.map +1 -0
- package/dist/runtime/grokInferenceClientConfig.js +62 -0
- package/dist/runtime/grokInferenceGrants.d.ts +77 -0
- package/dist/runtime/grokInferenceGrants.d.ts.map +1 -0
- package/dist/runtime/grokInferenceGrants.js +116 -0
- package/dist/runtime/grokInferenceProxy.d.ts +29 -0
- package/dist/runtime/grokInferenceProxy.d.ts.map +1 -0
- package/dist/runtime/grokInferenceProxy.js +85 -0
- package/dist/runtime/grokInferenceProxyRequest.d.ts +23 -0
- package/dist/runtime/grokInferenceProxyRequest.d.ts.map +1 -0
- package/dist/runtime/grokInferenceProxyRequest.js +63 -0
- package/dist/runtime/grokSlotPreflightReceipt.d.ts +70 -0
- package/dist/runtime/grokSlotPreflightReceipt.d.ts.map +1 -0
- package/dist/runtime/grokSlotPreflightReceipt.js +101 -0
- package/dist/runtime/grokSubscriptionRealm.d.ts +4 -0
- package/dist/runtime/grokSubscriptionRealm.d.ts.map +1 -0
- package/dist/runtime/grokSubscriptionRealm.js +435 -0
- package/dist/runtime/grokSubscriptionRealmTypes.d.ts +26 -0
- package/dist/runtime/grokSubscriptionRealmTypes.d.ts.map +1 -0
- package/dist/runtime/grokSubscriptionRealmTypes.js +1 -0
- package/dist/runtime/grokWorkerAttestation.d.ts +175 -0
- package/dist/runtime/grokWorkerAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerAttestation.js +266 -0
- package/dist/runtime/grokWorkerDenyPlacement.d.ts +80 -0
- package/dist/runtime/grokWorkerDenyPlacement.d.ts.map +1 -0
- package/dist/runtime/grokWorkerDenyPlacement.js +128 -0
- package/dist/runtime/grokWorkerHomeAttestation.d.ts +32 -0
- package/dist/runtime/grokWorkerHomeAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerHomeAttestation.js +75 -0
- package/dist/runtime/grokWorkerSandboxProfile.d.ts +27 -0
- package/dist/runtime/grokWorkerSandboxProfile.d.ts.map +1 -0
- package/dist/runtime/grokWorkerSandboxProfile.js +44 -0
- package/dist/runtime/grokWorkerTmpAttestation.d.ts +55 -0
- package/dist/runtime/grokWorkerTmpAttestation.d.ts.map +1 -0
- package/dist/runtime/grokWorkerTmpAttestation.js +63 -0
- package/dist/runtime/index.d.ts +31 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/inferenceUsageLedger.d.ts +38 -0
- package/dist/runtime/inferenceUsageLedger.d.ts.map +1 -0
- package/dist/runtime/inferenceUsageLedger.js +53 -0
- package/dist/runtime/mcpToolResult.d.ts +127 -0
- package/dist/runtime/mcpToolResult.d.ts.map +1 -0
- package/dist/runtime/mcpToolResult.js +214 -0
- package/dist/runtime/moltnetMachineRead.d.ts +97 -0
- package/dist/runtime/moltnetMachineRead.d.ts.map +1 -0
- package/dist/runtime/moltnetMachineRead.js +183 -0
- package/dist/runtime/native/daimon-engine-broker +0 -0
- package/dist/runtime/organizationRuntime.d.ts +168 -0
- package/dist/runtime/organizationRuntime.d.ts.map +1 -0
- package/dist/runtime/organizationRuntime.js +3 -0
- package/dist/runtime/organizationRuntimeAdmission.d.ts +6 -0
- package/dist/runtime/organizationRuntimeAdmission.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeAdmission.js +22 -0
- package/dist/runtime/organizationRuntimeControl.d.ts +51 -0
- package/dist/runtime/organizationRuntimeControl.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeControl.js +283 -0
- package/dist/runtime/organizationRuntimeHost.d.ts +19 -0
- package/dist/runtime/organizationRuntimeHost.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeHost.js +368 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts +6 -0
- package/dist/runtime/organizationRuntimeParsing.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeParsing.js +373 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts +12 -0
- package/dist/runtime/organizationRuntimeReadiness.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeReadiness.js +67 -0
- package/dist/runtime/organizationRuntimeRecording.d.ts +7 -0
- package/dist/runtime/organizationRuntimeRecording.d.ts.map +1 -0
- package/dist/runtime/organizationRuntimeRecording.js +58 -0
- package/dist/runtime/physicalReadiness.d.ts +59 -0
- package/dist/runtime/physicalReadiness.d.ts.map +1 -0
- package/dist/runtime/physicalReadiness.js +176 -0
- package/dist/runtime/portableCredentialAuth.d.ts +6 -0
- package/dist/runtime/portableCredentialAuth.d.ts.map +1 -0
- package/dist/runtime/portableCredentialAuth.js +70 -0
- package/dist/runtime/portableCredentialMaterial.d.ts +8 -0
- package/dist/runtime/portableCredentialMaterial.d.ts.map +1 -0
- package/dist/runtime/portableCredentialMaterial.js +169 -0
- package/dist/runtime/productionAgentTools.d.ts +5 -0
- package/dist/runtime/productionAgentTools.d.ts.map +1 -0
- package/dist/runtime/productionAgentTools.js +336 -0
- package/dist/runtime/relocateRuntimeConfig.d.ts +14 -0
- package/dist/runtime/relocateRuntimeConfig.d.ts.map +1 -0
- package/dist/runtime/relocateRuntimeConfig.js +38 -0
- package/dist/runtime/runtimeHomeLayout.d.ts +48 -0
- package/dist/runtime/runtimeHomeLayout.d.ts.map +1 -0
- package/dist/runtime/runtimeHomeLayout.js +84 -0
- package/dist/runtime/schedule.d.ts +40 -0
- package/dist/runtime/schedule.d.ts.map +1 -0
- package/dist/runtime/schedule.js +376 -0
- package/dist/runtime/storeCoordination.d.ts +33 -0
- package/dist/runtime/storeCoordination.d.ts.map +1 -0
- package/dist/runtime/storeCoordination.js +117 -0
- package/dist/runtime/taskClock.d.ts +42 -0
- package/dist/runtime/taskClock.d.ts.map +1 -0
- package/dist/runtime/taskClock.js +102 -0
- package/dist/runtime/taskClockProcess.d.ts +17 -0
- package/dist/runtime/taskClockProcess.d.ts.map +1 -0
- package/dist/runtime/taskClockProcess.js +58 -0
- package/dist/runtime/toolResultSpill.d.ts +152 -0
- package/dist/runtime/toolResultSpill.d.ts.map +1 -0
- package/dist/runtime/toolResultSpill.js +351 -0
- package/dist/runtime/turnRequestLedger.d.ts +155 -0
- package/dist/runtime/turnRequestLedger.d.ts.map +1 -0
- package/dist/runtime/turnRequestLedger.js +251 -0
- package/dist/runtime/turnUsageLedger.d.ts +143 -0
- package/dist/runtime/turnUsageLedger.d.ts.map +1 -0
- package/dist/runtime/turnUsageLedger.js +203 -0
- package/dist/runtime/wakeAcceptanceClaimDiagnostics.d.ts +34 -0
- package/dist/runtime/wakeAcceptanceClaimDiagnostics.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceClaimDiagnostics.js +79 -0
- package/dist/runtime/wakeAcceptanceIndex.d.ts +55 -0
- package/dist/runtime/wakeAcceptanceIndex.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceIndex.js +158 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts +25 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceProcessIdentity.js +54 -0
- package/dist/runtime/wakeAcceptanceReconciliation.d.ts +211 -0
- package/dist/runtime/wakeAcceptanceReconciliation.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceReconciliation.js +289 -0
- package/dist/runtime/wakeAcceptanceRecord.d.ts +25 -0
- package/dist/runtime/wakeAcceptanceRecord.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRecord.js +58 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts +36 -0
- package/dist/runtime/wakeAcceptanceRetention.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceRetention.js +38 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts +113 -0
- package/dist/runtime/wakeAcceptanceStore.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceStore.js +561 -0
- package/dist/runtime/wakeAcceptanceTypes.d.ts +179 -0
- package/dist/runtime/wakeAcceptanceTypes.d.ts.map +1 -0
- package/dist/runtime/wakeAcceptanceTypes.js +95 -0
- package/dist/runtime/wakeFuse.d.ts +124 -0
- package/dist/runtime/wakeFuse.d.ts.map +1 -0
- package/dist/runtime/wakeFuse.js +466 -0
- package/dist/runtime/wakeMomentFs.d.ts +27 -0
- package/dist/runtime/wakeMomentFs.d.ts.map +1 -0
- package/dist/runtime/wakeMomentFs.js +223 -0
- package/dist/runtime/wakeMomentHistory.d.ts +26 -0
- package/dist/runtime/wakeMomentHistory.d.ts.map +1 -0
- package/dist/runtime/wakeMomentHistory.js +109 -0
- package/dist/runtime/wakeMomentIo.d.ts +22 -0
- package/dist/runtime/wakeMomentIo.d.ts.map +1 -0
- package/dist/runtime/wakeMomentIo.js +114 -0
- package/dist/runtime/wakeMomentRecorder.d.ts +33 -0
- package/dist/runtime/wakeMomentRecorder.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRecorder.js +81 -0
- package/dist/runtime/wakeMomentRetention.d.ts +7 -0
- package/dist/runtime/wakeMomentRetention.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRetention.js +143 -0
- package/dist/runtime/wakeMomentRows.d.ts +8 -0
- package/dist/runtime/wakeMomentRows.d.ts.map +1 -0
- package/dist/runtime/wakeMomentRows.js +66 -0
- package/dist/runtime/wakeMomentSnapshot.d.ts +56 -0
- package/dist/runtime/wakeMomentSnapshot.d.ts.map +1 -0
- package/dist/runtime/wakeMomentSnapshot.js +248 -0
- package/package.json +22 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeContractManifest.d.ts","sourceRoot":"","sources":["../../src/contracts/runtimeContractManifest.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,iCAAiC,EAAG,8CAAuD,CAAC;AACzG,eAAO,MAAM,wCAAwC,EAAG,kDAA2D,CAAC;AACpH,eAAO,MAAM,0BAA0B;;;;;;;;CAE7B,CAAC;AACX,eAAO,MAAM,uBAAuB;;;;;;;;CAQ1B,CAAC;AACX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIrB,CAAC;AACX,eAAO,MAAM,sBAAsB;;;;;;;CAOzB,CAAC;AASX,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC5B,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { GROK_BROKER_TASK_CLOCK } from "./grokBrokerTaskClock.js";
|
|
2
|
+
import { WAKE_MOMENTS } from "./wakeMomentContract.js";
|
|
3
|
+
import { OPERATOR_DRAIN, WORK_AVAILABILITY_SCHEMA, WORK_BLOCKED_SCHEMA } from "./attentionContract.js";
|
|
4
|
+
import { GROK_BROKER_MODELS, GROK_BROKER_REASONING_EFFORTS, GROK_WORKER_MAX_TURNS, GROK_WORKER_TOOL_IDS, GROK_WORKER_VISIBLE_TOOLS } from "./grokWorkerContract.js";
|
|
5
|
+
import { ORGANIZATION_RUNTIME_CONFIG_SCHEMA, ORGANIZATION_RUNTIME_CONFIG_V2_SCHEMA, ORGANIZATION_RUNTIME_MAX_AGENTS, ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS } from "./organizationRuntimeContract.js";
|
|
6
|
+
export const RUNTIME_CONTRACT_MANIFEST_VERSION = "noopolis.daimon.runtime-contract-manifest.v5";
|
|
7
|
+
export const ORGANIZATION_RUNTIME_ACTIVITY_V2_VERSION = "noopolis.daimon.organization-runtime-activity.v2";
|
|
8
|
+
export const ENGINE_CREDENTIAL_MATERIAL = {
|
|
9
|
+
codex: { sourceSlot: "codex-auth", sourceRelativePath: ".daimon-inbound/codex-auth", destinationRelativePath: ".codex/auth.json", directoryMode: 0o700, fileMode: 0o600 }
|
|
10
|
+
};
|
|
11
|
+
export const GROK_SUBSCRIPTION_REALM = {
|
|
12
|
+
agentCredentialRelativePath: ".grok/auth.json",
|
|
13
|
+
bootstrapMountPath: "/var/lib/spawnfile/daimon/grok-bootstrap-auth",
|
|
14
|
+
bootstrapSourceSlot: "grok-auth",
|
|
15
|
+
directoryMode: 0o700,
|
|
16
|
+
durableMountPath: "/var/lib/spawnfile/daimon/grok-subscription-realm",
|
|
17
|
+
fileMode: 0o600,
|
|
18
|
+
maxCredentialBytes: 64 * 1024
|
|
19
|
+
};
|
|
20
|
+
export const GROK_ENGINE_BROKER = {
|
|
21
|
+
nativeAbiVersion: 2,
|
|
22
|
+
nativeExecutablePath: "/opt/daimon/bin/daimon-engine-broker",
|
|
23
|
+
grokExecutablePath: "/usr/local/bin/grok",
|
|
24
|
+
registrationPath: "/etc/daimon-engine-broker/registrations.bin",
|
|
25
|
+
credentialHomePath: "/var/lib/spawnfile/daimon/grok-subscription-realm",
|
|
26
|
+
turnStorePath: "/var/lib/spawnfile/daimon/grok-subscription-realm/turns",
|
|
27
|
+
controlSocketPath: "/run/daimon-engine-broker/control.sock",
|
|
28
|
+
backendSocketPath: "/run/daimon-engine-broker/backend.sock",
|
|
29
|
+
launcherSocketPath: "/run/daimon-engine-broker/launcher.sock",
|
|
30
|
+
serviceConfigPath: "/etc/daimon-engine-broker/service.json",
|
|
31
|
+
providerProxy: { host: "127.0.0.1", port: 43_123 },
|
|
32
|
+
mcpFacade: { host: "127.0.0.1", port: 43_124, path: "/mcp" },
|
|
33
|
+
identities: { organizationUid: 2_000, brokerUid: 2_100, firstWorkerUid: 2_200 },
|
|
34
|
+
grokCliVersion: "1.0.34",
|
|
35
|
+
grokCliBuild: "3736acbc8658",
|
|
36
|
+
grokCliArtifacts: {
|
|
37
|
+
arm64: { url: "https://storage.googleapis.com/grok-build-public-artifacts/cli/grok-1.0.34-linux-aarch64", sha256: "39ab87666877d64ef3a40aa60fbe0c3b6a6acd7001b78fe60e2c76bb6cfc4a94", bytes: 136_090_504 },
|
|
38
|
+
x64: { url: "https://storage.googleapis.com/grok-build-public-artifacts/cli/grok-1.0.34-linux-x86_64", sha256: "be5905e107d2b8b5f3c142d21ecfe4c8fd32a913d2fd551b788707930c4dc80d", bytes: 163_035_648 }
|
|
39
|
+
},
|
|
40
|
+
worker: {
|
|
41
|
+
modelId: "daimon-broker-grok",
|
|
42
|
+
models: GROK_BROKER_MODELS,
|
|
43
|
+
reasoningEfforts: GROK_BROKER_REASONING_EFFORTS,
|
|
44
|
+
defaultModel: "grok-4.6",
|
|
45
|
+
defaultReasoningEffort: "low",
|
|
46
|
+
toolIds: GROK_WORKER_TOOL_IDS,
|
|
47
|
+
visibleTools: GROK_WORKER_VISIBLE_TOOLS,
|
|
48
|
+
maxTurns: GROK_WORKER_MAX_TURNS,
|
|
49
|
+
systemPromptSha256: "2c31c0085a54a4efbf9c0cf0b8124c56e47f38691b7f0c7fa233a74abaa8ddf8",
|
|
50
|
+
// sha256 of `renderGrokBrokerWorkerConfig({ model, reasoningEffort })`, the unchanged production config.toml bytes.
|
|
51
|
+
configSha256: {
|
|
52
|
+
"grok-4.6": { low: "ab58499ac32678097c146479896f2b8a8e2b0e39aea22dc0a60b6227e370538e", medium: "df1a5cc84346e7f6bf6090492fbd19faaefb42953e3bb2e8c6cbc0572242403f", high: "65b0212564fb74042b1503d293fb8d3620276033264c0efade2a539ca09218e3" },
|
|
53
|
+
"grok-4.5": { low: "8247127c3625ff7c5d8d527a53596b89ec6557a821ac46cfd00bd122b90daff6", medium: "59288cee61297bb8c002097061a48f77b09d310754187a253ee089f7172a9155", high: "c63c3387ce92d94ec3f690abfe98942afcd7c9e17ff84816bbe751f340ab251f" },
|
|
54
|
+
"grok-build": { low: "fb343f2809903f26d21681470943235031f946e99085542fd89555eb7782cbb5", medium: "8a587ef75c90eab70d19b24583e60051d6fba9d90c558839fdbb15588b4cc656", high: "a23724e00d670caee185ba7690d2daa868173e53905cf446f5329666f01ab4e3" }
|
|
55
|
+
},
|
|
56
|
+
// Slot-zero template pins. Other slots replace only FAKETIME_TIMESTAMP_FILE with slotFilePattern.
|
|
57
|
+
clockedConfigSha256: {
|
|
58
|
+
"grok-4.6": {
|
|
59
|
+
"low": "751f1dcd04983e5e5883df5a8fefa04f201e187e5ef1f344d3bf83f950830432",
|
|
60
|
+
"medium": "f1406f93a8091eb0c09e07321254a9c783a89b0bbf5548d9613d53a8d087a517",
|
|
61
|
+
"high": "203744f6f0dfc0bc80cfb896880497edfd9b3de4dcf33060e8ef4d2ef5f220a7"
|
|
62
|
+
},
|
|
63
|
+
"grok-4.5": {
|
|
64
|
+
"low": "3c4f3515b21c1bffb3fb770e2ecb4b918b6c43d5e77c1fd47e1e6698d1fedee7",
|
|
65
|
+
"medium": "9117e12b2f3f6fa045799592969cbaae1c2f3b1ea79330badac8655b9b41dd7a",
|
|
66
|
+
"high": "907d8967960c342b442d6d256b2585f3c85bd846a78578f596f0b605403d6d34"
|
|
67
|
+
},
|
|
68
|
+
"grok-build": {
|
|
69
|
+
"low": "a8c63ba910623a0686930c27db0733f4a2588c7fca9dd7da25c3f18027720ab5",
|
|
70
|
+
"medium": "6afcd2b90c0d19794f8c0d22147a0f011946a92e613f89dae98b0ca729313101",
|
|
71
|
+
"high": "6efddadc82c38020d3351829e54bb09fa456cd6d76ea1247902794d82a4a3ffa"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
taskClock: GROK_BROKER_TASK_CLOCK,
|
|
75
|
+
// Worker `GROK_HOME` layout the broker attests before every turn. The home and
|
|
76
|
+
// its `sessions/` directory are root-owned, worker-group writable and sticky so
|
|
77
|
+
// Grok can create its own state but never replace a root-owned file.
|
|
78
|
+
home: {
|
|
79
|
+
directory: { uid: 0, group: "worker", mode: 0o1771 },
|
|
80
|
+
sessionsDirectory: { relativePath: "sessions", uid: 0, group: "worker", mode: 0o1771 },
|
|
81
|
+
readOnlyFiles: { names: ["config.toml", "managed_config.toml", "requirements.toml", "sandbox.toml", "trusted_folders.toml"], uid: 0, gid: 0, mode: 0o444 },
|
|
82
|
+
sandboxEvents: { relativePath: "sessions/sandbox-events.jsonl", owner: "worker", group: "broker", mode: 0o640 },
|
|
83
|
+
// The launcher exports TMPDIR=<worker home>/tmp; Grok's strict profile grants TMPDIR read-write.
|
|
84
|
+
privateTmp: { relativeToWorkerHome: "tmp", owner: "worker", mode: 0o700 },
|
|
85
|
+
// Strict also grants shared /tmp and /var/tmp read-write and refuses to start if either is
|
|
86
|
+
// denied, so the deployment keeps them from every worker by mode: root-owned, a non-worker
|
|
87
|
+
// group (< 2200), others read-only (Grok needs to open the directory) and no search/write.
|
|
88
|
+
sharedTmp: { paths: ["/tmp", "/var/tmp"], uid: 0, maxGroupExclusive: 2_200, otherMode: 0o4, mode: 0o1774 },
|
|
89
|
+
// The organization runtime home of a brokered Grok agent: traverse-only for the
|
|
90
|
+
// worker group so the worker can reach `tool-output/` and nothing else (no group
|
|
91
|
+
// read, no group write, no world bits; `physicalReadiness.ts` refuses anything else).
|
|
92
|
+
organizationRuntimeHome: { owner: "organization", group: "worker", mode: 0o710 },
|
|
93
|
+
// Spilled tool output the worker reads with read_file: setgid directory in the worker's group,
|
|
94
|
+
// files written 0640 by the runtime, never other-readable.
|
|
95
|
+
spillDirectory: { relativeToRuntimeHome: "tool-output", owner: "organization", group: "worker", mode: 0o2750, fileMode: 0o640 }
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
bounds: { promptBytes: 65_536, capabilityBytes: 4_096, capabilityBundleBytes: 8_196, outputBytes: 262_144 },
|
|
99
|
+
// Accounting and limits (P2). The broker is the single sealed usage writer.
|
|
100
|
+
controlProtocolVersion: "noopolis.daimon.engine-broker.v4",
|
|
101
|
+
turnRecordVersions: ["noopolis.daimon.engine-broker-turn.v1", "noopolis.daimon.engine-broker-turn.v2"],
|
|
102
|
+
serviceConfigVersions: ["noopolis.daimon.engine-broker-service.v1", "noopolis.daimon.engine-broker-service.v2", "noopolis.daimon.engine-broker-service.v3"],
|
|
103
|
+
slotRouting: { key: "slot", repeatedAgentIds: true, slotEnvironment: "DAIMON_ENGINE_BROKER_SLOT", resetRequest: "reset_slot", resetResponse: "slot_reset", turnStoreDirectory: "slot-{slot}", controlCaller: "organization", workersMayControl: false },
|
|
104
|
+
runRequestBudget: { maximumField: "maxRunRequests", storeField: "runRequestStore", fileName: "run-requests.json", includesInferenceGrants: true, countsCredentialRetries: true },
|
|
105
|
+
turnLimits: {
|
|
106
|
+
keys: ["maxRequests", "maxTokens", "timeoutMs"],
|
|
107
|
+
v1Defaults: { maxRequests: 32, maxTokens: 300_000, timeoutMs: 240_000 },
|
|
108
|
+
bounds: { maxRequests: [1, GROK_WORKER_MAX_TURNS], maxTokens: [1, 10_000_000], timeoutMs: [1_000, 3_600_000] },
|
|
109
|
+
limitReasons: ["tokens", "requests", "timeout", "none"],
|
|
110
|
+
wakeMayOnlyLower: true,
|
|
111
|
+
tokenCeilingOvershoot: "at-most-one-request",
|
|
112
|
+
maxInFlightRequests: 1,
|
|
113
|
+
// A per-request usage block above this is implausible (beyond the model
|
|
114
|
+
// context window) and treated as invalid rather than added to any total.
|
|
115
|
+
requestUsageMaxTokens: 500_000,
|
|
116
|
+
// A request whose response carries no valid usage is charged this estimate.
|
|
117
|
+
missingUsageEstimate: { inputBytesPerToken: 2, outputTokens: 4_096 }
|
|
118
|
+
},
|
|
119
|
+
wakeLimitEnvironment: { timeoutMs: "DAIMON_ENGINE_WAKE_TIMEOUT_MS", maxTokens: "DAIMON_ENGINE_WAKE_TOKEN_CEILING" },
|
|
120
|
+
// Evaluator inference grants (P2c). Judges and the optimizer (organization uid
|
|
121
|
+
// only, over the control socket) borrow the broker's Grok credential through
|
|
122
|
+
// the provider proxy; they never hold it, and their spend never reaches the
|
|
123
|
+
// subject usage ledger or wake fuse.
|
|
124
|
+
inferenceGrants: {
|
|
125
|
+
requestKinds: ["request_inference_grant", "release_inference_grant"],
|
|
126
|
+
purposes: ["judge", "optimizer"],
|
|
127
|
+
tokenPrefix: "inference_",
|
|
128
|
+
ttlMs: 600_000,
|
|
129
|
+
limits: { maxRequests: 64, maxTokens: 2_000_000 },
|
|
130
|
+
maxLiveGrants: 8,
|
|
131
|
+
maxInFlightRequestsPerGrant: 1,
|
|
132
|
+
// Top-level request members Grok 1.0.34 sends for a Paideia judge/optimizer call
|
|
133
|
+
// (live stub capture); `tools` and `tool_choice` are refused outright.
|
|
134
|
+
bodyMembers: ["messages", "model", "reasoning_effort", "response_format", "stream", "stream_options"],
|
|
135
|
+
messageRoles: ["system", "user", "assistant"],
|
|
136
|
+
failureCodes: ["auth_stale", "grant_limit", "invalid_request", "unavailable"],
|
|
137
|
+
ledgerVersion: "noopolis.daimon.inference-usage.v1",
|
|
138
|
+
ledgerDedupeKey: ["grant", "request"],
|
|
139
|
+
client: {
|
|
140
|
+
modelId: "daimon-inference-grok",
|
|
141
|
+
envKey: "DAIMON_INFERENCE_GRANT",
|
|
142
|
+
// sha256 of `renderGrokInferenceClientConfig` for the production proxy base URL and this env key.
|
|
143
|
+
configSha256: {
|
|
144
|
+
"grok-4.6": { low: "79314d039f787e4ebfec7dacf57adc969086b948f564dec008f0ed6367e6062f", medium: "6f538de0547c0c4e6a3f04ae08595ceadadabb06b75f6b6ee4c428744bb95cd8", high: "5652656effa82f0c4f09cf8226b16e6140332a5a358b571194bb5563312367ac" },
|
|
145
|
+
"grok-4.5": { low: "a07f7436f1268bb399ec233c65d3b3d8fb99a11a1f175f8da1ca133c9367bc74", medium: "1f4c0d4dad1f3b09419b5739db6423a09e0049abc091594c64123a75dd53dfb9", high: "ffbc33728b821e9854fbc7c93601e599225da421ecfd6ebf10d314afcc28d6f2" },
|
|
146
|
+
"grok-build": { low: "ca15c6a562a008227d39c51d3a3a83715663089b3784e8b46debb1fb67b3c4a1", medium: "01783fb6beadcf6f8486fff0836820ad43fab5662b812a907fe9cfdb83e9804d", high: "98d16f2b7d12f4eb540d625c853e51d227933e204923e43e8b9b4176f10aca2c" }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
projectionVersion: "noopolis.daimon.grok-broker-projection.v3",
|
|
151
|
+
slotPreflightVersion: "noopolis.daimon.grok-slot-preflight.v2",
|
|
152
|
+
artifacts: {
|
|
153
|
+
sourceSha256: "15836d7ad69f12ef581a6e5b8635c9db43b2177dac609160c0749d3d1fefbaa8",
|
|
154
|
+
x64Sha256: "95aa9c272225e74ff9f45f54dde4bc30aee324e9ba24d8a876db9151c81b454d",
|
|
155
|
+
arm64Sha256: "d0dc1c03197c3e90f09b66ad7c89b4f7b448d06dc84c03b247dce976d6018d6e"
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
export const AGY_SUBSCRIPTION_REALM = {
|
|
159
|
+
durableMountPath: "/var/lib/spawnfile/daimon/agy-subscription-realm",
|
|
160
|
+
unlockMountPath: "/var/lib/spawnfile/daimon/agy-unlock-secret",
|
|
161
|
+
unlockSourceSlot: "agy-unlock-secret",
|
|
162
|
+
directoryMode: 0o700,
|
|
163
|
+
fileMode: 0o600,
|
|
164
|
+
maxUnlockBytes: 4_096
|
|
165
|
+
};
|
|
166
|
+
const text = { type: "string", minLength: 1, maxLength: ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS, pattern: "\\S" };
|
|
167
|
+
const boundedText = { type: "string", maxLength: ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS };
|
|
168
|
+
const timestamp = { type: "string", format: "date-time", pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$" };
|
|
169
|
+
const wakeEvent = { type: "object", additionalProperties: false, required: ["version", "id", "kind", "text", "occurredAt"], properties: { version: { const: "noopolis.daimon.wake.v1" }, id: text, kind: { enum: ["manual", "message", "schedule", "external"] }, text: boundedText, occurredAt: timestamp } };
|
|
170
|
+
const wakeResultBase = { version: { const: "noopolis.daimon.wake-result.v1" }, agentId: text, wakeId: text };
|
|
171
|
+
const activityItem = { type: "object", additionalProperties: false, required: ["id", "agentId", "kind", "occurredAt"], properties: { id: { type: "string", format: "uuid", pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$" }, agentId: text, wakeId: text, kind: { enum: ["wake_started", "wake_completed", "wake_rejected", "wake_aborted", "agent_stopped"] }, occurredAt: timestamp } };
|
|
172
|
+
export const RUNTIME_CONTRACT_MANIFEST = {
|
|
173
|
+
version: RUNTIME_CONTRACT_MANIFEST_VERSION,
|
|
174
|
+
consumedConfigFields: ["version", "host.bindHost", "host.port", "host.controlTokenEnv", "agents[].id", "agents[].name", "agents[].instructions", "agents[].workspacePath", "agents[].runtimeHomePath", "agents[].engine.kind", "agents[].engine.model", "agents[].engine.reasoningEffort", "agents[].engine.codexSandbox", "agents[].schedule.kind", "agents[].schedule.interval_ms", "agents[].schedule.cron", "agents[].schedule.timezone", "agents[].schedule.prompt", "agents[].schedule.jitter_seconds", "agents[].mcp", "agents[].moltnet", "agents[].memory", "agents[].attention", "agents[].recording"],
|
|
175
|
+
wakeMoments: WAKE_MOMENTS,
|
|
176
|
+
organizationRuntimeConfigSchema: ORGANIZATION_RUNTIME_CONFIG_SCHEMA,
|
|
177
|
+
organizationRuntimeConfigV2Schema: ORGANIZATION_RUNTIME_CONFIG_V2_SCHEMA,
|
|
178
|
+
wakeAcceptanceTypes: ["manual", "message", "schedule", "external"],
|
|
179
|
+
deliverySemantics: {
|
|
180
|
+
activeDeliveryIdempotency: "unbounded-until-terminal",
|
|
181
|
+
terminalReceiptHorizon: 2_048,
|
|
182
|
+
recovery: "at-least-once-with-stable-wake-id",
|
|
183
|
+
concurrentSameAgentTurns: false,
|
|
184
|
+
externalEffectsExactlyOnce: false
|
|
185
|
+
},
|
|
186
|
+
attention: { enabledBy: "agents[].attention", defaultMaxBatchMessages: 8, defaultMaxBatchBytes: 12000, idleDispatch: "immediate", busyDispatch: "bounded-pending-message-batch", completion: "explicit-per-delivery", unhandled: "deferred-until-new-input", accounting: "execution-start-reservations" },
|
|
187
|
+
workAvailabilityResponseSchema: WORK_AVAILABILITY_SCHEMA,
|
|
188
|
+
workBlockedSchema: WORK_BLOCKED_SCHEMA,
|
|
189
|
+
operatorDrain: OPERATOR_DRAIN,
|
|
190
|
+
supportedEngineKinds: ["agy", "codex", "grok"],
|
|
191
|
+
engineCredentialMaterial: ENGINE_CREDENTIAL_MATERIAL,
|
|
192
|
+
grokSubscriptionRealm: GROK_SUBSCRIPTION_REALM,
|
|
193
|
+
grokEngineBroker: GROK_ENGINE_BROKER,
|
|
194
|
+
agySubscriptionRealm: AGY_SUBSCRIPTION_REALM,
|
|
195
|
+
wakeRequestSchema: { type: "object", additionalProperties: false, required: ["agentId", "event"], properties: { agentId: text, event: wakeEvent } },
|
|
196
|
+
wakeResultSchema: { oneOf: [
|
|
197
|
+
{ type: "object", additionalProperties: false, required: ["version", "status", "agentId", "wakeId", "text", "durationMs"], properties: { ...wakeResultBase, status: { const: "completed" }, text: boundedText, durationMs: { type: "integer", minimum: 0 } } },
|
|
198
|
+
{ type: "object", additionalProperties: false, required: ["version", "status", "agentId", "wakeId", "code"], properties: { ...wakeResultBase, status: { const: "rejected" }, code: { enum: ["unauthorized", "unknown_agent", "queue_full", "durable_inbox_required"] } } },
|
|
199
|
+
{ type: "object", additionalProperties: false, required: ["version", "status", "agentId", "wakeId", "code"], properties: { version: { const: "noopolis.daimon.wake-result.v1" }, status: { const: "rejected" }, agentId: { type: "string", maxLength: ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS }, wakeId: { type: "string", maxLength: ORGANIZATION_RUNTIME_MAX_STRING_CODEPOINTS }, code: { const: "invalid_request" } } },
|
|
200
|
+
{ type: "object", additionalProperties: false, required: ["version", "status", "agentId", "wakeId", "code"], properties: { ...wakeResultBase, status: { const: "stopped" }, code: { enum: ["host_stopping", "host_stopped", "queued_wake_stopped", "active_wake_aborted"] } } },
|
|
201
|
+
{ type: "object", additionalProperties: false, required: ["version", "status", "agentId", "wakeId", "code"], properties: { ...wakeResultBase, status: { const: "failed" }, code: { const: "engine_failed" } } }
|
|
202
|
+
] },
|
|
203
|
+
healthResponseSchema: { type: "object", additionalProperties: false, required: ["version", "state", "agents"], properties: { version: { const: "noopolis.daimon.organization-runtime-health.v1" }, state: { enum: ["starting", "running", "stopping", "stopped"] }, agents: { type: "array", maxItems: ORGANIZATION_RUNTIME_MAX_AGENTS, items: { type: "object", additionalProperties: false, required: ["agentId", "state"], properties: { agentId: text, state: { enum: ["starting", "running", "stopping", "stopped", "idle", "failed"] } } } } } },
|
|
204
|
+
activityResponseSchema: { type: "object", additionalProperties: false, required: ["version", "items"], properties: { version: { const: "noopolis.daimon.organization-runtime-activity.v1" }, items: { type: "array", maxItems: 100, items: activityItem }, nextCursor: { type: "string", minLength: 1, maxLength: 16, pattern: "^(0|[1-9][0-9]{0,15})$" } } },
|
|
205
|
+
activityV2ResponseSchema: { type: "object", additionalProperties: false, required: ["version", "items"], properties: { version: { const: ORGANIZATION_RUNTIME_ACTIVITY_V2_VERSION }, state: { enum: ["running", "stopped"] }, executions: { type: "array", maxItems: ORGANIZATION_RUNTIME_MAX_AGENTS, items: { type: "object", additionalProperties: false, required: ["agent_id", "execution_id", "state", "delivery_ids"], properties: { agent_id: text, execution_id: { type: "string" }, state: { const: "running" }, delivery_ids: { type: "array", maxItems: 32, items: text } } } }, items: { type: "array", maxItems: 2_112, items: { type: "object", additionalProperties: false, required: ["version", "acceptance_id", "agent_id", "delivery_id", "request_digest", "state", "accepted_at", "updated_at", "active"], properties: { version: { const: "noopolis.daimon.wake-receipt-status.v2" }, acceptance_id: { type: "string" }, agent_id: text, delivery_id: text, request_digest: { type: "string" }, state: { enum: ["accepted", "running", "completed", "failed", "stopped"] }, accepted_at: timestamp, updated_at: timestamp, active: { type: "boolean" }, execution_id: { type: "string" }, deferred: { type: "boolean" }, text: { type: "string", maxLength: 16384 }, queue_position: { type: "integer", minimum: 1 }, code: { enum: ["engine_failed", "host_stopped", "host_stopping", "queued_wake_stopped", "active_wake_aborted", "queue_full", "unknown_agent"] } } } } } }
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellEnvironmentPolicy.d.ts","sourceRoot":"","sources":["../../src/contracts/shellEnvironmentPolicy.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,MAAM,EAAE,CAGtG"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Same filter order and automatic secret exclusions for direct and brokered tools. */
|
|
2
|
+
export function shellEnvironmentPolicyEntries(env) {
|
|
3
|
+
const set = Object.entries(env).map(([name, value]) => `${JSON.stringify(name)}=${JSON.stringify(value)}`).join(",");
|
|
4
|
+
return ['inherit="all"', "ignore_default_excludes=false", "exclude=[]", "include_only=[]", `set={${set}}`];
|
|
5
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Data-only capability and on-disk bounds; presence in the manifest enables callers. */
|
|
2
|
+
export declare const WAKE_MOMENTS: {
|
|
3
|
+
readonly version: "noopolis.daimon.wake-moment.v1";
|
|
4
|
+
readonly rowsFile: "wake-moments.jsonl";
|
|
5
|
+
readonly snapshotsDirectory: "snapshots";
|
|
6
|
+
readonly completionSuffix: ".complete";
|
|
7
|
+
readonly maxSnapshotRoots: 16;
|
|
8
|
+
readonly maxSnapshotEntries: 200000;
|
|
9
|
+
readonly maxRowBytes: 4194304;
|
|
10
|
+
readonly maxManifestBytes: 134217728;
|
|
11
|
+
readonly captureDeadlineMs: 60000;
|
|
12
|
+
readonly finalizationDeadlineMs: 1000;
|
|
13
|
+
readonly configField: "agents[].recording";
|
|
14
|
+
};
|
|
15
|
+
export type WakeMomentRecording = Readonly<{
|
|
16
|
+
directory: string;
|
|
17
|
+
keepMs: number;
|
|
18
|
+
snapshots: readonly Readonly<{
|
|
19
|
+
id: string;
|
|
20
|
+
path: string;
|
|
21
|
+
}>[];
|
|
22
|
+
}>;
|
|
23
|
+
export declare const WAKE_MOMENT_RECORDING_SCHEMA: {
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
readonly additionalProperties: false;
|
|
26
|
+
readonly required: readonly ["directory", "keepMs", "snapshots"];
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly directory: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly pattern: "^/[^\\u0000]*$";
|
|
31
|
+
readonly maxLength: 4096;
|
|
32
|
+
};
|
|
33
|
+
readonly keepMs: {
|
|
34
|
+
readonly type: "integer";
|
|
35
|
+
readonly minimum: 1;
|
|
36
|
+
readonly maximum: 9007199254740991;
|
|
37
|
+
};
|
|
38
|
+
readonly snapshots: {
|
|
39
|
+
readonly type: "array";
|
|
40
|
+
readonly maxItems: 16;
|
|
41
|
+
readonly uniqueItems: true;
|
|
42
|
+
readonly items: {
|
|
43
|
+
readonly type: "object";
|
|
44
|
+
readonly additionalProperties: false;
|
|
45
|
+
readonly required: readonly ["id", "path"];
|
|
46
|
+
readonly properties: {
|
|
47
|
+
readonly id: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
readonly pattern: "^[A-Za-z0-9._-]{1,128}$";
|
|
50
|
+
};
|
|
51
|
+
readonly path: {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
readonly pattern: "^/[^\\u0000]*$";
|
|
54
|
+
readonly maxLength: 4096;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=wakeMomentContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wakeMomentContract.d.ts","sourceRoot":"","sources":["../../src/contracts/wakeMomentContract.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,eAAO,MAAM,YAAY;;;;;;;;;;;;CAYf,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,QAAQ,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CAC9D,CAAC,CAAC;AAGH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW/B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Data-only capability and on-disk bounds; presence in the manifest enables callers. */
|
|
2
|
+
export const WAKE_MOMENTS = {
|
|
3
|
+
version: "noopolis.daimon.wake-moment.v1",
|
|
4
|
+
rowsFile: "wake-moments.jsonl",
|
|
5
|
+
snapshotsDirectory: "snapshots",
|
|
6
|
+
completionSuffix: ".complete",
|
|
7
|
+
maxSnapshotRoots: 16,
|
|
8
|
+
maxSnapshotEntries: 200_000,
|
|
9
|
+
maxRowBytes: 4_194_304,
|
|
10
|
+
maxManifestBytes: 134_217_728,
|
|
11
|
+
captureDeadlineMs: 60_000,
|
|
12
|
+
finalizationDeadlineMs: 1_000,
|
|
13
|
+
configField: "agents[].recording"
|
|
14
|
+
};
|
|
15
|
+
const absolutePath = { type: "string", pattern: "^/[^\\u0000]*$", maxLength: 4_096 };
|
|
16
|
+
export const WAKE_MOMENT_RECORDING_SCHEMA = {
|
|
17
|
+
type: "object", additionalProperties: false, required: ["directory", "keepMs", "snapshots"],
|
|
18
|
+
properties: {
|
|
19
|
+
directory: absolutePath,
|
|
20
|
+
keepMs: { type: "integer", minimum: 1, maximum: 9_007_199_254_740_991 },
|
|
21
|
+
snapshots: { type: "array", maxItems: WAKE_MOMENTS.maxSnapshotRoots, uniqueItems: true, items: {
|
|
22
|
+
type: "object", additionalProperties: false, required: ["id", "path"], properties: {
|
|
23
|
+
id: { type: "string", pattern: "^[A-Za-z0-9._-]{1,128}$" }, path: absolutePath
|
|
24
|
+
}
|
|
25
|
+
} }
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Redacts provider credentials before text crosses any reply or diagnostic boundary. */
|
|
2
|
+
export declare function redactCredentialText(value: unknown, exactSecrets?: readonly string[], maxBytes?: number): string;
|
|
3
|
+
export declare function redactCredentialError(error: unknown, exactSecrets?: readonly string[], maxBytes?: number): Error;
|
|
4
|
+
//# sourceMappingURL=credentialRedaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentialRedaction.d.ts","sourceRoot":"","sources":["../../src/core/credentialRedaction.ts"],"names":[],"mappings":"AASA,yFAAyF;AACzF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,YAAY,GAAE,SAAS,MAAM,EAAO,EACpC,QAAQ,GAAE,MAA0B,GACnC,MAAM,CAoBR;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,YAAY,GAAE,SAAS,MAAM,EAAO,EACpC,QAAQ,GAAE,MAA0B,GACnC,KAAK,CAEP"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const DEFAULT_MAX_BYTES = 16_384;
|
|
2
|
+
const truncateUtf8 = (value, maxBytes) => {
|
|
3
|
+
if (Buffer.byteLength(value, "utf8") <= maxBytes)
|
|
4
|
+
return value;
|
|
5
|
+
let result = Buffer.from(value, "utf8").subarray(0, maxBytes).toString("utf8");
|
|
6
|
+
while (result.endsWith("\uFFFD"))
|
|
7
|
+
result = result.slice(0, -1);
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
/** Redacts provider credentials before text crosses any reply or diagnostic boundary. */
|
|
11
|
+
export function redactCredentialText(value, exactSecrets = [], maxBytes = DEFAULT_MAX_BYTES) {
|
|
12
|
+
let result = String(value);
|
|
13
|
+
for (const secret of [...new Set(exactSecrets.filter((entry) => entry.length > 0))]
|
|
14
|
+
.sort((left, right) => right.length - left.length)) {
|
|
15
|
+
result = result.split(secret).join("[REDACTED]");
|
|
16
|
+
}
|
|
17
|
+
result = result
|
|
18
|
+
.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{12,}/giu, "Bearer [REDACTED]")
|
|
19
|
+
.replace(/\bmagt_v1_[A-Za-z0-9_-]{16,}\b/gu, "[REDACTED]")
|
|
20
|
+
.replace(/\b(?:sk|sk-proj|xai)-[A-Za-z0-9_-]{20,}\b/gu, "[REDACTED]")
|
|
21
|
+
.replace(/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/gu, "[REDACTED]")
|
|
22
|
+
.replace(/("(?:api[_-]?key|authorization|client[_-]?secret|credential|key|password|secret|(?:access|refresh|id)[_-]?token|token)"\s*:\s*")([^"\\]*(?:\\.[^"\\]*)*)(")/giu, "$1[REDACTED]$3")
|
|
23
|
+
.replace(/\b(api[_-]?key|authorization|client[_-]?secret|credential|password|secret|(?:access|refresh|id)[_-]?token|token)\b(\s*[:=]\s*)(["']?)[^\s"',&]{8,}\3/giu, "$1$2[REDACTED]");
|
|
24
|
+
return truncateUtf8(result, maxBytes);
|
|
25
|
+
}
|
|
26
|
+
export function redactCredentialError(error, exactSecrets = [], maxBytes = DEFAULT_MAX_BYTES) {
|
|
27
|
+
return new Error(redactCredentialText(error instanceof Error ? error.message : error, exactSecrets, maxBytes));
|
|
28
|
+
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface AgentStartInput {
|
|
|
5
5
|
instructions: string;
|
|
6
6
|
workspacePath: string;
|
|
7
7
|
runtimeHomePath: string;
|
|
8
|
+
/** Trusted host causal identity, fixed per instance; unsupported with memory until its public API accepts context. */
|
|
9
|
+
causalRunId?: string;
|
|
8
10
|
tools?: string[];
|
|
9
11
|
}
|
|
10
12
|
export interface HarnessModelEndpoint {
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,WAAW,GAAG,QAAQ,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;KACtD,CAAC;IACF,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,IAAI,WAAW,CAAC;IACtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1D"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,sHAAsH;IACtH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,WAAW,GAAG,QAAQ,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;KACtD,CAAC;IACF,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,QAAQ,CAAC,EAAE,oBAAoB,CAAC;IAChC,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,IAAI,WAAW,CAAC;IACtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jungianPlayAgent.d.ts","sourceRoot":"","sources":["../../src/examples/jungianPlayAgent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"jungianPlayAgent.d.ts","sourceRoot":"","sources":["../../src/examples/jungianPlayAgent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAqB,KAAK,aAAa,IAAI,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEhH,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,eAAe,CAAC;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,kBAAkB,CAAC;CAC3B;AAUD,qBAAa,YAAY;IAMX,QAAQ,CAAC,MAAM,EAAE,kBAAkB;IAL/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;IACvC,OAAO,CAAC,UAAU,CAAC,CAAgB;gBAEd,MAAM,EAAE,kBAAkB;IAWzC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBxB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC;CA6DxD;AAED,eAAO,MAAM,UAAU,GAAU,CAAC,EAAE,CAAC,EACnC,QAAQ,SAAS,CAAC,EAAE,EACpB,OAAO,MAAM,EACb,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,EAAE,CAYb,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { createClockedMemoryRuntime } from "../pi/memoryClock.js";
|
|
4
|
+
import { verifyTaskClockProcess } from "../pi/taskClockProcess.js";
|
|
4
5
|
import { runEngineDetailed } from "../pi/cliSession.js";
|
|
5
6
|
const maxMemoryChars = 2200;
|
|
6
7
|
const truncate = (text, maxChars) => text.length <= maxChars ? text : `${text.slice(0, maxChars).trim()}\n[truncated]`;
|
|
@@ -10,11 +11,12 @@ export class JungianVoice {
|
|
|
10
11
|
runtimeHomePath;
|
|
11
12
|
workspacePath;
|
|
12
13
|
memory;
|
|
14
|
+
clockReady;
|
|
13
15
|
constructor(config) {
|
|
14
16
|
this.config = config;
|
|
15
17
|
this.workspacePath = path.join(config.runtimeRoot, "selves", config.selfId, "voices", config.id, "workspace");
|
|
16
18
|
this.runtimeHomePath = path.join(config.runtimeRoot, "selves", config.selfId, "voices", config.id, "runtime");
|
|
17
|
-
this.memory =
|
|
19
|
+
this.memory = createClockedMemoryRuntime({
|
|
18
20
|
agentId: config.id,
|
|
19
21
|
runtimeHomePath: this.runtimeHomePath,
|
|
20
22
|
source: `daimon/jungian-play/${config.engine}`,
|
|
@@ -22,6 +24,7 @@ export class JungianVoice {
|
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
async prepare() {
|
|
27
|
+
await (this.clockReady ??= verifyTaskClockProcess(this.runtimeHomePath));
|
|
25
28
|
await mkdir(this.workspacePath, { recursive: true });
|
|
26
29
|
await mkdir(this.runtimeHomePath, { recursive: true });
|
|
27
30
|
await writeFile(path.join(this.workspacePath, "AGENTS.md"), [
|
|
@@ -39,6 +42,7 @@ export class JungianVoice {
|
|
|
39
42
|
// CLI-backed voices are one-process-per-wake and have no persistent handle.
|
|
40
43
|
}
|
|
41
44
|
async wake(event) {
|
|
45
|
+
await (this.clockReady ??= verifyTaskClockProcess(this.runtimeHomePath));
|
|
42
46
|
const startedAt = Date.now();
|
|
43
47
|
const prepareStartedAt = Date.now();
|
|
44
48
|
const prepared = await this.memory.prepareTurn({
|
package/dist/mcp/toolServer.d.ts
CHANGED
|
@@ -6,9 +6,26 @@ export declare class McpToolTurnLimitError extends Error {
|
|
|
6
6
|
export declare class McpWakeDeadlineError extends Error {
|
|
7
7
|
constructor();
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* A non-standard request AGY issues during its MCP handshake.
|
|
11
|
+
*
|
|
12
|
+
* Captured live from `agy --print … --output-format stream-json`, the client
|
|
13
|
+
* sends `initialize`, `notifications/initialized`, **`server/discover`**,
|
|
14
|
+
* `tools/list`, `tools/call`. `server/discover` is not in the MCP
|
|
15
|
+
* specification, and the throwaway probe that proved AGY's headless tool
|
|
16
|
+
* calling answered it with `{}`. Codex and Grok never send it.
|
|
17
|
+
*
|
|
18
|
+
* This server answers it the same way that working probe did, rather than the
|
|
19
|
+
* SDK default of `MethodNotFound`, because a refusal here is the one observable
|
|
20
|
+
* difference between this server and the one AGY is known to work against, and
|
|
21
|
+
* the cost of being wrong is that every AGY agent silently loses every tool.
|
|
22
|
+
* The allowance is exactly this one method: any other unknown method still gets
|
|
23
|
+
* `MethodNotFound`, so a genuine protocol mistake is never hidden.
|
|
24
|
+
*/
|
|
25
|
+
export declare const AGY_SERVER_DISCOVER_METHOD: "server/discover";
|
|
9
26
|
export interface PiToolMcpServerOptions {
|
|
10
|
-
readonly maxToolTurns
|
|
11
|
-
readonly wakeDeadline
|
|
27
|
+
readonly maxToolTurns?: number;
|
|
28
|
+
readonly wakeDeadline?: number;
|
|
12
29
|
}
|
|
13
30
|
export declare const createPiToolMcpServer: (tools: ToolDefinition[], options: PiToolMcpServerOptions) => Server;
|
|
14
31
|
//# sourceMappingURL=toolServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolServer.d.ts","sourceRoot":"","sources":["../../src/mcp/toolServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,qBAAa,qBAAsB,SAAQ,KAAK;gBAC3B,YAAY,EAAE,MAAM;CAIxC;AAED,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"toolServer.d.ts","sourceRoot":"","sources":["../../src/mcp/toolServer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAYnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,qBAAa,qBAAsB,SAAQ,KAAK;gBAC3B,YAAY,EAAE,MAAM;CAIxC;AAED,qBAAa,oBAAqB,SAAQ,KAAK;;CAK9C;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B,EAAG,iBAA0B,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAyDD,eAAO,MAAM,qBAAqB,GAChC,OAAO,cAAc,EAAE,EACvB,SAAS,sBAAsB,KAC9B,MAgEF,CAAC"}
|
package/dist/mcp/toolServer.js
CHANGED
|
@@ -13,6 +13,23 @@ export class McpWakeDeadlineError extends Error {
|
|
|
13
13
|
this.name = "McpWakeDeadlineError";
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* A non-standard request AGY issues during its MCP handshake.
|
|
18
|
+
*
|
|
19
|
+
* Captured live from `agy --print … --output-format stream-json`, the client
|
|
20
|
+
* sends `initialize`, `notifications/initialized`, **`server/discover`**,
|
|
21
|
+
* `tools/list`, `tools/call`. `server/discover` is not in the MCP
|
|
22
|
+
* specification, and the throwaway probe that proved AGY's headless tool
|
|
23
|
+
* calling answered it with `{}`. Codex and Grok never send it.
|
|
24
|
+
*
|
|
25
|
+
* This server answers it the same way that working probe did, rather than the
|
|
26
|
+
* SDK default of `MethodNotFound`, because a refusal here is the one observable
|
|
27
|
+
* difference between this server and the one AGY is known to work against, and
|
|
28
|
+
* the cost of being wrong is that every AGY agent silently loses every tool.
|
|
29
|
+
* The allowance is exactly this one method: any other unknown method still gets
|
|
30
|
+
* `MethodNotFound`, so a genuine protocol mistake is never hidden.
|
|
31
|
+
*/
|
|
32
|
+
export const AGY_SERVER_DISCOVER_METHOD = "server/discover";
|
|
16
33
|
const jsonSchema = (parameters) => {
|
|
17
34
|
if (parameters === null || typeof parameters !== "object" || Array.isArray(parameters)) {
|
|
18
35
|
throw new TypeError("Pi tool parameters must be a JSON schema object");
|
|
@@ -25,6 +42,25 @@ const toolResult = (result) => ({
|
|
|
25
42
|
? { structuredContent: Object.fromEntries(Object.entries(result.details)) }
|
|
26
43
|
: {})
|
|
27
44
|
});
|
|
45
|
+
/** Bound on the rendered Ajv violations, so a pathological schema cannot flood a turn. */
|
|
46
|
+
const MAX_SCHEMA_VIOLATION_BYTES = 2_048;
|
|
47
|
+
/**
|
|
48
|
+
* Why the arguments were rejected, in the schema's own words.
|
|
49
|
+
*
|
|
50
|
+
* A bare `Invalid arguments for tool X` tells an agent that its call was wrong
|
|
51
|
+
* and nothing about how, which leaves trial and error as the only way to learn
|
|
52
|
+
* a tool's argument shape. Ajv already knows which instance path failed and
|
|
53
|
+
* which keyword it failed on; saying so turns a guessing loop into one
|
|
54
|
+
* correction.
|
|
55
|
+
*/
|
|
56
|
+
const schemaViolations = (validator) => {
|
|
57
|
+
const rendered = (validator.errors ?? [])
|
|
58
|
+
.map((issue) => `${issue.instancePath === "" ? "(root)" : issue.instancePath} ${issue.message ?? "is invalid"}`.trim())
|
|
59
|
+
.join("; ");
|
|
60
|
+
if (rendered.length === 0)
|
|
61
|
+
return "the arguments do not match the tool's declared input schema";
|
|
62
|
+
return rendered.length > MAX_SCHEMA_VIOLATION_BYTES ? `${rendered.slice(0, MAX_SCHEMA_VIOLATION_BYTES)}…` : rendered;
|
|
63
|
+
};
|
|
28
64
|
const toolError = (error) => ({
|
|
29
65
|
content: [{ type: "text", text: error instanceof Error ? `${error.name}: ${error.message}` : String(error) }],
|
|
30
66
|
isError: true
|
|
@@ -34,16 +70,22 @@ const toolError = (error) => ({
|
|
|
34
70
|
// The MCP mount deliberately has no Pi session context; `never` preserves typed positional checks.
|
|
35
71
|
const NO_PI_EXTENSION_CONTEXT = undefined;
|
|
36
72
|
const validateOptions = (options) => {
|
|
37
|
-
if (!Number.isSafeInteger(options.maxToolTurns) || options.maxToolTurns < 1) {
|
|
73
|
+
if (options.maxToolTurns !== undefined && (!Number.isSafeInteger(options.maxToolTurns) || options.maxToolTurns < 1)) {
|
|
38
74
|
throw new TypeError("maxToolTurns must be a positive safe integer");
|
|
39
75
|
}
|
|
40
|
-
if (!Number.isFinite(options.wakeDeadline)) {
|
|
76
|
+
if (options.wakeDeadline !== undefined && !Number.isFinite(options.wakeDeadline)) {
|
|
41
77
|
throw new TypeError("wakeDeadline must be a finite epoch-millisecond deadline");
|
|
42
78
|
}
|
|
43
79
|
};
|
|
44
80
|
export const createPiToolMcpServer = (tools, options) => {
|
|
45
81
|
validateOptions(options);
|
|
46
82
|
const server = new Server({ name: "daimon-pi-tools", version: "0.1.2" });
|
|
83
|
+
server.fallbackRequestHandler = async (request) => {
|
|
84
|
+
if (request.method !== AGY_SERVER_DISCOVER_METHOD) {
|
|
85
|
+
throw new McpError(ErrorCode.MethodNotFound, `Method not found: ${request.method}`);
|
|
86
|
+
}
|
|
87
|
+
return {};
|
|
88
|
+
};
|
|
47
89
|
const validators = new Map(tools.map((tool) => {
|
|
48
90
|
const schema = jsonSchema(tool.parameters);
|
|
49
91
|
return [tool.name, new Ajv2020({ strict: false }).compile(schema)];
|
|
@@ -60,9 +102,9 @@ export const createPiToolMcpServer = (tools, options) => {
|
|
|
60
102
|
}));
|
|
61
103
|
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
62
104
|
try {
|
|
63
|
-
if (Date.now() >= options.wakeDeadline)
|
|
105
|
+
if (options.wakeDeadline !== undefined && Date.now() >= options.wakeDeadline)
|
|
64
106
|
throw new McpWakeDeadlineError();
|
|
65
|
-
if (toolTurns >= options.maxToolTurns)
|
|
107
|
+
if (options.maxToolTurns !== undefined && toolTurns >= options.maxToolTurns)
|
|
66
108
|
throw new McpToolTurnLimitError(options.maxToolTurns);
|
|
67
109
|
const tool = tools.find((candidate) => candidate.name === request.params.name);
|
|
68
110
|
const validator = validators.get(request.params.name);
|
|
@@ -71,29 +113,27 @@ export const createPiToolMcpServer = (tools, options) => {
|
|
|
71
113
|
}
|
|
72
114
|
const args = request.params.arguments ?? {};
|
|
73
115
|
if (!validator(args)) {
|
|
74
|
-
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${tool.name}`);
|
|
116
|
+
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for tool ${tool.name}: ${schemaViolations(validator)}`);
|
|
75
117
|
}
|
|
76
118
|
toolTurns += 1;
|
|
77
119
|
// Ajv validated this value against this tool's own schema immediately above.
|
|
78
120
|
const validatedArgs = args;
|
|
79
|
-
const deadlineController = new AbortController();
|
|
80
|
-
const remainingMs = Math.max(0, options.wakeDeadline - Date.now());
|
|
81
|
-
const deadlineTimer = setTimeout(() => deadlineController.abort(), remainingMs);
|
|
82
|
-
const signal =
|
|
83
|
-
? deadlineController.signal
|
|
84
|
-
|
|
85
|
-
const deadline = new Promise((_resolve, reject) => {
|
|
121
|
+
const deadlineController = options.wakeDeadline === undefined ? undefined : new AbortController();
|
|
122
|
+
const remainingMs = options.wakeDeadline === undefined ? undefined : Math.max(0, options.wakeDeadline - Date.now());
|
|
123
|
+
const deadlineTimer = deadlineController === undefined ? undefined : setTimeout(() => deadlineController.abort(), remainingMs);
|
|
124
|
+
const signal = deadlineController === undefined ? extra.signal
|
|
125
|
+
: extra.signal === undefined ? deadlineController.signal : AbortSignal.any([extra.signal, deadlineController.signal]);
|
|
126
|
+
const deadline = deadlineController === undefined ? undefined : new Promise((_resolve, reject) => {
|
|
86
127
|
deadlineController.signal.addEventListener("abort", () => reject(new McpWakeDeadlineError()), { once: true });
|
|
87
128
|
});
|
|
88
129
|
let result;
|
|
89
130
|
try {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
deadline
|
|
93
|
-
]);
|
|
131
|
+
const execution = tool.execute(`mcp-tool-turn-${toolTurns}`, validatedArgs, signal, undefined, NO_PI_EXTENSION_CONTEXT);
|
|
132
|
+
result = deadline === undefined ? await execution : await Promise.race([execution, deadline]);
|
|
94
133
|
}
|
|
95
134
|
finally {
|
|
96
|
-
|
|
135
|
+
if (deadlineTimer !== undefined)
|
|
136
|
+
clearTimeout(deadlineTimer);
|
|
97
137
|
}
|
|
98
138
|
return toolResult(result);
|
|
99
139
|
}
|