@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
/** 从应用根(ZHIN_PROJECT_ROOT / cwd)解析 optional peer,避免 core 包目录下 dynamic import 失败 */
|
|
5
|
+
export function resolveOptionalPeerPackage(packageName) {
|
|
6
|
+
const roots = new Set();
|
|
7
|
+
const envRoot = process.env.ZHIN_PROJECT_ROOT?.trim();
|
|
8
|
+
if (envRoot)
|
|
9
|
+
roots.add(path.resolve(envRoot));
|
|
10
|
+
roots.add(process.cwd());
|
|
11
|
+
for (const root of roots) {
|
|
12
|
+
try {
|
|
13
|
+
const req = createRequire(path.join(root, 'package.json'));
|
|
14
|
+
return req.resolve(packageName);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// try next root
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
return createRequire(import.meta.url).resolve(packageName);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function importOptionalPeerPackage(packageName) {
|
|
28
|
+
const resolved = resolveOptionalPeerPackage(packageName);
|
|
29
|
+
if (resolved) {
|
|
30
|
+
return import(pathToFileURL(resolved).href);
|
|
31
|
+
}
|
|
32
|
+
return import(packageName);
|
|
33
|
+
}
|
|
@@ -20,4 +20,3 @@ export type OutboundMediaMaterializer = (content: SendContent, ctx: OutboundMedi
|
|
|
20
20
|
export declare function assertAdapterDeclaresRichSegmentPolicy(adapterClass: {
|
|
21
21
|
outboundRichSegmentPolicy?: Record<string, string>;
|
|
22
22
|
}): void;
|
|
23
|
-
//# sourceMappingURL=outbound-media-contract.d.ts.map
|
|
@@ -7,4 +7,3 @@ export declare function resolveLocalMediaPath(data: Record<string, unknown>): st
|
|
|
7
7
|
export declare function asMessageElements(content: SendContent): MessageElement[];
|
|
8
8
|
export declare function isMediaSegmentType(type: string): boolean;
|
|
9
9
|
export declare function collectOutboundMediaKinds(content: SendContent | undefined): string[];
|
|
10
|
-
//# sourceMappingURL=outbound-media-utils.d.ts.map
|
package/lib/built/permission.js
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Feature } from "@zhin.js/kernel";
|
|
6
6
|
import logger, { formatCompact } from "@zhin.js/logger";
|
|
7
|
-
import { getPlugin } from "../plugin.js";
|
|
8
7
|
import { isBuiltinPermit, parsePermitName } from "./permit-parse.js";
|
|
9
8
|
import { checkBuiltinPermit } from "./permit-check.js";
|
|
10
9
|
import { senderRolesFromMessage } from "./message-enrich.js";
|
|
@@ -81,7 +80,7 @@ export class PermissionFeature extends Feature {
|
|
|
81
80
|
const feature = this;
|
|
82
81
|
return {
|
|
83
82
|
addPermission(permission) {
|
|
84
|
-
const plugin =
|
|
83
|
+
const plugin = this;
|
|
85
84
|
const dispose = feature.add(permission, plugin.name);
|
|
86
85
|
const permName = permission.name instanceof RegExp ? permission.name.source : permission.name;
|
|
87
86
|
plugin.recordFeatureContribution(feature.name, permName);
|
|
@@ -102,4 +101,3 @@ export var Permissions;
|
|
|
102
101
|
* @deprecated Use PermissionFeature instead
|
|
103
102
|
*/
|
|
104
103
|
export const PermissionService = PermissionFeature;
|
|
105
|
-
//# sourceMappingURL=permission.js.map
|
|
@@ -5,4 +5,3 @@ import type { Message } from '../message.js';
|
|
|
5
5
|
import type { SenderRole } from './roles.js';
|
|
6
6
|
export declare function checkBuiltinPermit(name: string, message: Message<any>, roles: readonly SenderRole[]): boolean;
|
|
7
7
|
export declare function checkBuiltinPermitList(permits: readonly string[], message: Message<any>, roles: readonly SenderRole[]): boolean;
|
|
8
|
-
//# sourceMappingURL=permit-check.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Platform permit —
|
|
2
|
+
* Platform permit — 适配器注册的平台级权限校验(场景治理、频道身份等)
|
|
3
3
|
*/
|
|
4
4
|
import type { Message } from '../message.js';
|
|
5
5
|
export type PlatformPermitChecker = (perm: string, message: Message<any>) => boolean;
|
|
@@ -14,8 +14,7 @@ export declare function applyQqSenderRoleToMessageSender(sender: {
|
|
|
14
14
|
role?: string;
|
|
15
15
|
permissions?: string[];
|
|
16
16
|
}, role?: string): void;
|
|
17
|
-
/** 常见 IM
|
|
18
|
-
export declare function
|
|
19
|
-
/**
|
|
20
|
-
export declare function
|
|
21
|
-
//# sourceMappingURL=platform-permit.d.ts.map
|
|
17
|
+
/** 常见 IM 平台场景身份:$sender.role 为 owner / admin */
|
|
18
|
+
export declare function createSceneRolePlatformChecker(): PlatformPermitChecker;
|
|
19
|
+
/** 为适配器注册默认场景治理 platform checker(幂等) */
|
|
20
|
+
export declare function registerDefaultScenePlatformPermitChecker(adapter: string): () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parsePlatformPermitName, isPlatformPermit } from './permit-parse.js';
|
|
2
2
|
const checkers = new Map();
|
|
3
|
-
const
|
|
3
|
+
const registeredDefaultSceneCheckers = new Set();
|
|
4
4
|
export function registerPlatformPermitChecker(adapter, checker) {
|
|
5
5
|
const key = String(adapter);
|
|
6
6
|
checkers.set(key, checker);
|
|
@@ -12,7 +12,7 @@ export function registerPlatformPermitChecker(adapter, checker) {
|
|
|
12
12
|
}
|
|
13
13
|
export function clearPlatformPermitCheckers() {
|
|
14
14
|
checkers.clear();
|
|
15
|
-
|
|
15
|
+
registeredDefaultSceneCheckers.clear();
|
|
16
16
|
}
|
|
17
17
|
export function checkPlatformPermit(name, message) {
|
|
18
18
|
const parsed = parsePlatformPermitName(name);
|
|
@@ -44,24 +44,23 @@ export function applyQqSenderRoleToMessageSender(sender, role) {
|
|
|
44
44
|
sender.role = normalized;
|
|
45
45
|
sender.permissions = [normalized];
|
|
46
46
|
}
|
|
47
|
-
/** 常见 IM
|
|
48
|
-
export function
|
|
47
|
+
/** 常见 IM 平台场景身份:$sender.role 为 owner / admin */
|
|
48
|
+
export function createSceneRolePlatformChecker() {
|
|
49
49
|
return (perm, message) => {
|
|
50
50
|
const role = message.$sender?.role;
|
|
51
|
-
if (perm === '
|
|
51
|
+
if (perm === 'scene_admin')
|
|
52
52
|
return role === 'admin' || role === 'owner';
|
|
53
|
-
if (perm === '
|
|
53
|
+
if (perm === 'scene_owner')
|
|
54
54
|
return role === 'owner';
|
|
55
55
|
return false;
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
59
|
-
export function
|
|
58
|
+
/** 为适配器注册默认场景治理 platform checker(幂等) */
|
|
59
|
+
export function registerDefaultScenePlatformPermitChecker(adapter) {
|
|
60
60
|
const key = String(adapter);
|
|
61
|
-
if (
|
|
61
|
+
if (registeredDefaultSceneCheckers.has(key)) {
|
|
62
62
|
return () => { };
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
return registerPlatformPermitChecker(key,
|
|
64
|
+
registeredDefaultSceneCheckers.add(key);
|
|
65
|
+
return registerPlatformPermitChecker(key, createSceneRolePlatformChecker());
|
|
66
66
|
}
|
|
67
|
-
//# sourceMappingURL=platform-permit.js.map
|
|
@@ -32,4 +32,3 @@ export declare function resolveQuoteContextBlock(message: Message<any>, root: Pl
|
|
|
32
32
|
export declare function prependQuoteContext(message: Message<any>, root: Plugin, userText: string, options?: {
|
|
33
33
|
enabled?: boolean;
|
|
34
34
|
}): Promise<string>;
|
|
35
|
-
//# sourceMappingURL=prepend-quote-context.d.ts.map
|
|
@@ -128,4 +128,3 @@ export async function prependQuoteContext(message, root, userText, options) {
|
|
|
128
128
|
const quoteBlock = await resolveQuoteContextBlock(message, root, options);
|
|
129
129
|
return buildUserTurnWithQuoteContext(userText, quoteBlock);
|
|
130
130
|
}
|
|
131
|
-
//# sourceMappingURL=prepend-quote-context.js.map
|
|
@@ -16,4 +16,3 @@ export declare function resolveQrcodeSegmentsToImages(content: SendContent | und
|
|
|
16
16
|
export declare function resolveQrcodeSegmentsToTerminal(content: SendContent | undefined): Promise<SendContent | undefined>;
|
|
17
17
|
/** 不支持图片的平台:仅输出链接文本 */
|
|
18
18
|
export declare function coerceQrcodeSegmentsToText(content: SendContent): SendContent;
|
|
19
|
-
//# sourceMappingURL=qrcode-segment.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MessageType } from '../message.js';
|
|
2
2
|
import type { SendContent, SendOptions } from '../types.js';
|
|
3
|
+
import { type IMDeliveryTarget } from '../im-scene.js';
|
|
3
4
|
export interface QueueEnvelope<TDetail extends Record<string, unknown> = Record<string, unknown>> {
|
|
4
5
|
kind: string;
|
|
5
6
|
type: string;
|
|
@@ -23,5 +24,9 @@ export declare function isMessageType(value: unknown): value is MessageType;
|
|
|
23
24
|
/** Normalize queue outbound detail into the canonical queue-IM shape. */
|
|
24
25
|
export declare function normalizeQueueOutboundDetail(record: Record<string, unknown>): NormalizedQueueOutboundDetail;
|
|
25
26
|
export declare function toSendOptions(detail: NormalizedQueueOutboundDetail): SendOptions;
|
|
27
|
+
export interface QueueIMSceneTargetDetail {
|
|
28
|
+
target: IMDeliveryTarget;
|
|
29
|
+
content: SendContent;
|
|
30
|
+
}
|
|
31
|
+
export declare function sceneTargetToSendOptions(detail: QueueIMSceneTargetDetail): SendOptions;
|
|
26
32
|
export declare function normalizeRecordToSendOptions(record: Record<string, unknown>): SendOptions;
|
|
27
|
-
//# sourceMappingURL=queue-im-field-contract.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sceneRefToSendOptions } from '../im-scene.js';
|
|
1
2
|
export class QueueIMFieldContractError extends Error {
|
|
2
3
|
code;
|
|
3
4
|
field;
|
|
@@ -52,7 +53,15 @@ export function toSendOptions(detail) {
|
|
|
52
53
|
content: detail.content,
|
|
53
54
|
};
|
|
54
55
|
}
|
|
56
|
+
export function sceneTargetToSendOptions(detail) {
|
|
57
|
+
return sceneRefToSendOptions(detail.target, detail.content);
|
|
58
|
+
}
|
|
55
59
|
export function normalizeRecordToSendOptions(record) {
|
|
60
|
+
if (record.target && typeof record.target === 'object') {
|
|
61
|
+
return sceneTargetToSendOptions({
|
|
62
|
+
target: record.target,
|
|
63
|
+
content: requireContent(record.content),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
56
66
|
return toSendOptions(normalizeQueueOutboundDetail(record));
|
|
57
67
|
}
|
|
58
|
-
//# sourceMappingURL=queue-im-field-contract.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type OutboundRichSegmentPolicy } from './types.js';
|
|
2
2
|
/** 全功能 IM:html/markdown/qrcode→image,tts→audio */
|
|
3
3
|
export declare const OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL: OutboundRichSegmentPolicy;
|
|
4
4
|
/** 仅文本降级(无富媒体出站能力) */
|
|
@@ -7,4 +7,3 @@ export declare const OUTBOUND_RICH_SEGMENT_POLICY_TEXT_ONLY: OutboundRichSegment
|
|
|
7
7
|
export declare const OUTBOUND_RICH_SEGMENT_POLICY_IM_DEFAULT: OutboundRichSegmentPolicy;
|
|
8
8
|
/** 无音频出站(tts 降级 text) */
|
|
9
9
|
export declare const OUTBOUND_RICH_SEGMENT_POLICY_NO_AUDIO: OutboundRichSegmentPolicy;
|
|
10
|
-
//# sourceMappingURL=adapter-policies.d.ts.map
|
|
@@ -4,4 +4,3 @@ export declare function registerRichSegmentCapabilityLoader(id: string, loader:
|
|
|
4
4
|
/** 测试隔离 */
|
|
5
5
|
export declare function resetRichSegmentCapabilityLoadersForTests(): void;
|
|
6
6
|
export declare function createRichSegmentRenderContext(options?: RichSegmentCapabilityLoaderOptions): RichSegmentRenderContext;
|
|
7
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RichSegment } from './base.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type RichSegmentRenderContext, type RichSegmentRenderResult } from './types.js';
|
|
3
3
|
export interface HtmlSegmentData {
|
|
4
4
|
html: string;
|
|
5
5
|
text?: string;
|
|
@@ -13,4 +13,3 @@ export declare class HtmlSegment extends RichSegment<HtmlSegmentData> {
|
|
|
13
13
|
render(mode: string, ctx?: RichSegmentRenderContext): Promise<RichSegmentRenderResult>;
|
|
14
14
|
}
|
|
15
15
|
export declare function wrapHtmlSegment(data: Record<string, unknown>): HtmlSegment;
|
|
16
|
-
//# sourceMappingURL=html-segment.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RichSegment } from './base.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type RichSegmentRenderContext, type RichSegmentRenderResult } from './types.js';
|
|
3
3
|
export interface MarkdownSegmentData {
|
|
4
4
|
content: string;
|
|
5
5
|
width?: number;
|
|
@@ -12,4 +12,3 @@ export declare class MarkdownSegment extends RichSegment<MarkdownSegmentData> {
|
|
|
12
12
|
render(mode: string, ctx?: RichSegmentRenderContext): Promise<RichSegmentRenderResult>;
|
|
13
13
|
}
|
|
14
14
|
export declare function wrapMarkdownSegment(data: Record<string, unknown>): MarkdownSegment;
|
|
15
|
-
//# sourceMappingURL=markdown-segment.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MessageElement } from '../../types.js';
|
|
2
2
|
import { type GenerateQrCodeOptions } from '../generated-qrcode.js';
|
|
3
3
|
import { RichSegment } from './base.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type RichSegmentRenderContext, type RichSegmentRenderResult } from './types.js';
|
|
5
5
|
export interface QrcodeSegmentData extends GenerateQrCodeOptions {
|
|
6
6
|
text: string;
|
|
7
7
|
/** process origin 模式终端渲染时使用 */
|
|
@@ -16,4 +16,3 @@ export declare class QrcodeSegment extends RichSegment<QrcodeSegmentData> {
|
|
|
16
16
|
export declare function wrapQrcodeSegment(data: Record<string, unknown>): QrcodeSegment;
|
|
17
17
|
/** process endpoint:origin qrcode 段 → 终端 ASCII + 文本占位 */
|
|
18
18
|
export declare function interpretOriginQrcodeForProcess(content: MessageElement | string | (MessageElement | string)[]): Promise<MessageElement | string | (MessageElement | string)[]>;
|
|
19
|
-
//# sourceMappingURL=qrcode-segment.d.ts.map
|
|
@@ -14,4 +14,3 @@ export declare class RichSegmentRegistry {
|
|
|
14
14
|
export declare const RICH_SEGMENT_FALLBACK_MODE = "origin";
|
|
15
15
|
export declare const richSegmentRegistry: RichSegmentRegistry;
|
|
16
16
|
export declare function registerRichSegmentKind(definition: RichSegmentKindDefinition): void;
|
|
17
|
-
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { SendContent } from '../../types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type OutboundRichSegmentPolicy, type RichSegmentRenderContext } from './types.js';
|
|
3
3
|
export declare function hasRichSegment(content: SendContent | undefined): boolean;
|
|
4
4
|
/** 按 Adapter 出站策略在 renderSendMessage 首步统一渲染富媒体段 */
|
|
5
5
|
export declare function resolveRichSegments(content: SendContent, policy: OutboundRichSegmentPolicy, ctx?: RichSegmentRenderContext): Promise<SendContent>;
|
|
6
|
-
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RichSegment } from './base.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type RichSegmentRenderContext, type RichSegmentRenderResult } from './types.js';
|
|
3
3
|
export interface TtsSegmentData {
|
|
4
4
|
text: string;
|
|
5
5
|
voice?: string;
|
|
@@ -11,4 +11,3 @@ export declare class TtsSegment extends RichSegment<TtsSegmentData> {
|
|
|
11
11
|
render(mode: string, ctx?: RichSegmentRenderContext): Promise<RichSegmentRenderResult>;
|
|
12
12
|
}
|
|
13
13
|
export declare function wrapTtsSegment(data: Record<string, unknown>): TtsSegment;
|
|
14
|
-
//# sourceMappingURL=tts-segment.d.ts.map
|
|
@@ -82,4 +82,3 @@ export interface RichSegmentCapabilityLoaderOptions {
|
|
|
82
82
|
logContentChain?: RichSegmentRenderContext['logContentChain'];
|
|
83
83
|
}
|
|
84
84
|
export type RichSegmentCapabilityLoader = (options: RichSegmentCapabilityLoaderOptions) => Promise<unknown>;
|
|
85
|
-
//# sourceMappingURL=types.d.ts.map
|
package/lib/built/roles.d.ts
CHANGED
|
@@ -12,4 +12,3 @@ export declare function hasSenderRole(roles: Iterable<SenderRole>, role: SenderR
|
|
|
12
12
|
export declare function formatSenderRolesForLabel(roles: readonly SenderRole[]): string;
|
|
13
13
|
/** 剥离用户正文里自造的发送者前缀 */
|
|
14
14
|
export declare function stripUserSpoofedSenderPrefix(rawContent: string): string;
|
|
15
|
-
//# sourceMappingURL=roles.d.ts.map
|
package/lib/built/roles.js
CHANGED
|
@@ -7,4 +7,3 @@ export declare function shouldBindProcessStdin(): boolean;
|
|
|
7
7
|
export declare function isInteractiveStdin(): boolean;
|
|
8
8
|
export declare function isDenoDeploy(): boolean;
|
|
9
9
|
export declare function bindStdin(onChunk: (chunk: string) => void): () => void;
|
|
10
|
-
//# sourceMappingURL=runtime-io.d.ts.map
|
package/lib/built/runtime-io.js
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScheduleFeature — 管理插件注册的内存定时任务
|
|
3
|
+
*/
|
|
4
|
+
import { Feature, FeatureJSON, type ScheduleKind } from '@zhin.js/kernel';
|
|
5
|
+
import type { HolidayInput, ScatterInput } from '@zhin.js/kernel';
|
|
6
|
+
export interface ScheduleDescriptor {
|
|
7
|
+
kind: ScheduleKind | 'every' | 'at';
|
|
8
|
+
/** 6 段 cron(solar/lunar/workday/freeDay/holiday) */
|
|
9
|
+
cron?: string;
|
|
10
|
+
everyMs?: number;
|
|
11
|
+
atMs?: number;
|
|
12
|
+
scatterInput?: ScatterInput;
|
|
13
|
+
holidayInput?: HolidayInput;
|
|
14
|
+
tz?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ScheduleHandle {
|
|
17
|
+
id: string;
|
|
18
|
+
descriptor: ScheduleDescriptor;
|
|
19
|
+
dispose: () => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ScheduleContextExtensions {
|
|
22
|
+
addSchedule(descriptor: ScheduleDescriptor, callback: () => void | Promise<void>, id?: string): () => void;
|
|
23
|
+
}
|
|
24
|
+
declare module '../plugin.js' {
|
|
25
|
+
namespace Plugin {
|
|
26
|
+
interface Extensions extends ScheduleContextExtensions {
|
|
27
|
+
}
|
|
28
|
+
interface Contexts {
|
|
29
|
+
schedule: ScheduleFeature;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export declare class ScheduleFeature extends Feature<ScheduleHandle> {
|
|
34
|
+
readonly name: "schedule";
|
|
35
|
+
readonly icon = "Clock";
|
|
36
|
+
readonly desc = "\u65E5\u5386\u8C03\u5EA6";
|
|
37
|
+
readonly byName: Map<string, ScheduleHandle>;
|
|
38
|
+
add(handle: ScheduleHandle, pluginName: string): () => void;
|
|
39
|
+
remove(handle: ScheduleHandle): boolean;
|
|
40
|
+
get(id: string): ScheduleHandle | undefined;
|
|
41
|
+
stopAll(): void;
|
|
42
|
+
getStatus(): Array<{
|
|
43
|
+
id: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
expression?: string;
|
|
46
|
+
running: boolean;
|
|
47
|
+
nextExecution: Date | null;
|
|
48
|
+
plugin: string;
|
|
49
|
+
}>;
|
|
50
|
+
dispose(): void;
|
|
51
|
+
toJSON(pluginName?: string): FeatureJSON;
|
|
52
|
+
get extensions(): {
|
|
53
|
+
addSchedule(descriptor: ScheduleDescriptor, callback: () => void | Promise<void>, id?: string): () => void;
|
|
54
|
+
};
|
|
55
|
+
}
|