@zhin.js/core 1.1.55 → 1.1.57
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/lib/built/generic-segment-mapper.js +2 -0
- package/lib/built/html-to-text.js +2 -2
- package/lib/built/rich-segments/markdown-to-text.js +19 -0
- package/lib/built/segment-contract/validate.d.ts +1442 -300
- package/lib/built/user-interaction.js +3 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -0
- package/lib/plugin-runtime/im/command-menu-navigation.d.ts +1 -1
- package/lib/plugin-runtime/im/command-menu-navigation.js +2 -1
- package/lib/plugin-runtime/im/contracts.d.ts +8 -1
- package/lib/plugin-runtime/im/contracts.js +20 -1
- package/lib/plugin-runtime/im/conversation-runtime.d.ts +2 -2
- package/lib/plugin-runtime/im/conversation-runtime.js +6 -4
- package/lib/plugin-runtime/im/im-runtime.js +8 -1
- package/lib/plugin-runtime/im/inbound-dedup.d.ts +1 -0
- package/lib/plugin-runtime/im/inbound-dedup.js +1 -0
- package/lib/plugin-runtime/im/inbound-origin.d.ts +27 -0
- package/lib/plugin-runtime/im/inbound-runtime.d.ts +8 -1
- package/lib/plugin-runtime/im/inbound-runtime.js +79 -2
- package/lib/plugin-runtime/im/index.d.ts +2 -0
- package/lib/plugin-runtime/im/index.js +2 -0
- package/lib/plugin-runtime/im/interaction-runtime.d.ts +7 -6
- package/lib/plugin-runtime/im/interaction-runtime.js +85 -24
- package/lib/plugin-runtime/im/interactive-router.d.ts +28 -8
- package/lib/plugin-runtime/im/interactive-router.js +112 -35
- package/lib/plugin-runtime/im/jsx-button-registry.d.ts +16 -2
- package/lib/plugin-runtime/im/jsx-button-registry.js +56 -19
- package/lib/plugin-runtime/im/message-dispatcher.js +59 -6
- package/lib/plugin-runtime/im/operation-resources.d.ts +15 -0
- package/lib/plugin-runtime/im/operation-resources.js +2 -0
- package/lib/plugin-runtime/im/outbound-delivery-runtime.d.ts +5 -4
- package/lib/plugin-runtime/im/outbound-delivery-runtime.js +71 -21
- package/lib/plugin-runtime/im/outbound-segments.d.ts +1 -1
- package/lib/plugin-runtime/im/outbound-segments.js +2 -20
- package/lib/runtime.d.ts +2 -0
- package/lib/runtime.js +2 -0
- package/lib/side-event/index.d.ts +0 -1
- package/lib/side-event/index.js +0 -1
- package/lib/side-event/normalize.d.ts +0 -28
- package/lib/side-event/normalize.js +0 -100
- package/lib/side-event/scene-events.js +1 -1
- package/lib/side-event/types.d.ts +0 -6
- package/lib/side-event/types.js +1 -57
- package/lib/venue/contracts.d.ts +21 -0
- package/lib/venue/contracts.js +3 -0
- package/lib/venue/floor-controller.d.ts +11 -0
- package/lib/venue/floor-controller.js +63 -0
- package/lib/venue/index.d.ts +13 -0
- package/lib/venue/index.js +11 -0
- package/lib/venue/membership-port.d.ts +23 -0
- package/lib/venue/membership-port.js +141 -0
- package/lib/venue/projector.d.ts +38 -0
- package/lib/venue/projector.js +45 -0
- package/lib/venue/registry.d.ts +16 -0
- package/lib/venue/registry.js +63 -0
- package/lib/venue/router.d.ts +19 -0
- package/lib/venue/router.js +101 -0
- package/lib/venue/send-limiter.d.ts +17 -0
- package/lib/venue/send-limiter.js +73 -0
- package/lib/venue/validator.d.ts +6 -0
- package/lib/venue/validator.js +160 -0
- package/package.json +16 -16
- package/lib/side-event/dispatch.d.ts +0 -15
- package/lib/side-event/dispatch.js +0 -168
|
@@ -162,6 +162,8 @@ function normalizeMarkdown(seg) {
|
|
|
162
162
|
function normalizeSegment(seg) {
|
|
163
163
|
if (seg.type === 'at' || seg.type === 'mention')
|
|
164
164
|
return normalizeMention(seg);
|
|
165
|
+
if (seg.type === 'record' || seg.type === 'voice')
|
|
166
|
+
return normalizeMedia({ ...seg, type: 'audio' });
|
|
165
167
|
if (MEDIA_SEGMENT_TYPES.has(seg.type))
|
|
166
168
|
return normalizeMedia(seg);
|
|
167
169
|
if (seg.type === 'reply')
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { readableLinkTarget, decodeReadableEntities as decodeCommonEntities } from './readable-link.js';
|
|
5
5
|
const DEFAULT_MAX_INPUT = 2 * 1024 * 1024;
|
|
6
|
-
const BLOCK_TAGS = ['script', 'style', 'svg', 'nav', '
|
|
6
|
+
const BLOCK_TAGS = ['script', 'style', 'svg', 'nav', 'form'];
|
|
7
7
|
function findTagClose(html, from) {
|
|
8
8
|
const gt = html.indexOf('>', from);
|
|
9
9
|
return gt === -1 ? -1 : gt + 1;
|
|
@@ -213,7 +213,7 @@ export function htmlToFallbackText(html, options) {
|
|
|
213
213
|
out.push('\n');
|
|
214
214
|
else if (/^h[1-6]$/u.test(tag))
|
|
215
215
|
out.push(closing ? '\n\n' : `\n${'#'.repeat(Number(tag[1]))} `);
|
|
216
|
-
else if (['p', 'div', 'section', 'article', 'table', 'blockquote'].includes(tag)) {
|
|
216
|
+
else if (['p', 'div', 'section', 'article', 'table', 'blockquote', 'header', 'footer'].includes(tag)) {
|
|
217
217
|
if (closing)
|
|
218
218
|
out.push(tag === 'p' ? '\n\n' : '\n');
|
|
219
219
|
}
|
|
@@ -113,6 +113,7 @@ export function markdownToPlainText(md) {
|
|
|
113
113
|
if (fence)
|
|
114
114
|
text += `${text ? '\n' : ''}${stash(fence.code.join('\n'))}`;
|
|
115
115
|
text = readableLinks(decodeReadableEntities(text), stash);
|
|
116
|
+
text = formatMarkdownTables(text);
|
|
116
117
|
text = text.replace(/^#{1,6}\s+/gm, '');
|
|
117
118
|
text = text.replace(/^[ \t]*>[ \t]?/gm, '');
|
|
118
119
|
text = text.replace(/^([ \t]*)[-*+][ \t]+/gm, '$1• ');
|
|
@@ -137,3 +138,21 @@ export function markdownToHtmlForRender(md) {
|
|
|
137
138
|
.replace(/>/g, '>');
|
|
138
139
|
return `<pre style="white-space:pre-wrap;font-family:sans-serif;font-size:14px;line-height:1.5;padding:16px;">${escaped}</pre>`;
|
|
139
140
|
}
|
|
141
|
+
function formatMarkdownTables(text) {
|
|
142
|
+
if (!text.includes('|'))
|
|
143
|
+
return text;
|
|
144
|
+
const out = [];
|
|
145
|
+
for (const line of text.split('\n')) {
|
|
146
|
+
const trimmed = line.trim();
|
|
147
|
+
if (trimmed.length > 1 && trimmed.startsWith('|') && trimmed.endsWith('|')) {
|
|
148
|
+
const cells = trimmed.slice(1, -1).split('|').map(cell => cell.trim());
|
|
149
|
+
if (cells.length > 0 && cells.every(cell => /^:?-{2,}:?$/u.test(cell))) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
out.push(cells.join(' | '));
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
out.push(line);
|
|
156
|
+
}
|
|
157
|
+
return out.join('\n');
|
|
158
|
+
}
|