@dai_ming/plugin-deliverables 1.2.1 → 1.2.3
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/index.js +42 -3
- package/openclaw-plugin.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -287,6 +287,7 @@ function deliverableTypeForPath(filePath, isDirectory) {
|
|
|
287
287
|
|
|
288
288
|
function isAllowedWorkspacePath(candidatePath) {
|
|
289
289
|
const normalized = normalizeSlash(path.resolve(candidatePath));
|
|
290
|
+
// 老布局:根目录直接挂 workspace(保持向后兼容)。
|
|
290
291
|
if (
|
|
291
292
|
normalized.indexOf("/data/workspace-") === 0 ||
|
|
292
293
|
normalized.indexOf("/home/node/.openclaw/workspace") === 0
|
|
@@ -294,7 +295,13 @@ function isAllowedWorkspacePath(candidatePath) {
|
|
|
294
295
|
return true;
|
|
295
296
|
}
|
|
296
297
|
const openclawRoot = normalizeSlash(path.resolve(__dirname, "..", ".."));
|
|
297
|
-
|
|
298
|
+
if (normalized.indexOf(openclawRoot + "/workspace") === 0) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
// 新布局(多租户)及通用情况:绝对路径中任意位置含有 `xxx/workspace-*`
|
|
302
|
+
// 目录段都允许,覆盖 /data/tenants/<user>/workspace-<lobster>、
|
|
303
|
+
// /home/node/.openclaw/<user>/workspace-<lobster> 等。
|
|
304
|
+
return /\/workspace-[^/]+(?:\/|$)/.test(normalized);
|
|
298
305
|
}
|
|
299
306
|
|
|
300
307
|
function shouldIgnorePath(candidatePath) {
|
|
@@ -336,6 +343,38 @@ async function workspaceRoots() {
|
|
|
336
343
|
} catch (_err) {
|
|
337
344
|
// /data is not guaranteed in non-pod test environments.
|
|
338
345
|
}
|
|
346
|
+
// 多租户布局:枚举 <base>/<tenant-or-user>/workspace-* 下的 workspace 根目录,
|
|
347
|
+
// 覆盖 /data/tenants/<user>/workspace-<lobster>、
|
|
348
|
+
// /home/node/.openclaw/<user>/workspace-<lobster> 等。
|
|
349
|
+
for (const base of ["/data/tenants", "/home/node/.openclaw"]) {
|
|
350
|
+
let tenants;
|
|
351
|
+
try {
|
|
352
|
+
tenants = await fs.promises.readdir(base);
|
|
353
|
+
} catch (_err) {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
for (const tenant of tenants) {
|
|
357
|
+
if (!tenant || tenant.indexOf("workspace") === 0) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const tenantDir = path.join(base, tenant);
|
|
361
|
+
let children;
|
|
362
|
+
try {
|
|
363
|
+
children = await fs.promises.readdir(tenantDir);
|
|
364
|
+
} catch (_err) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
for (const child of children) {
|
|
368
|
+
if (!child || child.indexOf("workspace-") !== 0) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
const root = path.join(tenantDir, child);
|
|
372
|
+
if ((await safeStat(root)) && roots.indexOf(root) === -1) {
|
|
373
|
+
roots.push(root);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
339
378
|
const openclawRoot = path.resolve(__dirname, "..", "..");
|
|
340
379
|
try {
|
|
341
380
|
for (const entry of await fs.promises.readdir(openclawRoot)) {
|
|
@@ -880,7 +919,7 @@ function kbMultipartUpload(fileBuffers, fields, pathsArray) {
|
|
|
880
919
|
"X-API-Key": kbApiKey(),
|
|
881
920
|
"Content-Length": body.length,
|
|
882
921
|
},
|
|
883
|
-
timeout:
|
|
922
|
+
timeout: 30000,
|
|
884
923
|
},
|
|
885
924
|
(res) => {
|
|
886
925
|
const chunks = [];
|
|
@@ -907,7 +946,7 @@ function kbMultipartUpload(fileBuffers, fields, pathsArray) {
|
|
|
907
946
|
},
|
|
908
947
|
);
|
|
909
948
|
req.on("timeout", () => {
|
|
910
|
-
req.destroy(new Error("kb upload timeout after
|
|
949
|
+
req.destroy(new Error("kb upload timeout after 30s"));
|
|
911
950
|
});
|
|
912
951
|
req.on("error", reject);
|
|
913
952
|
req.write(body);
|
package/openclaw-plugin.json
CHANGED
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "plugin-deliverables",
|
|
3
3
|
"name": "Deliverables",
|
|
4
4
|
"description": "Deliverables runtime guard for upload-first file delivery with Palz split-send diagnostics.",
|
|
5
|
-
"version": "1.2.
|
|
5
|
+
"version": "1.2.3",
|
|
6
6
|
"skills": ["./skills"],
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
package/package.json
CHANGED