@psychout98/tadaima 1.0.4 → 1.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/dist/chunk-7TPZ4T2V.js +0 -0
- package/dist/{chunk-6O3GWKMO.js → chunk-GVIX77PC.js} +9 -2
- package/dist/chunk-KDW3UEKL.js +0 -0
- package/dist/config-YQZEYLLR.js +0 -0
- package/dist/daemon-YZQZNLEX.js +0 -0
- package/dist/{download-handler-R6AJCG4O.js → download-handler-3RP5BP6P.js} +1 -1
- package/dist/index.js +31 -37
- package/dist/logger-XTDECBFK.js +0 -0
- package/dist/service-GBG6YHQW.js +0 -0
- package/dist/setup-OLV7C7ON.js +0 -0
- package/dist/status-file-JMCUSEZR.js +32 -0
- package/dist/tui-ZE4672PT.js +0 -0
- package/dist/{updater-HXBNBU36.js → updater-LSMAQIFU.js} +2 -2
- package/dist/{ws-client-CLD6QAFC.js → ws-client-2MSPJRJ6.js} +1 -1
- package/package.json +16 -17
- package/LICENSE +0 -21
- package/dist/status-writer-RGH2PULB.js +0 -31
package/dist/chunk-7TPZ4T2V.js
CHANGED
|
File without changes
|
|
@@ -13947,7 +13947,9 @@ var cacheCheckSchema = messageEnvelopeSchema.extend({
|
|
|
13947
13947
|
});
|
|
13948
13948
|
var downloadAcceptedPayloadSchema = external_exports.object({
|
|
13949
13949
|
jobId: external_exports.string(),
|
|
13950
|
-
requestId: external_exports.string()
|
|
13950
|
+
requestId: external_exports.string(),
|
|
13951
|
+
title: external_exports.string().optional(),
|
|
13952
|
+
mediaType: external_exports.enum(["movie", "tv"]).optional()
|
|
13951
13953
|
});
|
|
13952
13954
|
var downloadAcceptedSchema = messageEnvelopeSchema.extend({
|
|
13953
13955
|
type: external_exports.literal("download:accepted"),
|
|
@@ -13957,6 +13959,8 @@ var downloadProgressPayloadSchema = external_exports.object({
|
|
|
13957
13959
|
jobId: external_exports.string(),
|
|
13958
13960
|
phase: external_exports.string(),
|
|
13959
13961
|
progress: external_exports.number().min(0).max(100),
|
|
13962
|
+
title: external_exports.string().optional(),
|
|
13963
|
+
mediaType: external_exports.enum(["movie", "tv"]).optional(),
|
|
13960
13964
|
downloadedBytes: external_exports.number().optional(),
|
|
13961
13965
|
totalBytes: external_exports.number().optional(),
|
|
13962
13966
|
speedBps: external_exports.number().optional(),
|
|
@@ -13969,6 +13973,7 @@ var downloadProgressSchema = messageEnvelopeSchema.extend({
|
|
|
13969
13973
|
var downloadCompletedPayloadSchema = external_exports.object({
|
|
13970
13974
|
jobId: external_exports.string(),
|
|
13971
13975
|
filePath: external_exports.string(),
|
|
13976
|
+
filePaths: external_exports.array(external_exports.string()).optional(),
|
|
13972
13977
|
finalSize: external_exports.number()
|
|
13973
13978
|
});
|
|
13974
13979
|
var downloadCompletedSchema = messageEnvelopeSchema.extend({
|
|
@@ -13997,7 +14002,9 @@ var downloadQueuedPayloadSchema = external_exports.object({
|
|
|
13997
14002
|
queueId: external_exports.string(),
|
|
13998
14003
|
requestId: external_exports.string(),
|
|
13999
14004
|
title: external_exports.string(),
|
|
14000
|
-
deviceName: external_exports.string()
|
|
14005
|
+
deviceName: external_exports.string(),
|
|
14006
|
+
mediaType: external_exports.enum(["movie", "tv"]).optional(),
|
|
14007
|
+
season: external_exports.number().optional()
|
|
14001
14008
|
});
|
|
14002
14009
|
var downloadQueuedSchema = messageEnvelopeSchema.extend({
|
|
14003
14010
|
type: external_exports.literal("download:queued"),
|
package/dist/chunk-KDW3UEKL.js
CHANGED
|
File without changes
|
package/dist/config-YQZEYLLR.js
CHANGED
|
File without changes
|
package/dist/daemon-YZQZNLEX.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
import { dirname, join } from "path";
|
|
7
|
-
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
-
var pkg = JSON.parse(
|
|
9
|
-
readFileSync(join(__dirname, "..", "package.json"), "utf-8")
|
|
10
|
-
);
|
|
4
|
+
var pkg = { version: "1.1.0" };
|
|
11
5
|
var args = process.argv.slice(2);
|
|
12
6
|
var command = args[0];
|
|
13
7
|
async function main() {
|
|
@@ -25,16 +19,15 @@ async function main() {
|
|
|
25
19
|
break;
|
|
26
20
|
}
|
|
27
21
|
console.log(`tadaima-agent v${pkg.version}`);
|
|
28
|
-
const { AgentWebSocket } = await import("./ws-client-
|
|
29
|
-
const { DownloadHandler } = await import("./download-handler-
|
|
22
|
+
const { AgentWebSocket } = await import("./ws-client-2MSPJRJ6.js");
|
|
23
|
+
const { DownloadHandler } = await import("./download-handler-3RP5BP6P.js");
|
|
30
24
|
const { TUI } = await import("./tui-ZE4672PT.js");
|
|
31
|
-
const { shouldCheckNow, checkForUpdate, applyUpdate, logUpdateAdvisory } = await import("./updater-
|
|
32
|
-
const {
|
|
25
|
+
const { shouldCheckNow, checkForUpdate, applyUpdate, logUpdateAdvisory } = await import("./updater-LSMAQIFU.js");
|
|
26
|
+
const { writeStatusFile, removeStatusFile, STATUS_HEARTBEAT_INTERVAL_MS } = await import("./status-file-JMCUSEZR.js");
|
|
33
27
|
const ws = new AgentWebSocket();
|
|
34
28
|
const handler = new DownloadHandler(ws);
|
|
35
29
|
const tui = new TUI(pkg.version);
|
|
36
30
|
let wsConnected = false;
|
|
37
|
-
let pendingUpdateVersion = null;
|
|
38
31
|
let pendingUpdate = null;
|
|
39
32
|
const tryApplyUpdate = async () => {
|
|
40
33
|
if (!pendingUpdate) return;
|
|
@@ -48,7 +41,6 @@ async function main() {
|
|
|
48
41
|
);
|
|
49
42
|
}
|
|
50
43
|
pendingUpdate = null;
|
|
51
|
-
pendingUpdateVersion = null;
|
|
52
44
|
};
|
|
53
45
|
const runUpdateCheck = async () => {
|
|
54
46
|
try {
|
|
@@ -60,7 +52,6 @@ async function main() {
|
|
|
60
52
|
return;
|
|
61
53
|
}
|
|
62
54
|
pendingUpdate = result;
|
|
63
|
-
pendingUpdateVersion = result.version;
|
|
64
55
|
await tryApplyUpdate();
|
|
65
56
|
}
|
|
66
57
|
} catch (err) {
|
|
@@ -91,35 +82,35 @@ async function main() {
|
|
|
91
82
|
});
|
|
92
83
|
ws.connect();
|
|
93
84
|
const { config: agentConfig } = await import("./config-YQZEYLLR.js");
|
|
94
|
-
const
|
|
95
|
-
writeStatus({
|
|
96
|
-
pid: process.pid,
|
|
97
|
-
version: pkg.version,
|
|
98
|
-
connected: wsConnected,
|
|
99
|
-
relay: agentConfig.get("relay"),
|
|
100
|
-
deviceName: agentConfig.get("deviceName"),
|
|
101
|
-
activeDownloads: handler.activeCount,
|
|
102
|
-
lastHeartbeat: (/* @__PURE__ */ new Date()).toISOString(),
|
|
103
|
-
updateAvailable: pendingUpdateVersion
|
|
104
|
-
});
|
|
105
|
-
}, 1e4);
|
|
106
|
-
writeStatus({
|
|
107
|
-
pid: process.pid,
|
|
85
|
+
const snapshotStatus = (connected) => ({
|
|
108
86
|
version: pkg.version,
|
|
109
|
-
|
|
110
|
-
|
|
87
|
+
pid: process.pid,
|
|
88
|
+
connected,
|
|
89
|
+
relayUrl: agentConfig.get("relay"),
|
|
90
|
+
deviceId: agentConfig.get("deviceId"),
|
|
111
91
|
deviceName: agentConfig.get("deviceName"),
|
|
112
|
-
activeDownloads:
|
|
113
|
-
lastHeartbeat: (/* @__PURE__ */ new Date()).toISOString()
|
|
114
|
-
updateAvailable: null
|
|
92
|
+
activeDownloads: handler.activeCount,
|
|
93
|
+
lastHeartbeat: (/* @__PURE__ */ new Date()).toISOString()
|
|
115
94
|
});
|
|
95
|
+
const writeStatusSafe = (connected) => {
|
|
96
|
+
writeStatusFile(snapshotStatus(connected)).catch((err) => {
|
|
97
|
+
console.warn(
|
|
98
|
+
"status.json write failed:",
|
|
99
|
+
err instanceof Error ? err.message : err
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
const statusInterval = setInterval(() => {
|
|
104
|
+
writeStatusSafe(wsConnected);
|
|
105
|
+
}, STATUS_HEARTBEAT_INTERVAL_MS);
|
|
106
|
+
writeStatusSafe(false);
|
|
116
107
|
if (!process.env.TADAIMA_DAEMON) {
|
|
117
108
|
tui.start();
|
|
118
109
|
}
|
|
119
110
|
process.on("SIGINT", () => {
|
|
120
111
|
clearInterval(updateInterval);
|
|
121
112
|
clearInterval(statusInterval);
|
|
122
|
-
|
|
113
|
+
removeStatusFile();
|
|
123
114
|
tui.stop();
|
|
124
115
|
ws.stop();
|
|
125
116
|
process.exit(0);
|
|
@@ -127,7 +118,7 @@ async function main() {
|
|
|
127
118
|
process.on("SIGTERM", () => {
|
|
128
119
|
clearInterval(updateInterval);
|
|
129
120
|
clearInterval(statusInterval);
|
|
130
|
-
|
|
121
|
+
removeStatusFile();
|
|
131
122
|
tui.stop();
|
|
132
123
|
ws.stop();
|
|
133
124
|
process.exit(0);
|
|
@@ -206,13 +197,16 @@ async function main() {
|
|
|
206
197
|
break;
|
|
207
198
|
}
|
|
208
199
|
case "update": {
|
|
209
|
-
const { checkForUpdate, applyUpdate } = await import("./updater-
|
|
200
|
+
const { checkForUpdate, applyUpdate, logUpdateAdvisory } = await import("./updater-LSMAQIFU.js");
|
|
201
|
+
const isBinaryInstall = !process.argv[1]?.includes("node_modules");
|
|
210
202
|
console.log(`Current version: v${pkg.version}`);
|
|
211
203
|
console.log("Checking for updates...");
|
|
212
204
|
try {
|
|
213
205
|
const result = await checkForUpdate(pkg.version);
|
|
214
206
|
if (!result) {
|
|
215
207
|
console.log("Already up to date.");
|
|
208
|
+
} else if (!isBinaryInstall) {
|
|
209
|
+
logUpdateAdvisory(pkg.version, result.version);
|
|
216
210
|
} else {
|
|
217
211
|
console.log(`Update available: v${result.version}`);
|
|
218
212
|
await applyUpdate(result);
|
|
@@ -227,7 +221,7 @@ async function main() {
|
|
|
227
221
|
break;
|
|
228
222
|
}
|
|
229
223
|
case "rollback": {
|
|
230
|
-
const { rollback } = await import("./updater-
|
|
224
|
+
const { rollback } = await import("./updater-LSMAQIFU.js");
|
|
231
225
|
rollback();
|
|
232
226
|
break;
|
|
233
227
|
}
|
package/dist/logger-XTDECBFK.js
CHANGED
|
File without changes
|
package/dist/service-GBG6YHQW.js
CHANGED
|
File without changes
|
package/dist/setup-OLV7C7ON.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
config
|
|
4
|
+
} from "./chunk-7TPZ4T2V.js";
|
|
5
|
+
|
|
6
|
+
// src/status-file.ts
|
|
7
|
+
import { mkdirSync, unlinkSync } from "fs";
|
|
8
|
+
import { writeFile, rename } from "fs/promises";
|
|
9
|
+
import { dirname, join } from "path";
|
|
10
|
+
var STATUS_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
11
|
+
function getStatusFilePath() {
|
|
12
|
+
return join(dirname(config.path), "status.json");
|
|
13
|
+
}
|
|
14
|
+
async function writeStatusFile(status) {
|
|
15
|
+
const statusPath = getStatusFilePath();
|
|
16
|
+
const tmpPath = statusPath + ".tmp";
|
|
17
|
+
mkdirSync(dirname(statusPath), { recursive: true });
|
|
18
|
+
await writeFile(tmpPath, JSON.stringify(status, null, 2));
|
|
19
|
+
await rename(tmpPath, statusPath);
|
|
20
|
+
}
|
|
21
|
+
function removeStatusFile() {
|
|
22
|
+
try {
|
|
23
|
+
unlinkSync(getStatusFilePath());
|
|
24
|
+
} catch {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
STATUS_HEARTBEAT_INTERVAL_MS,
|
|
29
|
+
getStatusFilePath,
|
|
30
|
+
removeStatusFile,
|
|
31
|
+
writeStatusFile
|
|
32
|
+
};
|
package/dist/tui-ZE4672PT.js
CHANGED
|
File without changes
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
GITHUB_RELEASES_API,
|
|
4
4
|
getAssetNameForPlatform
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GVIX77PC.js";
|
|
6
6
|
import {
|
|
7
7
|
config
|
|
8
8
|
} from "./chunk-7TPZ4T2V.js";
|
|
@@ -139,7 +139,7 @@ function rollback() {
|
|
|
139
139
|
function logUpdateAdvisory(currentVersion, latestVersion) {
|
|
140
140
|
console.log(`
|
|
141
141
|
Tadaima v${latestVersion} is available (you have v${currentVersion}).`);
|
|
142
|
-
console.log(" npm: npm
|
|
142
|
+
console.log(" npm: npm install -g @psychout98/tadaima@latest");
|
|
143
143
|
console.log(" Docker: docker compose pull && docker compose up -d\n");
|
|
144
144
|
}
|
|
145
145
|
function isNewer(latest, current) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@psychout98/tadaima",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI download agent for Tadaima — a self-hosted media download orchestrator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,21 +37,6 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"conf": "^15.1.0",
|
|
42
|
-
"prompts": "^2.4.2",
|
|
43
|
-
"ws": "^8.20.0"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@types/node": "^25.5.2",
|
|
47
|
-
"@types/prompts": "^2.4.9",
|
|
48
|
-
"@types/ws": "^8.18.1",
|
|
49
|
-
"tsup": "^8.0.0",
|
|
50
|
-
"tsx": "^4.19.0",
|
|
51
|
-
"typescript": "^5.7.0",
|
|
52
|
-
"vitest": "^4.1.2",
|
|
53
|
-
"@tadaima/shared": "0.0.0"
|
|
54
|
-
},
|
|
55
40
|
"scripts": {
|
|
56
41
|
"build": "tsup",
|
|
57
42
|
"dev": "tsx watch src/index.ts",
|
|
@@ -66,5 +51,19 @@
|
|
|
66
51
|
"compile:linux-x64": "bun build src/index.ts --compile --target=bun-linux-x64 --outfile=dist/tadaima-agent-linux-x64",
|
|
67
52
|
"compile:all": "pnpm run compile:darwin-arm64 && pnpm run compile:darwin-x64 && pnpm run compile:win-x64 && pnpm run compile:linux-x64",
|
|
68
53
|
"compile:checksums": "cd dist && shasum -a 256 tadaima-agent-* > checksums.sha256"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"conf": "^15.1.0",
|
|
57
|
+
"prompts": "^2.4.2",
|
|
58
|
+
"ws": "^8.20.0"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/node": "^25.5.2",
|
|
62
|
+
"@types/prompts": "^2.4.9",
|
|
63
|
+
"@types/ws": "^8.18.1",
|
|
64
|
+
"tsup": "^8.0.0",
|
|
65
|
+
"tsx": "^4.19.0",
|
|
66
|
+
"typescript": "^5.7.0",
|
|
67
|
+
"vitest": "^4.1.2"
|
|
69
68
|
}
|
|
70
|
-
}
|
|
69
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Tadaima Contributors
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
config
|
|
4
|
-
} from "./chunk-7TPZ4T2V.js";
|
|
5
|
-
|
|
6
|
-
// src/status-writer.ts
|
|
7
|
-
import { writeFileSync, unlinkSync, renameSync, mkdirSync } from "fs";
|
|
8
|
-
import { dirname, join } from "path";
|
|
9
|
-
function getStatusPath() {
|
|
10
|
-
return join(dirname(config.path), "status.json");
|
|
11
|
-
}
|
|
12
|
-
function writeStatus(status) {
|
|
13
|
-
const statusPath = getStatusPath();
|
|
14
|
-
const tmpPath = statusPath + ".tmp";
|
|
15
|
-
try {
|
|
16
|
-
mkdirSync(dirname(statusPath), { recursive: true });
|
|
17
|
-
writeFileSync(tmpPath, JSON.stringify(status, null, 2));
|
|
18
|
-
renameSync(tmpPath, statusPath);
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function removeStatus() {
|
|
23
|
-
try {
|
|
24
|
-
unlinkSync(getStatusPath());
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
removeStatus,
|
|
30
|
-
writeStatus
|
|
31
|
-
};
|