@a1hvdy/cc-openclaw 0.5.2 → 0.7.0
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/src/command-router/cc-handler.js +72 -0
- package/dist/src/command-router/cc-handler.js.map +1 -1
- package/dist/src/constants.d.ts +9 -0
- package/dist/src/constants.js +10 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/engines/persistent-session.d.ts +2 -0
- package/dist/src/engines/persistent-session.js +41 -11
- package/dist/src/engines/persistent-session.js.map +1 -1
- package/dist/src/lib/config.d.ts +2 -0
- package/dist/src/lib/config.js +19 -0
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/sysprompt-strip.js +12 -12
- package/dist/src/lib/sysprompt-strip.js.map +1 -1
- package/dist/src/lib/trajectory.d.ts +1 -1
- package/dist/src/lib/trajectory.js.map +1 -1
- package/dist/src/lib/vendor-paths.d.ts +6 -4
- package/dist/src/lib/vendor-paths.js +21 -14
- package/dist/src/lib/vendor-paths.js.map +1 -1
- package/dist/src/openai-compat/openai-compat.d.ts +7 -1
- package/dist/src/openai-compat/openai-compat.js +8 -1
- package/dist/src/openai-compat/openai-compat.js.map +1 -1
- package/dist/src/openai-compat/sse-translator.d.ts +23 -3
- package/dist/src/openai-compat/sse-translator.js +45 -6
- package/dist/src/openai-compat/sse-translator.js.map +1 -1
- package/dist/src/session-bootstrap/cwd-patch.js +59 -28
- package/dist/src/session-bootstrap/cwd-patch.js.map +1 -1
- package/dist/src/types.d.ts +1 -0
- package/package.json +2 -3
- package/vendor/base-oneshot-session.d.ts +0 -87
- package/vendor/base-oneshot-session.js +0 -227
- package/vendor/base-oneshot-session.js.map +0 -1
- package/vendor/circuit-breaker.d.ts +0 -21
- package/vendor/circuit-breaker.js +0 -47
- package/vendor/circuit-breaker.js.map +0 -1
- package/vendor/consensus.d.ts +0 -20
- package/vendor/consensus.js +0 -52
- package/vendor/consensus.js.map +0 -1
- package/vendor/constants.d.ts +0 -130
- package/vendor/constants.js +0 -139
- package/vendor/constants.js.map +0 -1
- package/vendor/council.d.ts +0 -67
- package/vendor/council.js +0 -913
- package/vendor/council.js.map +0 -1
- package/vendor/embedded-server.d.ts +0 -25
- package/vendor/embedded-server.js +0 -373
- package/vendor/embedded-server.js.map +0 -1
- package/vendor/inbox-manager.d.ts +0 -38
- package/vendor/inbox-manager.js +0 -111
- package/vendor/inbox-manager.js.map +0 -1
- package/vendor/index.d.ts +0 -63
- package/vendor/index.js +0 -705
- package/vendor/index.js.map +0 -1
- package/vendor/logger.d.ts +0 -16
- package/vendor/logger.js +0 -44
- package/vendor/logger.js.map +0 -1
- package/vendor/models.d.ts +0 -69
- package/vendor/models.js +0 -289
- package/vendor/models.js.map +0 -1
- package/vendor/openai-compat.d.ts +0 -197
- package/vendor/openai-compat.js +0 -765
- package/vendor/openai-compat.js.map +0 -1
- package/vendor/persistent-codex-session.d.ts +0 -16
- package/vendor/persistent-codex-session.js +0 -105
- package/vendor/persistent-codex-session.js.map +0 -1
- package/vendor/persistent-cursor-session.d.ts +0 -21
- package/vendor/persistent-cursor-session.js +0 -241
- package/vendor/persistent-cursor-session.js.map +0 -1
- package/vendor/persistent-custom-session.d.ts +0 -78
- package/vendor/persistent-custom-session.js +0 -937
- package/vendor/persistent-custom-session.js.map +0 -1
- package/vendor/persistent-gemini-session.d.ts +0 -21
- package/vendor/persistent-gemini-session.js +0 -216
- package/vendor/persistent-gemini-session.js.map +0 -1
- package/vendor/persistent-session.d.ts +0 -74
- package/vendor/persistent-session.js +0 -684
- package/vendor/persistent-session.js.map +0 -1
- package/vendor/proxy/anthropic-adapter.d.ts +0 -136
- package/vendor/proxy/anthropic-adapter.js +0 -392
- package/vendor/proxy/anthropic-adapter.js.map +0 -1
- package/vendor/proxy/handler.d.ts +0 -39
- package/vendor/proxy/handler.js +0 -323
- package/vendor/proxy/handler.js.map +0 -1
- package/vendor/proxy/schema-cleaner.d.ts +0 -11
- package/vendor/proxy/schema-cleaner.js +0 -34
- package/vendor/proxy/schema-cleaner.js.map +0 -1
- package/vendor/proxy/thought-cache.d.ts +0 -19
- package/vendor/proxy/thought-cache.js +0 -53
- package/vendor/proxy/thought-cache.js.map +0 -1
- package/vendor/session-manager.d.ts +0 -211
- package/vendor/session-manager.js +0 -1345
- package/vendor/session-manager.js.map +0 -1
- package/vendor/skill-resolver.js +0 -107
- package/vendor/types.d.ts +0 -466
- package/vendor/types.js +0 -8
- package/vendor/types.js.map +0 -1
- package/vendor/validation.d.ts +0 -31
- package/vendor/validation.js +0 -104
- package/vendor/validation.js.map +0 -1
package/vendor/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,MAAM,CAAC,MAAM,aAAa,GAA2B,UAAU,EAAE,CAAC"}
|
package/vendor/validation.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared validation utilities for input sanitization.
|
|
3
|
-
*
|
|
4
|
-
* Used by both the plugin tool handlers (index.ts) and the embedded HTTP
|
|
5
|
-
* server (embedded-server.ts) to ensure consistent protection regardless
|
|
6
|
-
* of entry point.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Resolve and validate a working directory path.
|
|
10
|
-
*
|
|
11
|
-
* Prevents path traversal and blocks access to system-critical and
|
|
12
|
-
* sensitive directories. Resolves symlinks where possible to defeat
|
|
13
|
-
* symlink-based bypasses.
|
|
14
|
-
*/
|
|
15
|
-
export declare function sanitizeCwd(cwd: string | undefined): string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Validate that a string is a syntactically valid regular expression.
|
|
18
|
-
*
|
|
19
|
-
* Returns the compiled RegExp if valid, throws on invalid syntax.
|
|
20
|
-
* Note: this validates syntax only — it does not detect catastrophic
|
|
21
|
-
* backtracking (ReDoS) patterns.
|
|
22
|
-
*/
|
|
23
|
-
export declare function validateRegex(pattern: string): RegExp;
|
|
24
|
-
/**
|
|
25
|
-
* Validate a resource name (agent, skill, rule) to prevent path injection.
|
|
26
|
-
*
|
|
27
|
-
* Only allows alphanumeric characters, hyphens, and underscores.
|
|
28
|
-
* Rejects empty strings, dots, slashes, spaces, and any other characters
|
|
29
|
-
* that could be used for path traversal.
|
|
30
|
-
*/
|
|
31
|
-
export declare function validateName(name: string): string;
|
package/vendor/validation.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared validation utilities for input sanitization.
|
|
3
|
-
*
|
|
4
|
-
* Used by both the plugin tool handlers (index.ts) and the embedded HTTP
|
|
5
|
-
* server (embedded-server.ts) to ensure consistent protection regardless
|
|
6
|
-
* of entry point.
|
|
7
|
-
*/
|
|
8
|
-
import * as path from 'node:path';
|
|
9
|
-
import * as fs from 'node:fs';
|
|
10
|
-
import * as os from 'node:os';
|
|
11
|
-
// ─── Blocked Path Prefixes ─────────────────────────────────────────────────
|
|
12
|
-
/** System-critical directories that must never be used as a working directory */
|
|
13
|
-
const BLOCKED_PREFIXES = ['/etc', '/proc', '/sys', '/var/run', '/var/log', '/boot', '/sbin'];
|
|
14
|
-
/** Sensitive directories under the user's home that must never be used as cwd */
|
|
15
|
-
const BLOCKED_HOME_SUBDIRS = ['.ssh', '.gnupg', '.aws', '.config/gcloud'];
|
|
16
|
-
// ─── sanitizeCwd ────────────────────────────────────────────────────────────
|
|
17
|
-
/**
|
|
18
|
-
* Resolve and validate a working directory path.
|
|
19
|
-
*
|
|
20
|
-
* Prevents path traversal and blocks access to system-critical and
|
|
21
|
-
* sensitive directories. Resolves symlinks where possible to defeat
|
|
22
|
-
* symlink-based bypasses.
|
|
23
|
-
*/
|
|
24
|
-
export function sanitizeCwd(cwd) {
|
|
25
|
-
if (!cwd)
|
|
26
|
-
return undefined;
|
|
27
|
-
// Logical path: resolves .. and . but does NOT follow symlinks.
|
|
28
|
-
// This catches the obvious cases (/etc, /var/run, /sbin) on all platforms.
|
|
29
|
-
const logical = path.resolve(cwd);
|
|
30
|
-
// Real path: follows symlinks. This catches symlink-based bypasses
|
|
31
|
-
// (e.g. /tmp/safe → /etc). Falls back to logical for non-existent paths.
|
|
32
|
-
let real;
|
|
33
|
-
try {
|
|
34
|
-
real = fs.realpathSync(cwd);
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
real = logical;
|
|
38
|
-
}
|
|
39
|
-
// Collect all paths to check — logical, real, and their de-prefixed
|
|
40
|
-
// variants for macOS where /etc → /private/etc, /var → /private/var.
|
|
41
|
-
const pathsToCheck = new Set([logical, real]);
|
|
42
|
-
for (const p of [logical, real]) {
|
|
43
|
-
if (p.startsWith('/private/')) {
|
|
44
|
-
pathsToCheck.add(p.slice('/private'.length));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// Block filesystem root
|
|
48
|
-
for (const check of pathsToCheck) {
|
|
49
|
-
if (check === '/') {
|
|
50
|
-
throw new Error(`Unsafe working directory: ${logical}`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
// Block system-critical prefixes
|
|
54
|
-
for (const check of pathsToCheck) {
|
|
55
|
-
for (const prefix of BLOCKED_PREFIXES) {
|
|
56
|
-
if (check === prefix || check.startsWith(prefix + '/')) {
|
|
57
|
-
throw new Error(`Unsafe working directory: ${logical}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
// Block sensitive home subdirectories
|
|
62
|
-
const home = os.homedir();
|
|
63
|
-
for (const check of pathsToCheck) {
|
|
64
|
-
for (const subdir of BLOCKED_HOME_SUBDIRS) {
|
|
65
|
-
const sensitive = path.join(home, subdir);
|
|
66
|
-
if (check === sensitive || check.startsWith(sensitive + '/')) {
|
|
67
|
-
throw new Error(`Unsafe working directory: ${logical}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return real;
|
|
72
|
-
}
|
|
73
|
-
// ─── validateRegex ──────────────────────────────────────────────────────────
|
|
74
|
-
/**
|
|
75
|
-
* Validate that a string is a syntactically valid regular expression.
|
|
76
|
-
*
|
|
77
|
-
* Returns the compiled RegExp if valid, throws on invalid syntax.
|
|
78
|
-
* Note: this validates syntax only — it does not detect catastrophic
|
|
79
|
-
* backtracking (ReDoS) patterns.
|
|
80
|
-
*/
|
|
81
|
-
export function validateRegex(pattern) {
|
|
82
|
-
try {
|
|
83
|
-
return new RegExp(pattern, 'i');
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
throw new Error(`Invalid regex pattern: ${err.message}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// ─── validateName ───────────────────────────────────────────────────────────
|
|
90
|
-
const VALID_NAME = /^[a-zA-Z0-9_-]+$/;
|
|
91
|
-
/**
|
|
92
|
-
* Validate a resource name (agent, skill, rule) to prevent path injection.
|
|
93
|
-
*
|
|
94
|
-
* Only allows alphanumeric characters, hyphens, and underscores.
|
|
95
|
-
* Rejects empty strings, dots, slashes, spaces, and any other characters
|
|
96
|
-
* that could be used for path traversal.
|
|
97
|
-
*/
|
|
98
|
-
export function validateName(name) {
|
|
99
|
-
if (!name || !VALID_NAME.test(name)) {
|
|
100
|
-
throw new Error(`Invalid name '${name}': must be non-empty and match /^[a-zA-Z0-9_-]+$/`);
|
|
101
|
-
}
|
|
102
|
-
return name;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=validation.js.map
|
package/vendor/validation.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation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