@quecue/dev-notify 0.1.3 → 0.1.4
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/CHANGELOG.en.md +83 -0
- package/CHANGELOG.md +9 -0
- package/README.en.md +275 -0
- package/README.md +9 -2
- package/SECURITY.en.md +78 -0
- package/SECURITY.md +4 -2
- package/dist/channels.js +12 -11
- package/dist/claude-code.js +30 -30
- package/dist/claude-hook.js +23 -23
- package/dist/cli.js +106 -81
- package/dist/config.js +37 -20
- package/dist/credentials.js +14 -13
- package/dist/formatting.js +6 -4
- package/dist/i18n.js +960 -0
- package/dist/maintenance.js +17 -16
- package/dist/prompts.js +7 -6
- package/dist/reply-bridge.js +11 -10
- package/dist/reply-engine.js +20 -19
- package/dist/reply-hooks.js +21 -20
- package/dist/reply-interactions.js +36 -35
- package/dist/reply-outcomes.js +46 -23
- package/dist/reply-platform.js +14 -13
- package/dist/reply-state.js +31 -30
- package/dist/reply-telegram.js +4 -3
- package/dist/setup.js +69 -51
- package/dist/update.js +23 -22
- package/package.json +4 -1
package/dist/formatting.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// 先解析为独立文本块,再在渲染后的可见文本上分段,不切断 HTML 实体或标签。
|
|
2
|
+
import { t } from './i18n.js';
|
|
1
3
|
export const escapeHtml = (text) => text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
2
4
|
export const partTitle = (title, index, total) => total > 1 ? `${title} (${index + 1}/${total})` : title;
|
|
3
5
|
function inline(text, tags = [], depth = 0) {
|
|
@@ -104,7 +106,7 @@ export function visibleText(blocks) {
|
|
|
104
106
|
}
|
|
105
107
|
function cut(text, budget, measure) {
|
|
106
108
|
if (budget < 1)
|
|
107
|
-
throw new Error('
|
|
109
|
+
throw new Error(t('format.noSpace'));
|
|
108
110
|
let used = 0, end = 0;
|
|
109
111
|
for (const ch of text) {
|
|
110
112
|
const size = measure(ch);
|
|
@@ -114,7 +116,7 @@ function cut(text, budget, measure) {
|
|
|
114
116
|
end += ch.length;
|
|
115
117
|
}
|
|
116
118
|
if (!end && text)
|
|
117
|
-
throw new Error('
|
|
119
|
+
throw new Error(t('format.oneChar'));
|
|
118
120
|
if (end < text.length) {
|
|
119
121
|
for (const boundary of ['\n\n', '\n', ' ']) {
|
|
120
122
|
const offset = text.slice(0, end).lastIndexOf(boundary);
|
|
@@ -128,7 +130,7 @@ function cut(text, budget, measure) {
|
|
|
128
130
|
}
|
|
129
131
|
export function telegramParts(blocks, budget) {
|
|
130
132
|
if (budget < 2)
|
|
131
|
-
throw new Error('
|
|
133
|
+
throw new Error(t('format.telegramHeader'));
|
|
132
134
|
const output = [];
|
|
133
135
|
let html = '', plain = '';
|
|
134
136
|
const flush = () => { if (plain)
|
|
@@ -156,7 +158,7 @@ export function telegramParts(blocks, budget) {
|
|
|
156
158
|
}
|
|
157
159
|
export function feishuParts(blocks, budget) {
|
|
158
160
|
if (budget < 128)
|
|
159
|
-
throw new Error('
|
|
161
|
+
throw new Error(t('format.feishuHeader'));
|
|
160
162
|
const output = [];
|
|
161
163
|
let current = '';
|
|
162
164
|
const size = (text) => Buffer.byteLength(text, 'utf8');
|