@zhin.js/core 1.3.2 → 1.3.3
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 +7 -7
- package/lib/adapter.d.ts +22 -2
- package/lib/adapter.js +71 -1
- package/lib/agent-prompt.d.ts +0 -1
- package/lib/agent-prompt.js +0 -1
- package/lib/built/adapter-process.d.ts +0 -1
- package/lib/built/adapter-process.js +0 -1
- package/lib/built/agent-preset.d.ts +0 -1
- package/lib/built/agent-preset.js +0 -1
- package/lib/built/ai-access.d.ts +36 -0
- package/lib/built/ai-access.js +46 -0
- package/lib/built/ai-outbound/adapter-access.d.ts +3 -0
- package/lib/built/ai-outbound/adapter-access.js +9 -0
- package/lib/built/ai-outbound/extensions/onebot-keyboard.d.ts +2 -0
- package/lib/built/ai-outbound/extensions/onebot-keyboard.js +67 -0
- package/lib/built/ai-outbound/extensions/qq-message.d.ts +3 -0
- package/lib/built/ai-outbound/extensions/qq-message.js +23 -0
- package/lib/built/ai-outbound/index.d.ts +9 -0
- package/lib/built/ai-outbound/index.js +9 -0
- package/lib/built/ai-outbound/parse.d.ts +13 -0
- package/lib/built/ai-outbound/parse.js +94 -0
- package/lib/built/ai-outbound/plain-mention-rewrite.d.ts +6 -0
- package/lib/built/ai-outbound/plain-mention-rewrite.js +37 -0
- package/lib/built/ai-outbound/prompt.d.ts +11 -0
- package/lib/built/ai-outbound/prompt.js +44 -0
- package/lib/built/ai-outbound/resolve.d.ts +4 -0
- package/lib/built/ai-outbound/resolve.js +64 -0
- package/lib/built/ai-outbound/structured-detect.d.ts +3 -0
- package/lib/built/ai-outbound/structured-detect.js +7 -0
- package/lib/built/ai-outbound/types.d.ts +60 -0
- package/lib/built/ai-outbound/types.js +5 -0
- package/lib/built/ai-trigger.d.ts +5 -1
- package/lib/built/ai-trigger.js +3 -7
- package/lib/built/authorization.d.ts +0 -1
- package/lib/built/authorization.js +0 -1
- package/lib/built/command.d.ts +0 -1
- package/lib/built/command.js +1 -3
- package/lib/built/common-adapter-tools.d.ts +25 -26
- package/lib/built/common-adapter-tools.js +48 -49
- package/lib/built/component.d.ts +0 -1
- package/lib/built/component.js +1 -3
- package/lib/built/config.d.ts +4 -1
- package/lib/built/config.js +26 -5
- package/lib/built/connect-endpoint-instance.d.ts +0 -1
- package/lib/built/connect-endpoint-instance.js +3 -2
- package/lib/built/database.d.ts +0 -1
- package/lib/built/database.js +1 -3
- package/lib/built/dispatcher.d.ts +6 -6
- package/lib/built/dispatcher.js +20 -8
- package/lib/built/endpoint-commands.d.ts +0 -1
- package/lib/built/endpoint-commands.js +6 -9
- package/lib/built/endpoint-lifecycle-service.d.ts +2 -1
- package/lib/built/endpoint-lifecycle-service.js +25 -3
- package/lib/built/endpoint-lifecycle.d.ts +0 -1
- package/lib/built/endpoint-lifecycle.js +0 -1
- package/lib/built/endpoint-manager.d.ts +0 -1
- package/lib/built/endpoint-manager.js +0 -1
- package/lib/built/generated-qrcode.d.ts +0 -1
- package/lib/built/generated-qrcode.js +0 -1
- package/lib/built/generic-segment-mapper.d.ts +6 -0
- package/lib/built/generic-segment-mapper.js +232 -0
- package/lib/built/html-renderer-loader.d.ts +2 -1
- package/lib/built/html-renderer-loader.js +6 -2
- package/lib/built/html-segment-fallback.d.ts +0 -1
- package/lib/built/html-segment-fallback.js +0 -1
- package/lib/built/html-to-text.d.ts +0 -1
- package/lib/built/html-to-text.js +0 -1
- package/lib/built/inbound-pipeline.d.ts +0 -1
- package/lib/built/inbound-pipeline.js +0 -1
- package/lib/built/inbound-runner.d.ts +0 -1
- package/lib/built/inbound-runner.js +0 -1
- package/lib/built/interactive-segment-contract.d.ts +6 -0
- package/lib/built/interactive-segment-contract.js +9 -0
- package/lib/built/interactive-segments/action.d.ts +17 -0
- package/lib/built/interactive-segments/action.js +54 -0
- package/lib/built/interactive-segments/button-spec.d.ts +10 -0
- package/lib/built/interactive-segments/button-spec.js +21 -0
- package/lib/built/interactive-segments/handlers.d.ts +9 -0
- package/lib/built/interactive-segments/handlers.js +58 -0
- package/lib/built/interactive-segments/index.d.ts +7 -0
- package/lib/built/interactive-segments/index.js +7 -0
- package/lib/built/interactive-segments/keyboard-segment.d.ts +12 -0
- package/lib/built/interactive-segments/keyboard-segment.js +13 -0
- package/lib/built/interactive-segments/onebot-keyboard.d.ts +10 -0
- package/lib/built/interactive-segments/onebot-keyboard.js +53 -0
- package/lib/built/interactive-segments/resolve.d.ts +9 -0
- package/lib/built/interactive-segments/resolve.js +84 -0
- package/lib/built/interactive-segments/types.d.ts +62 -0
- package/lib/built/interactive-segments/types.js +13 -0
- package/lib/built/introspection-format.d.ts +0 -1
- package/lib/built/introspection-format.js +1 -1
- package/lib/built/login-assist.d.ts +0 -1
- package/lib/built/login-assist.js +0 -1
- package/lib/built/management-command-guard.d.ts +5 -1
- package/lib/built/management-command-guard.js +5 -1
- package/lib/built/message-enrich.d.ts +0 -1
- package/lib/built/message-enrich.js +0 -1
- package/lib/built/message-filter.d.ts +0 -1
- package/lib/built/message-filter.js +1 -3
- package/lib/built/optional-peer-import.d.ts +3 -0
- package/lib/built/optional-peer-import.js +33 -0
- package/lib/built/outbound-media-contract.d.ts +0 -1
- package/lib/built/outbound-media-contract.js +0 -1
- package/lib/built/outbound-media-utils.d.ts +0 -1
- package/lib/built/outbound-media-utils.js +0 -1
- package/lib/built/permission.d.ts +0 -1
- package/lib/built/permission.js +1 -3
- package/lib/built/permit-check.d.ts +0 -1
- package/lib/built/permit-check.js +0 -1
- package/lib/built/permit-parse.d.ts +0 -1
- package/lib/built/permit-parse.js +0 -1
- package/lib/built/platform-permit.d.ts +5 -6
- package/lib/built/platform-permit.js +11 -12
- package/lib/built/prepend-quote-context.d.ts +0 -1
- package/lib/built/prepend-quote-context.js +0 -1
- package/lib/built/qrcode-segment.d.ts +0 -1
- package/lib/built/qrcode-segment.js +0 -1
- package/lib/built/queue-im-field-contract.d.ts +6 -1
- package/lib/built/queue-im-field-contract.js +10 -1
- package/lib/built/rich-segments/adapter-policies.d.ts +1 -2
- package/lib/built/rich-segments/adapter-policies.js +0 -1
- package/lib/built/rich-segments/base.d.ts +0 -1
- package/lib/built/rich-segments/base.js +0 -1
- package/lib/built/rich-segments/builtins.d.ts +0 -1
- package/lib/built/rich-segments/builtins.js +0 -1
- package/lib/built/rich-segments/capabilities.d.ts +0 -1
- package/lib/built/rich-segments/capabilities.js +0 -1
- package/lib/built/rich-segments/html-segment.d.ts +1 -2
- package/lib/built/rich-segments/html-segment.js +0 -1
- package/lib/built/rich-segments/index.d.ts +0 -1
- package/lib/built/rich-segments/index.js +0 -1
- package/lib/built/rich-segments/markdown-segment.d.ts +1 -2
- package/lib/built/rich-segments/markdown-segment.js +0 -1
- package/lib/built/rich-segments/markdown-to-text.d.ts +0 -1
- package/lib/built/rich-segments/markdown-to-text.js +0 -1
- package/lib/built/rich-segments/qrcode-segment.d.ts +1 -2
- package/lib/built/rich-segments/qrcode-segment.js +0 -1
- package/lib/built/rich-segments/registry.d.ts +0 -1
- package/lib/built/rich-segments/registry.js +0 -1
- package/lib/built/rich-segments/resolve.d.ts +1 -2
- package/lib/built/rich-segments/resolve.js +0 -1
- package/lib/built/rich-segments/tts-segment.d.ts +1 -2
- package/lib/built/rich-segments/tts-segment.js +0 -1
- package/lib/built/rich-segments/types.d.ts +0 -1
- package/lib/built/rich-segments/types.js +0 -1
- package/lib/built/roles.d.ts +0 -1
- package/lib/built/roles.js +0 -1
- package/lib/built/runtime-io.d.ts +0 -1
- package/lib/built/runtime-io.js +0 -1
- package/lib/built/schedule.d.ts +55 -0
- package/lib/built/schedule.js +112 -0
- package/lib/built/schema-endpoint-manager.d.ts +0 -1
- package/lib/built/schema-endpoint-manager.js +0 -1
- package/lib/built/schema-feature.d.ts +0 -1
- package/lib/built/schema-feature.js +1 -3
- package/lib/built/segment-contract/assert.d.ts +4 -0
- package/lib/built/segment-contract/assert.js +30 -0
- package/lib/built/segment-contract/delivery.d.ts +5 -0
- package/lib/built/segment-contract/delivery.js +40 -0
- package/lib/built/segment-contract/image.d.ts +5 -0
- package/lib/built/segment-contract/image.js +10 -0
- package/lib/built/segment-contract/index.d.ts +8 -0
- package/lib/built/segment-contract/index.js +7 -0
- package/lib/built/segment-contract/media.d.ts +8 -0
- package/lib/built/segment-contract/media.js +39 -0
- package/lib/built/segment-contract/mention.d.ts +10 -0
- package/lib/built/segment-contract/mention.js +26 -0
- package/lib/built/segment-contract/preview.d.ts +3 -0
- package/lib/built/segment-contract/preview.js +159 -0
- package/lib/built/segment-contract/types.d.ts +70 -0
- package/lib/built/segment-contract/types.js +5 -0
- package/lib/built/segment-contract/validate.d.ts +138 -0
- package/lib/built/segment-contract/validate.js +124 -0
- package/lib/built/skill.d.ts +0 -1
- package/lib/built/skill.js +0 -1
- package/lib/built/speech-loader.d.ts +2 -1
- package/lib/built/speech-loader.js +6 -2
- package/lib/built/tool.d.ts +0 -1
- package/lib/built/tool.js +1 -3
- package/lib/command.d.ts +12 -7
- package/lib/command.js +38 -16
- package/lib/component.d.ts +0 -1
- package/lib/component.js +0 -1
- package/lib/endpoint-capabilities.d.ts +3 -1
- package/lib/endpoint-capabilities.js +0 -1
- package/lib/endpoint.d.ts +0 -1
- package/lib/endpoint.js +0 -1
- package/lib/errors.d.ts +0 -1
- package/lib/errors.js +0 -1
- package/lib/host-plugin-registry.d.ts +0 -1
- package/lib/host-plugin-registry.js +0 -1
- package/lib/im-scene.d.ts +29 -0
- package/lib/im-scene.js +77 -0
- package/lib/im-session-id.d.ts +25 -12
- package/lib/im-session-id.js +35 -17
- package/lib/index.d.ts +13 -7
- package/lib/index.js +11 -6
- package/lib/jsx-dev-runtime.d.ts +0 -1
- package/lib/jsx-dev-runtime.js +0 -1
- package/lib/jsx-runtime.d.ts +0 -1
- package/lib/jsx-runtime.js +0 -1
- package/lib/jsx.d.ts +0 -1
- package/lib/jsx.js +0 -1
- package/lib/message-quote.d.ts +1 -2
- package/lib/message-quote.js +2 -3
- package/lib/message.d.ts +7 -5
- package/lib/message.js +16 -1
- package/lib/models/system-log.d.ts +0 -1
- package/lib/models/system-log.js +0 -1
- package/lib/models/user.d.ts +0 -1
- package/lib/models/user.js +0 -1
- package/lib/notice.d.ts +0 -1
- package/lib/notice.js +0 -1
- package/lib/plugin-context.d.ts +0 -1
- package/lib/plugin-context.js +0 -1
- package/lib/plugin.d.ts +11 -2
- package/lib/plugin.js +19 -7
- package/lib/prompt.d.ts +0 -1
- package/lib/prompt.js +0 -1
- package/lib/request.d.ts +0 -1
- package/lib/request.js +0 -1
- package/lib/tool-zod.d.ts +0 -1
- package/lib/tool-zod.js +0 -1
- package/lib/types-generator.d.ts +0 -1
- package/lib/types-generator.js +0 -1
- package/lib/types.d.ts +30 -11
- package/lib/types.js +0 -1
- package/lib/utils.d.ts +36 -1
- package/lib/utils.js +33 -25
- package/package.json +15 -8
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js.map +0 -1
- package/lib/agent-prompt.d.ts.map +0 -1
- package/lib/agent-prompt.js.map +0 -1
- package/lib/built/adapter-process.d.ts.map +0 -1
- package/lib/built/adapter-process.js.map +0 -1
- package/lib/built/agent-preset.d.ts.map +0 -1
- package/lib/built/agent-preset.js.map +0 -1
- package/lib/built/ai-trigger.d.ts.map +0 -1
- package/lib/built/ai-trigger.js.map +0 -1
- package/lib/built/authorization.d.ts.map +0 -1
- package/lib/built/authorization.js.map +0 -1
- package/lib/built/command.d.ts.map +0 -1
- package/lib/built/command.js.map +0 -1
- package/lib/built/common-adapter-tools.d.ts.map +0 -1
- package/lib/built/common-adapter-tools.js.map +0 -1
- package/lib/built/component.d.ts.map +0 -1
- package/lib/built/component.js.map +0 -1
- package/lib/built/config.d.ts.map +0 -1
- package/lib/built/config.js.map +0 -1
- package/lib/built/connect-endpoint-instance.d.ts.map +0 -1
- package/lib/built/connect-endpoint-instance.js.map +0 -1
- package/lib/built/cron.d.ts +0 -75
- package/lib/built/cron.d.ts.map +0 -1
- package/lib/built/cron.js +0 -122
- package/lib/built/cron.js.map +0 -1
- package/lib/built/database.d.ts.map +0 -1
- package/lib/built/database.js.map +0 -1
- package/lib/built/dispatcher.d.ts.map +0 -1
- package/lib/built/dispatcher.js.map +0 -1
- package/lib/built/endpoint-commands.d.ts.map +0 -1
- package/lib/built/endpoint-commands.js.map +0 -1
- package/lib/built/endpoint-lifecycle-service.d.ts.map +0 -1
- package/lib/built/endpoint-lifecycle-service.js.map +0 -1
- package/lib/built/endpoint-lifecycle.d.ts.map +0 -1
- package/lib/built/endpoint-lifecycle.js.map +0 -1
- package/lib/built/endpoint-manager.d.ts.map +0 -1
- package/lib/built/endpoint-manager.js.map +0 -1
- package/lib/built/generated-qrcode.d.ts.map +0 -1
- package/lib/built/generated-qrcode.js.map +0 -1
- package/lib/built/html-renderer-loader.d.ts.map +0 -1
- package/lib/built/html-renderer-loader.js.map +0 -1
- package/lib/built/html-segment-fallback.d.ts.map +0 -1
- package/lib/built/html-segment-fallback.js.map +0 -1
- package/lib/built/html-to-text.d.ts.map +0 -1
- package/lib/built/html-to-text.js.map +0 -1
- package/lib/built/inbound-pipeline.d.ts.map +0 -1
- package/lib/built/inbound-pipeline.js.map +0 -1
- package/lib/built/inbound-runner.d.ts.map +0 -1
- package/lib/built/inbound-runner.js.map +0 -1
- package/lib/built/introspection-format.d.ts.map +0 -1
- package/lib/built/introspection-format.js.map +0 -1
- package/lib/built/login-assist.d.ts.map +0 -1
- package/lib/built/login-assist.js.map +0 -1
- package/lib/built/management-command-guard.d.ts.map +0 -1
- package/lib/built/management-command-guard.js.map +0 -1
- package/lib/built/mcp-mesh-registrar.d.ts +0 -9
- package/lib/built/mcp-mesh-registrar.d.ts.map +0 -1
- package/lib/built/mcp-mesh-registrar.js +0 -17
- package/lib/built/mcp-mesh-registrar.js.map +0 -1
- package/lib/built/message-enrich.d.ts.map +0 -1
- package/lib/built/message-enrich.js.map +0 -1
- package/lib/built/message-filter.d.ts.map +0 -1
- package/lib/built/message-filter.js.map +0 -1
- package/lib/built/outbound-media-contract.d.ts.map +0 -1
- package/lib/built/outbound-media-contract.js.map +0 -1
- package/lib/built/outbound-media-utils.d.ts.map +0 -1
- package/lib/built/outbound-media-utils.js.map +0 -1
- package/lib/built/permission.d.ts.map +0 -1
- package/lib/built/permission.js.map +0 -1
- package/lib/built/permit-check.d.ts.map +0 -1
- package/lib/built/permit-check.js.map +0 -1
- package/lib/built/permit-parse.d.ts.map +0 -1
- package/lib/built/permit-parse.js.map +0 -1
- package/lib/built/platform-permit.d.ts.map +0 -1
- package/lib/built/platform-permit.js.map +0 -1
- package/lib/built/prepend-quote-context.d.ts.map +0 -1
- package/lib/built/prepend-quote-context.js.map +0 -1
- package/lib/built/qrcode-segment.d.ts.map +0 -1
- package/lib/built/qrcode-segment.js.map +0 -1
- package/lib/built/queue-im-field-contract.d.ts.map +0 -1
- package/lib/built/queue-im-field-contract.js.map +0 -1
- package/lib/built/rich-segments/adapter-policies.d.ts.map +0 -1
- package/lib/built/rich-segments/adapter-policies.js.map +0 -1
- package/lib/built/rich-segments/base.d.ts.map +0 -1
- package/lib/built/rich-segments/base.js.map +0 -1
- package/lib/built/rich-segments/builtins.d.ts.map +0 -1
- package/lib/built/rich-segments/builtins.js.map +0 -1
- package/lib/built/rich-segments/capabilities.d.ts.map +0 -1
- package/lib/built/rich-segments/capabilities.js.map +0 -1
- package/lib/built/rich-segments/html-segment.d.ts.map +0 -1
- package/lib/built/rich-segments/html-segment.js.map +0 -1
- package/lib/built/rich-segments/index.d.ts.map +0 -1
- package/lib/built/rich-segments/index.js.map +0 -1
- package/lib/built/rich-segments/markdown-segment.d.ts.map +0 -1
- package/lib/built/rich-segments/markdown-segment.js.map +0 -1
- package/lib/built/rich-segments/markdown-to-text.d.ts.map +0 -1
- package/lib/built/rich-segments/markdown-to-text.js.map +0 -1
- package/lib/built/rich-segments/qrcode-segment.d.ts.map +0 -1
- package/lib/built/rich-segments/qrcode-segment.js.map +0 -1
- package/lib/built/rich-segments/registry.d.ts.map +0 -1
- package/lib/built/rich-segments/registry.js.map +0 -1
- package/lib/built/rich-segments/resolve.d.ts.map +0 -1
- package/lib/built/rich-segments/resolve.js.map +0 -1
- package/lib/built/rich-segments/tts-segment.d.ts.map +0 -1
- package/lib/built/rich-segments/tts-segment.js.map +0 -1
- package/lib/built/rich-segments/types.d.ts.map +0 -1
- package/lib/built/rich-segments/types.js.map +0 -1
- package/lib/built/roles.d.ts.map +0 -1
- package/lib/built/roles.js.map +0 -1
- package/lib/built/runtime-io.d.ts.map +0 -1
- package/lib/built/runtime-io.js.map +0 -1
- package/lib/built/schema-endpoint-manager.d.ts.map +0 -1
- package/lib/built/schema-endpoint-manager.js.map +0 -1
- package/lib/built/schema-feature.d.ts.map +0 -1
- package/lib/built/schema-feature.js.map +0 -1
- package/lib/built/skill.d.ts.map +0 -1
- package/lib/built/skill.js.map +0 -1
- package/lib/built/speech-loader.d.ts.map +0 -1
- package/lib/built/speech-loader.js.map +0 -1
- package/lib/built/tool.d.ts.map +0 -1
- package/lib/built/tool.js.map +0 -1
- package/lib/command.d.ts.map +0 -1
- package/lib/command.js.map +0 -1
- package/lib/component.d.ts.map +0 -1
- package/lib/component.js.map +0 -1
- package/lib/endpoint-capabilities.d.ts.map +0 -1
- package/lib/endpoint-capabilities.js.map +0 -1
- package/lib/endpoint.d.ts.map +0 -1
- package/lib/endpoint.js.map +0 -1
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/host-plugin-registry.d.ts.map +0 -1
- package/lib/host-plugin-registry.js.map +0 -1
- package/lib/im-session-id.d.ts.map +0 -1
- package/lib/im-session-id.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/jsx-dev-runtime.d.ts.map +0 -1
- package/lib/jsx-dev-runtime.js.map +0 -1
- package/lib/jsx-runtime.d.ts.map +0 -1
- package/lib/jsx-runtime.js.map +0 -1
- package/lib/jsx.d.ts.map +0 -1
- package/lib/jsx.js.map +0 -1
- package/lib/message-quote.d.ts.map +0 -1
- package/lib/message-quote.js.map +0 -1
- package/lib/message.d.ts.map +0 -1
- package/lib/message.js.map +0 -1
- package/lib/models/system-log.d.ts.map +0 -1
- package/lib/models/system-log.js.map +0 -1
- package/lib/models/user.d.ts.map +0 -1
- package/lib/models/user.js.map +0 -1
- package/lib/notice.d.ts.map +0 -1
- package/lib/notice.js.map +0 -1
- package/lib/plugin-context.d.ts.map +0 -1
- package/lib/plugin-context.js.map +0 -1
- package/lib/plugin.d.ts.map +0 -1
- package/lib/plugin.js.map +0 -1
- package/lib/prompt.d.ts.map +0 -1
- package/lib/prompt.js.map +0 -1
- package/lib/request.d.ts.map +0 -1
- package/lib/request.js.map +0 -1
- package/lib/scheduler/scheduler.d.ts +0 -49
- package/lib/scheduler/scheduler.d.ts.map +0 -1
- package/lib/scheduler/scheduler.js +0 -352
- package/lib/scheduler/scheduler.js.map +0 -1
- package/lib/scheduler/types.d.ts +0 -71
- package/lib/scheduler/types.d.ts.map +0 -1
- package/lib/scheduler/types.js +0 -8
- package/lib/scheduler/types.js.map +0 -1
- package/lib/tool-zod.d.ts.map +0 -1
- package/lib/tool-zod.js.map +0 -1
- package/lib/types-generator.d.ts.map +0 -1
- package/lib/types-generator.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js.map +0 -1
package/lib/im-session-id.d.ts
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* IM 会话 ID
|
|
2
|
+
* IM 会话 ID 解析(SSOT 在 @zhin.js/kernel + im-scene)
|
|
3
3
|
*
|
|
4
|
-
* 格式:`platform:endpointId:
|
|
4
|
+
* 格式:`platform:endpointId:kind:sceneId`
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
endpointId: string;
|
|
10
|
-
scope: IMSessionScope;
|
|
11
|
-
sceneId: string;
|
|
12
|
-
}
|
|
6
|
+
import { type ResolveIMSessionIdInput } from '@zhin.js/kernel';
|
|
7
|
+
import { type IMSceneKind, type IMSceneRef } from './im-scene.js';
|
|
8
|
+
export type { IMSceneKind, ResolveIMSessionIdInput };
|
|
13
9
|
export declare function resolveIMSessionId(input: ResolveIMSessionIdInput): string;
|
|
14
|
-
export declare function
|
|
10
|
+
export declare function resolveIMSessionIdFromScene(scene: IMSceneRef): string;
|
|
11
|
+
export declare function resolveIMSceneIdForSession(kind: IMSceneKind, sceneId?: string, senderId?: string): string;
|
|
15
12
|
export declare function resolveIMSessionIdFromMessage(message: {
|
|
16
13
|
$adapter?: string;
|
|
17
14
|
$endpoint?: string;
|
|
18
15
|
$channel?: {
|
|
19
|
-
type?:
|
|
16
|
+
type?: IMSceneKind;
|
|
20
17
|
id?: string;
|
|
21
18
|
};
|
|
22
19
|
$sender?: {
|
|
23
20
|
id?: string;
|
|
24
21
|
};
|
|
25
22
|
}): string;
|
|
26
|
-
|
|
23
|
+
/** Canonical scene fields for transcript / session persistence (ADR 0028 SSOT). */
|
|
24
|
+
export declare function resolveSceneFieldsFromMessage(message: {
|
|
25
|
+
$adapter?: string;
|
|
26
|
+
$endpoint?: string;
|
|
27
|
+
$channel?: {
|
|
28
|
+
type?: IMSceneKind;
|
|
29
|
+
id?: string;
|
|
30
|
+
};
|
|
31
|
+
$sender?: {
|
|
32
|
+
id?: string;
|
|
33
|
+
};
|
|
34
|
+
}): {
|
|
35
|
+
platform: string;
|
|
36
|
+
endpointId: string;
|
|
37
|
+
sceneId: string;
|
|
38
|
+
sceneType: IMSceneKind;
|
|
39
|
+
};
|
package/lib/im-session-id.js
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* IM 会话 ID
|
|
2
|
+
* IM 会话 ID 解析(SSOT 在 @zhin.js/kernel + im-scene)
|
|
3
3
|
*
|
|
4
|
-
* 格式:`platform:endpointId:
|
|
4
|
+
* 格式:`platform:endpointId:kind:sceneId`
|
|
5
5
|
*/
|
|
6
|
+
import { resolveIMSceneIdForSession as resolveIMSceneIdForSessionKernel, resolveIMSessionId as resolveIMSessionIdKernel, } from '@zhin.js/kernel';
|
|
7
|
+
import { resolveIMSceneSessionId, sceneRefFromMessage, } from './im-scene.js';
|
|
6
8
|
export function resolveIMSessionId(input) {
|
|
7
|
-
|
|
8
|
-
const endpointId = String(input.endpointId || 'default');
|
|
9
|
-
const scope = input.scope || 'private';
|
|
10
|
-
const sceneId = String(input.sceneId || 'unknown');
|
|
11
|
-
return `${platform}:${endpointId}:${scope}:${sceneId}`;
|
|
9
|
+
return resolveIMSessionIdKernel(input);
|
|
12
10
|
}
|
|
13
|
-
export function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return
|
|
11
|
+
export function resolveIMSessionIdFromScene(scene) {
|
|
12
|
+
return resolveIMSceneSessionId(scene);
|
|
13
|
+
}
|
|
14
|
+
export function resolveIMSceneIdForSession(kind, sceneId, senderId) {
|
|
15
|
+
return resolveIMSceneIdForSessionKernel(kind, sceneId, senderId);
|
|
18
16
|
}
|
|
19
17
|
export function resolveIMSessionIdFromMessage(message) {
|
|
20
|
-
const
|
|
21
|
-
|
|
18
|
+
const scene = sceneRefFromMessage(message);
|
|
19
|
+
if (scene)
|
|
20
|
+
return resolveIMSceneSessionId(scene);
|
|
21
|
+
const kind = (message.$channel?.type || 'private');
|
|
22
22
|
return resolveIMSessionId({
|
|
23
23
|
platform: String(message.$adapter || ''),
|
|
24
24
|
endpointId: String(message.$endpoint || ''),
|
|
25
|
-
|
|
26
|
-
sceneId,
|
|
25
|
+
kind,
|
|
26
|
+
sceneId: resolveIMSceneIdForSession(kind, message.$channel?.id, message.$sender?.id),
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
/** Canonical scene fields for transcript / session persistence (ADR 0028 SSOT). */
|
|
30
|
+
export function resolveSceneFieldsFromMessage(message) {
|
|
31
|
+
const scene = sceneRefFromMessage(message);
|
|
32
|
+
if (scene) {
|
|
33
|
+
return {
|
|
34
|
+
platform: scene.platform,
|
|
35
|
+
endpointId: scene.endpointId,
|
|
36
|
+
sceneId: scene.sceneId,
|
|
37
|
+
sceneType: scene.kind,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const sceneType = (message.$channel?.type || 'private');
|
|
41
|
+
return {
|
|
42
|
+
platform: String(message.$adapter || ''),
|
|
43
|
+
endpointId: String(message.$endpoint || ''),
|
|
44
|
+
sceneType,
|
|
45
|
+
sceneId: resolveIMSceneIdForSession(sceneType, message.$channel?.id, message.$sender?.id),
|
|
46
|
+
};
|
|
47
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './command.js';
|
|
|
5
5
|
export * from './component.js';
|
|
6
6
|
export * from './adapter.js';
|
|
7
7
|
export * from './message.js';
|
|
8
|
+
export * from './im-scene.js';
|
|
8
9
|
export * from './notice.js';
|
|
9
10
|
export * from './request.js';
|
|
10
11
|
export * from './prompt.js';
|
|
@@ -14,7 +15,8 @@ export * from './utils.js';
|
|
|
14
15
|
export * from './errors.js';
|
|
15
16
|
export * from './built/config.js';
|
|
16
17
|
export * from './built/command.js';
|
|
17
|
-
export * from './built/
|
|
18
|
+
export * from './built/schedule.js';
|
|
19
|
+
export type { ScheduleDescriptor, ScheduleHandle, ScheduleContextExtensions } from './built/schedule.js';
|
|
18
20
|
export * from './models/system-log.js';
|
|
19
21
|
export * from './models/user.js';
|
|
20
22
|
export * from './built/permission.js';
|
|
@@ -34,16 +36,22 @@ export * from './built/common-adapter-tools.js';
|
|
|
34
36
|
export * from './built/roles.js';
|
|
35
37
|
export * from './im-session-id.js';
|
|
36
38
|
export * from './built/ai-trigger.js';
|
|
39
|
+
export * from './built/ai-access.js';
|
|
37
40
|
export * from './built/dispatcher.js';
|
|
38
41
|
export * from './built/schema-feature.js';
|
|
39
42
|
export * from './built/login-assist.js';
|
|
40
43
|
export * from './built/generated-qrcode.js';
|
|
41
44
|
export * from './built/qrcode-segment.js';
|
|
42
45
|
export * from './built/rich-segments/index.js';
|
|
43
|
-
export
|
|
44
|
-
export
|
|
46
|
+
export * from './built/interactive-segments/index.js';
|
|
47
|
+
export * from './built/ai-outbound/index.js';
|
|
48
|
+
export { loadHtmlRenderer, seedHtmlRenderer, HTML_RENDERER_PACKAGE } from './built/html-renderer-loader.js';
|
|
49
|
+
export { loadSpeechPipeline, seedSpeechPipeline, SPEECH_PACKAGE } from './built/speech-loader.js';
|
|
45
50
|
export * from './built/outbound-media-utils.js';
|
|
46
51
|
export * from './built/outbound-media-contract.js';
|
|
52
|
+
export * from './built/interactive-segment-contract.js';
|
|
53
|
+
export * from './built/segment-contract/index.js';
|
|
54
|
+
export * from './built/generic-segment-mapper.js';
|
|
47
55
|
export * from './built/adapter-process.js';
|
|
48
56
|
export * from './built/component.js';
|
|
49
57
|
export * from './built/inbound-runner.js';
|
|
@@ -61,13 +69,11 @@ export * from './built/introspection-format.js';
|
|
|
61
69
|
export * from './built/management-command-guard.js';
|
|
62
70
|
export * from './built/html-to-text.js';
|
|
63
71
|
export * from './built/html-segment-fallback.js';
|
|
64
|
-
export * from './built/mcp-mesh-registrar.js';
|
|
65
72
|
export * from './built/prepend-quote-context.js';
|
|
66
73
|
export * from './message-quote.js';
|
|
67
74
|
export * from '@zhin.js/database';
|
|
68
75
|
export * from '@zhin.js/logger';
|
|
69
76
|
export { Schema } from '@zhin.js/schema';
|
|
70
77
|
export type { PluginLike } from '@zhin.js/kernel';
|
|
71
|
-
export { Feature,
|
|
72
|
-
export type { FeatureJSON, FeatureListener, Schedule, JobPayload, JobState, ScheduledJob, JobStore, JobCallback, AddJobOptions, IScheduler, SchedulerOptions, } from '@zhin.js/kernel';
|
|
73
|
-
//# sourceMappingURL=index.d.ts.map
|
|
78
|
+
export { Feature, ScheduleEngine, getScheduleEngine, setScheduleEngine, Scheduler, getScheduler, setScheduler, } from '@zhin.js/kernel';
|
|
79
|
+
export type { FeatureJSON, FeatureListener, Schedule, JobPayload, JobState, ScheduledJob, JobStore, JobCallback, AddJobOptions, IScheduler, SchedulerOptions, ScheduleFireCallback, MemoryScheduleRegistration, ScheduleEngineOptions, JobContext, ResolvedJob, ScheduleKind, } from '@zhin.js/kernel';
|
package/lib/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from './command.js';
|
|
|
6
6
|
export * from './component.js';
|
|
7
7
|
export * from './adapter.js';
|
|
8
8
|
export * from './message.js';
|
|
9
|
+
export * from './im-scene.js';
|
|
9
10
|
export * from './notice.js';
|
|
10
11
|
export * from './request.js';
|
|
11
12
|
export * from './prompt.js';
|
|
@@ -16,7 +17,7 @@ export * from './errors.js';
|
|
|
16
17
|
// ── Built 模块 ──────────────────────────────────────────────────────
|
|
17
18
|
export * from './built/config.js';
|
|
18
19
|
export * from './built/command.js';
|
|
19
|
-
export * from './built/
|
|
20
|
+
export * from './built/schedule.js';
|
|
20
21
|
// Models
|
|
21
22
|
export * from './models/system-log.js';
|
|
22
23
|
export * from './models/user.js';
|
|
@@ -36,16 +37,22 @@ export * from './built/common-adapter-tools.js';
|
|
|
36
37
|
export * from './built/roles.js';
|
|
37
38
|
export * from './im-session-id.js';
|
|
38
39
|
export * from './built/ai-trigger.js';
|
|
40
|
+
export * from './built/ai-access.js';
|
|
39
41
|
export * from './built/dispatcher.js';
|
|
40
42
|
export * from './built/schema-feature.js';
|
|
41
43
|
export * from './built/login-assist.js';
|
|
42
44
|
export * from './built/generated-qrcode.js';
|
|
43
45
|
export * from './built/qrcode-segment.js';
|
|
44
46
|
export * from './built/rich-segments/index.js';
|
|
45
|
-
export
|
|
46
|
-
export
|
|
47
|
+
export * from './built/interactive-segments/index.js';
|
|
48
|
+
export * from './built/ai-outbound/index.js';
|
|
49
|
+
export { loadHtmlRenderer, seedHtmlRenderer, HTML_RENDERER_PACKAGE } from './built/html-renderer-loader.js';
|
|
50
|
+
export { loadSpeechPipeline, seedSpeechPipeline, SPEECH_PACKAGE } from './built/speech-loader.js';
|
|
47
51
|
export * from './built/outbound-media-utils.js';
|
|
48
52
|
export * from './built/outbound-media-contract.js';
|
|
53
|
+
export * from './built/interactive-segment-contract.js';
|
|
54
|
+
export * from './built/segment-contract/index.js';
|
|
55
|
+
export * from './built/generic-segment-mapper.js';
|
|
49
56
|
export * from './built/adapter-process.js';
|
|
50
57
|
export * from './built/component.js';
|
|
51
58
|
export * from './built/inbound-runner.js';
|
|
@@ -59,12 +66,10 @@ export * from './built/introspection-format.js';
|
|
|
59
66
|
export * from './built/management-command-guard.js';
|
|
60
67
|
export * from './built/html-to-text.js';
|
|
61
68
|
export * from './built/html-segment-fallback.js';
|
|
62
|
-
export * from './built/mcp-mesh-registrar.js';
|
|
63
69
|
export * from './built/prepend-quote-context.js';
|
|
64
70
|
export * from './message-quote.js';
|
|
65
71
|
// ── 外部库 re-export ──────────────────────────────────────────────────
|
|
66
72
|
export * from '@zhin.js/database';
|
|
67
73
|
export * from '@zhin.js/logger';
|
|
68
74
|
export { Schema } from '@zhin.js/schema';
|
|
69
|
-
export { Feature,
|
|
70
|
-
//# sourceMappingURL=index.js.map
|
|
75
|
+
export { Feature, ScheduleEngine, getScheduleEngine, setScheduleEngine, Scheduler, getScheduler, setScheduler, } from '@zhin.js/kernel';
|
package/lib/jsx-dev-runtime.d.ts
CHANGED
package/lib/jsx-dev-runtime.js
CHANGED
package/lib/jsx-runtime.d.ts
CHANGED
package/lib/jsx-runtime.js
CHANGED
package/lib/jsx.d.ts
CHANGED
|
@@ -30,4 +30,3 @@ declare global {
|
|
|
30
30
|
export declare function jsx(type: JSXElementType, data: JSXProps): MessageComponent<any>;
|
|
31
31
|
export declare function jsxs(type: JSXElementType, props: JSXProps): MessageElement;
|
|
32
32
|
export declare function renderJSX(element: MessageComponent<any>, context?: ComponentContext): Promise<SendContent>;
|
|
33
|
-
//# sourceMappingURL=jsx.d.ts.map
|
package/lib/jsx.js
CHANGED
package/lib/message-quote.d.ts
CHANGED
|
@@ -6,6 +6,5 @@ export declare function quoteIdFromContent(content: MessageElement[]): string |
|
|
|
6
6
|
export declare function quoteIdFromRaw(raw: unknown): string | undefined;
|
|
7
7
|
/** 无 $quote_id 时从 $content / $raw 回填 */
|
|
8
8
|
export declare function syncQuoteId(message: Message<any>): void;
|
|
9
|
-
/** 将 reply
|
|
9
|
+
/** 将 reply 段与 $quote_id 对齐(canonical 仅保留 message_id) */
|
|
10
10
|
export declare function alignReplySegments(content: MessageElement[], quoteId?: string): void;
|
|
11
|
-
//# sourceMappingURL=message-quote.d.ts.map
|
package/lib/message-quote.js
CHANGED
|
@@ -75,7 +75,7 @@ export function syncQuoteId(message) {
|
|
|
75
75
|
if (id)
|
|
76
76
|
message.$quote_id = id;
|
|
77
77
|
}
|
|
78
|
-
/** 将 reply
|
|
78
|
+
/** 将 reply 段与 $quote_id 对齐(canonical 仅保留 message_id) */
|
|
79
79
|
export function alignReplySegments(content, quoteId) {
|
|
80
80
|
const id = quoteId ?? quoteIdFromContent(content);
|
|
81
81
|
if (!id)
|
|
@@ -84,8 +84,7 @@ export function alignReplySegments(content, quoteId) {
|
|
|
84
84
|
if (seg.type !== 'reply' || !seg.data || typeof seg.data !== 'object')
|
|
85
85
|
continue;
|
|
86
86
|
const data = seg.data;
|
|
87
|
-
data.id = id;
|
|
88
87
|
data.message_id = id;
|
|
88
|
+
delete data.id;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
//# sourceMappingURL=message-quote.js.map
|
package/lib/message.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageElement, MessageSender, SendContent } from "./types";
|
|
1
|
+
import { MessageElement, MessageSender, SendContent } from "./types.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
3
|
import { Adapters } from "./adapter.js";
|
|
4
4
|
/**
|
|
@@ -17,11 +17,12 @@ export interface MessageChannel {
|
|
|
17
17
|
id: string;
|
|
18
18
|
type: MessageType;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* 私聊/子频道消息的来源场景:
|
|
21
|
+
* - 群临时会话:type=private + parent.group
|
|
22
|
+
* - QQ 子频道:type=channel + parent.guild
|
|
22
23
|
*/
|
|
23
24
|
parent?: {
|
|
24
|
-
type: 'group' | 'channel';
|
|
25
|
+
type: 'group' | 'channel' | 'guild';
|
|
25
26
|
id: string;
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -58,5 +59,6 @@ export declare namespace Message {
|
|
|
58
59
|
function quoteIdFromContent(content: MessageElement[]): string | undefined;
|
|
59
60
|
function syncQuoteId(message: Message<any>): void;
|
|
60
61
|
function alignReplySegments(content: MessageElement[], quoteId?: string): void;
|
|
62
|
+
function actionPayload(message: Message<any>): string | undefined;
|
|
63
|
+
function isAction(message: Message<any>): boolean;
|
|
61
64
|
}
|
|
62
|
-
//# sourceMappingURL=message.d.ts.map
|
package/lib/message.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { alignReplySegments as alignReplySegmentsImpl, quoteIdFromContent as quoteIdFromContentImpl, syncQuoteId as syncQuoteIdImpl, } from "./message-quote.js";
|
|
2
|
+
import { isActionMessage as isActionMessageImpl } from "./built/interactive-segments/action.js";
|
|
2
3
|
export var Message;
|
|
3
4
|
(function (Message) {
|
|
4
5
|
/**
|
|
@@ -20,5 +21,19 @@ export var Message;
|
|
|
20
21
|
alignReplySegmentsImpl(content, quoteId);
|
|
21
22
|
}
|
|
22
23
|
Message.alignReplySegments = alignReplySegments;
|
|
24
|
+
function actionPayload(message) {
|
|
25
|
+
for (const item of message.$content ?? []) {
|
|
26
|
+
if (typeof item === 'string')
|
|
27
|
+
continue;
|
|
28
|
+
if (item.type === 'action' && item.data?.payload) {
|
|
29
|
+
return String(item.data.payload);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
Message.actionPayload = actionPayload;
|
|
35
|
+
function isAction(message) {
|
|
36
|
+
return isActionMessageImpl(message);
|
|
37
|
+
}
|
|
38
|
+
Message.isAction = isAction;
|
|
23
39
|
})(Message || (Message = {}));
|
|
24
|
-
//# sourceMappingURL=message.js.map
|
package/lib/models/system-log.js
CHANGED
package/lib/models/user.d.ts
CHANGED
package/lib/models/user.js
CHANGED
package/lib/notice.d.ts
CHANGED
package/lib/notice.js
CHANGED
package/lib/plugin-context.d.ts
CHANGED
package/lib/plugin-context.js
CHANGED
package/lib/plugin.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* - 中间件系统、适配器管理、useContext 等
|
|
8
8
|
*/
|
|
9
9
|
import type { PluginManifest } from "./types.js";
|
|
10
|
+
import type { InteractiveHandler } from "./built/interactive-segments/types.js";
|
|
10
11
|
import { MessageMiddleware, RegisteredAdapter, MaybePromise, ArrayItem, SendOptions, MessageSendPayload } from "./types.js";
|
|
11
12
|
import { Adapter, Adapters } from "./adapter.js";
|
|
12
13
|
import { PluginBase, PluginBaseLifecycle } from "@zhin.js/kernel";
|
|
@@ -64,6 +65,10 @@ export declare class Plugin extends PluginBase implements PluginLike {
|
|
|
64
65
|
* 中间件用于处理消息流转
|
|
65
66
|
*/
|
|
66
67
|
addMiddleware<T extends RegisteredAdapter>(middleware: MessageMiddleware<T>, name?: string): () => void;
|
|
68
|
+
/**
|
|
69
|
+
* 注册交互式 action 回调处理器(自动安装根中间件,优先于 Dispatcher)
|
|
70
|
+
*/
|
|
71
|
+
registerInteractiveHandler(prefix: string, handler: InteractiveHandler): () => void;
|
|
67
72
|
/**
|
|
68
73
|
* 插件名称
|
|
69
74
|
*/
|
|
@@ -159,7 +164,7 @@ export declare namespace Plugin {
|
|
|
159
164
|
interface Features {
|
|
160
165
|
commands: string[];
|
|
161
166
|
components: string[];
|
|
162
|
-
|
|
167
|
+
schedules: string[];
|
|
163
168
|
middlewares: string[];
|
|
164
169
|
}
|
|
165
170
|
/**
|
|
@@ -193,6 +198,8 @@ export declare namespace Plugin {
|
|
|
193
198
|
"ai.response": [Plugin.AIEventPayload];
|
|
194
199
|
"ai.typing.start": [Plugin.AIEventPayload];
|
|
195
200
|
"ai.typing.stop": [Plugin.AIEventPayload];
|
|
201
|
+
"ai.activity.queued.start": [Plugin.AIEventPayload];
|
|
202
|
+
"ai.activity.queued.clear": [Plugin.AIEventPayload];
|
|
196
203
|
"ai.subagent.spawn": [Plugin.AIEventPayload];
|
|
197
204
|
"ai.subagent.start": [Plugin.AIEventPayload];
|
|
198
205
|
"ai.subagent.finish": [Plugin.AIEventPayload];
|
|
@@ -204,6 +211,9 @@ export declare namespace Plugin {
|
|
|
204
211
|
"ai.session.new": [Plugin.AIEventPayload];
|
|
205
212
|
"ai.session.compact": [Plugin.AIEventPayload];
|
|
206
213
|
"ai.hook": [Plugin.AIEventPayload];
|
|
214
|
+
"schedule.start": [Plugin.AIEventPayload];
|
|
215
|
+
"schedule.finish": [Plugin.AIEventPayload];
|
|
216
|
+
"schedule.error": [Plugin.AIEventPayload];
|
|
207
217
|
}
|
|
208
218
|
interface AIEventPayload {
|
|
209
219
|
sessionId: string;
|
|
@@ -257,4 +267,3 @@ export declare namespace Plugin {
|
|
|
257
267
|
interface Extensions {
|
|
258
268
|
}
|
|
259
269
|
}
|
|
260
|
-
//# sourceMappingURL=plugin.d.ts.map
|
package/lib/plugin.js
CHANGED
|
@@ -11,6 +11,7 @@ import * as path from "node:path";
|
|
|
11
11
|
import { pathToFileURL } from "node:url";
|
|
12
12
|
import { formatCompact } from "@zhin.js/logger";
|
|
13
13
|
import { compose, remove, resolveEntry } from "./utils.js";
|
|
14
|
+
import { ensureInteractiveMiddleware, registerInteractiveHandler as registerInteractiveHandlerCore, } from "./built/interactive-segments/handlers.js";
|
|
14
15
|
import { Adapter } from "./adapter.js";
|
|
15
16
|
import { Feature } from "@zhin.js/kernel";
|
|
16
17
|
import { PluginBase, resolvePluginResolveDir as _resolvePluginResolveDir, pluginCreateRequire as _pluginCreateRequire, getFileHash, watchFile, registerExtension, unregisterExtensions, installExtensionProxy, } from "@zhin.js/kernel";
|
|
@@ -36,7 +37,9 @@ function pluginCreateRequire() {
|
|
|
36
37
|
* 同一上下文中同一文件多次调用返回同一实例
|
|
37
38
|
*/
|
|
38
39
|
export function usePlugin() {
|
|
39
|
-
|
|
40
|
+
// 必须传入 plugin.ts 的 import.meta.url:getCurrentFile 默认锚定在 plugin-context.ts,
|
|
41
|
+
// 否则会多跳一层 usePlugin 帧,把调用方误判为 plugin.ts(plugin.name === "plugin")。
|
|
42
|
+
const callerFile = getCurrentFile(import.meta.url);
|
|
40
43
|
// 如果当前 store 已是同一文件创建的插件,直接返回
|
|
41
44
|
const current = storage.getStore();
|
|
42
45
|
if (current && current.filePath.replace(/\?t=\d+$/, '') === callerFile.replace(/\?t=\d+$/, '')) {
|
|
@@ -103,6 +106,15 @@ export class Plugin extends PluginBase {
|
|
|
103
106
|
this.onDispose(dispose);
|
|
104
107
|
return dispose;
|
|
105
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* 注册交互式 action 回调处理器(自动安装根中间件,优先于 Dispatcher)
|
|
111
|
+
*/
|
|
112
|
+
registerInteractiveHandler(prefix, handler) {
|
|
113
|
+
ensureInteractiveMiddleware((mw) => this.root.addMiddleware(mw));
|
|
114
|
+
const dispose = registerInteractiveHandlerCore(prefix, handler);
|
|
115
|
+
this.onDispose(dispose);
|
|
116
|
+
return dispose;
|
|
117
|
+
}
|
|
106
118
|
/**
|
|
107
119
|
* 插件名称
|
|
108
120
|
*/
|
|
@@ -212,7 +224,8 @@ export class Plugin extends PluginBase {
|
|
|
212
224
|
contextReadyCallback();
|
|
213
225
|
}
|
|
214
226
|
inject(name) {
|
|
215
|
-
const
|
|
227
|
+
const resolved = name === 'cron' ? 'schedule' : name;
|
|
228
|
+
const context = this.root.contexts.get(resolved);
|
|
216
229
|
return context?.value;
|
|
217
230
|
}
|
|
218
231
|
injectAdapter(name) {
|
|
@@ -291,11 +304,11 @@ export class Plugin extends PluginBase {
|
|
|
291
304
|
get features() {
|
|
292
305
|
const commandService = this.inject('command');
|
|
293
306
|
const componentService = this.inject('component');
|
|
294
|
-
const
|
|
307
|
+
const scheduleService = this.inject('schedule');
|
|
295
308
|
return {
|
|
296
309
|
commands: commandService ? commandService.items.map(c => c.pattern) : [],
|
|
297
310
|
components: componentService ? componentService.getAllNames() : [],
|
|
298
|
-
|
|
311
|
+
schedules: scheduleService ? scheduleService.items.map(s => s.id) : [],
|
|
299
312
|
middlewares: this.#middlewares.map((m, i) => m.name || `middleware_${i}`),
|
|
300
313
|
};
|
|
301
314
|
}
|
|
@@ -310,8 +323,8 @@ export class Plugin extends PluginBase {
|
|
|
310
323
|
result.push({ name: 'command', count: f.commands.length });
|
|
311
324
|
if (f.components.length > 0)
|
|
312
325
|
result.push({ name: 'component', count: f.components.length });
|
|
313
|
-
if (f.
|
|
314
|
-
result.push({ name: '
|
|
326
|
+
if (f.schedules.length > 0)
|
|
327
|
+
result.push({ name: 'schedule', count: f.schedules.length });
|
|
315
328
|
// #middlewares includes the default command middleware, only count user-added ones
|
|
316
329
|
const userMiddlewareCount = this.#middlewares.length - 1; // subtract default #messageMiddleware
|
|
317
330
|
if (userMiddlewareCount > 0)
|
|
@@ -573,4 +586,3 @@ export class Plugin extends PluginBase {
|
|
|
573
586
|
export function defineContext(options) {
|
|
574
587
|
return options;
|
|
575
588
|
}
|
|
576
|
-
//# sourceMappingURL=plugin.js.map
|
package/lib/prompt.d.ts
CHANGED
package/lib/prompt.js
CHANGED
package/lib/request.d.ts
CHANGED
package/lib/request.js
CHANGED
package/lib/tool-zod.d.ts
CHANGED
|
@@ -26,4 +26,3 @@ export interface CreateToolFromZodOptions {
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function createToolFromZod<T extends Record<string, any>>(name: string, description: string, schema: any, execute: (args: T, message?: Message<any>) => MaybePromise<any>, options?: CreateToolFromZodOptions): Tool;
|
|
28
28
|
export {};
|
|
29
|
-
//# sourceMappingURL=tool-zod.d.ts.map
|
package/lib/tool-zod.js
CHANGED
package/lib/types-generator.d.ts
CHANGED
package/lib/types-generator.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { MessageChannel, Message } from
|
|
2
|
-
import { Adapter, Adapters } from
|
|
3
|
-
import { Endpoint } from
|
|
4
|
-
import { SystemLog } from
|
|
5
|
-
import { User } from
|
|
6
|
-
import { Databases, Registry } from
|
|
7
|
-
import {
|
|
8
|
-
import { ProcessAdapter } from "./built/adapter-process.js";
|
|
1
|
+
import { MessageChannel, Message, MessageComponent } from './message.js';
|
|
2
|
+
import { Adapter, Adapters } from './adapter.js';
|
|
3
|
+
import { Endpoint } from './endpoint.js';
|
|
4
|
+
import { SystemLog } from './models/system-log.js';
|
|
5
|
+
import { User } from './models/user.js';
|
|
6
|
+
import { Databases, Registry } from '@zhin.js/database';
|
|
7
|
+
import { ProcessAdapter } from './built/adapter-process.js';
|
|
9
8
|
export type { SenderRole } from "./built/roles.js";
|
|
10
9
|
export type ArrayItem<T> = T extends Array<infer R> ? R : unknown;
|
|
11
10
|
export interface Models extends Record<string, object> {
|
|
@@ -77,8 +76,27 @@ export interface QuotedMessagePayload {
|
|
|
77
76
|
export interface QuotableEndpoint {
|
|
78
77
|
$getMsg(messageId: string): Promise<QuotedMessagePayload>;
|
|
79
78
|
}
|
|
80
|
-
/**
|
|
81
|
-
export
|
|
79
|
+
/** 可选:编辑已发送消息(交互式棋盘更新) */
|
|
80
|
+
export interface EditMessageOptions {
|
|
81
|
+
messageId: string;
|
|
82
|
+
context: string;
|
|
83
|
+
endpoint: string;
|
|
84
|
+
id: string;
|
|
85
|
+
type: 'private' | 'group' | 'channel';
|
|
86
|
+
content: SendContent;
|
|
87
|
+
}
|
|
88
|
+
export interface EditableEndpoint {
|
|
89
|
+
$editMessage?(options: EditMessageOptions): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/** 出站回复来源(指令 / AI / proactive),仅当经 MessageDispatcher.replyWithPolish 或 runWithOutboundPolish 发出时由框架填入异步上下文 */
|
|
92
|
+
export type OutboundReplySource = 'command' | 'ai' | 'proactive';
|
|
93
|
+
export type OutboundReplyTrigger = 'inbound' | 'proactive';
|
|
94
|
+
export interface OutboundReplyStore {
|
|
95
|
+
message: Message;
|
|
96
|
+
source: OutboundReplySource;
|
|
97
|
+
trigger: OutboundReplyTrigger;
|
|
98
|
+
proactiveSource?: string;
|
|
99
|
+
}
|
|
82
100
|
/**
|
|
83
101
|
* 出站润色上下文(`dispatcher.addOutboundPolish` 的 handler 签名的同构类型)。
|
|
84
102
|
* 与 {@link Adapter.sendMessage} → `before.sendMessage` 同一管道;需 `message`/`source` 时见 `getOutboundReplyStore`(dispatcher 导出)。
|
|
@@ -135,6 +153,8 @@ export interface SendOptions extends MessageChannel {
|
|
|
135
153
|
context: string;
|
|
136
154
|
endpoint: string;
|
|
137
155
|
content: SendContent;
|
|
156
|
+
quoteId?: string;
|
|
157
|
+
threadId?: string;
|
|
138
158
|
}
|
|
139
159
|
/** `Adapter.sendMessage` 成功发出后由 core 分发的载荷 */
|
|
140
160
|
export interface MessageSendPayload {
|
|
@@ -382,4 +402,3 @@ export interface PluginManifest {
|
|
|
382
402
|
}
|
|
383
403
|
/** @deprecated 使用 Tool 替代 */
|
|
384
404
|
export type AITool = Tool;
|
|
385
|
-
//# sourceMappingURL=types.d.ts.map
|