@slock-ai/computer 0.0.35 → 0.0.36
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/index.js +590 -1690
- package/dist/lib/index.js +29 -14
- package/package.json +6 -2
package/dist/lib/index.js
CHANGED
|
@@ -188,7 +188,7 @@ async function firstReadableOwner(paths) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// src/apiClient.ts
|
|
191
|
-
import { fetch } from "undici";
|
|
191
|
+
import { fetch as fetch2 } from "undici";
|
|
192
192
|
var ServersClient = class {
|
|
193
193
|
constructor(baseUrl, accessToken) {
|
|
194
194
|
this.baseUrl = baseUrl;
|
|
@@ -200,7 +200,7 @@ var ServersClient = class {
|
|
|
200
200
|
async list() {
|
|
201
201
|
let res;
|
|
202
202
|
try {
|
|
203
|
-
res = await
|
|
203
|
+
res = await fetch2(this.url("/api/servers/"), {
|
|
204
204
|
method: "GET",
|
|
205
205
|
headers: { Authorization: `Bearer ${this.accessToken}` }
|
|
206
206
|
});
|
|
@@ -244,7 +244,7 @@ var LegacyMachinesClient = class {
|
|
|
244
244
|
async list(serverSlug) {
|
|
245
245
|
let res;
|
|
246
246
|
try {
|
|
247
|
-
res = await
|
|
247
|
+
res = await fetch2(
|
|
248
248
|
this.url(`/api/computer/legacy-machines?serverSlug=${encodeURIComponent(serverSlug)}`),
|
|
249
249
|
{
|
|
250
250
|
method: "GET",
|
|
@@ -288,7 +288,7 @@ var RunnersClient = class {
|
|
|
288
288
|
return new URL(p, this.baseUrl).toString();
|
|
289
289
|
}
|
|
290
290
|
async list() {
|
|
291
|
-
const res = await
|
|
291
|
+
const res = await fetch2(this.url("/internal/computer/runners"), {
|
|
292
292
|
method: "GET",
|
|
293
293
|
headers: { Authorization: `Bearer ${this.computerApiKey}` }
|
|
294
294
|
});
|
|
@@ -305,7 +305,7 @@ var RunnersClient = class {
|
|
|
305
305
|
return { status: "error", code };
|
|
306
306
|
}
|
|
307
307
|
async stop(agentId) {
|
|
308
|
-
const res = await
|
|
308
|
+
const res = await fetch2(this.url(`/internal/computer/runners/${encodeURIComponent(agentId)}/stop`), {
|
|
309
309
|
method: "POST",
|
|
310
310
|
headers: { Authorization: `Bearer ${this.computerApiKey}`, "Content-Type": "application/json" },
|
|
311
311
|
body: "{}"
|
|
@@ -320,9 +320,9 @@ var RunnersClient = class {
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
// src/setup.ts
|
|
323
|
-
import { chmod as
|
|
324
|
-
import { dirname as
|
|
325
|
-
import { fetch as
|
|
323
|
+
import { chmod as chmod5, mkdir as mkdir11, readFile as readFile10, rename as rename4, rm as rm3, writeFile as writeFile10 } from "fs/promises";
|
|
324
|
+
import { dirname as dirname9 } from "path";
|
|
325
|
+
import { fetch as fetch4 } from "undici";
|
|
326
326
|
|
|
327
327
|
// src/serverState.ts
|
|
328
328
|
import { readFile as readFile2, readdir as readdir2, writeFile, mkdir, unlink, access, chmod } from "fs/promises";
|
|
@@ -472,10 +472,13 @@ import { setTimeout as delay } from "timers/promises";
|
|
|
472
472
|
|
|
473
473
|
// src/service.ts
|
|
474
474
|
import { spawn as spawn2 } from "child_process";
|
|
475
|
+
import { createRequire as createRequire2 } from "module";
|
|
475
476
|
|
|
476
477
|
// src/version.ts
|
|
477
478
|
import { createRequire } from "module";
|
|
478
479
|
function readComputerVersion(moduleUrl = import.meta.url) {
|
|
480
|
+
const baked = process.env.SLOCK_COMPUTER_VERSION;
|
|
481
|
+
if (typeof baked === "string" && baked.length > 0) return baked;
|
|
479
482
|
try {
|
|
480
483
|
const require2 = createRequire(moduleUrl);
|
|
481
484
|
const pkg = require2("../package.json");
|
|
@@ -487,8 +490,8 @@ function readComputerVersion(moduleUrl = import.meta.url) {
|
|
|
487
490
|
var COMPUTER_VERSION = readComputerVersion();
|
|
488
491
|
|
|
489
492
|
// src/service.ts
|
|
490
|
-
import { mkdir as
|
|
491
|
-
import { dirname as
|
|
493
|
+
import { mkdir as mkdir10, readFile as readFile9, writeFile as writeFile9, open, rename as rename3 } from "fs/promises";
|
|
494
|
+
import { dirname as dirname8, join as joinPath } from "path";
|
|
492
495
|
import { fileURLToPath } from "url";
|
|
493
496
|
|
|
494
497
|
// src/cleanup.ts
|
|
@@ -585,7 +588,19 @@ async function walkFallback(slockHome, readPidfile, isAlive, clearStale) {
|
|
|
585
588
|
}
|
|
586
589
|
|
|
587
590
|
// src/services/detach.ts
|
|
588
|
-
import { fetch as
|
|
591
|
+
import { fetch as fetch3 } from "undici";
|
|
592
|
+
|
|
593
|
+
// src/upgradeSea.ts
|
|
594
|
+
import { createHash as createHash3 } from "crypto";
|
|
595
|
+
import { chmod as chmod4, mkdir as mkdir9, readFile as readFile8, rename as rename2, rm as rm2, writeFile as writeFile8 } from "fs/promises";
|
|
596
|
+
import { join as join4 } from "path";
|
|
597
|
+
|
|
598
|
+
// src/channel.ts
|
|
599
|
+
import { readFile as readFile7, writeFile as writeFile7, mkdir as mkdir8 } from "fs/promises";
|
|
600
|
+
import { dirname as dirname7 } from "path";
|
|
601
|
+
|
|
602
|
+
// src/service.ts
|
|
603
|
+
var seaRequire = createRequire2(import.meta.url);
|
|
589
604
|
|
|
590
605
|
// src/setup.ts
|
|
591
606
|
var MIGRATION_FRESH_TRIGGERS = [
|
|
@@ -634,10 +649,10 @@ async function pickMigrationCandidateFromInput(candidates, read, write) {
|
|
|
634
649
|
}
|
|
635
650
|
|
|
636
651
|
// src/status.ts
|
|
637
|
-
import { readFile as
|
|
652
|
+
import { readFile as readFile11 } from "fs/promises";
|
|
638
653
|
async function readUserSession(path2) {
|
|
639
654
|
try {
|
|
640
|
-
const parsed = JSON.parse(await
|
|
655
|
+
const parsed = JSON.parse(await readFile11(path2, "utf8"));
|
|
641
656
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
642
657
|
return { state: "present", session: parsed, error: null };
|
|
643
658
|
}
|
|
@@ -790,7 +805,7 @@ function isServiceState(value) {
|
|
|
790
805
|
}
|
|
791
806
|
|
|
792
807
|
// src/upgradeLog.ts
|
|
793
|
-
import { chmod as
|
|
808
|
+
import { chmod as chmod6, mkdir as mkdir12, open as open2 } from "fs/promises";
|
|
794
809
|
var UPGRADE_ERROR_CODES = [
|
|
795
810
|
"UPGRADE_DEPS_CHANGED",
|
|
796
811
|
"UPGRADE_NETWORK_FAILED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slock-ai/computer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Slock Computer — standalone human/local-machine control-plane CLI (login + attach). Distinct from the agent-facing @slock-ai/cli.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,11 +28,13 @@
|
|
|
28
28
|
"commander": "^12.1.0",
|
|
29
29
|
"proper-lockfile": "^4.1.2",
|
|
30
30
|
"undici": "^7.24.7",
|
|
31
|
-
"@slock-ai/daemon": "0.57.
|
|
31
|
+
"@slock-ai/daemon": "0.57.6"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^25.5.0",
|
|
35
35
|
"@types/proper-lockfile": "^4.1.4",
|
|
36
|
+
"esbuild": "^0.25.0",
|
|
37
|
+
"postject": "^1.0.0-alpha.6",
|
|
36
38
|
"tsup": "^8.5.1",
|
|
37
39
|
"tsx": "^4.21.0",
|
|
38
40
|
"typescript": "^5.9.3"
|
|
@@ -42,6 +44,8 @@
|
|
|
42
44
|
"start": "tsx src/index.ts",
|
|
43
45
|
"build:deps": "pnpm --filter @slock-ai/daemon build",
|
|
44
46
|
"build": "pnpm run build:deps && tsup",
|
|
47
|
+
"build:native": "pnpm run build:deps && node scripts/native/build.mjs",
|
|
48
|
+
"manifest:native": "node scripts/native/produce-manifest.mjs",
|
|
45
49
|
"test": "node --import tsx --test --test-force-exit 'src/**/*.test.ts'",
|
|
46
50
|
"typecheck": "tsc --noEmit",
|
|
47
51
|
"lint:boundaries": "node scripts/check-boundaries.mjs",
|