@elizaos/core 2.0.0-alpha.52 → 2.0.0-alpha.53
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/action-docs.d.ts +22 -0
- package/dist/action-docs.d.ts.map +1 -0
- package/dist/actions.d.ts +18 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/addContact.d.ts +3 -0
- package/dist/advanced-capabilities/actions/addContact.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/createTask.d.ts +3 -0
- package/dist/advanced-capabilities/actions/createTask.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/followRoom.d.ts +3 -0
- package/dist/advanced-capabilities/actions/followRoom.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/imageGeneration.d.ts +3 -0
- package/dist/advanced-capabilities/actions/imageGeneration.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/index.d.ts +20 -0
- package/dist/advanced-capabilities/actions/index.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/muteRoom.d.ts +3 -0
- package/dist/advanced-capabilities/actions/muteRoom.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/removeContact.d.ts +3 -0
- package/dist/advanced-capabilities/actions/removeContact.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/roles.d.ts +13 -0
- package/dist/advanced-capabilities/actions/roles.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/scheduleFollowUp.d.ts +3 -0
- package/dist/advanced-capabilities/actions/scheduleFollowUp.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/searchContacts.d.ts +3 -0
- package/dist/advanced-capabilities/actions/searchContacts.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/sendMessage.d.ts +15 -0
- package/dist/advanced-capabilities/actions/sendMessage.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/settings.d.ts +22 -0
- package/dist/advanced-capabilities/actions/settings.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/unfollowRoom.d.ts +3 -0
- package/dist/advanced-capabilities/actions/unfollowRoom.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/unmuteRoom.d.ts +3 -0
- package/dist/advanced-capabilities/actions/unmuteRoom.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/updateContact.d.ts +3 -0
- package/dist/advanced-capabilities/actions/updateContact.d.ts.map +1 -0
- package/dist/advanced-capabilities/actions/updateEntity.d.ts +43 -0
- package/dist/advanced-capabilities/actions/updateEntity.d.ts.map +1 -0
- package/dist/advanced-capabilities/evaluators/index.d.ts +8 -0
- package/dist/advanced-capabilities/evaluators/index.d.ts.map +1 -0
- package/dist/advanced-capabilities/evaluators/reflection.d.ts +3 -0
- package/dist/advanced-capabilities/evaluators/reflection.d.ts.map +1 -0
- package/dist/advanced-capabilities/evaluators/relationshipExtraction.d.ts +3 -0
- package/dist/advanced-capabilities/evaluators/relationshipExtraction.d.ts.map +1 -0
- package/dist/advanced-capabilities/index.d.ts +43 -0
- package/dist/advanced-capabilities/index.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/contacts.d.ts +3 -0
- package/dist/advanced-capabilities/providers/contacts.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/facts.d.ts +11 -0
- package/dist/advanced-capabilities/providers/facts.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/followUps.d.ts +3 -0
- package/dist/advanced-capabilities/providers/followUps.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/index.d.ts +13 -0
- package/dist/advanced-capabilities/providers/index.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/knowledge.d.ts +9 -0
- package/dist/advanced-capabilities/providers/knowledge.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/relationships.d.ts +15 -0
- package/dist/advanced-capabilities/providers/relationships.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/roles.d.ts +19 -0
- package/dist/advanced-capabilities/providers/roles.d.ts.map +1 -0
- package/dist/advanced-capabilities/providers/settings.d.ts +7 -0
- package/dist/advanced-capabilities/providers/settings.d.ts.map +1 -0
- package/dist/advanced-memory/actions/resetSession.d.ts +11 -0
- package/dist/advanced-memory/actions/resetSession.d.ts.map +1 -0
- package/dist/advanced-memory/evaluators/index.d.ts +3 -0
- package/dist/advanced-memory/evaluators/index.d.ts.map +1 -0
- package/dist/advanced-memory/evaluators/long-term-extraction.d.ts +3 -0
- package/dist/advanced-memory/evaluators/long-term-extraction.d.ts.map +1 -0
- package/dist/advanced-memory/evaluators/summarization.d.ts +3 -0
- package/dist/advanced-memory/evaluators/summarization.d.ts.map +1 -0
- package/dist/advanced-memory/index.d.ts +16 -0
- package/dist/advanced-memory/index.d.ts.map +1 -0
- package/dist/advanced-memory/prompts.d.ts +4 -0
- package/dist/advanced-memory/prompts.d.ts.map +1 -0
- package/dist/advanced-memory/providers/context-summary.d.ts +3 -0
- package/dist/advanced-memory/providers/context-summary.d.ts.map +1 -0
- package/dist/advanced-memory/providers/index.d.ts +3 -0
- package/dist/advanced-memory/providers/index.d.ts.map +1 -0
- package/dist/advanced-memory/providers/long-term-memory.d.ts +3 -0
- package/dist/advanced-memory/providers/long-term-memory.d.ts.map +1 -0
- package/dist/advanced-memory/schemas/index.d.ts +5 -0
- package/dist/advanced-memory/schemas/index.d.ts.map +1 -0
- package/dist/advanced-memory/schemas/long-term-memories.d.ts +10 -0
- package/dist/advanced-memory/schemas/long-term-memories.d.ts.map +1 -0
- package/dist/advanced-memory/schemas/memory-access-logs.d.ts +10 -0
- package/dist/advanced-memory/schemas/memory-access-logs.d.ts.map +1 -0
- package/dist/advanced-memory/schemas/session-summaries.d.ts +10 -0
- package/dist/advanced-memory/schemas/session-summaries.d.ts.map +1 -0
- package/dist/advanced-memory/services/autoCompaction.d.ts +24 -0
- package/dist/advanced-memory/services/autoCompaction.d.ts.map +1 -0
- package/dist/advanced-memory/services/memory-service.d.ts +36 -0
- package/dist/advanced-memory/services/memory-service.d.ts.map +1 -0
- package/dist/advanced-memory/types.d.ts +68 -0
- package/dist/advanced-memory/types.d.ts.map +1 -0
- package/dist/advanced-planning/actions/chain-example.d.ts +6 -0
- package/dist/advanced-planning/actions/chain-example.d.ts.map +1 -0
- package/dist/advanced-planning/index.d.ts +5 -0
- package/dist/advanced-planning/index.d.ts.map +1 -0
- package/dist/advanced-planning/prompts.d.ts +8 -0
- package/dist/advanced-planning/prompts.d.ts.map +1 -0
- package/dist/advanced-planning/providers/message-classifier.d.ts +3 -0
- package/dist/advanced-planning/providers/message-classifier.d.ts.map +1 -0
- package/dist/advanced-planning/services/planning-service.d.ts +77 -0
- package/dist/advanced-planning/services/planning-service.d.ts.map +1 -0
- package/dist/advanced-planning/types.d.ts +78 -0
- package/dist/advanced-planning/types.d.ts.map +1 -0
- package/dist/autonomy/action.d.ts +14 -0
- package/dist/autonomy/action.d.ts.map +1 -0
- package/dist/autonomy/autonomousState.d.ts +5 -0
- package/dist/autonomy/autonomousState.d.ts.map +1 -0
- package/dist/autonomy/execution-facade.d.ts +22 -0
- package/dist/autonomy/execution-facade.d.ts.map +1 -0
- package/dist/autonomy/index.d.ts +11 -0
- package/dist/autonomy/index.d.ts.map +1 -0
- package/dist/autonomy/providers.d.ts +21 -0
- package/dist/autonomy/providers.d.ts.map +1 -0
- package/dist/autonomy/routes.d.ts +11 -0
- package/dist/autonomy/routes.d.ts.map +1 -0
- package/dist/autonomy/service.d.ts +137 -0
- package/dist/autonomy/service.d.ts.map +1 -0
- package/dist/autonomy/types.d.ts +31 -0
- package/dist/autonomy/types.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/choice.d.ts +4 -0
- package/dist/basic-capabilities/actions/choice.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/compactSession.d.ts +12 -0
- package/dist/basic-capabilities/actions/compactSession.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/ignore.d.ts +3 -0
- package/dist/basic-capabilities/actions/ignore.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/index.d.ts +11 -0
- package/dist/basic-capabilities/actions/index.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/none.d.ts +3 -0
- package/dist/basic-capabilities/actions/none.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/reply.d.ts +3 -0
- package/dist/basic-capabilities/actions/reply.d.ts.map +1 -0
- package/dist/basic-capabilities/actions/status.d.ts +10 -0
- package/dist/basic-capabilities/actions/status.d.ts.map +1 -0
- package/dist/basic-capabilities/index.d.ts +101 -0
- package/dist/basic-capabilities/index.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/actionState.d.ts +7 -0
- package/dist/basic-capabilities/providers/actionState.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/actions.d.ts +35 -0
- package/dist/basic-capabilities/providers/actions.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/attachments.d.ts +20 -0
- package/dist/basic-capabilities/providers/attachments.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/capabilities.d.ts +14 -0
- package/dist/basic-capabilities/providers/capabilities.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/character.d.ts +17 -0
- package/dist/basic-capabilities/providers/character.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/choice.d.ts +11 -0
- package/dist/basic-capabilities/providers/choice.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/contextBench.d.ts +12 -0
- package/dist/basic-capabilities/providers/contextBench.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/currentTime.d.ts +11 -0
- package/dist/basic-capabilities/providers/currentTime.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/entities.d.ts +7 -0
- package/dist/basic-capabilities/providers/entities.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/evaluators.d.ts +27 -0
- package/dist/basic-capabilities/providers/evaluators.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/index.d.ts +19 -0
- package/dist/basic-capabilities/providers/index.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/providers.d.ts +18 -0
- package/dist/basic-capabilities/providers/providers.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/recentMessages.d.ts +14 -0
- package/dist/basic-capabilities/providers/recentMessages.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/time.d.ts +12 -0
- package/dist/basic-capabilities/providers/time.d.ts.map +1 -0
- package/dist/basic-capabilities/providers/world.d.ts +8 -0
- package/dist/basic-capabilities/providers/world.d.ts.map +1 -0
- package/dist/bootstrap/actions/addContact.d.ts +3 -0
- package/dist/bootstrap/actions/addContact.d.ts.map +1 -0
- package/dist/bootstrap/actions/choice.d.ts +3 -0
- package/dist/bootstrap/actions/choice.d.ts.map +1 -0
- package/dist/bootstrap/actions/followRoom.d.ts +3 -0
- package/dist/bootstrap/actions/followRoom.d.ts.map +1 -0
- package/dist/bootstrap/actions/ignore.d.ts +3 -0
- package/dist/bootstrap/actions/ignore.d.ts.map +1 -0
- package/dist/bootstrap/actions/imageGeneration.d.ts +2 -0
- package/dist/bootstrap/actions/imageGeneration.d.ts.map +1 -0
- package/dist/bootstrap/actions/index.d.ts +14 -0
- package/dist/bootstrap/actions/index.d.ts.map +1 -0
- package/dist/bootstrap/actions/muteRoom.d.ts +3 -0
- package/dist/bootstrap/actions/muteRoom.d.ts.map +1 -0
- package/dist/bootstrap/actions/none.d.ts +3 -0
- package/dist/bootstrap/actions/none.d.ts.map +1 -0
- package/dist/bootstrap/actions/removeContact.d.ts +3 -0
- package/dist/bootstrap/actions/removeContact.d.ts.map +1 -0
- package/dist/bootstrap/actions/reply.d.ts +3 -0
- package/dist/bootstrap/actions/reply.d.ts.map +1 -0
- package/dist/bootstrap/actions/resetSession.d.ts +2 -0
- package/dist/bootstrap/actions/resetSession.d.ts.map +1 -0
- package/dist/bootstrap/actions/roles.d.ts +13 -0
- package/dist/bootstrap/actions/roles.d.ts.map +1 -0
- package/dist/bootstrap/actions/scheduleFollowUp.d.ts +3 -0
- package/dist/bootstrap/actions/scheduleFollowUp.d.ts.map +1 -0
- package/dist/bootstrap/actions/searchContacts.d.ts +3 -0
- package/dist/bootstrap/actions/searchContacts.d.ts.map +1 -0
- package/dist/bootstrap/actions/sendMessage.d.ts +14 -0
- package/dist/bootstrap/actions/sendMessage.d.ts.map +1 -0
- package/dist/bootstrap/actions/settings.d.ts +7 -0
- package/dist/bootstrap/actions/settings.d.ts.map +1 -0
- package/dist/bootstrap/actions/status.d.ts +10 -0
- package/dist/bootstrap/actions/status.d.ts.map +1 -0
- package/dist/bootstrap/actions/unfollowRoom.d.ts +13 -0
- package/dist/bootstrap/actions/unfollowRoom.d.ts.map +1 -0
- package/dist/bootstrap/actions/unmuteRoom.d.ts +14 -0
- package/dist/bootstrap/actions/unmuteRoom.d.ts.map +1 -0
- package/dist/bootstrap/actions/updateContact.d.ts +3 -0
- package/dist/bootstrap/actions/updateContact.d.ts.map +1 -0
- package/dist/bootstrap/actions/updateEntity.d.ts +42 -0
- package/dist/bootstrap/actions/updateEntity.d.ts.map +1 -0
- package/dist/bootstrap/evaluators/index.d.ts +2 -0
- package/dist/bootstrap/evaluators/index.d.ts.map +1 -0
- package/dist/bootstrap/evaluators/reflection.d.ts +3 -0
- package/dist/bootstrap/evaluators/reflection.d.ts.map +1 -0
- package/dist/bootstrap/evaluators/relationshipExtraction.d.ts +3 -0
- package/dist/bootstrap/evaluators/relationshipExtraction.d.ts.map +1 -0
- package/dist/bootstrap/index.d.ts +64 -0
- package/dist/bootstrap/index.d.ts.map +1 -0
- package/dist/bootstrap/providers/actionState.d.ts +7 -0
- package/dist/bootstrap/providers/actionState.d.ts.map +1 -0
- package/dist/bootstrap/providers/actions.d.ts +4 -0
- package/dist/bootstrap/providers/actions.d.ts.map +1 -0
- package/dist/bootstrap/providers/attachments.d.ts +20 -0
- package/dist/bootstrap/providers/attachments.d.ts.map +1 -0
- package/dist/bootstrap/providers/capabilities.d.ts +13 -0
- package/dist/bootstrap/providers/capabilities.d.ts.map +1 -0
- package/dist/bootstrap/providers/character.d.ts +17 -0
- package/dist/bootstrap/providers/character.d.ts.map +1 -0
- package/dist/bootstrap/providers/choice.d.ts +10 -0
- package/dist/bootstrap/providers/choice.d.ts.map +1 -0
- package/dist/bootstrap/providers/contacts.d.ts +3 -0
- package/dist/bootstrap/providers/contacts.d.ts.map +1 -0
- package/dist/bootstrap/providers/contextBench.d.ts +12 -0
- package/dist/bootstrap/providers/contextBench.d.ts.map +1 -0
- package/dist/bootstrap/providers/entities.d.ts +7 -0
- package/dist/bootstrap/providers/entities.d.ts.map +1 -0
- package/dist/bootstrap/providers/evaluators.d.ts +3 -0
- package/dist/bootstrap/providers/evaluators.d.ts.map +1 -0
- package/dist/bootstrap/providers/facts.d.ts +11 -0
- package/dist/bootstrap/providers/facts.d.ts.map +1 -0
- package/dist/bootstrap/providers/followUps.d.ts +3 -0
- package/dist/bootstrap/providers/followUps.d.ts.map +1 -0
- package/dist/bootstrap/providers/index.d.ts +16 -0
- package/dist/bootstrap/providers/index.d.ts.map +1 -0
- package/dist/bootstrap/providers/knowledge.d.ts +9 -0
- package/dist/bootstrap/providers/knowledge.d.ts.map +1 -0
- package/dist/bootstrap/providers/providers.d.ts +18 -0
- package/dist/bootstrap/providers/providers.d.ts.map +1 -0
- package/dist/bootstrap/providers/recentMessages.d.ts +14 -0
- package/dist/bootstrap/providers/recentMessages.d.ts.map +1 -0
- package/dist/bootstrap/providers/relationships.d.ts +15 -0
- package/dist/bootstrap/providers/relationships.d.ts.map +1 -0
- package/dist/bootstrap/providers/roles.d.ts +18 -0
- package/dist/bootstrap/providers/roles.d.ts.map +1 -0
- package/dist/bootstrap/providers/settings.d.ts +7 -0
- package/dist/bootstrap/providers/settings.d.ts.map +1 -0
- package/dist/bootstrap/providers/time.d.ts +16 -0
- package/dist/bootstrap/providers/time.d.ts.map +1 -0
- package/dist/bootstrap/providers/world.d.ts +7 -0
- package/dist/bootstrap/providers/world.d.ts.map +1 -0
- package/dist/bootstrap/services/autoCompaction.d.ts +2 -0
- package/dist/bootstrap/services/autoCompaction.d.ts.map +1 -0
- package/dist/browser/index.browser.js +3569 -0
- package/dist/browser/index.browser.js.map +628 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/character-loader.d.ts +85 -0
- package/dist/character-loader.d.ts.map +1 -0
- package/dist/character-utils.d.ts +138 -0
- package/dist/character-utils.d.ts.map +1 -0
- package/dist/character.d.ts +68 -0
- package/dist/character.d.ts.map +1 -0
- package/dist/constants/index.d.ts +7 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/secrets.d.ts +99 -0
- package/dist/constants/secrets.d.ts.map +1 -0
- package/dist/database/inMemoryAdapter.d.ts +282 -0
- package/dist/database/inMemoryAdapter.d.ts.map +1 -0
- package/dist/database.d.ts +433 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/deterministic.d.ts +31 -0
- package/dist/deterministic.d.ts.map +1 -0
- package/dist/entities.d.ts +11 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/generated/action-docs.d.ts +1994 -0
- package/dist/generated/action-docs.d.ts.map +1 -0
- package/dist/generated/spec-helpers.d.ts +49 -0
- package/dist/generated/spec-helpers.d.ts.map +1 -0
- package/dist/index.browser.d.ts +45 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.node.d.ts +70 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +2 -0
- package/dist/logger.d.ts +121 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/markdown/chunk.d.ts +50 -0
- package/dist/markdown/chunk.d.ts.map +1 -0
- package/dist/markdown/code-spans.d.ts +42 -0
- package/dist/markdown/code-spans.d.ts.map +1 -0
- package/dist/markdown/fences.d.ts +50 -0
- package/dist/markdown/fences.d.ts.map +1 -0
- package/dist/markdown/frontmatter.d.ts +24 -0
- package/dist/markdown/frontmatter.d.ts.map +1 -0
- package/dist/markdown/index.d.ts +18 -0
- package/dist/markdown/index.d.ts.map +1 -0
- package/dist/markdown/ir.d.ts +101 -0
- package/dist/markdown/ir.d.ts.map +1 -0
- package/dist/media/fetch.d.ts +39 -0
- package/dist/media/fetch.d.ts.map +1 -0
- package/dist/media/image-ops.d.ts +55 -0
- package/dist/media/image-ops.d.ts.map +1 -0
- package/dist/media/index.d.ts +9 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/mime.d.ts +51 -0
- package/dist/media/mime.d.ts.map +1 -0
- package/dist/memory.d.ts +40 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/network/fetch-guard.d.ts +34 -0
- package/dist/network/fetch-guard.d.ts.map +1 -0
- package/dist/network/index.d.ts +11 -0
- package/dist/network/index.d.ts.map +1 -0
- package/dist/network/sandbox-fetch-proxy.d.ts +25 -0
- package/dist/network/sandbox-fetch-proxy.d.ts.map +1 -0
- package/dist/network/ssrf.d.ts +53 -0
- package/dist/network/ssrf.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.node.js +107107 -0
- package/dist/node/index.node.js.map +899 -0
- package/dist/packages/typescript/tsconfig.tsbuildinfo +1 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugins/discovery.d.ts +62 -0
- package/dist/plugins/discovery.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/manifest-registry.d.ts +118 -0
- package/dist/plugins/manifest-registry.d.ts.map +1 -0
- package/dist/prompts.d.ts +85 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/providers/onboarding-progress.d.ts +19 -0
- package/dist/providers/onboarding-progress.d.ts.map +1 -0
- package/dist/providers/sessionKeys.d.ts +24 -0
- package/dist/providers/sessionKeys.d.ts.map +1 -0
- package/dist/providers/skill-eligibility.d.ts +28 -0
- package/dist/providers/skill-eligibility.d.ts.map +1 -0
- package/dist/request-context.d.ts +143 -0
- package/dist/request-context.d.ts.map +1 -0
- package/dist/roles.d.ts +9 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/runtime.d.ts +817 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/schemas/agent.d.ts +7 -0
- package/dist/schemas/agent.d.ts.map +1 -0
- package/dist/schemas/cache.d.ts +7 -0
- package/dist/schemas/cache.d.ts.map +1 -0
- package/dist/schemas/channel-participant.d.ts +7 -0
- package/dist/schemas/channel-participant.d.ts.map +1 -0
- package/dist/schemas/channel.d.ts +7 -0
- package/dist/schemas/channel.d.ts.map +1 -0
- package/dist/schemas/character.d.ts +445 -0
- package/dist/schemas/character.d.ts.map +1 -0
- package/dist/schemas/component.d.ts +7 -0
- package/dist/schemas/component.d.ts.map +1 -0
- package/dist/schemas/embedding.d.ts +7 -0
- package/dist/schemas/embedding.d.ts.map +1 -0
- package/dist/schemas/entity.d.ts +7 -0
- package/dist/schemas/entity.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +75 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/log.d.ts +6 -0
- package/dist/schemas/log.d.ts.map +1 -0
- package/dist/schemas/memory.d.ts +7 -0
- package/dist/schemas/memory.d.ts.map +1 -0
- package/dist/schemas/message-server-agent.d.ts +7 -0
- package/dist/schemas/message-server-agent.d.ts.map +1 -0
- package/dist/schemas/message-server.d.ts +6 -0
- package/dist/schemas/message-server.d.ts.map +1 -0
- package/dist/schemas/message.d.ts +7 -0
- package/dist/schemas/message.d.ts.map +1 -0
- package/dist/schemas/pairing-allowlist.d.ts +7 -0
- package/dist/schemas/pairing-allowlist.d.ts.map +1 -0
- package/dist/schemas/pairing-request.d.ts +7 -0
- package/dist/schemas/pairing-request.d.ts.map +1 -0
- package/dist/schemas/participant.d.ts +6 -0
- package/dist/schemas/participant.d.ts.map +1 -0
- package/dist/schemas/relationship.d.ts +7 -0
- package/dist/schemas/relationship.d.ts.map +1 -0
- package/dist/schemas/room.d.ts +6 -0
- package/dist/schemas/room.d.ts.map +1 -0
- package/dist/schemas/server.d.ts +7 -0
- package/dist/schemas/server.d.ts.map +1 -0
- package/dist/schemas/task.d.ts +6 -0
- package/dist/schemas/task.d.ts.map +1 -0
- package/dist/schemas/world.d.ts +6 -0
- package/dist/schemas/world.d.ts.map +1 -0
- package/dist/search.d.ts +381 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/secrets.d.ts +6 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/security/external-content.d.ts +96 -0
- package/dist/security/external-content.d.ts.map +1 -0
- package/dist/security/index.d.ts +12 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/redact.d.ts +111 -0
- package/dist/security/redact.d.ts.map +1 -0
- package/dist/security/sandbox-token-manager.d.ts +33 -0
- package/dist/security/sandbox-token-manager.d.ts.map +1 -0
- package/dist/services/action-filter.d.ts +195 -0
- package/dist/services/action-filter.d.ts.map +1 -0
- package/dist/services/agentEvent.d.ts +297 -0
- package/dist/services/agentEvent.d.ts.map +1 -0
- package/dist/services/approval.d.ts +169 -0
- package/dist/services/approval.d.ts.map +1 -0
- package/dist/services/bm25.d.ts +51 -0
- package/dist/services/bm25.d.ts.map +1 -0
- package/dist/services/cosine-similarity.d.ts +5 -0
- package/dist/services/cosine-similarity.d.ts.map +1 -0
- package/dist/services/embedding.d.ts +47 -0
- package/dist/services/embedding.d.ts.map +1 -0
- package/dist/services/followUp.d.ts +48 -0
- package/dist/services/followUp.d.ts.map +1 -0
- package/dist/services/hook.d.ts +85 -0
- package/dist/services/hook.d.ts.map +1 -0
- package/dist/services/message.d.ts +71 -0
- package/dist/services/message.d.ts.map +1 -0
- package/dist/services/onboarding-cli.d.ts +240 -0
- package/dist/services/onboarding-cli.d.ts.map +1 -0
- package/dist/services/onboarding-rpc.d.ts +225 -0
- package/dist/services/onboarding-rpc.d.ts.map +1 -0
- package/dist/services/onboarding-state.d.ts +155 -0
- package/dist/services/onboarding-state.d.ts.map +1 -0
- package/dist/services/pairing-integration.d.ts +96 -0
- package/dist/services/pairing-integration.d.ts.map +1 -0
- package/dist/services/pairing-migration.d.ts +105 -0
- package/dist/services/pairing-migration.d.ts.map +1 -0
- package/dist/services/pairing.d.ts +80 -0
- package/dist/services/pairing.d.ts.map +1 -0
- package/dist/services/plugin-hooks.d.ts +112 -0
- package/dist/services/plugin-hooks.d.ts.map +1 -0
- package/dist/services/rolodex.d.ts +111 -0
- package/dist/services/rolodex.d.ts.map +1 -0
- package/dist/services/task-scheduler.d.ts +28 -0
- package/dist/services/task-scheduler.d.ts.map +1 -0
- package/dist/services/task.d.ts +127 -0
- package/dist/services/task.d.ts.map +1 -0
- package/dist/services/tool-policy.d.ts +186 -0
- package/dist/services/tool-policy.d.ts.map +1 -0
- package/dist/services/trajectoryLogger.d.ts +55 -0
- package/dist/services/trajectoryLogger.d.ts.map +1 -0
- package/dist/services/triggerScheduling.d.ts +29 -0
- package/dist/services/triggerScheduling.d.ts.map +1 -0
- package/dist/services/triggerWorker.d.ts +17 -0
- package/dist/services/triggerWorker.d.ts.map +1 -0
- package/dist/services/voice-cache.d.ts +14 -0
- package/dist/services/voice-cache.d.ts.map +1 -0
- package/dist/services.d.ts +61 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/sessions/index.d.ts +19 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/sessions/paths.d.ts +106 -0
- package/dist/sessions/paths.d.ts.map +1 -0
- package/dist/sessions/provider.d.ts +102 -0
- package/dist/sessions/provider.d.ts.map +1 -0
- package/dist/sessions/session-key.d.ts +201 -0
- package/dist/sessions/session-key.d.ts.map +1 -0
- package/dist/sessions/store.d.ts +116 -0
- package/dist/sessions/store.d.ts.map +1 -0
- package/dist/sessions/types.d.ts +197 -0
- package/dist/sessions/types.d.ts.map +1 -0
- package/dist/settings.d.ts +99 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/streaming-context.d.ts +78 -0
- package/dist/streaming-context.d.ts.map +1 -0
- package/dist/trajectory-context.d.ts +19 -0
- package/dist/trajectory-context.d.ts.map +1 -0
- package/dist/types/agent.d.ts +54 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agentEvent.d.ts +258 -0
- package/dist/types/agentEvent.d.ts.map +1 -0
- package/dist/types/channel-config.d.ts +167 -0
- package/dist/types/channel-config.d.ts.map +1 -0
- package/dist/types/components.d.ts +293 -0
- package/dist/types/components.d.ts.map +1 -0
- package/dist/types/database.d.ts +1087 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/environment.d.ts +61 -0
- package/dist/types/environment.d.ts.map +1 -0
- package/dist/types/events.d.ts +386 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/agent_pb.d.ts +376 -0
- package/dist/types/generated/eliza/v1/agent_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/components_pb.d.ts +364 -0
- package/dist/types/generated/eliza/v1/components_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/database_pb.d.ts +694 -0
- package/dist/types/generated/eliza/v1/database_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/environment_pb.d.ts +299 -0
- package/dist/types/generated/eliza/v1/environment_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/events_pb.d.ts +746 -0
- package/dist/types/generated/eliza/v1/events_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/ipc_pb.d.ts +799 -0
- package/dist/types/generated/eliza/v1/ipc_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/knowledge_pb.d.ts +63 -0
- package/dist/types/generated/eliza/v1/knowledge_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/memory_pb.d.ts +290 -0
- package/dist/types/generated/eliza/v1/memory_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/message_service_pb.d.ts +148 -0
- package/dist/types/generated/eliza/v1/message_service_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/messaging_pb.d.ts +214 -0
- package/dist/types/generated/eliza/v1/messaging_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/model_pb.d.ts +637 -0
- package/dist/types/generated/eliza/v1/model_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/payment_pb.d.ts +147 -0
- package/dist/types/generated/eliza/v1/payment_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/plugin_pb.d.ts +286 -0
- package/dist/types/generated/eliza/v1/plugin_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/primitives_pb.d.ts +263 -0
- package/dist/types/generated/eliza/v1/primitives_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/prompts_pb.d.ts +137 -0
- package/dist/types/generated/eliza/v1/prompts_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/service_interfaces_pb.d.ts +2687 -0
- package/dist/types/generated/eliza/v1/service_interfaces_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/service_pb.d.ts +144 -0
- package/dist/types/generated/eliza/v1/service_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/settings_pb.d.ts +146 -0
- package/dist/types/generated/eliza/v1/settings_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/state_pb.d.ts +259 -0
- package/dist/types/generated/eliza/v1/state_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/task_pb.d.ts +120 -0
- package/dist/types/generated/eliza/v1/task_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/tee_pb.d.ts +205 -0
- package/dist/types/generated/eliza/v1/tee_pb.d.ts.map +1 -0
- package/dist/types/generated/eliza/v1/testing_pb.d.ts +47 -0
- package/dist/types/generated/eliza/v1/testing_pb.d.ts.map +1 -0
- package/dist/types/hook.d.ts +338 -0
- package/dist/types/hook.d.ts.map +1 -0
- package/dist/types/index.d.ts +38 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/knowledge.d.ts +49 -0
- package/dist/types/knowledge.d.ts.map +1 -0
- package/dist/types/memory-storage.d.ts +28 -0
- package/dist/types/memory-storage.d.ts.map +1 -0
- package/dist/types/memory.d.ts +426 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/message-service.d.ts +136 -0
- package/dist/types/message-service.d.ts.map +1 -0
- package/dist/types/messaging.d.ts +358 -0
- package/dist/types/messaging.d.ts.map +1 -0
- package/dist/types/model.d.ts +631 -0
- package/dist/types/model.d.ts.map +1 -0
- package/dist/types/onboarding.d.ts +319 -0
- package/dist/types/onboarding.d.ts.map +1 -0
- package/dist/types/pairing.d.ts +124 -0
- package/dist/types/pairing.d.ts.map +1 -0
- package/dist/types/payment.d.ts +45 -0
- package/dist/types/payment.d.ts.map +1 -0
- package/dist/types/plugin-manifest.d.ts +353 -0
- package/dist/types/plugin-manifest.d.ts.map +1 -0
- package/dist/types/plugin-store.d.ts +173 -0
- package/dist/types/plugin-store.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +135 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/primitives.d.ts +170 -0
- package/dist/types/primitives.d.ts.map +1 -0
- package/dist/types/prompt-batcher.d.ts +126 -0
- package/dist/types/prompt-batcher.d.ts.map +1 -0
- package/dist/types/prompts.d.ts +39 -0
- package/dist/types/prompts.d.ts.map +1 -0
- package/dist/types/proto.d.ts +60 -0
- package/dist/types/proto.d.ts.map +1 -0
- package/dist/types/runtime.d.ts +370 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/schema-builder.d.ts +43 -0
- package/dist/types/schema-builder.d.ts.map +1 -0
- package/dist/types/schema.d.ts +99 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/service-interfaces.d.ts +1200 -0
- package/dist/types/service-interfaces.d.ts.map +1 -0
- package/dist/types/service.d.ts +172 -0
- package/dist/types/service.d.ts.map +1 -0
- package/dist/types/settings.d.ts +36 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/state.d.ts +232 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/streaming.d.ts +93 -0
- package/dist/types/streaming.d.ts.map +1 -0
- package/dist/types/task.d.ts +127 -0
- package/dist/types/task.d.ts.map +1 -0
- package/dist/types/tee.d.ts +3 -0
- package/dist/types/tee.d.ts.map +1 -0
- package/dist/types/testing.d.ts +15 -0
- package/dist/types/testing.d.ts.map +1 -0
- package/dist/types/tools.d.ts +166 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/trigger.d.ts +38 -0
- package/dist/types/trigger.d.ts.map +1 -0
- package/dist/utils/boolean.d.ts +50 -0
- package/dist/utils/boolean.d.ts.map +1 -0
- package/dist/utils/buffer.d.ts +107 -0
- package/dist/utils/buffer.d.ts.map +1 -0
- package/dist/utils/channel-utils.d.ts +274 -0
- package/dist/utils/channel-utils.d.ts.map +1 -0
- package/dist/utils/crypto-compat.d.ts +101 -0
- package/dist/utils/crypto-compat.d.ts.map +1 -0
- package/dist/utils/environment.d.ts +125 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/json-llm.d.ts +17 -0
- package/dist/utils/json-llm.d.ts.map +1 -0
- package/dist/utils/node.d.ts +8 -0
- package/dist/utils/node.d.ts.map +1 -0
- package/dist/utils/paths.d.ts +97 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/prompt-batcher/batcher.d.ts +159 -0
- package/dist/utils/prompt-batcher/batcher.d.ts.map +1 -0
- package/dist/utils/prompt-batcher/dispatcher.d.ts +15 -0
- package/dist/utils/prompt-batcher/dispatcher.d.ts.map +1 -0
- package/dist/utils/prompt-batcher/shared.d.ts +68 -0
- package/dist/utils/prompt-batcher/shared.d.ts.map +1 -0
- package/dist/utils/prompt-batcher.d.ts +5 -0
- package/dist/utils/prompt-batcher.d.ts.map +1 -0
- package/dist/utils/server-health.d.ts +35 -0
- package/dist/utils/server-health.d.ts.map +1 -0
- package/dist/utils/slice-to-fit-budget.d.ts +12 -0
- package/dist/utils/slice-to-fit-budget.d.ts.map +1 -0
- package/dist/utils/streaming.d.ts +267 -0
- package/dist/utils/streaming.d.ts.map +1 -0
- package/dist/utils/text-normalize.d.ts +23 -0
- package/dist/utils/text-normalize.d.ts.map +1 -0
- package/dist/utils/text-splitting.d.ts +14 -0
- package/dist/utils/text-splitting.d.ts.map +1 -0
- package/dist/utils/time-format.d.ts +28 -0
- package/dist/utils/time-format.d.ts.map +1 -0
- package/dist/utils/type-guards.d.ts +25 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils.d.ts +182 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/validation/index.d.ts +7 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/keywords.d.ts +26 -0
- package/dist/validation/keywords.d.ts.map +1 -0
- package/dist/validation/secrets.d.ts +94 -0
- package/dist/validation/secrets.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1087 @@
|
|
|
1
|
+
import type { Agent } from "./agent";
|
|
2
|
+
import type { Component, Entity, Participant, Relationship, Room, World } from "./environment";
|
|
3
|
+
import type { Memory, MemoryMetadata } from "./memory";
|
|
4
|
+
import type { PairingAllowlistEntry, PairingChannel, PairingRequest } from "./pairing";
|
|
5
|
+
import type { Metadata, UUID } from "./primitives";
|
|
6
|
+
import type { JsonValue, ActionLogBody as ProtoActionLogBody, ActionLogPrompt as ProtoActionLogPrompt, ActionLogResult as ProtoActionLogResult, AgentRunCounts as ProtoAgentRunCounts, AgentRunSummary as ProtoAgentRunSummary, AgentRunSummaryResult as ProtoAgentRunSummaryResult, BaseLogBody as ProtoBaseLogBody, DbRunStatus as ProtoDbRunStatus, EmbeddingLogBody as ProtoEmbeddingLogBody, EmbeddingSearchResult as ProtoEmbeddingSearchResult, EvaluatorLogBody as ProtoEvaluatorLogBody, Log as ProtoLog, ModelActionContext as ProtoModelActionContext, ModelLogBody as ProtoModelLogBody } from "./proto.js";
|
|
7
|
+
import type { Task } from "./task";
|
|
8
|
+
/**
|
|
9
|
+
* Allowed value types for log body fields
|
|
10
|
+
*/
|
|
11
|
+
export type LogBodyValue = string | number | boolean | null | undefined | UUID | Error | LogBodyValue[] | {
|
|
12
|
+
[key: string]: LogBodyValue;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Base log body type with common properties
|
|
16
|
+
*/
|
|
17
|
+
export interface BaseLogBody extends Omit<ProtoBaseLogBody, "$typeName" | "$unknown" | "metadata"> {
|
|
18
|
+
runId?: string | UUID;
|
|
19
|
+
parentRunId?: string | UUID;
|
|
20
|
+
messageId?: UUID;
|
|
21
|
+
roomId?: UUID;
|
|
22
|
+
entityId?: UUID;
|
|
23
|
+
source?: string;
|
|
24
|
+
startTime?: number | bigint;
|
|
25
|
+
endTime?: number | bigint;
|
|
26
|
+
duration?: number | bigint;
|
|
27
|
+
metadata?: Record<string, LogBodyValue>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Action log content structure
|
|
31
|
+
*/
|
|
32
|
+
export interface ActionLogContent {
|
|
33
|
+
actions?: string[];
|
|
34
|
+
text?: string;
|
|
35
|
+
thought?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Action result structure for logging
|
|
39
|
+
*/
|
|
40
|
+
export interface ActionLogResult extends Omit<ProtoActionLogResult, "$typeName" | "$unknown" | "data" | "error"> {
|
|
41
|
+
data?: Record<string, LogBodyValue>;
|
|
42
|
+
error?: string | Error;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Prompt tracking for action logs
|
|
46
|
+
*/
|
|
47
|
+
export interface ActionLogPrompt extends Omit<ProtoActionLogPrompt, "$typeName" | "$unknown" | "timestamp"> {
|
|
48
|
+
timestamp: number | bigint;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Log body for action logs
|
|
52
|
+
*/
|
|
53
|
+
export interface ActionLogBody extends Omit<ProtoActionLogBody, "$typeName" | "$unknown" | "base" | "state" | "responses" | "content" | "result" | "prompts">, BaseLogBody {
|
|
54
|
+
action?: string;
|
|
55
|
+
actionName?: string;
|
|
56
|
+
actionId?: UUID | string;
|
|
57
|
+
message?: string;
|
|
58
|
+
messageId?: UUID;
|
|
59
|
+
state?: Record<string, LogBodyValue>;
|
|
60
|
+
responses?: Array<Record<string, LogBodyValue>>;
|
|
61
|
+
content?: ActionLogContent;
|
|
62
|
+
result?: ActionLogResult;
|
|
63
|
+
isVoidReturn?: boolean;
|
|
64
|
+
prompts?: ActionLogPrompt[];
|
|
65
|
+
promptCount?: number;
|
|
66
|
+
planStep?: string;
|
|
67
|
+
planThought?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Log body for evaluator logs
|
|
71
|
+
*/
|
|
72
|
+
export interface EvaluatorLogBody extends Omit<ProtoEvaluatorLogBody, "$typeName" | "$unknown" | "base" | "state">, BaseLogBody {
|
|
73
|
+
messageId?: UUID;
|
|
74
|
+
state?: Record<string, LogBodyValue>;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Action context for model logs
|
|
78
|
+
*/
|
|
79
|
+
export type ModelActionContext = Omit<ProtoModelActionContext, "$typeName" | "$unknown">;
|
|
80
|
+
/**
|
|
81
|
+
* Log body for model logs
|
|
82
|
+
*/
|
|
83
|
+
export interface ModelLogBody extends Omit<ProtoModelLogBody, "$typeName" | "$unknown" | "base" | "params" | "response" | "actionContext" | "timestamp" | "executionTime">, BaseLogBody {
|
|
84
|
+
params?: Record<string, LogBodyValue>;
|
|
85
|
+
actionContext?: ModelActionContext;
|
|
86
|
+
timestamp?: number | bigint;
|
|
87
|
+
executionTime?: number | bigint;
|
|
88
|
+
response?: JsonValue;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Log body for embedding logs
|
|
92
|
+
*/
|
|
93
|
+
export interface EmbeddingLogBody extends Omit<ProtoEmbeddingLogBody, "$typeName" | "$unknown" | "base" | "duration">, BaseLogBody {
|
|
94
|
+
duration?: number | bigint;
|
|
95
|
+
error?: string | Error;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Union type for all possible log body types
|
|
99
|
+
*/
|
|
100
|
+
export type LogBody = BaseLogBody | ActionLogBody | EvaluatorLogBody | ModelLogBody | EmbeddingLogBody;
|
|
101
|
+
/**
|
|
102
|
+
* Represents a log entry
|
|
103
|
+
*/
|
|
104
|
+
export interface Log extends Omit<ProtoLog, "$typeName" | "$unknown" | "body" | "createdAt" | "entityId" | "roomId"> {
|
|
105
|
+
entityId: UUID;
|
|
106
|
+
roomId?: UUID;
|
|
107
|
+
body: LogBody;
|
|
108
|
+
createdAt: Date;
|
|
109
|
+
}
|
|
110
|
+
export type RunStatus = "started" | "completed" | "timeout" | "error";
|
|
111
|
+
/**
|
|
112
|
+
* JSON Patch operation for atomic component data updates.
|
|
113
|
+
*
|
|
114
|
+
* WHY: Enables race-free partial updates to component JSONB data without
|
|
115
|
+
* read-modify-write cycles. All operations are applied in a single UPDATE
|
|
116
|
+
* statement using dialect-specific JSONB functions.
|
|
117
|
+
*
|
|
118
|
+
* OPERATIONS:
|
|
119
|
+
* - set: Set a value at path (creates path if missing)
|
|
120
|
+
* - push: Append value to array at path (errors if not array)
|
|
121
|
+
* - remove: Delete the key/index at path (idempotent if missing)
|
|
122
|
+
* - increment: Add numeric value to number at path (errors if not number)
|
|
123
|
+
*
|
|
124
|
+
* PATH FORMAT:
|
|
125
|
+
* - Dot-separated: "wallet.balance" or "positions.0.open"
|
|
126
|
+
* - Only alphanumeric, underscore, and numeric array indices allowed
|
|
127
|
+
* - Validated with regex to prevent SQL injection
|
|
128
|
+
*/
|
|
129
|
+
export interface PatchOp {
|
|
130
|
+
/** Operation type */
|
|
131
|
+
op: "set" | "push" | "remove" | "increment";
|
|
132
|
+
/**
|
|
133
|
+
* Dot-separated path to the field (e.g., "wallet.balance", "items.0.name")
|
|
134
|
+
* Validated against /^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*|\.\d+)*$/
|
|
135
|
+
*/
|
|
136
|
+
path: string;
|
|
137
|
+
/**
|
|
138
|
+
* Value for the operation
|
|
139
|
+
* - Required for: set, push, increment
|
|
140
|
+
* - Ignored for: remove
|
|
141
|
+
*/
|
|
142
|
+
value?: unknown;
|
|
143
|
+
}
|
|
144
|
+
/** Participant room state for batch get/update (getParticipantUserStates, updateParticipantUserStates). */
|
|
145
|
+
export type ParticipantUserState = "FOLLOWED" | "MUTED" | null;
|
|
146
|
+
/** Fields that can be updated on a participant (Participant + DB-only roomState/metadata). */
|
|
147
|
+
export type ParticipantUpdateFields = Partial<Participant> & {
|
|
148
|
+
roomState?: ParticipantUserState;
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
150
|
+
};
|
|
151
|
+
/** Result of getEntitiesForRooms: one entry per requested roomId, same order. */
|
|
152
|
+
export type EntitiesForRoomsResult = Array<{
|
|
153
|
+
roomId: UUID;
|
|
154
|
+
entities: Entity[];
|
|
155
|
+
}>;
|
|
156
|
+
/** Result of getParticipantsForRooms: one entry per requested roomId, same order. */
|
|
157
|
+
export type ParticipantsForRoomsResult = Array<{
|
|
158
|
+
roomId: UUID;
|
|
159
|
+
entityIds: UUID[];
|
|
160
|
+
}>;
|
|
161
|
+
/** Result of getPairingRequests batch: one entry per (channel, agentId) query, same order. */
|
|
162
|
+
export type PairingRequestsResult = Array<{
|
|
163
|
+
channel: PairingChannel;
|
|
164
|
+
agentId: UUID;
|
|
165
|
+
requests: PairingRequest[];
|
|
166
|
+
}>;
|
|
167
|
+
/** Result of getPairingAllowlists batch: one entry per (channel, agentId) query, same order. */
|
|
168
|
+
export type PairingAllowlistsResult = Array<{
|
|
169
|
+
channel: PairingChannel;
|
|
170
|
+
agentId: UUID;
|
|
171
|
+
entries: PairingAllowlistEntry[];
|
|
172
|
+
}>;
|
|
173
|
+
export interface AgentRunCounts extends Omit<ProtoAgentRunCounts, "$typeName" | "$unknown"> {
|
|
174
|
+
}
|
|
175
|
+
export interface AgentRunSummary extends Omit<ProtoAgentRunSummary, "$typeName" | "$unknown" | "status" | "startedAt" | "endedAt" | "durationMs" | "metadata"> {
|
|
176
|
+
status: RunStatus | ProtoDbRunStatus;
|
|
177
|
+
startedAt: number | bigint | null;
|
|
178
|
+
endedAt: number | bigint | null;
|
|
179
|
+
durationMs: number | bigint | null;
|
|
180
|
+
metadata?: Record<string, JsonValue>;
|
|
181
|
+
}
|
|
182
|
+
export interface AgentRunSummaryResult extends Omit<ProtoAgentRunSummaryResult, "$typeName" | "$unknown"> {
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Interface for database operations.
|
|
186
|
+
*
|
|
187
|
+
* **Design: Batch-First CRUD**
|
|
188
|
+
*
|
|
189
|
+
* All create/read-by-ID/update/delete methods accept and return arrays.
|
|
190
|
+
* This is intentional and non-negotiable for adapter implementations.
|
|
191
|
+
*
|
|
192
|
+
* WHY: elizaOS agents process events that frequently touch multiple DB rows
|
|
193
|
+
* in a single tick -- load entity + room, store memory + log, clean up tasks.
|
|
194
|
+
* Under the old single-item API, each was a separate round-trip. At scale
|
|
195
|
+
* (multiple agents, concurrent conversations), this saturated connection pools
|
|
196
|
+
* and made network latency the bottleneck. Batch methods let SQL adapters use
|
|
197
|
+
* `IN (...)` clauses, multi-row inserts, and transactions -- actual DB-level
|
|
198
|
+
* batching instead of application-level loops.
|
|
199
|
+
*
|
|
200
|
+
* Single-item convenience wrappers (e.g. `getAgent(id)`) live on `AgentRuntime`
|
|
201
|
+
* and `IAgentRuntime`, NOT here. They delegate to batch methods internally.
|
|
202
|
+
* This keeps the adapter contract simple: implement batch, get single-item free.
|
|
203
|
+
*
|
|
204
|
+
* **Query methods** (complex filter params, not ID lookups) remain singular because
|
|
205
|
+
* batching `searchMemories` would mean "run N different searches" -- a fundamentally
|
|
206
|
+
* different operation than "look up N items by their IDs."
|
|
207
|
+
*
|
|
208
|
+
* See DATABASE_BATCH_API.md for the full design rationale and migration guide.
|
|
209
|
+
*/
|
|
210
|
+
export interface IDatabaseAdapter<DB extends object = object> {
|
|
211
|
+
/** Database instance */
|
|
212
|
+
db: DB;
|
|
213
|
+
/**
|
|
214
|
+
* Initialize database connection
|
|
215
|
+
*
|
|
216
|
+
* WHY: Async initialization allows:
|
|
217
|
+
* - Connection pooling setup
|
|
218
|
+
* - Schema validation and migrations
|
|
219
|
+
* - SSL/TLS handshake completion
|
|
220
|
+
* - Adapter-specific configuration (RLS policies, extensions, etc.)
|
|
221
|
+
*
|
|
222
|
+
* @param config Optional adapter-specific configuration
|
|
223
|
+
*/
|
|
224
|
+
initialize(config?: Record<string, string | number | boolean | null>): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Run plugin schema migrations for all registered plugins
|
|
227
|
+
* @param plugins Array of plugins with their schemas
|
|
228
|
+
* @param options Migration options (verbose, force, dryRun, etc.)
|
|
229
|
+
*/
|
|
230
|
+
runPluginMigrations?(plugins: Array<{
|
|
231
|
+
name: string;
|
|
232
|
+
schema?: Record<string, JsonValue | object>;
|
|
233
|
+
}>, options?: {
|
|
234
|
+
verbose?: boolean;
|
|
235
|
+
force?: boolean;
|
|
236
|
+
dryRun?: boolean;
|
|
237
|
+
}): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Run database migrations from migration files
|
|
240
|
+
* @param migrationsPaths Optional array of migration file paths
|
|
241
|
+
*/
|
|
242
|
+
runMigrations?(migrationsPaths?: string[]): Promise<void>;
|
|
243
|
+
/** Check if the database connection is ready */
|
|
244
|
+
isReady(): Promise<boolean>;
|
|
245
|
+
/** Close database connection */
|
|
246
|
+
close(): Promise<void>;
|
|
247
|
+
getConnection(): Promise<DB>;
|
|
248
|
+
/**
|
|
249
|
+
* Execute a callback with full isolation context (Server RLS + Entity RLS).
|
|
250
|
+
*
|
|
251
|
+
* WHY: PostgreSQL Row Level Security requires setting session variables before
|
|
252
|
+
* queries. This method sets the entity (and optionally server) context and
|
|
253
|
+
* executes the callback within that context.
|
|
254
|
+
*
|
|
255
|
+
* WHY unknown context parameter: Different backends provide different context
|
|
256
|
+
* types (Drizzle transaction for SQL, nothing for in-memory). Callers that
|
|
257
|
+
* need the context can cast `ctx` to the appropriate type.
|
|
258
|
+
*
|
|
259
|
+
* @param entityId - The entity ID to set as context (null clears context)
|
|
260
|
+
* @param callback - Function to execute within isolation context
|
|
261
|
+
* @returns The result of the callback
|
|
262
|
+
*/
|
|
263
|
+
withIsolationContext?<T>(entityId: UUID | null, callback: (ctx: unknown) => Promise<T>): Promise<T>;
|
|
264
|
+
/** Get all agents */
|
|
265
|
+
getAgents(): Promise<Partial<Agent>[]>;
|
|
266
|
+
getAgentsByIds(agentIds: UUID[]): Promise<Agent[]>;
|
|
267
|
+
createAgents(agents: Partial<Agent>[]): Promise<UUID[]>;
|
|
268
|
+
updateAgents(updates: Array<{
|
|
269
|
+
agentId: UUID;
|
|
270
|
+
agent: Partial<Agent>;
|
|
271
|
+
}>): Promise<boolean>;
|
|
272
|
+
deleteAgents(agentIds: UUID[]): Promise<boolean>;
|
|
273
|
+
/**
|
|
274
|
+
* Upsert agents (insert or update by ID)
|
|
275
|
+
*
|
|
276
|
+
* WHY: Atomic insert-or-update eliminates the get-check-create race condition
|
|
277
|
+
* in `ensureAgentExists`. Single SQL statement is safer and faster.
|
|
278
|
+
*
|
|
279
|
+
* WHY on adapter interface: PostgreSQL and MySQL can perform this atomically
|
|
280
|
+
* (ON CONFLICT / ON DUPLICATE KEY), so it belongs on the adapter. InMemory
|
|
281
|
+
* simulates with has()/set(), which is acceptable.
|
|
282
|
+
*
|
|
283
|
+
* WHY void return: Upserts don't create new IDs - the caller already has them.
|
|
284
|
+
* Returning UUID[] suggests creation, which is misleading for updates.
|
|
285
|
+
*
|
|
286
|
+
* IMPLEMENTATION NOTES:
|
|
287
|
+
* - PostgreSQL: INSERT ... ON CONFLICT (id) DO UPDATE SET ...
|
|
288
|
+
* - MySQL: INSERT ... ON DUPLICATE KEY UPDATE ...
|
|
289
|
+
* - InMemory: map.has(id) ? map.set(id, merged) : map.set(id, agent)
|
|
290
|
+
*
|
|
291
|
+
* @param agents Agents to upsert (ID is required for each)
|
|
292
|
+
*/
|
|
293
|
+
upsertAgents(agents: Partial<Agent>[]): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Count total number of agents in the database
|
|
296
|
+
*
|
|
297
|
+
* WHY: Useful for admin dashboards, monitoring, and quota checks.
|
|
298
|
+
* Simple count query that doesn't fetch full agent records.
|
|
299
|
+
*
|
|
300
|
+
* @returns Total count of agents
|
|
301
|
+
*/
|
|
302
|
+
countAgents(): Promise<number>;
|
|
303
|
+
/**
|
|
304
|
+
* Remove agents that haven't been active recently
|
|
305
|
+
*
|
|
306
|
+
* WHY: Cleanup stale agents for multi-tenant systems or dev environments
|
|
307
|
+
* where agents are created for testing and then abandoned. Prevents
|
|
308
|
+
* database bloat from accumulating test/demo agents.
|
|
309
|
+
*
|
|
310
|
+
* IMPLEMENTATION NOTE: Deletion criteria varies by adapter. SQL adapters
|
|
311
|
+
* typically use updatedAt < 30 days ago. InMemory adapters may do nothing.
|
|
312
|
+
*/
|
|
313
|
+
cleanupAgents(): Promise<void>;
|
|
314
|
+
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
315
|
+
/**
|
|
316
|
+
* Execute a callback within a database transaction.
|
|
317
|
+
*
|
|
318
|
+
* WHY: Enables cross-method atomicity. Each batch method (createEntities,
|
|
319
|
+
* upsertComponents, etc.) is already internally atomic. transaction() is for
|
|
320
|
+
* when you need multiple methods to succeed or fail together.
|
|
321
|
+
*
|
|
322
|
+
* EXAMPLE: Create entity + its components atomically:
|
|
323
|
+
* ```
|
|
324
|
+
* await adapter.transaction(async (tx) => {
|
|
325
|
+
* await tx.createEntities([entity]);
|
|
326
|
+
* await tx.createComponents(components);
|
|
327
|
+
* });
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* IMPLEMENTATION:
|
|
331
|
+
* - SQL adapters: Use Drizzle's transaction() with prototype proxy pattern
|
|
332
|
+
* - InMemory: Executes callback directly (NOT atomic - see warning below)
|
|
333
|
+
*
|
|
334
|
+
* TRAP - InMemory non-atomicity: The InMemory adapter does NOT provide true
|
|
335
|
+
* transaction semantics. If step 2 fails, step 1's changes are NOT rolled back.
|
|
336
|
+
* This is acceptable for dev/test but NOT for production critical paths.
|
|
337
|
+
*
|
|
338
|
+
* @param callback Function that receives a transactional adapter proxy
|
|
339
|
+
* @param options.entityContext When set (Postgres + ENABLE_DATA_ISOLATION), runs callback under RLS for this entity.
|
|
340
|
+
* WHY optional: System paths (migrations, boot, admin) run without a user entity; required would break them.
|
|
341
|
+
* @returns Promise resolving to callback's return value
|
|
342
|
+
* @throws Error if any operation in the callback fails (SQL: rolls back, InMemory: does NOT)
|
|
343
|
+
*/
|
|
344
|
+
transaction<T>(callback: (tx: IDatabaseAdapter<DB>) => Promise<T>, options?: {
|
|
345
|
+
entityContext?: UUID;
|
|
346
|
+
}): Promise<T>;
|
|
347
|
+
/** Get entities for multiple rooms (one entry per roomId, same order). */
|
|
348
|
+
getEntitiesForRooms(roomIds: UUID[], includeComponents?: boolean): Promise<EntitiesForRoomsResult>;
|
|
349
|
+
/** Create new entities */
|
|
350
|
+
createEntities(entities: Entity[]): Promise<UUID[]>;
|
|
351
|
+
/**
|
|
352
|
+
* Upsert entities (insert or update by ID)
|
|
353
|
+
*
|
|
354
|
+
* WHY: Atomic insert-or-update eliminates race conditions in `ensureEntityExists`.
|
|
355
|
+
* Entities may be created concurrently from multiple sources (client plugins,
|
|
356
|
+
* RPC handlers, background jobs). Atomic upsert prevents duplicates.
|
|
357
|
+
*
|
|
358
|
+
* WHY on adapter interface: All SQL dialects support atomic upserts, so this
|
|
359
|
+
* belongs on the adapter, not as runtime-level get-then-create orchestration.
|
|
360
|
+
*
|
|
361
|
+
* WHY void return: Caller already has the entity IDs. Upserts don't generate
|
|
362
|
+
* new IDs - they're idempotent operations where the ID is the lookup key.
|
|
363
|
+
*
|
|
364
|
+
* IMPLEMENTATION NOTES:
|
|
365
|
+
* - PostgreSQL: INSERT ... ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, ...
|
|
366
|
+
* - MySQL: INSERT ... ON DUPLICATE KEY UPDATE name = VALUES(name), ...
|
|
367
|
+
* - InMemory: entities.set(id, merged)
|
|
368
|
+
* - Conflict resolution: Last write wins (update all fields from input)
|
|
369
|
+
*
|
|
370
|
+
* @param entities Entities to upsert (ID, agentId, name required)
|
|
371
|
+
*/
|
|
372
|
+
upsertEntities(entities: Entity[]): Promise<void>;
|
|
373
|
+
/**
|
|
374
|
+
* Search entities by name substring match
|
|
375
|
+
*
|
|
376
|
+
* WHY: Enables autocomplete/search UIs for entity mentions (e.g., "@user"
|
|
377
|
+
* in Discord, entity picker in admin dashboards). Case-insensitive substring
|
|
378
|
+
* search across all entity names.
|
|
379
|
+
*
|
|
380
|
+
* WHY on adapter interface: SQL adapters use ILIKE/LOWER() with GIN indexes
|
|
381
|
+
* on the names array. InMemory adapters iterate and filter. This search
|
|
382
|
+
* pattern is common enough to warrant a dedicated method.
|
|
383
|
+
*
|
|
384
|
+
* PERFORMANCE:
|
|
385
|
+
* - PostgreSQL: Uses GIN index on names array + ILIKE for case-insensitive
|
|
386
|
+
* - MySQL: Uses JSON_TABLE + LIKE (slower, no ideal index)
|
|
387
|
+
* - InMemory: O(N) scan with substring match
|
|
388
|
+
*
|
|
389
|
+
* @param params.query Substring to search for (case-insensitive)
|
|
390
|
+
* @param params.agentId Scope search to this agent's entities
|
|
391
|
+
* @param params.limit Max results (default: 10)
|
|
392
|
+
* @returns Matching entities, ordered by relevance (exact matches first)
|
|
393
|
+
*/
|
|
394
|
+
searchEntitiesByName(params: {
|
|
395
|
+
query: string;
|
|
396
|
+
agentId: UUID;
|
|
397
|
+
limit?: number;
|
|
398
|
+
}): Promise<Entity[]>;
|
|
399
|
+
/**
|
|
400
|
+
* Get entities by exact name match
|
|
401
|
+
*
|
|
402
|
+
* WHY: Batch lookup for entities by their display names. Used when importing
|
|
403
|
+
* data from external systems where entities are identified by name, not UUID.
|
|
404
|
+
*
|
|
405
|
+
* WHY batch: When syncing a channel with 50 participants, we need to resolve
|
|
406
|
+
* all their names to entity IDs in one query, not 50 separate queries.
|
|
407
|
+
*
|
|
408
|
+
* IMPLEMENTATION NOTE: Matches ANY name in the entity's names array (entities
|
|
409
|
+
* can have aliases/nicknames). Case-sensitive exact match.
|
|
410
|
+
*
|
|
411
|
+
* @param params.names Array of names to look up
|
|
412
|
+
* @param params.agentId Scope to this agent's entities
|
|
413
|
+
* @returns Entities with matching names (may return fewer than names.length)
|
|
414
|
+
*/
|
|
415
|
+
getEntitiesByNames(params: {
|
|
416
|
+
names: string[];
|
|
417
|
+
agentId: UUID;
|
|
418
|
+
}): Promise<Entity[]>;
|
|
419
|
+
/**
|
|
420
|
+
* Query entities by component properties (type and/or data filter)
|
|
421
|
+
*
|
|
422
|
+
* WHY: Eliminates multi-hop fetch patterns like "get all user IDs → getEntitiesByIds →
|
|
423
|
+
* filter for ACCOUNT components → extract wallet data". Collapses 3+ queries into one
|
|
424
|
+
* database-optimized query with JSONB containment filtering.
|
|
425
|
+
*
|
|
426
|
+
* This is the highest-impact API addition, replacing patterns like:
|
|
427
|
+
* - int_accounts.ts: "get accounts by pubkey" (240 lines → 10 lines)
|
|
428
|
+
* - int_users.ts: "get users by type" (multi-step ID resolution)
|
|
429
|
+
* - int_spartan.ts: master registry becomes unnecessary
|
|
430
|
+
*
|
|
431
|
+
* TWO-QUERY APPROACH (critical for correctness):
|
|
432
|
+
* 1. Query 1: SELECT DISTINCT entity_id FROM components WHERE ... LIMIT N
|
|
433
|
+
* 2. Query 2: SELECT entities.*, components.* WHERE entity_id IN (...)
|
|
434
|
+
*
|
|
435
|
+
* WHY two queries: A single SELECT DISTINCT ... JOIN ... LIMIT can return fewer
|
|
436
|
+
* than LIMIT entities if entities have multiple components (DISTINCT dedupes AFTER
|
|
437
|
+
* LIMIT). Two queries ensures LIMIT applies to entity count, not row count.
|
|
438
|
+
*
|
|
439
|
+
* JSONB CONTAINMENT (@> operator):
|
|
440
|
+
* - {"wallet": {"chain": "solana"}} @> {"wallet": {"chain": "solana"}} ✓
|
|
441
|
+
* - {"tags": ["admin","user"]} @> {"tags": ["admin"]} ✓ (containment, not equality)
|
|
442
|
+
* - Exploits GIN index on components.data for O(log N) performance
|
|
443
|
+
*
|
|
444
|
+
* FILTER VALIDATION:
|
|
445
|
+
* - If no componentType, no componentDataFilter, no entityIds: MUST throw unless limit set
|
|
446
|
+
* - Prevents accidental full table scans from queryEntities({})
|
|
447
|
+
*
|
|
448
|
+
* @param params.componentType Filter by component type (e.g., "ACCOUNT", "WALLET")
|
|
449
|
+
* @param params.componentDataFilter JSONB containment filter on component.data
|
|
450
|
+
* @param params.agentId Scope query to agent's entities
|
|
451
|
+
* @param params.entityIds Explicit list of entity IDs to filter
|
|
452
|
+
* @param params.worldId Filter by world context
|
|
453
|
+
* @param params.limit Max entities to return (applies to distinct entities, not rows)
|
|
454
|
+
* @param params.offset Skip first N entities for pagination
|
|
455
|
+
* @param params.includeAllComponents If false (default): return only matched component type.
|
|
456
|
+
* If true: return all components for matched entities.
|
|
457
|
+
* @returns Entities with their components (filtered by includeAllComponents)
|
|
458
|
+
*/
|
|
459
|
+
queryEntities(params: {
|
|
460
|
+
componentType?: string;
|
|
461
|
+
componentDataFilter?: Record<string, unknown>;
|
|
462
|
+
agentId?: UUID;
|
|
463
|
+
entityIds?: UUID[];
|
|
464
|
+
worldId?: UUID;
|
|
465
|
+
limit?: number;
|
|
466
|
+
offset?: number;
|
|
467
|
+
includeAllComponents?: boolean;
|
|
468
|
+
/** RLS only: when set (Postgres + ENABLE_DATA_ISOLATION), query runs under this entity context. Not a filter (WHY: RLS is connection-level; stores do not take entityContext). */
|
|
469
|
+
entityContext?: UUID;
|
|
470
|
+
}): Promise<Entity[]>;
|
|
471
|
+
/** Get components by natural keys (entityId, type, worldId?, sourceEntityId?). Same order as keys; null where not found. */
|
|
472
|
+
getComponentsByNaturalKeys(keys: Array<{
|
|
473
|
+
entityId: UUID;
|
|
474
|
+
type: string;
|
|
475
|
+
worldId?: UUID;
|
|
476
|
+
sourceEntityId?: UUID;
|
|
477
|
+
}>): Promise<(Component | null)[]>;
|
|
478
|
+
/** Get all components for multiple entities. Flat list (components have entityId). */
|
|
479
|
+
getComponentsForEntities(entityIds: UUID[], worldId?: UUID, sourceEntityId?: UUID): Promise<Component[]>;
|
|
480
|
+
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[]>;
|
|
481
|
+
updateEntities(entities: Entity[]): Promise<void>;
|
|
482
|
+
deleteEntities(entityIds: UUID[]): Promise<void>;
|
|
483
|
+
createComponents(components: Component[]): Promise<UUID[]>;
|
|
484
|
+
getComponentsByIds(componentIds: UUID[]): Promise<Component[]>;
|
|
485
|
+
updateComponents(components: Component[]): Promise<void>;
|
|
486
|
+
deleteComponents(componentIds: UUID[]): Promise<void>;
|
|
487
|
+
/**
|
|
488
|
+
* Upsert components (insert or update by natural key)
|
|
489
|
+
*
|
|
490
|
+
* WHY: Completes the upsert pattern established by upsertAgents, upsertEntities,
|
|
491
|
+
* upsertWorlds, upsertRooms. Components have a composite natural key of
|
|
492
|
+
* (entityId, type, worldId, sourceEntityId). Atomic upsert eliminates race
|
|
493
|
+
* conditions when multiple code paths try to ensure a component exists.
|
|
494
|
+
*
|
|
495
|
+
* WHY natural key, not ID: The caller knows the component's semantic identity
|
|
496
|
+
* (which entity, which type, which world context) but may not know if a
|
|
497
|
+
* component with those properties already exists. The database enforces
|
|
498
|
+
* uniqueness via the unique_component_natural_key constraint.
|
|
499
|
+
*
|
|
500
|
+
* CONFLICT RESOLUTION:
|
|
501
|
+
* - On conflict: UPDATE data, agentId, roomId (mutable state)
|
|
502
|
+
* - Do NOT update: id, entityId, type, worldId, sourceEntityId (identity)
|
|
503
|
+
* - Do NOT update: createdAt (preserve original timestamp)
|
|
504
|
+
*
|
|
505
|
+
* IMPLEMENTATION NOTES:
|
|
506
|
+
* - PostgreSQL: INSERT ... ON CONFLICT (entity_id, type, world_id, source_entity_id)
|
|
507
|
+
* DO UPDATE SET data = EXCLUDED.data, ...
|
|
508
|
+
* Requires unique_component_natural_key constraint with NULLS NOT DISTINCT
|
|
509
|
+
* - MySQL: INSERT ... ON DUPLICATE KEY UPDATE data = VALUES(data), ...
|
|
510
|
+
* Requires UNIQUE KEY on (entity_id, type, world_id, source_entity_id)
|
|
511
|
+
* - InMemory: Find by natural key, update if found, insert if not
|
|
512
|
+
*
|
|
513
|
+
* TRAP: If input contains duplicate natural keys, dedupe first (last-wins).
|
|
514
|
+
* PostgreSQL will error: "ON CONFLICT DO UPDATE command cannot affect row a second time"
|
|
515
|
+
*
|
|
516
|
+
* @param components Components to upsert (id, entityId, type, data required)
|
|
517
|
+
* @param options.entityContext When set (Postgres + ENABLE_DATA_ISOLATION), upsert runs under RLS for this entity.
|
|
518
|
+
*/
|
|
519
|
+
upsertComponents(components: Component[], options?: {
|
|
520
|
+
entityContext?: UUID;
|
|
521
|
+
}): Promise<void>;
|
|
522
|
+
/**
|
|
523
|
+
* Batch patch components (JSON Patch ops per component). Run in a transaction; all commit or all roll back.
|
|
524
|
+
* @param updates Array of { componentId, ops }
|
|
525
|
+
* @param options.entityContext When set (Postgres + ENABLE_DATA_ISOLATION), patch runs under RLS for this entity.
|
|
526
|
+
*/
|
|
527
|
+
patchComponents(updates: Array<{
|
|
528
|
+
componentId: UUID;
|
|
529
|
+
ops: PatchOp[];
|
|
530
|
+
}>, options?: {
|
|
531
|
+
entityContext?: UUID;
|
|
532
|
+
}): Promise<void>;
|
|
533
|
+
/**
|
|
534
|
+
* Get memories matching criteria
|
|
535
|
+
*
|
|
536
|
+
* WHY metadata parameter: Eliminates the "fetch 50K rows, filter in JS" antipattern
|
|
537
|
+
* seen in plugin-knowledge. Database-level JSON filtering is 50-100x faster:
|
|
538
|
+
* - PostgreSQL: Uses GIN-indexed @> operator on jsonb columns
|
|
539
|
+
* - MySQL: Uses JSON_CONTAINS() function
|
|
540
|
+
* - InMemory: Deep equality check (less efficient but correct)
|
|
541
|
+
*
|
|
542
|
+
* WHY limit/offset: Standard pagination naming (limit = max results, offset = skip N).
|
|
543
|
+
* The deprecated 'count' parameter is kept for backward compatibility.
|
|
544
|
+
*
|
|
545
|
+
* @param params.metadata Filter by metadata fields (partial object match)
|
|
546
|
+
* @param params.limit Max results to return (replaces deprecated 'count')
|
|
547
|
+
* @param params.offset Skip first N results for pagination
|
|
548
|
+
* @param params.tableName Memory type/table (required)
|
|
549
|
+
*/
|
|
550
|
+
getMemories(params: {
|
|
551
|
+
entityId?: UUID;
|
|
552
|
+
agentId?: UUID;
|
|
553
|
+
/** @deprecated use limit */
|
|
554
|
+
count?: number;
|
|
555
|
+
limit?: number;
|
|
556
|
+
offset?: number;
|
|
557
|
+
unique?: boolean;
|
|
558
|
+
tableName: string;
|
|
559
|
+
start?: number;
|
|
560
|
+
end?: number;
|
|
561
|
+
roomId?: UUID;
|
|
562
|
+
worldId?: UUID;
|
|
563
|
+
metadata?: Record<string, unknown>;
|
|
564
|
+
/**
|
|
565
|
+
* Order by column (currently only 'createdAt' supported for security).
|
|
566
|
+
* Whitelisted to prevent SQL injection. Default behavior: ORDER BY created_at DESC.
|
|
567
|
+
*/
|
|
568
|
+
orderBy?: "createdAt";
|
|
569
|
+
/**
|
|
570
|
+
* Order direction. Default: 'desc' (newest first, current hardcoded behavior).
|
|
571
|
+
*/
|
|
572
|
+
orderDirection?: "asc" | "desc";
|
|
573
|
+
}): Promise<Memory[]>;
|
|
574
|
+
getMemoriesByIds(ids: UUID[], tableName?: string): Promise<Memory[]>;
|
|
575
|
+
getMemoriesByRoomIds(params: {
|
|
576
|
+
tableName: string;
|
|
577
|
+
roomIds: UUID[];
|
|
578
|
+
limit?: number;
|
|
579
|
+
}): Promise<Memory[]>;
|
|
580
|
+
getCachedEmbeddings(params: {
|
|
581
|
+
query_table_name: string;
|
|
582
|
+
query_threshold: number;
|
|
583
|
+
query_input: string;
|
|
584
|
+
query_field_name: string;
|
|
585
|
+
query_field_sub_name: string;
|
|
586
|
+
query_match_count: number;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
embedding: number[];
|
|
589
|
+
levenshtein_score: number;
|
|
590
|
+
}[]>;
|
|
591
|
+
getLogs(params: {
|
|
592
|
+
entityId?: UUID;
|
|
593
|
+
roomId?: UUID;
|
|
594
|
+
type?: string;
|
|
595
|
+
/** @deprecated use limit */
|
|
596
|
+
count?: number;
|
|
597
|
+
limit?: number;
|
|
598
|
+
offset?: number;
|
|
599
|
+
}): Promise<Log[]>;
|
|
600
|
+
createLogs(params: Array<{
|
|
601
|
+
body: LogBody;
|
|
602
|
+
entityId: UUID;
|
|
603
|
+
roomId: UUID;
|
|
604
|
+
type: string;
|
|
605
|
+
}>): Promise<void>;
|
|
606
|
+
/**
|
|
607
|
+
* Get logs by their IDs
|
|
608
|
+
*
|
|
609
|
+
* WHY: Batch lookup for specific log entries. Used when rendering agent
|
|
610
|
+
* run history or debugging specific interactions (e.g., "show me all logs
|
|
611
|
+
* from this conversation turn").
|
|
612
|
+
*
|
|
613
|
+
* @param logIds Array of log IDs to fetch
|
|
614
|
+
* @returns Array of logs (only found logs returned, no nulls)
|
|
615
|
+
*/
|
|
616
|
+
getLogsByIds(logIds: UUID[]): Promise<Log[]>;
|
|
617
|
+
/**
|
|
618
|
+
* Update logs (batch)
|
|
619
|
+
*
|
|
620
|
+
* WHY: Agent run summaries update log status/metadata after completion.
|
|
621
|
+
* Logs aren't truly immutable - their status field changes as runs progress
|
|
622
|
+
* (pending → running → completed → failed).
|
|
623
|
+
*
|
|
624
|
+
* WHY batch: When an agent run completes, it updates status for all logs
|
|
625
|
+
* in that run (model call log, action logs, evaluator logs).
|
|
626
|
+
*
|
|
627
|
+
* @param logs Array of {id, updates} where updates is a partial Log
|
|
628
|
+
*/
|
|
629
|
+
updateLogs(logs: Array<{
|
|
630
|
+
id: UUID;
|
|
631
|
+
updates: Partial<Log>;
|
|
632
|
+
}>): Promise<void>;
|
|
633
|
+
deleteLogs(logIds: UUID[]): Promise<void>;
|
|
634
|
+
getAgentRunSummaries?(params: {
|
|
635
|
+
limit?: number;
|
|
636
|
+
roomId?: UUID;
|
|
637
|
+
status?: RunStatus | "all";
|
|
638
|
+
from?: number;
|
|
639
|
+
to?: number;
|
|
640
|
+
entityId?: UUID;
|
|
641
|
+
}): Promise<AgentRunSummaryResult>;
|
|
642
|
+
searchMemories(params: {
|
|
643
|
+
embedding: number[];
|
|
644
|
+
match_threshold?: number;
|
|
645
|
+
/** @deprecated use limit */
|
|
646
|
+
count?: number;
|
|
647
|
+
limit?: number;
|
|
648
|
+
unique?: boolean;
|
|
649
|
+
tableName: string;
|
|
650
|
+
query?: string;
|
|
651
|
+
roomId?: UUID;
|
|
652
|
+
worldId?: UUID;
|
|
653
|
+
entityId?: UUID;
|
|
654
|
+
}): Promise<Memory[]>;
|
|
655
|
+
/**
|
|
656
|
+
* Batch create memories
|
|
657
|
+
*
|
|
658
|
+
* WHY UUID[] return: Returns the IDs of created memories, enabling immediate
|
|
659
|
+
* follow-up operations (e.g., linking to external systems, creating relationships).
|
|
660
|
+
* Changed from boolean return which was ambiguous (false = failed OR already exists?).
|
|
661
|
+
*
|
|
662
|
+
* @returns Array of created memory IDs (in same order as input)
|
|
663
|
+
*/
|
|
664
|
+
createMemories(memories: Array<{
|
|
665
|
+
memory: Memory;
|
|
666
|
+
tableName: string;
|
|
667
|
+
unique?: boolean;
|
|
668
|
+
}>): Promise<UUID[]>;
|
|
669
|
+
/**
|
|
670
|
+
* Batch update memories
|
|
671
|
+
*
|
|
672
|
+
* WHY void return: Updates should throw on failure (fail-fast principle).
|
|
673
|
+
* Changed from boolean[] which created ambiguity about whether to continue
|
|
674
|
+
* processing after a failed update. Now failures are exceptional, not expected.
|
|
675
|
+
*
|
|
676
|
+
* WHY batch: SQL adapters use CASE expressions for single UPDATE statement:
|
|
677
|
+
* UPDATE memories SET content = CASE
|
|
678
|
+
* WHEN id = $1 THEN $2
|
|
679
|
+
* WHEN id = $3 THEN $4
|
|
680
|
+
* ...
|
|
681
|
+
* WHERE id IN ($1, $3, ...)
|
|
682
|
+
*
|
|
683
|
+
* @throws Error if any update fails (transaction rolls back)
|
|
684
|
+
*/
|
|
685
|
+
updateMemories(memories: Array<Partial<Memory> & {
|
|
686
|
+
id: UUID;
|
|
687
|
+
metadata?: MemoryMetadata;
|
|
688
|
+
}>): Promise<void>;
|
|
689
|
+
deleteMemories(memoryIds: UUID[]): Promise<void>;
|
|
690
|
+
/**
|
|
691
|
+
* Upsert memories (insert or update by ID)
|
|
692
|
+
*
|
|
693
|
+
* WHY: Completes the upsert pattern. Unlike createMemories (which uses ON CONFLICT
|
|
694
|
+
* DO NOTHING to skip duplicates), upsertMemories uses ON CONFLICT DO UPDATE to
|
|
695
|
+
* overwrite existing memories. Used for bulk data refresh or re-import scenarios.
|
|
696
|
+
*
|
|
697
|
+
* CONFLICT RESOLUTION:
|
|
698
|
+
* - Updates: content, metadata, unique (mutable data)
|
|
699
|
+
* - Preserves: id, type, entityId, roomId, worldId, agentId, createdAt (identity)
|
|
700
|
+
*
|
|
701
|
+
* NO SIMILARITY CHECK: Unlike createMemories, this does NOT run embedding similarity
|
|
702
|
+
* checks. The caller is asserting "I know this memory's ID, insert or replace."
|
|
703
|
+
* This is intentional - upsert is for known-identity updates, not duplicate detection.
|
|
704
|
+
*
|
|
705
|
+
* EMBEDDING HANDLING: If a memory includes an embedding, the embeddings table row
|
|
706
|
+
* is also upserted (ON CONFLICT on memory_id). This keeps embeddings in sync.
|
|
707
|
+
*
|
|
708
|
+
* @param memories Array of {memory, tableName} to upsert (memory.id required)
|
|
709
|
+
* @param options.entityContext When set (Postgres + ENABLE_DATA_ISOLATION), upsert runs under RLS for this entity.
|
|
710
|
+
*/
|
|
711
|
+
upsertMemories(memories: Array<{
|
|
712
|
+
memory: Memory;
|
|
713
|
+
tableName: string;
|
|
714
|
+
}>, options?: {
|
|
715
|
+
entityContext?: UUID;
|
|
716
|
+
}): Promise<void>;
|
|
717
|
+
deleteAllMemories(roomIds: UUID[], tableName: string): Promise<void>;
|
|
718
|
+
/**
|
|
719
|
+
* Count memories matching criteria.
|
|
720
|
+
* Use roomIds for room scope (pass [roomId] for a single room).
|
|
721
|
+
*/
|
|
722
|
+
countMemories(params: {
|
|
723
|
+
roomIds?: UUID[];
|
|
724
|
+
unique?: boolean;
|
|
725
|
+
tableName?: string;
|
|
726
|
+
entityId?: UUID;
|
|
727
|
+
agentId?: UUID;
|
|
728
|
+
metadata?: Record<string, unknown>;
|
|
729
|
+
}): Promise<number>;
|
|
730
|
+
getAllWorlds(): Promise<World[]>;
|
|
731
|
+
getWorldsByIds(worldIds: UUID[]): Promise<World[]>;
|
|
732
|
+
createWorlds(worlds: World[]): Promise<UUID[]>;
|
|
733
|
+
deleteWorlds(worldIds: UUID[]): Promise<void>;
|
|
734
|
+
updateWorlds(worlds: World[]): Promise<void>;
|
|
735
|
+
/**
|
|
736
|
+
* Upsert worlds (insert or update by ID)
|
|
737
|
+
*
|
|
738
|
+
* WHY: Atomic insert-or-update for world initialization. Worlds are created
|
|
739
|
+
* during agent bootstrap or plugin initialization. Concurrent initialization
|
|
740
|
+
* attempts should be idempotent, not fail with "already exists" errors.
|
|
741
|
+
*
|
|
742
|
+
* WHY on adapter interface: SQL dialects support atomic upserts for worlds.
|
|
743
|
+
* The world table has minimal fields (id, name, type, agentId), making upserts
|
|
744
|
+
* straightforward across all dialects.
|
|
745
|
+
*
|
|
746
|
+
* WHY void return: World IDs are provided by the caller (often deterministic
|
|
747
|
+
* UUIDs based on world name/type). No need to return IDs.
|
|
748
|
+
*
|
|
749
|
+
* IMPLEMENTATION NOTES:
|
|
750
|
+
* - PostgreSQL: INSERT ... ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, ...
|
|
751
|
+
* - MySQL: INSERT ... ON DUPLICATE KEY UPDATE name = VALUES(name), ...
|
|
752
|
+
* - InMemory: worlds.set(id, world)
|
|
753
|
+
*
|
|
754
|
+
* @param worlds Worlds to upsert (ID required for each)
|
|
755
|
+
*/
|
|
756
|
+
upsertWorlds(worlds: World[]): Promise<void>;
|
|
757
|
+
getRoomsByIds(roomIds: UUID[]): Promise<Room[]>;
|
|
758
|
+
createRooms(rooms: Room[]): Promise<UUID[]>;
|
|
759
|
+
deleteRoomsByWorldIds(worldIds: UUID[]): Promise<void>;
|
|
760
|
+
/**
|
|
761
|
+
* Get room IDs where entities are participants.
|
|
762
|
+
* @param entityIds Array of entity UUIDs
|
|
763
|
+
* @returns Array of room IDs where any of the entities participate
|
|
764
|
+
*/
|
|
765
|
+
getRoomsForParticipants(entityIds: UUID[]): Promise<UUID[]>;
|
|
766
|
+
/** Get rooms for multiple worlds. Limit/offset apply globally across all worlds. */
|
|
767
|
+
getRoomsByWorlds(worldIds: UUID[], limit?: number, offset?: number): Promise<Room[]>;
|
|
768
|
+
updateRooms(rooms: Room[]): Promise<void>;
|
|
769
|
+
deleteRooms(roomIds: UUID[]): Promise<void>;
|
|
770
|
+
/**
|
|
771
|
+
* Upsert rooms (insert or update by ID)
|
|
772
|
+
*
|
|
773
|
+
* WHY: Atomic insert-or-update for room management. Rooms are created during
|
|
774
|
+
* `ensureConnection` or when syncing external platforms (Discord, Telegram).
|
|
775
|
+
* Concurrent connection attempts should be idempotent.
|
|
776
|
+
*
|
|
777
|
+
* WHY on adapter interface: SQL dialects support atomic room upserts. Rooms
|
|
778
|
+
* have more fields than worlds (name, type, worldId, metadata, etc.) but
|
|
779
|
+
* upsert is still straightforward.
|
|
780
|
+
*
|
|
781
|
+
* WHY void return: Room IDs are provided by caller. For DM rooms, the ID
|
|
782
|
+
* is often deterministic (hash of participant IDs). No need to return IDs.
|
|
783
|
+
*
|
|
784
|
+
* IMPLEMENTATION NOTES:
|
|
785
|
+
* - PostgreSQL: INSERT ... ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name, ...
|
|
786
|
+
* - MySQL: INSERT ... ON DUPLICATE KEY UPDATE name = VALUES(name), ...
|
|
787
|
+
* - InMemory: rooms.set(id, room)
|
|
788
|
+
* - Partial updates: Full replacement (all fields updated)
|
|
789
|
+
*
|
|
790
|
+
* @param rooms Rooms to upsert (ID, worldId, agentId required for each)
|
|
791
|
+
*/
|
|
792
|
+
upsertRooms(rooms: Room[]): Promise<void>;
|
|
793
|
+
getParticipantsForEntities(entityIds: UUID[]): Promise<Participant[]>;
|
|
794
|
+
/** Get participants for multiple rooms (one entry per roomId, same order). */
|
|
795
|
+
getParticipantsForRooms(roomIds: UUID[]): Promise<ParticipantsForRoomsResult>;
|
|
796
|
+
areRoomParticipants(pairs: Array<{
|
|
797
|
+
roomId: UUID;
|
|
798
|
+
entityId: UUID;
|
|
799
|
+
}>): Promise<boolean[]>;
|
|
800
|
+
/**
|
|
801
|
+
* Create room participants (add entities to a room)
|
|
802
|
+
*
|
|
803
|
+
* WHY renamed from addRoomParticipants: 'create' prefix aligns with CRUD
|
|
804
|
+
* naming convention (create = insert, update = modify, delete = remove).
|
|
805
|
+
*
|
|
806
|
+
* WHY UUID[] return: Returns participant record IDs (changed from boolean).
|
|
807
|
+
* Useful for tracking who joined when, managing invites, etc.
|
|
808
|
+
*
|
|
809
|
+
* WHY ON CONFLICT DO NOTHING: Idempotent - calling twice with same entities
|
|
810
|
+
* doesn't fail, just skips duplicates. This is intentional for invite flows.
|
|
811
|
+
*
|
|
812
|
+
* @returns Array of created participant record IDs
|
|
813
|
+
*/
|
|
814
|
+
createRoomParticipants(entityIds: UUID[], roomId: UUID): Promise<UUID[]>;
|
|
815
|
+
deleteParticipants(participants: Array<{
|
|
816
|
+
entityId: UUID;
|
|
817
|
+
roomId: UUID;
|
|
818
|
+
}>): Promise<boolean>;
|
|
819
|
+
/**
|
|
820
|
+
* Update participants (batch)
|
|
821
|
+
*
|
|
822
|
+
* WHY: Participants have fields beyond roomState (e.g., lastSeenAt, metadata).
|
|
823
|
+
* This method provides general-purpose participant updates, while
|
|
824
|
+
* updateParticipantUserState is a specialized convenience for the common
|
|
825
|
+
* case of updating notification preferences.
|
|
826
|
+
*
|
|
827
|
+
* WHY composite key: Participant table's primary key is (entityId, roomId, agentId).
|
|
828
|
+
* Updates must specify all key fields, not just a single UUID.
|
|
829
|
+
*
|
|
830
|
+
* USAGE NOTE: For updating notification state (FOLLOWED/MUTED), prefer
|
|
831
|
+
* updateParticipantUserState() which has simpler signature.
|
|
832
|
+
*
|
|
833
|
+
* @param participants Array of participant updates with composite keys
|
|
834
|
+
*/
|
|
835
|
+
updateParticipants(participants: Array<{
|
|
836
|
+
entityId: UUID;
|
|
837
|
+
roomId: UUID;
|
|
838
|
+
updates: ParticipantUpdateFields;
|
|
839
|
+
}>): Promise<void>;
|
|
840
|
+
getParticipantUserStates(pairs: Array<{
|
|
841
|
+
roomId: UUID;
|
|
842
|
+
entityId: UUID;
|
|
843
|
+
}>): Promise<ParticipantUserState[]>;
|
|
844
|
+
updateParticipantUserStates(updates: Array<{
|
|
845
|
+
roomId: UUID;
|
|
846
|
+
entityId: UUID;
|
|
847
|
+
state: ParticipantUserState;
|
|
848
|
+
}>): Promise<void>;
|
|
849
|
+
/** Get relationships by (source, target) pairs. Same order as pairs; null where not found. */
|
|
850
|
+
getRelationshipsByPairs(pairs: Array<{
|
|
851
|
+
sourceEntityId: UUID;
|
|
852
|
+
targetEntityId: UUID;
|
|
853
|
+
}>): Promise<(Relationship | null)[]>;
|
|
854
|
+
/**
|
|
855
|
+
* Retrieves all relationships for entities. Use entityIds (pass [entityId] for a single entity).
|
|
856
|
+
*/
|
|
857
|
+
getRelationships(params: {
|
|
858
|
+
entityIds?: UUID[];
|
|
859
|
+
tags?: string[];
|
|
860
|
+
limit?: number;
|
|
861
|
+
offset?: number;
|
|
862
|
+
}): Promise<Relationship[]>;
|
|
863
|
+
createRelationships(relationships: Array<{
|
|
864
|
+
sourceEntityId: UUID;
|
|
865
|
+
targetEntityId: UUID;
|
|
866
|
+
tags?: string[];
|
|
867
|
+
metadata?: Metadata;
|
|
868
|
+
}>): Promise<UUID[]>;
|
|
869
|
+
getRelationshipsByIds(relationshipIds: UUID[]): Promise<Relationship[]>;
|
|
870
|
+
updateRelationships(relationships: Relationship[]): Promise<void>;
|
|
871
|
+
deleteRelationships(relationshipIds: UUID[]): Promise<void>;
|
|
872
|
+
getCaches<T>(keys: string[]): Promise<Map<string, T>>;
|
|
873
|
+
setCaches<T>(entries: Array<{
|
|
874
|
+
key: string;
|
|
875
|
+
value: T;
|
|
876
|
+
}>): Promise<boolean>;
|
|
877
|
+
deleteCaches(keys: string[]): Promise<boolean>;
|
|
878
|
+
/**
|
|
879
|
+
* Get tasks matching criteria
|
|
880
|
+
*
|
|
881
|
+
* WHY limit/offset added: Previously returned ALL matching tasks, which could
|
|
882
|
+
* be thousands of records. Task queues grow unbounded over time, causing:
|
|
883
|
+
* - Memory exhaustion when loading full queue
|
|
884
|
+
* - Slow queries without limits
|
|
885
|
+
* - UI freeze when rendering thousands of tasks
|
|
886
|
+
*
|
|
887
|
+
* @param params.limit Max results (default: unlimited, use with caution)
|
|
888
|
+
* @param params.offset Skip first N results for pagination
|
|
889
|
+
*/
|
|
890
|
+
getTasks(params: {
|
|
891
|
+
roomId?: UUID;
|
|
892
|
+
tags?: string[];
|
|
893
|
+
entityId?: UUID;
|
|
894
|
+
/** Required. Only tasks with agentId in this array are returned. Single agent = [id]. WHY: multi-tenant safety; schema indexes by agent_id; daemon batches one getTasks(agentIds) for many agents. */
|
|
895
|
+
agentIds: UUID[];
|
|
896
|
+
limit?: number;
|
|
897
|
+
offset?: number;
|
|
898
|
+
}): Promise<Task[]>;
|
|
899
|
+
getTasksByName(name: string): Promise<Task[]>;
|
|
900
|
+
createTasks(tasks: Task[]): Promise<UUID[]>;
|
|
901
|
+
getTasksByIds(taskIds: UUID[]): Promise<Task[]>;
|
|
902
|
+
updateTasks(updates: Array<{
|
|
903
|
+
id: UUID;
|
|
904
|
+
task: Partial<Task>;
|
|
905
|
+
}>): Promise<void>;
|
|
906
|
+
deleteTasks(taskIds: UUID[]): Promise<void>;
|
|
907
|
+
getMemoriesByWorldId(params: {
|
|
908
|
+
worldIds?: UUID[];
|
|
909
|
+
/** @deprecated use limit */
|
|
910
|
+
count?: number;
|
|
911
|
+
limit?: number;
|
|
912
|
+
tableName?: string;
|
|
913
|
+
}): Promise<Memory[]>;
|
|
914
|
+
/** Get pairing requests for multiple (channel, agentId) queries. One entry per query, same order. */
|
|
915
|
+
getPairingRequests(queries: Array<{
|
|
916
|
+
channel: PairingChannel;
|
|
917
|
+
agentId: UUID;
|
|
918
|
+
}>): Promise<PairingRequestsResult>;
|
|
919
|
+
createPairingRequests(requests: PairingRequest[]): Promise<UUID[]>;
|
|
920
|
+
updatePairingRequests(requests: PairingRequest[]): Promise<void>;
|
|
921
|
+
deletePairingRequests(ids: UUID[]): Promise<void>;
|
|
922
|
+
/** Get pairing allowlists for multiple (channel, agentId) queries. One entry per query, same order. */
|
|
923
|
+
getPairingAllowlists(queries: Array<{
|
|
924
|
+
channel: PairingChannel;
|
|
925
|
+
agentId: UUID;
|
|
926
|
+
}>): Promise<PairingAllowlistsResult>;
|
|
927
|
+
createPairingAllowlistEntries(entries: PairingAllowlistEntry[]): Promise<UUID[]>;
|
|
928
|
+
/**
|
|
929
|
+
* Update pairing allowlist entries (batch)
|
|
930
|
+
*
|
|
931
|
+
* WHY: Allowlist entries have metadata/config that changes over time
|
|
932
|
+
* (e.g., expiration dates, permission levels, notes). Batch updates
|
|
933
|
+
* are needed when admin adjusts settings for multiple users at once.
|
|
934
|
+
*
|
|
935
|
+
* @param entries Full PairingAllowlistEntry objects (ID required for each)
|
|
936
|
+
*/
|
|
937
|
+
updatePairingAllowlistEntries(entries: PairingAllowlistEntry[]): Promise<void>;
|
|
938
|
+
deletePairingAllowlistEntries(ids: UUID[]): Promise<void>;
|
|
939
|
+
/**
|
|
940
|
+
* Register a plugin's schema (tables, columns, indexes)
|
|
941
|
+
*
|
|
942
|
+
* WHY: Plugins like goals and todos need custom tables. Without this, they
|
|
943
|
+
* must cast runtime.db to Drizzle, which only works with SQL adapters.
|
|
944
|
+
*
|
|
945
|
+
* IDEMPOTENT: Safe to call multiple times (e.g., on hot reload). The adapter
|
|
946
|
+
* should check if tables exist and only create/migrate what's needed.
|
|
947
|
+
*
|
|
948
|
+
* MIGRATIONS: If a plugin updates its schema (adds columns, indexes), the
|
|
949
|
+
* adapter should diff against the current schema and apply changes. For SQL
|
|
950
|
+
* adapters, this uses ALTER TABLE. For in-memory, it's a no-op (just stores
|
|
951
|
+
* the schema definition).
|
|
952
|
+
*
|
|
953
|
+
* @param schema Complete schema definition for the plugin
|
|
954
|
+
* @throws Error if schema is invalid or migration fails
|
|
955
|
+
*/
|
|
956
|
+
registerPluginSchema?(schema: import("./plugin-store").PluginSchema): Promise<void>;
|
|
957
|
+
/**
|
|
958
|
+
* Get a plugin store for CRUD operations on plugin tables
|
|
959
|
+
*
|
|
960
|
+
* WHY: Provides a generic interface for plugins to access their data without
|
|
961
|
+
* knowing whether they're running on SQL or in-memory adapters.
|
|
962
|
+
*
|
|
963
|
+
* NAMESPACING: The store automatically prefixes table names with the plugin
|
|
964
|
+
* name to avoid conflicts (e.g., "goals_goals", "goals_goal_tags").
|
|
965
|
+
*
|
|
966
|
+
* @param pluginName Name of the plugin (must match registered schema)
|
|
967
|
+
* @returns Plugin store interface, or null if adapter doesn't support plugins
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
* ```typescript
|
|
971
|
+
* // In plugin code:
|
|
972
|
+
* const store = runtime.getPluginStore('goals');
|
|
973
|
+
* if (!store) throw new Error('Plugin storage not available');
|
|
974
|
+
*
|
|
975
|
+
* const goals = await store.query<Goal>('goals', {
|
|
976
|
+
* agentId: runtime.agentId,
|
|
977
|
+
* isCompleted: false
|
|
978
|
+
* });
|
|
979
|
+
* ```
|
|
980
|
+
*/
|
|
981
|
+
getPluginStore?(pluginName: string): import("./plugin-store").IPluginStore | null;
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Result interface for embedding similarity searches
|
|
985
|
+
*/
|
|
986
|
+
export interface EmbeddingSearchResult extends Omit<ProtoEmbeddingSearchResult, "levenshteinScore"> {
|
|
987
|
+
levenshtein_score?: number;
|
|
988
|
+
}
|
|
989
|
+
/** Base shape for memory retrieval options (string IDs before UUID substitution) */
|
|
990
|
+
interface ProtoMemoryRetrievalOptions {
|
|
991
|
+
roomId?: string;
|
|
992
|
+
agentId?: string;
|
|
993
|
+
start?: number;
|
|
994
|
+
end?: number;
|
|
995
|
+
limit?: number;
|
|
996
|
+
unique?: boolean;
|
|
997
|
+
tableName?: string;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Options for memory retrieval operations
|
|
1001
|
+
*/
|
|
1002
|
+
export interface MemoryRetrievalOptions extends Omit<ProtoMemoryRetrievalOptions, "roomId" | "agentId" | "start" | "end"> {
|
|
1003
|
+
roomId: UUID;
|
|
1004
|
+
agentId?: UUID;
|
|
1005
|
+
start?: number | bigint;
|
|
1006
|
+
end?: number | bigint;
|
|
1007
|
+
}
|
|
1008
|
+
/** Base shape for memory search options */
|
|
1009
|
+
interface ProtoMemorySearchOptions {
|
|
1010
|
+
roomId?: string;
|
|
1011
|
+
agentId?: string;
|
|
1012
|
+
metadata?: unknown;
|
|
1013
|
+
matchThreshold?: number;
|
|
1014
|
+
limit?: number;
|
|
1015
|
+
tableName?: string;
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Options for memory search operations
|
|
1019
|
+
*/
|
|
1020
|
+
export interface MemorySearchOptions extends Omit<ProtoMemorySearchOptions, "roomId" | "agentId" | "metadata" | "matchThreshold"> {
|
|
1021
|
+
roomId: UUID;
|
|
1022
|
+
agentId?: UUID;
|
|
1023
|
+
metadata?: Partial<MemoryMetadata>;
|
|
1024
|
+
match_threshold?: number;
|
|
1025
|
+
}
|
|
1026
|
+
/** Base shape for multi-room memory options */
|
|
1027
|
+
interface ProtoMultiRoomMemoryOptions {
|
|
1028
|
+
roomIds?: string[];
|
|
1029
|
+
agentId?: string;
|
|
1030
|
+
limit?: number;
|
|
1031
|
+
tableName?: string;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Options for multi-room memory retrieval
|
|
1035
|
+
*/
|
|
1036
|
+
export interface MultiRoomMemoryOptions extends Omit<ProtoMultiRoomMemoryOptions, "roomIds" | "agentId"> {
|
|
1037
|
+
roomIds: UUID[];
|
|
1038
|
+
agentId?: UUID;
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Standard options pattern for memory operations
|
|
1042
|
+
* Provides a simpler, more consistent interface
|
|
1043
|
+
*/
|
|
1044
|
+
export interface StandardMemoryOptions {
|
|
1045
|
+
roomId: UUID;
|
|
1046
|
+
limit?: number;
|
|
1047
|
+
agentId?: UUID;
|
|
1048
|
+
unique?: boolean;
|
|
1049
|
+
start?: number;
|
|
1050
|
+
end?: number;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Specialized memory search options
|
|
1054
|
+
*/
|
|
1055
|
+
export interface MemorySearchParams extends StandardMemoryOptions {
|
|
1056
|
+
embedding: number[];
|
|
1057
|
+
similarity?: number;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Base interface for database connection objects.
|
|
1061
|
+
* Specific adapters should extend this with their connection type.
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* ```typescript
|
|
1065
|
+
* // In a PostgreSQL adapter:
|
|
1066
|
+
* interface PgConnection extends DbConnection {
|
|
1067
|
+
* pool: Pool;
|
|
1068
|
+
* query: <T>(sql: string, params?: unknown[]) => Promise<T>;
|
|
1069
|
+
* }
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
export interface DbConnection {
|
|
1073
|
+
/** Whether the connection is currently active */
|
|
1074
|
+
isConnected?: boolean;
|
|
1075
|
+
/** Close the connection */
|
|
1076
|
+
close?: () => Promise<void>;
|
|
1077
|
+
}
|
|
1078
|
+
export declare const VECTOR_DIMS: {
|
|
1079
|
+
readonly SMALL: 384;
|
|
1080
|
+
readonly MEDIUM: 512;
|
|
1081
|
+
readonly LARGE: 768;
|
|
1082
|
+
readonly XL: 1024;
|
|
1083
|
+
readonly XXL: 1536;
|
|
1084
|
+
readonly XXXL: 3072;
|
|
1085
|
+
};
|
|
1086
|
+
export {};
|
|
1087
|
+
//# sourceMappingURL=database.d.ts.map
|