@cydm/pie 4.7.0 → 4.9.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/README.md +51 -27
- package/dist/builtin/extensions/ask-user/index.js +4 -4
- package/dist/builtin/extensions/cron/index.js +916 -162
- package/dist/builtin/extensions/im-forward/README.md +24 -7
- package/dist/builtin/extensions/im-forward/index.js +6823 -3683
- package/dist/builtin/extensions/memory/index.js +76 -28
- package/dist/builtin/extensions/pie-ipc/README.md +2 -2
- package/dist/builtin/extensions/pie-ipc/index.js +421 -27
- package/dist/builtin/extensions/pie-proc/README.md +7 -7
- package/dist/builtin/extensions/pie-proc/index.js +453 -97
- package/dist/builtin/extensions/plan-mode/index.js +5 -5
- package/dist/builtin/extensions/subagent/index.js +8 -8
- package/dist/builtin/extensions/todo/index.js +4 -4
- package/dist/builtin/skills/chrome-devtools-axi/SKILL.md +35 -24
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-bridge.js +391 -123
- package/dist/builtin/skills/chrome-devtools-axi/chrome-devtools-axi-runtime.js +1 -1
- package/dist/builtin/skills/chrome-devtools-axi/chunk-HAUDUMDO.js +795 -0
- package/dist/builtin/skills/chrome-devtools-axi/{cli-NLPMVDGG.js → cli-K7ESY3XD.js} +1437 -231
- package/dist/builtin/skills/computer-use-axi/SKILL.md +26 -8
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-broker.js +465 -83
- package/dist/builtin/skills/computer-use-axi/computer-use-axi-runtime.js +75 -22
- package/dist/builtin/skills/tui-use/tui-use-daemon.cjs +451 -43
- package/dist/chunks/{chunk-3W3SXVPB.js → chunk-4UIUMTHG.js} +993 -371
- package/dist/chunks/chunk-6WKBQZWM.js +19 -0
- package/dist/chunks/{chunk-5KI4Y4LA.js → chunk-BA4Z27XT.js} +4 -3
- package/dist/chunks/{chunk-BLDI2GRF.js → chunk-DBDU3RRN.js} +1364 -446
- package/dist/chunks/{chunk-LAJXWOKS.js → chunk-EEC5PJTC.js} +11 -9
- package/dist/chunks/chunk-IZKHSUNQ.js +30 -0
- package/dist/chunks/{chunk-Y3I2UV5Y.js → chunk-LRHNAG4V.js} +349 -288
- package/dist/chunks/chunk-OU33ROFD.js +717 -0
- package/dist/chunks/{chunk-Z2FKA2ZH.js → chunk-PN6B54VT.js} +104 -22
- package/dist/chunks/{chunk-NHV2CALB.js → chunk-WYXUF4MP.js} +388 -32
- package/dist/chunks/{chunk-4PR34UZF.js → chunk-Z5KL6AO2.js} +159 -145
- package/dist/chunks/{host-image-fallback-N7RHNPYN.js → host-image-fallback-RASJSVZY.js} +1 -1
- package/dist/chunks/{manager-cli-NEZA46M5.js → manager-cli-Y6HM3MHA.js} +5 -5
- package/dist/chunks/{model-registry-3XAHXXTA.js → model-registry-5TLYILYR.js} +2 -2
- package/dist/chunks/{read-file-understanding-FMPXR6EJ.js → read-file-understanding-VPKDBV23.js} +5 -5
- package/dist/chunks/{src-B44QWSGM.js → src-2XI5P62J.js} +2 -2
- package/dist/chunks/{src-EGXFJ3WA.js → src-6QGGDHIW.js} +3 -3
- package/dist/chunks/{src-Q7LU27C2.js → src-CCEENRKC.js} +31 -1
- package/dist/chunks/{src-CLE5ILN4.js → src-DI4MCAGT.js} +20 -4
- package/dist/chunks/{test-stream-OR3EJBNF.js → test-stream-SYVWIPPW.js} +2 -2
- package/dist/cli.js +1918 -1489
- package/models.schema.json +271 -0
- package/package.json +2 -2
- package/dist/builtin/skills/chrome-devtools-axi/chunk-WOGAQ4P5.js +0 -399
- package/dist/chunks/chunk-7UAUDXZW.js +0 -1425
- package/dist/chunks/{chunk-CGSFBWOM.js → chunk-WBL73KRI.js} +3 -3
- package/dist/chunks/{manager-upgrade-CTU3ISCW.js → manager-upgrade-LSTOHBUV.js} +3 -3
|
@@ -2,17 +2,17 @@ import { createRequire as __createRequire } from "node:module"; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
createReadFileUnderstandingHandler,
|
|
4
4
|
modalityForReadFileUnderstandingKind
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import {
|
|
7
|
-
getLogger
|
|
8
|
-
} from "./chunk-3W3SXVPB.js";
|
|
5
|
+
} from "./chunk-DBDU3RRN.js";
|
|
9
6
|
import {
|
|
10
7
|
readImageFormat
|
|
11
8
|
} from "./chunk-F7EBZTZO.js";
|
|
9
|
+
import {
|
|
10
|
+
getLogger
|
|
11
|
+
} from "./chunk-4UIUMTHG.js";
|
|
12
12
|
|
|
13
13
|
// src/capabilities/read-file-understanding.ts
|
|
14
|
-
import * as
|
|
15
|
-
import * as
|
|
14
|
+
import * as path10 from "node:path";
|
|
15
|
+
import * as fs9 from "node:fs/promises";
|
|
16
16
|
|
|
17
17
|
// src/core/provider-capabilities.ts
|
|
18
18
|
var PLATFORM_DISPLAY_NAMES = {
|
|
@@ -870,8 +870,8 @@ function guessMimeType(filename) {
|
|
|
870
870
|
}
|
|
871
871
|
|
|
872
872
|
// src/files/file-manager.ts
|
|
873
|
-
import * as
|
|
874
|
-
import * as
|
|
873
|
+
import * as fs8 from "node:fs";
|
|
874
|
+
import * as path9 from "node:path";
|
|
875
875
|
import * as crypto2 from "node:crypto";
|
|
876
876
|
|
|
877
877
|
// src/files/file-cache.ts
|
|
@@ -2191,13 +2191,124 @@ var FFmpegProcessor = class {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
};
|
|
2193
2193
|
|
|
2194
|
-
// src/files/
|
|
2194
|
+
// src/files/directory-listing.ts
|
|
2195
|
+
import * as fs7 from "node:fs";
|
|
2196
|
+
import * as path8 from "node:path";
|
|
2195
2197
|
var DIRECTORY_LISTING_TTL_MS = 1500;
|
|
2198
|
+
var DirectoryListingCache = class {
|
|
2199
|
+
cache = /* @__PURE__ */ new Map();
|
|
2200
|
+
getListing(dirPath) {
|
|
2201
|
+
const resolvedDir = resolvePath(dirPath);
|
|
2202
|
+
const cached = this.cache.get(resolvedDir);
|
|
2203
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
2204
|
+
return cached;
|
|
2205
|
+
}
|
|
2206
|
+
const listing = {
|
|
2207
|
+
expiresAt: Date.now() + DIRECTORY_LISTING_TTL_MS,
|
|
2208
|
+
files: [],
|
|
2209
|
+
directories: []
|
|
2210
|
+
};
|
|
2211
|
+
try {
|
|
2212
|
+
const entries = fs7.readdirSync(resolvedDir, { withFileTypes: true });
|
|
2213
|
+
for (const entry of entries) {
|
|
2214
|
+
if (!entry.name || entry.name.startsWith(".")) {
|
|
2215
|
+
continue;
|
|
2216
|
+
}
|
|
2217
|
+
const fullPath = path8.join(resolvedDir, entry.name);
|
|
2218
|
+
if (entry.isDirectory()) {
|
|
2219
|
+
listing.directories.push({ name: entry.name, path: fullPath });
|
|
2220
|
+
continue;
|
|
2221
|
+
}
|
|
2222
|
+
let isDirectory = false;
|
|
2223
|
+
let isFile = entry.isFile();
|
|
2224
|
+
if (entry.isSymbolicLink()) {
|
|
2225
|
+
try {
|
|
2226
|
+
const targetStat = fs7.statSync(fullPath);
|
|
2227
|
+
isDirectory = targetStat.isDirectory();
|
|
2228
|
+
isFile = targetStat.isFile();
|
|
2229
|
+
} catch {
|
|
2230
|
+
continue;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
if (isDirectory) {
|
|
2234
|
+
listing.directories.push({ name: entry.name, path: fullPath });
|
|
2235
|
+
continue;
|
|
2236
|
+
}
|
|
2237
|
+
if (!isFile) {
|
|
2238
|
+
continue;
|
|
2239
|
+
}
|
|
2240
|
+
const type = FileCache.getFileTypeFromName(entry.name);
|
|
2241
|
+
if (!type) {
|
|
2242
|
+
continue;
|
|
2243
|
+
}
|
|
2244
|
+
const stat2 = fs7.statSync(fullPath);
|
|
2245
|
+
listing.files.push({
|
|
2246
|
+
name: entry.name,
|
|
2247
|
+
path: fullPath,
|
|
2248
|
+
size: stat2.size,
|
|
2249
|
+
type
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
} catch {
|
|
2253
|
+
}
|
|
2254
|
+
this.cache.set(resolvedDir, listing);
|
|
2255
|
+
return listing;
|
|
2256
|
+
}
|
|
2257
|
+
invalidateForPath(filePath) {
|
|
2258
|
+
this.cache.delete(path8.dirname(resolvePath(filePath)));
|
|
2259
|
+
}
|
|
2260
|
+
clear() {
|
|
2261
|
+
this.cache.clear();
|
|
2262
|
+
}
|
|
2263
|
+
getCwdFiles(getCacheStatus, query) {
|
|
2264
|
+
const files = [];
|
|
2265
|
+
const listing = this.getListing(process.cwd());
|
|
2266
|
+
const normalizedQuery = query?.toLowerCase();
|
|
2267
|
+
for (const entry of listing.files) {
|
|
2268
|
+
if (normalizedQuery && !entry.name.toLowerCase().includes(normalizedQuery)) {
|
|
2269
|
+
continue;
|
|
2270
|
+
}
|
|
2271
|
+
files.push({
|
|
2272
|
+
...entry,
|
|
2273
|
+
cacheStatus: getCacheStatus(entry.path)
|
|
2274
|
+
});
|
|
2275
|
+
}
|
|
2276
|
+
files.sort((a, b) => a.name.localeCompare(b.name, "zh-Hans-CN", { numeric: true }));
|
|
2277
|
+
return files;
|
|
2278
|
+
}
|
|
2279
|
+
listPathEntries(dirPath, getCacheStatus, query) {
|
|
2280
|
+
const directories = [];
|
|
2281
|
+
const files = [];
|
|
2282
|
+
const listing = this.getListing(resolvePath(dirPath));
|
|
2283
|
+
const normalizedQuery = query?.toLowerCase();
|
|
2284
|
+
for (const directory of listing.directories) {
|
|
2285
|
+
if (normalizedQuery && !directory.name.toLowerCase().includes(normalizedQuery)) {
|
|
2286
|
+
continue;
|
|
2287
|
+
}
|
|
2288
|
+
directories.push(directory);
|
|
2289
|
+
}
|
|
2290
|
+
for (const entry of listing.files) {
|
|
2291
|
+
if (normalizedQuery && !entry.name.toLowerCase().includes(normalizedQuery)) {
|
|
2292
|
+
continue;
|
|
2293
|
+
}
|
|
2294
|
+
files.push({
|
|
2295
|
+
...entry,
|
|
2296
|
+
cacheStatus: getCacheStatus(entry.path)
|
|
2297
|
+
});
|
|
2298
|
+
}
|
|
2299
|
+
const sorter = (a, b) => a.name.localeCompare(b.name, "zh-Hans-CN", { numeric: true });
|
|
2300
|
+
directories.sort(sorter);
|
|
2301
|
+
files.sort(sorter);
|
|
2302
|
+
return { directories, files };
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2305
|
+
|
|
2306
|
+
// src/files/file-manager.ts
|
|
2196
2307
|
var FileManager = class {
|
|
2197
2308
|
constructor(options) {
|
|
2198
2309
|
this.options = options;
|
|
2199
|
-
const baseDir = options.baseDir ||
|
|
2200
|
-
const sessionsDir = options.sessionsDir ||
|
|
2310
|
+
const baseDir = options.baseDir || path9.join(process.env.HOME || ".", ".pie", "files");
|
|
2311
|
+
const sessionsDir = options.sessionsDir || path9.join(process.env.HOME || ".", ".pie", "sessions");
|
|
2201
2312
|
this.fileCache = new FileCache(baseDir);
|
|
2202
2313
|
this.authFingerprint = options.apiKey ? this.buildAuthFingerprint(options.apiKey) : void 0;
|
|
2203
2314
|
this.sessionManager = new SessionFileManager(
|
|
@@ -2208,7 +2319,7 @@ var FileManager = class {
|
|
|
2208
2319
|
);
|
|
2209
2320
|
this.ffmpeg = new FFmpegProcessor(options.ffmpegPath);
|
|
2210
2321
|
this.platform = normalizeFileManagerPlatform(options.platform);
|
|
2211
|
-
this.tempDir =
|
|
2322
|
+
this.tempDir = path9.join(baseDir, "temp");
|
|
2212
2323
|
this.ensureDirectories();
|
|
2213
2324
|
}
|
|
2214
2325
|
options;
|
|
@@ -2217,11 +2328,11 @@ var FileManager = class {
|
|
|
2217
2328
|
ffmpeg;
|
|
2218
2329
|
platform;
|
|
2219
2330
|
tempDir;
|
|
2220
|
-
|
|
2331
|
+
directoryListing = new DirectoryListingCache();
|
|
2221
2332
|
authFingerprint;
|
|
2222
2333
|
ensureDirectories() {
|
|
2223
|
-
if (!
|
|
2224
|
-
|
|
2334
|
+
if (!fs8.existsSync(this.tempDir)) {
|
|
2335
|
+
fs8.mkdirSync(this.tempDir, { recursive: true });
|
|
2225
2336
|
}
|
|
2226
2337
|
}
|
|
2227
2338
|
// ============================================================================
|
|
@@ -2255,8 +2366,8 @@ var FileManager = class {
|
|
|
2255
2366
|
// ============================================================================
|
|
2256
2367
|
async stageLocal(filePath, options = {}) {
|
|
2257
2368
|
const resolvedPath = resolvePath(filePath);
|
|
2258
|
-
const sourceName = options.sourceName ||
|
|
2259
|
-
if (!
|
|
2369
|
+
const sourceName = options.sourceName || path9.basename(resolvedPath);
|
|
2370
|
+
if (!fs8.existsSync(resolvedPath)) {
|
|
2260
2371
|
throw new FileManagerError(
|
|
2261
2372
|
"LOCAL_FILE_MISSING" /* LOCAL_FILE_MISSING */,
|
|
2262
2373
|
`File not found: ${filePath}`
|
|
@@ -2272,7 +2383,7 @@ var FileManager = class {
|
|
|
2272
2383
|
this.fileCache.rememberPathHint(resolvedPath, hash, sourceName);
|
|
2273
2384
|
this.invalidateDirectoryListingCacheForPath(resolvedPath);
|
|
2274
2385
|
const entry = this.fileCache.getByHash(hash);
|
|
2275
|
-
const size = entry?.size ??
|
|
2386
|
+
const size = entry?.size ?? fs8.statSync(resolvedPath).size;
|
|
2276
2387
|
return {
|
|
2277
2388
|
success: true,
|
|
2278
2389
|
hash,
|
|
@@ -2286,8 +2397,8 @@ var FileManager = class {
|
|
|
2286
2397
|
}
|
|
2287
2398
|
async upload(filePath, options = {}) {
|
|
2288
2399
|
const resolvedPath = resolvePath(filePath);
|
|
2289
|
-
const sourceName = options.sourceName ||
|
|
2290
|
-
if (!
|
|
2400
|
+
const sourceName = options.sourceName || path9.basename(resolvedPath);
|
|
2401
|
+
if (!fs8.existsSync(resolvedPath)) {
|
|
2291
2402
|
throw new FileManagerError(
|
|
2292
2403
|
"LOCAL_FILE_MISSING" /* LOCAL_FILE_MISSING */,
|
|
2293
2404
|
`File not found: ${filePath}`
|
|
@@ -2368,7 +2479,7 @@ var FileManager = class {
|
|
|
2368
2479
|
// ============================================================================
|
|
2369
2480
|
async uploadPic(filePath, options = {}) {
|
|
2370
2481
|
const resolvedPath = resolvePath(filePath);
|
|
2371
|
-
if (!
|
|
2482
|
+
if (!fs8.existsSync(resolvedPath)) {
|
|
2372
2483
|
throw new FileManagerError(
|
|
2373
2484
|
"LOCAL_FILE_MISSING" /* LOCAL_FILE_MISSING */,
|
|
2374
2485
|
`File not found: ${filePath}`
|
|
@@ -2376,7 +2487,7 @@ var FileManager = class {
|
|
|
2376
2487
|
}
|
|
2377
2488
|
const cachedResult = await this.tryReuseCachedSourceUpload(
|
|
2378
2489
|
resolvedPath,
|
|
2379
|
-
options.sourceName ||
|
|
2490
|
+
options.sourceName || path9.basename(resolvedPath),
|
|
2380
2491
|
options.platform || this.platform
|
|
2381
2492
|
);
|
|
2382
2493
|
if (cachedResult) {
|
|
@@ -2393,12 +2504,12 @@ var FileManager = class {
|
|
|
2393
2504
|
const result = await this.upload(optimizedPath, {
|
|
2394
2505
|
...options,
|
|
2395
2506
|
purpose: "image",
|
|
2396
|
-
sourceName:
|
|
2507
|
+
sourceName: path9.basename(resolvedPath)
|
|
2397
2508
|
});
|
|
2398
|
-
this.fileCache.rememberPathHint(resolvedPath, result.hash,
|
|
2509
|
+
this.fileCache.rememberPathHint(resolvedPath, result.hash, path9.basename(resolvedPath));
|
|
2399
2510
|
this.invalidateDirectoryListingCacheForPath(resolvedPath);
|
|
2400
2511
|
try {
|
|
2401
|
-
|
|
2512
|
+
fs8.unlinkSync(optimizedPath);
|
|
2402
2513
|
} catch {
|
|
2403
2514
|
}
|
|
2404
2515
|
return result;
|
|
@@ -2408,7 +2519,7 @@ var FileManager = class {
|
|
|
2408
2519
|
// ============================================================================
|
|
2409
2520
|
async uploadVideo(filePath, options = {}) {
|
|
2410
2521
|
const resolvedPath = resolvePath(filePath);
|
|
2411
|
-
if (!
|
|
2522
|
+
if (!fs8.existsSync(resolvedPath)) {
|
|
2412
2523
|
throw new FileManagerError(
|
|
2413
2524
|
"LOCAL_FILE_MISSING" /* LOCAL_FILE_MISSING */,
|
|
2414
2525
|
`File not found: ${filePath}`
|
|
@@ -2416,7 +2527,7 @@ var FileManager = class {
|
|
|
2416
2527
|
}
|
|
2417
2528
|
const cachedResult = await this.tryReuseCachedSourceUpload(
|
|
2418
2529
|
resolvedPath,
|
|
2419
|
-
options.sourceName ||
|
|
2530
|
+
options.sourceName || path9.basename(resolvedPath),
|
|
2420
2531
|
options.platform || this.platform
|
|
2421
2532
|
);
|
|
2422
2533
|
if (cachedResult) {
|
|
@@ -2466,9 +2577,9 @@ var FileManager = class {
|
|
|
2466
2577
|
result = await this.upload(preprocessResult.output, {
|
|
2467
2578
|
...options,
|
|
2468
2579
|
purpose: "video",
|
|
2469
|
-
sourceName:
|
|
2580
|
+
sourceName: path9.basename(resolvedPath)
|
|
2470
2581
|
});
|
|
2471
|
-
this.fileCache.rememberPathHint(resolvedPath, result.hash,
|
|
2582
|
+
this.fileCache.rememberPathHint(resolvedPath, result.hash, path9.basename(resolvedPath));
|
|
2472
2583
|
this.invalidateDirectoryListingCacheForPath(resolvedPath);
|
|
2473
2584
|
} else {
|
|
2474
2585
|
throw new FileManagerError(
|
|
@@ -2560,7 +2671,7 @@ var FileManager = class {
|
|
|
2560
2671
|
if (sessionEntry) {
|
|
2561
2672
|
this.sessionManager.updateFileStatus(fileId, "error", void 0, error);
|
|
2562
2673
|
}
|
|
2563
|
-
this.
|
|
2674
|
+
this.directoryListing.clear();
|
|
2564
2675
|
return true;
|
|
2565
2676
|
}
|
|
2566
2677
|
async sync() {
|
|
@@ -2577,7 +2688,7 @@ var FileManager = class {
|
|
|
2577
2688
|
if (Object.keys(entry.platforms).length === 0) {
|
|
2578
2689
|
}
|
|
2579
2690
|
}
|
|
2580
|
-
this.
|
|
2691
|
+
this.directoryListing.clear();
|
|
2581
2692
|
}
|
|
2582
2693
|
// ============================================================================
|
|
2583
2694
|
// Mention Support
|
|
@@ -2760,7 +2871,7 @@ var FileManager = class {
|
|
|
2760
2871
|
* Detect purpose from file path based on extension
|
|
2761
2872
|
*/
|
|
2762
2873
|
detectPurpose(filePath) {
|
|
2763
|
-
const ext =
|
|
2874
|
+
const ext = path9.extname(filePath).toLowerCase();
|
|
2764
2875
|
switch (ext) {
|
|
2765
2876
|
case ".mp4":
|
|
2766
2877
|
case ".mov":
|
|
@@ -2802,13 +2913,13 @@ var FileManager = class {
|
|
|
2802
2913
|
cleanupTempFiles(output) {
|
|
2803
2914
|
try {
|
|
2804
2915
|
if (typeof output === "string") {
|
|
2805
|
-
if (
|
|
2806
|
-
|
|
2916
|
+
if (fs8.existsSync(output)) {
|
|
2917
|
+
fs8.unlinkSync(output);
|
|
2807
2918
|
}
|
|
2808
2919
|
} else {
|
|
2809
2920
|
for (const file of output) {
|
|
2810
|
-
if (
|
|
2811
|
-
|
|
2921
|
+
if (fs8.existsSync(file)) {
|
|
2922
|
+
fs8.unlinkSync(file);
|
|
2812
2923
|
}
|
|
2813
2924
|
}
|
|
2814
2925
|
}
|
|
@@ -2840,7 +2951,7 @@ var FileManager = class {
|
|
|
2840
2951
|
}];
|
|
2841
2952
|
}
|
|
2842
2953
|
const localPath = this.fileCache.getLocalPath(entry.hash);
|
|
2843
|
-
if (localPath &&
|
|
2954
|
+
if (localPath && fs8.existsSync(localPath)) {
|
|
2844
2955
|
return [{
|
|
2845
2956
|
fileId,
|
|
2846
2957
|
name: cacheEntry.name,
|
|
@@ -2860,50 +2971,10 @@ var FileManager = class {
|
|
|
2860
2971
|
* Used by @mention system to show local files
|
|
2861
2972
|
*/
|
|
2862
2973
|
getCwdFiles(query) {
|
|
2863
|
-
|
|
2864
|
-
const cwd = process.cwd();
|
|
2865
|
-
const listing = this.getDirectoryListing(cwd);
|
|
2866
|
-
const normalizedQuery = query?.toLowerCase();
|
|
2867
|
-
for (const entry of listing.files) {
|
|
2868
|
-
if (normalizedQuery && !entry.name.toLowerCase().includes(normalizedQuery)) {
|
|
2869
|
-
continue;
|
|
2870
|
-
}
|
|
2871
|
-
files.push({
|
|
2872
|
-
...entry,
|
|
2873
|
-
cacheStatus: this.getCacheStatusForPath(entry.path)
|
|
2874
|
-
});
|
|
2875
|
-
}
|
|
2876
|
-
files.sort((a, b) => a.name.localeCompare(b.name, "zh-Hans-CN", { numeric: true }));
|
|
2877
|
-
return files;
|
|
2974
|
+
return this.directoryListing.getCwdFiles((filePath) => this.getCacheStatusForPath(filePath), query);
|
|
2878
2975
|
}
|
|
2879
2976
|
listPathEntries(dirPath, query) {
|
|
2880
|
-
|
|
2881
|
-
const files = [];
|
|
2882
|
-
const resolvedDir = resolvePath(dirPath);
|
|
2883
|
-
const listing = this.getDirectoryListing(resolvedDir);
|
|
2884
|
-
const normalizedQuery = query?.toLowerCase();
|
|
2885
|
-
for (const directory of listing.directories) {
|
|
2886
|
-
if (normalizedQuery && !directory.name.toLowerCase().includes(normalizedQuery)) {
|
|
2887
|
-
continue;
|
|
2888
|
-
}
|
|
2889
|
-
directories.push(directory);
|
|
2890
|
-
}
|
|
2891
|
-
for (const entry of listing.files) {
|
|
2892
|
-
if (normalizedQuery && !entry.name.toLowerCase().includes(normalizedQuery)) {
|
|
2893
|
-
continue;
|
|
2894
|
-
}
|
|
2895
|
-
files.push({
|
|
2896
|
-
...entry,
|
|
2897
|
-
cacheStatus: this.getCacheStatusForPath(entry.path)
|
|
2898
|
-
});
|
|
2899
|
-
}
|
|
2900
|
-
const sorter = (a, b) => a.name.localeCompare(b.name, "zh-Hans-CN", { numeric: true });
|
|
2901
|
-
directories.sort(sorter);
|
|
2902
|
-
files.sort(sorter);
|
|
2903
|
-
return {
|
|
2904
|
-
directories,
|
|
2905
|
-
files
|
|
2906
|
-
};
|
|
2977
|
+
return this.directoryListing.listPathEntries(dirPath, (filePath) => this.getCacheStatusForPath(filePath), query);
|
|
2907
2978
|
}
|
|
2908
2979
|
getCacheStatusForPath(filePath) {
|
|
2909
2980
|
try {
|
|
@@ -2925,65 +2996,8 @@ var FileManager = class {
|
|
|
2925
2996
|
return void 0;
|
|
2926
2997
|
}
|
|
2927
2998
|
}
|
|
2928
|
-
getDirectoryListing(dirPath) {
|
|
2929
|
-
const resolvedDir = resolvePath(dirPath);
|
|
2930
|
-
const cached = this.directoryListingCache.get(resolvedDir);
|
|
2931
|
-
if (cached && cached.expiresAt > Date.now()) {
|
|
2932
|
-
return cached;
|
|
2933
|
-
}
|
|
2934
|
-
const listing = {
|
|
2935
|
-
expiresAt: Date.now() + DIRECTORY_LISTING_TTL_MS,
|
|
2936
|
-
files: [],
|
|
2937
|
-
directories: []
|
|
2938
|
-
};
|
|
2939
|
-
try {
|
|
2940
|
-
const entries = fs7.readdirSync(resolvedDir, { withFileTypes: true });
|
|
2941
|
-
for (const entry of entries) {
|
|
2942
|
-
if (!entry.name || entry.name.startsWith(".")) {
|
|
2943
|
-
continue;
|
|
2944
|
-
}
|
|
2945
|
-
const fullPath = path8.join(resolvedDir, entry.name);
|
|
2946
|
-
if (entry.isDirectory()) {
|
|
2947
|
-
listing.directories.push({ name: entry.name, path: fullPath });
|
|
2948
|
-
continue;
|
|
2949
|
-
}
|
|
2950
|
-
let isDirectory = false;
|
|
2951
|
-
let isFile = entry.isFile();
|
|
2952
|
-
if (entry.isSymbolicLink()) {
|
|
2953
|
-
try {
|
|
2954
|
-
const targetStat = fs7.statSync(fullPath);
|
|
2955
|
-
isDirectory = targetStat.isDirectory();
|
|
2956
|
-
isFile = targetStat.isFile();
|
|
2957
|
-
} catch {
|
|
2958
|
-
continue;
|
|
2959
|
-
}
|
|
2960
|
-
}
|
|
2961
|
-
if (isDirectory) {
|
|
2962
|
-
listing.directories.push({ name: entry.name, path: fullPath });
|
|
2963
|
-
continue;
|
|
2964
|
-
}
|
|
2965
|
-
if (!isFile) {
|
|
2966
|
-
continue;
|
|
2967
|
-
}
|
|
2968
|
-
const type = FileCache.getFileTypeFromName(entry.name);
|
|
2969
|
-
if (!type) {
|
|
2970
|
-
continue;
|
|
2971
|
-
}
|
|
2972
|
-
const stat2 = fs7.statSync(fullPath);
|
|
2973
|
-
listing.files.push({
|
|
2974
|
-
name: entry.name,
|
|
2975
|
-
path: fullPath,
|
|
2976
|
-
size: stat2.size,
|
|
2977
|
-
type
|
|
2978
|
-
});
|
|
2979
|
-
}
|
|
2980
|
-
} catch {
|
|
2981
|
-
}
|
|
2982
|
-
this.directoryListingCache.set(resolvedDir, listing);
|
|
2983
|
-
return listing;
|
|
2984
|
-
}
|
|
2985
2999
|
invalidateDirectoryListingCacheForPath(filePath) {
|
|
2986
|
-
this.
|
|
3000
|
+
this.directoryListing.invalidateForPath(filePath);
|
|
2987
3001
|
}
|
|
2988
3002
|
buildAuthFingerprint(apiKey) {
|
|
2989
3003
|
return crypto2.createHash("sha256").update(apiKey).digest("hex").slice(0, 16);
|
|
@@ -3032,8 +3046,8 @@ function createFileManagerForModel(params) {
|
|
|
3032
3046
|
sessionId: params.sessionId,
|
|
3033
3047
|
platform,
|
|
3034
3048
|
apiKey: params.apiKey,
|
|
3035
|
-
baseDir:
|
|
3036
|
-
sessionsDir:
|
|
3049
|
+
baseDir: path10.join(params.configDir, "files"),
|
|
3050
|
+
sessionsDir: path10.join(params.configDir, "sessions")
|
|
3037
3051
|
});
|
|
3038
3052
|
switch (getFileManagerAdapterKind(platform)) {
|
|
3039
3053
|
case "kimi":
|
|
@@ -3068,15 +3082,15 @@ function isInlineMediaRequest(request) {
|
|
|
3068
3082
|
return request.kind === "image" || request.kind === "video";
|
|
3069
3083
|
}
|
|
3070
3084
|
async function prepareInlineMediaContent(params) {
|
|
3071
|
-
const stat2 = await
|
|
3085
|
+
const stat2 = await fs9.stat(params.request.absolutePath);
|
|
3072
3086
|
const limitMb = getCapabilityLimitMb(params.model, params.request.kind);
|
|
3073
3087
|
const limitBytes = limitMb * 1024 * 1024;
|
|
3074
3088
|
if (stat2.size > limitBytes) {
|
|
3075
3089
|
throw new Error(
|
|
3076
|
-
`${params.request.kind} understanding for ${params.model.provider}/${params.model.id} supports inline files up to ${limitMb}MB; ${
|
|
3090
|
+
`${params.request.kind} understanding for ${params.model.provider}/${params.model.id} supports inline files up to ${limitMb}MB; ${path10.basename(params.request.displayPath)} is ${(stat2.size / 1024 / 1024).toFixed(1)}MB. Configure a model with a file upload adapter, or compress/trim the file before reading it.`
|
|
3077
3091
|
);
|
|
3078
3092
|
}
|
|
3079
|
-
const data = await
|
|
3093
|
+
const data = await fs9.readFile(params.request.absolutePath, "base64");
|
|
3080
3094
|
const content = params.request.kind === "video" ? [{ type: "video", data, mimeType: params.request.mimeType }] : [{ type: "image", data, mimeType: params.request.mimeType }];
|
|
3081
3095
|
return {
|
|
3082
3096
|
content,
|
|
@@ -3112,7 +3126,7 @@ async function prepareFileContent(configDir, params) {
|
|
|
3112
3126
|
});
|
|
3113
3127
|
if (params.request.kind === "document") {
|
|
3114
3128
|
const upload2 = await manager.upload(params.request.absolutePath, {
|
|
3115
|
-
sourceName:
|
|
3129
|
+
sourceName: path10.basename(params.request.displayPath),
|
|
3116
3130
|
purpose: "file-extract"
|
|
3117
3131
|
});
|
|
3118
3132
|
await waitForReady({ manager, fileId: upload2.fileId, timeoutMs: 12e4, signal: params.request.signal });
|
|
@@ -3135,8 +3149,8 @@ async function prepareFileContent(configDir, params) {
|
|
|
3135
3149
|
}
|
|
3136
3150
|
};
|
|
3137
3151
|
}
|
|
3138
|
-
const upload = params.request.kind === "video" ? await manager.uploadVideo(params.request.absolutePath, { sourceName:
|
|
3139
|
-
sourceName:
|
|
3152
|
+
const upload = params.request.kind === "video" ? await manager.uploadVideo(params.request.absolutePath, { sourceName: path10.basename(params.request.displayPath), strategy: "compress" }) : await manager.upload(params.request.absolutePath, {
|
|
3153
|
+
sourceName: path10.basename(params.request.displayPath),
|
|
3140
3154
|
purpose: params.request.kind === "image" ? "image" : "file-extract"
|
|
3141
3155
|
});
|
|
3142
3156
|
if (params.request.kind !== "video") {
|
|
@@ -5,7 +5,7 @@ import "./chunk-LZQXQOPJ.js";
|
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
async function describeImageViaUnderstandingChain(options) {
|
|
7
7
|
try {
|
|
8
|
-
const { understandReadFile } = await import("./read-file-understanding-
|
|
8
|
+
const { understandReadFile } = await import("./read-file-understanding-VPKDBV23.js");
|
|
9
9
|
const ext = options.filePath.toLowerCase().split(".").pop() ?? "";
|
|
10
10
|
const mimeType = ext === "png" ? "image/png" : ext === "gif" ? "image/gif" : ext === "webp" ? "image/webp" : "image/jpeg";
|
|
11
11
|
const result = await understandReadFile(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
getConfigDir
|
|
4
|
-
} from "./chunk-CBDQJMUI.js";
|
|
5
2
|
import {
|
|
6
3
|
readProcessCommandLine
|
|
7
4
|
} from "./chunk-7RJXKN7N.js";
|
|
5
|
+
import {
|
|
6
|
+
getConfigDir
|
|
7
|
+
} from "./chunk-CBDQJMUI.js";
|
|
8
8
|
import "./chunk-LZQXQOPJ.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/manager-cli.ts
|
|
@@ -346,7 +346,7 @@ function isTooBroadForWorkerSandbox(input) {
|
|
|
346
346
|
}
|
|
347
347
|
const root = path2.parse(resolved).root;
|
|
348
348
|
if (resolved === root || resolved === os.homedir()) return true;
|
|
349
|
-
const forbidden = [os.tmpdir(), "/tmp", "/var/tmp", "/private/tmp", "/private/var/tmp"];
|
|
349
|
+
const forbidden = [os.homedir(), os.tmpdir(), "/tmp", "/var/tmp", "/private/tmp", "/private/var/tmp"];
|
|
350
350
|
for (const candidate of forbidden) {
|
|
351
351
|
try {
|
|
352
352
|
const real = fs2.realpathSync(candidate);
|
|
@@ -907,7 +907,7 @@ function withStartLock(dir, fn) {
|
|
|
907
907
|
});
|
|
908
908
|
}
|
|
909
909
|
async function runUpgradeCommand(args) {
|
|
910
|
-
const { upgradePaths, performUpgrade, cliEffects, parseTarget } = await import("./manager-upgrade-
|
|
910
|
+
const { upgradePaths, performUpgrade, cliEffects, parseTarget } = await import("./manager-upgrade-LSTOHBUV.js");
|
|
911
911
|
const targetIdx = args.indexOf("--target");
|
|
912
912
|
if (targetIdx >= 0 && typeof args[targetIdx + 1] !== "string") {
|
|
913
913
|
console.error('--target expects "latest" or an x.y.z version (no value given)');
|
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
assertNoSecretSubstrings,
|
|
5
5
|
configuredRemoteCredentialValues,
|
|
6
6
|
loadResolvedModelsConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WYXUF4MP.js";
|
|
8
8
|
import "./chunk-CBDQJMUI.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-4UIUMTHG.js";
|
|
10
10
|
import "./chunk-XXGYUYXI.js";
|
|
11
11
|
import "./chunk-LZQXQOPJ.js";
|
|
12
12
|
export {
|
package/dist/chunks/{read-file-understanding-FMPXR6EJ.js → read-file-understanding-VPKDBV23.js}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
understandReadFile
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-3W3SXVPB.js";
|
|
4
|
+
} from "./chunk-Z5KL6AO2.js";
|
|
5
|
+
import "./chunk-DBDU3RRN.js";
|
|
6
|
+
import "./chunk-LRHNAG4V.js";
|
|
7
|
+
import "./chunk-BA4Z27XT.js";
|
|
9
8
|
import "./chunk-F7EBZTZO.js";
|
|
9
|
+
import "./chunk-4UIUMTHG.js";
|
|
10
10
|
import "./chunk-XXGYUYXI.js";
|
|
11
11
|
import "./chunk-LZQXQOPJ.js";
|
|
12
12
|
export {
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
createToolCallerIdentity,
|
|
9
9
|
getAgentFailureMetadata,
|
|
10
10
|
getToolCallerIdentity
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-BA4Z27XT.js";
|
|
12
|
+
import "./chunk-4UIUMTHG.js";
|
|
13
13
|
import "./chunk-XXGYUYXI.js";
|
|
14
14
|
import "./chunk-LZQXQOPJ.js";
|
|
15
15
|
export {
|
|
@@ -142,9 +142,9 @@ import {
|
|
|
142
142
|
substituteArgs,
|
|
143
143
|
validateRetainedTailEntries,
|
|
144
144
|
verifyPreparedCompactionCommit
|
|
145
|
-
} from "./chunk-
|
|
146
|
-
import "./chunk-
|
|
147
|
-
import "./chunk-
|
|
145
|
+
} from "./chunk-LRHNAG4V.js";
|
|
146
|
+
import "./chunk-BA4Z27XT.js";
|
|
147
|
+
import "./chunk-4UIUMTHG.js";
|
|
148
148
|
import "./chunk-XXGYUYXI.js";
|
|
149
149
|
import "./chunk-LZQXQOPJ.js";
|
|
150
150
|
export {
|