@zhin.js/core 1.1.43 → 1.1.45
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.
|
@@ -19,10 +19,6 @@ export declare const STRICT_OUTBOUND_SEGMENT_TYPES: readonly ["text", "mention",
|
|
|
19
19
|
* 严格段镜像 validate.ts,交互段镜像 interactive-segments/types.ts;其他扩展段走宽松分支。
|
|
20
20
|
*/
|
|
21
21
|
export declare const outboundSegmentJsonSchema: JsonSchemaObject;
|
|
22
|
-
/**
|
|
23
|
-
* AI 结构化出站根对象(ADR 0025 JSON DSL 的 schema 形态)。
|
|
24
|
-
* 与 parseAiOutboundJson / ZhinAiOutboundPayload 对齐:text、mentions、segments
|
|
25
|
-
* 均为可选(provider strict 模式兼容性考虑),"至少一项"由 prompt 与下游校验兜底。
|
|
26
|
-
*/
|
|
22
|
+
/** One ordered message, including plain replies. No text/mentions shorthand. */
|
|
27
23
|
export declare const aiOutboundJsonSchema: JsonSchemaObject;
|
|
28
24
|
export {};
|
|
@@ -161,27 +161,48 @@ export const outboundSegmentJsonSchema = {
|
|
|
161
161
|
],
|
|
162
162
|
};
|
|
163
163
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
164
|
+
* Provider-facing subset of the canonical contract. Only required fields are
|
|
165
|
+
* exposed: strict structured-output providers require closed objects with all
|
|
166
|
+
* properties required. Optional presentation/platform fields belong to renderers
|
|
167
|
+
* and tools, not to model-generated replies.
|
|
167
168
|
*/
|
|
169
|
+
function requiredFieldsOnly(schema) {
|
|
170
|
+
if (schema.type === 'object') {
|
|
171
|
+
const required = (schema.required ?? []);
|
|
172
|
+
const properties = schema.properties;
|
|
173
|
+
return {
|
|
174
|
+
type: 'object',
|
|
175
|
+
properties: Object.fromEntries(required.map(key => [key, requiredFieldsOnly(properties[key])])),
|
|
176
|
+
required,
|
|
177
|
+
additionalProperties: false,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
if (typeof schema.const === 'string')
|
|
181
|
+
return { type: 'string', ...schema };
|
|
182
|
+
return schema;
|
|
183
|
+
}
|
|
184
|
+
/** One ordered message, including plain replies. No text/mentions shorthand. */
|
|
168
185
|
export const aiOutboundJsonSchema = {
|
|
169
186
|
type: 'object',
|
|
170
187
|
properties: {
|
|
171
|
-
text: {
|
|
172
|
-
type: 'string',
|
|
173
|
-
description: '纯文本回复正文;与 segments 至少输出一项。使用 mentions 时必填',
|
|
174
|
-
},
|
|
175
|
-
mentions: {
|
|
176
|
-
type: 'array',
|
|
177
|
-
items: { type: 'string' },
|
|
178
|
-
description: '要 @ 的会话成员引用(昵称或 id,由宿主解析为平台账号);需配合 text 使用',
|
|
179
|
-
},
|
|
180
188
|
segments: {
|
|
181
189
|
type: 'array',
|
|
182
|
-
items:
|
|
183
|
-
|
|
190
|
+
items: {
|
|
191
|
+
anyOf: outboundSegmentJsonSchema.anyOf
|
|
192
|
+
.filter(branch => {
|
|
193
|
+
const type = branch.properties.type?.const;
|
|
194
|
+
return type && STRICT_OUTBOUND_SEGMENT_TYPES.includes(type);
|
|
195
|
+
})
|
|
196
|
+
.map(requiredFieldsOnly)
|
|
197
|
+
// Markdown is a renderer extension in the general segment contract;
|
|
198
|
+
// give the model its concrete, closed content shape.
|
|
199
|
+
.concat(requiredFieldsOnly(strictBranch('markdown', dataObject({
|
|
200
|
+
content: { type: 'string', description: 'Markdown source; rendered by the unified outbound pipeline' },
|
|
201
|
+
}, ['content'])))),
|
|
202
|
+
},
|
|
203
|
+
description: 'Ordered canonical message segments. Use an empty array only when no reply is needed.',
|
|
184
204
|
},
|
|
185
205
|
},
|
|
206
|
+
required: ['segments'],
|
|
186
207
|
additionalProperties: false,
|
|
187
208
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45",
|
|
4
4
|
"description": "Zhin机器人核心框架",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -8,57 +8,46 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
|
-
"development": "./src/index.ts",
|
|
12
11
|
"import": "./lib/index.js"
|
|
13
12
|
},
|
|
14
13
|
"./queue-im-field-contract": {
|
|
15
14
|
"types": "./lib/built/queue-im-field-contract.d.ts",
|
|
16
|
-
"development": "./src/built/queue-im-field-contract.ts",
|
|
17
15
|
"import": "./lib/built/queue-im-field-contract.js"
|
|
18
16
|
},
|
|
19
17
|
"./runtime": {
|
|
20
18
|
"types": "./lib/plugin-runtime/im/index.d.ts",
|
|
21
|
-
"development": "./src/plugin-runtime/im/index.ts",
|
|
22
19
|
"import": "./lib/plugin-runtime/im/index.js"
|
|
23
20
|
},
|
|
24
21
|
"./jsx": {
|
|
25
22
|
"types": "./lib/jsx.d.ts",
|
|
26
|
-
"development": "./src/jsx.ts",
|
|
27
23
|
"import": "./lib/jsx.js"
|
|
28
24
|
},
|
|
29
25
|
"./jsx-runtime": {
|
|
30
26
|
"types": "./lib/jsx-runtime.d.ts",
|
|
31
|
-
"development": "./src/jsx-runtime.ts",
|
|
32
27
|
"import": "./lib/jsx-runtime.js"
|
|
33
28
|
},
|
|
34
29
|
"./jsx-dev-runtime": {
|
|
35
30
|
"types": "./lib/jsx-dev-runtime.d.ts",
|
|
36
|
-
"development": "./src/jsx-dev-runtime.ts",
|
|
37
31
|
"import": "./lib/jsx-dev-runtime.js"
|
|
38
32
|
},
|
|
39
33
|
"./feature/adapter": {
|
|
40
34
|
"types": "./lib/feature/adapter.d.ts",
|
|
41
|
-
"development": "./src/feature/adapter.ts",
|
|
42
35
|
"import": "./lib/feature/adapter.js"
|
|
43
36
|
},
|
|
44
37
|
"./feature/command": {
|
|
45
38
|
"types": "./lib/feature/command.d.ts",
|
|
46
|
-
"development": "./src/feature/command.ts",
|
|
47
39
|
"import": "./lib/feature/command.js"
|
|
48
40
|
},
|
|
49
41
|
"./feature/component": {
|
|
50
42
|
"types": "./lib/feature/component.d.ts",
|
|
51
|
-
"development": "./src/feature/component.ts",
|
|
52
43
|
"import": "./lib/feature/component.js"
|
|
53
44
|
},
|
|
54
45
|
"./feature/middleware": {
|
|
55
46
|
"types": "./lib/feature/middleware.d.ts",
|
|
56
|
-
"development": "./src/feature/middleware.ts",
|
|
57
47
|
"import": "./lib/feature/middleware.js"
|
|
58
48
|
},
|
|
59
49
|
"./feature/handler": {
|
|
60
50
|
"types": "./lib/feature/handler.d.ts",
|
|
61
|
-
"development": "./src/feature/handler.ts",
|
|
62
51
|
"import": "./lib/feature/handler.js"
|
|
63
52
|
}
|
|
64
53
|
},
|
|
@@ -68,29 +57,29 @@
|
|
|
68
57
|
"dependencies": {
|
|
69
58
|
"qrcode": "^1.5.4",
|
|
70
59
|
"segment-matcher": "^1.0.5",
|
|
71
|
-
"@zhin.js/adapter": "1.1.
|
|
72
|
-
"@zhin.js/command": "1.1.
|
|
73
|
-
"@zhin.js/
|
|
74
|
-
"@zhin.js/
|
|
75
|
-
"@zhin.js/handler": "1.1.
|
|
76
|
-
"@zhin.js/im-contract": "1.1.
|
|
77
|
-
"@zhin.js/interaction": "1.1.
|
|
78
|
-
"@zhin.js/logger": "1.1.
|
|
79
|
-
"@zhin.js/middleware": "1.1.
|
|
80
|
-
"@zhin.js/
|
|
81
|
-
"@zhin.js/
|
|
82
|
-
"@zhin.js/
|
|
83
|
-
"@zhin.js/
|
|
84
|
-
"@zhin.js/
|
|
85
|
-
"@zhin.js/
|
|
86
|
-
"@zhin.js/jsx": "1.1.
|
|
60
|
+
"@zhin.js/adapter": "1.1.19",
|
|
61
|
+
"@zhin.js/command": "1.1.7",
|
|
62
|
+
"@zhin.js/component": "1.1.6",
|
|
63
|
+
"@zhin.js/database": "1.1.4",
|
|
64
|
+
"@zhin.js/handler": "1.1.5",
|
|
65
|
+
"@zhin.js/im-contract": "1.1.4",
|
|
66
|
+
"@zhin.js/interaction": "1.1.2",
|
|
67
|
+
"@zhin.js/logger": "1.1.2",
|
|
68
|
+
"@zhin.js/middleware": "1.1.6",
|
|
69
|
+
"@zhin.js/kernel": "1.1.4",
|
|
70
|
+
"@zhin.js/plugin-runtime": "1.1.14",
|
|
71
|
+
"@zhin.js/permission": "1.1.6",
|
|
72
|
+
"@zhin.js/schedule-feature": "1.1.5",
|
|
73
|
+
"@zhin.js/schema": "1.1.3",
|
|
74
|
+
"@zhin.js/feature-kit": "1.1.5",
|
|
75
|
+
"@zhin.js/jsx": "1.1.3"
|
|
87
76
|
},
|
|
88
77
|
"devDependencies": {
|
|
89
78
|
"@types/node": "^26.1.2",
|
|
90
79
|
"@types/qrcode": "^1.5.6",
|
|
91
80
|
"ajv": "8.18.0",
|
|
92
81
|
"typescript": "^6.0.3",
|
|
93
|
-
"@zhin.js/ai": "1.1.
|
|
82
|
+
"@zhin.js/ai": "1.1.40"
|
|
94
83
|
},
|
|
95
84
|
"repository": {
|
|
96
85
|
"type": "git",
|
|
@@ -108,7 +97,7 @@
|
|
|
108
97
|
"url": "https://github.com/lc-cn"
|
|
109
98
|
},
|
|
110
99
|
"engines": {
|
|
111
|
-
"node": "
|
|
100
|
+
"node": ">=22.19.0"
|
|
112
101
|
},
|
|
113
102
|
"zhin": {
|
|
114
103
|
"protocol": 1,
|