@tjamescouch/agentchat 0.18.2 → 0.18.5
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/bin/agentchat.js +1 -2
- package/lib/daemon.js +15 -1
- package/package.json +1 -1
package/bin/agentchat.js
CHANGED
|
@@ -1581,8 +1581,7 @@ if (!firstArg || !subcommands.includes(firstArg)) {
|
|
|
1581
1581
|
: `Connect to agentchat and introduce yourself in #general. Read SKILL.md if you need help.`;
|
|
1582
1582
|
|
|
1583
1583
|
const claude = spawn('claude', [prompt], {
|
|
1584
|
-
stdio: 'inherit'
|
|
1585
|
-
shell: true
|
|
1584
|
+
stdio: 'inherit'
|
|
1586
1585
|
});
|
|
1587
1586
|
|
|
1588
1587
|
claude.on('error', (err) => {
|
package/lib/daemon.js
CHANGED
|
@@ -25,11 +25,25 @@ const RECONNECT_DELAY = 5000; // 5 seconds
|
|
|
25
25
|
const MAX_RECONNECT_TIME = 10 * 60 * 1000; // 10 minutes default
|
|
26
26
|
const OUTBOX_POLL_INTERVAL = 500; // 500ms
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Validate instance name to prevent path traversal
|
|
30
|
+
* Only allows alphanumeric, hyphens, and underscores
|
|
31
|
+
*/
|
|
32
|
+
function validateInstanceName(name) {
|
|
33
|
+
if (!name || typeof name !== 'string') {
|
|
34
|
+
return 'default';
|
|
35
|
+
}
|
|
36
|
+
// Strip any path separators and dangerous characters
|
|
37
|
+
const sanitized = name.replace(/[^a-zA-Z0-9_-]/g, '');
|
|
38
|
+
return sanitized || 'default';
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
/**
|
|
29
42
|
* Get paths for a daemon instance
|
|
30
43
|
*/
|
|
31
44
|
export function getDaemonPaths(instanceName = DEFAULT_INSTANCE) {
|
|
32
|
-
const
|
|
45
|
+
const safeName = validateInstanceName(instanceName);
|
|
46
|
+
const instanceDir = path.join(DAEMONS_DIR, safeName);
|
|
33
47
|
return {
|
|
34
48
|
dir: instanceDir,
|
|
35
49
|
inbox: path.join(instanceDir, 'inbox.jsonl'),
|