@zhin.js/core 1.5.16 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -195
- package/lib/ai-completion-contract.d.ts +135 -0
- package/lib/ai-completion-contract.js +69 -0
- package/lib/built/ai-access.d.ts +2 -21
- package/lib/built/ai-access.js +1 -46
- package/lib/built/ai-outbound/index.d.ts +0 -2
- package/lib/built/ai-outbound/index.js +0 -2
- package/lib/built/ai-outbound/prompt.d.ts +2 -0
- package/lib/built/ai-outbound/prompt.js +2 -0
- package/lib/built/ai-outbound/types.d.ts +1 -10
- package/lib/built/ai-trigger.d.ts +39 -78
- package/lib/built/ai-trigger.js +3 -254
- package/lib/built/common-adapter-tools.d.ts +21 -6
- package/lib/built/common-adapter-tools.js +28 -17
- package/lib/built/generic-segment-mapper.js +4 -1
- package/lib/built/html-segment-fallback.d.ts +6 -7
- package/lib/built/html-segment-fallback.js +1 -16
- package/lib/built/html-to-text.d.ts +0 -3
- package/lib/built/html-to-text.js +131 -40
- package/lib/built/interaction-messages.d.ts +1 -0
- package/lib/built/interaction-messages.js +30 -0
- package/lib/built/interactive-segments/action.d.ts +3 -4
- package/lib/built/interactive-segments/action.js +2 -5
- package/lib/built/interactive-segments/index.d.ts +0 -2
- package/lib/built/interactive-segments/index.js +0 -2
- package/lib/built/interactive-segments/keyboard-segment.d.ts +0 -1
- package/lib/built/interactive-segments/keyboard-segment.js +0 -1
- package/lib/built/interactive-segments/onebot-keyboard.d.ts +0 -1
- package/lib/built/interactive-segments/onebot-keyboard.js +0 -2
- package/lib/built/interactive-segments/resolve.d.ts +2 -3
- package/lib/built/interactive-segments/resolve.js +21 -14
- package/lib/built/interactive-segments/types.d.ts +2 -7
- package/lib/built/interactive-segments/types.js +22 -2
- package/lib/built/login-assist.d.ts +330 -25
- package/lib/built/login-assist.js +1156 -75
- package/lib/built/login-captcha.d.ts +62 -0
- package/lib/built/login-captcha.js +107 -0
- package/lib/built/message-enrich.d.ts +24 -27
- package/lib/built/message-enrich.js +53 -49
- package/lib/built/outbound-content-arrays.d.ts +4 -0
- package/lib/built/outbound-content-arrays.js +32 -0
- package/lib/built/outbound-media-trust.d.ts +46 -0
- package/lib/built/outbound-media-trust.js +245 -0
- package/lib/built/outbound-media-utils.d.ts +5 -3
- package/lib/built/outbound-media-utils.js +5 -3
- package/lib/built/readable-link.d.ts +4 -0
- package/lib/built/readable-link.js +32 -0
- package/lib/built/rich-segments/markdown-to-text.d.ts +1 -2
- package/lib/built/rich-segments/markdown-to-text.js +141 -17
- package/lib/built/roles.d.ts +141 -12
- package/lib/built/roles.js +253 -52
- package/lib/built/segment-contract/assert.js +8 -2
- package/lib/built/segment-contract/delivery.js +1 -0
- package/lib/built/segment-contract/index.d.ts +3 -3
- package/lib/built/segment-contract/index.js +2 -2
- package/lib/built/segment-contract/json-schema.d.ts +39 -5
- package/lib/built/segment-contract/json-schema.js +207 -24
- package/lib/built/segment-contract/preview.js +8 -1
- package/lib/built/segment-contract/text.js +1 -1
- package/lib/built/segment-contract/types.d.ts +2 -2
- package/lib/built/segment-contract/validate.d.ts +1553 -224
- package/lib/built/segment-contract/validate.js +39 -3
- package/lib/built/tool-access.d.ts +5 -0
- package/lib/built/tool-access.js +17 -0
- package/lib/built/user-interaction.d.ts +5 -4
- package/lib/built/user-interaction.js +64 -52
- package/lib/errors.d.ts +1 -18
- package/lib/errors.js +1 -26
- package/lib/feature/command-public-api.d.ts +5 -0
- package/lib/feature/command-public-api.js +5 -0
- package/lib/feature/command.d.ts +2 -0
- package/lib/feature/command.js +1 -0
- package/lib/feature/component.d.ts +1 -0
- package/lib/feature/component.js +1 -0
- package/lib/feature/handler.d.ts +13 -7
- package/lib/feature/handler.js +2 -1
- package/lib/feature/middleware-public-api.d.ts +6 -0
- package/lib/feature/middleware-public-api.js +6 -0
- package/lib/feature/middleware.d.ts +22 -2
- package/lib/feature/middleware.js +7 -2
- package/lib/im-scene.d.ts +4 -3
- package/lib/im-scene.js +9 -9
- package/lib/im-session-id.d.ts +20 -12
- package/lib/im-session-id.js +8 -8
- package/lib/index.d.ts +20 -48
- package/lib/index.js +15 -41
- package/lib/jsx/intrinsic-elements.d.ts +83 -0
- package/lib/jsx/message-renderer.d.ts +13 -0
- package/lib/jsx/message-renderer.js +128 -0
- package/lib/jsx/message-tags.d.ts +133 -0
- package/lib/jsx/message-tags.js +50 -0
- package/lib/jsx-dev-runtime.d.ts +2 -2
- package/lib/jsx-dev-runtime.js +1 -2
- package/lib/jsx-runtime.d.ts +2 -12
- package/lib/jsx-runtime.js +1 -10
- package/lib/jsx.d.ts +6 -30
- package/lib/jsx.js +3 -93
- package/lib/message.d.ts +0 -40
- package/lib/message.js +1 -27
- package/lib/models/system-log.d.ts +0 -2
- package/lib/models/system-log.js +1 -8
- package/lib/models/user.d.ts +0 -2
- package/lib/models/user.js +1 -7
- package/lib/notice.d.ts +38 -33
- package/lib/notice.js +23 -7
- package/lib/plugin-runtime/im/command-feedback.d.ts +59 -0
- package/lib/plugin-runtime/im/command-feedback.js +148 -0
- package/lib/plugin-runtime/im/contracts.d.ts +217 -32
- package/lib/plugin-runtime/im/contracts.js +141 -23
- package/lib/plugin-runtime/im/conversation-runtime.d.ts +42 -0
- package/lib/plugin-runtime/im/conversation-runtime.js +451 -0
- package/lib/plugin-runtime/im/endpoint-runtime.d.ts +112 -0
- package/lib/plugin-runtime/im/endpoint-runtime.js +434 -0
- package/lib/plugin-runtime/im/feature-gate.d.ts +21 -0
- package/lib/plugin-runtime/im/feature-gate.js +88 -0
- package/lib/plugin-runtime/im/host/component-host-installer.d.ts +2 -0
- package/lib/plugin-runtime/im/host/component-host-installer.js +14 -0
- package/lib/plugin-runtime/im/host/conversation-migration.d.ts +5 -0
- package/lib/plugin-runtime/im/host/conversation-migration.js +75 -0
- package/lib/plugin-runtime/im/host/database-config.d.ts +10 -0
- package/lib/plugin-runtime/im/host/database-config.js +152 -0
- package/lib/plugin-runtime/im/host/database-console-schema.d.ts +79 -0
- package/lib/plugin-runtime/im/host/database-console-schema.js +477 -0
- package/lib/plugin-runtime/im/host/database-console-sql.d.ts +66 -0
- package/lib/plugin-runtime/im/host/database-console-sql.js +459 -0
- package/lib/plugin-runtime/im/host/database-host-installer.d.ts +60 -0
- package/lib/plugin-runtime/im/host/database-host-installer.js +1166 -0
- package/lib/plugin-runtime/im/host/database-state.d.ts +9 -0
- package/lib/plugin-runtime/im/host/database-state.js +91 -0
- package/lib/plugin-runtime/im/host/index.d.ts +8 -0
- package/lib/plugin-runtime/im/host/index.js +8 -0
- package/lib/plugin-runtime/im/host/locale-host-installer.d.ts +3 -0
- package/lib/plugin-runtime/im/host/locale-host-installer.js +60 -0
- package/lib/plugin-runtime/im/host/outbound-host-installer.d.ts +8 -0
- package/lib/plugin-runtime/im/host/outbound-host-installer.js +153 -0
- package/lib/plugin-runtime/im/host/sender-enrichment.d.ts +34 -0
- package/lib/plugin-runtime/im/host/sender-enrichment.js +82 -0
- package/lib/plugin-runtime/im/im-runtime.d.ts +40 -111
- package/lib/plugin-runtime/im/im-runtime.js +235 -1059
- package/lib/plugin-runtime/im/inbound-dedup.d.ts +84 -0
- package/lib/plugin-runtime/im/inbound-dedup.js +322 -0
- package/lib/plugin-runtime/im/inbound-origin.d.ts +150 -0
- package/lib/plugin-runtime/im/inbound-origin.js +183 -0
- package/lib/plugin-runtime/im/inbound-runtime.d.ts +59 -0
- package/lib/plugin-runtime/im/inbound-runtime.js +478 -0
- package/lib/plugin-runtime/im/inbound-spine.d.ts +196 -0
- package/lib/plugin-runtime/im/inbound-spine.js +335 -0
- package/lib/plugin-runtime/im/index.d.ts +15 -4
- package/lib/plugin-runtime/im/index.js +11 -4
- package/lib/plugin-runtime/im/interaction-runtime.d.ts +50 -0
- package/lib/plugin-runtime/im/interaction-runtime.js +390 -0
- package/lib/plugin-runtime/im/interactive-router.d.ts +81 -0
- package/lib/plugin-runtime/im/interactive-router.js +382 -0
- package/lib/plugin-runtime/im/message-diagnostics.d.ts +70 -0
- package/lib/plugin-runtime/im/message-diagnostics.js +182 -0
- package/lib/plugin-runtime/im/message-dispatcher.d.ts +18 -4
- package/lib/plugin-runtime/im/message-dispatcher.js +138 -20
- package/lib/plugin-runtime/im/message-events.d.ts +85 -0
- package/lib/plugin-runtime/im/message-events.js +113 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.d.ts +39 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.js +450 -0
- package/lib/plugin-runtime/im/outbound-renderer.d.ts +52 -3
- package/lib/plugin-runtime/im/outbound-renderer.js +188 -8
- package/lib/plugin-runtime/im/outbound-segments.d.ts +29 -5
- package/lib/plugin-runtime/im/outbound-segments.js +130 -36
- package/lib/plugin-runtime/im/progressive-reply.d.ts +58 -0
- package/lib/plugin-runtime/im/progressive-reply.js +501 -0
- package/lib/plugin-runtime/im/public-api.d.ts +1 -1
- package/lib/request.d.ts +27 -36
- package/lib/request.js +14 -6
- package/lib/side-event/base.d.ts +64 -44
- package/lib/side-event/base.js +72 -19
- package/lib/side-event/index.d.ts +1 -1
- package/lib/side-event/index.js +1 -1
- package/lib/side-event/normalize.d.ts +7 -38
- package/lib/side-event/normalize.js +4 -109
- package/lib/side-event/scene-events.d.ts +40 -0
- package/lib/side-event/scene-events.js +147 -0
- package/lib/side-event/types.d.ts +4 -13
- package/lib/side-event/types.js +1 -55
- package/lib/system-event.d.ts +17 -12
- package/lib/system-event.js +8 -6
- package/lib/types.d.ts +23 -167
- package/lib/utils.d.ts +50 -33
- package/lib/utils.js +12 -185
- package/lib/venue/contracts.d.ts +21 -0
- package/lib/venue/contracts.js +3 -0
- package/lib/venue/floor-controller.d.ts +11 -0
- package/lib/venue/floor-controller.js +63 -0
- package/lib/venue/index.d.ts +13 -0
- package/lib/venue/index.js +11 -0
- package/lib/venue/membership-port.d.ts +23 -0
- package/lib/venue/membership-port.js +141 -0
- package/lib/venue/projector.d.ts +38 -0
- package/lib/venue/projector.js +45 -0
- package/lib/venue/registry.d.ts +16 -0
- package/lib/venue/registry.js +63 -0
- package/lib/venue/router.d.ts +19 -0
- package/lib/venue/router.js +101 -0
- package/lib/venue/send-limiter.d.ts +17 -0
- package/lib/venue/send-limiter.js +73 -0
- package/lib/venue/validator.d.ts +6 -0
- package/lib/venue/validator.js +160 -0
- package/package.json +24 -50
- package/lib/adapter.d.ts +0 -145
- package/lib/adapter.js +0 -377
- package/lib/built/adapter-process.d.ts +0 -58
- package/lib/built/adapter-process.js +0 -128
- package/lib/built/agent-preset.d.ts +0 -64
- package/lib/built/agent-preset.js +0 -79
- package/lib/built/ai-outbound/adapter-access.d.ts +0 -3
- package/lib/built/ai-outbound/adapter-access.js +0 -9
- package/lib/built/ai-outbound/extensions/qq-message.d.ts +0 -3
- package/lib/built/ai-outbound/extensions/qq-message.js +0 -23
- package/lib/built/authorization.d.ts +0 -10
- package/lib/built/authorization.js +0 -76
- package/lib/built/command.d.ts +0 -72
- package/lib/built/command.js +0 -105
- package/lib/built/component.d.ts +0 -67
- package/lib/built/component.js +0 -97
- package/lib/built/config.d.ts +0 -98
- package/lib/built/config.js +0 -372
- package/lib/built/connect-endpoint-instance.d.ts +0 -17
- package/lib/built/connect-endpoint-instance.js +0 -42
- package/lib/built/database.d.ts +0 -68
- package/lib/built/database.js +0 -106
- package/lib/built/dispatcher.d.ts +0 -141
- package/lib/built/dispatcher.js +0 -383
- package/lib/built/endpoint-commands.d.ts +0 -3
- package/lib/built/endpoint-commands.js +0 -99
- package/lib/built/endpoint-lifecycle-service.d.ts +0 -28
- package/lib/built/endpoint-lifecycle-service.js +0 -242
- package/lib/built/endpoint-lifecycle.d.ts +0 -27
- package/lib/built/endpoint-lifecycle.js +0 -36
- package/lib/built/endpoint-manager.d.ts +0 -34
- package/lib/built/html-renderer-loader.d.ts +0 -13
- package/lib/built/html-renderer-loader.js +0 -33
- package/lib/built/inbound-pipeline.d.ts +0 -37
- package/lib/built/inbound-pipeline.js +0 -63
- package/lib/built/inbound-runner.d.ts +0 -22
- package/lib/built/inbound-runner.js +0 -34
- package/lib/built/interactive-segment-contract.d.ts +0 -6
- package/lib/built/interactive-segment-contract.js +0 -9
- package/lib/built/interactive-segments/fallback-store.d.ts +0 -29
- package/lib/built/interactive-segments/fallback-store.js +0 -63
- package/lib/built/interactive-segments/handlers.d.ts +0 -16
- package/lib/built/interactive-segments/handlers.js +0 -74
- package/lib/built/introspection-format.d.ts +0 -10
- package/lib/built/introspection-format.js +0 -28
- package/lib/built/management-command-guard.d.ts +0 -15
- package/lib/built/management-command-guard.js +0 -25
- package/lib/built/message-filter.d.ts +0 -176
- package/lib/built/message-filter.js +0 -239
- package/lib/built/optional-peer-import.d.ts +0 -3
- package/lib/built/optional-peer-import.js +0 -33
- package/lib/built/outbound-media-contract.d.ts +0 -22
- package/lib/built/outbound-media-contract.js +0 -10
- package/lib/built/permission.d.ts +0 -51
- package/lib/built/permission.js +0 -99
- package/lib/built/permit-check.d.ts +0 -7
- package/lib/built/permit-check.js +0 -35
- package/lib/built/permit-parse.d.ts +0 -16
- package/lib/built/permit-parse.js +0 -32
- package/lib/built/platform-permit.d.ts +0 -20
- package/lib/built/platform-permit.js +0 -91
- package/lib/built/queue-im-field-contract.d.ts +0 -32
- package/lib/built/queue-im-field-contract.js +0 -67
- package/lib/built/rich-segments/adapter-policies.d.ts +0 -9
- package/lib/built/rich-segments/adapter-policies.js +0 -27
- package/lib/built/rich-segments/base.d.ts +0 -11
- package/lib/built/rich-segments/base.js +0 -24
- package/lib/built/rich-segments/builtins.d.ts +0 -4
- package/lib/built/rich-segments/builtins.js +0 -40
- package/lib/built/rich-segments/capabilities.d.ts +0 -6
- package/lib/built/rich-segments/capabilities.js +0 -38
- package/lib/built/rich-segments/html-segment.d.ts +0 -15
- package/lib/built/rich-segments/html-segment.js +0 -62
- package/lib/built/rich-segments/index.d.ts +0 -13
- package/lib/built/rich-segments/index.js +0 -13
- package/lib/built/rich-segments/markdown-segment.d.ts +0 -14
- package/lib/built/rich-segments/markdown-segment.js +0 -58
- package/lib/built/rich-segments/qrcode-segment.d.ts +0 -18
- package/lib/built/rich-segments/qrcode-segment.js +0 -73
- package/lib/built/rich-segments/registry.d.ts +0 -16
- package/lib/built/rich-segments/registry.js +0 -52
- package/lib/built/rich-segments/resolve.d.ts +0 -5
- package/lib/built/rich-segments/resolve.js +0 -87
- package/lib/built/rich-segments/tts-segment.d.ts +0 -13
- package/lib/built/rich-segments/tts-segment.js +0 -51
- package/lib/built/rich-segments/types.d.ts +0 -79
- package/lib/built/rich-segments/types.js +0 -17
- package/lib/built/runtime-io.d.ts +0 -9
- package/lib/built/runtime-io.js +0 -67
- package/lib/built/schedule.d.ts +0 -54
- package/lib/built/schedule.js +0 -112
- package/lib/built/schema-endpoint-manager.d.ts +0 -17
- package/lib/built/schema-endpoint-manager.js +0 -73
- package/lib/built/schema-feature.d.ts +0 -77
- package/lib/built/schema-feature.js +0 -130
- package/lib/built/skill.d.ts +0 -120
- package/lib/built/skill.js +0 -151
- package/lib/built/speech-loader.d.ts +0 -14
- package/lib/built/speech-loader.js +0 -32
- package/lib/built/tool.d.ts +0 -151
- package/lib/built/tool.js +0 -388
- package/lib/command.d.ts +0 -50
- package/lib/command.js +0 -106
- package/lib/component.d.ts +0 -26
- package/lib/component.js +0 -583
- package/lib/endpoint-capabilities.d.ts +0 -46
- package/lib/endpoint-capabilities.js +0 -55
- package/lib/endpoint.d.ts +0 -19
- package/lib/endpoint.js +0 -3
- package/lib/host-plugin-registry.d.ts +0 -8
- package/lib/host-plugin-registry.js +0 -12
- package/lib/plugin-context.d.ts +0 -27
- package/lib/plugin-context.js +0 -64
- package/lib/plugin-runtime/im/interactive.d.ts +0 -26
- package/lib/plugin-runtime/im/interactive.js +0 -46
- package/lib/plugin-runtime/im/login-assist-host.d.ts +0 -6
- package/lib/plugin-runtime/im/login-assist-host.js +0 -6
- package/lib/plugin-runtime/im/message-bus.d.ts +0 -38
- package/lib/plugin-runtime/im/message-bus.js +0 -40
- package/lib/plugin-runtime/im/service-tokens.d.ts +0 -18
- package/lib/plugin-runtime/im/service-tokens.js +0 -13
- package/lib/plugin.d.ts +0 -268
- package/lib/plugin.js +0 -583
- package/lib/schema-interaction.d.ts +0 -117
- package/lib/schema-interaction.js +0 -247
- package/lib/side-event/dispatch.d.ts +0 -15
- package/lib/side-event/dispatch.js +0 -140
- package/lib/tool-zod.d.ts +0 -43
- package/lib/tool-zod.js +0 -184
- /package/lib/{built/endpoint-manager.js → jsx/intrinsic-elements.js} +0 -0
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
import { Scope, generationAdmissionBinder, type GenerationAdmissionGate, type
|
|
2
|
-
import {
|
|
3
|
-
import { type
|
|
4
|
-
import { type ConversationEventStore, type ConversationContextBlock, type ConversationReference, type ConversationResolution, type ConversationRef, type DeliveryReceipt
|
|
5
|
-
import { Message, type
|
|
1
|
+
import { Scope, generationAdmissionBinder, type GenerationAdmissionGate, type RuntimeSnapshot, type SnapshotLease, type SnapshotReader } from '@zhin.js/plugin-runtime';
|
|
2
|
+
import { PermissionHost } from '@zhin.js/permission';
|
|
3
|
+
import { type EndpointContentResolveContext, type EndpointEventGateway, type PeerRegistry } from '@zhin.js/adapter';
|
|
4
|
+
import { type ConversationEventStore, type ConversationEventReader, type ConversationContextBlock, type ConversationReference, type ConversationResolution, type ConversationRef, type DeliveryReceipt } from '@zhin.js/im-contract';
|
|
5
|
+
import { Message, type IncomingMessage, type OutboundMessageService, type MessageSenderRef, type SendRequest } from './contracts.js';
|
|
6
6
|
import { LoginAssist } from '../../built/login-assist.js';
|
|
7
|
-
import type { UserInteraction } from '@zhin.js/
|
|
8
|
-
import { OutboundRenderer } from './outbound-renderer.js';
|
|
9
|
-
import { type
|
|
7
|
+
import type { UserInteraction } from '@zhin.js/im-contract';
|
|
8
|
+
import type { OutboundRenderer } from './outbound-renderer.js';
|
|
9
|
+
import { type PendingUserInteraction } from './interaction-runtime.js';
|
|
10
|
+
import { EndpointRuntime } from './endpoint-runtime.js';
|
|
11
|
+
import { MessageBus, type RuntimeMessageEventSource, type RuntimeSceneEventSource } from './message-events.js';
|
|
12
|
+
import { InboundDeduper } from './inbound-dedup.js';
|
|
13
|
+
import { type RuntimeMessageDiagnosticsReader } from './message-diagnostics.js';
|
|
14
|
+
/**
|
|
15
|
+
* Plugin Runtime login-assist port(与出站消息服务并列)。
|
|
16
|
+
* 适配器 waitForInput;Console / stdin 经 listPending + submit 消费。
|
|
17
|
+
*/
|
|
18
|
+
export declare const loginAssistToken: import("@zhin.js/plugin-runtime").Token<LoginAssist>;
|
|
10
19
|
/** @public Stable inbound and outbound IM gateway token for Adapter integrations. */
|
|
11
20
|
export declare const outboundMessageToken: import("@zhin.js/plugin-runtime").Token<OutboundMessageService>;
|
|
12
|
-
/** Generation-owned ingress hooks before ordinary dispatch and after it misses. */
|
|
13
|
-
export interface IngressRoute {
|
|
14
|
-
preRoute?(message: Message, lease: SnapshotLease, requester: PluginId, conversationSequence: number | undefined): Promise<boolean>;
|
|
15
|
-
/** A live pre-route handoff that must run before handlers and commands. */
|
|
16
|
-
shouldRouteBeforeDispatch?(message: Message): boolean;
|
|
17
|
-
route(message: Message, lease: SnapshotLease, requester: PluginId, conversationSequence: number | undefined): Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
export declare const ingressRouteToken: import("@zhin.js/plugin-runtime").Token<IngressRoute>;
|
|
20
|
-
/** Console 实时消息事件(SSE 推送源;content 仅为截断预览,不含完整原始段)。 */
|
|
21
|
-
export interface RuntimeMessageEvent {
|
|
22
|
-
readonly direction: 'inbound' | 'outbound';
|
|
23
|
-
readonly conversation: ConversationRef;
|
|
24
|
-
/** inbound:发送者。 */
|
|
25
|
-
readonly sender?: MessageSenderRef;
|
|
26
|
-
/** outbound:发起方插件。 */
|
|
27
|
-
readonly requester?: PluginId;
|
|
28
|
-
/** 预览文本,截断至 200 字。 */
|
|
29
|
-
readonly contentPreview: string;
|
|
30
|
-
readonly messageId?: string;
|
|
31
|
-
readonly timestamp: number;
|
|
32
|
-
}
|
|
33
|
-
export declare const messagePreviewLimit = 200;
|
|
34
21
|
export interface ImRuntimeOptions {
|
|
35
22
|
/**
|
|
36
23
|
* 全局静态命令前缀(如 `'/'`)。缺省时按适配器实例 config 的
|
|
@@ -42,19 +29,34 @@ export interface ImRuntimeOptions {
|
|
|
42
29
|
/** Process-root ingress claim (pending interaction, authentication challenge, etc.). */
|
|
43
30
|
readonly inboundClaim?: (message: Message) => boolean | Promise<boolean>;
|
|
44
31
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
32
|
+
* 探测 `inboundClaim` 这类进程级 prompt 在该 Endpoint 上、对该发送者是否有待回答项。
|
|
33
|
+
* Room Router 用它把消息送到持有待回答状态的成员 Endpoint。必须同步、无副作用。
|
|
34
|
+
* 仓库内没有生产实现;缺省按 false(即 inboundClaim 的待回答不参与 Room 路由)。
|
|
35
|
+
*/
|
|
36
|
+
readonly inboundClaimPending?: (conversation: ConversationRef, senderId: string) => boolean;
|
|
37
|
+
/** 覆盖进程级 Peer Registry(测试用,避免污染单例)。 */
|
|
38
|
+
readonly peerRegistry?: Pick<PeerRegistry, 'lookup' | 'isReady' | 'selfOf'>;
|
|
39
|
+
/** @internal 覆盖入站去重器(测试用);去重仅作用于 Room 会话。 */
|
|
40
|
+
readonly inboundDeduper?: Pick<InboundDeduper, 'claim'> & Partial<Pick<InboundDeduper, 'arbitrate'>>;
|
|
41
|
+
/**
|
|
42
|
+
* 入站 sender 增强(ADR 0056):在构造 Message 前设置 `sender.chatRole`(会话链上的最高聊天角色)
|
|
43
|
+
* 并归一 `sender.platform`,使整个下游链路(命令分发、agent ingress 等)读到同一份角色。
|
|
47
44
|
*
|
|
48
|
-
*
|
|
45
|
+
* 通常为 {@link createChatRoleSenderEnricher} 的结果。缺省时只归一平台身份并丢弃适配器自带的 `chatRole`。
|
|
49
46
|
*/
|
|
50
47
|
readonly enrichSender?: (sender: MessageSenderRef | undefined, conversation: IncomingMessage['conversation'], snapshot: RuntimeSnapshot) => MessageSenderRef | undefined;
|
|
51
48
|
}
|
|
52
49
|
export declare class ImRuntime implements OutboundMessageService {
|
|
53
50
|
#private;
|
|
54
|
-
|
|
51
|
+
readonly messageDiagnostics: RuntimeMessageDiagnosticsReader;
|
|
52
|
+
readonly messageEvents: RuntimeMessageEventSource;
|
|
53
|
+
/** #996: scene facts (mute, join request, poke, …) as soon as they are stored, for wake-up observers. */
|
|
54
|
+
readonly sceneEvents: RuntimeSceneEventSource;
|
|
55
|
+
readonly endpoints: EndpointRuntime;
|
|
55
56
|
constructor(options?: ImRuntimeOptions);
|
|
56
57
|
/** Process composition replaces the bootstrap memory store after required DB activation. */
|
|
57
58
|
replaceConversationEventStore(store: ConversationEventStore): void;
|
|
59
|
+
get conversationEventReader(): ConversationEventReader;
|
|
58
60
|
/** Pins all nested IM operations to the snapshot current at operation ingress. */
|
|
59
61
|
runWithSnapshotView<T>(operation: () => Promise<T>): Promise<T>;
|
|
60
62
|
resolveConversationReference(lease: SnapshotLease, reference: ConversationReference, context: EndpointContentResolveContext): Promise<ConversationResolution>;
|
|
@@ -64,7 +66,7 @@ export declare class ImRuntime implements OutboundMessageService {
|
|
|
64
66
|
}>>;
|
|
65
67
|
commitConversationContext(conversation: ConversationRef, consumer: string, cursor: number): Promise<void>;
|
|
66
68
|
attach(snapshots: SnapshotReader): void;
|
|
67
|
-
readonly permissionHost:
|
|
69
|
+
readonly permissionHost: PermissionHost;
|
|
68
70
|
readonly messageBus: MessageBus;
|
|
69
71
|
readonly loginAssist: LoginAssist;
|
|
70
72
|
install(resources: Scope): void;
|
|
@@ -77,7 +79,7 @@ export declare class ImRuntime implements OutboundMessageService {
|
|
|
77
79
|
* 注册 interactive action 回跳 handler(prefix 最长匹配;返回注销函数)。
|
|
78
80
|
* 在 Command dispatch 之前路由:action 段 / 数字回跳 / 指令预填 payload。
|
|
79
81
|
*/
|
|
80
|
-
registerInteractiveHandler(prefix: string, handler:
|
|
82
|
+
registerInteractiveHandler(prefix: string, handler: (message: Message) => Promise<boolean> | boolean): () => void;
|
|
81
83
|
/**
|
|
82
84
|
* User interaction bound to this conversation.
|
|
83
85
|
* `bind.subjectId` waits for that user (e.g. master) instead of the message sender.
|
|
@@ -85,32 +87,11 @@ export declare class ImRuntime implements OutboundMessageService {
|
|
|
85
87
|
createInteraction(message: Message, bind?: {
|
|
86
88
|
readonly subjectId: string;
|
|
87
89
|
}): UserInteraction | undefined;
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
* 返回注销函数。listener 抛错不会阻断消息链路。
|
|
91
|
-
*/
|
|
92
|
-
onMessage(listener: (event: RuntimeMessageEvent) => void): () => void;
|
|
90
|
+
/** Reads a prompt within the caller's current generation lease; answering uses the original IM ingress. */
|
|
91
|
+
readPendingInteraction(conversation: ConversationRef, subjectId: string, generation: number): PendingUserInteraction | undefined;
|
|
93
92
|
send(request: SendRequest): Promise<DeliveryReceipt>;
|
|
94
93
|
/** Sends through the exact generation lease that admitted the current operation. */
|
|
95
94
|
sendWithSnapshotLease(lease: SnapshotLease, request: SendRequest): Promise<DeliveryReceipt>;
|
|
96
|
-
receiveEndpointEvent(event: EndpointEvent, admission?: GenerationAdmissionGate): Promise<unknown>;
|
|
97
|
-
/** Console `endpoint.list` — empty until Adapter Feature projection is ready. */
|
|
98
|
-
listEndpoints(): readonly {
|
|
99
|
-
readonly id: string;
|
|
100
|
-
readonly name: string;
|
|
101
|
-
readonly adapter: string;
|
|
102
|
-
readonly owner: string;
|
|
103
|
-
readonly connected: boolean;
|
|
104
|
-
readonly status: 'online' | 'offline';
|
|
105
|
-
readonly phase: AdapterEndpointPhase;
|
|
106
|
-
readonly operations: readonly AdapterOperation[];
|
|
107
|
-
readonly managementCapabilities: readonly EndpointManagementCapability[];
|
|
108
|
-
}[];
|
|
109
|
-
/** Exact operation capabilities for one concrete live Endpoint. */
|
|
110
|
-
endpointCapabilities(input: {
|
|
111
|
-
readonly adapter: string;
|
|
112
|
-
readonly endpointKey: string;
|
|
113
|
-
}): EndpointCapabilities | undefined;
|
|
114
95
|
/**
|
|
115
96
|
* Console `GET /api/stats` 同源计数:非 root 插件节点 + AdapterIndex endpoints。
|
|
116
97
|
* 供命令 / 状态卡等在 Plugin Runtime 下读取(legacy `root.adapters` / `root.children` 已不存在)。
|
|
@@ -122,56 +103,4 @@ export declare class ImRuntime implements OutboundMessageService {
|
|
|
122
103
|
readonly online: number;
|
|
123
104
|
};
|
|
124
105
|
}>;
|
|
125
|
-
getEndpoint(adapter: string, endpointKey: string): {
|
|
126
|
-
readonly name: string;
|
|
127
|
-
readonly adapter: string;
|
|
128
|
-
readonly connected: boolean;
|
|
129
|
-
readonly status: 'online' | 'offline';
|
|
130
|
-
readonly phase: AdapterEndpointPhase;
|
|
131
|
-
readonly operations: readonly AdapterOperation[];
|
|
132
|
-
readonly managementCapabilities: readonly EndpointManagementCapability[];
|
|
133
|
-
} | null;
|
|
134
|
-
sendEndpointMessage(input: {
|
|
135
|
-
readonly adapter: string;
|
|
136
|
-
readonly endpointKey: string;
|
|
137
|
-
readonly conversation: ConversationAddress;
|
|
138
|
-
readonly content: unknown;
|
|
139
|
-
}): Promise<{
|
|
140
|
-
messageId: string;
|
|
141
|
-
}>;
|
|
142
|
-
/** Activity-feedback: add a message reaction when the live Endpoint supports it. */
|
|
143
|
-
addEndpointReaction(input: {
|
|
144
|
-
readonly adapter: string;
|
|
145
|
-
readonly endpointKey: string;
|
|
146
|
-
readonly message: MessageRef;
|
|
147
|
-
readonly emoji: string;
|
|
148
|
-
readonly sceneType?: string;
|
|
149
|
-
readonly channelId?: string;
|
|
150
|
-
}): Promise<string | null>;
|
|
151
|
-
removeEndpointReaction(input: {
|
|
152
|
-
readonly adapter: string;
|
|
153
|
-
readonly endpointKey: string;
|
|
154
|
-
readonly message: MessageRef;
|
|
155
|
-
readonly reactionId: string;
|
|
156
|
-
}): Promise<void>;
|
|
157
|
-
/** Activity-feedback autoRemove: recall a previously sent status message. */
|
|
158
|
-
recallEndpointMessage(input: {
|
|
159
|
-
readonly adapter: string;
|
|
160
|
-
readonly endpointKey: string;
|
|
161
|
-
readonly message: MessageRef;
|
|
162
|
-
}): Promise<void>;
|
|
163
|
-
editEndpointMessage(input: {
|
|
164
|
-
readonly adapter: string;
|
|
165
|
-
readonly endpointKey: string;
|
|
166
|
-
readonly message: MessageRef;
|
|
167
|
-
readonly content: unknown;
|
|
168
|
-
}): Promise<string | null>;
|
|
169
|
-
setEndpointTyping(input: {
|
|
170
|
-
readonly adapter: string;
|
|
171
|
-
readonly endpointKey: string;
|
|
172
|
-
readonly conversation: ConversationRef;
|
|
173
|
-
readonly active?: boolean;
|
|
174
|
-
}): Promise<void>;
|
|
175
|
-
/** Run one management operation while the Endpoint generation stays leased. */
|
|
176
|
-
withEndpointManagement<T>(adapter: string, endpointKey: string, run: (management: EndpointManagement) => T | Promise<T>): Promise<T | null>;
|
|
177
106
|
}
|