@zhin.js/core 1.1.45 → 1.1.46
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 +6 -0
- package/lib/built/html-to-text.d.ts +0 -3
- package/lib/built/html-to-text.js +130 -39
- package/lib/built/interactive-segments/resolve.d.ts +2 -2
- package/lib/built/interactive-segments/resolve.js +20 -12
- package/lib/built/readable-link.d.ts +4 -0
- package/lib/built/readable-link.js +32 -0
- package/lib/built/rich-segments/markdown-to-text.d.ts +1 -1
- package/lib/built/rich-segments/markdown-to-text.js +123 -11
- package/lib/built/user-interaction.d.ts +1 -1
- package/lib/built/user-interaction.js +4 -5
- package/lib/plugin-runtime/im/command-menu-navigation.d.ts +6 -0
- package/lib/plugin-runtime/im/command-menu-navigation.js +33 -0
- package/lib/plugin-runtime/im/contracts.d.ts +12 -2
- package/lib/plugin-runtime/im/contracts.js +24 -2
- package/lib/plugin-runtime/im/im-runtime.d.ts +2 -0
- package/lib/plugin-runtime/im/im-runtime.js +24 -4
- package/lib/plugin-runtime/im/inbound-runtime.d.ts +5 -0
- package/lib/plugin-runtime/im/inbound-runtime.js +193 -135
- package/lib/plugin-runtime/im/index.d.ts +1 -0
- package/lib/plugin-runtime/im/interaction-operation.d.ts +8 -0
- package/lib/plugin-runtime/im/interaction-operation.js +2 -0
- package/lib/plugin-runtime/im/interaction-runtime.d.ts +5 -3
- package/lib/plugin-runtime/im/interaction-runtime.js +150 -51
- package/lib/plugin-runtime/im/message-diagnostics.d.ts +70 -0
- package/lib/plugin-runtime/im/message-diagnostics.js +182 -0
- package/lib/plugin-runtime/im/message-dispatcher.d.ts +1 -1
- package/lib/plugin-runtime/im/message-dispatcher.js +31 -4
- package/lib/plugin-runtime/im/outbound-delivery-runtime.d.ts +2 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.js +7 -0
- package/lib/plugin-runtime/im/outbound-segments.js +4 -3
- package/package.json +13 -13
|
@@ -19,6 +19,12 @@ export class OutboundDeliveryRuntime {
|
|
|
19
19
|
this.#renderer = renderer;
|
|
20
20
|
}
|
|
21
21
|
async deliver(request, snapshot) {
|
|
22
|
+
let rendering;
|
|
23
|
+
const receipt = await this.#deliver(request, snapshot, value => { rendering = value; });
|
|
24
|
+
this.context.diagnostics?.delivery(snapshot.generation, request.conversation, receipt, rendering);
|
|
25
|
+
return receipt;
|
|
26
|
+
}
|
|
27
|
+
async #deliver(request, snapshot, observeRendering) {
|
|
22
28
|
const adapter = request.conversation.endpoint.id;
|
|
23
29
|
const jsxCache = new WeakMap();
|
|
24
30
|
const buttons = this.context.prepareButtons?.(request, snapshot);
|
|
@@ -80,6 +86,7 @@ export class OutboundDeliveryRuntime {
|
|
|
80
86
|
},
|
|
81
87
|
});
|
|
82
88
|
payload = projection.payload;
|
|
89
|
+
observeRendering(projection.rendering);
|
|
83
90
|
for (const value of collectButtonPayloads(payload))
|
|
84
91
|
buttonPayloads.add(value);
|
|
85
92
|
}
|
|
@@ -124,9 +124,10 @@ export function applyOutboundInteractivePolicy(payload, policy, remember) {
|
|
|
124
124
|
if (!isKeyboardSegment(item))
|
|
125
125
|
return item;
|
|
126
126
|
const data = item.data;
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
127
|
+
const remembered = remember?.(effectiveKeyboardFallbackMap(data));
|
|
128
|
+
const map = remembered && typeof remembered === 'object' && !Array.isArray(remembered) ? remembered : undefined;
|
|
129
|
+
const projected = map ? { ...data, fallback: { hint: data.fallback?.hint ?? '', map } } : data;
|
|
130
|
+
return { type: 'text', data: { text: renderKeyboardAsText(projected, map) } };
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
/** 多 endpoint 展开的 record id(`slot.id~entry`)→ slot id(entry 名禁含 `~`,见 adapter-index)。 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.46",
|
|
4
4
|
"description": "Zhin机器人核心框架",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -57,29 +57,29 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"qrcode": "^1.5.4",
|
|
59
59
|
"segment-matcher": "^1.0.5",
|
|
60
|
-
"@zhin.js/
|
|
61
|
-
"@zhin.js/command": "1.1.
|
|
62
|
-
"@zhin.js/component": "1.1.6",
|
|
60
|
+
"@zhin.js/component": "1.1.7",
|
|
61
|
+
"@zhin.js/command": "1.1.8",
|
|
63
62
|
"@zhin.js/database": "1.1.4",
|
|
64
|
-
"@zhin.js/handler": "1.1.
|
|
63
|
+
"@zhin.js/handler": "1.1.6",
|
|
64
|
+
"@zhin.js/adapter": "1.1.20",
|
|
65
65
|
"@zhin.js/im-contract": "1.1.4",
|
|
66
66
|
"@zhin.js/interaction": "1.1.2",
|
|
67
|
-
"@zhin.js/logger": "1.1.2",
|
|
68
|
-
"@zhin.js/middleware": "1.1.6",
|
|
69
67
|
"@zhin.js/kernel": "1.1.4",
|
|
70
|
-
"@zhin.js/
|
|
71
|
-
"@zhin.js/
|
|
72
|
-
"@zhin.js/
|
|
68
|
+
"@zhin.js/logger": "1.1.2",
|
|
69
|
+
"@zhin.js/middleware": "1.1.7",
|
|
70
|
+
"@zhin.js/permission": "1.1.7",
|
|
71
|
+
"@zhin.js/plugin-runtime": "1.1.15",
|
|
72
|
+
"@zhin.js/schedule-feature": "1.1.6",
|
|
73
73
|
"@zhin.js/schema": "1.1.3",
|
|
74
|
-
"@zhin.js/
|
|
75
|
-
"@zhin.js/
|
|
74
|
+
"@zhin.js/jsx": "1.1.3",
|
|
75
|
+
"@zhin.js/feature-kit": "1.1.6"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/node": "^26.1.2",
|
|
79
79
|
"@types/qrcode": "^1.5.6",
|
|
80
80
|
"ajv": "8.18.0",
|
|
81
81
|
"typescript": "^6.0.3",
|
|
82
|
-
"@zhin.js/ai": "1.1.
|
|
82
|
+
"@zhin.js/ai": "1.1.41"
|
|
83
83
|
},
|
|
84
84
|
"repository": {
|
|
85
85
|
"type": "git",
|