codeksei 0.1.0
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 -0
- package/README.en.md +215 -0
- package/README.md +259 -0
- package/bin/codeksei.js +10 -0
- package/bin/cyberboss.js +11 -0
- package/package.json +86 -0
- package/scripts/install-background-tasks.ps1 +135 -0
- package/scripts/open_shared_wechat_thread.sh +94 -0
- package/scripts/open_wechat_thread.sh +117 -0
- package/scripts/shared-common.js +791 -0
- package/scripts/shared-open.js +46 -0
- package/scripts/shared-start.js +41 -0
- package/scripts/shared-status.js +74 -0
- package/scripts/shared-supervisor.js +141 -0
- package/scripts/shared-task-runner.ps1 +87 -0
- package/scripts/shared-watchdog.js +290 -0
- package/scripts/show_shared_status.sh +53 -0
- package/scripts/start_shared_app_server.sh +65 -0
- package/scripts/start_shared_wechat.sh +108 -0
- package/scripts/timeline-screenshot.sh +15 -0
- package/scripts/uninstall-background-tasks.ps1 +23 -0
- package/src/adapters/channel/weixin/account-store.js +135 -0
- package/src/adapters/channel/weixin/api-v2.js +258 -0
- package/src/adapters/channel/weixin/api.js +180 -0
- package/src/adapters/channel/weixin/context-token-store.js +84 -0
- package/src/adapters/channel/weixin/index.js +605 -0
- package/src/adapters/channel/weixin/legacy.js +567 -0
- package/src/adapters/channel/weixin/login-common.js +63 -0
- package/src/adapters/channel/weixin/login-legacy.js +124 -0
- package/src/adapters/channel/weixin/login-v2.js +186 -0
- package/src/adapters/channel/weixin/media-mime.js +22 -0
- package/src/adapters/channel/weixin/media-receive.js +370 -0
- package/src/adapters/channel/weixin/media-send.js +331 -0
- package/src/adapters/channel/weixin/message-utils-v2.js +282 -0
- package/src/adapters/channel/weixin/message-utils.js +199 -0
- package/src/adapters/channel/weixin/protocol.js +77 -0
- package/src/adapters/channel/weixin/redact.js +41 -0
- package/src/adapters/channel/weixin/reminder-queue-store.js +101 -0
- package/src/adapters/channel/weixin/sync-buffer-store.js +35 -0
- package/src/adapters/runtime/codex/events.js +252 -0
- package/src/adapters/runtime/codex/index.js +502 -0
- package/src/adapters/runtime/codex/message-utils.js +141 -0
- package/src/adapters/runtime/codex/model-catalog.js +106 -0
- package/src/adapters/runtime/codex/protocol-leak-monitor.js +75 -0
- package/src/adapters/runtime/codex/rpc-client.js +443 -0
- package/src/adapters/runtime/codex/session-store.js +376 -0
- package/src/app/channel-send-file-cli.js +57 -0
- package/src/app/diary-write-cli.js +620 -0
- package/src/app/note-auto-cli.js +201 -0
- package/src/app/note-sync-cli.js +130 -0
- package/src/app/project-radar-cli.js +165 -0
- package/src/app/reminder-write-cli.js +210 -0
- package/src/app/review-cli.js +134 -0
- package/src/app/system-checkin-poller.js +100 -0
- package/src/app/system-send-cli.js +129 -0
- package/src/app/timeline-event-cli.js +273 -0
- package/src/app/timeline-screenshot-cli.js +109 -0
- package/src/core/app.js +1810 -0
- package/src/core/branding.js +167 -0
- package/src/core/command-registry.js +609 -0
- package/src/core/config.js +84 -0
- package/src/core/default-targets.js +163 -0
- package/src/core/durable-note-schema.js +325 -0
- package/src/core/instructions-template.js +31 -0
- package/src/core/note-sync.js +433 -0
- package/src/core/project-radar.js +402 -0
- package/src/core/review-semantic.js +524 -0
- package/src/core/review.js +1081 -0
- package/src/core/shared-bridge-heartbeat.js +140 -0
- package/src/core/stream-delivery.js +990 -0
- package/src/core/system-message-dispatcher.js +68 -0
- package/src/core/system-message-queue-store.js +128 -0
- package/src/core/thread-state-store.js +135 -0
- package/src/core/timeline-screenshot-queue-store.js +134 -0
- package/src/core/workspace-alias.js +163 -0
- package/src/core/workspace-bootstrap.js +338 -0
- package/src/index.js +270 -0
- package/src/integrations/timeline/index.js +191 -0
- package/templates/weixin-instructions.md +53 -0
- package/templates/weixin-operations.md +69 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const crypto = require("crypto");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const { resolveSelectedAccount } = require("../adapters/channel/weixin/account-store");
|
|
5
|
+
const { SessionStore } = require("../adapters/runtime/codex/session-store");
|
|
6
|
+
const { resolvePreferredSenderId } = require("../core/default-targets");
|
|
7
|
+
const { TimelineScreenshotQueueStore } = require("../core/timeline-screenshot-queue-store");
|
|
8
|
+
|
|
9
|
+
async function runTimelineScreenshotCommand(config, args = process.argv.slice(4)) {
|
|
10
|
+
const options = parseTimelineScreenshotArgs(args);
|
|
11
|
+
if (options.help) {
|
|
12
|
+
printTimelineScreenshotHelp();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const account = resolveSelectedAccount(config);
|
|
17
|
+
const sessionStore = new SessionStore({ filePath: config.sessionsFile });
|
|
18
|
+
const senderId = resolvePreferredSenderId({
|
|
19
|
+
config,
|
|
20
|
+
accountId: account.accountId,
|
|
21
|
+
explicitUser: options.user,
|
|
22
|
+
sessionStore,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (!senderId) {
|
|
26
|
+
throw new Error("缺少发送目标,传 --user 或配置 CODEKSEI_ALLOWED_USER_IDS(或旧的 CYBERBOSS_ALLOWED_USER_IDS)");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const queue = new TimelineScreenshotQueueStore({ filePath: config.timelineScreenshotQueueFile });
|
|
30
|
+
const queued = queue.enqueue({
|
|
31
|
+
id: crypto.randomUUID(),
|
|
32
|
+
accountId: account.accountId,
|
|
33
|
+
senderId,
|
|
34
|
+
outputFile: options.outputFile,
|
|
35
|
+
args: options.forwardArgs,
|
|
36
|
+
createdAt: new Date().toISOString(),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
console.log(`timeline screenshot queued: ${queued.id}`);
|
|
40
|
+
console.log("delivery_status: pending_bridge_send");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function parseTimelineScreenshotArgs(args) {
|
|
44
|
+
const options = {
|
|
45
|
+
help: false,
|
|
46
|
+
user: "",
|
|
47
|
+
outputFile: "",
|
|
48
|
+
forwardArgs: [],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
52
|
+
const token = String(args[index] || "").trim();
|
|
53
|
+
if (!token) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (token === "--help" || token === "-h") {
|
|
57
|
+
options.help = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (token === "--send") {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (token === "--user") {
|
|
64
|
+
const value = String(args[index + 1] || "").trim();
|
|
65
|
+
if (!value || value.startsWith("--")) {
|
|
66
|
+
throw new Error("参数缺少值: --user");
|
|
67
|
+
}
|
|
68
|
+
options.user = value;
|
|
69
|
+
index += 1;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (token === "--output") {
|
|
73
|
+
const value = String(args[index + 1] || "").trim();
|
|
74
|
+
if (!value || value.startsWith("--")) {
|
|
75
|
+
throw new Error("参数缺少值: --output");
|
|
76
|
+
}
|
|
77
|
+
options.outputFile = path.resolve(value);
|
|
78
|
+
index += 1;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
options.forwardArgs.push(token);
|
|
83
|
+
const next = String(args[index + 1] || "").trim();
|
|
84
|
+
if (token.startsWith("--") && next && !next.startsWith("--")) {
|
|
85
|
+
options.forwardArgs.push(next);
|
|
86
|
+
index += 1;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return options;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function printTimelineScreenshotHelp() {
|
|
94
|
+
console.log(`
|
|
95
|
+
用法: npm run timeline:screenshot -- --send [--user <wechatUserId>] [--output /绝对路径] [其他 timeline screenshot 参数]
|
|
96
|
+
|
|
97
|
+
说明:
|
|
98
|
+
这条命令只负责把截图任务排进本地队列,真正截图和发送由正在运行的微信 bridge 异步执行。
|
|
99
|
+
queued 不等于“已经发到微信”;只有 bridge 真正送达后,用户那边才会看到图片或文件。
|
|
100
|
+
|
|
101
|
+
示例:
|
|
102
|
+
npm run timeline:screenshot -- --send --selector timeline
|
|
103
|
+
`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = {
|
|
107
|
+
runTimelineScreenshotCommand,
|
|
108
|
+
parseTimelineScreenshotArgs,
|
|
109
|
+
};
|