@web-auto/webauto 0.1.8 → 0.1.9
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/apps/desktop-console/dist/main/index.mjs +800 -89
- package/apps/desktop-console/dist/main/preload.mjs +3 -0
- package/apps/desktop-console/dist/renderer/index.html +9 -1
- package/apps/desktop-console/dist/renderer/index.js +784 -331
- package/apps/desktop-console/entry/ui-cli.mjs +23 -8
- package/apps/desktop-console/entry/ui-console.mjs +8 -3
- package/apps/webauto/entry/account.mjs +69 -8
- package/apps/webauto/entry/lib/account-detect.mjs +106 -25
- package/apps/webauto/entry/lib/account-store.mjs +121 -22
- package/apps/webauto/entry/lib/schedule-store.mjs +0 -12
- package/apps/webauto/entry/profilepool.mjs +45 -3
- package/apps/webauto/entry/schedule.mjs +44 -2
- package/apps/webauto/entry/weibo-unified.mjs +2 -2
- package/apps/webauto/entry/xhs-install.mjs +220 -51
- package/apps/webauto/entry/xhs-unified.mjs +33 -6
- package/bin/webauto.mjs +80 -4
- package/dist/modules/camo-runtime/src/utils/browser-service.mjs +4 -0
- package/dist/services/unified-api/server.js +5 -0
- package/dist/services/unified-api/task-state.js +2 -0
- package/modules/camo-runtime/src/autoscript/action-providers/xhs/interaction.mjs +142 -14
- package/modules/camo-runtime/src/autoscript/action-providers/xhs/search.mjs +16 -1
- package/modules/camo-runtime/src/autoscript/action-providers/xhs.mjs +104 -0
- package/modules/camo-runtime/src/autoscript/runtime.mjs +14 -4
- package/modules/camo-runtime/src/autoscript/schema.mjs +9 -0
- package/modules/camo-runtime/src/autoscript/xhs-unified-template.mjs +9 -2
- package/modules/camo-runtime/src/container/runtime-core/checkpoint.mjs +107 -1
- package/modules/camo-runtime/src/container/runtime-core/subscription.mjs +24 -2
- package/modules/camo-runtime/src/utils/browser-service.mjs +4 -0
- package/package.json +6 -3
- package/scripts/bump-version.mjs +120 -0
- package/services/unified-api/server.ts +4 -0
- package/services/unified-api/task-state.ts +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@web-auto/webauto",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"webauto": "bin/webauto.mjs"
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"check:modules": "echo \"Module checks skipped\"",
|
|
60
60
|
"check:ts": "tsc --noEmit -p tsconfig.services.json",
|
|
61
61
|
"test:modules:unit": "npx tsx --test $(find modules -name \"*.test.ts\" -o -name \"*.test.mts\" 2>/dev/null | tr \"\\n\" \" \")",
|
|
62
|
-
"test:desktop-console:unit": "tsx --test apps/desktop-console/src/main/profile-store.test.mts apps/desktop-console/src/main/index-streaming.test.mts apps/desktop-console/src/main/ui-cli-bridge.test.mts apps/desktop-console/src/main/heartbeat-watchdog.test.mts apps/desktop-console/src/main/core-daemon-manager.test.mts apps/desktop-console/src/main/desktop-settings.test.mts apps/desktop-console/src/main/env-check.test.mts",
|
|
62
|
+
"test:desktop-console:unit": "tsx --test apps/desktop-console/src/main/profile-store.test.mts apps/desktop-console/src/main/index-streaming.test.mts apps/desktop-console/src/main/ui-cli-bridge.test.mts apps/desktop-console/src/main/task-gateway.test.mts apps/desktop-console/src/main/heartbeat-watchdog.test.mts apps/desktop-console/src/main/core-daemon-manager.test.mts apps/desktop-console/src/main/desktop-settings.test.mts apps/desktop-console/src/main/env-check.test.mts",
|
|
63
63
|
"test:desktop-console:renderer": "npm --prefix apps/desktop-console run test:renderer",
|
|
64
|
-
"test:desktop-console:coverage": "c8 --reporter=text --reporter=lcov --all --src apps/desktop-console/src/main --extension .mts --extension .mjs --extension .ts --exclude \"**/*.test.*\" --check-coverage --lines 75 --functions 75 --branches 55 --statements 75 --include \"apps/desktop-console/src/main/profile-store.mts\" --include \"apps/desktop-console/src/main/ui-cli-bridge.mts\" --include \"apps/desktop-console/src/main/heartbeat-watchdog.mts\" --include \"apps/desktop-console/src/main/core-daemon-manager.mts\" --include \"apps/desktop-console/src/main/desktop-settings.mts\" --include \"apps/desktop-console/src/main/env-check.mts\" tsx --test apps/desktop-console/src/main/profile-store.test.mts apps/desktop-console/src/main/index-streaming.test.mts apps/desktop-console/src/main/ui-cli-bridge.test.mts apps/desktop-console/src/main/heartbeat-watchdog.test.mts apps/desktop-console/src/main/core-daemon-manager.test.mts apps/desktop-console/src/main/desktop-settings.test.mts apps/desktop-console/src/main/env-check.test.mts",
|
|
64
|
+
"test:desktop-console:coverage": "c8 --reporter=text --reporter=lcov --all --src apps/desktop-console/src/main --extension .mts --extension .mjs --extension .ts --exclude \"**/*.test.*\" --check-coverage --lines 75 --functions 75 --branches 55 --statements 75 --include \"apps/desktop-console/src/main/profile-store.mts\" --include \"apps/desktop-console/src/main/ui-cli-bridge.mts\" --include \"apps/desktop-console/src/main/task-gateway.mts\" --include \"apps/desktop-console/src/main/heartbeat-watchdog.mts\" --include \"apps/desktop-console/src/main/core-daemon-manager.mts\" --include \"apps/desktop-console/src/main/desktop-settings.mts\" --include \"apps/desktop-console/src/main/env-check.mts\" tsx --test apps/desktop-console/src/main/profile-store.test.mts apps/desktop-console/src/main/index-streaming.test.mts apps/desktop-console/src/main/ui-cli-bridge.test.mts apps/desktop-console/src/main/task-gateway.test.mts apps/desktop-console/src/main/heartbeat-watchdog.test.mts apps/desktop-console/src/main/core-daemon-manager.test.mts apps/desktop-console/src/main/desktop-settings.test.mts apps/desktop-console/src/main/env-check.test.mts",
|
|
65
65
|
"test:webauto:schedule:unit": "node --test tests/unit/webauto/schedule-store.test.mjs tests/unit/webauto/schedule-cli.test.mjs",
|
|
66
66
|
"test:webauto:ui-cli:unit": "node --test tests/unit/webauto/ui-cli-command.test.mjs",
|
|
67
67
|
"test:webauto:install:unit": "node --test tests/unit/webauto/xhs-install.test.mjs",
|
|
@@ -69,6 +69,9 @@
|
|
|
69
69
|
"test:ci": "npm test && npm --prefix apps/desktop-console run test:renderer",
|
|
70
70
|
"coverage:ci": "node scripts/test/run-coverage.mjs",
|
|
71
71
|
"build:release": "node bin/webauto.mjs build:release",
|
|
72
|
+
"version:bump": "node scripts/bump-version.mjs patch",
|
|
73
|
+
"version:bump:minor": "node scripts/bump-version.mjs minor",
|
|
74
|
+
"version:bump:major": "node scripts/bump-version.mjs major",
|
|
72
75
|
"test": "npm run check:modules && npm run check:ts && npm run test:modules:unit && npm run test:webauto:schedule:unit && npm run test:webauto:ui-cli:unit && npm run test:webauto:install:unit && npm run test:desktop-console:unit && npm run test:services:unit",
|
|
73
76
|
"cli:session-manager": "tsx modules/session-manager/src/cli.ts",
|
|
74
77
|
"cli:logging": "tsx modules/logging/src/cli.ts",
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
8
|
+
const ROOT_PACKAGE = path.join(ROOT, 'package.json');
|
|
9
|
+
const DESKTOP_PACKAGE = path.join(ROOT, 'apps', 'desktop-console', 'package.json');
|
|
10
|
+
const ROOT_LOCK = path.join(ROOT, 'package-lock.json');
|
|
11
|
+
|
|
12
|
+
function usage(exitCode = 0) {
|
|
13
|
+
console.log(`Usage:
|
|
14
|
+
node scripts/bump-version.mjs [patch|minor|major] [--json]
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
node scripts/bump-version.mjs
|
|
18
|
+
node scripts/bump-version.mjs patch
|
|
19
|
+
node scripts/bump-version.mjs minor --json`);
|
|
20
|
+
process.exit(exitCode);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readJson(filePath) {
|
|
24
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function writeJson(filePath, json) {
|
|
28
|
+
writeFileSync(filePath, `${JSON.stringify(json, null, 2)}\n`, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function bumpSemver(version, kind) {
|
|
32
|
+
const match = String(version || '').trim().match(/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/);
|
|
33
|
+
if (!match) {
|
|
34
|
+
throw new Error(`invalid semver: ${version}`);
|
|
35
|
+
}
|
|
36
|
+
let major = Number(match[1]);
|
|
37
|
+
let minor = Number(match[2]);
|
|
38
|
+
let patch = Number(match[3]);
|
|
39
|
+
if (kind === 'major') {
|
|
40
|
+
major += 1;
|
|
41
|
+
minor = 0;
|
|
42
|
+
patch = 0;
|
|
43
|
+
} else if (kind === 'minor') {
|
|
44
|
+
minor += 1;
|
|
45
|
+
patch = 0;
|
|
46
|
+
} else {
|
|
47
|
+
patch += 1;
|
|
48
|
+
}
|
|
49
|
+
return `${major}.${minor}.${patch}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function updatePackageVersion(filePath, nextVersion) {
|
|
53
|
+
const json = readJson(filePath);
|
|
54
|
+
const prev = String(json.version || '').trim();
|
|
55
|
+
if (!prev) throw new Error(`missing version in ${filePath}`);
|
|
56
|
+
json.version = nextVersion;
|
|
57
|
+
writeJson(filePath, json);
|
|
58
|
+
return prev;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function updateRootLockVersion(filePath, nextVersion) {
|
|
62
|
+
if (!existsSync(filePath)) return false;
|
|
63
|
+
const lock = readJson(filePath);
|
|
64
|
+
lock.version = nextVersion;
|
|
65
|
+
if (lock.packages && lock.packages['']) {
|
|
66
|
+
lock.packages[''].version = nextVersion;
|
|
67
|
+
}
|
|
68
|
+
writeJson(filePath, lock);
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function main() {
|
|
73
|
+
const argv = process.argv.slice(2);
|
|
74
|
+
if (argv.includes('--help') || argv.includes('-h')) usage(0);
|
|
75
|
+
|
|
76
|
+
const jsonMode = argv.includes('--json');
|
|
77
|
+
const kindArg = argv.find((arg) => !arg.startsWith('-')) || 'patch';
|
|
78
|
+
const kind = String(kindArg || 'patch').trim().toLowerCase();
|
|
79
|
+
if (!['patch', 'minor', 'major'].includes(kind)) {
|
|
80
|
+
console.error(`[version] unsupported bump type: ${kind}`);
|
|
81
|
+
usage(2);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const rootPkg = readJson(ROOT_PACKAGE);
|
|
85
|
+
const prevRootVersion = String(rootPkg.version || '').trim();
|
|
86
|
+
if (!prevRootVersion) {
|
|
87
|
+
throw new Error(`missing version in ${ROOT_PACKAGE}`);
|
|
88
|
+
}
|
|
89
|
+
const nextVersion = bumpSemver(prevRootVersion, kind);
|
|
90
|
+
|
|
91
|
+
const prevDesktopVersion = updatePackageVersion(DESKTOP_PACKAGE, nextVersion);
|
|
92
|
+
const prevVersion = updatePackageVersion(ROOT_PACKAGE, nextVersion);
|
|
93
|
+
const lockUpdated = updateRootLockVersion(ROOT_LOCK, nextVersion);
|
|
94
|
+
|
|
95
|
+
const result = {
|
|
96
|
+
ok: true,
|
|
97
|
+
kind,
|
|
98
|
+
previous: prevVersion,
|
|
99
|
+
next: nextVersion,
|
|
100
|
+
desktopPrevious: prevDesktopVersion,
|
|
101
|
+
desktopNext: nextVersion,
|
|
102
|
+
lockUpdated,
|
|
103
|
+
files: [
|
|
104
|
+
ROOT_PACKAGE,
|
|
105
|
+
DESKTOP_PACKAGE,
|
|
106
|
+
...(lockUpdated ? [ROOT_LOCK] : []),
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
if (jsonMode) {
|
|
111
|
+
console.log(JSON.stringify(result, null, 2));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
console.log(`[version] bump ${kind}: ${prevVersion} -> ${nextVersion}`);
|
|
115
|
+
console.log(`[version] updated: ${ROOT_PACKAGE}`);
|
|
116
|
+
console.log(`[version] updated: ${DESKTOP_PACKAGE}`);
|
|
117
|
+
if (lockUpdated) console.log(`[version] updated: ${ROOT_LOCK}`);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
main();
|
|
@@ -296,11 +296,13 @@ class UnifiedApiServer {
|
|
|
296
296
|
if (existing) return existing;
|
|
297
297
|
const profileId = String(seed?.profileId || 'unknown').trim() || 'unknown';
|
|
298
298
|
const keyword = String(seed?.keyword || '').trim();
|
|
299
|
+
const uiTriggerId = String(seed?.uiTriggerId || seed?.triggerId || '').trim();
|
|
299
300
|
const phase = normalizeTaskPhase(seed?.phase);
|
|
300
301
|
return this.taskRegistry.createTask({
|
|
301
302
|
runId: normalizedRunId,
|
|
302
303
|
profileId,
|
|
303
304
|
keyword,
|
|
305
|
+
uiTriggerId,
|
|
304
306
|
phase,
|
|
305
307
|
});
|
|
306
308
|
};
|
|
@@ -311,11 +313,13 @@ class UnifiedApiServer {
|
|
|
311
313
|
const phase = normalizeTaskPhase(payload?.phase);
|
|
312
314
|
const profileId = String(payload?.profileId || '').trim();
|
|
313
315
|
const keyword = String(payload?.keyword || '').trim();
|
|
316
|
+
const uiTriggerId = String(payload?.uiTriggerId || payload?.triggerId || '').trim();
|
|
314
317
|
const details = payload?.details && typeof payload.details === 'object' ? payload.details : undefined;
|
|
315
318
|
const patch: any = {};
|
|
316
319
|
if (phase !== 'unknown') patch.phase = phase;
|
|
317
320
|
if (profileId) patch.profileId = profileId;
|
|
318
321
|
if (keyword) patch.keyword = keyword;
|
|
322
|
+
if (uiTriggerId) patch.uiTriggerId = uiTriggerId;
|
|
319
323
|
if (details) patch.details = details;
|
|
320
324
|
if (Object.keys(patch).length > 0) {
|
|
321
325
|
this.taskRegistry.updateTask(normalizedRunId, patch);
|
|
@@ -37,10 +37,12 @@ export interface TaskState {
|
|
|
37
37
|
runId: string;
|
|
38
38
|
profileId: string;
|
|
39
39
|
keyword: string;
|
|
40
|
+
uiTriggerId?: string;
|
|
40
41
|
phase: TaskPhase;
|
|
41
42
|
status: TaskStatus;
|
|
42
43
|
progress: TaskProgress;
|
|
43
44
|
stats: TaskStats;
|
|
45
|
+
createdAt: number;
|
|
44
46
|
startedAt: number;
|
|
45
47
|
updatedAt: number;
|
|
46
48
|
completedAt?: number;
|
|
@@ -71,6 +73,7 @@ class TaskStateRegistry {
|
|
|
71
73
|
runId: string;
|
|
72
74
|
profileId: string;
|
|
73
75
|
keyword: string;
|
|
76
|
+
uiTriggerId?: string;
|
|
74
77
|
phase?: TaskPhase;
|
|
75
78
|
}): TaskState {
|
|
76
79
|
const now = Date.now();
|
|
@@ -78,6 +81,7 @@ class TaskStateRegistry {
|
|
|
78
81
|
runId: partial.runId,
|
|
79
82
|
profileId: partial.profileId,
|
|
80
83
|
keyword: partial.keyword,
|
|
84
|
+
uiTriggerId: partial.uiTriggerId ? String(partial.uiTriggerId).trim() : undefined,
|
|
81
85
|
phase: partial.phase || 'unknown',
|
|
82
86
|
status: 'starting',
|
|
83
87
|
progress: { total: 0, processed: 0, failed: 0 },
|
|
@@ -89,6 +93,7 @@ class TaskStateRegistry {
|
|
|
89
93
|
imagesDownloaded: 0,
|
|
90
94
|
ocrProcessed: 0,
|
|
91
95
|
},
|
|
96
|
+
createdAt: now,
|
|
92
97
|
startedAt: now,
|
|
93
98
|
updatedAt: now,
|
|
94
99
|
details: {
|