@zhin.js/core 1.1.35 → 1.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -193
- package/lib/built/ai-outbound/index.d.ts +0 -1
- package/lib/built/ai-outbound/index.js +0 -1
- package/lib/built/ai-outbound/types.d.ts +0 -9
- package/lib/built/ai-trigger.d.ts +0 -5
- package/lib/built/ai-trigger.js +1 -27
- package/lib/built/common-adapter-tools.d.ts +0 -2
- package/lib/built/common-adapter-tools.js +0 -4
- package/lib/built/html-segment-fallback.d.ts +2 -5
- package/lib/built/html-segment-fallback.js +0 -15
- 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 +0 -1
- package/lib/built/interactive-segments/resolve.js +0 -1
- package/lib/built/interactive-segments/types.d.ts +0 -5
- package/lib/built/login-assist.d.ts +1 -8
- package/lib/built/message-enrich.d.ts +2 -8
- package/lib/built/message-enrich.js +3 -11
- package/lib/built/segment-contract/validate.d.ts +2 -2
- package/lib/built/segment-contract/validate.js +1 -3
- package/lib/built/tool-access.d.ts +5 -0
- package/lib/built/tool-access.js +17 -0
- package/lib/built/user-interaction.js +0 -4
- package/lib/feature/handler.d.ts +1 -5
- package/lib/index.d.ts +4 -45
- package/lib/index.js +3 -39
- package/lib/message.d.ts +1 -2
- 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 +1 -2
- package/lib/plugin-runtime/im/conversation-runtime.d.ts +19 -0
- package/lib/plugin-runtime/im/conversation-runtime.js +312 -0
- package/lib/plugin-runtime/im/endpoint-runtime.d.ts +79 -0
- package/lib/plugin-runtime/im/endpoint-runtime.js +162 -0
- package/lib/plugin-runtime/im/im-runtime.d.ts +13 -106
- package/lib/plugin-runtime/im/im-runtime.js +58 -1061
- package/lib/plugin-runtime/im/inbound-runtime.d.ts +31 -0
- package/lib/plugin-runtime/im/inbound-runtime.js +252 -0
- package/lib/plugin-runtime/im/index.d.ts +4 -2
- package/lib/plugin-runtime/im/index.js +2 -2
- package/lib/plugin-runtime/im/ingress-route.d.ts +10 -0
- package/lib/plugin-runtime/im/ingress-route.js +10 -0
- package/lib/plugin-runtime/im/interaction-runtime.d.ts +23 -0
- package/lib/plugin-runtime/im/interaction-runtime.js +181 -0
- package/lib/plugin-runtime/im/interactive-router.d.ts +17 -0
- package/lib/plugin-runtime/im/interactive-router.js +98 -0
- package/lib/plugin-runtime/im/message-bus.d.ts +3 -3
- package/lib/plugin-runtime/im/message-bus.js +3 -3
- package/lib/plugin-runtime/im/message-events.d.ts +26 -0
- package/lib/plugin-runtime/im/message-events.js +61 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.d.ts +19 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.js +165 -0
- package/lib/plugin-runtime/im/outbound-segments.d.ts +2 -3
- package/lib/plugin-runtime/im/outbound-segments.js +3 -4
- package/lib/plugin-runtime/im/runtime-middleware.d.ts +3 -0
- package/lib/plugin-runtime/im/runtime-middleware.js +13 -0
- package/lib/request.d.ts +1 -2
- package/lib/side-event/base.d.ts +1 -2
- package/lib/side-event/normalize.d.ts +1 -5
- package/lib/side-event/normalize.js +1 -11
- package/lib/system-event.d.ts +1 -2
- package/lib/types.d.ts +9 -116
- package/lib/utils.d.ts +51 -24
- package/lib/utils.js +11 -23
- package/package.json +18 -28
- 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/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/endpoint-manager.js +0 -1
- 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/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/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/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/tool-zod.d.ts +0 -43
- package/lib/tool-zod.js +0 -184
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Schema } from '@zhin.js/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Segment } from './types.js';
|
|
3
|
+
export { isMediaRef } from '@zhin.js/im-contract';
|
|
3
4
|
export declare const mediaRefSchema: Schema<{
|
|
4
5
|
kind?: any;
|
|
5
6
|
value?: string | undefined;
|
|
@@ -224,6 +225,5 @@ export declare const rpsSegmentSchema: Schema<{
|
|
|
224
225
|
}>;
|
|
225
226
|
export declare const canonicalSegmentSchema: Schema<any, any>;
|
|
226
227
|
export declare const segmentArraySchema: Schema<any[], any[]>;
|
|
227
|
-
export declare function isMediaRef(value: unknown): value is MediaRef;
|
|
228
228
|
/** 严格 canonical 段校验(@zhin.js/schema validate-only) */
|
|
229
229
|
export declare function isStrictCanonicalSegment(value: unknown): value is Segment;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Schema } from '@zhin.js/schema';
|
|
2
|
+
export { isMediaRef } from '@zhin.js/im-contract';
|
|
2
3
|
const platformSchema = Schema.dict(Schema.any());
|
|
3
4
|
const mediaKindSchema = Schema.union([
|
|
4
5
|
Schema.const('url'),
|
|
@@ -165,9 +166,6 @@ export const canonicalSegmentSchema = Schema.discriminatedUnion('type', {
|
|
|
165
166
|
},
|
|
166
167
|
});
|
|
167
168
|
export const segmentArraySchema = Schema.list(canonicalSegmentSchema);
|
|
168
|
-
export function isMediaRef(value) {
|
|
169
|
-
return mediaRefSchema.safeParse(value).success;
|
|
170
|
-
}
|
|
171
169
|
/** 严格 canonical 段校验(@zhin.js/schema validate-only) */
|
|
172
170
|
export function isStrictCanonicalSegment(value) {
|
|
173
171
|
return canonicalSegmentSchema.safeParse(value).success;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type PermissionHost } from '@zhin.js/permission';
|
|
2
|
+
import type { Message } from '../message.js';
|
|
3
|
+
import type { Tool } from '../types.js';
|
|
4
|
+
/** Checks whether a Tool is visible to the current IM message context. */
|
|
5
|
+
export declare function canAccessTool(tool: Tool, message?: Message<any>, host?: PermissionHost | null): Promise<boolean>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toPermissionSubject } from '@zhin.js/permission';
|
|
2
|
+
/** Checks whether a Tool is visible to the current IM message context. */
|
|
3
|
+
export async function canAccessTool(tool, message, host) {
|
|
4
|
+
if (!message)
|
|
5
|
+
return !tool.platforms?.length && !tool.scopes?.length && !tool.permissions?.length;
|
|
6
|
+
const adapter = String(message.$adapter);
|
|
7
|
+
const scope = (message.$channel?.type || 'private');
|
|
8
|
+
if (tool.platforms?.length && !tool.platforms.includes(adapter))
|
|
9
|
+
return false;
|
|
10
|
+
if (tool.scopes?.length && !tool.scopes.includes(scope))
|
|
11
|
+
return false;
|
|
12
|
+
if (!tool.permissions?.length)
|
|
13
|
+
return true;
|
|
14
|
+
if (!host)
|
|
15
|
+
return false;
|
|
16
|
+
return host.checkAll(tool.permissions, toPermissionSubject(message));
|
|
17
|
+
}
|
|
@@ -14,14 +14,10 @@ export function assertUserInteractionRequest(request) {
|
|
|
14
14
|
if (request.type === 'select' || request.type === 'multiselect') {
|
|
15
15
|
if (request.options.length === 0)
|
|
16
16
|
throw new TypeError('User interaction options must not be empty');
|
|
17
|
-
const labels = new Set();
|
|
18
17
|
for (const option of request.options) {
|
|
19
18
|
const label = option.label.trim().toLocaleLowerCase();
|
|
20
19
|
if (!label)
|
|
21
20
|
throw new TypeError('User interaction option label must not be empty');
|
|
22
|
-
if (labels.has(label))
|
|
23
|
-
throw new TypeError(`Duplicate user interaction option label: ${option.label}`);
|
|
24
|
-
labels.add(label);
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
23
|
if (request.type === 'multiselect') {
|
package/lib/feature/handler.d.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/** Authoring API for Handler Feature — implementation in `@zhin.js/handler`. */
|
|
2
2
|
export { parseHandlerDefinition, HandlerIndex, isHandlerIndex, handlerFeatureId, handlerFeature, handlerEventFromLocalName, resolveHandlerEvent, type HandlerEventMap, type HandlerDefinition, type HandlerDescriptor, type HandlerContext, type HandlerDispatchOptions, } from '@zhin.js/handler';
|
|
3
3
|
import { type HandlerContext, type HandlerDefinition, type HandlerEventMap } from '@zhin.js/handler';
|
|
4
|
-
import type { Plugin } from '../plugin.js';
|
|
5
4
|
import type { Message } from '../plugin-runtime/im/contracts.js';
|
|
6
5
|
import type { Notice } from '../notice.js';
|
|
7
6
|
import type { Request } from '../request.js';
|
|
8
7
|
import type { SystemEvent } from '../system-event.js';
|
|
9
8
|
import type { AdapterClient, AdapterEvents, EndpointEvent, EndpointIdentity, PlatformEvent, RegisteredAdapterName } from '@zhin.js/adapter';
|
|
10
|
-
type KnownKeys<T> = {
|
|
11
|
-
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
|
|
12
|
-
};
|
|
13
9
|
declare module '@zhin.js/handler' {
|
|
14
|
-
interface HandlerEventMap
|
|
10
|
+
interface HandlerEventMap {
|
|
15
11
|
'message.receive': [event: EndpointEvent<Message>];
|
|
16
12
|
'notice.receive': [event: EndpointEvent<Notice>];
|
|
17
13
|
'request.receive': [event: EndpointEvent<Request>];
|
package/lib/index.d.ts
CHANGED
|
@@ -2,82 +2,41 @@
|
|
|
2
2
|
* Canonical IM messages, Endpoints, rendering, and plugin-facing core types.
|
|
3
3
|
* @module @zhin.js/core
|
|
4
4
|
*/
|
|
5
|
-
export * from './endpoint.js';
|
|
6
|
-
export * from './endpoint-capabilities.js';
|
|
7
|
-
export * from './plugin.js';
|
|
8
|
-
export * from './command.js';
|
|
9
5
|
export * from './component.js';
|
|
10
|
-
export * from './adapter.js';
|
|
11
6
|
export * from './message.js';
|
|
12
7
|
export * from './im-scene.js';
|
|
13
8
|
export * from './notice.js';
|
|
14
9
|
export * from './request.js';
|
|
15
10
|
export * from './system-event.js';
|
|
16
11
|
export * from './side-event/index.js';
|
|
17
|
-
export * from './schema-interaction.js';
|
|
18
12
|
export type * from '@zhin.js/interaction';
|
|
19
13
|
export * from './types.js';
|
|
20
14
|
export * from './utils.js';
|
|
21
15
|
export * from './errors.js';
|
|
22
|
-
export * from './built/config.js';
|
|
23
|
-
export * from './built/command.js';
|
|
24
|
-
export * from './built/schedule.js';
|
|
25
|
-
export type { ScheduleDescriptor, ScheduleHandle, ScheduleContextExtensions } from './built/schedule.js';
|
|
26
16
|
export * from './models/system-log.js';
|
|
27
17
|
export * from './models/user.js';
|
|
28
|
-
export * from './built/permit-parse.js';
|
|
29
|
-
export * from './built/permit-check.js';
|
|
30
|
-
export * from './built/platform-permit.js';
|
|
31
|
-
export * from './built/authorization.js';
|
|
32
18
|
export * from './built/message-enrich.js';
|
|
33
19
|
export type { AgentTurnMessage, SyntheticMessageInput } from './built/message-enrich.js';
|
|
34
|
-
export * from './built/
|
|
35
|
-
export * from './built/database.js';
|
|
36
|
-
export * from './built/message-filter.js';
|
|
37
|
-
export * from './built/tool.js';
|
|
38
|
-
export * from './built/skill.js';
|
|
39
|
-
export * from './built/agent-preset.js';
|
|
20
|
+
export * from './built/tool-access.js';
|
|
40
21
|
export * from './built/common-adapter-tools.js';
|
|
41
22
|
export * from './built/roles.js';
|
|
42
23
|
export * from './im-session-id.js';
|
|
43
24
|
export * from './built/ai-trigger.js';
|
|
44
25
|
export * from './built/ai-access.js';
|
|
45
|
-
export * from './built/dispatcher.js';
|
|
46
|
-
export * from './built/schema-feature.js';
|
|
47
26
|
export * from './built/login-assist.js';
|
|
48
27
|
export * from './built/generated-qrcode.js';
|
|
49
|
-
export
|
|
28
|
+
export { markdownToPlainText } from './built/rich-segments/markdown-to-text.js';
|
|
50
29
|
export * from './built/interactive-segments/index.js';
|
|
51
30
|
export * from './built/user-interaction.js';
|
|
52
31
|
export * from './built/ai-outbound/index.js';
|
|
53
|
-
export { loadHtmlRenderer, seedHtmlRenderer, HTML_RENDERER_PACKAGE } from './built/html-renderer-loader.js';
|
|
54
|
-
export { loadSpeechPipeline, seedSpeechPipeline, SPEECH_PACKAGE } from './built/speech-loader.js';
|
|
55
32
|
export * from './built/outbound-media-utils.js';
|
|
56
|
-
export * from './built/outbound-media-contract.js';
|
|
57
|
-
export * from './built/interactive-segment-contract.js';
|
|
58
33
|
export * from './built/segment-contract/index.js';
|
|
59
34
|
export type { SegmentMediaRef } from './built/segment-contract/media.js';
|
|
60
35
|
export * from './built/generic-segment-mapper.js';
|
|
61
|
-
export * from './built/adapter-process.js';
|
|
62
|
-
export * from './built/component.js';
|
|
63
|
-
export * from './built/inbound-runner.js';
|
|
64
|
-
export type { RunInboundMessageOptions, InboundRunResult } from './built/inbound-runner.js';
|
|
65
|
-
export * from './built/connect-endpoint-instance.js';
|
|
66
|
-
export type { ConnectEndpointInstanceOptions } from './built/connect-endpoint-instance.js';
|
|
67
|
-
export * from './built/endpoint-lifecycle.js';
|
|
68
|
-
export type { EndpointLifecycleKind, EndpointLifecyclePayload } from './built/endpoint-lifecycle.js';
|
|
69
|
-
export * from './built/endpoint-manager.js';
|
|
70
|
-
export type { EndpointConfigRecord, EndpointManager, ProvisionContext } from './built/endpoint-manager.js';
|
|
71
|
-
export * from './built/endpoint-lifecycle-service.js';
|
|
72
|
-
export * from './built/schema-endpoint-manager.js';
|
|
73
|
-
export * from './built/endpoint-commands.js';
|
|
74
|
-
export * from './built/introspection-format.js';
|
|
75
|
-
export * from './built/management-command-guard.js';
|
|
76
36
|
export * from './built/html-to-text.js';
|
|
77
37
|
export * from './built/html-segment-fallback.js';
|
|
78
38
|
export * from '@zhin.js/database';
|
|
79
39
|
export * from '@zhin.js/logger';
|
|
80
40
|
export { Schema } from '@zhin.js/schema';
|
|
81
|
-
export
|
|
82
|
-
export {
|
|
83
|
-
export type { FeatureJSON, FeatureListener, Schedule, JobPayload, JobState, ScheduledJob, JobStore, JobCallback, AddJobOptions, IScheduler, SchedulerOptions, ScheduleFireCallback, MemoryScheduleRegistration, ScheduleEngineOptions, JobContext, ResolvedJob, ScheduleKind, } from '@zhin.js/kernel';
|
|
41
|
+
export { ScheduleEngine, Scheduler, } from '@zhin.js/kernel';
|
|
42
|
+
export type { Schedule, JobPayload, JobState, ScheduledJob, JobStore, JobCallback, AddJobOptions, IScheduler, SchedulerOptions, ScheduleFireCallback, MemoryScheduleRegistration, ScheduleEngineOptions, JobContext, ResolvedJob, ScheduleKind, } from '@zhin.js/kernel';
|
package/lib/index.js
CHANGED
|
@@ -2,76 +2,40 @@
|
|
|
2
2
|
* Canonical IM messages, Endpoints, rendering, and plugin-facing core types.
|
|
3
3
|
* @module @zhin.js/core
|
|
4
4
|
*/
|
|
5
|
-
// ── Core 类模块 ──────────────────────────────────────────────────────
|
|
6
|
-
export * from './endpoint.js';
|
|
7
|
-
export * from './endpoint-capabilities.js';
|
|
8
|
-
export * from './plugin.js';
|
|
9
|
-
export * from './command.js';
|
|
10
5
|
export * from './component.js';
|
|
11
|
-
export * from './adapter.js';
|
|
12
6
|
export * from './message.js';
|
|
13
7
|
export * from './im-scene.js';
|
|
14
8
|
export * from './notice.js';
|
|
15
9
|
export * from './request.js';
|
|
16
10
|
export * from './system-event.js';
|
|
17
11
|
export * from './side-event/index.js';
|
|
18
|
-
export * from './schema-interaction.js';
|
|
19
12
|
export * from './types.js';
|
|
20
13
|
export * from './utils.js';
|
|
21
14
|
export * from './errors.js';
|
|
22
15
|
// ── Built 模块 ──────────────────────────────────────────────────────
|
|
23
|
-
export * from './built/config.js';
|
|
24
|
-
export * from './built/command.js';
|
|
25
|
-
export * from './built/schedule.js';
|
|
26
16
|
// Models
|
|
27
17
|
export * from './models/system-log.js';
|
|
28
18
|
export * from './models/user.js';
|
|
29
|
-
export * from './built/permit-parse.js';
|
|
30
|
-
export * from './built/permit-check.js';
|
|
31
|
-
export * from './built/platform-permit.js';
|
|
32
|
-
export * from './built/authorization.js';
|
|
33
19
|
export * from './built/message-enrich.js';
|
|
34
|
-
export * from './built/
|
|
35
|
-
export * from './built/database.js';
|
|
36
|
-
export * from './built/message-filter.js';
|
|
37
|
-
export * from './built/tool.js';
|
|
38
|
-
export * from './built/skill.js';
|
|
39
|
-
export * from './built/agent-preset.js';
|
|
20
|
+
export * from './built/tool-access.js';
|
|
40
21
|
export * from './built/common-adapter-tools.js';
|
|
41
22
|
export * from './built/roles.js';
|
|
42
23
|
export * from './im-session-id.js';
|
|
43
24
|
export * from './built/ai-trigger.js';
|
|
44
25
|
export * from './built/ai-access.js';
|
|
45
|
-
export * from './built/dispatcher.js';
|
|
46
|
-
export * from './built/schema-feature.js';
|
|
47
26
|
export * from './built/login-assist.js';
|
|
48
27
|
export * from './built/generated-qrcode.js';
|
|
49
|
-
export
|
|
28
|
+
export { markdownToPlainText } from './built/rich-segments/markdown-to-text.js';
|
|
50
29
|
export * from './built/interactive-segments/index.js';
|
|
51
30
|
export * from './built/user-interaction.js';
|
|
52
31
|
export * from './built/ai-outbound/index.js';
|
|
53
|
-
export { loadHtmlRenderer, seedHtmlRenderer, HTML_RENDERER_PACKAGE } from './built/html-renderer-loader.js';
|
|
54
|
-
export { loadSpeechPipeline, seedSpeechPipeline, SPEECH_PACKAGE } from './built/speech-loader.js';
|
|
55
32
|
export * from './built/outbound-media-utils.js';
|
|
56
|
-
export * from './built/outbound-media-contract.js';
|
|
57
|
-
export * from './built/interactive-segment-contract.js';
|
|
58
33
|
export * from './built/segment-contract/index.js';
|
|
59
34
|
export * from './built/generic-segment-mapper.js';
|
|
60
|
-
export * from './built/adapter-process.js';
|
|
61
|
-
export * from './built/component.js';
|
|
62
|
-
export * from './built/inbound-runner.js';
|
|
63
|
-
export * from './built/connect-endpoint-instance.js';
|
|
64
|
-
export * from './built/endpoint-lifecycle.js';
|
|
65
|
-
export * from './built/endpoint-manager.js';
|
|
66
|
-
export * from './built/endpoint-lifecycle-service.js';
|
|
67
|
-
export * from './built/schema-endpoint-manager.js';
|
|
68
|
-
export * from './built/endpoint-commands.js';
|
|
69
|
-
export * from './built/introspection-format.js';
|
|
70
|
-
export * from './built/management-command-guard.js';
|
|
71
35
|
export * from './built/html-to-text.js';
|
|
72
36
|
export * from './built/html-segment-fallback.js';
|
|
73
37
|
// ── 外部库 re-export ──────────────────────────────────────────────────
|
|
74
38
|
export * from '@zhin.js/database';
|
|
75
39
|
export * from '@zhin.js/logger';
|
|
76
40
|
export { Schema } from '@zhin.js/schema';
|
|
77
|
-
export {
|
|
41
|
+
export { ScheduleEngine, Scheduler, } from '@zhin.js/kernel';
|
package/lib/message.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MessageElement, MessageSender, SendContent } from "./types.js";
|
|
2
2
|
import { Component } from "./component.js";
|
|
3
|
-
import { Adapters } from "./adapter.js";
|
|
4
3
|
/**
|
|
5
4
|
* 消息组件类型:用于自定义消息结构
|
|
6
5
|
*/
|
|
@@ -35,7 +34,7 @@ export type MessageType = 'group' | 'private' | 'channel';
|
|
|
35
34
|
*/
|
|
36
35
|
export interface MessageBase {
|
|
37
36
|
$id: string;
|
|
38
|
-
$adapter:
|
|
37
|
+
$adapter: string;
|
|
39
38
|
$endpoint: string;
|
|
40
39
|
$content: MessageElement[];
|
|
41
40
|
$sender: MessageSender;
|
package/lib/models/system-log.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: { type: 'integer', autoIncrement: true, primary: true },
|
|
3
|
-
level: { type: 'text', nullable: false },
|
|
4
|
-
name: { type: 'text', nullable: false },
|
|
5
|
-
message: { type: 'text', nullable: false },
|
|
6
|
-
source: { type: 'text', nullable: false },
|
|
7
|
-
timestamp: { type: 'date', nullable: false }
|
|
8
|
-
};
|
|
1
|
+
export {};
|
package/lib/models/user.d.ts
CHANGED
package/lib/models/user.js
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: { type: "text", nullable: false },
|
|
3
|
-
name: { type: 'text', nullable: true },
|
|
4
|
-
password: { type: 'text', nullable: true },
|
|
5
|
-
third_part: { type: 'json', default: [] },
|
|
6
|
-
permissions: { type: 'json', default: [] }
|
|
7
|
-
};
|
|
1
|
+
export {};
|
package/lib/notice.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Adapters } from './adapter.js';
|
|
2
1
|
import type { NoticeKind } from './side-event/types.js';
|
|
3
2
|
import type { SideEventBase } from './side-event/base.js';
|
|
4
3
|
export type { NoticeKind, ComposedNoticeName } from './side-event/types.js';
|
|
@@ -26,7 +25,7 @@ export { composeSideEventName, formatSideEventName, matchesSideEventName, parseS
|
|
|
26
25
|
* ```
|
|
27
26
|
*/
|
|
28
27
|
export interface NoticeBase extends SideEventBase {
|
|
29
|
-
$adapter:
|
|
28
|
+
$adapter: string;
|
|
30
29
|
$type: NoticeKind;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ConversationContextBlock, type ConversationEventReader, type ConversationEventStore, type ConversationReference, type ConversationResolution, type ConversationRef, type DeliveryReceipt } from '@zhin.js/im-contract';
|
|
2
|
+
import type { Notice } from '../../notice.js';
|
|
3
|
+
import type { IncomingMessage, MessageSenderRef, SendRequest } from './contracts.js';
|
|
4
|
+
/** Owns one ImRuntime's conversation fact store, projections, and consumer cursors. */
|
|
5
|
+
export declare class ConversationRuntime {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(events?: ConversationEventStore);
|
|
8
|
+
get reader(): ConversationEventReader;
|
|
9
|
+
replaceStore(events: ConversationEventStore): void;
|
|
10
|
+
resolveLocal(reference: ConversationReference): Promise<ConversationResolution | undefined>;
|
|
11
|
+
readContext(conversation: ConversationRef, consumer: string, throughSequence: number, limit?: number, excludeMessageId?: string): Promise<Readonly<{
|
|
12
|
+
blocks: readonly ConversationContextBlock[];
|
|
13
|
+
cursor: number;
|
|
14
|
+
}>>;
|
|
15
|
+
commitContext(conversation: ConversationRef, consumer: string, cursor: number): Promise<void>;
|
|
16
|
+
recordIncoming(input: IncomingMessage, sender: MessageSenderRef | undefined): Promise<number | undefined>;
|
|
17
|
+
recordOutbound(request: SendRequest, receipt: DeliveryReceipt): Promise<void>;
|
|
18
|
+
recordNotice(notice: Notice): Promise<void>;
|
|
19
|
+
}
|