@openclaw-cloud/agent-controller 3.1.0 → 3.1.1
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/api.d.ts +7 -0
- package/dist/api.js.map +1 -1
- package/dist/commands/bootstrap.d.ts +10 -1
- package/dist/commands/bootstrap.js +21 -69
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/plugin-update-cli.js +6 -3
- package/dist/commands/plugin-update-cli.js.map +1 -1
- package/dist/commands/update-skills.js +3 -3
- package/dist/commands/update-skills.js.map +1 -1
- package/dist/config-file.js +1 -0
- package/dist/config-file.js.map +1 -1
- package/dist/handlers/memory.d.ts +11 -1
- package/dist/handlers/memory.js.map +1 -1
- package/dist/handlers/update-config.js +2 -3
- package/dist/handlers/update-config.js.map +1 -1
- package/dist/index.js +21 -34
- package/dist/index.js.map +1 -1
- package/dist/providers/openclaw/gateway-adapter.js +2 -0
- package/dist/providers/openclaw/gateway-adapter.js.map +1 -1
- package/dist/utils/apply-config.d.ts +25 -6
- package/dist/utils/apply-config.js +77 -11
- package/dist/utils/apply-config.js.map +1 -1
- package/dist/utils/claude-env.d.ts +6 -0
- package/dist/utils/claude-env.js +11 -0
- package/dist/utils/claude-env.js.map +1 -1
- package/dist/utils/deploy-type.d.ts +16 -0
- package/dist/utils/deploy-type.js +34 -0
- package/dist/utils/deploy-type.js.map +1 -0
- package/dist/utils/exec.d.ts +9 -0
- package/dist/utils/exec.js +12 -1
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/knowledge-graph.d.ts +13 -1
- package/dist/utils/knowledge-graph.js +75 -29
- package/dist/utils/knowledge-graph.js.map +1 -1
- package/dist/utils/write-workspace-files.d.ts +1 -1
- package/dist/utils/write-workspace-files.js +22 -5
- package/dist/utils/write-workspace-files.js.map +1 -1
- package/package.json +9 -4
|
@@ -17,32 +17,49 @@ import path from 'node:path';
|
|
|
17
17
|
export async function writeWorkspaceFiles(files, workspaceDir) {
|
|
18
18
|
const fileNames = Object.keys(files);
|
|
19
19
|
if (fileNames.length === 0)
|
|
20
|
-
return;
|
|
20
|
+
return 0;
|
|
21
21
|
await fs.mkdir(workspaceDir, { recursive: true });
|
|
22
|
+
const written = [];
|
|
22
23
|
for (const [filePath, content] of Object.entries(files)) {
|
|
24
|
+
// Reject any key that escapes the workspace. The file_write handler applies
|
|
25
|
+
// the same sandbox; writeWorkspaceFiles previously had no guard, so a
|
|
26
|
+
// backend-supplied key like "../../etc/openclaw/agent.env" or an absolute
|
|
27
|
+
// path could write outside the workspace.
|
|
23
28
|
const fullPath = path.join(workspaceDir, filePath);
|
|
29
|
+
const rel = path.relative(workspaceDir, fullPath);
|
|
30
|
+
// Segment-aware containment: reject absolute keys and real ".." traversal,
|
|
31
|
+
// but allow filenames that merely contain ".." (e.g. "notes..v2.md").
|
|
32
|
+
if (path.isAbsolute(filePath) ||
|
|
33
|
+
rel === '..' ||
|
|
34
|
+
rel.startsWith('..' + path.sep) ||
|
|
35
|
+
path.isAbsolute(rel)) {
|
|
36
|
+
console.error(` ✗ ${filePath}: rejected (path escapes workspace)`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
24
39
|
await fs.mkdir(path.dirname(fullPath), { recursive: true });
|
|
25
40
|
try {
|
|
26
41
|
await fs.writeFile(fullPath, content);
|
|
42
|
+
written.push(filePath);
|
|
27
43
|
console.log(` ✓ ${filePath}`);
|
|
28
44
|
}
|
|
29
45
|
catch (err) {
|
|
30
46
|
console.error(` ✗ ${filePath}: ${err instanceof Error ? err.message : err}`);
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
|
-
// Make .sh files executable
|
|
34
|
-
for (const filePath of
|
|
49
|
+
// Make .sh files executable (only the ones we actually wrote)
|
|
50
|
+
for (const filePath of written) {
|
|
35
51
|
if (filePath.endsWith('.sh')) {
|
|
36
52
|
const fullPath = path.join(workspaceDir, filePath);
|
|
37
53
|
await fs.chmod(fullPath, 0o755);
|
|
38
54
|
}
|
|
39
55
|
}
|
|
40
56
|
// Summary for deployed skills (under .agents/skills/<name>/...)
|
|
41
|
-
const skillFiles =
|
|
57
|
+
const skillFiles = written.filter((f) => f.startsWith('.agents/skills/'));
|
|
42
58
|
if (skillFiles.length > 0) {
|
|
43
59
|
const skills = [...new Set(skillFiles.map((f) => f.split('/')[2]))];
|
|
44
60
|
console.log(` ✓ skills deployed: ${skills.join(', ')}`);
|
|
45
61
|
}
|
|
46
|
-
console.log(` wrote ${
|
|
62
|
+
console.log(` wrote ${written.length} workspace files`);
|
|
63
|
+
return written.length;
|
|
47
64
|
}
|
|
48
65
|
//# sourceMappingURL=write-workspace-files.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-workspace-files.js","sourceRoot":"","sources":["../../src/utils/write-workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAA6B,EAC7B,YAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"write-workspace-files.js","sourceRoot":"","sources":["../../src/utils/write-workspace-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAA6B,EAC7B,YAAoB;IAEpB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAErC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE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ACH,CAAC;IAED,8DAA8D;IAC9D,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;YACnD,MAAM,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAED,gEAAgE;IAChE,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC1E,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,CAAC,wBAAwB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,MAAM,kBAAkB,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC,MAAM,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw-cloud/agent-controller",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"packageManager": "pnpm@11.5.2",
|
|
4
5
|
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
5
9
|
"main": "dist/index.js",
|
|
6
10
|
"bin": {
|
|
7
11
|
"agent-controller": "bin/agent-controller.js"
|
|
8
12
|
},
|
|
9
13
|
"scripts": {
|
|
10
14
|
"build": "tsc",
|
|
11
|
-
"prepublishOnly": "
|
|
12
|
-
"test": "
|
|
15
|
+
"prepublishOnly": "pnpm run build",
|
|
16
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --forceExit",
|
|
13
17
|
"start": "node bin/agent-controller.js",
|
|
14
|
-
"prepare": "[ -
|
|
18
|
+
"prepare": "[ -e .git ] && husky || true",
|
|
15
19
|
"lint": "eslint --fix ./src"
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
|
@@ -25,6 +29,7 @@
|
|
|
25
29
|
"zod": "^4.3.6"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
32
|
+
"@jest/globals": "^30.0.0",
|
|
28
33
|
"@semantic-release/git": "^10.0.1",
|
|
29
34
|
"@semantic-release/npm": "^13.1.5",
|
|
30
35
|
"@types/jest": "^30.0.0",
|