@clawos-dev/clawd 0.2.112-beta.212.a6b6915 → 0.2.112-beta.214.dc7a4d7
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/cli.cjs +90 -65
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -7649,7 +7649,7 @@ var require_thread_stream = __commonJS({
|
|
|
7649
7649
|
var { version: version2 } = require_package();
|
|
7650
7650
|
var { EventEmitter: EventEmitter3 } = require("events");
|
|
7651
7651
|
var { Worker } = require("worker_threads");
|
|
7652
|
-
var { join:
|
|
7652
|
+
var { join: join13 } = require("path");
|
|
7653
7653
|
var { pathToFileURL } = require("url");
|
|
7654
7654
|
var { wait } = require_wait();
|
|
7655
7655
|
var {
|
|
@@ -7685,7 +7685,7 @@ var require_thread_stream = __commonJS({
|
|
|
7685
7685
|
function createWorker(stream, opts) {
|
|
7686
7686
|
const { filename, workerData } = opts;
|
|
7687
7687
|
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
|
7688
|
-
const toExecute = bundlerOverrides["thread-stream-worker"] ||
|
|
7688
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join13(__dirname, "lib", "worker.js");
|
|
7689
7689
|
const worker = new Worker(toExecute, {
|
|
7690
7690
|
...opts.workerOpts,
|
|
7691
7691
|
trackUnmanagedFds: false,
|
|
@@ -8071,7 +8071,7 @@ var require_transport = __commonJS({
|
|
|
8071
8071
|
"use strict";
|
|
8072
8072
|
var { createRequire } = require("module");
|
|
8073
8073
|
var getCallers = require_caller();
|
|
8074
|
-
var { join:
|
|
8074
|
+
var { join: join13, isAbsolute: isAbsolute2, sep: sep3 } = require("path");
|
|
8075
8075
|
var sleep = require_atomic_sleep();
|
|
8076
8076
|
var onExit = require_on_exit_leak_free();
|
|
8077
8077
|
var ThreadStream = require_thread_stream();
|
|
@@ -8134,7 +8134,7 @@ var require_transport = __commonJS({
|
|
|
8134
8134
|
throw new Error("only one of target or targets can be specified");
|
|
8135
8135
|
}
|
|
8136
8136
|
if (targets) {
|
|
8137
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
8137
|
+
target = bundlerOverrides["pino-worker"] || join13(__dirname, "worker.js");
|
|
8138
8138
|
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
8139
8139
|
return {
|
|
8140
8140
|
...dest,
|
|
@@ -8152,7 +8152,7 @@ var require_transport = __commonJS({
|
|
|
8152
8152
|
});
|
|
8153
8153
|
});
|
|
8154
8154
|
} else if (pipeline3) {
|
|
8155
|
-
target = bundlerOverrides["pino-worker"] ||
|
|
8155
|
+
target = bundlerOverrides["pino-worker"] || join13(__dirname, "worker.js");
|
|
8156
8156
|
options.pipelines = [pipeline3.map((dest) => {
|
|
8157
8157
|
return {
|
|
8158
8158
|
...dest,
|
|
@@ -8174,7 +8174,7 @@ var require_transport = __commonJS({
|
|
|
8174
8174
|
return origin;
|
|
8175
8175
|
}
|
|
8176
8176
|
if (origin === "pino/file") {
|
|
8177
|
-
return
|
|
8177
|
+
return join13(__dirname, "..", "file.js");
|
|
8178
8178
|
}
|
|
8179
8179
|
let fixTarget2;
|
|
8180
8180
|
for (const filePath of callers) {
|
|
@@ -9164,7 +9164,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
9164
9164
|
return circularValue;
|
|
9165
9165
|
}
|
|
9166
9166
|
let res = "";
|
|
9167
|
-
let
|
|
9167
|
+
let join13 = ",";
|
|
9168
9168
|
const originalIndentation = indentation;
|
|
9169
9169
|
if (Array.isArray(value)) {
|
|
9170
9170
|
if (value.length === 0) {
|
|
@@ -9178,7 +9178,7 @@ var require_safe_stable_stringify = __commonJS({
|
|
|
9178
9178
|
indentation += spacer;
|
|
9179
9179
|
res += `
|
|
9180
9180
|
${indentation}`;
|
|
9181
|
-
|
|
9181
|
+
join13 = `,
|
|
9182
9182
|
${indentation}`;
|
|
9183
9183
|
}
|
|
9184
9184
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -9186,13 +9186,13 @@ ${indentation}`;
|
|
|
9186
9186
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
9187
9187
|
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
9188
9188
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
9189
|
-
res +=
|
|
9189
|
+
res += join13;
|
|
9190
9190
|
}
|
|
9191
9191
|
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
9192
9192
|
res += tmp !== void 0 ? tmp : "null";
|
|
9193
9193
|
if (value.length - 1 > maximumBreadth) {
|
|
9194
9194
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9195
|
-
res += `${
|
|
9195
|
+
res += `${join13}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9196
9196
|
}
|
|
9197
9197
|
if (spacer !== "") {
|
|
9198
9198
|
res += `
|
|
@@ -9213,7 +9213,7 @@ ${originalIndentation}`;
|
|
|
9213
9213
|
let separator = "";
|
|
9214
9214
|
if (spacer !== "") {
|
|
9215
9215
|
indentation += spacer;
|
|
9216
|
-
|
|
9216
|
+
join13 = `,
|
|
9217
9217
|
${indentation}`;
|
|
9218
9218
|
whitespace = " ";
|
|
9219
9219
|
}
|
|
@@ -9227,13 +9227,13 @@ ${indentation}`;
|
|
|
9227
9227
|
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
|
9228
9228
|
if (tmp !== void 0) {
|
|
9229
9229
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
9230
|
-
separator =
|
|
9230
|
+
separator = join13;
|
|
9231
9231
|
}
|
|
9232
9232
|
}
|
|
9233
9233
|
if (keyLength > maximumBreadth) {
|
|
9234
9234
|
const removedKeys = keyLength - maximumBreadth;
|
|
9235
9235
|
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
9236
|
-
separator =
|
|
9236
|
+
separator = join13;
|
|
9237
9237
|
}
|
|
9238
9238
|
if (spacer !== "" && separator.length > 1) {
|
|
9239
9239
|
res = `
|
|
@@ -9274,7 +9274,7 @@ ${originalIndentation}`;
|
|
|
9274
9274
|
}
|
|
9275
9275
|
const originalIndentation = indentation;
|
|
9276
9276
|
let res = "";
|
|
9277
|
-
let
|
|
9277
|
+
let join13 = ",";
|
|
9278
9278
|
if (Array.isArray(value)) {
|
|
9279
9279
|
if (value.length === 0) {
|
|
9280
9280
|
return "[]";
|
|
@@ -9287,7 +9287,7 @@ ${originalIndentation}`;
|
|
|
9287
9287
|
indentation += spacer;
|
|
9288
9288
|
res += `
|
|
9289
9289
|
${indentation}`;
|
|
9290
|
-
|
|
9290
|
+
join13 = `,
|
|
9291
9291
|
${indentation}`;
|
|
9292
9292
|
}
|
|
9293
9293
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
@@ -9295,13 +9295,13 @@ ${indentation}`;
|
|
|
9295
9295
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
9296
9296
|
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
9297
9297
|
res += tmp2 !== void 0 ? tmp2 : "null";
|
|
9298
|
-
res +=
|
|
9298
|
+
res += join13;
|
|
9299
9299
|
}
|
|
9300
9300
|
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
9301
9301
|
res += tmp !== void 0 ? tmp : "null";
|
|
9302
9302
|
if (value.length - 1 > maximumBreadth) {
|
|
9303
9303
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9304
|
-
res += `${
|
|
9304
|
+
res += `${join13}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9305
9305
|
}
|
|
9306
9306
|
if (spacer !== "") {
|
|
9307
9307
|
res += `
|
|
@@ -9314,7 +9314,7 @@ ${originalIndentation}`;
|
|
|
9314
9314
|
let whitespace = "";
|
|
9315
9315
|
if (spacer !== "") {
|
|
9316
9316
|
indentation += spacer;
|
|
9317
|
-
|
|
9317
|
+
join13 = `,
|
|
9318
9318
|
${indentation}`;
|
|
9319
9319
|
whitespace = " ";
|
|
9320
9320
|
}
|
|
@@ -9323,7 +9323,7 @@ ${indentation}`;
|
|
|
9323
9323
|
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
|
9324
9324
|
if (tmp !== void 0) {
|
|
9325
9325
|
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
|
9326
|
-
separator =
|
|
9326
|
+
separator = join13;
|
|
9327
9327
|
}
|
|
9328
9328
|
}
|
|
9329
9329
|
if (spacer !== "" && separator.length > 1) {
|
|
@@ -9381,20 +9381,20 @@ ${originalIndentation}`;
|
|
|
9381
9381
|
indentation += spacer;
|
|
9382
9382
|
let res2 = `
|
|
9383
9383
|
${indentation}`;
|
|
9384
|
-
const
|
|
9384
|
+
const join14 = `,
|
|
9385
9385
|
${indentation}`;
|
|
9386
9386
|
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
9387
9387
|
let i = 0;
|
|
9388
9388
|
for (; i < maximumValuesToStringify - 1; i++) {
|
|
9389
9389
|
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
9390
9390
|
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
|
9391
|
-
res2 +=
|
|
9391
|
+
res2 += join14;
|
|
9392
9392
|
}
|
|
9393
9393
|
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
9394
9394
|
res2 += tmp !== void 0 ? tmp : "null";
|
|
9395
9395
|
if (value.length - 1 > maximumBreadth) {
|
|
9396
9396
|
const removedKeys = value.length - maximumBreadth - 1;
|
|
9397
|
-
res2 += `${
|
|
9397
|
+
res2 += `${join14}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
9398
9398
|
}
|
|
9399
9399
|
res2 += `
|
|
9400
9400
|
${originalIndentation}`;
|
|
@@ -9410,16 +9410,16 @@ ${originalIndentation}`;
|
|
|
9410
9410
|
return '"[Object]"';
|
|
9411
9411
|
}
|
|
9412
9412
|
indentation += spacer;
|
|
9413
|
-
const
|
|
9413
|
+
const join13 = `,
|
|
9414
9414
|
${indentation}`;
|
|
9415
9415
|
let res = "";
|
|
9416
9416
|
let separator = "";
|
|
9417
9417
|
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
9418
9418
|
if (isTypedArrayWithEntries(value)) {
|
|
9419
|
-
res += stringifyTypedArray(value,
|
|
9419
|
+
res += stringifyTypedArray(value, join13, maximumBreadth);
|
|
9420
9420
|
keys = keys.slice(value.length);
|
|
9421
9421
|
maximumPropertiesToStringify -= value.length;
|
|
9422
|
-
separator =
|
|
9422
|
+
separator = join13;
|
|
9423
9423
|
}
|
|
9424
9424
|
if (deterministic) {
|
|
9425
9425
|
keys = sort(keys, comparator);
|
|
@@ -9430,13 +9430,13 @@ ${indentation}`;
|
|
|
9430
9430
|
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
|
9431
9431
|
if (tmp !== void 0) {
|
|
9432
9432
|
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
|
9433
|
-
separator =
|
|
9433
|
+
separator = join13;
|
|
9434
9434
|
}
|
|
9435
9435
|
}
|
|
9436
9436
|
if (keyLength > maximumBreadth) {
|
|
9437
9437
|
const removedKeys = keyLength - maximumBreadth;
|
|
9438
9438
|
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
9439
|
-
separator =
|
|
9439
|
+
separator = join13;
|
|
9440
9440
|
}
|
|
9441
9441
|
if (separator !== "") {
|
|
9442
9442
|
res = `
|
|
@@ -21023,7 +21023,7 @@ var require_BufferList = __commonJS({
|
|
|
21023
21023
|
this.head = this.tail = null;
|
|
21024
21024
|
this.length = 0;
|
|
21025
21025
|
};
|
|
21026
|
-
BufferList.prototype.join = function
|
|
21026
|
+
BufferList.prototype.join = function join13(s) {
|
|
21027
21027
|
if (this.length === 0) return "";
|
|
21028
21028
|
var p2 = this.head;
|
|
21029
21029
|
var ret = "" + p2.data;
|
|
@@ -30480,7 +30480,7 @@ var require_lib3 = __commonJS({
|
|
|
30480
30480
|
// src/run-case/recorder.ts
|
|
30481
30481
|
function startRunCaseRecorder(opts) {
|
|
30482
30482
|
const now = opts.now ?? Date.now;
|
|
30483
|
-
const dir =
|
|
30483
|
+
const dir = import_node_path47.default.dirname(opts.recordPath);
|
|
30484
30484
|
let stream = null;
|
|
30485
30485
|
let closing = false;
|
|
30486
30486
|
let closedSettled = false;
|
|
@@ -30494,8 +30494,8 @@ function startRunCaseRecorder(opts) {
|
|
|
30494
30494
|
});
|
|
30495
30495
|
const ensureStream = () => {
|
|
30496
30496
|
if (stream) return stream;
|
|
30497
|
-
|
|
30498
|
-
stream =
|
|
30497
|
+
import_node_fs32.default.mkdirSync(dir, { recursive: true });
|
|
30498
|
+
stream = import_node_fs32.default.createWriteStream(opts.recordPath, { flags: "a" });
|
|
30499
30499
|
stream.on("close", () => closedResolve());
|
|
30500
30500
|
return stream;
|
|
30501
30501
|
};
|
|
@@ -30520,12 +30520,12 @@ function startRunCaseRecorder(opts) {
|
|
|
30520
30520
|
};
|
|
30521
30521
|
return { tap, close, closed };
|
|
30522
30522
|
}
|
|
30523
|
-
var
|
|
30523
|
+
var import_node_fs32, import_node_path47;
|
|
30524
30524
|
var init_recorder = __esm({
|
|
30525
30525
|
"src/run-case/recorder.ts"() {
|
|
30526
30526
|
"use strict";
|
|
30527
|
-
|
|
30528
|
-
|
|
30527
|
+
import_node_fs32 = __toESM(require("fs"), 1);
|
|
30528
|
+
import_node_path47 = __toESM(require("path"), 1);
|
|
30529
30529
|
}
|
|
30530
30530
|
});
|
|
30531
30531
|
|
|
@@ -30568,7 +30568,7 @@ var init_wire = __esm({
|
|
|
30568
30568
|
// src/run-case/controller.ts
|
|
30569
30569
|
async function runController(opts) {
|
|
30570
30570
|
const now = opts.now ?? Date.now;
|
|
30571
|
-
const cwd = opts.cwd ?? (0,
|
|
30571
|
+
const cwd = opts.cwd ?? (0, import_node_fs33.mkdtempSync)(import_node_path48.default.join(import_node_os19.default.tmpdir(), "clawd-runcase-"));
|
|
30572
30572
|
const ownsCwd = opts.cwd === void 0;
|
|
30573
30573
|
const recorder = startRunCaseRecorder({ recordPath: opts.record, now });
|
|
30574
30574
|
const spawnCtx = { cwd };
|
|
@@ -30729,19 +30729,19 @@ async function runController(opts) {
|
|
|
30729
30729
|
if (sigintHandler) process.off("SIGINT", sigintHandler);
|
|
30730
30730
|
if (ownsCwd) {
|
|
30731
30731
|
try {
|
|
30732
|
-
(0,
|
|
30732
|
+
(0, import_node_fs33.rmSync)(cwd, { recursive: true, force: true });
|
|
30733
30733
|
} catch {
|
|
30734
30734
|
}
|
|
30735
30735
|
}
|
|
30736
30736
|
return exitCode ?? 0;
|
|
30737
30737
|
}
|
|
30738
|
-
var
|
|
30738
|
+
var import_node_fs33, import_node_os19, import_node_path48;
|
|
30739
30739
|
var init_controller = __esm({
|
|
30740
30740
|
"src/run-case/controller.ts"() {
|
|
30741
30741
|
"use strict";
|
|
30742
|
-
|
|
30742
|
+
import_node_fs33 = require("fs");
|
|
30743
30743
|
import_node_os19 = __toESM(require("os"), 1);
|
|
30744
|
-
|
|
30744
|
+
import_node_path48 = __toESM(require("path"), 1);
|
|
30745
30745
|
init_claude();
|
|
30746
30746
|
init_stdout_splitter();
|
|
30747
30747
|
init_permission_stdio();
|
|
@@ -30976,8 +30976,8 @@ Env (advanced):
|
|
|
30976
30976
|
`;
|
|
30977
30977
|
|
|
30978
30978
|
// src/index.ts
|
|
30979
|
-
var
|
|
30980
|
-
var
|
|
30979
|
+
var import_node_path46 = __toESM(require("path"), 1);
|
|
30980
|
+
var import_node_fs31 = __toESM(require("fs"), 1);
|
|
30981
30981
|
|
|
30982
30982
|
// src/logger.ts
|
|
30983
30983
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
@@ -41745,7 +41745,14 @@ var ProjectStore = class {
|
|
|
41745
41745
|
|
|
41746
41746
|
// src/app-builder/dev-server-supervisor.ts
|
|
41747
41747
|
var import_node_child_process7 = require("child_process");
|
|
41748
|
+
var import_node_fs30 = require("fs");
|
|
41749
|
+
var import_node_path42 = require("path");
|
|
41748
41750
|
var import_node_events2 = require("events");
|
|
41751
|
+
function resolveDevCwd(projectCwd) {
|
|
41752
|
+
if ((0, import_node_fs30.existsSync)((0, import_node_path42.join)(projectCwd, "package.json"))) return projectCwd;
|
|
41753
|
+
if ((0, import_node_fs30.existsSync)((0, import_node_path42.join)(projectCwd, "web", "package.json"))) return (0, import_node_path42.join)(projectCwd, "web");
|
|
41754
|
+
return null;
|
|
41755
|
+
}
|
|
41749
41756
|
var DevServerSupervisor = class extends import_node_events2.EventEmitter {
|
|
41750
41757
|
running = /* @__PURE__ */ new Map();
|
|
41751
41758
|
// key: sessionId
|
|
@@ -41771,14 +41778,32 @@ var DevServerSupervisor = class extends import_node_events2.EventEmitter {
|
|
|
41771
41778
|
CLAWD_TUNNEL_HOST: args.tunnelHost ?? "",
|
|
41772
41779
|
CLAWD_PREVIEW_PORT: String(args.port)
|
|
41773
41780
|
};
|
|
41781
|
+
const resolvedCwd = resolveDevCwd(args.cwd);
|
|
41782
|
+
if (!resolvedCwd) {
|
|
41783
|
+
this.logger.warn("dev-server.no-manifest", {
|
|
41784
|
+
projectName: args.projectName,
|
|
41785
|
+
port: args.port,
|
|
41786
|
+
projectCwd: args.cwd,
|
|
41787
|
+
hint: "\u9879\u76EE\u76EE\u5F55\u91CC\u6CA1\u627E\u5230 package.json\uFF08\u9876\u5C42\u6216 web/ \u90FD\u6CA1\u6709\uFF09\u3002\u5148\u5728 chat \u91CC\u8BA9 assistant \u8DD1 extension-kit/scripts/new-extension.sh \u5B8C\u6210 scaffold"
|
|
41788
|
+
});
|
|
41789
|
+
this.emit("devServer:failed", {
|
|
41790
|
+
sessionId: args.sessionId,
|
|
41791
|
+
projectName: args.projectName,
|
|
41792
|
+
port: args.port,
|
|
41793
|
+
exitCode: null
|
|
41794
|
+
});
|
|
41795
|
+
return;
|
|
41796
|
+
}
|
|
41774
41797
|
this.logger.info("dev-server.start", {
|
|
41775
41798
|
projectName: args.projectName,
|
|
41776
41799
|
port: args.port,
|
|
41777
|
-
|
|
41800
|
+
projectCwd: args.cwd,
|
|
41801
|
+
resolvedCwd,
|
|
41802
|
+
usedSubdir: resolvedCwd !== args.cwd ? "web" : null,
|
|
41778
41803
|
sessionId: args.sessionId,
|
|
41779
41804
|
tunnelHost: args.tunnelHost
|
|
41780
41805
|
});
|
|
41781
|
-
const child = (0, import_node_child_process7.spawn)("pnpm", ["dev"], { cwd:
|
|
41806
|
+
const child = (0, import_node_child_process7.spawn)("pnpm", ["dev"], { cwd: resolvedCwd, env, stdio: "pipe", shell: true });
|
|
41782
41807
|
const entry = { ...args, process: child };
|
|
41783
41808
|
this.running.set(args.sessionId, entry);
|
|
41784
41809
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -42022,7 +42047,7 @@ function computeGrantForFrame(method, frame) {
|
|
|
42022
42047
|
|
|
42023
42048
|
// src/extension/runtime.ts
|
|
42024
42049
|
var import_node_child_process8 = require("child_process");
|
|
42025
|
-
var
|
|
42050
|
+
var import_node_path43 = __toESM(require("path"), 1);
|
|
42026
42051
|
var import_promises10 = require("timers/promises");
|
|
42027
42052
|
|
|
42028
42053
|
// src/extension/port-allocator.ts
|
|
@@ -42123,7 +42148,7 @@ var Runtime = class {
|
|
|
42123
42148
|
/\$CLAWOS_EXT_PORT/g,
|
|
42124
42149
|
String(port)
|
|
42125
42150
|
);
|
|
42126
|
-
const dir =
|
|
42151
|
+
const dir = import_node_path43.default.join(this.root, extId);
|
|
42127
42152
|
const env = {
|
|
42128
42153
|
...process.env,
|
|
42129
42154
|
CLAWOS_EXT_PORT: String(port),
|
|
@@ -42235,7 +42260,7 @@ ${handle.stderrTail}`
|
|
|
42235
42260
|
|
|
42236
42261
|
// src/extension/published-channels.ts
|
|
42237
42262
|
var import_promises11 = __toESM(require("fs/promises"), 1);
|
|
42238
|
-
var
|
|
42263
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
|
42239
42264
|
init_zod();
|
|
42240
42265
|
var PublishedChannelsError = class extends Error {
|
|
42241
42266
|
constructor(code, message) {
|
|
@@ -42334,7 +42359,7 @@ var PublishedChannelStore = class {
|
|
|
42334
42359
|
)
|
|
42335
42360
|
};
|
|
42336
42361
|
const tmp = `${this.filePath}.tmp`;
|
|
42337
|
-
await import_promises11.default.mkdir(
|
|
42362
|
+
await import_promises11.default.mkdir(import_node_path44.default.dirname(this.filePath), { recursive: true });
|
|
42338
42363
|
await import_promises11.default.writeFile(tmp, JSON.stringify(data, null, 2), { mode: 384 });
|
|
42339
42364
|
await import_promises11.default.rename(tmp, this.filePath);
|
|
42340
42365
|
}
|
|
@@ -42342,7 +42367,7 @@ var PublishedChannelStore = class {
|
|
|
42342
42367
|
|
|
42343
42368
|
// src/extension/bundle-cache.ts
|
|
42344
42369
|
var import_promises12 = __toESM(require("fs/promises"), 1);
|
|
42345
|
-
var
|
|
42370
|
+
var import_node_path45 = __toESM(require("path"), 1);
|
|
42346
42371
|
var BundleCache = class {
|
|
42347
42372
|
constructor(rootDir) {
|
|
42348
42373
|
this.rootDir = rootDir;
|
|
@@ -42351,14 +42376,14 @@ var BundleCache = class {
|
|
|
42351
42376
|
/** Atomic write: stage tmp → rename. Caller passes the hex sha256. */
|
|
42352
42377
|
async write(snapshotHash, buffer) {
|
|
42353
42378
|
await import_promises12.default.mkdir(this.rootDir, { recursive: true });
|
|
42354
|
-
const file =
|
|
42379
|
+
const file = import_node_path45.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
42355
42380
|
const tmp = `${file}.tmp`;
|
|
42356
42381
|
await import_promises12.default.writeFile(tmp, buffer, { mode: 384 });
|
|
42357
42382
|
await import_promises12.default.rename(tmp, file);
|
|
42358
42383
|
}
|
|
42359
42384
|
/** Returns the bundle bytes, or null when the file doesn't exist. */
|
|
42360
42385
|
async read(snapshotHash) {
|
|
42361
|
-
const file =
|
|
42386
|
+
const file = import_node_path45.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
42362
42387
|
try {
|
|
42363
42388
|
return await import_promises12.default.readFile(file);
|
|
42364
42389
|
} catch (e) {
|
|
@@ -42368,7 +42393,7 @@ var BundleCache = class {
|
|
|
42368
42393
|
}
|
|
42369
42394
|
/** Idempotent — missing file is not an error. */
|
|
42370
42395
|
async delete(snapshotHash) {
|
|
42371
|
-
const file =
|
|
42396
|
+
const file = import_node_path45.default.join(this.rootDir, `${snapshotHash}.zip`);
|
|
42372
42397
|
await import_promises12.default.rm(file, { force: true });
|
|
42373
42398
|
}
|
|
42374
42399
|
};
|
|
@@ -42377,7 +42402,7 @@ var BundleCache = class {
|
|
|
42377
42402
|
async function startDaemon(config) {
|
|
42378
42403
|
const logger = createLogger({
|
|
42379
42404
|
level: config.logLevel,
|
|
42380
|
-
file:
|
|
42405
|
+
file: import_node_path46.default.join(config.dataDir, "clawd.log")
|
|
42381
42406
|
});
|
|
42382
42407
|
logger.info("starting clawd", { version, config: { port: config.port, host: config.host, dataDir: config.dataDir } });
|
|
42383
42408
|
const stateMgr = new StateFileManager({ dataDir: config.dataDir });
|
|
@@ -42464,7 +42489,7 @@ async function startDaemon(config) {
|
|
|
42464
42489
|
const agents = new AgentsScanner();
|
|
42465
42490
|
const history = new ClaudeHistoryReader();
|
|
42466
42491
|
let transport = null;
|
|
42467
|
-
const personaStore = new PersonaStore(
|
|
42492
|
+
const personaStore = new PersonaStore(import_node_path46.default.join(config.dataDir, "personas"));
|
|
42468
42493
|
const defaultsRoot = findDefaultsRoot();
|
|
42469
42494
|
if (defaultsRoot) {
|
|
42470
42495
|
seedDefaultPersonas({ store: personaStore, defaultsRoot, logger });
|
|
@@ -42481,7 +42506,7 @@ async function startDaemon(config) {
|
|
|
42481
42506
|
getAdapter,
|
|
42482
42507
|
historyReader: history,
|
|
42483
42508
|
dataDir: config.dataDir,
|
|
42484
|
-
personaRoot:
|
|
42509
|
+
personaRoot: import_node_path46.default.join(config.dataDir, "personas"),
|
|
42485
42510
|
personaStore,
|
|
42486
42511
|
ownerDisplayName,
|
|
42487
42512
|
ownerPrincipalId,
|
|
@@ -42505,10 +42530,10 @@ async function startDaemon(config) {
|
|
|
42505
42530
|
// 文件可能 agent 写完又被自己删(罕见),用 size=0 / fallback mime 兜底。
|
|
42506
42531
|
attachmentGroup: {
|
|
42507
42532
|
onFileEdit: (input) => {
|
|
42508
|
-
const absPath =
|
|
42533
|
+
const absPath = import_node_path46.default.isAbsolute(input.relPath) ? input.relPath : import_node_path46.default.join(input.cwd, input.relPath);
|
|
42509
42534
|
let size = 0;
|
|
42510
42535
|
try {
|
|
42511
|
-
size =
|
|
42536
|
+
size = import_node_fs31.default.statSync(absPath).size;
|
|
42512
42537
|
} catch (err) {
|
|
42513
42538
|
logger.warn("attachment.onFileEdit stat failed", {
|
|
42514
42539
|
sessionId: input.sessionId,
|
|
@@ -42596,7 +42621,7 @@ async function startDaemon(config) {
|
|
|
42596
42621
|
await publishedChannelStore.load();
|
|
42597
42622
|
const bundleCache = new BundleCache(bundleCacheRoot());
|
|
42598
42623
|
const appBuilderStore = new ProjectStore(
|
|
42599
|
-
|
|
42624
|
+
import_node_path46.default.join(config.dataDir, "personas/persona-app-builder")
|
|
42600
42625
|
);
|
|
42601
42626
|
const devServerSupervisor = new DevServerSupervisor();
|
|
42602
42627
|
devServerSupervisor.setLogger(logger);
|
|
@@ -42646,10 +42671,10 @@ async function startDaemon(config) {
|
|
|
42646
42671
|
// 'persona/<pid>/owner',default 走 'default'。
|
|
42647
42672
|
getSessionScope: (sid) => manager.findOwnedSessionScope(sid),
|
|
42648
42673
|
// guest path guard:candidate 必须在 personaRoot 子树下
|
|
42649
|
-
personaRoot:
|
|
42674
|
+
personaRoot: import_node_path46.default.join(config.dataDir, "personas")
|
|
42650
42675
|
},
|
|
42651
42676
|
// workspace/git/history/skills/agents handler 共用的 guest path guard 锚点
|
|
42652
|
-
personaRoot:
|
|
42677
|
+
personaRoot: import_node_path46.default.join(config.dataDir, "personas"),
|
|
42653
42678
|
// capability:list / delete handler 依赖
|
|
42654
42679
|
capabilityManager,
|
|
42655
42680
|
// personal-cap:get 返回的 shareBaseUrl 用此 base URL:
|
|
@@ -42874,8 +42899,8 @@ async function startDaemon(config) {
|
|
|
42874
42899
|
const lines = [
|
|
42875
42900
|
`Tunnel: ${r.url}`,
|
|
42876
42901
|
...resolvedAuthToken ? [`Connect: ${connectUrl}`] : [],
|
|
42877
|
-
`Frpc config: ${
|
|
42878
|
-
`Frpc log: ${
|
|
42902
|
+
`Frpc config: ${import_node_path46.default.join(config.dataDir, "frpc.toml")}`,
|
|
42903
|
+
`Frpc log: ${import_node_path46.default.join(config.dataDir, "frpc.log")}`
|
|
42879
42904
|
];
|
|
42880
42905
|
const width = Math.max(...lines.map((l) => l.length));
|
|
42881
42906
|
const bar = "\u2550".repeat(width + 4);
|
|
@@ -42888,8 +42913,8 @@ ${bar}
|
|
|
42888
42913
|
|
|
42889
42914
|
`);
|
|
42890
42915
|
try {
|
|
42891
|
-
const connectPath =
|
|
42892
|
-
|
|
42916
|
+
const connectPath = import_node_path46.default.join(config.dataDir, "connect.txt");
|
|
42917
|
+
import_node_fs31.default.writeFileSync(connectPath, lines.join("\n") + "\n", { mode: 384 });
|
|
42893
42918
|
} catch {
|
|
42894
42919
|
}
|
|
42895
42920
|
} catch (err) {
|
|
@@ -42955,9 +42980,9 @@ ${bar}
|
|
|
42955
42980
|
};
|
|
42956
42981
|
}
|
|
42957
42982
|
function migrateDropPersonsDir(dataDir) {
|
|
42958
|
-
const dir =
|
|
42983
|
+
const dir = import_node_path46.default.join(dataDir, "persons");
|
|
42959
42984
|
try {
|
|
42960
|
-
|
|
42985
|
+
import_node_fs31.default.rmSync(dir, { recursive: true, force: true });
|
|
42961
42986
|
} catch {
|
|
42962
42987
|
}
|
|
42963
42988
|
}
|
package/package.json
CHANGED