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.
Files changed (68) hide show
  1. package/LICENSE +661 -661
  2. package/README.en.md +109 -47
  3. package/README.md +79 -58
  4. package/bin/cyberboss.js +1 -1
  5. package/package.json +86 -86
  6. package/scripts/open_shared_wechat_thread.sh +77 -77
  7. package/scripts/open_wechat_thread.sh +108 -108
  8. package/scripts/shared-common.js +144 -144
  9. package/scripts/shared-open.js +14 -14
  10. package/scripts/shared-start.js +5 -5
  11. package/scripts/shared-status.js +27 -27
  12. package/scripts/show_shared_status.sh +45 -45
  13. package/scripts/start_shared_app_server.sh +52 -52
  14. package/scripts/start_shared_wechat.sh +94 -94
  15. package/scripts/timeline-screenshot.sh +14 -14
  16. package/src/adapters/channel/weixin/account-store.js +99 -99
  17. package/src/adapters/channel/weixin/api-v2.js +50 -50
  18. package/src/adapters/channel/weixin/api.js +169 -169
  19. package/src/adapters/channel/weixin/context-token-store.js +84 -84
  20. package/src/adapters/channel/weixin/index.js +618 -604
  21. package/src/adapters/channel/weixin/legacy.js +579 -566
  22. package/src/adapters/channel/weixin/media-mime.js +22 -22
  23. package/src/adapters/channel/weixin/media-receive.js +370 -370
  24. package/src/adapters/channel/weixin/media-send.js +102 -102
  25. package/src/adapters/channel/weixin/message-utils-v2.js +282 -282
  26. package/src/adapters/channel/weixin/message-utils.js +199 -199
  27. package/src/adapters/channel/weixin/redact.js +41 -41
  28. package/src/adapters/channel/weixin/reminder-queue-store.js +101 -101
  29. package/src/adapters/channel/weixin/sync-buffer-store.js +35 -35
  30. package/src/adapters/runtime/codex/events.js +215 -215
  31. package/src/adapters/runtime/codex/index.js +109 -104
  32. package/src/adapters/runtime/codex/message-utils.js +95 -95
  33. package/src/adapters/runtime/codex/model-catalog.js +106 -106
  34. package/src/adapters/runtime/codex/protocol-leak-monitor.js +75 -75
  35. package/src/adapters/runtime/codex/rpc-client.js +339 -339
  36. package/src/adapters/runtime/codex/session-store.js +286 -286
  37. package/src/app/channel-send-file-cli.js +57 -57
  38. package/src/app/diary-write-cli.js +236 -88
  39. package/src/app/note-sync-cli.js +2 -2
  40. package/src/app/reminder-write-cli.js +215 -210
  41. package/src/app/review-cli.js +7 -5
  42. package/src/app/system-checkin-poller.js +64 -64
  43. package/src/app/system-send-cli.js +129 -129
  44. package/src/app/timeline-event-cli.js +28 -25
  45. package/src/app/timeline-screenshot-cli.js +103 -100
  46. package/src/core/app.js +1763 -1763
  47. package/src/core/branding.js +2 -1
  48. package/src/core/command-registry.js +381 -369
  49. package/src/core/config.js +30 -14
  50. package/src/core/default-targets.js +163 -163
  51. package/src/core/durable-note-schema.js +9 -8
  52. package/src/core/instructions-template.js +17 -16
  53. package/src/core/note-sync.js +8 -7
  54. package/src/core/path-utils.js +54 -0
  55. package/src/core/project-radar.js +11 -10
  56. package/src/core/review.js +48 -50
  57. package/src/core/stream-delivery.js +1162 -983
  58. package/src/core/system-message-dispatcher.js +68 -68
  59. package/src/core/system-message-queue-store.js +128 -128
  60. package/src/core/thread-state-store.js +96 -96
  61. package/src/core/timeline-screenshot-queue-store.js +134 -134
  62. package/src/core/timezone.js +436 -0
  63. package/src/core/workspace-bootstrap.js +9 -1
  64. package/src/index.js +148 -146
  65. package/src/integrations/timeline/index.js +130 -74
  66. package/src/integrations/timeline/state-sync.js +240 -0
  67. package/templates/weixin-instructions.md +12 -38
  68. 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 };