log-llm-config 1.0.22 → 1.0.24
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/log_config_files.js +59 -1
- package/package.json +1 -1
package/dist/log_config_files.js
CHANGED
|
@@ -174,6 +174,60 @@ const DIR_GLOB_BY_FILE_TYPE = {
|
|
|
174
174
|
claude_hooks: 'hooks.json',
|
|
175
175
|
claude_plugin_mcp: '.mcp.json',
|
|
176
176
|
};
|
|
177
|
+
/** Max depth for recursive glob (path_pattern containing **) to avoid runaway. */
|
|
178
|
+
const RECURSIVE_GLOB_MAX_DEPTH = 20;
|
|
179
|
+
/**
|
|
180
|
+
* Expand a path pattern containing double-star into concrete file paths by recursing from a base dir.
|
|
181
|
+
* Finds e.g. all .clawhub/lock.json under home when suffix is /.clawhub/lock.json.
|
|
182
|
+
* Path pattern format: <base>**<suffix>.
|
|
183
|
+
*/
|
|
184
|
+
function expandRecursiveGlobPathPattern(pathPattern, fileType, home) {
|
|
185
|
+
const norm = pathPattern.replace(/\\/g, '/');
|
|
186
|
+
const doubleStarIndex = norm.indexOf('**');
|
|
187
|
+
if (doubleStarIndex === -1)
|
|
188
|
+
return [];
|
|
189
|
+
const before = norm.slice(0, doubleStarIndex).replace(/\/+$/, '');
|
|
190
|
+
const after = norm.slice(doubleStarIndex + 2).replace(/^\/+/, '');
|
|
191
|
+
if (!after)
|
|
192
|
+
return [];
|
|
193
|
+
let basePath;
|
|
194
|
+
if (before === '~' || before.startsWith('~/')) {
|
|
195
|
+
basePath = join(home, before === '~' ? '' : before.slice(2));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return [];
|
|
199
|
+
}
|
|
200
|
+
const targets = [];
|
|
201
|
+
const parts = after.split('/');
|
|
202
|
+
const dirName = parts[0];
|
|
203
|
+
const fileName = parts.length > 1 ? parts[parts.length - 1] : null;
|
|
204
|
+
function walk(dir, depth) {
|
|
205
|
+
if (depth > RECURSIVE_GLOB_MAX_DEPTH)
|
|
206
|
+
return;
|
|
207
|
+
if (!existsSync(dir))
|
|
208
|
+
return;
|
|
209
|
+
try {
|
|
210
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
211
|
+
for (const entry of entries) {
|
|
212
|
+
const full = join(dir, entry.name);
|
|
213
|
+
if (entry.isDirectory()) {
|
|
214
|
+
if (entry.name === dirName) {
|
|
215
|
+
const filePath = parts.length === 1 ? full : join(full, ...parts.slice(1));
|
|
216
|
+
if (fileName && existsSync(filePath)) {
|
|
217
|
+
targets.push({ path: filePath, file_type: fileType });
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
walk(full, depth + 1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// ignore read errors
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
walk(basePath, 0);
|
|
229
|
+
return targets;
|
|
230
|
+
}
|
|
177
231
|
/**
|
|
178
232
|
* Expand a path pattern containing a single * into concrete directory paths.
|
|
179
233
|
* Example: ~/.claude/plugins/marketplaces/<name>/skills/ -> [ .../anthropic-agent-skills/skills, ... ].
|
|
@@ -274,6 +328,10 @@ function resolvePatternToTargets(pathPattern, fileType, projectRoot, home) {
|
|
|
274
328
|
}
|
|
275
329
|
return targets;
|
|
276
330
|
}
|
|
331
|
+
// Recursive ** glob: e.g. ~/**/.clawhub/lock.json -> find all .clawhub/lock.json under home
|
|
332
|
+
if (norm.includes('**')) {
|
|
333
|
+
return expandRecursiveGlobPathPattern(pathPattern, fileType, home);
|
|
334
|
+
}
|
|
277
335
|
// Single-* glob pattern: expand ~/.claude/plugins/marketplaces/*/skills/ etc.
|
|
278
336
|
if (norm.includes('*')) {
|
|
279
337
|
return expandGlobPathPattern(pathPattern, fileType, home, projectRoot);
|
|
@@ -2232,7 +2290,7 @@ async function sendConfigFilesBatch(configFiles, hardwareUuid, authKey, hookRequ
|
|
|
2232
2290
|
const signature = createSignature(payload, authKey.key);
|
|
2233
2291
|
const body = { ...payload, signature, key_id: authKey.key_id || '' };
|
|
2234
2292
|
try {
|
|
2235
|
-
const response = (await postStartupPayload(apiUrl, body));
|
|
2293
|
+
const response = (await postStartupPayload(apiUrl, body, 30000));
|
|
2236
2294
|
if (response.status === 'accepted') {
|
|
2237
2295
|
const accepted = typeof response.accepted === 'number' ? response.accepted : chunk.length;
|
|
2238
2296
|
const failedList = Array.isArray(response.failed) ? response.failed : [];
|