@nookplot/runtime 0.5.123 → 0.5.124
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/dist/__tests__/apiMarketplace.test.d.ts +2 -0
- package/dist/__tests__/apiMarketplace.test.d.ts.map +1 -0
- package/dist/__tests__/apiMarketplace.test.js +102 -0
- package/dist/__tests__/apiMarketplace.test.js.map +1 -0
- package/dist/__tests__/autonomous.actionDispatch.test.d.ts +2 -0
- package/dist/__tests__/autonomous.actionDispatch.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.actionDispatch.test.js +287 -0
- package/dist/__tests__/autonomous.actionDispatch.test.js.map +1 -0
- package/dist/__tests__/autonomous.dedup.test.d.ts +2 -0
- package/dist/__tests__/autonomous.dedup.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.dedup.test.js +125 -0
- package/dist/__tests__/autonomous.dedup.test.js.map +1 -0
- package/dist/__tests__/autonomous.doomLoop.test.d.ts +2 -0
- package/dist/__tests__/autonomous.doomLoop.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.doomLoop.test.js +126 -0
- package/dist/__tests__/autonomous.doomLoop.test.js.map +1 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.d.ts +2 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.js +235 -0
- package/dist/__tests__/autonomous.getAvailableActions.test.js.map +1 -0
- package/dist/__tests__/autonomous.goalBootstrap.test.d.ts +2 -0
- package/dist/__tests__/autonomous.goalBootstrap.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.goalBootstrap.test.js +148 -0
- package/dist/__tests__/autonomous.goalBootstrap.test.js.map +1 -0
- package/dist/__tests__/autonomous.guardrails.test.d.ts +2 -0
- package/dist/__tests__/autonomous.guardrails.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.guardrails.test.js +215 -0
- package/dist/__tests__/autonomous.guardrails.test.js.map +1 -0
- package/dist/__tests__/autonomous.hooks.test.d.ts +2 -0
- package/dist/__tests__/autonomous.hooks.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.hooks.test.js +107 -0
- package/dist/__tests__/autonomous.hooks.test.js.map +1 -0
- package/dist/__tests__/autonomous.latentSpace.test.d.ts +2 -0
- package/dist/__tests__/autonomous.latentSpace.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.latentSpace.test.js +224 -0
- package/dist/__tests__/autonomous.latentSpace.test.js.map +1 -0
- package/dist/__tests__/autonomous.lifecycle.test.d.ts +2 -0
- package/dist/__tests__/autonomous.lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.lifecycle.test.js +147 -0
- package/dist/__tests__/autonomous.lifecycle.test.js.map +1 -0
- package/dist/__tests__/autonomous.loadedSkillRefs.test.d.ts +2 -0
- package/dist/__tests__/autonomous.loadedSkillRefs.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.loadedSkillRefs.test.js +150 -0
- package/dist/__tests__/autonomous.loadedSkillRefs.test.js.map +1 -0
- package/dist/__tests__/autonomous.miningTrack.test.d.ts +2 -0
- package/dist/__tests__/autonomous.miningTrack.test.d.ts.map +1 -0
- package/dist/__tests__/autonomous.miningTrack.test.js +38 -0
- package/dist/__tests__/autonomous.miningTrack.test.js.map +1 -0
- package/dist/__tests__/chatEngine.episodicHook.test.d.ts +2 -0
- package/dist/__tests__/chatEngine.episodicHook.test.d.ts.map +1 -0
- package/dist/__tests__/chatEngine.episodicHook.test.js +160 -0
- package/dist/__tests__/chatEngine.episodicHook.test.js.map +1 -0
- package/dist/__tests__/chatEngine.test.d.ts +2 -0
- package/dist/__tests__/chatEngine.test.d.ts.map +1 -0
- package/dist/__tests__/chatEngine.test.js +482 -0
- package/dist/__tests__/chatEngine.test.js.map +1 -0
- package/dist/__tests__/codegen-drift.test.d.ts +23 -0
- package/dist/__tests__/codegen-drift.test.d.ts.map +1 -0
- package/dist/__tests__/codegen-drift.test.js +187 -0
- package/dist/__tests__/codegen-drift.test.js.map +1 -0
- package/dist/__tests__/contentSafety.test.d.ts +2 -0
- package/dist/__tests__/contentSafety.test.d.ts.map +1 -0
- package/dist/__tests__/contentSafety.test.js +90 -0
- package/dist/__tests__/contentSafety.test.js.map +1 -0
- package/dist/__tests__/conversation/compactionMemory.test.d.ts +2 -0
- package/dist/__tests__/conversation/compactionMemory.test.d.ts.map +1 -0
- package/dist/__tests__/conversation/compactionMemory.test.js +447 -0
- package/dist/__tests__/conversation/compactionMemory.test.js.map +1 -0
- package/dist/__tests__/conversation/modelThresholdsParity.test.d.ts +2 -0
- package/dist/__tests__/conversation/modelThresholdsParity.test.d.ts.map +1 -0
- package/dist/__tests__/conversation/modelThresholdsParity.test.js +74 -0
- package/dist/__tests__/conversation/modelThresholdsParity.test.js.map +1 -0
- package/dist/__tests__/doomLoop.test.d.ts +6 -0
- package/dist/__tests__/doomLoop.test.d.ts.map +1 -0
- package/dist/__tests__/doomLoop.test.js +144 -0
- package/dist/__tests__/doomLoop.test.js.map +1 -0
- package/dist/__tests__/goalLoop.test.d.ts +2 -0
- package/dist/__tests__/goalLoop.test.d.ts.map +1 -0
- package/dist/__tests__/goalLoop.test.js +335 -0
- package/dist/__tests__/goalLoop.test.js.map +1 -0
- package/dist/__tests__/guardrails.test.d.ts +2 -0
- package/dist/__tests__/guardrails.test.d.ts.map +1 -0
- package/dist/__tests__/guardrails.test.js +236 -0
- package/dist/__tests__/guardrails.test.js.map +1 -0
- package/dist/__tests__/helpers/mockRuntime.d.ts +11 -0
- package/dist/__tests__/helpers/mockRuntime.d.ts.map +1 -0
- package/dist/__tests__/helpers/mockRuntime.js +153 -0
- package/dist/__tests__/helpers/mockRuntime.js.map +1 -0
- package/dist/__tests__/hooks.test.d.ts +9 -0
- package/dist/__tests__/hooks.test.d.ts.map +1 -0
- package/dist/__tests__/hooks.test.js +192 -0
- package/dist/__tests__/hooks.test.js.map +1 -0
- package/dist/__tests__/loadProfile.test.d.ts +8 -0
- package/dist/__tests__/loadProfile.test.d.ts.map +1 -0
- package/dist/__tests__/loadProfile.test.js +134 -0
- package/dist/__tests__/loadProfile.test.js.map +1 -0
- package/dist/__tests__/manifestActivationHook.test.d.ts +2 -0
- package/dist/__tests__/manifestActivationHook.test.d.ts.map +1 -0
- package/dist/__tests__/manifestActivationHook.test.js +312 -0
- package/dist/__tests__/manifestActivationHook.test.js.map +1 -0
- package/dist/__tests__/memory.test.d.ts +2 -0
- package/dist/__tests__/memory.test.d.ts.map +1 -0
- package/dist/__tests__/memory.test.js +192 -0
- package/dist/__tests__/memory.test.js.map +1 -0
- package/dist/__tests__/mining.test.d.ts +2 -0
- package/dist/__tests__/mining.test.d.ts.map +1 -0
- package/dist/__tests__/mining.test.js +306 -0
- package/dist/__tests__/mining.test.js.map +1 -0
- package/dist/__tests__/onChainActions.parity.test.d.ts +12 -0
- package/dist/__tests__/onChainActions.parity.test.d.ts.map +1 -0
- package/dist/__tests__/onChainActions.parity.test.js +104 -0
- package/dist/__tests__/onChainActions.parity.test.js.map +1 -0
- package/dist/__tests__/presetLoader.test.d.ts +2 -0
- package/dist/__tests__/presetLoader.test.d.ts.map +1 -0
- package/dist/__tests__/presetLoader.test.js +749 -0
- package/dist/__tests__/presetLoader.test.js.map +1 -0
- package/dist/__tests__/querySegmentation.test.d.ts +2 -0
- package/dist/__tests__/querySegmentation.test.d.ts.map +1 -0
- package/dist/__tests__/querySegmentation.test.js +187 -0
- package/dist/__tests__/querySegmentation.test.js.map +1 -0
- package/dist/__tests__/sandbox.test.d.ts +13 -0
- package/dist/__tests__/sandbox.test.d.ts.map +1 -0
- package/dist/__tests__/sandbox.test.js +413 -0
- package/dist/__tests__/sandbox.test.js.map +1 -0
- package/dist/__tests__/signing.test.d.ts +2 -0
- package/dist/__tests__/signing.test.d.ts.map +1 -0
- package/dist/__tests__/signing.test.js +260 -0
- package/dist/__tests__/signing.test.js.map +1 -0
- package/dist/__tests__/wakeUpStack.test.d.ts +2 -0
- package/dist/__tests__/wakeUpStack.test.d.ts.map +1 -0
- package/dist/__tests__/wakeUpStack.test.js +239 -0
- package/dist/__tests__/wakeUpStack.test.js.map +1 -0
- package/dist/actionCatalog.d.ts +57 -0
- package/dist/actionCatalog.d.ts.map +1 -0
- package/dist/actionCatalog.generated.d.ts +4 -0
- package/dist/actionCatalog.generated.d.ts.map +1 -0
- package/dist/actionCatalog.generated.js +2234 -0
- package/dist/actionCatalog.generated.js.map +1 -0
- package/dist/actionCatalog.js +210 -0
- package/dist/actionCatalog.js.map +1 -0
- package/dist/api-marketplace.d.ts +111 -0
- package/dist/api-marketplace.d.ts.map +1 -0
- package/dist/api-marketplace.js +154 -0
- package/dist/api-marketplace.js.map +1 -0
- package/dist/artifactEmbeddings.d.ts +69 -0
- package/dist/artifactEmbeddings.d.ts.map +1 -0
- package/dist/artifactEmbeddings.js +52 -0
- package/dist/artifactEmbeddings.js.map +1 -0
- package/dist/autonomous.d.ts +285 -0
- package/dist/autonomous.d.ts.map +1 -0
- package/dist/autonomous.js +3659 -0
- package/dist/autonomous.js.map +1 -0
- package/dist/bounties.d.ts +112 -0
- package/dist/bounties.d.ts.map +1 -0
- package/dist/bounties.js +140 -0
- package/dist/bounties.js.map +1 -0
- package/dist/bundles.d.ts +174 -0
- package/dist/bundles.d.ts.map +1 -0
- package/dist/bundles.js +208 -0
- package/dist/bundles.js.map +1 -0
- package/dist/channels.d.ts +131 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +227 -0
- package/dist/channels.js.map +1 -0
- package/dist/chat/chatEngine.d.ts +138 -0
- package/dist/chat/chatEngine.d.ts.map +1 -0
- package/dist/chat/chatEngine.js +605 -0
- package/dist/chat/chatEngine.js.map +1 -0
- package/dist/chat/index.d.ts +30 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +29 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/terminal.d.ts +19 -0
- package/dist/chat/terminal.d.ts.map +1 -0
- package/dist/chat/terminal.js +17 -0
- package/dist/chat/terminal.js.map +1 -0
- package/dist/chat/terminals/discordTerminal.d.ts +22 -0
- package/dist/chat/terminals/discordTerminal.d.ts.map +1 -0
- package/dist/chat/terminals/discordTerminal.js +132 -0
- package/dist/chat/terminals/discordTerminal.js.map +1 -0
- package/dist/chat/terminals/openclawTerminal.d.ts +43 -0
- package/dist/chat/terminals/openclawTerminal.d.ts.map +1 -0
- package/dist/chat/terminals/openclawTerminal.js +186 -0
- package/dist/chat/terminals/openclawTerminal.js.map +1 -0
- package/dist/chat/terminals/stdinTerminal.d.ts +18 -0
- package/dist/chat/terminals/stdinTerminal.d.ts.map +1 -0
- package/dist/chat/terminals/stdinTerminal.js +58 -0
- package/dist/chat/terminals/stdinTerminal.js.map +1 -0
- package/dist/chat/terminals/telegramTerminal.d.ts +27 -0
- package/dist/chat/terminals/telegramTerminal.d.ts.map +1 -0
- package/dist/chat/terminals/telegramTerminal.js +123 -0
- package/dist/chat/terminals/telegramTerminal.js.map +1 -0
- package/dist/cognitiveWorkspace.d.ts +107 -0
- package/dist/cognitiveWorkspace.d.ts.map +1 -0
- package/dist/cognitiveWorkspace.js +94 -0
- package/dist/cognitiveWorkspace.js.map +1 -0
- package/dist/communities.d.ts +40 -0
- package/dist/communities.d.ts.map +1 -0
- package/dist/communities.js +53 -0
- package/dist/communities.js.map +1 -0
- package/dist/connection.d.ts +90 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +428 -0
- package/dist/connection.js.map +1 -0
- package/dist/contentSafety.d.ts +64 -0
- package/dist/contentSafety.d.ts.map +1 -0
- package/dist/contentSafety.js +123 -0
- package/dist/contentSafety.js.map +1 -0
- package/dist/conversation/compactionMemory.d.ts +124 -0
- package/dist/conversation/compactionMemory.d.ts.map +1 -0
- package/dist/conversation/compactionMemory.js +379 -0
- package/dist/conversation/compactionMemory.js.map +1 -0
- package/dist/conversation/conversationLogStore.d.ts +111 -0
- package/dist/conversation/conversationLogStore.d.ts.map +1 -0
- package/dist/conversation/conversationLogStore.js +248 -0
- package/dist/conversation/conversationLogStore.js.map +1 -0
- package/dist/conversation/conversationMemory.d.ts +59 -0
- package/dist/conversation/conversationMemory.d.ts.map +1 -0
- package/dist/conversation/conversationMemory.js +32 -0
- package/dist/conversation/conversationMemory.js.map +1 -0
- package/dist/conversation/index.d.ts +16 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +5 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/modelLimits.d.ts +43 -0
- package/dist/conversation/modelLimits.d.ts.map +1 -0
- package/dist/conversation/modelLimits.js +67 -0
- package/dist/conversation/modelLimits.js.map +1 -0
- package/dist/cro.d.ts +243 -0
- package/dist/cro.d.ts.map +1 -0
- package/dist/cro.js +263 -0
- package/dist/cro.js.map +1 -0
- package/dist/defaultGuardrails.d.ts +21 -0
- package/dist/defaultGuardrails.d.ts.map +1 -0
- package/dist/defaultGuardrails.js +90 -0
- package/dist/defaultGuardrails.js.map +1 -0
- package/dist/delegations.d.ts +63 -0
- package/dist/delegations.d.ts.map +1 -0
- package/dist/delegations.js +41 -0
- package/dist/delegations.js.map +1 -0
- package/dist/discovery.d.ts +172 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +300 -0
- package/dist/discovery.js.map +1 -0
- package/dist/doomLoop.d.ts +52 -0
- package/dist/doomLoop.d.ts.map +1 -0
- package/dist/doomLoop.js +173 -0
- package/dist/doomLoop.js.map +1 -0
- package/dist/economy.d.ts +244 -0
- package/dist/economy.d.ts.map +1 -0
- package/dist/economy.js +263 -0
- package/dist/economy.js.map +1 -0
- package/dist/email.d.ts +125 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +91 -0
- package/dist/email.js.map +1 -0
- package/dist/embeddingExchange.d.ts +141 -0
- package/dist/embeddingExchange.d.ts.map +1 -0
- package/dist/embeddingExchange.js +95 -0
- package/dist/embeddingExchange.js.map +1 -0
- package/dist/episodicMemoryHook.d.ts +39 -0
- package/dist/episodicMemoryHook.d.ts.map +1 -0
- package/dist/episodicMemoryHook.js +58 -0
- package/dist/episodicMemoryHook.js.map +1 -0
- package/dist/evaluator.d.ts +113 -0
- package/dist/evaluator.d.ts.map +1 -0
- package/dist/evaluator.js +144 -0
- package/dist/evaluator.js.map +1 -0
- package/dist/events.d.ts +58 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +86 -0
- package/dist/events.js.map +1 -0
- package/dist/formatters.d.ts +31 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/formatters.js +227 -0
- package/dist/formatters.js.map +1 -0
- package/dist/goal/goalLoop.d.ts +78 -0
- package/dist/goal/goalLoop.d.ts.map +1 -0
- package/dist/goal/goalLoop.js +376 -0
- package/dist/goal/goalLoop.js.map +1 -0
- package/dist/goal/goalPrompts.d.ts +20 -0
- package/dist/goal/goalPrompts.d.ts.map +1 -0
- package/dist/goal/goalPrompts.js +54 -0
- package/dist/goal/goalPrompts.js.map +1 -0
- package/dist/goal/types.d.ts +98 -0
- package/dist/goal/types.d.ts.map +1 -0
- package/dist/goal/types.js +7 -0
- package/dist/goal/types.js.map +1 -0
- package/dist/gpu.d.ts +137 -0
- package/dist/gpu.d.ts.map +1 -0
- package/dist/gpu.js +166 -0
- package/dist/gpu.js.map +1 -0
- package/dist/guardrails.d.ts +182 -0
- package/dist/guardrails.d.ts.map +1 -0
- package/dist/guardrails.js +277 -0
- package/dist/guardrails.js.map +1 -0
- package/dist/guilds.d.ts +158 -0
- package/dist/guilds.d.ts.map +1 -0
- package/dist/guilds.js +205 -0
- package/dist/guilds.js.map +1 -0
- package/dist/heartbeat.d.ts +43 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +72 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/hooks.d.ts +172 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +91 -0
- package/dist/hooks.js.map +1 -0
- package/dist/identity.d.ts +112 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +126 -0
- package/dist/identity.js.map +1 -0
- package/dist/inbox.d.ts +77 -0
- package/dist/inbox.d.ts.map +1 -0
- package/dist/inbox.js +98 -0
- package/dist/inbox.js.map +1 -0
- package/dist/index.d.ts +329 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +366 -0
- package/dist/index.js.map +1 -0
- package/dist/insights.d.ts +166 -0
- package/dist/insights.d.ts.map +1 -0
- package/dist/insights.js +100 -0
- package/dist/insights.js.map +1 -0
- package/dist/intents.d.ts +132 -0
- package/dist/intents.d.ts.map +1 -0
- package/dist/intents.js +81 -0
- package/dist/intents.js.map +1 -0
- package/dist/knowledgeContext.d.ts +68 -0
- package/dist/knowledgeContext.d.ts.map +1 -0
- package/dist/knowledgeContext.js +109 -0
- package/dist/knowledgeContext.js.map +1 -0
- package/dist/leaderboard.d.ts +30 -0
- package/dist/leaderboard.d.ts.map +1 -0
- package/dist/leaderboard.js +34 -0
- package/dist/leaderboard.js.map +1 -0
- package/dist/loadProfile.d.ts +100 -0
- package/dist/loadProfile.d.ts.map +1 -0
- package/dist/loadProfile.js +221 -0
- package/dist/loadProfile.js.map +1 -0
- package/dist/manifest.d.ts +127 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +123 -0
- package/dist/manifest.js.map +1 -0
- package/dist/manifestActivationHook.d.ts +72 -0
- package/dist/manifestActivationHook.d.ts.map +1 -0
- package/dist/manifestActivationHook.js +180 -0
- package/dist/manifestActivationHook.js.map +1 -0
- package/dist/marketplace.d.ts +156 -0
- package/dist/marketplace.d.ts.map +1 -0
- package/dist/marketplace.js +215 -0
- package/dist/marketplace.js.map +1 -0
- package/dist/matching.d.ts +192 -0
- package/dist/matching.d.ts.map +1 -0
- package/dist/matching.js +138 -0
- package/dist/matching.js.map +1 -0
- package/dist/memory.d.ts +287 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +379 -0
- package/dist/memory.js.map +1 -0
- package/dist/mining.d.ts +155 -0
- package/dist/mining.d.ts.map +1 -0
- package/dist/mining.js +365 -0
- package/dist/mining.js.map +1 -0
- package/dist/oracle.d.ts +30 -0
- package/dist/oracle.d.ts.map +1 -0
- package/dist/oracle.js +31 -0
- package/dist/oracle.js.map +1 -0
- package/dist/policies.d.ts +132 -0
- package/dist/policies.d.ts.map +1 -0
- package/dist/policies.js +62 -0
- package/dist/policies.js.map +1 -0
- package/dist/presetLoader.d.ts +130 -0
- package/dist/presetLoader.d.ts.map +1 -0
- package/dist/presetLoader.js +734 -0
- package/dist/presetLoader.js.map +1 -0
- package/dist/proactive.d.ts +197 -0
- package/dist/proactive.d.ts.map +1 -0
- package/dist/proactive.js +229 -0
- package/dist/proactive.js.map +1 -0
- package/dist/projects.d.ts +307 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +438 -0
- package/dist/projects.js.map +1 -0
- package/dist/querySegmentation.d.ts +54 -0
- package/dist/querySegmentation.d.ts.map +1 -0
- package/dist/querySegmentation.js +80 -0
- package/dist/querySegmentation.js.map +1 -0
- package/dist/sandbox.d.ts +156 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +425 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/signalActionMap.d.ts +59 -0
- package/dist/signalActionMap.d.ts.map +1 -0
- package/dist/signalActionMap.js +302 -0
- package/dist/signalActionMap.js.map +1 -0
- package/dist/signing.d.ts +94 -0
- package/dist/signing.d.ts.map +1 -0
- package/dist/signing.js +158 -0
- package/dist/signing.js.map +1 -0
- package/dist/social.d.ts +176 -0
- package/dist/social.d.ts.map +1 -0
- package/dist/social.js +232 -0
- package/dist/social.js.map +1 -0
- package/dist/specialization.d.ts +108 -0
- package/dist/specialization.d.ts.map +1 -0
- package/dist/specialization.js +104 -0
- package/dist/specialization.js.map +1 -0
- package/dist/swarms.d.ts +119 -0
- package/dist/swarms.d.ts.map +1 -0
- package/dist/swarms.js +103 -0
- package/dist/swarms.js.map +1 -0
- package/dist/teaching.d.ts +171 -0
- package/dist/teaching.d.ts.map +1 -0
- package/dist/teaching.js +87 -0
- package/dist/teaching.js.map +1 -0
- package/dist/tools.d.ts +223 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +325 -0
- package/dist/tools.js.map +1 -0
- package/dist/treasury-ops.d.ts +101 -0
- package/dist/treasury-ops.d.ts.map +1 -0
- package/dist/treasury-ops.js +59 -0
- package/dist/treasury-ops.js.map +1 -0
- package/dist/types.d.ts +1193 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/wakeUpStack.d.ts +94 -0
- package/dist/wakeUpStack.d.ts.map +1 -0
- package/dist/wakeUpStack.js +215 -0
- package/dist/wakeUpStack.js.map +1 -0
- package/dist/workspace.d.ts +318 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +207 -0
- package/dist/workspace.js.map +1 -0
- package/dist/xmtp.d.ts +85 -0
- package/dist/xmtp.d.ts.map +1 -0
- package/dist/xmtp.js +250 -0
- package/dist/xmtp.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heartbeat manager for the Nookplot Agent Runtime SDK.
|
|
3
|
+
*
|
|
4
|
+
* Monitors the connection state and provides convenience methods
|
|
5
|
+
* for tracking connection health. The actual heartbeat sending
|
|
6
|
+
* is handled by ConnectionManager — this module provides
|
|
7
|
+
* higher-level health monitoring.
|
|
8
|
+
*
|
|
9
|
+
* @module heartbeat
|
|
10
|
+
*/
|
|
11
|
+
import type { ConnectionManager } from "./connection.js";
|
|
12
|
+
import type { ConnectionState } from "./types.js";
|
|
13
|
+
export declare class HeartbeatManager {
|
|
14
|
+
private readonly connection;
|
|
15
|
+
private onHealthChange;
|
|
16
|
+
private lastHealthy;
|
|
17
|
+
constructor(connection: ConnectionManager);
|
|
18
|
+
/**
|
|
19
|
+
* Whether the connection is currently healthy (connected).
|
|
20
|
+
*/
|
|
21
|
+
get isHealthy(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Current connection state.
|
|
24
|
+
*/
|
|
25
|
+
get state(): ConnectionState;
|
|
26
|
+
/**
|
|
27
|
+
* The current session ID (null if not connected).
|
|
28
|
+
*/
|
|
29
|
+
get sessionId(): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Register a callback for health state changes.
|
|
32
|
+
*
|
|
33
|
+
* @param callback - Called with `true` when connection becomes healthy,
|
|
34
|
+
* `false` when it becomes unhealthy.
|
|
35
|
+
*/
|
|
36
|
+
onHealthChanged(callback: (healthy: boolean) => void): void;
|
|
37
|
+
/**
|
|
38
|
+
* Send a manual heartbeat via HTTP (backup for WebSocket heartbeat).
|
|
39
|
+
* Useful if the WebSocket is temporarily down but HTTP still works.
|
|
40
|
+
*/
|
|
41
|
+
manualHeartbeat(): Promise<boolean>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=heartbeat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.d.ts","sourceRoot":"","sources":["../src/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,cAAc,CAA6C;IACnE,OAAO,CAAC,WAAW,CAAS;gBAEhB,UAAU,EAAE,iBAAiB;IAezC;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,eAAe,CAE3B;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;IAED;;;;;OAKG;IACH,eAAe,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IAI3D;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;CAW1C"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heartbeat manager for the Nookplot Agent Runtime SDK.
|
|
3
|
+
*
|
|
4
|
+
* Monitors the connection state and provides convenience methods
|
|
5
|
+
* for tracking connection health. The actual heartbeat sending
|
|
6
|
+
* is handled by ConnectionManager — this module provides
|
|
7
|
+
* higher-level health monitoring.
|
|
8
|
+
*
|
|
9
|
+
* @module heartbeat
|
|
10
|
+
*/
|
|
11
|
+
export class HeartbeatManager {
|
|
12
|
+
connection;
|
|
13
|
+
onHealthChange = null;
|
|
14
|
+
lastHealthy = false;
|
|
15
|
+
constructor(connection) {
|
|
16
|
+
this.connection = connection;
|
|
17
|
+
// Monitor state changes for health tracking
|
|
18
|
+
this.connection.onStateChange((state) => {
|
|
19
|
+
const healthy = state === "connected";
|
|
20
|
+
if (healthy !== this.lastHealthy) {
|
|
21
|
+
this.lastHealthy = healthy;
|
|
22
|
+
if (this.onHealthChange) {
|
|
23
|
+
try {
|
|
24
|
+
this.onHealthChange(healthy);
|
|
25
|
+
}
|
|
26
|
+
catch { /* swallow */ }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether the connection is currently healthy (connected).
|
|
33
|
+
*/
|
|
34
|
+
get isHealthy() {
|
|
35
|
+
return this.connection.state === "connected";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Current connection state.
|
|
39
|
+
*/
|
|
40
|
+
get state() {
|
|
41
|
+
return this.connection.state;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The current session ID (null if not connected).
|
|
45
|
+
*/
|
|
46
|
+
get sessionId() {
|
|
47
|
+
return this.connection.sessionId;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Register a callback for health state changes.
|
|
51
|
+
*
|
|
52
|
+
* @param callback - Called with `true` when connection becomes healthy,
|
|
53
|
+
* `false` when it becomes unhealthy.
|
|
54
|
+
*/
|
|
55
|
+
onHealthChanged(callback) {
|
|
56
|
+
this.onHealthChange = callback;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Send a manual heartbeat via HTTP (backup for WebSocket heartbeat).
|
|
60
|
+
* Useful if the WebSocket is temporarily down but HTTP still works.
|
|
61
|
+
*/
|
|
62
|
+
async manualHeartbeat() {
|
|
63
|
+
try {
|
|
64
|
+
await this.connection.request("POST", "/v1/runtime/heartbeat");
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heartbeat.js","sourceRoot":"","sources":["../src/heartbeat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,OAAO,gBAAgB;IACV,UAAU,CAAoB;IACvC,cAAc,GAAwC,IAAI,CAAC;IAC3D,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,UAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,4CAA4C;QAC5C,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,KAAK,KAAK,WAAW,CAAC;YACtC,IAAI,OAAO,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;gBAC3B,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;oBACxB,IAAI,CAAC;wBAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;oBAAC,CAAC;oBAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,KAAK,WAAW,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,QAAoC;QAClD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAC3B,MAAM,EACN,uBAAuB,CACxB,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HookRegistry — local, in-process event bus for runtime-internal lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* This is a SEPARATE concern from `EventManager` (which routes gateway-emitted
|
|
5
|
+
* WebSocket events like `proactive.signal`). Hooks are agent-local — they fire
|
|
6
|
+
* inside the runtime process when actions start/end, signals arrive, and chat
|
|
7
|
+
* turns complete. Use them to attach cross-cutting concerns (tracing, episodic
|
|
8
|
+
* memory writes, mining-trace capture, latency metrics) without inlining the
|
|
9
|
+
* logic at every call site.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* runtime.hooks.register("action_end", ({ actionType, durationMs }) => {
|
|
14
|
+
* metrics.histogram("action_duration_ms", durationMs, { type: actionType });
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @module hooks
|
|
19
|
+
*/
|
|
20
|
+
import type { SignalEvent } from "./autonomous.js";
|
|
21
|
+
/** Per-action lifecycle: emitted by `handleActionRequest` in autonomous.ts. */
|
|
22
|
+
export interface ActionStartPayload {
|
|
23
|
+
actionType: string;
|
|
24
|
+
args: Record<string, unknown>;
|
|
25
|
+
actionId?: string;
|
|
26
|
+
agentAddress?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ActionEndPayload {
|
|
29
|
+
actionType: string;
|
|
30
|
+
args: Record<string, unknown>;
|
|
31
|
+
result: unknown;
|
|
32
|
+
durationMs: number;
|
|
33
|
+
actionId?: string;
|
|
34
|
+
txHash?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ActionErrorPayload {
|
|
37
|
+
actionType: string;
|
|
38
|
+
args: Record<string, unknown>;
|
|
39
|
+
error: Error;
|
|
40
|
+
durationMs: number;
|
|
41
|
+
actionId?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Approval gate denied the action. NOT an error. */
|
|
44
|
+
export interface ActionRejectedPayload {
|
|
45
|
+
actionType: string;
|
|
46
|
+
args: Record<string, unknown>;
|
|
47
|
+
reason: string;
|
|
48
|
+
actionId?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Tool-input/output hooks fired by Phase 3 guardrails wrapper. */
|
|
51
|
+
export interface ToolInputPayload {
|
|
52
|
+
toolName: string;
|
|
53
|
+
args: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export interface ToolOutputPayload {
|
|
56
|
+
toolName: string;
|
|
57
|
+
args: Record<string, unknown>;
|
|
58
|
+
result: unknown;
|
|
59
|
+
}
|
|
60
|
+
/** Chat turn finished (final assistant message produced). */
|
|
61
|
+
export interface ChatTurnCompletePayload {
|
|
62
|
+
sender: string;
|
|
63
|
+
platform: string;
|
|
64
|
+
message: string;
|
|
65
|
+
response: string;
|
|
66
|
+
toolsUsed: boolean;
|
|
67
|
+
toolCallCount: number;
|
|
68
|
+
senderId?: string | null;
|
|
69
|
+
channelId?: string | null;
|
|
70
|
+
/** Agent display name (from chat-engine soul). Used by the episodic hook
|
|
71
|
+
* to format the stored line as `[platform] sender: msg\nAgent: response`. */
|
|
72
|
+
agentName?: string;
|
|
73
|
+
/** Whether the engine that emitted this had memory enabled. The default
|
|
74
|
+
* episodic hook respects this so disabling memory at the engine level
|
|
75
|
+
* still suppresses writes even if the hook is installed. */
|
|
76
|
+
enableMemory?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/** Phase 2 CompactionMemory fires this after a successful summarize-and-prune. */
|
|
79
|
+
export interface MemoryCompactedPayload {
|
|
80
|
+
sessionId: string;
|
|
81
|
+
compactionNumber: number;
|
|
82
|
+
messagesCompacted: number;
|
|
83
|
+
summaryTokens: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Phase 2 CompactionMemory fires this when `compactFn` throws. The conversation
|
|
87
|
+
* is left untouched and will attempt compaction again on the next `addMessage`.
|
|
88
|
+
* Operators can register a handler to alert when compaction is broken — without
|
|
89
|
+
* this hook, a downed summarizer would silently let context grow unbounded.
|
|
90
|
+
*/
|
|
91
|
+
export interface CompactionFailedPayload {
|
|
92
|
+
sessionId: string;
|
|
93
|
+
error: unknown;
|
|
94
|
+
/** How many messages were about to be compacted when the failure occurred. */
|
|
95
|
+
attemptedMessages?: number;
|
|
96
|
+
}
|
|
97
|
+
/** Doom-loop detector tripped — same tool+args 3+ times, or A,B,A,B cycle. */
|
|
98
|
+
export interface DoomLoopDetectedPayload {
|
|
99
|
+
/** Tool name responsible for the loop. */
|
|
100
|
+
offender: string;
|
|
101
|
+
/** Number of triggers accumulated for this agent (resets after a forced abort). */
|
|
102
|
+
triggers: number;
|
|
103
|
+
/** The action type whose dispatch tripped the detector. */
|
|
104
|
+
actionType: string;
|
|
105
|
+
}
|
|
106
|
+
/** Map from event name → payload shape. Keep in lockstep with Python. */
|
|
107
|
+
export interface HookEventMap {
|
|
108
|
+
action_start: ActionStartPayload;
|
|
109
|
+
action_end: ActionEndPayload;
|
|
110
|
+
action_error: ActionErrorPayload;
|
|
111
|
+
action_rejected: ActionRejectedPayload;
|
|
112
|
+
signal_received: SignalEvent;
|
|
113
|
+
tool_input: ToolInputPayload;
|
|
114
|
+
tool_output: ToolOutputPayload;
|
|
115
|
+
chat_turn_complete: ChatTurnCompletePayload;
|
|
116
|
+
memory_compacted: MemoryCompactedPayload;
|
|
117
|
+
compaction_failed: CompactionFailedPayload;
|
|
118
|
+
doom_loop_detected: DoomLoopDetectedPayload;
|
|
119
|
+
}
|
|
120
|
+
export type HookEvent = keyof HookEventMap;
|
|
121
|
+
export type HookCallback<E extends HookEvent = HookEvent> = (payload: HookEventMap[E]) => void | Promise<void>;
|
|
122
|
+
export interface RegisterOptions {
|
|
123
|
+
/** Insert at the front of the callback list instead of the end. */
|
|
124
|
+
prepend?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Ordered, in-process callback registry. Each event name has its own list of
|
|
128
|
+
* callbacks; `emit()` runs them via `Promise.allSettled` so one throwing
|
|
129
|
+
* callback doesn't prevent the rest from running.
|
|
130
|
+
*
|
|
131
|
+
* Two emit modes:
|
|
132
|
+
* - `emit(event, payload)` — awaits all callbacks. Use when the caller wants
|
|
133
|
+
* to know when side-effects have completed.
|
|
134
|
+
* - `emitFireAndForget(event, payload)` — schedules via `Promise.resolve()`,
|
|
135
|
+
* returns synchronously. Use in hot paths (chat response, action dispatch)
|
|
136
|
+
* where blocking on observers would degrade UX.
|
|
137
|
+
*/
|
|
138
|
+
export declare class HookRegistry {
|
|
139
|
+
private listeners;
|
|
140
|
+
/**
|
|
141
|
+
* Register a callback for an event. Returns a disposer that removes only
|
|
142
|
+
* this callback (safer than calling `deregister` with the same reference
|
|
143
|
+
* since it survives renames + closures).
|
|
144
|
+
*/
|
|
145
|
+
register<E extends HookEvent>(event: E, cb: HookCallback<E>, opts?: RegisterOptions): () => void;
|
|
146
|
+
/** Remove the first matching callback for an event. Idempotent. */
|
|
147
|
+
deregister<E extends HookEvent>(event: E, cb: HookCallback<E>): void;
|
|
148
|
+
/**
|
|
149
|
+
* Emit and await all callbacks. Resolves once every callback has settled
|
|
150
|
+
* (either resolved or rejected). One throwing callback never prevents the
|
|
151
|
+
* others from running. Errors are logged via `console.error` so operators
|
|
152
|
+
* can observe silent hook failures (episodic write, metrics, etc.).
|
|
153
|
+
*/
|
|
154
|
+
emit<E extends HookEvent>(event: E, payload: HookEventMap[E]): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Schedule emit and return synchronously. Use in hot paths where the caller
|
|
157
|
+
* must not block on observers.
|
|
158
|
+
*/
|
|
159
|
+
emitFireAndForget<E extends HookEvent>(event: E, payload: HookEventMap[E]): void;
|
|
160
|
+
/** Test helper. With no arg, clears all subscribers. */
|
|
161
|
+
clear(event?: HookEvent): void;
|
|
162
|
+
/** Number of registered callbacks for an event (test inspection). */
|
|
163
|
+
count(event: HookEvent): number;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Module-level singleton — convenient default for agents that don't pass a
|
|
167
|
+
* registry around. `NookplotRuntime` exposes its own `runtime.hooks` instance
|
|
168
|
+
* which is the same object as this singleton, so `import { hooks } from
|
|
169
|
+
* "@nookplot/runtime"` and `runtime.hooks` are interchangeable.
|
|
170
|
+
*/
|
|
171
|
+
export declare const hooks: HookRegistry;
|
|
172
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,+EAA+E;AAC/E,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,C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S,GAAG,SAAS,IAAI,CAC1D,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KACrB,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAID;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAwC;IAEzD;;;;OAIG;IACH,QAAQ,CAAC,CAAC,SAAS,SAAS,EAC1B,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,EACnB,IAAI,GAAE,eAAoB,GACzB,MAAM,IAAI;IAYb,mEAAmE;IACnE,UAAU,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI;IAQpE;;;;;OAKG;IACG,IAAI,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlF;;;OAGG;IACH,iBAAiB,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI;IAIhF,wDAAwD;IACxD,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI;IAK9B,qEAAqE;IACrE,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;CAGhC;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,cAAqB,CAAC"}
|
package/dist/hooks.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// ── Registry implementation ──────────────────────────────────
|
|
2
|
+
/**
|
|
3
|
+
* Ordered, in-process callback registry. Each event name has its own list of
|
|
4
|
+
* callbacks; `emit()` runs them via `Promise.allSettled` so one throwing
|
|
5
|
+
* callback doesn't prevent the rest from running.
|
|
6
|
+
*
|
|
7
|
+
* Two emit modes:
|
|
8
|
+
* - `emit(event, payload)` — awaits all callbacks. Use when the caller wants
|
|
9
|
+
* to know when side-effects have completed.
|
|
10
|
+
* - `emitFireAndForget(event, payload)` — schedules via `Promise.resolve()`,
|
|
11
|
+
* returns synchronously. Use in hot paths (chat response, action dispatch)
|
|
12
|
+
* where blocking on observers would degrade UX.
|
|
13
|
+
*/
|
|
14
|
+
export class HookRegistry {
|
|
15
|
+
listeners = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* Register a callback for an event. Returns a disposer that removes only
|
|
18
|
+
* this callback (safer than calling `deregister` with the same reference
|
|
19
|
+
* since it survives renames + closures).
|
|
20
|
+
*/
|
|
21
|
+
register(event, cb, opts = {}) {
|
|
22
|
+
let list = this.listeners.get(event);
|
|
23
|
+
if (!list) {
|
|
24
|
+
list = [];
|
|
25
|
+
this.listeners.set(event, list);
|
|
26
|
+
}
|
|
27
|
+
if (opts.prepend)
|
|
28
|
+
list.unshift(cb);
|
|
29
|
+
else
|
|
30
|
+
list.push(cb);
|
|
31
|
+
return () => this.deregister(event, cb);
|
|
32
|
+
}
|
|
33
|
+
/** Remove the first matching callback for an event. Idempotent. */
|
|
34
|
+
deregister(event, cb) {
|
|
35
|
+
const list = this.listeners.get(event);
|
|
36
|
+
if (!list)
|
|
37
|
+
return;
|
|
38
|
+
const idx = list.indexOf(cb);
|
|
39
|
+
if (idx >= 0)
|
|
40
|
+
list.splice(idx, 1);
|
|
41
|
+
if (list.length === 0)
|
|
42
|
+
this.listeners.delete(event);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Emit and await all callbacks. Resolves once every callback has settled
|
|
46
|
+
* (either resolved or rejected). One throwing callback never prevents the
|
|
47
|
+
* others from running. Errors are logged via `console.error` so operators
|
|
48
|
+
* can observe silent hook failures (episodic write, metrics, etc.).
|
|
49
|
+
*/
|
|
50
|
+
async emit(event, payload) {
|
|
51
|
+
const list = this.listeners.get(event);
|
|
52
|
+
if (!list || list.length === 0)
|
|
53
|
+
return;
|
|
54
|
+
// Snapshot so callbacks that mutate the list mid-emit don't affect this run.
|
|
55
|
+
const snapshot = list.slice();
|
|
56
|
+
await Promise.allSettled(snapshot.map(async (cb) => {
|
|
57
|
+
try {
|
|
58
|
+
await cb(payload);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
console.error(`[hooks] callback for "${event}" threw:`, err);
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Schedule emit and return synchronously. Use in hot paths where the caller
|
|
67
|
+
* must not block on observers.
|
|
68
|
+
*/
|
|
69
|
+
emitFireAndForget(event, payload) {
|
|
70
|
+
void this.emit(event, payload);
|
|
71
|
+
}
|
|
72
|
+
/** Test helper. With no arg, clears all subscribers. */
|
|
73
|
+
clear(event) {
|
|
74
|
+
if (event)
|
|
75
|
+
this.listeners.delete(event);
|
|
76
|
+
else
|
|
77
|
+
this.listeners.clear();
|
|
78
|
+
}
|
|
79
|
+
/** Number of registered callbacks for an event (test inspection). */
|
|
80
|
+
count(event) {
|
|
81
|
+
return this.listeners.get(event)?.length ?? 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Module-level singleton — convenient default for agents that don't pass a
|
|
86
|
+
* registry around. `NookplotRuntime` exposes its own `runtime.hooks` instance
|
|
87
|
+
* which is the same object as this singleton, so `import { hooks } from
|
|
88
|
+
* "@nookplot/runtime"` and `runtime.hooks` are interchangeable.
|
|
89
|
+
*/
|
|
90
|
+
export const hooks = new HookRegistry();
|
|
91
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAgJA,gEAAgE;AAEhE;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,YAAY;IACf,SA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6E;QAC7E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,OAAO,CAAC,UAAU,CACtB,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,yBAAyB,KAAK,UAAU,EAAE,GAAG,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,iBAAiB,CAAsB,KAAQ,EAAE,OAAwB;QACvE,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,wDAAwD;IACxD,KAAK,CAAC,KAAiB;QACrB,IAAI,KAAK;YAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;YACnC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,qEAAqE;IACrE,KAAK,CAAC,KAAgB;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IAChD,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity manager for the Nookplot Agent Runtime SDK.
|
|
3
|
+
*
|
|
4
|
+
* Handles agent registration, profile management, and soul.md
|
|
5
|
+
* document lifecycle via the gateway API.
|
|
6
|
+
*
|
|
7
|
+
* @module identity
|
|
8
|
+
*/
|
|
9
|
+
import type { ConnectionManager } from "./connection.js";
|
|
10
|
+
import type { AgentProfileInput, AgentInfo, AgentSearchResult, SoulUpdateInput, Project } from "./types.js";
|
|
11
|
+
export declare class IdentityManager {
|
|
12
|
+
private readonly connection;
|
|
13
|
+
constructor(connection: ConnectionManager);
|
|
14
|
+
/**
|
|
15
|
+
* Get the current agent's profile.
|
|
16
|
+
*/
|
|
17
|
+
getProfile(): Promise<AgentInfo>;
|
|
18
|
+
/**
|
|
19
|
+
* Look up another agent's profile by address.
|
|
20
|
+
*/
|
|
21
|
+
lookupAgent(address: string): Promise<AgentInfo>;
|
|
22
|
+
/**
|
|
23
|
+
* Search for agents by name or address.
|
|
24
|
+
*
|
|
25
|
+
* @param query - Name substring or address prefix to search for.
|
|
26
|
+
* @param limit - Max results (default 20, max 100).
|
|
27
|
+
* @param offset - Pagination offset.
|
|
28
|
+
*/
|
|
29
|
+
searchAgents(query: string, limit?: number, offset?: number): Promise<AgentSearchResult>;
|
|
30
|
+
/**
|
|
31
|
+
* List another agent's projects by address.
|
|
32
|
+
*
|
|
33
|
+
* @param address - Ethereum address of the agent.
|
|
34
|
+
*/
|
|
35
|
+
getAgentProjects(address: string): Promise<Project[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Register a new agent on the network.
|
|
38
|
+
* Note: Most agents will already be registered via the gateway
|
|
39
|
+
* before using the runtime SDK. This is for programmatic registration.
|
|
40
|
+
*/
|
|
41
|
+
register(profile?: AgentProfileInput): Promise<AgentInfo & {
|
|
42
|
+
apiKey: string;
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Update the agent's soul CID (for agent launchpad deployments).
|
|
46
|
+
*/
|
|
47
|
+
updateSoul(input: SoulUpdateInput): Promise<{
|
|
48
|
+
success: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Get the current agent's address.
|
|
52
|
+
* Convenience method — returns null if not connected.
|
|
53
|
+
*/
|
|
54
|
+
getAddress(): string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Get the current agent's ID.
|
|
57
|
+
* Convenience method — returns null if not connected.
|
|
58
|
+
*/
|
|
59
|
+
getAgentId(): string | null;
|
|
60
|
+
/**
|
|
61
|
+
* Read the agent's current goal config. Returns null for agents
|
|
62
|
+
* without a goal set (the common case for manually-forged agents).
|
|
63
|
+
*/
|
|
64
|
+
getGoal(): Promise<GoalConfig | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Transition the goal status (pending → in_progress → complete, etc).
|
|
67
|
+
*/
|
|
68
|
+
updateGoalStatus(status: GoalStatus): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Mark the goal complete and attach the private KG artifact item ID.
|
|
71
|
+
* Called by the runtime's GoalLoop after it stores the deliverable.
|
|
72
|
+
*/
|
|
73
|
+
completeGoal(artifactItemId: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Record one step of the goal loop. Used for UI progress + debugging.
|
|
76
|
+
* Never a consensus signal — just an audit trail.
|
|
77
|
+
*/
|
|
78
|
+
recordGoalStep(input: {
|
|
79
|
+
stepNumber: number;
|
|
80
|
+
actionType?: string | null;
|
|
81
|
+
inputSummary?: string | null;
|
|
82
|
+
outputSummary?: string | null;
|
|
83
|
+
nookSpent?: number | string;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
id: string;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Surface a pending decision card to the owner. Called when the
|
|
89
|
+
* agent's GoalLoop is blocked (budget, capability, stuck, unclear goal).
|
|
90
|
+
*/
|
|
91
|
+
createPendingTask(input: {
|
|
92
|
+
reason: "needs_capability" | "budget_exhausted" | "access_denied" | "stuck_3x" | "unclear_goal";
|
|
93
|
+
description: string;
|
|
94
|
+
parentSwarmId?: string | null;
|
|
95
|
+
suggestedPresetId?: string | null;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
id: string;
|
|
98
|
+
}>;
|
|
99
|
+
}
|
|
100
|
+
/** The subset of goal fields returned by GET /v1/agents/me/goal. */
|
|
101
|
+
export interface GoalConfig {
|
|
102
|
+
initialGoal: string | null;
|
|
103
|
+
goalBudgetNook: string | null;
|
|
104
|
+
goalStatus: GoalStatus;
|
|
105
|
+
goalStartedAt: string | null;
|
|
106
|
+
goalCompletedAt: string | null;
|
|
107
|
+
goalArtifactId: string | null;
|
|
108
|
+
goalParentSwarmId: string | null;
|
|
109
|
+
}
|
|
110
|
+
/** Valid goal status transitions. Kept in sync with goalService.ts. */
|
|
111
|
+
export type GoalStatus = "pending" | "in_progress" | "complete" | "failed" | "blocked_budget" | "blocked_needs_decision" | "paused_awaiting_topoff";
|
|
112
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;gBAEnC,UAAU,EAAE,iBAAiB;IAIzC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAItC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAMtD;;;;;;OAMG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAOrF;;;;OAIG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQ3D;;;;OAIG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpF;;OAEG;IACG,UAAU,CAAC,KAAK,EAAE,eAAe,GA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AE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,uEAAuE;AACvE,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,aAAa,GACb,UAAU,GACV,QAAQ,GACR,gBAAgB,GAChB,wBAAwB,GACxB,wBAAwB,CAAC"}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity manager for the Nookplot Agent Runtime SDK.
|
|
3
|
+
*
|
|
4
|
+
* Handles agent registration, profile management, and soul.md
|
|
5
|
+
* document lifecycle via the gateway API.
|
|
6
|
+
*
|
|
7
|
+
* @module identity
|
|
8
|
+
*/
|
|
9
|
+
export class IdentityManager {
|
|
10
|
+
connection;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.connection = connection;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the current agent's profile.
|
|
16
|
+
*/
|
|
17
|
+
async getProfile() {
|
|
18
|
+
return this.connection.request("GET", "/v1/agents/me");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Look up another agent's profile by address.
|
|
22
|
+
*/
|
|
23
|
+
async lookupAgent(address) {
|
|
24
|
+
// SECURITY: URL-encode path segment to prevent path traversal
|
|
25
|
+
// Uses enriched /profile endpoint for contribution scores, endorsements, bounties, projects, recent work
|
|
26
|
+
return this.connection.request("GET", `/v1/agents/${encodeURIComponent(address)}/profile`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Search for agents by name or address.
|
|
30
|
+
*
|
|
31
|
+
* @param query - Name substring or address prefix to search for.
|
|
32
|
+
* @param limit - Max results (default 20, max 100).
|
|
33
|
+
* @param offset - Pagination offset.
|
|
34
|
+
*/
|
|
35
|
+
async searchAgents(query, limit = 20, offset = 0) {
|
|
36
|
+
return this.connection.request("GET", `/v1/agents/search?q=${encodeURIComponent(query)}&limit=${limit}&offset=${offset}`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List another agent's projects by address.
|
|
40
|
+
*
|
|
41
|
+
* @param address - Ethereum address of the agent.
|
|
42
|
+
*/
|
|
43
|
+
async getAgentProjects(address) {
|
|
44
|
+
const result = await this.connection.request("GET", `/v1/agents/${encodeURIComponent(address)}/projects`);
|
|
45
|
+
return result.projects ?? [];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Register a new agent on the network.
|
|
49
|
+
* Note: Most agents will already be registered via the gateway
|
|
50
|
+
* before using the runtime SDK. This is for programmatic registration.
|
|
51
|
+
*/
|
|
52
|
+
async register(profile) {
|
|
53
|
+
return this.connection.request("POST", "/v1/agents", profile ?? {});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Update the agent's soul CID (for agent launchpad deployments).
|
|
57
|
+
*/
|
|
58
|
+
async updateSoul(input) {
|
|
59
|
+
return this.connection.request("PUT", `/v1/deployments/${encodeURIComponent(input.deploymentId)}/soul`, { soulCid: input.soulCid });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the current agent's address.
|
|
63
|
+
* Convenience method — returns null if not connected.
|
|
64
|
+
*/
|
|
65
|
+
getAddress() {
|
|
66
|
+
return this.connection.address;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get the current agent's ID.
|
|
70
|
+
* Convenience method — returns null if not connected.
|
|
71
|
+
*/
|
|
72
|
+
getAgentId() {
|
|
73
|
+
return this.connection.agentId;
|
|
74
|
+
}
|
|
75
|
+
// ──────────────────────────────────────────────────────────────────
|
|
76
|
+
// Goal execution (L3 — migration 247)
|
|
77
|
+
//
|
|
78
|
+
// These helpers talk to /v1/agents/me/goal/* endpoints. They are
|
|
79
|
+
// used by the runtime's GoalLoop when an agent was forged with an
|
|
80
|
+
// initial_goal attached (e.g. via an L1 swarm suggestion).
|
|
81
|
+
// ──────────────────────────────────────────────────────────────────
|
|
82
|
+
/**
|
|
83
|
+
* Read the agent's current goal config. Returns null for agents
|
|
84
|
+
* without a goal set (the common case for manually-forged agents).
|
|
85
|
+
*/
|
|
86
|
+
async getGoal() {
|
|
87
|
+
try {
|
|
88
|
+
return await this.connection.request("GET", "/v1/agents/me/goal");
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
// 404 = no goal config for this agent — treat as null rather than throwing
|
|
92
|
+
const status = err?.status;
|
|
93
|
+
if (status === 404)
|
|
94
|
+
return null;
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Transition the goal status (pending → in_progress → complete, etc).
|
|
100
|
+
*/
|
|
101
|
+
async updateGoalStatus(status) {
|
|
102
|
+
await this.connection.request("POST", "/v1/agents/me/goal/status", { status });
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Mark the goal complete and attach the private KG artifact item ID.
|
|
106
|
+
* Called by the runtime's GoalLoop after it stores the deliverable.
|
|
107
|
+
*/
|
|
108
|
+
async completeGoal(artifactItemId) {
|
|
109
|
+
await this.connection.request("POST", "/v1/agents/me/goal/complete", { artifactItemId });
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Record one step of the goal loop. Used for UI progress + debugging.
|
|
113
|
+
* Never a consensus signal — just an audit trail.
|
|
114
|
+
*/
|
|
115
|
+
async recordGoalStep(input) {
|
|
116
|
+
return this.connection.request("POST", "/v1/agents/me/goal/step", input);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Surface a pending decision card to the owner. Called when the
|
|
120
|
+
* agent's GoalLoop is blocked (budget, capability, stuck, unclear goal).
|
|
121
|
+
*/
|
|
122
|
+
async createPendingTask(input) {
|
|
123
|
+
return this.connection.request("POST", "/v1/agents/me/goal/pending-task", input);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# s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