@myclaw163/clawclaw-cli 0.10.16 → 0.10.17
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/cli-runtime/cli.js +16 -1
- package/cli-runtime/commands/runtime.js +35 -0
- package/cli-runtime/lib/account-resource-lock.js +15 -0
- package/cli-runtime/lib/agent-workspace-skills.js +3 -1
- package/cli-runtime/lib/desktop-mode.js +3 -0
- package/cli-runtime/lib/harness-context.js +20 -0
- package/cli-runtime/lib/init-command.js +2 -1
- package/cli-runtime/lib/lobby-host-context.js +1 -2
- package/cli-runtime/lib/skill-host.js +2 -0
- package/cli-runtime/lib/user-data.js +4 -2
- package/cli-runtime/runtime/clawclaw/owner-lock.js +2 -1
- package/dist/strategy-worker/runtime/clawclaw/plugins/behavior/sdk-sdk.js +46 -25
- package/docs/configuration.md +6 -0
- package/package.json +1 -1
- package/skills/clawclaw/SKILL.md +1 -1
- package/src/cli.ts +12 -1
- package/src/commands/runtime.ts +26 -0
- package/src/lib/account-resource-lock.ts +14 -0
- package/src/lib/agent-workspace-skills.ts +3 -2
- package/src/lib/desktop-mode.ts +4 -0
- package/src/lib/harness-context.ts +21 -0
- package/src/lib/init-command.ts +2 -1
- package/src/lib/lobby-host-context.ts +2 -2
- package/src/lib/skill-host.ts +2 -0
- package/src/lib/user-data.ts +5 -2
- package/src/runtime/clawclaw/owner-lock.ts +2 -1
package/cli-runtime/cli.js
CHANGED
|
@@ -22,6 +22,7 @@ const registry = [
|
|
|
22
22
|
if (!name2 || name2 === "game") p.addCommand(module.createGameCommand());
|
|
23
23
|
} },
|
|
24
24
|
{ names: ["account"], register: async (p) => p.addCommand((await import("./commands/account.js")).createAccountCommand()) },
|
|
25
|
+
{ names: ["runtime"], register: async (p) => p.addCommand((await import("./commands/runtime.js")).createRuntimeCommand()) },
|
|
25
26
|
{ names: ["auth"], register: async (p) => p.addCommand((await import("./commands/auth.js")).createAuthCommand()) },
|
|
26
27
|
{ names: ["competition"], register: async (p) => p.addCommand((await import("./commands/competition.js")).createCompetitionCommand()) },
|
|
27
28
|
{ names: ["capability", "cap"], register: async (p) => p.addCommand((await import("./commands/capability.js")).createCapabilityCommand()) },
|
|
@@ -72,7 +73,21 @@ try {
|
|
|
72
73
|
}
|
|
73
74
|
startupMark("cli.modules_loaded");
|
|
74
75
|
startupMark("cli.parse_ready");
|
|
75
|
-
await
|
|
76
|
+
const context = (await import("./lib/harness-context.js")).harnessContext();
|
|
77
|
+
if (context && !context.session && (name === "join" || name === "start" || name === "game" && ["start", "s", "join-room", "create-room", "training"].includes(args[1] ?? "")) && !args.includes("--help")) {
|
|
78
|
+
throw new Error("INVALID_HARNESS_CONTEXT: game launch requires CLAWCLAW_HOST_SESSION_ID.");
|
|
79
|
+
}
|
|
80
|
+
const writesResources = ["prepare", "capability", "cap", "hub", "skill", "persona", "prs", "memory", "mem", "strategy", "behavior", "beh", "perception", "pcp", "trigger", "trg"];
|
|
81
|
+
let guard;
|
|
82
|
+
if (name && writesResources.includes(name) && !args.includes("--help") && !args.includes("-h")) {
|
|
83
|
+
const { acquireAccountResourceLock } = await import("./lib/account-resource-lock.js");
|
|
84
|
+
guard = acquireAccountResourceLock();
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await program.parseAsync();
|
|
88
|
+
} finally {
|
|
89
|
+
guard?.release();
|
|
90
|
+
}
|
|
76
91
|
startupMark("cli.complete");
|
|
77
92
|
} catch (err) {
|
|
78
93
|
process.stderr.write(`${formatCommandError(err)}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { getWorkspaceDir } from "../lib/init-command.js";
|
|
5
|
+
import { getRuntimeDir } from "../lib/user-data.js";
|
|
6
|
+
import { resolveBundledClawclawSkill } from "../lib/skill-host.js";
|
|
7
|
+
function createRuntimeCommand() {
|
|
8
|
+
const command = new Command("runtime").description("Inspect the effective local CCL installation");
|
|
9
|
+
command.command("info").option("--json").action(() => {
|
|
10
|
+
const workspace = getWorkspaceDir();
|
|
11
|
+
const skillDirectory = resolveBundledClawclawSkill();
|
|
12
|
+
const root = dirname(dirname(skillDirectory));
|
|
13
|
+
const { version } = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
14
|
+
console.log(JSON.stringify({
|
|
15
|
+
protocolVersion: 1,
|
|
16
|
+
version,
|
|
17
|
+
workspace,
|
|
18
|
+
runtimeDirectory: getRuntimeDir(workspace),
|
|
19
|
+
skillDirectory,
|
|
20
|
+
executable: process.execPath,
|
|
21
|
+
cli: join(root, "bin", "clawclaw-cli.mjs")
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
command.command("skills").option("--json").action(async () => {
|
|
25
|
+
const { AuthStore } = await import("../lib/auth.js");
|
|
26
|
+
const { accountManagedSkillSources } = await import("../lib/agent-workspace-skills.js");
|
|
27
|
+
const profile = new AuthStore().getActive();
|
|
28
|
+
const sources = profile ? accountManagedSkillSources(getWorkspaceDir(), profile) : /* @__PURE__ */ new Map();
|
|
29
|
+
console.log(JSON.stringify(Array.from(sources, ([name, directory]) => ({ name, directory }))));
|
|
30
|
+
});
|
|
31
|
+
return command;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
createRuntimeCommand
|
|
35
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { tryAcquireRuntimeLock } from "@myclaw163/game-agent-runtime/owner/runtime-lock.js";
|
|
3
|
+
import { AuthStore } from "./auth.js";
|
|
4
|
+
import { getWorkspaceDir } from "./init-command.js";
|
|
5
|
+
import { getUserDataAccountDir } from "./user-data.js";
|
|
6
|
+
function acquireAccountResourceLock() {
|
|
7
|
+
const profile = new AuthStore().getActive();
|
|
8
|
+
if (!profile) return;
|
|
9
|
+
const lock = tryAcquireRuntimeLock(join(getUserDataAccountDir(getWorkspaceDir(), profile), ".resource-lock"));
|
|
10
|
+
if (!lock) throw new Error("ACCOUNT_RESOURCES_BUSY: another command is using this account\u2019s resources. Retry after it finishes.");
|
|
11
|
+
return lock;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
acquireAccountResourceLock
|
|
15
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext } from "./harness-context.js";
|
|
1
2
|
import { isPackageManagedSkill, reservedSkillName } from "./package-skills.js";
|
|
2
3
|
import {
|
|
3
4
|
existsSync,
|
|
@@ -154,7 +155,7 @@ function accountManagedSkillSources(workspaceDir, profile, includeInactive = fal
|
|
|
154
155
|
return sources;
|
|
155
156
|
}
|
|
156
157
|
function switchActiveAccountSkillLinks(workspaceDir, previousProfile, nextProfile, dependencies = {}) {
|
|
157
|
-
if (previousProfile?.apiKey === nextProfile?.apiKey) return { removed: [], linked: [] };
|
|
158
|
+
if (harnessContext() || previousProfile?.apiKey === nextProfile?.apiKey) return { removed: [], linked: [] };
|
|
158
159
|
const guard = tryAcquireWorkspaceRuntimeLock(workspaceDir);
|
|
159
160
|
if (!guard) throw new Error("A ClawClaw runtime is running in this workspace. Stop it before switching accounts.");
|
|
160
161
|
guard.release();
|
|
@@ -447,6 +448,7 @@ function syncAgentWorkspaceSkills(workspaceDir, profile, snapshot, dependencies
|
|
|
447
448
|
};
|
|
448
449
|
}
|
|
449
450
|
export {
|
|
451
|
+
accountManagedSkillSources,
|
|
450
452
|
inspectSkillNameConflicts,
|
|
451
453
|
switchActiveAccountSkillLinks,
|
|
452
454
|
syncAgentWorkspaceSkills
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { harnessContext } from "./harness-context.js";
|
|
1
2
|
function isDesktopMode(env = process.env) {
|
|
3
|
+
const mode = harnessContext(env)?.auth;
|
|
4
|
+
if (mode) return mode === "managed";
|
|
2
5
|
return env.CLAWCLAW_IS_DESKTOP === "true";
|
|
3
6
|
}
|
|
4
7
|
const DESKTOP_LOGIN_MESSAGE = "\u8BF7\u5728\u5BA2\u6237\u7AEF\u767B\u5F55\u6E38\u620F\u8D26\u53F7\u3002CCL \u7684\u767B\u5F55\u8D26\u53F7\u7531\u5BA2\u6237\u7AEF\u7BA1\u7406\u3002";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
function harnessContext(env = process.env) {
|
|
4
|
+
const { CLAWCLAW_HOST_KIND: kind, CLAWCLAW_HOST_INSTANCE_ID: instance, CLAWCLAW_HOST_SESSION_ID: session, CLAWCLAW_AUTH_MODE: auth } = env;
|
|
5
|
+
if (kind === void 0 && auth === void 0) return void 0;
|
|
6
|
+
if (!kind || !/^[a-z][a-z0-9-]{0,63}$/.test(kind) || !instance || !/^[^\s\p{Cc}]{1,128}$/u.test(instance) || session !== void 0 && !/^[^\s\p{Cc}]{1,128}$/u.test(session) || auth !== void 0 && auth !== "managed" && auth !== "standalone") {
|
|
7
|
+
throw new Error("INVALID_HARNESS_CONTEXT: provide a valid kind, persistent instance ID and optional session/auth mode.");
|
|
8
|
+
}
|
|
9
|
+
return { kind, instance, session, auth };
|
|
10
|
+
}
|
|
11
|
+
function stateRoot(workspace) {
|
|
12
|
+
const context = harnessContext();
|
|
13
|
+
if (!context) return workspace;
|
|
14
|
+
const id = createHash("sha256").update(JSON.stringify([context.kind, context.instance])).digest("hex");
|
|
15
|
+
return join(workspace, "contexts", id);
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
harnessContext,
|
|
19
|
+
stateRoot
|
|
20
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stateRoot } from "./harness-context.js";
|
|
1
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
2
3
|
import { isAbsolute, join, resolve, win32 } from "path";
|
|
3
4
|
import { homedir } from "os";
|
|
@@ -56,7 +57,7 @@ function cmdInit(force = false) {
|
|
|
56
57
|
return { created: !alreadyExists, path: workspaceDir };
|
|
57
58
|
}
|
|
58
59
|
function getAccountDir(accountId) {
|
|
59
|
-
return join(getWorkspaceDir(), "accounts", accountId);
|
|
60
|
+
return join(stateRoot(getWorkspaceDir()), "accounts", accountId);
|
|
60
61
|
}
|
|
61
62
|
function createAccountDirs(accountId) {
|
|
62
63
|
const accountDir = getAccountDir(accountId);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { isDesktopMode } from "./desktop-mode.js";
|
|
3
2
|
import { ApiError } from "./http-transport.js";
|
|
4
3
|
const agentInstanceId = randomUUID();
|
|
5
4
|
class InvalidHostContextError extends Error {
|
|
@@ -32,7 +31,7 @@ function validateLobbyHostContext(value) {
|
|
|
32
31
|
function resolveLobbyHostContext(env = process.env) {
|
|
33
32
|
const instanceId = env.CLAWCLAW_HOST_INSTANCE_ID;
|
|
34
33
|
const sessionId = env.CLAWCLAW_HOST_SESSION_ID;
|
|
35
|
-
if (
|
|
34
|
+
if (env.CLAWCLAW_IS_DESKTOP === "true") {
|
|
36
35
|
if (!validId(instanceId) || !validId(sessionId)) {
|
|
37
36
|
throw new InvalidHostContextError("Desktop must provide CLAWCLAW_HOST_INSTANCE_ID and CLAWCLAW_HOST_SESSION_ID (1\u2013128 characters, no whitespace/control characters).");
|
|
38
37
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext } from "./harness-context.js";
|
|
1
2
|
import { spawnSync } from "node:child_process";
|
|
2
3
|
import {
|
|
3
4
|
cpSync,
|
|
@@ -83,6 +84,7 @@ function openClawSkillsDir(homeDir) {
|
|
|
83
84
|
return join(homeDir, ".openclaw", "skills");
|
|
84
85
|
}
|
|
85
86
|
function agentSkillTargets(name) {
|
|
87
|
+
if (harnessContext()) return [];
|
|
86
88
|
const homeDir = homedir();
|
|
87
89
|
const claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || join(homeDir, ".claude");
|
|
88
90
|
const codexHome = process.env.CODEX_HOME?.trim() || join(homeDir, ".codex");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext, stateRoot } from "./harness-context.js";
|
|
1
2
|
import {
|
|
2
3
|
copyFileSync,
|
|
3
4
|
existsSync,
|
|
@@ -18,10 +19,10 @@ function getUserDataDir(workspaceDir) {
|
|
|
18
19
|
return join(workspaceDir, USER_DATA_DIR);
|
|
19
20
|
}
|
|
20
21
|
function getRuntimeDir(workspaceDir) {
|
|
21
|
-
return join(workspaceDir, RUNTIME_DIR);
|
|
22
|
+
return join(stateRoot(workspaceDir), RUNTIME_DIR);
|
|
22
23
|
}
|
|
23
24
|
function getUserDataAuthFile(workspaceDir) {
|
|
24
|
-
return join(getUserDataDir(workspaceDir), "auth.json");
|
|
25
|
+
return join(getUserDataDir(stateRoot(workspaceDir)), "auth.json");
|
|
25
26
|
}
|
|
26
27
|
function getRuntimeAuthStateFile(workspaceDir) {
|
|
27
28
|
return join(getRuntimeDir(workspaceDir), "auth-state.json");
|
|
@@ -258,6 +259,7 @@ function ensureUserDataLayout(workspaceDir) {
|
|
|
258
259
|
ensureDir(getUserDataTriggersDir(workspaceDir));
|
|
259
260
|
ensureDir(getUserDataHubDir(workspaceDir));
|
|
260
261
|
ensureDir(getRuntimeDir(workspaceDir));
|
|
262
|
+
if (harnessContext()) return result;
|
|
261
263
|
const auth = migrateAuth(workspaceDir, result);
|
|
262
264
|
migrateAccountFiles(workspaceDir, auth, result);
|
|
263
265
|
writeMigrationMarker(workspaceDir, result);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stateRoot } from "../../lib/harness-context.js";
|
|
1
2
|
import { timeStartup } from "../../../bin/startup-trace.mjs";
|
|
2
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
4
|
import { mkdirSync, readFileSync, realpathSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
@@ -27,7 +28,7 @@ function workspaceOwnerRecordPath(workspaceDir = getWorkspaceDir()) {
|
|
|
27
28
|
return join(getRuntimeDir(workspaceDir), "owner.json");
|
|
28
29
|
}
|
|
29
30
|
function workspaceOwnerIdentity(workspaceDir = getWorkspaceDir()) {
|
|
30
|
-
const real = realpathSync(workspaceDir);
|
|
31
|
+
const real = realpathSync(stateRoot(workspaceDir));
|
|
31
32
|
return createHash("sha256").update(process.platform === "win32" ? real.toLowerCase() : real).digest("hex");
|
|
32
33
|
}
|
|
33
34
|
function readOwnerRecord(path) {
|
|
@@ -172,8 +172,28 @@ var Action = class _Action {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
// src/lib/harness-context.ts
|
|
176
|
+
import { createHash } from "node:crypto";
|
|
177
|
+
import { join } from "node:path";
|
|
178
|
+
function harnessContext(env = process.env) {
|
|
179
|
+
const { CLAWCLAW_HOST_KIND: kind, CLAWCLAW_HOST_INSTANCE_ID: instance, CLAWCLAW_HOST_SESSION_ID: session, CLAWCLAW_AUTH_MODE: auth } = env;
|
|
180
|
+
if (kind === void 0 && auth === void 0) return void 0;
|
|
181
|
+
if (!kind || !/^[a-z][a-z0-9-]{0,63}$/.test(kind) || !instance || !/^[^\s\p{Cc}]{1,128}$/u.test(instance) || session !== void 0 && !/^[^\s\p{Cc}]{1,128}$/u.test(session) || auth !== void 0 && auth !== "managed" && auth !== "standalone") {
|
|
182
|
+
throw new Error("INVALID_HARNESS_CONTEXT: provide a valid kind, persistent instance ID and optional session/auth mode.");
|
|
183
|
+
}
|
|
184
|
+
return { kind, instance, session, auth };
|
|
185
|
+
}
|
|
186
|
+
function stateRoot(workspace) {
|
|
187
|
+
const context = harnessContext();
|
|
188
|
+
if (!context) return workspace;
|
|
189
|
+
const id = createHash("sha256").update(JSON.stringify([context.kind, context.instance])).digest("hex");
|
|
190
|
+
return join(workspace, "contexts", id);
|
|
191
|
+
}
|
|
192
|
+
|
|
175
193
|
// src/lib/desktop-mode.ts
|
|
176
194
|
function isDesktopMode(env = process.env) {
|
|
195
|
+
const mode = harnessContext(env)?.auth;
|
|
196
|
+
if (mode) return mode === "managed";
|
|
177
197
|
return env.CLAWCLAW_IS_DESKTOP === "true";
|
|
178
198
|
}
|
|
179
199
|
var DESKTOP_LOGIN_MESSAGE = "\u8BF7\u5728\u5BA2\u6237\u7AEF\u767B\u5F55\u6E38\u620F\u8D26\u53F7\u3002CCL \u7684\u767B\u5F55\u8D26\u53F7\u7531\u5BA2\u6237\u7AEF\u7BA1\u7406\u3002";
|
|
@@ -184,10 +204,10 @@ function accountRequiredMessage(standaloneMessage) {
|
|
|
184
204
|
// src/lib/auth.ts
|
|
185
205
|
import { chmodSync, existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
186
206
|
import { randomUUID } from "crypto";
|
|
187
|
-
import { join as
|
|
207
|
+
import { join as join4, dirname as dirname2 } from "path";
|
|
188
208
|
|
|
189
209
|
// src/lib/init-command.ts
|
|
190
|
-
import { isAbsolute, join as
|
|
210
|
+
import { isAbsolute, join as join3, resolve, win32 } from "path";
|
|
191
211
|
import { homedir } from "os";
|
|
192
212
|
|
|
193
213
|
// src/lib/user-data.ts
|
|
@@ -198,8 +218,8 @@ import {
|
|
|
198
218
|
readFileSync,
|
|
199
219
|
writeFileSync
|
|
200
220
|
} from "fs";
|
|
201
|
-
import { createHash } from "crypto";
|
|
202
|
-
import { dirname, join } from "path";
|
|
221
|
+
import { createHash as createHash2 } from "crypto";
|
|
222
|
+
import { dirname, join as join2 } from "path";
|
|
203
223
|
var USER_DATA_DIR = "user-data";
|
|
204
224
|
var RUNTIME_DIR = "runtime";
|
|
205
225
|
var EMPTY_RESULT = () => ({
|
|
@@ -208,37 +228,37 @@ var EMPTY_RESULT = () => ({
|
|
|
208
228
|
skippedExisting: []
|
|
209
229
|
});
|
|
210
230
|
function getUserDataDir(workspaceDir) {
|
|
211
|
-
return
|
|
231
|
+
return join2(workspaceDir, USER_DATA_DIR);
|
|
212
232
|
}
|
|
213
233
|
function getRuntimeDir(workspaceDir) {
|
|
214
|
-
return
|
|
234
|
+
return join2(stateRoot(workspaceDir), RUNTIME_DIR);
|
|
215
235
|
}
|
|
216
236
|
function getUserDataAuthFile(workspaceDir) {
|
|
217
|
-
return
|
|
237
|
+
return join2(getUserDataDir(stateRoot(workspaceDir)), "auth.json");
|
|
218
238
|
}
|
|
219
239
|
function getRuntimeAuthStateFile(workspaceDir) {
|
|
220
|
-
return
|
|
240
|
+
return join2(getRuntimeDir(workspaceDir), "auth-state.json");
|
|
221
241
|
}
|
|
222
242
|
function getUserDataAccountsDir(workspaceDir) {
|
|
223
|
-
return
|
|
243
|
+
return join2(getUserDataDir(workspaceDir), "accounts");
|
|
224
244
|
}
|
|
225
245
|
function getUserDataAccountHash(apiKey) {
|
|
226
|
-
return
|
|
246
|
+
return createHash2("sha256").update(apiKey).digest("hex").slice(0, 16);
|
|
227
247
|
}
|
|
228
248
|
function getUserDataAccountDir(workspaceDir, profile) {
|
|
229
|
-
return
|
|
249
|
+
return join2(getUserDataAccountsDir(workspaceDir), getUserDataAccountHash(profile.apiKey));
|
|
230
250
|
}
|
|
231
251
|
function getUserDataBehaviorsDir(workspaceDir) {
|
|
232
|
-
return
|
|
252
|
+
return join2(getUserDataDir(workspaceDir), "behaviors");
|
|
233
253
|
}
|
|
234
254
|
function getUserDataPerceptionsDir(workspaceDir) {
|
|
235
|
-
return
|
|
255
|
+
return join2(getUserDataDir(workspaceDir), "perceptions");
|
|
236
256
|
}
|
|
237
257
|
function getUserDataTriggersDir(workspaceDir) {
|
|
238
|
-
return
|
|
258
|
+
return join2(getUserDataDir(workspaceDir), "triggers");
|
|
239
259
|
}
|
|
240
260
|
function getUserDataHubDir(workspaceDir) {
|
|
241
|
-
return
|
|
261
|
+
return join2(getUserDataDir(workspaceDir), "hub");
|
|
242
262
|
}
|
|
243
263
|
function ensureDir(path) {
|
|
244
264
|
mkdirSync(path, { recursive: true });
|
|
@@ -311,7 +331,7 @@ function mergeRuntimeAuthState(path, incoming, result) {
|
|
|
311
331
|
}
|
|
312
332
|
}
|
|
313
333
|
function migrateAuth(workspaceDir, result) {
|
|
314
|
-
const legacyAuthFile =
|
|
334
|
+
const legacyAuthFile = join2(workspaceDir, ".auth.json");
|
|
315
335
|
const authFile = getUserDataAuthFile(workspaceDir);
|
|
316
336
|
const runtimeFile = getRuntimeAuthStateFile(workspaceDir);
|
|
317
337
|
const source = existsSync(authFile) ? readJson(authFile) : readJson(legacyAuthFile);
|
|
@@ -330,11 +350,11 @@ function migrateAuth(workspaceDir, result) {
|
|
|
330
350
|
function migrateAccountFiles(workspaceDir, auth, result) {
|
|
331
351
|
if (!auth) return;
|
|
332
352
|
for (const profile of Object.values(auth.profiles ?? {})) {
|
|
333
|
-
const legacyDir =
|
|
353
|
+
const legacyDir = join2(workspaceDir, "accounts", profile.apiKey);
|
|
334
354
|
const newDir = getUserDataAccountDir(workspaceDir, profile);
|
|
335
355
|
for (const fileName of ["persona.md", "memory.md"]) {
|
|
336
|
-
const from =
|
|
337
|
-
const to =
|
|
356
|
+
const from = join2(legacyDir, fileName);
|
|
357
|
+
const to = join2(newDir, fileName);
|
|
338
358
|
if (!existsSync(from)) continue;
|
|
339
359
|
if (existsSync(to)) {
|
|
340
360
|
result.skippedExisting.push(`user-data/accounts/${getUserDataAccountHash(profile.apiKey)}/${fileName}`);
|
|
@@ -348,7 +368,7 @@ function migrateAccountFiles(workspaceDir, auth, result) {
|
|
|
348
368
|
}
|
|
349
369
|
function writeMigrationMarker(workspaceDir, result) {
|
|
350
370
|
if (result.copied.length === 0 && result.skipped.length === 0 && result.skippedExisting.length === 0) return;
|
|
351
|
-
const marker =
|
|
371
|
+
const marker = join2(getUserDataDir(workspaceDir), ".migration.json");
|
|
352
372
|
if (existsSync(marker)) return;
|
|
353
373
|
writeJson(marker, {
|
|
354
374
|
from: "legacy-workspace-layout",
|
|
@@ -367,6 +387,7 @@ function ensureUserDataLayout(workspaceDir) {
|
|
|
367
387
|
ensureDir(getUserDataTriggersDir(workspaceDir));
|
|
368
388
|
ensureDir(getUserDataHubDir(workspaceDir));
|
|
369
389
|
ensureDir(getRuntimeDir(workspaceDir));
|
|
390
|
+
if (harnessContext()) return result;
|
|
370
391
|
const auth = migrateAuth(workspaceDir, result);
|
|
371
392
|
migrateAccountFiles(workspaceDir, auth, result);
|
|
372
393
|
writeMigrationMarker(workspaceDir, result);
|
|
@@ -383,7 +404,7 @@ function resolveWorkspaceDir({
|
|
|
383
404
|
cwd = process.cwd()
|
|
384
405
|
} = {}) {
|
|
385
406
|
const rawWorkspaceDir = env[CLAWCLAW_WORKSPACE_DIR];
|
|
386
|
-
const pathApi = platform === "win32" ? win32 : { isAbsolute, join:
|
|
407
|
+
const pathApi = platform === "win32" ? win32 : { isAbsolute, join: join3, resolve };
|
|
387
408
|
if (typeof rawWorkspaceDir === "string") {
|
|
388
409
|
const trimmedWorkspaceDir = rawWorkspaceDir.trim();
|
|
389
410
|
if (trimmedWorkspaceDir !== "") {
|
|
@@ -394,13 +415,13 @@ function resolveWorkspaceDir({
|
|
|
394
415
|
const appData = env.APPDATA ?? win32.join(homeDir, "AppData", "Roaming");
|
|
395
416
|
return win32.join(appData, "clawclaw");
|
|
396
417
|
}
|
|
397
|
-
return
|
|
418
|
+
return join3(homeDir, ".clawclaw");
|
|
398
419
|
}
|
|
399
420
|
function getWorkspaceDir() {
|
|
400
421
|
return resolveWorkspaceDir();
|
|
401
422
|
}
|
|
402
423
|
function getWorkspaceConfigFile(workspaceDir = getWorkspaceDir()) {
|
|
403
|
-
return
|
|
424
|
+
return join3(workspaceDir, WORKSPACE_CONFIG_FILE);
|
|
404
425
|
}
|
|
405
426
|
|
|
406
427
|
// src/lib/workspace-runtime-lock.ts
|
|
@@ -440,7 +461,7 @@ var AuthStore = class {
|
|
|
440
461
|
constructor(authFile, runtimeAuthStateFile) {
|
|
441
462
|
if (authFile) {
|
|
442
463
|
this.authFile = authFile;
|
|
443
|
-
this.runtimeAuthStateFile = runtimeAuthStateFile ??
|
|
464
|
+
this.runtimeAuthStateFile = runtimeAuthStateFile ?? join4(dirname2(authFile), "auth-state.json");
|
|
444
465
|
return;
|
|
445
466
|
}
|
|
446
467
|
const workspaceDir = getWorkspaceDir();
|
|
@@ -2531,7 +2552,7 @@ function validateLobbyHostContext(value) {
|
|
|
2531
2552
|
function resolveLobbyHostContext(env = process.env) {
|
|
2532
2553
|
const instanceId = env.CLAWCLAW_HOST_INSTANCE_ID;
|
|
2533
2554
|
const sessionId = env.CLAWCLAW_HOST_SESSION_ID;
|
|
2534
|
-
if (
|
|
2555
|
+
if (env.CLAWCLAW_IS_DESKTOP === "true") {
|
|
2535
2556
|
if (!validId(instanceId) || !validId(sessionId)) {
|
|
2536
2557
|
throw new InvalidHostContextError("Desktop must provide CLAWCLAW_HOST_INSTANCE_ID and CLAWCLAW_HOST_SESSION_ID (1\u2013128 characters, no whitespace/control characters).");
|
|
2537
2558
|
}
|
package/docs/configuration.md
CHANGED
|
@@ -297,3 +297,9 @@ deliveryClass 决定是否对 Agent 可见,wakeAgent 决定是否允许主动
|
|
|
297
297
|
本地感知入口放在 `<workspace>/user-data/accounts/<account-hash>/capabilities/perceptions/`,默认导出一个 `ClawclawPerception` 子类;其静态 manifest 声明模块 ID、主体范围和可生成 Event type。安装模块、选择模块和选择 Event 投递方式是三个独立动作。完整输入、输出、切片生命周期与安全限制见 [开发 Perception](./custom-modules/perception.md)。
|
|
298
298
|
|
|
299
299
|
开局延迟可用 `cli.business_start` 区分模块加载和命令执行。`start match` 的 `http.queue.join.sent` 记录 HTTP 请求头实际发送,`http.queue.join.headers` 记录响应头到达。Owner 计时还包括进程身份、系统锁和 Runtime 启动。诊断宿主传入的 `launch_id` 可用于连接两份 JSONL。
|
|
300
|
+
|
|
301
|
+
## Harness 客户端上下文(协议 v1)
|
|
302
|
+
|
|
303
|
+
客户端使用终端安装的 `ccl`,继承相同的 workspace。每次调用传入 `CLAWCLAW_HOST_KIND`(例如 `dsh-client`)与持久化的 `CLAWCLAW_HOST_INSTANCE_ID`。开局、加房和恢复时传入发起会话的 `CLAWCLAW_HOST_SESSION_ID`。认证方式 `CLAWCLAW_AUTH_MODE` 可选 `managed` 或 `standalone`。DSH 的托管登录继续用 stdin,Lobby 的 Desktop 标记与实例、会话字段遵循客户端托管协议。
|
|
304
|
+
|
|
305
|
+
`ccl runtime info --json` 可在未登录时读取协议版本、CCL 版本、实际 Node 和 CLI 入口、内置 Skill、workspace 与本实例运行目录。同一账号共享 `user-data/accounts` 的技能、策略与记忆。实例凭据、Owner 锁、日志和控制端点位于 `contexts/<实例哈希>`;终端使用原有位置。客户端切号不修改终端 Skill 链接。
|
package/package.json
CHANGED
package/skills/clawclaw/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clawclaw
|
|
3
3
|
description: ClawClaw/龙虾杀的完整玩法 Skill,仅在游戏事件流接通后读取。开局或恢复连接之前不要读取本 Skill,此阶段只读取 clawclaw-start。start/join 成功接流后立即调用本 Skill,不必等待匹配完成或身份分配。用于处理实时游戏事件、角色行动、策略、会议发言与投票、结算和复盘。资源创作使用 clawclaw-creator。
|
|
4
|
-
version: 4.8.
|
|
4
|
+
version: 4.8.134
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# 龙虾杀完整玩法(接流后调用)
|
package/src/cli.ts
CHANGED
|
@@ -23,6 +23,7 @@ const registry = [
|
|
|
23
23
|
if (!name || name === 'game') p.addCommand(module.createGameCommand());
|
|
24
24
|
} },
|
|
25
25
|
{ names: ['account'], register: async (p: Command) => p.addCommand((await import('./commands/account.js')).createAccountCommand()) },
|
|
26
|
+
{ names: ['runtime'], register: async (p: Command) => p.addCommand((await import('./commands/runtime.js')).createRuntimeCommand()) },
|
|
26
27
|
{ names: ['auth'], register: async (p: Command) => p.addCommand((await import('./commands/auth.js')).createAuthCommand()) },
|
|
27
28
|
{ names: ['competition'], register: async (p: Command) => p.addCommand((await import('./commands/competition.js')).createCompetitionCommand()) },
|
|
28
29
|
{ names: ['capability', 'cap'], register: async (p: Command) => p.addCommand((await import('./commands/capability.js')).createCapabilityCommand()) },
|
|
@@ -81,7 +82,17 @@ try {
|
|
|
81
82
|
}
|
|
82
83
|
startupMark('cli.modules_loaded');
|
|
83
84
|
startupMark('cli.parse_ready');
|
|
84
|
-
await
|
|
85
|
+
const context = (await import('./lib/harness-context.js')).harnessContext();
|
|
86
|
+
if (context && !context.session && (name === 'join' || name === 'start' || (name === 'game' && ['start', 's', 'join-room', 'create-room', 'training'].includes(args[1] ?? ''))) && !args.includes('--help')) {
|
|
87
|
+
throw new Error('INVALID_HARNESS_CONTEXT: game launch requires CLAWCLAW_HOST_SESSION_ID.');
|
|
88
|
+
}
|
|
89
|
+
const writesResources = ['prepare', 'capability', 'cap', 'hub', 'skill', 'persona', 'prs', 'memory', 'mem', 'strategy', 'behavior', 'beh', 'perception', 'pcp', 'trigger', 'trg'];
|
|
90
|
+
let guard;
|
|
91
|
+
if (name && writesResources.includes(name) && !args.includes('--help') && !args.includes('-h')) {
|
|
92
|
+
const { acquireAccountResourceLock } = await import('./lib/account-resource-lock.js');
|
|
93
|
+
guard = acquireAccountResourceLock();
|
|
94
|
+
}
|
|
95
|
+
try { await program.parseAsync(); } finally { guard?.release(); }
|
|
85
96
|
startupMark('cli.complete');
|
|
86
97
|
} catch (err) {
|
|
87
98
|
process.stderr.write(`${formatCommandError(err)}\n`);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { getWorkspaceDir } from '../lib/init-command.js';
|
|
5
|
+
import { getRuntimeDir } from '../lib/user-data.js';
|
|
6
|
+
import { resolveBundledClawclawSkill } from '../lib/skill-host.js';
|
|
7
|
+
|
|
8
|
+
export function createRuntimeCommand(): Command {
|
|
9
|
+
const command = new Command('runtime').description('Inspect the effective local CCL installation');
|
|
10
|
+
command.command('info').option('--json').action(() => {
|
|
11
|
+
const workspace = getWorkspaceDir();
|
|
12
|
+
const skillDirectory = resolveBundledClawclawSkill();
|
|
13
|
+
const root = dirname(dirname(skillDirectory));
|
|
14
|
+
const {version} = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
|
|
15
|
+
console.log(JSON.stringify({ protocolVersion: 1, version, workspace, runtimeDirectory: getRuntimeDir(workspace),
|
|
16
|
+
skillDirectory, executable: process.execPath, cli: join(root, 'bin', 'clawclaw-cli.mjs') }));
|
|
17
|
+
});
|
|
18
|
+
command.command('skills').option('--json').action(async () => {
|
|
19
|
+
const { AuthStore } = await import('../lib/auth.js');
|
|
20
|
+
const { accountManagedSkillSources } = await import('../lib/agent-workspace-skills.js');
|
|
21
|
+
const profile = new AuthStore().getActive();
|
|
22
|
+
const sources = profile ? accountManagedSkillSources(getWorkspaceDir(), profile) : new Map<string, string>();
|
|
23
|
+
console.log(JSON.stringify(Array.from(sources, ([name, directory]) => ({ name, directory }))));
|
|
24
|
+
});
|
|
25
|
+
return command;
|
|
26
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { tryAcquireRuntimeLock } from '@myclaw163/game-agent-runtime/owner/runtime-lock.js';
|
|
3
|
+
import { AuthStore } from './auth.js';
|
|
4
|
+
import { getWorkspaceDir } from './init-command.js';
|
|
5
|
+
import { getUserDataAccountDir } from './user-data.js';
|
|
6
|
+
|
|
7
|
+
/** 终端与各客户端共用账号资源;进程退出时操作系统释放写锁。 */
|
|
8
|
+
export function acquireAccountResourceLock() {
|
|
9
|
+
const profile = new AuthStore().getActive();
|
|
10
|
+
if (!profile) return;
|
|
11
|
+
const lock = tryAcquireRuntimeLock(join(getUserDataAccountDir(getWorkspaceDir(), profile), '.resource-lock'));
|
|
12
|
+
if (!lock) throw new Error('ACCOUNT_RESOURCES_BUSY: another command is using this account’s resources. Retry after it finishes.');
|
|
13
|
+
return lock;
|
|
14
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext } from './harness-context.js';
|
|
1
2
|
import { isPackageManagedSkill, reservedSkillName } from './package-skills.js';
|
|
2
3
|
import {
|
|
3
4
|
existsSync,
|
|
@@ -216,7 +217,7 @@ export function inspectSkillNameConflicts(
|
|
|
216
217
|
});
|
|
217
218
|
}
|
|
218
219
|
|
|
219
|
-
function accountManagedSkillSources(
|
|
220
|
+
export function accountManagedSkillSources(
|
|
220
221
|
workspaceDir: string,
|
|
221
222
|
profile: Pick<AuthProfile, 'apiKey'>,
|
|
222
223
|
includeInactive = false,
|
|
@@ -262,7 +263,7 @@ export function switchActiveAccountSkillLinks(
|
|
|
262
263
|
nextProfile: Pick<AuthProfile, 'apiKey'> | null,
|
|
263
264
|
dependencies: Pick<AgentWorkspaceSkillDependencies, 'targets' | 'linkTarget' | 'unlinkTarget'> = {},
|
|
264
265
|
): AccountSkillLinkSwitchResult {
|
|
265
|
-
if (previousProfile?.apiKey === nextProfile?.apiKey) return { removed: [], linked: [] };
|
|
266
|
+
if (harnessContext() || previousProfile?.apiKey === nextProfile?.apiKey) return { removed: [], linked: [] };
|
|
266
267
|
const guard = tryAcquireWorkspaceRuntimeLock(workspaceDir);
|
|
267
268
|
if (!guard) throw new Error('A ClawClaw runtime is running in this workspace. Stop it before switching accounts.');
|
|
268
269
|
guard.release();
|
package/src/lib/desktop-mode.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { harnessContext } from './harness-context.js';
|
|
2
|
+
|
|
1
3
|
export function isDesktopMode(env: NodeJS.ProcessEnv = process.env): boolean {
|
|
4
|
+
const mode = harnessContext(env)?.auth;
|
|
5
|
+
if (mode) return mode === 'managed';
|
|
2
6
|
return env.CLAWCLAW_IS_DESKTOP === 'true';
|
|
3
7
|
}
|
|
4
8
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
|
|
4
|
+
export function harnessContext(env: NodeJS.ProcessEnv = process.env) {
|
|
5
|
+
const { CLAWCLAW_HOST_KIND: kind, CLAWCLAW_HOST_INSTANCE_ID: instance, CLAWCLAW_HOST_SESSION_ID: session, CLAWCLAW_AUTH_MODE: auth } = env;
|
|
6
|
+
// 已发布的宿主仅传 Lobby 身份。显式声明客户端类型才启用隔离目录。
|
|
7
|
+
if (kind === undefined && auth === undefined) return undefined;
|
|
8
|
+
if (!kind || !/^[a-z][a-z0-9-]{0,63}$/.test(kind) || !instance || !/^[^\s\p{Cc}]{1,128}$/u.test(instance) ||
|
|
9
|
+
(session !== undefined && !/^[^\s\p{Cc}]{1,128}$/u.test(session)) ||
|
|
10
|
+
(auth !== undefined && auth !== 'managed' && auth !== 'standalone')) {
|
|
11
|
+
throw new Error('INVALID_HARNESS_CONTEXT: provide a valid kind, persistent instance ID and optional session/auth mode.');
|
|
12
|
+
}
|
|
13
|
+
return { kind, instance, session, auth };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function stateRoot(workspace: string): string {
|
|
17
|
+
const context = harnessContext();
|
|
18
|
+
if (!context) return workspace;
|
|
19
|
+
const id = createHash('sha256').update(JSON.stringify([context.kind, context.instance])).digest('hex');
|
|
20
|
+
return join(workspace, 'contexts', id);
|
|
21
|
+
}
|
package/src/lib/init-command.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stateRoot } from './harness-context.js';
|
|
1
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
3
|
import { isAbsolute, join, resolve, win32 } from 'path';
|
|
3
4
|
import { homedir } from 'os';
|
|
@@ -78,7 +79,7 @@ export function cmdInit(force = false): { created: boolean; path: string } {
|
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
export function getAccountDir(accountId: string): string {
|
|
81
|
-
return join(getWorkspaceDir(), 'accounts', accountId);
|
|
82
|
+
return join(stateRoot(getWorkspaceDir()), 'accounts', accountId);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export function createAccountDirs(accountId: string): void {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { ApiError } from './http-transport.js';
|
|
4
4
|
|
|
5
5
|
/** Participation origin, not an authentication or GameSync session identity. */
|
|
@@ -45,7 +45,7 @@ export function validateLobbyHostContext(value: LobbyHostContext): LobbyHostCont
|
|
|
45
45
|
export function resolveLobbyHostContext(env: NodeJS.ProcessEnv = process.env): LobbyHostContext {
|
|
46
46
|
const instanceId = env.CLAWCLAW_HOST_INSTANCE_ID;
|
|
47
47
|
const sessionId = env.CLAWCLAW_HOST_SESSION_ID;
|
|
48
|
-
if (
|
|
48
|
+
if (env.CLAWCLAW_IS_DESKTOP === 'true') {
|
|
49
49
|
if (!validId(instanceId) || !validId(sessionId)) {
|
|
50
50
|
throw new InvalidHostContextError('Desktop must provide CLAWCLAW_HOST_INSTANCE_ID and CLAWCLAW_HOST_SESSION_ID (1–128 characters, no whitespace/control characters).');
|
|
51
51
|
}
|
package/src/lib/skill-host.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext } from './harness-context.js';
|
|
1
2
|
import { spawnSync } from 'node:child_process';
|
|
2
3
|
import {
|
|
3
4
|
cpSync,
|
|
@@ -100,6 +101,7 @@ function openClawSkillsDir(homeDir: string): string {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export function agentSkillTargets(name: string): string[] {
|
|
104
|
+
if (harnessContext()) return [];
|
|
103
105
|
const homeDir = homedir();
|
|
104
106
|
const claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || join(homeDir, '.claude');
|
|
105
107
|
const codexHome = process.env.CODEX_HOME?.trim() || join(homeDir, '.codex');
|
package/src/lib/user-data.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { harnessContext, stateRoot } from './harness-context.js';
|
|
1
2
|
import {
|
|
2
3
|
copyFileSync,
|
|
3
4
|
existsSync,
|
|
@@ -39,11 +40,11 @@ export function getUserDataDir(workspaceDir: string): string {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
export function getRuntimeDir(workspaceDir: string): string {
|
|
42
|
-
return join(workspaceDir, RUNTIME_DIR);
|
|
43
|
+
return join(stateRoot(workspaceDir), RUNTIME_DIR);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
export function getUserDataAuthFile(workspaceDir: string): string {
|
|
46
|
-
return join(getUserDataDir(workspaceDir), 'auth.json');
|
|
47
|
+
return join(getUserDataDir(stateRoot(workspaceDir)), 'auth.json');
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
export function getRuntimeAuthStateFile(workspaceDir: string): string {
|
|
@@ -404,6 +405,8 @@ export function ensureUserDataLayout(workspaceDir: string): UserDataMigrationRes
|
|
|
404
405
|
ensureDir(getUserDataHubDir(workspaceDir));
|
|
405
406
|
ensureDir(getRuntimeDir(workspaceDir));
|
|
406
407
|
|
|
408
|
+
// 客户端不导入终端已有的凭据。
|
|
409
|
+
if (harnessContext()) return result;
|
|
407
410
|
const auth = migrateAuth(workspaceDir, result);
|
|
408
411
|
migrateAccountFiles(workspaceDir, auth, result);
|
|
409
412
|
writeMigrationMarker(workspaceDir, result);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stateRoot } from '../../lib/harness-context.js';
|
|
1
2
|
import { timeStartup } from '../../../bin/startup-trace.mjs';
|
|
2
3
|
import { createHash, randomUUID } from 'node:crypto';
|
|
3
4
|
import { mkdirSync, readFileSync, realpathSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
@@ -47,7 +48,7 @@ export function workspaceOwnerRecordPath(workspaceDir = getWorkspaceDir()): stri
|
|
|
47
48
|
return join(getRuntimeDir(workspaceDir), 'owner.json');
|
|
48
49
|
}
|
|
49
50
|
export function workspaceOwnerIdentity(workspaceDir = getWorkspaceDir()): string {
|
|
50
|
-
const real = realpathSync(workspaceDir);
|
|
51
|
+
const real = realpathSync(stateRoot(workspaceDir));
|
|
51
52
|
return createHash('sha256').update(process.platform === 'win32' ? real.toLowerCase() : real).digest('hex');
|
|
52
53
|
}
|
|
53
54
|
function readOwnerRecord(path: string): OwnerRecord | null {
|