@undefineds.co/xpod 0.2.35 → 0.2.37
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/agents/schema/agent-config.js +1 -1
- package/dist/agents/schema/agent-config.js.map +1 -1
- package/dist/agents/schema/create-agent-schema.js +17 -16
- package/dist/agents/schema/create-agent-schema.js.map +1 -1
- package/dist/agents/schema/tables.js +1 -1
- package/dist/agents/schema/tables.js.map +1 -1
- package/dist/ai/schema/config.js +1 -1
- package/dist/ai/schema/config.js.map +1 -1
- package/dist/ai/schema/model.js +2 -2
- package/dist/ai/schema/model.js.map +1 -1
- package/dist/ai/schema/provider.js +1 -1
- package/dist/ai/schema/provider.js.map +1 -1
- package/dist/ai/schema/vector-store.js +2 -2
- package/dist/ai/schema/vector-store.js.map +1 -1
- package/dist/credential/schema/tables.js +3 -3
- package/dist/credential/schema/tables.js.map +1 -1
- package/dist/runtime/Proxy.d.ts +1 -0
- package/dist/runtime/Proxy.js +9 -0
- package/dist/runtime/Proxy.js.map +1 -1
- package/package.json +2 -2
- package/node_modules/@undefineds.co/models/README.md +0 -578
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/columns.d.ts +0 -37
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/columns.js +0 -1
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/pod-table.d.ts +0 -3
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/pod-table.js +0 -1
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/types.d.ts +0 -40
- package/node_modules/@undefineds.co/models/dist/_drizzle-solid/types.js +0 -1
- package/node_modules/@undefineds.co/models/dist/agent.providers.d.ts +0 -13
- package/node_modules/@undefineds.co/models/dist/agent.providers.js +0 -69
- package/node_modules/@undefineds.co/models/dist/agent.repository.d.ts +0 -85
- package/node_modules/@undefineds.co/models/dist/agent.repository.js +0 -7
- package/node_modules/@undefineds.co/models/dist/agent.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/agent.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-config/index.d.ts +0 -61
- package/node_modules/@undefineds.co/models/dist/ai-config/index.js +0 -294
- package/node_modules/@undefineds.co/models/dist/ai-config.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-config.js +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-model.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-model.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-provider.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/ai-provider.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/approval.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/approval.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/audit.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/audit.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/chat.repository.d.ts +0 -61
- package/node_modules/@undefineds.co/models/dist/chat.repository.js +0 -8
- package/node_modules/@undefineds.co/models/dist/chat.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/chat.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/chat.utils.d.ts +0 -3
- package/node_modules/@undefineds.co/models/dist/chat.utils.js +0 -30
- package/node_modules/@undefineds.co/models/dist/contact.repository.d.ts +0 -85
- package/node_modules/@undefineds.co/models/dist/contact.repository.js +0 -8
- package/node_modules/@undefineds.co/models/dist/contact.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/contact.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/agent-provider.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/agent-provider.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/agent-status.schema.d.ts +0 -12
- package/node_modules/@undefineds.co/models/dist/core/agent-status.schema.js +0 -18
- package/node_modules/@undefineds.co/models/dist/core/agent.schema.d.ts +0 -72
- package/node_modules/@undefineds.co/models/dist/core/agent.schema.js +0 -38
- package/node_modules/@undefineds.co/models/dist/core/ai-config.schema.d.ts +0 -11
- package/node_modules/@undefineds.co/models/dist/core/ai-config.schema.js +0 -18
- package/node_modules/@undefineds.co/models/dist/core/ai-model.schema.d.ts +0 -15
- package/node_modules/@undefineds.co/models/dist/core/ai-model.schema.js +0 -21
- package/node_modules/@undefineds.co/models/dist/core/ai-provider.schema.d.ts +0 -16
- package/node_modules/@undefineds.co/models/dist/core/ai-provider.schema.js +0 -28
- package/node_modules/@undefineds.co/models/dist/core/approval.schema.d.ts +0 -21
- package/node_modules/@undefineds.co/models/dist/core/approval.schema.js +0 -33
- package/node_modules/@undefineds.co/models/dist/core/audit.schema.d.ts +0 -17
- package/node_modules/@undefineds.co/models/dist/core/audit.schema.js +0 -29
- package/node_modules/@undefineds.co/models/dist/core/chat.schema.d.ts +0 -36
- package/node_modules/@undefineds.co/models/dist/core/chat.schema.js +0 -45
- package/node_modules/@undefineds.co/models/dist/core/contact.schema.d.ts +0 -47
- package/node_modules/@undefineds.co/models/dist/core/contact.schema.js +0 -59
- package/node_modules/@undefineds.co/models/dist/core/credential.schema.d.ts +0 -56
- package/node_modules/@undefineds.co/models/dist/core/credential.schema.js +0 -40
- package/node_modules/@undefineds.co/models/dist/core/extension/extension.schema.d.ts +0 -4
- package/node_modules/@undefineds.co/models/dist/core/extension/extension.schema.js +0 -11
- package/node_modules/@undefineds.co/models/dist/core/extension/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/extension/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/extension.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/extension.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/favorite/favorite.schema.d.ts +0 -24
- package/node_modules/@undefineds.co/models/dist/core/favorite/favorite.schema.js +0 -34
- package/node_modules/@undefineds.co/models/dist/core/favorite/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/favorite/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/file/file.schema.d.ts +0 -39
- package/node_modules/@undefineds.co/models/dist/core/file/file.schema.js +0 -51
- package/node_modules/@undefineds.co/models/dist/core/file/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/file/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/file.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/file.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/grant.schema.d.ts +0 -16
- package/node_modules/@undefineds.co/models/dist/core/grant.schema.js +0 -29
- package/node_modules/@undefineds.co/models/dist/core/import/import-job.schema.d.ts +0 -5
- package/node_modules/@undefineds.co/models/dist/core/import/import-job.schema.js +0 -5
- package/node_modules/@undefineds.co/models/dist/core/import/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/import/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/import.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/import.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/inbox-notification.schema.d.ts +0 -9
- package/node_modules/@undefineds.co/models/dist/core/inbox-notification.schema.js +0 -16
- package/node_modules/@undefineds.co/models/dist/core/index.d.ts +0 -31
- package/node_modules/@undefineds.co/models/dist/core/index.js +0 -32
- package/node_modules/@undefineds.co/models/dist/core/knowledge/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/knowledge/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/knowledge/knowledge-folder.schema.d.ts +0 -7
- package/node_modules/@undefineds.co/models/dist/core/knowledge/knowledge-folder.schema.js +0 -6
- package/node_modules/@undefineds.co/models/dist/core/knowledge.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/knowledge.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/message.schema.d.ts +0 -33
- package/node_modules/@undefineds.co/models/dist/core/message.schema.js +0 -49
- package/node_modules/@undefineds.co/models/dist/core/namespaces.d.ts +0 -176
- package/node_modules/@undefineds.co/models/dist/core/namespaces.js +0 -289
- package/node_modules/@undefineds.co/models/dist/core/profile.d.ts +0 -16
- package/node_modules/@undefineds.co/models/dist/core/profile.js +0 -19
- package/node_modules/@undefineds.co/models/dist/core/schema.d.ts +0 -304
- package/node_modules/@undefineds.co/models/dist/core/schema.js +0 -46
- package/node_modules/@undefineds.co/models/dist/core/session/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/session/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/session/session.schema.d.ts +0 -6
- package/node_modules/@undefineds.co/models/dist/core/session/session.schema.js +0 -6
- package/node_modules/@undefineds.co/models/dist/core/session.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/session.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/settings/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/settings/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/settings/settings.schema.d.ts +0 -49
- package/node_modules/@undefineds.co/models/dist/core/settings/settings.schema.js +0 -63
- package/node_modules/@undefineds.co/models/dist/core/settings.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/settings.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/thread.schema.d.ts +0 -28
- package/node_modules/@undefineds.co/models/dist/core/thread.schema.js +0 -36
- package/node_modules/@undefineds.co/models/dist/core/types/collaboration-blocks.d.ts +0 -52
- package/node_modules/@undefineds.co/models/dist/core/types/collaboration-blocks.js +0 -7
- package/node_modules/@undefineds.co/models/dist/core/types/message-block.d.ts +0 -270
- package/node_modules/@undefineds.co/models/dist/core/types/message-block.js +0 -125
- package/node_modules/@undefineds.co/models/dist/core/vector-store.schema.d.ts +0 -25
- package/node_modules/@undefineds.co/models/dist/core/vector-store.schema.js +0 -35
- package/node_modules/@undefineds.co/models/dist/core/vocab/_namespaces.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/vocab/_namespaces.js +0 -3
- package/node_modules/@undefineds.co/models/dist/core/vocab/chat.vocab.d.ts +0 -16
- package/node_modules/@undefineds.co/models/dist/core/vocab/chat.vocab.js +0 -22
- package/node_modules/@undefineds.co/models/dist/core/vocab/contact.vocab.d.ts +0 -21
- package/node_modules/@undefineds.co/models/dist/core/vocab/contact.vocab.js +0 -22
- package/node_modules/@undefineds.co/models/dist/core/vocab/index.d.ts +0 -6
- package/node_modules/@undefineds.co/models/dist/core/vocab/index.js +0 -6
- package/node_modules/@undefineds.co/models/dist/core/vocab/message.vocab.d.ts +0 -20
- package/node_modules/@undefineds.co/models/dist/core/vocab/message.vocab.js +0 -24
- package/node_modules/@undefineds.co/models/dist/core/vocab/sidecar.vocab.d.ts +0 -46
- package/node_modules/@undefineds.co/models/dist/core/vocab/sidecar.vocab.js +0 -47
- package/node_modules/@undefineds.co/models/dist/core/vocab/thread.vocab.d.ts +0 -11
- package/node_modules/@undefineds.co/models/dist/core/vocab/thread.vocab.js +0 -14
- package/node_modules/@undefineds.co/models/dist/core/vocab/workspace.vocab.d.ts +0 -12
- package/node_modules/@undefineds.co/models/dist/core/vocab/workspace.vocab.js +0 -13
- package/node_modules/@undefineds.co/models/dist/core/vocab.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core/vocab.js +0 -1
- package/node_modules/@undefineds.co/models/dist/core/workspace.schema.d.ts +0 -35
- package/node_modules/@undefineds.co/models/dist/core/workspace.schema.js +0 -106
- package/node_modules/@undefineds.co/models/dist/core.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/core.js +0 -1
- package/node_modules/@undefineds.co/models/dist/credential.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/credential.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/discovery/index.d.ts +0 -31
- package/node_modules/@undefineds.co/models/dist/discovery/index.js +0 -147
- package/node_modules/@undefineds.co/models/dist/discovery/models.json +0 -2623
- package/node_modules/@undefineds.co/models/dist/discovery/providers.json +0 -156
- package/node_modules/@undefineds.co/models/dist/discovery/types.d.ts +0 -103
- package/node_modules/@undefineds.co/models/dist/discovery/types.js +0 -12
- package/node_modules/@undefineds.co/models/dist/discovery/vercel.d.ts +0 -25
- package/node_modules/@undefineds.co/models/dist/discovery/vercel.js +0 -95
- package/node_modules/@undefineds.co/models/dist/discovery.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/discovery.js +0 -1
- package/node_modules/@undefineds.co/models/dist/extension/extension.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/extension/extension.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/extension/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/extension/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/extension.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/extension.js +0 -1
- package/node_modules/@undefineds.co/models/dist/favorite/favorite.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/favorite/favorite.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/favorite/index.d.ts +0 -2
- package/node_modules/@undefineds.co/models/dist/favorite/index.js +0 -7
- package/node_modules/@undefineds.co/models/dist/favorite/starred-sync.d.ts +0 -66
- package/node_modules/@undefineds.co/models/dist/favorite/starred-sync.js +0 -156
- package/node_modules/@undefineds.co/models/dist/favorite.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/favorite.js +0 -1
- package/node_modules/@undefineds.co/models/dist/file/file.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/file/file.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/file/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/file/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/file.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/file.js +0 -1
- package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.d.ts +0 -13
- package/node_modules/@undefineds.co/models/dist/fixtures/contracts-chat-contact.js +0 -76
- package/node_modules/@undefineds.co/models/dist/grant.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/grant.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/import/import-job.schema.d.ts +0 -5
- package/node_modules/@undefineds.co/models/dist/import/import-job.schema.js +0 -5
- package/node_modules/@undefineds.co/models/dist/import/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/import/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/import.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/import.js +0 -1
- package/node_modules/@undefineds.co/models/dist/inbox-notification.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/inbox-notification.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/index.d.ts +0 -41
- package/node_modules/@undefineds.co/models/dist/index.js +0 -83
- package/node_modules/@undefineds.co/models/dist/knowledge/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/knowledge/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/knowledge/knowledge-folder.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/knowledge/knowledge-folder.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/knowledge.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/knowledge.js +0 -1
- package/node_modules/@undefineds.co/models/dist/message.repository.d.ts +0 -81
- package/node_modules/@undefineds.co/models/dist/message.repository.js +0 -8
- package/node_modules/@undefineds.co/models/dist/message.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/message.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/namespaces.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/namespaces.js +0 -1
- package/node_modules/@undefineds.co/models/dist/profile.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/profile.js +0 -1
- package/node_modules/@undefineds.co/models/dist/repository.d.ts +0 -59
- package/node_modules/@undefineds.co/models/dist/repository.js +0 -186
- package/node_modules/@undefineds.co/models/dist/schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/session/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/session/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/session/session.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/session/session.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/session.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/session.js +0 -1
- package/node_modules/@undefineds.co/models/dist/settings/index.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/settings/index.js +0 -1
- package/node_modules/@undefineds.co/models/dist/settings/settings.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/settings/settings.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/settings.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/settings.js +0 -1
- package/node_modules/@undefineds.co/models/dist/sidecar/index.d.ts +0 -2
- package/node_modules/@undefineds.co/models/dist/sidecar/index.js +0 -2
- package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.d.ts +0 -51
- package/node_modules/@undefineds.co/models/dist/sidecar/persistence-mapping.js +0 -44
- package/node_modules/@undefineds.co/models/dist/sidecar/sidecar-events.d.ts +0 -632
- package/node_modules/@undefineds.co/models/dist/sidecar/sidecar-events.js +0 -133
- package/node_modules/@undefineds.co/models/dist/thread.repository.d.ts +0 -41
- package/node_modules/@undefineds.co/models/dist/thread.repository.js +0 -8
- package/node_modules/@undefineds.co/models/dist/thread.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/thread.schema.js +0 -1
- package/node_modules/@undefineds.co/models/dist/types/collaboration-blocks.d.ts +0 -52
- package/node_modules/@undefineds.co/models/dist/types/collaboration-blocks.js +0 -7
- package/node_modules/@undefineds.co/models/dist/types/message-block.d.ts +0 -270
- package/node_modules/@undefineds.co/models/dist/types/message-block.js +0 -125
- package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/vocab/_namespaces.js +0 -3
- package/node_modules/@undefineds.co/models/dist/vocab/chat.vocab.d.ts +0 -16
- package/node_modules/@undefineds.co/models/dist/vocab/chat.vocab.js +0 -22
- package/node_modules/@undefineds.co/models/dist/vocab/contact.vocab.d.ts +0 -21
- package/node_modules/@undefineds.co/models/dist/vocab/contact.vocab.js +0 -22
- package/node_modules/@undefineds.co/models/dist/vocab/index.d.ts +0 -6
- package/node_modules/@undefineds.co/models/dist/vocab/index.js +0 -6
- package/node_modules/@undefineds.co/models/dist/vocab/message.vocab.d.ts +0 -20
- package/node_modules/@undefineds.co/models/dist/vocab/message.vocab.js +0 -24
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.d.ts +0 -46
- package/node_modules/@undefineds.co/models/dist/vocab/sidecar.vocab.js +0 -47
- package/node_modules/@undefineds.co/models/dist/vocab/thread.vocab.d.ts +0 -11
- package/node_modules/@undefineds.co/models/dist/vocab/thread.vocab.js +0 -14
- package/node_modules/@undefineds.co/models/dist/vocab/workspace.vocab.d.ts +0 -12
- package/node_modules/@undefineds.co/models/dist/vocab/workspace.vocab.js +0 -13
- package/node_modules/@undefineds.co/models/dist/vocab.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/vocab.js +0 -1
- package/node_modules/@undefineds.co/models/dist/workspace.repository.d.ts +0 -45
- package/node_modules/@undefineds.co/models/dist/workspace.repository.js +0 -8
- package/node_modules/@undefineds.co/models/dist/workspace.schema.d.ts +0 -1
- package/node_modules/@undefineds.co/models/dist/workspace.schema.js +0 -1
- package/node_modules/@undefineds.co/models/package.json +0 -67
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export const RiskLevelSchema = z.enum(['low', 'medium', 'high']);
|
|
3
|
-
export const DecisionRoleSchema = z.enum(['human', 'secretary', 'system']);
|
|
4
|
-
export const ToolCallStatusSchema = z.enum([
|
|
5
|
-
'calling',
|
|
6
|
-
'waiting_approval',
|
|
7
|
-
'approved',
|
|
8
|
-
'rejected',
|
|
9
|
-
'running',
|
|
10
|
-
'done',
|
|
11
|
-
'error',
|
|
12
|
-
]);
|
|
13
|
-
const IsoDatetimeSchema = z.string().datetime();
|
|
14
|
-
// --------------------------------------------
|
|
15
|
-
// tool.call
|
|
16
|
-
// --------------------------------------------
|
|
17
|
-
export const ToolCallEventV1Schema = z
|
|
18
|
-
.object({
|
|
19
|
-
type: z.literal('tool.call'),
|
|
20
|
-
version: z.literal(1).optional(),
|
|
21
|
-
sessionId: z.string(),
|
|
22
|
-
toolCallId: z.string(),
|
|
23
|
-
toolName: z.string(),
|
|
24
|
-
risk: RiskLevelSchema.optional(),
|
|
25
|
-
status: ToolCallStatusSchema,
|
|
26
|
-
// CP0 Pod-only scope projection
|
|
27
|
-
target: z.string().optional(),
|
|
28
|
-
action: z.string().optional(),
|
|
29
|
-
arguments: z.record(z.unknown()).optional(),
|
|
30
|
-
result: z.unknown().optional(),
|
|
31
|
-
error: z.string().optional(),
|
|
32
|
-
duration: z.number().int().nonnegative().optional(),
|
|
33
|
-
inboxItemId: z.string().optional(),
|
|
34
|
-
decisionBy: z.string().optional(), // WebID
|
|
35
|
-
decisionRole: DecisionRoleSchema.optional(),
|
|
36
|
-
onBehalfOf: z.string().optional(), // WebID
|
|
37
|
-
policyVersion: z.string().optional(),
|
|
38
|
-
timestamp: IsoDatetimeSchema,
|
|
39
|
-
})
|
|
40
|
-
.strict();
|
|
41
|
-
export const ToolCallEventSchema = ToolCallEventV1Schema;
|
|
42
|
-
// --------------------------------------------
|
|
43
|
-
// session.state
|
|
44
|
-
// --------------------------------------------
|
|
45
|
-
export const SessionToolSchema = z.enum(['claude-code', 'cursor', 'windsurf']);
|
|
46
|
-
export const SessionStatusSchema = z.enum(['active', 'paused', 'completed', 'error']);
|
|
47
|
-
export const SessionStateEventV1Schema = z
|
|
48
|
-
.object({
|
|
49
|
-
type: z.literal('session.state'),
|
|
50
|
-
version: z.literal(1).optional(),
|
|
51
|
-
sessionId: z.string(),
|
|
52
|
-
chatId: z.string(),
|
|
53
|
-
policy: z.string().optional(),
|
|
54
|
-
policyVersion: z.string().optional(),
|
|
55
|
-
status: SessionStatusSchema,
|
|
56
|
-
previousStatus: z.string(),
|
|
57
|
-
tool: SessionToolSchema,
|
|
58
|
-
tokenUsage: z.number().int().nonnegative(),
|
|
59
|
-
timestamp: IsoDatetimeSchema,
|
|
60
|
-
})
|
|
61
|
-
.strict();
|
|
62
|
-
export const SessionStateEventSchema = SessionStateEventV1Schema;
|
|
63
|
-
// --------------------------------------------
|
|
64
|
-
// tool.control
|
|
65
|
-
// --------------------------------------------
|
|
66
|
-
export const ToolControlCommandNameSchema = z.enum([
|
|
67
|
-
'approve',
|
|
68
|
-
'reject',
|
|
69
|
-
'pause',
|
|
70
|
-
'resume',
|
|
71
|
-
'stop',
|
|
72
|
-
'inject_message',
|
|
73
|
-
'approve_pattern',
|
|
74
|
-
]);
|
|
75
|
-
export const ToolControlCommandV1Schema = z
|
|
76
|
-
.object({
|
|
77
|
-
commandId: z.string().optional(),
|
|
78
|
-
type: z.literal('tool.control'),
|
|
79
|
-
version: z.literal(1).optional(),
|
|
80
|
-
command: ToolControlCommandNameSchema,
|
|
81
|
-
sessionId: z.string(),
|
|
82
|
-
toolCallId: z.string().optional(),
|
|
83
|
-
message: z.string().optional(),
|
|
84
|
-
pattern: z.string().optional(),
|
|
85
|
-
inboxItemId: z.string().optional(),
|
|
86
|
-
actor: z
|
|
87
|
-
.object({
|
|
88
|
-
actorWebId: z.string(),
|
|
89
|
-
actorRole: DecisionRoleSchema,
|
|
90
|
-
onBehalfOf: z.string().optional(),
|
|
91
|
-
})
|
|
92
|
-
.optional(),
|
|
93
|
-
policyVersion: z.string().optional(),
|
|
94
|
-
timestamp: IsoDatetimeSchema,
|
|
95
|
-
})
|
|
96
|
-
.strict();
|
|
97
|
-
export const ToolControlCommandSchema = ToolControlCommandV1Schema;
|
|
98
|
-
// --------------------------------------------
|
|
99
|
-
// inbox.approval
|
|
100
|
-
// --------------------------------------------
|
|
101
|
-
export const InboxApprovalStatusSchema = z.enum(['pending', 'approved', 'rejected', 'expired']);
|
|
102
|
-
export const InboxApprovalEventV1Schema = z
|
|
103
|
-
.object({
|
|
104
|
-
type: z.literal('inbox.approval'),
|
|
105
|
-
version: z.literal(1).optional(),
|
|
106
|
-
inboxItemId: z.string(),
|
|
107
|
-
sessionId: z.string(),
|
|
108
|
-
toolCallId: z.string(),
|
|
109
|
-
// Optional Pod scope projection
|
|
110
|
-
target: z.string().optional(),
|
|
111
|
-
action: z.string().optional(),
|
|
112
|
-
policy: z.string().optional(),
|
|
113
|
-
policyVersion: z.string().optional(),
|
|
114
|
-
risk: RiskLevelSchema,
|
|
115
|
-
status: InboxApprovalStatusSchema,
|
|
116
|
-
assignedTo: z.string().optional(),
|
|
117
|
-
createdAt: IsoDatetimeSchema,
|
|
118
|
-
resolvedAt: IsoDatetimeSchema.optional(),
|
|
119
|
-
})
|
|
120
|
-
.strict();
|
|
121
|
-
export const InboxApprovalEventSchema = InboxApprovalEventV1Schema;
|
|
122
|
-
// --------------------------------------------
|
|
123
|
-
// SidecarEvent
|
|
124
|
-
// --------------------------------------------
|
|
125
|
-
export const SidecarEventSchema = z.union([
|
|
126
|
-
ToolCallEventSchema,
|
|
127
|
-
SessionStateEventSchema,
|
|
128
|
-
ToolControlCommandSchema,
|
|
129
|
-
InboxApprovalEventSchema,
|
|
130
|
-
]);
|
|
131
|
-
export function getSidecarEventVersion(_event) {
|
|
132
|
-
return 1;
|
|
133
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export declare const threadRepository: import("./repository.js").PodRepositoryDescriptor<import("@undefineds.co/models/_drizzle-solid/pod-table").PodTableWithColumns<import("@undefineds.co/models/_drizzle-solid/types").ResolvedColumns<{
|
|
2
|
-
id: import("@undefineds.co/models/_drizzle-solid/columns").PodStringColumn<false, false>;
|
|
3
|
-
chatId: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"uri", null, true, false>;
|
|
4
|
-
title: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"string", null, false, false>;
|
|
5
|
-
starred: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"boolean", null, false, true>;
|
|
6
|
-
status: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"string", null, false, true>;
|
|
7
|
-
metadata: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"object", null, false, false>;
|
|
8
|
-
workspace: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"uri", null, false, false>;
|
|
9
|
-
createdAt: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"datetime", null, true, true>;
|
|
10
|
-
updatedAt: import("@undefineds.co/models/_drizzle-solid/columns").ColumnBuilder<"datetime", null, true, true>;
|
|
11
|
-
}>>, {
|
|
12
|
-
id: string;
|
|
13
|
-
chatId: string;
|
|
14
|
-
title: string;
|
|
15
|
-
starred: boolean;
|
|
16
|
-
status: string;
|
|
17
|
-
metadata: Record<string, unknown>;
|
|
18
|
-
workspace: string;
|
|
19
|
-
createdAt: Date;
|
|
20
|
-
updatedAt: Date;
|
|
21
|
-
}, {
|
|
22
|
-
chatId: string;
|
|
23
|
-
id?: string | undefined;
|
|
24
|
-
title?: string | undefined;
|
|
25
|
-
starred?: boolean | undefined;
|
|
26
|
-
status?: string | undefined;
|
|
27
|
-
metadata?: Record<string, unknown> | undefined;
|
|
28
|
-
workspace?: string | undefined;
|
|
29
|
-
createdAt?: Date | undefined;
|
|
30
|
-
updatedAt?: Date | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
id?: string | null | undefined;
|
|
33
|
-
chatId?: string | undefined;
|
|
34
|
-
title?: string | null | undefined;
|
|
35
|
-
starred?: boolean | null | undefined;
|
|
36
|
-
status?: string | null | undefined;
|
|
37
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
38
|
-
workspace?: string | null | undefined;
|
|
39
|
-
createdAt?: Date | undefined;
|
|
40
|
-
updatedAt?: Date | undefined;
|
|
41
|
-
}, Record<string, unknown>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { definePodRepository } from './repository.js';
|
|
2
|
-
import { threadTable } from './thread.schema.js';
|
|
3
|
-
export const threadRepository = definePodRepository({
|
|
4
|
-
namespace: 'thread',
|
|
5
|
-
table: threadTable,
|
|
6
|
-
searchableFields: ['title'],
|
|
7
|
-
defaultSort: { field: 'updatedAt', direction: 'desc' },
|
|
8
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { threadTable, type ThreadRow, type ThreadInsert, type ThreadUpdate, } from './core.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { threadTable, } from './core.js';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wave A CP0: collaboration-related richContent block contracts.
|
|
3
|
-
*
|
|
4
|
-
* These are minimal JSON shapes stored in MessageRow.richContent and consumed by downstream UIs.
|
|
5
|
-
* They intentionally do NOT include UI block runtime fields (id/createdAt/status, etc.).
|
|
6
|
-
*/
|
|
7
|
-
export type ToolRisk = 'low' | 'medium' | 'high';
|
|
8
|
-
export type ToolApprovalStatus = 'pending' | 'approved' | 'rejected' | 'auto_approved';
|
|
9
|
-
export interface ToolApprovalBlock {
|
|
10
|
-
type: 'tool_approval';
|
|
11
|
-
toolCallId: string;
|
|
12
|
-
toolName: string;
|
|
13
|
-
toolDescription: string;
|
|
14
|
-
arguments: Record<string, unknown>;
|
|
15
|
-
risk: ToolRisk;
|
|
16
|
-
status: ToolApprovalStatus;
|
|
17
|
-
approvedBy?: string;
|
|
18
|
-
approvedAt?: string;
|
|
19
|
-
decisionBy?: string;
|
|
20
|
-
decisionRole?: 'human' | 'secretary' | 'system';
|
|
21
|
-
onBehalfOf?: string;
|
|
22
|
-
reason?: string;
|
|
23
|
-
policyVersion?: string;
|
|
24
|
-
inboxItemId?: string;
|
|
25
|
-
}
|
|
26
|
-
export type TaskProgressStepStatus = 'pending' | 'running' | 'done' | 'error' | 'skipped';
|
|
27
|
-
export interface TaskProgressBlock {
|
|
28
|
-
type: 'task_progress';
|
|
29
|
-
taskId: string;
|
|
30
|
-
title: string;
|
|
31
|
-
steps: Array<{
|
|
32
|
-
id: string;
|
|
33
|
-
label: string;
|
|
34
|
-
status: TaskProgressStepStatus;
|
|
35
|
-
detail?: string;
|
|
36
|
-
duration?: number;
|
|
37
|
-
}>;
|
|
38
|
-
currentStep: number;
|
|
39
|
-
totalSteps: number;
|
|
40
|
-
}
|
|
41
|
-
export type ToolCallStatus = 'calling' | 'waiting_approval' | 'running' | 'done' | 'error';
|
|
42
|
-
export interface ToolCallBlock {
|
|
43
|
-
type: 'tool';
|
|
44
|
-
toolCallId: string;
|
|
45
|
-
toolName: string;
|
|
46
|
-
arguments: Record<string, unknown>;
|
|
47
|
-
status: ToolCallStatus;
|
|
48
|
-
result?: unknown;
|
|
49
|
-
error?: string;
|
|
50
|
-
duration?: number;
|
|
51
|
-
}
|
|
52
|
-
export type CollaborationRichBlock = ToolApprovalBlock | TaskProgressBlock | ToolCallBlock;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wave A CP0: collaboration-related richContent block contracts.
|
|
3
|
-
*
|
|
4
|
-
* These are minimal JSON shapes stored in MessageRow.richContent and consumed by downstream UIs.
|
|
5
|
-
* They intentionally do NOT include UI block runtime fields (id/createdAt/status, etc.).
|
|
6
|
-
*/
|
|
7
|
-
export {};
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import type { ToolApprovalStatus, ToolCallStatus, TaskProgressStepStatus } from './collaboration-blocks.js';
|
|
2
|
-
/**
|
|
3
|
-
* Message Block Types - 基于 Cherry Studio 的 block-based 消息系统
|
|
4
|
-
*
|
|
5
|
-
* 将消息内容拆分为多个块(blocks),支持:
|
|
6
|
-
* - 主文本 (Markdown)
|
|
7
|
-
* - 思考过程 (CoT/Reasoning)
|
|
8
|
-
* - 工具调用
|
|
9
|
-
* - 图片/文件
|
|
10
|
-
* - 引用/搜索结果
|
|
11
|
-
* - 错误信息
|
|
12
|
-
*/
|
|
13
|
-
export declare enum MessageBlockType {
|
|
14
|
-
/** 未知类型,用于流式响应开始前 */
|
|
15
|
-
UNKNOWN = "unknown",
|
|
16
|
-
/** 主要文本内容(Markdown) */
|
|
17
|
-
MAIN_TEXT = "main_text",
|
|
18
|
-
/** 思考过程(Claude、DeepSeek R1、OpenAI o-系列等) */
|
|
19
|
-
THINKING = "thinking",
|
|
20
|
-
/** 图片内容 */
|
|
21
|
-
IMAGE = "image",
|
|
22
|
-
/** 代码块(独立可运行) */
|
|
23
|
-
CODE = "code",
|
|
24
|
-
/** 工具调用及响应 */
|
|
25
|
-
TOOL = "tool",
|
|
26
|
-
/** 工具审批卡片 */
|
|
27
|
-
TOOL_APPROVAL = "tool_approval",
|
|
28
|
-
/** 任务进度卡片 */
|
|
29
|
-
TASK_PROGRESS = "task_progress",
|
|
30
|
-
/** 文件内容 */
|
|
31
|
-
FILE = "file",
|
|
32
|
-
/** 错误信息 */
|
|
33
|
-
ERROR = "error",
|
|
34
|
-
/** 引用类型(Web 搜索、知识库等) */
|
|
35
|
-
CITATION = "citation"
|
|
36
|
-
}
|
|
37
|
-
export declare enum MessageBlockStatus {
|
|
38
|
-
/** 等待处理 */
|
|
39
|
-
PENDING = "pending",
|
|
40
|
-
/** 正在处理,等待接收 */
|
|
41
|
-
PROCESSING = "processing",
|
|
42
|
-
/** 正在流式接收 */
|
|
43
|
-
STREAMING = "streaming",
|
|
44
|
-
/** 处理成功 */
|
|
45
|
-
SUCCESS = "success",
|
|
46
|
-
/** 处理错误 */
|
|
47
|
-
ERROR = "error",
|
|
48
|
-
/** 处理暂停 */
|
|
49
|
-
PAUSED = "paused"
|
|
50
|
-
}
|
|
51
|
-
export interface BaseMessageBlock {
|
|
52
|
-
/** 块 ID */
|
|
53
|
-
id: string;
|
|
54
|
-
/** 所属消息 ID */
|
|
55
|
-
messageId: string;
|
|
56
|
-
/** 块类型 */
|
|
57
|
-
type: MessageBlockType;
|
|
58
|
-
/** 创建时间 */
|
|
59
|
-
createdAt: string;
|
|
60
|
-
/** 更新时间 */
|
|
61
|
-
updatedAt?: string;
|
|
62
|
-
/** 块状态 */
|
|
63
|
-
status: MessageBlockStatus;
|
|
64
|
-
/** 使用的模型 */
|
|
65
|
-
model?: {
|
|
66
|
-
id: string;
|
|
67
|
-
name: string;
|
|
68
|
-
provider: string;
|
|
69
|
-
};
|
|
70
|
-
/** 通用元数据 */
|
|
71
|
-
metadata?: Record<string, unknown>;
|
|
72
|
-
/** 错误信息 */
|
|
73
|
-
error?: {
|
|
74
|
-
code?: string;
|
|
75
|
-
message: string;
|
|
76
|
-
details?: unknown;
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export interface PlaceholderMessageBlock extends BaseMessageBlock {
|
|
80
|
-
type: MessageBlockType.UNKNOWN;
|
|
81
|
-
}
|
|
82
|
-
export interface MainTextMessageBlock extends BaseMessageBlock {
|
|
83
|
-
type: MessageBlockType.MAIN_TEXT;
|
|
84
|
-
/** Markdown 内容 */
|
|
85
|
-
content: string;
|
|
86
|
-
/** 关联的知识库 ID */
|
|
87
|
-
knowledgeBaseIds?: string[];
|
|
88
|
-
/** 引用参考 */
|
|
89
|
-
citationReferences?: Array<{
|
|
90
|
-
citationBlockId?: string;
|
|
91
|
-
url?: string;
|
|
92
|
-
title?: string;
|
|
93
|
-
}>;
|
|
94
|
-
}
|
|
95
|
-
export interface ThinkingMessageBlock extends BaseMessageBlock {
|
|
96
|
-
type: MessageBlockType.THINKING;
|
|
97
|
-
/** 思考内容 */
|
|
98
|
-
content: string;
|
|
99
|
-
/** 思考耗时(毫秒) */
|
|
100
|
-
thinkingDuration?: number;
|
|
101
|
-
}
|
|
102
|
-
export interface CodeMessageBlock extends BaseMessageBlock {
|
|
103
|
-
type: MessageBlockType.CODE;
|
|
104
|
-
/** 代码内容 */
|
|
105
|
-
content: string;
|
|
106
|
-
/** 代码语言 */
|
|
107
|
-
language: string;
|
|
108
|
-
/** 是否可执行 */
|
|
109
|
-
executable?: boolean;
|
|
110
|
-
/** 执行结果 */
|
|
111
|
-
executionResult?: {
|
|
112
|
-
output?: string;
|
|
113
|
-
error?: string;
|
|
114
|
-
exitCode?: number;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
export interface ImageMessageBlock extends BaseMessageBlock {
|
|
118
|
-
type: MessageBlockType.IMAGE;
|
|
119
|
-
/** 图片 URL */
|
|
120
|
-
url?: string;
|
|
121
|
-
/** 本地文件路径 */
|
|
122
|
-
filePath?: string;
|
|
123
|
-
/** 图片元数据 */
|
|
124
|
-
metadata?: BaseMessageBlock['metadata'] & {
|
|
125
|
-
/** 生成提示词 */
|
|
126
|
-
prompt?: string;
|
|
127
|
-
/** 负面提示词 */
|
|
128
|
-
negativePrompt?: string;
|
|
129
|
-
/** 原始文件名 */
|
|
130
|
-
fileName?: string;
|
|
131
|
-
/** 文件大小 */
|
|
132
|
-
fileSize?: number;
|
|
133
|
-
/** 宽度 */
|
|
134
|
-
width?: number;
|
|
135
|
-
/** 高度 */
|
|
136
|
-
height?: number;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
export interface ToolMessageBlock extends BaseMessageBlock {
|
|
140
|
-
type: MessageBlockType.TOOL;
|
|
141
|
-
/** 协作链路中的工具调用 ID(与 CP0 ToolCallBlock 对齐) */
|
|
142
|
-
toolCallId?: string;
|
|
143
|
-
/** 工具 ID */
|
|
144
|
-
toolId: string;
|
|
145
|
-
/** 工具名称 */
|
|
146
|
-
toolName: string;
|
|
147
|
-
/** 调用参数 */
|
|
148
|
-
arguments?: Record<string, unknown>;
|
|
149
|
-
/** 响应内容 */
|
|
150
|
-
content?: string | object;
|
|
151
|
-
/** CP0 协作契约状态(waiting_approval / running / done ...) */
|
|
152
|
-
toolStatus?: ToolCallStatus;
|
|
153
|
-
/** 执行结果(CP0 ToolCallBlock.result) */
|
|
154
|
-
result?: unknown;
|
|
155
|
-
/** 错误信息(CP0 ToolCallBlock.error) */
|
|
156
|
-
toolError?: string;
|
|
157
|
-
/** 耗时(ms) */
|
|
158
|
-
duration?: number;
|
|
159
|
-
/** 工具元数据 */
|
|
160
|
-
metadata?: BaseMessageBlock['metadata'] & {
|
|
161
|
-
/** 是否来自 MCP */
|
|
162
|
-
isMcp?: boolean;
|
|
163
|
-
/** MCP 服务器名称 */
|
|
164
|
-
mcpServer?: string;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
export interface ToolApprovalMessageBlock extends BaseMessageBlock {
|
|
168
|
-
type: MessageBlockType.TOOL_APPROVAL;
|
|
169
|
-
toolCallId: string;
|
|
170
|
-
toolName: string;
|
|
171
|
-
toolDescription: string;
|
|
172
|
-
arguments: Record<string, unknown>;
|
|
173
|
-
risk: 'low' | 'medium' | 'high';
|
|
174
|
-
approvalStatus: ToolApprovalStatus;
|
|
175
|
-
approvedBy?: string;
|
|
176
|
-
approvedAt?: string;
|
|
177
|
-
decisionBy?: string;
|
|
178
|
-
decisionRole?: 'human' | 'secretary' | 'system';
|
|
179
|
-
onBehalfOf?: string;
|
|
180
|
-
reason?: string;
|
|
181
|
-
policyVersion?: string;
|
|
182
|
-
inboxItemId?: string;
|
|
183
|
-
}
|
|
184
|
-
export interface TaskProgressMessageBlock extends BaseMessageBlock {
|
|
185
|
-
type: MessageBlockType.TASK_PROGRESS;
|
|
186
|
-
taskId: string;
|
|
187
|
-
title: string;
|
|
188
|
-
steps: Array<{
|
|
189
|
-
id: string;
|
|
190
|
-
label: string;
|
|
191
|
-
status: TaskProgressStepStatus;
|
|
192
|
-
detail?: string;
|
|
193
|
-
duration?: number;
|
|
194
|
-
}>;
|
|
195
|
-
currentStep: number;
|
|
196
|
-
totalSteps: number;
|
|
197
|
-
}
|
|
198
|
-
export interface CitationMessageBlock extends BaseMessageBlock {
|
|
199
|
-
type: MessageBlockType.CITATION;
|
|
200
|
-
/** Web 搜索结果 */
|
|
201
|
-
webSearch?: {
|
|
202
|
-
query: string;
|
|
203
|
-
results: Array<{
|
|
204
|
-
title: string;
|
|
205
|
-
url: string;
|
|
206
|
-
snippet?: string;
|
|
207
|
-
favicon?: string;
|
|
208
|
-
}>;
|
|
209
|
-
};
|
|
210
|
-
/** 知识库引用 */
|
|
211
|
-
knowledge?: Array<{
|
|
212
|
-
id: string;
|
|
213
|
-
title: string;
|
|
214
|
-
content: string;
|
|
215
|
-
source?: string;
|
|
216
|
-
}>;
|
|
217
|
-
}
|
|
218
|
-
export interface FileMessageBlock extends BaseMessageBlock {
|
|
219
|
-
type: MessageBlockType.FILE;
|
|
220
|
-
/** 文件名 */
|
|
221
|
-
fileName: string;
|
|
222
|
-
/** 文件路径或 URL */
|
|
223
|
-
fileUrl: string;
|
|
224
|
-
/** 文件大小 */
|
|
225
|
-
fileSize?: number;
|
|
226
|
-
/** MIME 类型 */
|
|
227
|
-
mimeType?: string;
|
|
228
|
-
}
|
|
229
|
-
export interface ErrorMessageBlock extends BaseMessageBlock {
|
|
230
|
-
type: MessageBlockType.ERROR;
|
|
231
|
-
/** 错误消息 */
|
|
232
|
-
message: string;
|
|
233
|
-
/** 是否可重试 */
|
|
234
|
-
retryable?: boolean;
|
|
235
|
-
}
|
|
236
|
-
export type MessageBlock = PlaceholderMessageBlock | MainTextMessageBlock | ThinkingMessageBlock | CodeMessageBlock | ImageMessageBlock | ToolMessageBlock | ToolApprovalMessageBlock | TaskProgressMessageBlock | FileMessageBlock | ErrorMessageBlock | CitationMessageBlock;
|
|
237
|
-
/**
|
|
238
|
-
* 消息的 richContent JSON 结构
|
|
239
|
-
* 存储在 Message.richContent 字段中
|
|
240
|
-
*/
|
|
241
|
-
export interface MessageRichContent {
|
|
242
|
-
/** 向后兼容:思考内容 */
|
|
243
|
-
thought?: string;
|
|
244
|
-
/** 向后兼容:工具调用 */
|
|
245
|
-
toolInvocations?: Array<{
|
|
246
|
-
id: string;
|
|
247
|
-
toolName: string;
|
|
248
|
-
input: unknown;
|
|
249
|
-
output?: unknown;
|
|
250
|
-
error?: string;
|
|
251
|
-
}>;
|
|
252
|
-
/** 新的块系统 */
|
|
253
|
-
blocks?: MessageBlock[];
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* 创建块的工厂函数
|
|
257
|
-
*/
|
|
258
|
-
export declare function createMessageBlock<T extends MessageBlock>(type: T['type'], messageId: string, partial: Omit<T, 'id' | 'messageId' | 'type' | 'createdAt' | 'status'>): T;
|
|
259
|
-
/**
|
|
260
|
-
* 判断块类型
|
|
261
|
-
*/
|
|
262
|
-
export declare function isBlockType<T extends MessageBlock>(block: MessageBlock, type: T['type']): block is T;
|
|
263
|
-
/**
|
|
264
|
-
* 从 richContent JSON 解析块
|
|
265
|
-
*/
|
|
266
|
-
export declare function parseMessageBlocks(richContent: string | null | undefined): MessageBlock[];
|
|
267
|
-
/**
|
|
268
|
-
* 序列化块到 richContent JSON
|
|
269
|
-
*/
|
|
270
|
-
export declare function serializeMessageBlocks(blocks: MessageBlock[]): string;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Message Block Types - 基于 Cherry Studio 的 block-based 消息系统
|
|
3
|
-
*
|
|
4
|
-
* 将消息内容拆分为多个块(blocks),支持:
|
|
5
|
-
* - 主文本 (Markdown)
|
|
6
|
-
* - 思考过程 (CoT/Reasoning)
|
|
7
|
-
* - 工具调用
|
|
8
|
-
* - 图片/文件
|
|
9
|
-
* - 引用/搜索结果
|
|
10
|
-
* - 错误信息
|
|
11
|
-
*/
|
|
12
|
-
// 块类型枚举
|
|
13
|
-
export var MessageBlockType;
|
|
14
|
-
(function (MessageBlockType) {
|
|
15
|
-
/** 未知类型,用于流式响应开始前 */
|
|
16
|
-
MessageBlockType["UNKNOWN"] = "unknown";
|
|
17
|
-
/** 主要文本内容(Markdown) */
|
|
18
|
-
MessageBlockType["MAIN_TEXT"] = "main_text";
|
|
19
|
-
/** 思考过程(Claude、DeepSeek R1、OpenAI o-系列等) */
|
|
20
|
-
MessageBlockType["THINKING"] = "thinking";
|
|
21
|
-
/** 图片内容 */
|
|
22
|
-
MessageBlockType["IMAGE"] = "image";
|
|
23
|
-
/** 代码块(独立可运行) */
|
|
24
|
-
MessageBlockType["CODE"] = "code";
|
|
25
|
-
/** 工具调用及响应 */
|
|
26
|
-
MessageBlockType["TOOL"] = "tool";
|
|
27
|
-
/** 工具审批卡片 */
|
|
28
|
-
MessageBlockType["TOOL_APPROVAL"] = "tool_approval";
|
|
29
|
-
/** 任务进度卡片 */
|
|
30
|
-
MessageBlockType["TASK_PROGRESS"] = "task_progress";
|
|
31
|
-
/** 文件内容 */
|
|
32
|
-
MessageBlockType["FILE"] = "file";
|
|
33
|
-
/** 错误信息 */
|
|
34
|
-
MessageBlockType["ERROR"] = "error";
|
|
35
|
-
/** 引用类型(Web 搜索、知识库等) */
|
|
36
|
-
MessageBlockType["CITATION"] = "citation";
|
|
37
|
-
})(MessageBlockType || (MessageBlockType = {}));
|
|
38
|
-
// 块状态定义
|
|
39
|
-
export var MessageBlockStatus;
|
|
40
|
-
(function (MessageBlockStatus) {
|
|
41
|
-
/** 等待处理 */
|
|
42
|
-
MessageBlockStatus["PENDING"] = "pending";
|
|
43
|
-
/** 正在处理,等待接收 */
|
|
44
|
-
MessageBlockStatus["PROCESSING"] = "processing";
|
|
45
|
-
/** 正在流式接收 */
|
|
46
|
-
MessageBlockStatus["STREAMING"] = "streaming";
|
|
47
|
-
/** 处理成功 */
|
|
48
|
-
MessageBlockStatus["SUCCESS"] = "success";
|
|
49
|
-
/** 处理错误 */
|
|
50
|
-
MessageBlockStatus["ERROR"] = "error";
|
|
51
|
-
/** 处理暂停 */
|
|
52
|
-
MessageBlockStatus["PAUSED"] = "paused";
|
|
53
|
-
})(MessageBlockStatus || (MessageBlockStatus = {}));
|
|
54
|
-
/**
|
|
55
|
-
* 创建块的工厂函数
|
|
56
|
-
*/
|
|
57
|
-
export function createMessageBlock(type, messageId, partial) {
|
|
58
|
-
const id = `block-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
59
|
-
return {
|
|
60
|
-
id,
|
|
61
|
-
messageId,
|
|
62
|
-
type,
|
|
63
|
-
createdAt: new Date().toISOString(),
|
|
64
|
-
status: MessageBlockStatus.PENDING,
|
|
65
|
-
...partial,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 判断块类型
|
|
70
|
-
*/
|
|
71
|
-
export function isBlockType(block, type) {
|
|
72
|
-
return block.type === type;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* 从 richContent JSON 解析块
|
|
76
|
-
*/
|
|
77
|
-
export function parseMessageBlocks(richContent) {
|
|
78
|
-
if (!richContent)
|
|
79
|
-
return [];
|
|
80
|
-
try {
|
|
81
|
-
const parsed = JSON.parse(richContent);
|
|
82
|
-
// 如果有新的块系统,直接返回
|
|
83
|
-
if (parsed.blocks && parsed.blocks.length > 0) {
|
|
84
|
-
return parsed.blocks;
|
|
85
|
-
}
|
|
86
|
-
// 向后兼容:转换旧格式
|
|
87
|
-
const blocks = [];
|
|
88
|
-
if (parsed.thought) {
|
|
89
|
-
blocks.push({
|
|
90
|
-
id: 'legacy-thought',
|
|
91
|
-
messageId: '',
|
|
92
|
-
type: MessageBlockType.THINKING,
|
|
93
|
-
content: parsed.thought,
|
|
94
|
-
createdAt: new Date().toISOString(),
|
|
95
|
-
status: MessageBlockStatus.SUCCESS,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (parsed.toolInvocations) {
|
|
99
|
-
parsed.toolInvocations.forEach((ti, index) => {
|
|
100
|
-
blocks.push({
|
|
101
|
-
id: `legacy-tool-${index}`,
|
|
102
|
-
messageId: '',
|
|
103
|
-
type: MessageBlockType.TOOL,
|
|
104
|
-
toolId: ti.id,
|
|
105
|
-
toolName: ti.toolName,
|
|
106
|
-
arguments: ti.input,
|
|
107
|
-
content: ti.output ?? ti.error,
|
|
108
|
-
createdAt: new Date().toISOString(),
|
|
109
|
-
status: ti.error ? MessageBlockStatus.ERROR : MessageBlockStatus.SUCCESS,
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return blocks;
|
|
114
|
-
}
|
|
115
|
-
catch {
|
|
116
|
-
return [];
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* 序列化块到 richContent JSON
|
|
121
|
-
*/
|
|
122
|
-
export function serializeMessageBlocks(blocks) {
|
|
123
|
-
const content = { blocks };
|
|
124
|
-
return JSON.stringify(content);
|
|
125
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../namespaces.js';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** Chat channel vocab (thin place/container). */
|
|
2
|
-
export declare const ChatBaseVocab: {
|
|
3
|
-
readonly title: string;
|
|
4
|
-
readonly description: string;
|
|
5
|
-
readonly avatarUrl: string;
|
|
6
|
-
readonly participants: string;
|
|
7
|
-
readonly metadata: string;
|
|
8
|
-
readonly starred: string;
|
|
9
|
-
readonly muted: string;
|
|
10
|
-
readonly unreadCount: string;
|
|
11
|
-
readonly lastActiveAt: string;
|
|
12
|
-
readonly lastMessageId: string;
|
|
13
|
-
readonly lastMessagePreview: string;
|
|
14
|
-
readonly createdAt: string;
|
|
15
|
-
readonly updatedAt: string;
|
|
16
|
-
};
|