codeksei 0.1.0 → 0.1.1
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/LICENSE +661 -661
- package/README.en.md +109 -47
- package/README.md +79 -58
- package/bin/cyberboss.js +1 -1
- package/package.json +86 -86
- package/scripts/open_shared_wechat_thread.sh +77 -77
- package/scripts/open_wechat_thread.sh +108 -108
- package/scripts/shared-common.js +144 -144
- package/scripts/shared-open.js +14 -14
- package/scripts/shared-start.js +5 -5
- package/scripts/shared-status.js +27 -27
- package/scripts/show_shared_status.sh +45 -45
- package/scripts/start_shared_app_server.sh +52 -52
- package/scripts/start_shared_wechat.sh +94 -94
- package/scripts/timeline-screenshot.sh +14 -14
- package/src/adapters/channel/weixin/account-store.js +99 -99
- package/src/adapters/channel/weixin/api-v2.js +50 -50
- package/src/adapters/channel/weixin/api.js +169 -169
- package/src/adapters/channel/weixin/context-token-store.js +84 -84
- package/src/adapters/channel/weixin/index.js +618 -604
- package/src/adapters/channel/weixin/legacy.js +579 -566
- package/src/adapters/channel/weixin/media-mime.js +22 -22
- package/src/adapters/channel/weixin/media-receive.js +370 -370
- package/src/adapters/channel/weixin/media-send.js +102 -102
- package/src/adapters/channel/weixin/message-utils-v2.js +282 -282
- package/src/adapters/channel/weixin/message-utils.js +199 -199
- package/src/adapters/channel/weixin/redact.js +41 -41
- package/src/adapters/channel/weixin/reminder-queue-store.js +101 -101
- package/src/adapters/channel/weixin/sync-buffer-store.js +35 -35
- package/src/adapters/runtime/codex/events.js +215 -215
- package/src/adapters/runtime/codex/index.js +109 -104
- package/src/adapters/runtime/codex/message-utils.js +95 -95
- package/src/adapters/runtime/codex/model-catalog.js +106 -106
- package/src/adapters/runtime/codex/protocol-leak-monitor.js +75 -75
- package/src/adapters/runtime/codex/rpc-client.js +339 -339
- package/src/adapters/runtime/codex/session-store.js +286 -286
- package/src/app/channel-send-file-cli.js +57 -57
- package/src/app/diary-write-cli.js +236 -88
- package/src/app/note-sync-cli.js +2 -2
- package/src/app/reminder-write-cli.js +215 -210
- package/src/app/review-cli.js +7 -5
- package/src/app/system-checkin-poller.js +64 -64
- package/src/app/system-send-cli.js +129 -129
- package/src/app/timeline-event-cli.js +28 -25
- package/src/app/timeline-screenshot-cli.js +103 -100
- package/src/core/app.js +1763 -1763
- package/src/core/branding.js +2 -1
- package/src/core/command-registry.js +381 -369
- package/src/core/config.js +30 -14
- package/src/core/default-targets.js +163 -163
- package/src/core/durable-note-schema.js +9 -8
- package/src/core/instructions-template.js +17 -16
- package/src/core/note-sync.js +8 -7
- package/src/core/path-utils.js +54 -0
- package/src/core/project-radar.js +11 -10
- package/src/core/review.js +48 -50
- package/src/core/stream-delivery.js +1162 -983
- package/src/core/system-message-dispatcher.js +68 -68
- package/src/core/system-message-queue-store.js +128 -128
- package/src/core/thread-state-store.js +96 -96
- package/src/core/timeline-screenshot-queue-store.js +134 -134
- package/src/core/timezone.js +436 -0
- package/src/core/workspace-bootstrap.js +9 -1
- package/src/index.js +148 -146
- package/src/integrations/timeline/index.js +130 -74
- package/src/integrations/timeline/state-sync.js +240 -0
- package/templates/weixin-instructions.md +12 -38
- package/templates/weixin-operations.md +29 -31
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
const SUSPICIOUS_PATTERNS = [
|
|
2
|
-
/\b(?:analysis|commentary|final|summary)\s+to=[a-z0-9_.-]+/i,
|
|
3
|
-
/\bto=functions\.[a-z0-9_]+/i,
|
|
4
|
-
/\bfunctions\.[a-z0-9_]+\b/i,
|
|
5
|
-
/\bas_string\s*=\s*(?:true|false)\b/i,
|
|
6
|
-
/\brecipient_name\b/i,
|
|
7
|
-
/\btool_uses\b/i,
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
function sanitizeProtocolLeakText(text) {
|
|
11
|
-
const normalizedText = normalizeLineEndings(text);
|
|
12
|
-
if (!normalizedText) {
|
|
13
|
-
return {
|
|
14
|
-
text: "",
|
|
15
|
-
changed: false,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let cutIndex = -1;
|
|
20
|
-
for (const pattern of SUSPICIOUS_PATTERNS) {
|
|
21
|
-
const match = pattern.exec(normalizedText);
|
|
22
|
-
if (!match || typeof match.index !== "number" || match.index < 0) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (cutIndex === -1 || match.index < cutIndex) {
|
|
26
|
-
cutIndex = match.index;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (cutIndex === -1) {
|
|
31
|
-
return {
|
|
32
|
-
text: normalizedText,
|
|
33
|
-
changed: false,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const safeCutIndex = findSafeProtocolCutIndex(normalizedText, cutIndex);
|
|
38
|
-
const truncated = normalizedText
|
|
39
|
-
.slice(0, safeCutIndex)
|
|
40
|
-
.replace(/\s+$/g, "")
|
|
41
|
-
.replace(/[|·::,,;;、\-–—\s]+$/g, "")
|
|
42
|
-
.trim();
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
text: truncated,
|
|
46
|
-
changed: truncated !== normalizedText,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function normalizeLineEndings(value) {
|
|
51
|
-
return String(value || "").replace(/\r\n/g, "\n");
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function findSafeProtocolCutIndex(text, leakStartIndex) {
|
|
55
|
-
if (!text || leakStartIndex <= 0) {
|
|
56
|
-
return Math.max(0, leakStartIndex);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const prefix = text.slice(0, leakStartIndex);
|
|
60
|
-
let lastBoundary = -1;
|
|
61
|
-
for (let index = prefix.length - 1; index >= 0; index -= 1) {
|
|
62
|
-
const char = prefix[index];
|
|
63
|
-
if (char === "。" || char === "!" || char === "?" || char === "!" || char === "?") {
|
|
64
|
-
lastBoundary = index + 1;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (lastBoundary !== -1) {
|
|
70
|
-
return lastBoundary;
|
|
71
|
-
}
|
|
72
|
-
return leakStartIndex;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
module.exports = { sanitizeProtocolLeakText };
|
|
1
|
+
const SUSPICIOUS_PATTERNS = [
|
|
2
|
+
/\b(?:analysis|commentary|final|summary)\s+to=[a-z0-9_.-]+/i,
|
|
3
|
+
/\bto=functions\.[a-z0-9_]+/i,
|
|
4
|
+
/\bfunctions\.[a-z0-9_]+\b/i,
|
|
5
|
+
/\bas_string\s*=\s*(?:true|false)\b/i,
|
|
6
|
+
/\brecipient_name\b/i,
|
|
7
|
+
/\btool_uses\b/i,
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
function sanitizeProtocolLeakText(text) {
|
|
11
|
+
const normalizedText = normalizeLineEndings(text);
|
|
12
|
+
if (!normalizedText) {
|
|
13
|
+
return {
|
|
14
|
+
text: "",
|
|
15
|
+
changed: false,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let cutIndex = -1;
|
|
20
|
+
for (const pattern of SUSPICIOUS_PATTERNS) {
|
|
21
|
+
const match = pattern.exec(normalizedText);
|
|
22
|
+
if (!match || typeof match.index !== "number" || match.index < 0) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (cutIndex === -1 || match.index < cutIndex) {
|
|
26
|
+
cutIndex = match.index;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (cutIndex === -1) {
|
|
31
|
+
return {
|
|
32
|
+
text: normalizedText,
|
|
33
|
+
changed: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const safeCutIndex = findSafeProtocolCutIndex(normalizedText, cutIndex);
|
|
38
|
+
const truncated = normalizedText
|
|
39
|
+
.slice(0, safeCutIndex)
|
|
40
|
+
.replace(/\s+$/g, "")
|
|
41
|
+
.replace(/[|·::,,;;、\-–—\s]+$/g, "")
|
|
42
|
+
.trim();
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
text: truncated,
|
|
46
|
+
changed: truncated !== normalizedText,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function normalizeLineEndings(value) {
|
|
51
|
+
return String(value || "").replace(/\r\n/g, "\n");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function findSafeProtocolCutIndex(text, leakStartIndex) {
|
|
55
|
+
if (!text || leakStartIndex <= 0) {
|
|
56
|
+
return Math.max(0, leakStartIndex);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const prefix = text.slice(0, leakStartIndex);
|
|
60
|
+
let lastBoundary = -1;
|
|
61
|
+
for (let index = prefix.length - 1; index >= 0; index -= 1) {
|
|
62
|
+
const char = prefix[index];
|
|
63
|
+
if (char === "。" || char === "!" || char === "?" || char === "!" || char === "?") {
|
|
64
|
+
lastBoundary = index + 1;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (lastBoundary !== -1) {
|
|
70
|
+
return lastBoundary;
|
|
71
|
+
}
|
|
72
|
+
return leakStartIndex;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = { sanitizeProtocolLeakText };
|