@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,51 @@
|
|
|
1
|
+
import { GROK_ENGINE_BROKER } from "../contracts/runtimeContractManifest.js";
|
|
2
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
const tokenCount = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : undefined;
|
|
4
|
+
const SESSION_ID = /^[A-Za-z0-9][A-Za-z0-9-]{0,63}$/u;
|
|
5
|
+
const MODEL_KEY = /^[a-z0-9][a-z0-9.-]{0,63}$/u;
|
|
6
|
+
const decodeUsage = (usage) => {
|
|
7
|
+
if (!isRecord(usage))
|
|
8
|
+
return undefined;
|
|
9
|
+
const input = tokenCount(usage.input_tokens), output = tokenCount(usage.output_tokens), cacheRead = tokenCount(usage.cache_read_input_tokens), cacheWrite = tokenCount(usage.cache_creation_input_tokens);
|
|
10
|
+
if (input === undefined || output === undefined || cacheRead === undefined || cacheWrite === undefined)
|
|
11
|
+
return undefined;
|
|
12
|
+
const total = input + cacheRead + cacheWrite + output;
|
|
13
|
+
// Beyond the model context window one request cannot have spent it: invalid, like a malformed block.
|
|
14
|
+
if (total > GROK_ENGINE_BROKER.turnLimits.requestUsageMaxTokens)
|
|
15
|
+
return undefined;
|
|
16
|
+
return { input, cacheRead, cacheWrite, output, total };
|
|
17
|
+
};
|
|
18
|
+
export const decodeGrokStreamUsage = (output) => {
|
|
19
|
+
const byMessage = new Map();
|
|
20
|
+
const reportedModels = new Set();
|
|
21
|
+
let sessionId, corrupt = false;
|
|
22
|
+
for (const line of output.split(/\r?\n/u)) {
|
|
23
|
+
if (line.trim().length === 0)
|
|
24
|
+
continue;
|
|
25
|
+
let event;
|
|
26
|
+
try {
|
|
27
|
+
event = JSON.parse(line);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (!isRecord(event))
|
|
33
|
+
continue;
|
|
34
|
+
if (typeof event.session_id === "string" && SESSION_ID.test(event.session_id))
|
|
35
|
+
sessionId ??= event.session_id;
|
|
36
|
+
if (event.type === "result" && isRecord(event.modelUsage))
|
|
37
|
+
for (const key of Object.keys(event.modelUsage))
|
|
38
|
+
reportedModels.add(MODEL_KEY.test(key) ? key : "invalid");
|
|
39
|
+
if (event.type !== "assistant" || event.parent_tool_use_id !== null || !isRecord(event.message) || event.message.usage === undefined)
|
|
40
|
+
continue;
|
|
41
|
+
const decoded = decodeUsage(event.message.usage);
|
|
42
|
+
if (decoded === undefined || typeof event.message.id !== "string") {
|
|
43
|
+
corrupt = true;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
// One request can surface as more than one frame of the same message; it is one request.
|
|
47
|
+
byMessage.set(event.message.id, decoded);
|
|
48
|
+
}
|
|
49
|
+
const requests = corrupt ? [] : [...byMessage.values()].map((usage, index) => Object.freeze({ index, ...usage }));
|
|
50
|
+
return { requests, ...(sessionId === undefined ? {} : { sessionId }), reportedModels: [...reportedModels].sort() };
|
|
51
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as mneme from "@noopolis/mneme";
|
|
2
|
+
import { type TaskClock } from "../runtime/taskClock.js";
|
|
3
|
+
type MnemeClockModule = {
|
|
4
|
+
readonly createOffsetClock?: unknown;
|
|
5
|
+
};
|
|
6
|
+
type MemoryConfig = Parameters<typeof mneme.createMemoryRuntime>[0];
|
|
7
|
+
type MemoryModule = MnemeClockModule & {
|
|
8
|
+
createMemoryRuntime(config: MemoryConfig & {
|
|
9
|
+
clock?: () => number;
|
|
10
|
+
}): ReturnType<typeof mneme.createMemoryRuntime>;
|
|
11
|
+
};
|
|
12
|
+
/** Keep construction and capability detection together while the published types catch up. */
|
|
13
|
+
export declare function createClockedMemoryRuntime(config: MemoryConfig, clock?: Readonly<{
|
|
14
|
+
raw: string;
|
|
15
|
+
origin: string;
|
|
16
|
+
anchorEpochMs: number;
|
|
17
|
+
at(realEpochMs: number): number;
|
|
18
|
+
now(): number;
|
|
19
|
+
}> | undefined, moduleRoot?: MemoryModule): mneme.MemoryRuntime;
|
|
20
|
+
/** The root export is Mneme's capability signal, including across older published versions. */
|
|
21
|
+
export declare function memoryClockOptions(clock?: TaskClock | undefined, moduleRoot?: MnemeClockModule): {
|
|
22
|
+
clock?: () => number;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=memoryClock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memoryClock.d.ts","sourceRoot":"","sources":["../../src/pi/memoryClock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAExE,KAAK,gBAAgB,GAAG;IAAE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjE,KAAK,YAAY,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,KAAK,YAAY,GAAG,gBAAgB,GAAG;IAAE,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,MAAM,CAAA;KAAE,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,mBAAmB,CAAC,CAAA;CAAE,CAAC;AAE9J,8FAA8F;AAC9F,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK;;;;;;cAAkB,EAAE,UAAU,GAAE,YAAoB,uBAEzH;AAED,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAChC,KAAK,GAAE,SAAS,GAAG,SAA2B,EAC9C,UAAU,GAAE,gBAA4C,GACvD;IAAE,KAAK,CAAC,EAAE,MAAM,MAAM,CAAA;CAAE,CAQ1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as mneme from "@noopolis/mneme";
|
|
2
|
+
import { readTaskClock } from "../runtime/taskClock.js";
|
|
3
|
+
/** Keep construction and capability detection together while the published types catch up. */
|
|
4
|
+
export function createClockedMemoryRuntime(config, clock = readTaskClock(), moduleRoot = mneme) {
|
|
5
|
+
return moduleRoot.createMemoryRuntime({ ...config, ...memoryClockOptions(clock, moduleRoot) });
|
|
6
|
+
}
|
|
7
|
+
/** The root export is Mneme's capability signal, including across older published versions. */
|
|
8
|
+
export function memoryClockOptions(clock = readTaskClock(), moduleRoot = mneme) {
|
|
9
|
+
if (clock === undefined)
|
|
10
|
+
return {};
|
|
11
|
+
if (typeof moduleRoot.createOffsetClock !== "function") {
|
|
12
|
+
throw new Error("NOOPOLIS_TASK_CLOCK requires @noopolis/mneme with the root createOffsetClock export and createMemoryRuntime({ clock }) support");
|
|
13
|
+
}
|
|
14
|
+
const memoryClock = moduleRoot.createOffsetClock({ origin: clock.origin, anchorMs: clock.anchorEpochMs });
|
|
15
|
+
if (typeof memoryClock !== "function")
|
|
16
|
+
throw new Error("@noopolis/mneme createOffsetClock must return an epoch-ms clock function");
|
|
17
|
+
return { clock: memoryClock };
|
|
18
|
+
}
|
|
@@ -6,7 +6,7 @@ import { persistPiTurnTrace, type PiTurnTraceModel } from "./turnTrace.js";
|
|
|
6
6
|
import { type PiRawTrainingCaptureOptions, type PiRawTrainingCaptureRef } from "./rawTrainingCapture.js";
|
|
7
7
|
import { type PiWorldToolContextRef } from "./worldNudge.js";
|
|
8
8
|
import { type PiWorldTrajectoryIdentity } from "./worldTrajectory.js";
|
|
9
|
-
import {
|
|
9
|
+
import type { PiNativeSessionCreator, PiSession, PiSessionCreator, PiSessionLike, PiWakeEnvironmentContextRef } from "./piAgentWakeSupport.js";
|
|
10
10
|
import { type MemoryRuntime } from "@noopolis/mneme";
|
|
11
11
|
export type { PiSession, PiSessionLike, PiSessionCreator, PiNativeSessionCreator } from "./piAgentWakeSupport.js";
|
|
12
12
|
export type WakeAcceptanceInput = {
|
|
@@ -14,6 +14,7 @@ export type WakeAcceptanceInput = {
|
|
|
14
14
|
completeTurn?: typeof stampTurnOutputCompleted;
|
|
15
15
|
traceTurn?: typeof persistPiTurnTrace;
|
|
16
16
|
createWakeAcceptance?: (runtimeHomePath: string, agentId: string) => WakeAcceptanceStoreLike;
|
|
17
|
+
causalRunId?: string;
|
|
17
18
|
};
|
|
18
19
|
export declare class PiAgentHandle implements AgentHandle {
|
|
19
20
|
readonly id: string;
|
|
@@ -28,6 +29,7 @@ export declare class PiAgentHandle implements AgentHandle {
|
|
|
28
29
|
private readonly rawTrainingCaptureOptions?;
|
|
29
30
|
private readonly worldTrajectoryIdentity?;
|
|
30
31
|
private readonly piSessionForRawCapture?;
|
|
32
|
+
private readonly wakeEnvironmentContext?;
|
|
31
33
|
private state;
|
|
32
34
|
private lastWakeAt;
|
|
33
35
|
private lastError;
|
|
@@ -35,8 +37,9 @@ export declare class PiAgentHandle implements AgentHandle {
|
|
|
35
37
|
private readonly stampTurnInputSubmitted;
|
|
36
38
|
private readonly stampTurnOutputCompleted;
|
|
37
39
|
private readonly persistTrace;
|
|
38
|
-
|
|
39
|
-
constructor(id: string, session:
|
|
40
|
+
private readonly causalRunId?;
|
|
41
|
+
constructor(id: string, session: PiSession, createSession: PiNativeSessionCreator, runtimeHomePath: string, traceModel: PiTurnTraceModel, memory?: MemoryRuntime, memoryToolContext?: PiMemoryToolContextRef, dependencies?: WakeAcceptanceInput, worldToolContext?: PiWorldToolContextRef, rawTrainingCaptureRef?: PiRawTrainingCaptureRef, rawTrainingCaptureOptions?: PiRawTrainingCaptureOptions, worldTrajectoryIdentity?: PiWorldTrajectoryIdentity, rawTrainingCaptureSession?: PiSession, wakeEnvironmentContext?: PiWakeEnvironmentContextRef);
|
|
42
|
+
constructor(id: string, session: PiSessionLike, createSession: PiSessionCreator, runtimeHomePath: string, traceModel: PiTurnTraceModel, memory?: MemoryRuntime, memoryToolContext?: PiMemoryToolContextRef, dependencies?: WakeAcceptanceInput, worldToolContext?: PiWorldToolContextRef, rawTrainingCaptureRef?: never, rawTrainingCaptureOptions?: never, worldTrajectoryIdentity?: PiWorldTrajectoryIdentity, rawTrainingCaptureSession?: never, wakeEnvironmentContext?: PiWakeEnvironmentContextRef);
|
|
40
43
|
wake(event: WakeEvent): Promise<WakeResult>;
|
|
41
44
|
private runWake;
|
|
42
45
|
status(): AgentStatus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piAgentHandle.d.ts","sourceRoot":"","sources":["../../src/pi/piAgentHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"piAgentHandle.d.ts","sourceRoot":"","sources":["../../src/pi/piAgentHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAoC,KAAK,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAEjG,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EAGzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAkC,KAAK,gBAAgB,EAA6B,MAAM,gBAAgB,CAAC;AAEtI,OAAO,EAAyD,KAAK,2BAA2B,EAAE,KAAK,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AAC,EAAE,KAAK,EACjC,sBAAsB,CAAC,EAAE,2BAA2B;IAyBhD,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;YAInC,OAAO;IAiSrB,MAAM,IAAI,WAAW;IAQf,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAM5B"}
|
package/dist/pi/piAgentHandle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createTrustedPiMemoryToolContext } from "./memoryTools.js";
|
|
2
|
-
import { formatWakePrompt } from "./prompts.js";
|
|
2
|
+
import { formatWakePrompt, preserveModelFacingWakeIdentity } from "./prompts.js";
|
|
3
3
|
import { stampTurnInputSubmitted, stampTurnOutputCompleted } from "./turnCausal.js";
|
|
4
4
|
import { WakeAcceptanceStore } from "./wakeAcceptance.js";
|
|
5
5
|
import { persistPiTurnTrace } from "./turnTrace.js";
|
|
@@ -7,7 +7,7 @@ import { formatDreamPrompt } from "./wakeModes.js";
|
|
|
7
7
|
import { createPiRawTrainingCapture } from "./rawTrainingCapture.js";
|
|
8
8
|
import { formatWorldWakePrompt, worldWakeContext } from "./worldNudge.js";
|
|
9
9
|
import { createPiWorldTrajectoryCapture } from "./worldTrajectory.js";
|
|
10
|
-
import { cloneWakeEvent, persistPiTurnArtifacts, PiWakeDeliveryQueue, selectPiSessionForWake, subscribeToPiTurnEvents } from "./piAgentWakeSupport.js";
|
|
10
|
+
import { cloneWakeEvent, disposePiSession, persistPiTurnArtifacts, PiWakeDeliveryQueue, selectPiSessionForWake, subscribeToPiTurnEvents } from "./piAgentWakeSupport.js";
|
|
11
11
|
import { readMemoryContext } from "@noopolis/mneme";
|
|
12
12
|
export class PiAgentHandle {
|
|
13
13
|
id;
|
|
@@ -22,6 +22,7 @@ export class PiAgentHandle {
|
|
|
22
22
|
rawTrainingCaptureOptions;
|
|
23
23
|
worldTrajectoryIdentity;
|
|
24
24
|
piSessionForRawCapture;
|
|
25
|
+
wakeEnvironmentContext;
|
|
25
26
|
state = "idle";
|
|
26
27
|
lastWakeAt;
|
|
27
28
|
lastError;
|
|
@@ -29,7 +30,8 @@ export class PiAgentHandle {
|
|
|
29
30
|
stampTurnInputSubmitted;
|
|
30
31
|
stampTurnOutputCompleted;
|
|
31
32
|
persistTrace;
|
|
32
|
-
|
|
33
|
+
causalRunId;
|
|
34
|
+
constructor(id, session, createSession, runtimeHomePath, traceModel, memory, memoryToolContext, dependencies = {}, worldToolContext, rawTrainingCaptureRef, rawTrainingCaptureOptions, worldTrajectoryIdentity, piSessionForRawCapture, wakeEnvironmentContext) {
|
|
33
35
|
this.id = id;
|
|
34
36
|
this.session = session;
|
|
35
37
|
this.createSession = createSession;
|
|
@@ -42,11 +44,12 @@ export class PiAgentHandle {
|
|
|
42
44
|
this.rawTrainingCaptureOptions = rawTrainingCaptureOptions;
|
|
43
45
|
this.worldTrajectoryIdentity = worldTrajectoryIdentity;
|
|
44
46
|
this.piSessionForRawCapture = piSessionForRawCapture;
|
|
47
|
+
this.wakeEnvironmentContext = wakeEnvironmentContext;
|
|
45
48
|
this.stampTurnInputSubmitted = dependencies.runWake ?? stampTurnInputSubmitted;
|
|
46
49
|
this.stampTurnOutputCompleted = dependencies.completeTurn ?? stampTurnOutputCompleted;
|
|
47
50
|
this.persistTrace = dependencies.traceTurn ?? persistPiTurnTrace;
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
this.causalRunId = dependencies.causalRunId;
|
|
52
|
+
const wakeAcceptance = dependencies.createWakeAcceptance?.(runtimeHomePath, id) ?? new WakeAcceptanceStore(runtimeHomePath, id, undefined, this.causalRunId);
|
|
50
53
|
this.wakeDeliveryQueue = new PiWakeDeliveryQueue(id, wakeAcceptance);
|
|
51
54
|
}
|
|
52
55
|
async wake(event) {
|
|
@@ -88,7 +91,7 @@ export class PiAgentHandle {
|
|
|
88
91
|
? undefined
|
|
89
92
|
: createPiWorldTrajectoryCapture();
|
|
90
93
|
const request = {
|
|
91
|
-
eventId: event.id
|
|
94
|
+
eventId: /^(simfile|moltnet|mneme|daimon):.+$/u.test(event.id) ? event.id : `daimon:${event.id}`,
|
|
92
95
|
kind: event.kind,
|
|
93
96
|
text: safeWakeText,
|
|
94
97
|
from: event.from,
|
|
@@ -98,6 +101,10 @@ export class PiAgentHandle {
|
|
|
98
101
|
? formatWakePrompt(event)
|
|
99
102
|
: safeWakeText;
|
|
100
103
|
try {
|
|
104
|
+
if (this.wakeEnvironmentContext !== undefined) {
|
|
105
|
+
this.wakeEnvironmentContext.current = event.id;
|
|
106
|
+
this.wakeEnvironmentContext.spokeFor = undefined;
|
|
107
|
+
}
|
|
101
108
|
if (this.worldToolContext !== undefined) {
|
|
102
109
|
this.worldToolContext.current = worldContext;
|
|
103
110
|
}
|
|
@@ -139,7 +146,7 @@ export class PiAgentHandle {
|
|
|
139
146
|
prepared,
|
|
140
147
|
status: "completed"
|
|
141
148
|
};
|
|
142
|
-
promptText = prepared.promptText;
|
|
149
|
+
promptText = preserveModelFacingWakeIdentity(prepared.promptText, event, request.eventId);
|
|
143
150
|
if (this.memoryToolContext !== undefined) {
|
|
144
151
|
this.memoryToolContext.observeTool = (toolEvent) => tools.push(toolEvent);
|
|
145
152
|
this.memoryToolContext.current = createTrustedPiMemoryToolContext({
|
|
@@ -157,6 +164,7 @@ export class PiAgentHandle {
|
|
|
157
164
|
}
|
|
158
165
|
stage = "causal_input";
|
|
159
166
|
const turnInput = await this.stampTurnInputSubmitted({
|
|
167
|
+
runId: this.causalRunId,
|
|
160
168
|
agentId: this.id,
|
|
161
169
|
event,
|
|
162
170
|
prepared,
|
|
@@ -169,18 +177,24 @@ export class PiAgentHandle {
|
|
|
169
177
|
}
|
|
170
178
|
stage = "engine_prompt";
|
|
171
179
|
const engineStartedAt = Date.now();
|
|
180
|
+
selectedSession.session.bindWake?.(event);
|
|
172
181
|
await selectedSession.session.prompt(promptText, { expandPromptTemplates: false });
|
|
173
182
|
enginePromptMs = Date.now() - engineStartedAt;
|
|
174
183
|
this.state = "idle";
|
|
175
184
|
const outputText = chunks.join("\n").trim();
|
|
176
185
|
stage = "causal_output";
|
|
177
186
|
await this.stampTurnOutputCompleted({
|
|
187
|
+
runId: this.causalRunId,
|
|
178
188
|
agentId: this.id,
|
|
179
189
|
causeEventId: turnInput.event_id,
|
|
180
190
|
outputText,
|
|
181
191
|
runtimeHomePath: this.runtimeHomePath,
|
|
182
192
|
turnId: event.id
|
|
183
193
|
});
|
|
194
|
+
if (this.memory !== undefined && prepared !== undefined) {
|
|
195
|
+
await this.memory.recordTurn({ principal: prepared.principal, prompt: prepared.packet, request, recall: prepared.recall, result: "completed", outputText, toolEvents: tools })
|
|
196
|
+
.catch((recordError) => { this.lastError = `memory record failed: ${recordError instanceof Error ? recordError.message : String(recordError)}`; });
|
|
197
|
+
}
|
|
184
198
|
await this.persistTrace({
|
|
185
199
|
agentId: this.id,
|
|
186
200
|
enginePromptMs,
|
|
@@ -203,9 +217,6 @@ export class PiAgentHandle {
|
|
|
203
217
|
if (rawTrainingCapture !== undefined
|
|
204
218
|
&& this.rawTrainingCaptureOptions !== undefined
|
|
205
219
|
&& this.piSessionForRawCapture !== undefined) {
|
|
206
|
-
// Do not retry a partially failed private capture in the catch path.
|
|
207
|
-
// The first failure is authoritative and retrying the same immutable
|
|
208
|
-
// turn path would only mask it with an EEXIST/partial-write error.
|
|
209
220
|
rawTrainingCapturePersistAttempted = true;
|
|
210
221
|
}
|
|
211
222
|
await persistPiTurnArtifacts({
|
|
@@ -225,9 +236,18 @@ export class PiAgentHandle {
|
|
|
225
236
|
worldTrajectory,
|
|
226
237
|
worldTrajectoryIdentity: this.worldTrajectoryIdentity
|
|
227
238
|
});
|
|
239
|
+
// An agent with a mounted `moltnet_send` tool has exactly one
|
|
240
|
+
// legitimate publication channel; its terminal text is always a
|
|
241
|
+
// private note to the runtime — whether it spoke, stayed silent, or
|
|
242
|
+
// narrated a failure back as its reply — never the bridge's
|
|
243
|
+
// terminal-text fallback (moltnet/internal/bridge/daimon/
|
|
244
|
+
// receipt_tracker.go), which is reserved for agents with no send tool
|
|
245
|
+
// at all. `outputText` itself stays intact for the turn trace and
|
|
246
|
+
// memory record above.
|
|
247
|
+
const hasSendCapability = this.wakeEnvironmentContext?.hasSendCapability === true;
|
|
228
248
|
return {
|
|
229
249
|
agentId: this.id,
|
|
230
|
-
text: outputText,
|
|
250
|
+
text: hasSendCapability ? "" : outputText,
|
|
231
251
|
durationMs: Date.now() - startedAtMs
|
|
232
252
|
};
|
|
233
253
|
}
|
|
@@ -264,6 +284,9 @@ export class PiAgentHandle {
|
|
|
264
284
|
? {}
|
|
265
285
|
: { worldContextBound: worldContext !== undefined })
|
|
266
286
|
}).catch(() => undefined);
|
|
287
|
+
if (this.memory !== undefined && prepared !== undefined) {
|
|
288
|
+
await this.memory.recordTurn({ principal: prepared.principal, prompt: prepared.packet, request, recall: prepared.recall, result: "failed", error: message, outputText: chunks.join("\n").trim(), toolEvents: tools }).catch(() => undefined);
|
|
289
|
+
}
|
|
267
290
|
const persistRawCapture = !rawTrainingCapturePersistAttempted
|
|
268
291
|
&& selectedSession !== undefined;
|
|
269
292
|
if (persistRawCapture && rawTrainingCapture !== undefined) {
|
|
@@ -293,6 +316,11 @@ export class PiAgentHandle {
|
|
|
293
316
|
throw error;
|
|
294
317
|
}
|
|
295
318
|
finally {
|
|
319
|
+
selectedSession?.session.bindWake?.();
|
|
320
|
+
if (this.wakeEnvironmentContext !== undefined) {
|
|
321
|
+
this.wakeEnvironmentContext.current = undefined;
|
|
322
|
+
this.wakeEnvironmentContext.spokeFor = undefined;
|
|
323
|
+
}
|
|
296
324
|
if (this.memoryToolContext !== undefined) {
|
|
297
325
|
this.memoryToolContext.current = undefined;
|
|
298
326
|
this.memoryToolContext.observeTool = undefined;
|
|
@@ -318,7 +346,9 @@ export class PiAgentHandle {
|
|
|
318
346
|
};
|
|
319
347
|
}
|
|
320
348
|
async stop() {
|
|
321
|
-
|
|
349
|
+
// CLI-backed sessions may own a process group, while native Pi remains
|
|
350
|
+
// source-compatible through the synchronous dispose() hook.
|
|
351
|
+
await disposePiSession(this.session);
|
|
322
352
|
this.state = "stopped";
|
|
323
353
|
}
|
|
324
354
|
}
|
|
@@ -10,8 +10,43 @@ export type PiSession = Awaited<ReturnType<typeof createAgentSession>>["session"
|
|
|
10
10
|
export interface PiSessionLike {
|
|
11
11
|
subscribe(listener: Parameters<PiSession["subscribe"]>[0]): () => void;
|
|
12
12
|
prompt(text: string, options?: Parameters<PiSession["prompt"]>[1]): Promise<void>;
|
|
13
|
+
/** Optional per-turn context for isolated CLI child environments. */
|
|
14
|
+
bindWake?(event?: WakeEvent): void;
|
|
15
|
+
/** Kept synchronous for existing Pi session implementations. */
|
|
13
16
|
dispose(): void;
|
|
17
|
+
/** Optional additive hook for sessions that must asynchronously quiesce children. */
|
|
18
|
+
disposeAsync?(): Promise<void>;
|
|
14
19
|
}
|
|
20
|
+
export type PiWakeEnvironmentContextRef = {
|
|
21
|
+
current?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Set to the delivery id of the current wake once `moltnet_send` has been
|
|
24
|
+
* accepted during it. Bookkeeping only: it no longer gates whether the wake
|
|
25
|
+
* completion path publishes terminal text (see `hasSendCapability`), but it
|
|
26
|
+
* still records, per wake, whether this agent actually spoke. Never a
|
|
27
|
+
* boolean: a boolean could survive a stale reset and silently misattribute
|
|
28
|
+
* a later wake.
|
|
29
|
+
*/
|
|
30
|
+
spokeFor?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Set once per agent, at harness construction, to whether a `moltnet_send`
|
|
33
|
+
* tool is mounted for it (`piHarness.ts`, from `productionTools`) — never
|
|
34
|
+
* reset per wake, unlike `current`/`spokeFor`.
|
|
35
|
+
*
|
|
36
|
+
* A turn that fails partway (a tool error the model narrates back as
|
|
37
|
+
* terminal text, e.g. "Blocked: Moltnet auth is not mounted...") still
|
|
38
|
+
* completes structurally and used to publish that narration through the
|
|
39
|
+
* terminal-text fallback even though `moltnet_send` was never actually
|
|
40
|
+
* called — a second, unintended echo into the room. An agent with a
|
|
41
|
+
* mounted send tool has exactly one legitimate publication channel
|
|
42
|
+
* (`moltnet_send`); its terminal text is always a private note to the
|
|
43
|
+
* runtime, whether it spoke, stayed silent, or failed. Only an agent with
|
|
44
|
+
* no send tool at all keeps the documented terminal-text fallback
|
|
45
|
+
* (`moltnet/internal/bridge/daimon/AGENTS.md`).
|
|
46
|
+
*/
|
|
47
|
+
hasSendCapability?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare function disposePiSession(session: PiSessionLike): Promise<void>;
|
|
15
50
|
export type PiSessionCreator = (mode: MemoryWakeMode, sessionDirectory: string) => Promise<PiSessionLike>;
|
|
16
51
|
export type PiNativeSessionCreator = (mode: MemoryWakeMode, sessionDirectory: string) => Promise<PiSession>;
|
|
17
52
|
export interface WakeSessionSelection {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piAgentWakeSupport.d.ts","sourceRoot":"","sources":["../../src/pi/piAgentWakeSupport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,S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CAAC;IACnB,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;IAC1C,yBAAyB,CAAC,EAAE,2BAA2B,CAAC;IACxD,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,MAAM,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C,uBAAuB,CAAC,EAAE,yBAAyB,CAAC;CACrD,KAAG,OAAO,CAAC,IAAI,CAqCf,CAAC"}
|
|
@@ -3,6 +3,10 @@ import { summarizeSessionEvent, } from "./turnTrace.js";
|
|
|
3
3
|
import { createAwakeThreadId, createDreamSessionDirectory, createDreamSessionKey, createDreamThreadId, } from "./wakeModes.js";
|
|
4
4
|
import { WakeAcceptanceError, } from "./wakeAcceptance.js";
|
|
5
5
|
import { capturePiWorldTrajectoryEvent, persistPiWorldTrajectory, } from "./worldTrajectory.js";
|
|
6
|
+
export async function disposePiSession(session) {
|
|
7
|
+
await Promise.resolve(session.dispose());
|
|
8
|
+
await session.disposeAsync?.();
|
|
9
|
+
}
|
|
6
10
|
export class PiWakeDeliveryQueue {
|
|
7
11
|
agentId;
|
|
8
12
|
acceptance;
|
package/dist/pi/piHarness.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { createAgentSession } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import {
|
|
1
|
+
import { createAgentSession, type ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { MemoryAuthorityConfig } from "@noopolis/mneme";
|
|
3
3
|
import type { AgentHandle, AgentHarnessAdapter, AgentStartInput, HarnessModelSpec } from "../core/types.js";
|
|
4
4
|
import { type PiSessionLike } from "./piAgentHandle.js";
|
|
5
|
+
import { type PiWakeEnvironmentContextRef } from "./piAgentWakeSupport.js";
|
|
5
6
|
import { type PiWorldBinding } from "./worldTools.js";
|
|
7
|
+
import { type TaskClockProcessProbe } from "./taskClockProcess.js";
|
|
6
8
|
import { type PiRawTrainingCaptureOptions } from "./rawTrainingCapture.js";
|
|
7
9
|
type HarnessMemoryEmbeddingProvider = {
|
|
8
10
|
dimensions?: number;
|
|
@@ -18,6 +20,8 @@ type PiHarnessBaseOptions = {
|
|
|
18
20
|
name: string;
|
|
19
21
|
};
|
|
20
22
|
modelsPath?: string;
|
|
23
|
+
/** Host-only names removed from every engine and Pi bash child environment. */
|
|
24
|
+
protectedEnvironmentNames?: readonly string[];
|
|
21
25
|
memory?: {
|
|
22
26
|
authority?: MemoryAuthorityConfig;
|
|
23
27
|
embeddingProvider?: HarnessMemoryEmbeddingProvider;
|
|
@@ -27,6 +31,10 @@ type PiHarnessBaseOptions = {
|
|
|
27
31
|
};
|
|
28
32
|
thinkingLevel?: PiThinkingLevel;
|
|
29
33
|
world?: PiWorldBinding;
|
|
34
|
+
productionTools?: readonly ToolDefinition[];
|
|
35
|
+
/** Engine-owned default; an empty list disables Pi builtins for confined CLI engines. */
|
|
36
|
+
toolNames?: readonly string[];
|
|
37
|
+
wakeEnvironmentContext?: PiWakeEnvironmentContextRef;
|
|
30
38
|
};
|
|
31
39
|
export type PiHarnessOptions = PiHarnessBaseOptions & ({
|
|
32
40
|
rawTrainingCapture?: PiRawTrainingCaptureOptions;
|
|
@@ -37,16 +45,23 @@ export type PiHarnessOptions = PiHarnessBaseOptions & ({
|
|
|
37
45
|
});
|
|
38
46
|
export type PiSessionFactoryInput = Exclude<Parameters<typeof createAgentSession>[0], undefined> & {
|
|
39
47
|
daimonSecretEnvironmentNames?: readonly string[];
|
|
48
|
+
/** The isolated runtime home assigned by Daimon to this one agent. */
|
|
49
|
+
runtimeHomePath?: string;
|
|
40
50
|
};
|
|
41
51
|
export type PiSessionFactory = (input: PiSessionFactoryInput) => Promise<{
|
|
42
52
|
session: PiSessionLike;
|
|
43
53
|
}>;
|
|
44
54
|
export declare class PiHarnessAdapter implements AgentHarnessAdapter {
|
|
45
55
|
private readonly options;
|
|
56
|
+
private readonly taskClockProbe?;
|
|
57
|
+
static readonly capabilities: Readonly<{
|
|
58
|
+
causalRunId: true;
|
|
59
|
+
memoryCausalRunId: false;
|
|
60
|
+
}>;
|
|
46
61
|
private readonly authStorage;
|
|
47
62
|
private readonly modelRegistry;
|
|
48
63
|
private readonly sessionFactory;
|
|
49
|
-
constructor(options: PiHarnessOptions);
|
|
64
|
+
constructor(options: PiHarnessOptions, /** @internal */ taskClockProbe?: TaskClockProcessProbe | undefined);
|
|
50
65
|
startAgent(input: AgentStartInput): Promise<AgentHandle>;
|
|
51
66
|
}
|
|
52
67
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"piHarness.d.ts","sourceRoot":"","sources":["../../src/pi/piHarness.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"piHarness.d.ts","sourceRoot":"","sources":["../../src/pi/piHarness.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,kBAAkB,EAIlB,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAuB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAElF,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAO5G,OAAO,EAAqE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC3H,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAM5F,OAAO,EAA0B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3F,OAAO,EAGL,KAAK,2BAA2B,EAEjC,MAAM,yBAAyB,CAAC;AAEjC,KAAK,8BAA8B,GAAG;IACpC,UAAU,CAAC,E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