deepfish-ai 2.0.9 → 2.0.11
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/index.js +132 -53
- package/dist/serve/pm2-server.js +45 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8403,10 +8403,10 @@ var require_lib = __commonJS({
|
|
|
8403
8403
|
exports2.analyse = analyse;
|
|
8404
8404
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
8405
8405
|
let fd;
|
|
8406
|
-
const
|
|
8406
|
+
const fs25 = (0, node_1.default)();
|
|
8407
8407
|
const handler = (err, buffer) => {
|
|
8408
8408
|
if (fd) {
|
|
8409
|
-
|
|
8409
|
+
fs25.closeSync(fd);
|
|
8410
8410
|
}
|
|
8411
8411
|
if (err) {
|
|
8412
8412
|
reject(err);
|
|
@@ -8418,9 +8418,9 @@ var require_lib = __commonJS({
|
|
|
8418
8418
|
};
|
|
8419
8419
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
8420
8420
|
if (sampleSize > 0) {
|
|
8421
|
-
fd =
|
|
8421
|
+
fd = fs25.openSync(filepath, "r");
|
|
8422
8422
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
8423
|
-
|
|
8423
|
+
fs25.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
8424
8424
|
if (err) {
|
|
8425
8425
|
handler(err, null);
|
|
8426
8426
|
} else {
|
|
@@ -8432,22 +8432,22 @@ var require_lib = __commonJS({
|
|
|
8432
8432
|
});
|
|
8433
8433
|
return;
|
|
8434
8434
|
}
|
|
8435
|
-
|
|
8435
|
+
fs25.readFile(filepath, handler);
|
|
8436
8436
|
});
|
|
8437
8437
|
exports2.detectFile = detectFile;
|
|
8438
8438
|
var detectFileSync = (filepath, opts = {}) => {
|
|
8439
|
-
const
|
|
8439
|
+
const fs25 = (0, node_1.default)();
|
|
8440
8440
|
if (opts && opts.sampleSize) {
|
|
8441
|
-
const fd =
|
|
8441
|
+
const fd = fs25.openSync(filepath, "r");
|
|
8442
8442
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
8443
|
-
const bytesRead =
|
|
8443
|
+
const bytesRead = fs25.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
8444
8444
|
if (bytesRead < opts.sampleSize) {
|
|
8445
8445
|
sample = sample.subarray(0, bytesRead);
|
|
8446
8446
|
}
|
|
8447
|
-
|
|
8447
|
+
fs25.closeSync(fd);
|
|
8448
8448
|
return (0, exports2.detect)(sample);
|
|
8449
8449
|
}
|
|
8450
|
-
return (0, exports2.detect)(
|
|
8450
|
+
return (0, exports2.detect)(fs25.readFileSync(filepath));
|
|
8451
8451
|
};
|
|
8452
8452
|
exports2.detectFileSync = detectFileSync;
|
|
8453
8453
|
exports2.default = {
|
|
@@ -8631,6 +8631,79 @@ var ADD_MODEL_Config = {
|
|
|
8631
8631
|
// src/cli/cli-utils/getGlobalPath.ts
|
|
8632
8632
|
var import_path2 = __toESM(require("path"));
|
|
8633
8633
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
8634
|
+
|
|
8635
|
+
// src/cli/cli-utils/node-root.ts
|
|
8636
|
+
var { execSync } = require("child_process");
|
|
8637
|
+
var path2 = require("path");
|
|
8638
|
+
var fs = require("fs");
|
|
8639
|
+
function safeExec(cmd) {
|
|
8640
|
+
try {
|
|
8641
|
+
return execSync(cmd, { encoding: "utf8", stdio: "pipe" }).trim();
|
|
8642
|
+
} catch (err) {
|
|
8643
|
+
return null;
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
function resolveValidPath(targetPath) {
|
|
8647
|
+
if (!targetPath) return null;
|
|
8648
|
+
try {
|
|
8649
|
+
const realPath = fs.realpathSync(targetPath);
|
|
8650
|
+
return fs.existsSync(realPath) ? realPath : null;
|
|
8651
|
+
} catch (err) {
|
|
8652
|
+
return null;
|
|
8653
|
+
}
|
|
8654
|
+
}
|
|
8655
|
+
function getNvmGlobalPath() {
|
|
8656
|
+
const nvmDir = process.env["NVM_DIR"] || (process.platform === "win32" ? path2.join(process.env["USERPROFILE"], ".nvm") : path2.join(process.env["HOME"], ".nvm"));
|
|
8657
|
+
const nodeVersion = safeExec("nvm current");
|
|
8658
|
+
if (!nodeVersion || nodeVersion.includes("N/A")) return null;
|
|
8659
|
+
const nvmGlobalPath = path2.join(
|
|
8660
|
+
nvmDir,
|
|
8661
|
+
"versions",
|
|
8662
|
+
"node",
|
|
8663
|
+
nodeVersion,
|
|
8664
|
+
"lib",
|
|
8665
|
+
"node_modules"
|
|
8666
|
+
);
|
|
8667
|
+
return resolveValidPath(nvmGlobalPath);
|
|
8668
|
+
}
|
|
8669
|
+
function getNpmGlobalPath() {
|
|
8670
|
+
const npmPath = safeExec("npm root -g");
|
|
8671
|
+
return resolveValidPath(npmPath);
|
|
8672
|
+
}
|
|
8673
|
+
function getFallbackGlobalPath() {
|
|
8674
|
+
try {
|
|
8675
|
+
const nodeExecPath = process.execPath;
|
|
8676
|
+
let globalPrefix;
|
|
8677
|
+
if (process.platform === "win32") {
|
|
8678
|
+
globalPrefix = path2.dirname(path2.dirname(nodeExecPath));
|
|
8679
|
+
} else {
|
|
8680
|
+
globalPrefix = path2.dirname(path2.dirname(path2.dirname(nodeExecPath)));
|
|
8681
|
+
}
|
|
8682
|
+
const fallbackPath = path2.join(globalPrefix, "lib", "node_modules");
|
|
8683
|
+
return resolveValidPath(fallbackPath);
|
|
8684
|
+
} catch (err) {
|
|
8685
|
+
return null;
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
function getGlobalNodeModulesPath() {
|
|
8689
|
+
const nvmPath = getNvmGlobalPath();
|
|
8690
|
+
if (nvmPath) {
|
|
8691
|
+
return nvmPath;
|
|
8692
|
+
}
|
|
8693
|
+
const npmPath = getNpmGlobalPath();
|
|
8694
|
+
if (npmPath) {
|
|
8695
|
+
return npmPath;
|
|
8696
|
+
}
|
|
8697
|
+
const fallbackPath = getFallbackGlobalPath();
|
|
8698
|
+
if (fallbackPath) {
|
|
8699
|
+
return fallbackPath;
|
|
8700
|
+
}
|
|
8701
|
+
console.error("\u65E0\u6CD5\u83B7\u53D6\u5168\u5C40 node_modules \u8DEF\u5F84");
|
|
8702
|
+
return null;
|
|
8703
|
+
}
|
|
8704
|
+
var node_root_default = getGlobalNodeModulesPath;
|
|
8705
|
+
|
|
8706
|
+
// src/cli/cli-utils/getGlobalPath.ts
|
|
8634
8707
|
var getDirname = () => __dirname;
|
|
8635
8708
|
function getHomePath() {
|
|
8636
8709
|
return HOME_DIR;
|
|
@@ -8693,6 +8766,10 @@ function getScanDirPaths() {
|
|
|
8693
8766
|
const paths = /* @__PURE__ */ new Set();
|
|
8694
8767
|
paths.add(import_path2.default.join(workspacePath, ".deepfish-ai"));
|
|
8695
8768
|
paths.add(import_path2.default.join(homePath));
|
|
8769
|
+
const nodeRoot = import_path2.default.join(node_root_default(), "@deepfish-ai");
|
|
8770
|
+
if (import_fs_extra.default.existsSync(nodeRoot)) {
|
|
8771
|
+
paths.add(nodeRoot);
|
|
8772
|
+
}
|
|
8696
8773
|
return Array.from(paths);
|
|
8697
8774
|
}
|
|
8698
8775
|
function getMCPFilePath() {
|
|
@@ -8728,8 +8805,11 @@ function handleConfigView() {
|
|
|
8728
8805
|
}
|
|
8729
8806
|
const content = import_fs_extra2.default.readFileSync(configPath, "utf-8");
|
|
8730
8807
|
const data = import_json5.default.parse(content);
|
|
8808
|
+
data.aiList?.forEach((item) => {
|
|
8809
|
+
item.apiKey = "******";
|
|
8810
|
+
});
|
|
8731
8811
|
logInfo("Current config:");
|
|
8732
|
-
|
|
8812
|
+
logInfo(JSON.stringify(data, null, 2));
|
|
8733
8813
|
}
|
|
8734
8814
|
function handleConfigReset() {
|
|
8735
8815
|
const configPath = getConfigPath();
|
|
@@ -8966,18 +9046,8 @@ function initConfig() {
|
|
|
8966
9046
|
if (!import_fs_extra4.default.pathExistsSync(skillsRegisterPath)) {
|
|
8967
9047
|
import_fs_extra4.default.writeFileSync(skillsRegisterPath, "[]", "utf-8");
|
|
8968
9048
|
}
|
|
8969
|
-
const dynamicToolsDir = getToolsPath();
|
|
8970
|
-
import_fs_extra4.default.ensureDirSync(dynamicToolsDir);
|
|
8971
|
-
const dynamicToolsRegisterPath = import_path3.default.join(dynamicToolsDir, "register.json");
|
|
8972
|
-
if (!import_fs_extra4.default.pathExistsSync(dynamicToolsRegisterPath)) {
|
|
8973
|
-
import_fs_extra4.default.writeFileSync(dynamicToolsRegisterPath, "[]", "utf-8");
|
|
8974
|
-
}
|
|
8975
9049
|
const toolsDir = getToolsPath();
|
|
8976
9050
|
import_fs_extra4.default.ensureDirSync(toolsDir);
|
|
8977
|
-
const toolsRegisterPath = import_path3.default.join(toolsDir, "register.json");
|
|
8978
|
-
if (!import_fs_extra4.default.pathExistsSync(toolsRegisterPath)) {
|
|
8979
|
-
import_fs_extra4.default.writeFileSync(toolsRegisterPath, "[]", "utf-8");
|
|
8980
|
-
}
|
|
8981
9051
|
const sessionsDir = getSessionsPath();
|
|
8982
9052
|
import_fs_extra4.default.ensureDirSync(sessionsDir);
|
|
8983
9053
|
const sessionsIndexPath = import_path3.default.join(sessionsDir, "sessions.json");
|
|
@@ -10494,10 +10564,10 @@ function mergeDefs(...defs) {
|
|
|
10494
10564
|
function cloneDef(schema) {
|
|
10495
10565
|
return mergeDefs(schema._zod.def);
|
|
10496
10566
|
}
|
|
10497
|
-
function getElementAtPath(obj,
|
|
10498
|
-
if (!
|
|
10567
|
+
function getElementAtPath(obj, path23) {
|
|
10568
|
+
if (!path23)
|
|
10499
10569
|
return obj;
|
|
10500
|
-
return
|
|
10570
|
+
return path23.reduce((acc, key) => acc?.[key], obj);
|
|
10501
10571
|
}
|
|
10502
10572
|
function promiseAllObject(promisesObj) {
|
|
10503
10573
|
const keys = Object.keys(promisesObj);
|
|
@@ -10906,11 +10976,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
10906
10976
|
}
|
|
10907
10977
|
return false;
|
|
10908
10978
|
}
|
|
10909
|
-
function prefixIssues(
|
|
10979
|
+
function prefixIssues(path23, issues) {
|
|
10910
10980
|
return issues.map((iss) => {
|
|
10911
10981
|
var _a3;
|
|
10912
10982
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
10913
|
-
iss.path.unshift(
|
|
10983
|
+
iss.path.unshift(path23);
|
|
10914
10984
|
return iss;
|
|
10915
10985
|
});
|
|
10916
10986
|
}
|
|
@@ -11057,16 +11127,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
11057
11127
|
}
|
|
11058
11128
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
11059
11129
|
const fieldErrors = { _errors: [] };
|
|
11060
|
-
const processError = (error52,
|
|
11130
|
+
const processError = (error52, path23 = []) => {
|
|
11061
11131
|
for (const issue2 of error52.issues) {
|
|
11062
11132
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11063
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11133
|
+
issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
|
|
11064
11134
|
} else if (issue2.code === "invalid_key") {
|
|
11065
|
-
processError({ issues: issue2.issues }, [...
|
|
11135
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
11066
11136
|
} else if (issue2.code === "invalid_element") {
|
|
11067
|
-
processError({ issues: issue2.issues }, [...
|
|
11137
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
11068
11138
|
} else {
|
|
11069
|
-
const fullpath = [...
|
|
11139
|
+
const fullpath = [...path23, ...issue2.path];
|
|
11070
11140
|
if (fullpath.length === 0) {
|
|
11071
11141
|
fieldErrors._errors.push(mapper(issue2));
|
|
11072
11142
|
} else {
|
|
@@ -11093,17 +11163,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
11093
11163
|
}
|
|
11094
11164
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
11095
11165
|
const result = { errors: [] };
|
|
11096
|
-
const processError = (error52,
|
|
11166
|
+
const processError = (error52, path23 = []) => {
|
|
11097
11167
|
var _a3, _b;
|
|
11098
11168
|
for (const issue2 of error52.issues) {
|
|
11099
11169
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
11100
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
11170
|
+
issue2.errors.map((issues) => processError({ issues }, [...path23, ...issue2.path]));
|
|
11101
11171
|
} else if (issue2.code === "invalid_key") {
|
|
11102
|
-
processError({ issues: issue2.issues }, [...
|
|
11172
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
11103
11173
|
} else if (issue2.code === "invalid_element") {
|
|
11104
|
-
processError({ issues: issue2.issues }, [...
|
|
11174
|
+
processError({ issues: issue2.issues }, [...path23, ...issue2.path]);
|
|
11105
11175
|
} else {
|
|
11106
|
-
const fullpath = [...
|
|
11176
|
+
const fullpath = [...path23, ...issue2.path];
|
|
11107
11177
|
if (fullpath.length === 0) {
|
|
11108
11178
|
result.errors.push(mapper(issue2));
|
|
11109
11179
|
continue;
|
|
@@ -11135,8 +11205,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
11135
11205
|
}
|
|
11136
11206
|
function toDotPath(_path) {
|
|
11137
11207
|
const segs = [];
|
|
11138
|
-
const
|
|
11139
|
-
for (const seg of
|
|
11208
|
+
const path23 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
11209
|
+
for (const seg of path23) {
|
|
11140
11210
|
if (typeof seg === "number")
|
|
11141
11211
|
segs.push(`[${seg}]`);
|
|
11142
11212
|
else if (typeof seg === "symbol")
|
|
@@ -23828,13 +23898,13 @@ function resolveRef(ref, ctx) {
|
|
|
23828
23898
|
if (!ref.startsWith("#")) {
|
|
23829
23899
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
23830
23900
|
}
|
|
23831
|
-
const
|
|
23832
|
-
if (
|
|
23901
|
+
const path23 = ref.slice(1).split("/").filter(Boolean);
|
|
23902
|
+
if (path23.length === 0) {
|
|
23833
23903
|
return ctx.rootSchema;
|
|
23834
23904
|
}
|
|
23835
23905
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
23836
|
-
if (
|
|
23837
|
-
const key =
|
|
23906
|
+
if (path23[0] === defsKey) {
|
|
23907
|
+
const key = path23[1];
|
|
23838
23908
|
if (!key || !ctx.defs[key]) {
|
|
23839
23909
|
throw new Error(`Reference not found: ${ref}`);
|
|
23840
23910
|
}
|
|
@@ -24318,8 +24388,8 @@ var Thinking = class {
|
|
|
24318
24388
|
};
|
|
24319
24389
|
|
|
24320
24390
|
// src/agent/AIAgent/utils/skill-parser.ts
|
|
24321
|
-
var
|
|
24322
|
-
var
|
|
24391
|
+
var fs6 = require("fs-extra");
|
|
24392
|
+
var path5 = require("path");
|
|
24323
24393
|
var yaml = require_js_yaml();
|
|
24324
24394
|
function extractFrontmatter(content, skillPath) {
|
|
24325
24395
|
const normalizedContent = content.replace(/^\uFEFF/, "");
|
|
@@ -24330,14 +24400,14 @@ function extractFrontmatter(content, skillPath) {
|
|
|
24330
24400
|
return frontmatterMatch[1];
|
|
24331
24401
|
}
|
|
24332
24402
|
function parseSkillMetadataYaml(skillPath) {
|
|
24333
|
-
const content =
|
|
24403
|
+
const content = fs6.readFileSync(skillPath, "utf-8");
|
|
24334
24404
|
const frontmatterContent = extractFrontmatter(content, skillPath);
|
|
24335
24405
|
const frontmatter = yaml.load(frontmatterContent);
|
|
24336
24406
|
return {
|
|
24337
24407
|
name: frontmatter.name,
|
|
24338
24408
|
description: frontmatter.description,
|
|
24339
24409
|
homepage: frontmatter.homepage,
|
|
24340
|
-
location:
|
|
24410
|
+
location: path5.dirname(skillPath),
|
|
24341
24411
|
metadata: frontmatter.metadata || {},
|
|
24342
24412
|
skillFilePath: skillPath
|
|
24343
24413
|
};
|
|
@@ -24726,7 +24796,10 @@ function _scanUserToolsFile() {
|
|
|
24726
24796
|
const toolFiles = [];
|
|
24727
24797
|
const scanPaths = getScanDirPaths();
|
|
24728
24798
|
scanPaths.forEach((scanPath) => {
|
|
24729
|
-
|
|
24799
|
+
let toolsDir = scanPath;
|
|
24800
|
+
if (!scanPath.endsWith("@deepfish-ai")) {
|
|
24801
|
+
toolsDir = import_path8.default.resolve(scanPath, "tools");
|
|
24802
|
+
}
|
|
24730
24803
|
if (import_fs_extra8.default.pathExistsSync(toolsDir)) {
|
|
24731
24804
|
const files = import_fs_extra8.default.readdirSync(toolsDir);
|
|
24732
24805
|
files.forEach((file2) => {
|
|
@@ -26670,7 +26743,7 @@ function handleSkillsDel(index) {
|
|
|
26670
26743
|
const skill = skills[skillIndex];
|
|
26671
26744
|
import_fs_extra20.default.removeSync(skill.skillPath);
|
|
26672
26745
|
const skillDir = skill.skillDir;
|
|
26673
|
-
const registerPath =
|
|
26746
|
+
const registerPath = _getRegisterPath(skillDir);
|
|
26674
26747
|
if (import_fs_extra20.default.existsSync(registerPath)) {
|
|
26675
26748
|
let register = import_fs_extra20.default.readJSONSync(registerPath);
|
|
26676
26749
|
register = register.filter((item) => item.skillPath !== skill.skillPath);
|
|
@@ -26688,7 +26761,7 @@ function handleSkillsEnable(index) {
|
|
|
26688
26761
|
const skill = skills[skillIndex];
|
|
26689
26762
|
skill.isEnabled = true;
|
|
26690
26763
|
const skillDir = skill.skillDir;
|
|
26691
|
-
const registerPath =
|
|
26764
|
+
const registerPath = _getRegisterPath(skillDir);
|
|
26692
26765
|
import_fs_extra20.default.writeJSONSync(
|
|
26693
26766
|
registerPath,
|
|
26694
26767
|
skills.filter((item) => item.skillDir === skillDir),
|
|
@@ -26706,7 +26779,7 @@ function handleSkillsDisable(index) {
|
|
|
26706
26779
|
const skill = skills[skillIndex];
|
|
26707
26780
|
skill.isEnabled = false;
|
|
26708
26781
|
const skillDir = skill.skillDir;
|
|
26709
|
-
const registerPath =
|
|
26782
|
+
const registerPath = _getRegisterPath(skillDir);
|
|
26710
26783
|
import_fs_extra20.default.writeJSONSync(
|
|
26711
26784
|
registerPath,
|
|
26712
26785
|
skills.filter((item) => item.skillDir === skillDir),
|
|
@@ -26774,7 +26847,7 @@ function _scanSkills(skillsDir) {
|
|
|
26774
26847
|
return skills;
|
|
26775
26848
|
}
|
|
26776
26849
|
function _updateRegister(skillsDir) {
|
|
26777
|
-
const registerPath =
|
|
26850
|
+
const registerPath = _getRegisterPath(skillsDir);
|
|
26778
26851
|
if (import_fs_extra20.default.existsSync(skillsDir) && !import_fs_extra20.default.existsSync(registerPath)) {
|
|
26779
26852
|
import_fs_extra20.default.writeJSONSync(registerPath, [], { spaces: 2 });
|
|
26780
26853
|
} else if (!import_fs_extra20.default.existsSync(skillsDir)) {
|
|
@@ -26804,7 +26877,7 @@ function getRegisteredSkills() {
|
|
|
26804
26877
|
const skills = [];
|
|
26805
26878
|
scanPaths.forEach((scanPath) => {
|
|
26806
26879
|
_updateRegister(scanPath);
|
|
26807
|
-
const registerPath =
|
|
26880
|
+
const registerPath = _getRegisterPath(scanPath);
|
|
26808
26881
|
if (import_fs_extra20.default.existsSync(registerPath)) {
|
|
26809
26882
|
const register = import_fs_extra20.default.readJSONSync(registerPath);
|
|
26810
26883
|
register.forEach((item) => {
|
|
@@ -26818,7 +26891,7 @@ function getRegisteredSkills() {
|
|
|
26818
26891
|
}
|
|
26819
26892
|
function _getSkillList(skillsDir) {
|
|
26820
26893
|
let allSkills = [];
|
|
26821
|
-
const registerPath =
|
|
26894
|
+
const registerPath = _getRegisterPath(skillsDir);
|
|
26822
26895
|
if (import_fs_extra20.default.existsSync(registerPath)) {
|
|
26823
26896
|
_updateRegister(skillsDir);
|
|
26824
26897
|
const register = import_fs_extra20.default.readJSONSync(registerPath);
|
|
@@ -26839,6 +26912,12 @@ function _getAllSkills() {
|
|
|
26839
26912
|
});
|
|
26840
26913
|
return allSkills;
|
|
26841
26914
|
}
|
|
26915
|
+
function _getRegisterPath(skillsDir) {
|
|
26916
|
+
if (skillsDir.endsWith("@deepfish-ai")) {
|
|
26917
|
+
return import_path20.default.join(skillsDir, "register.json");
|
|
26918
|
+
}
|
|
26919
|
+
return import_path20.default.join(skillsDir, "skills", "register.json");
|
|
26920
|
+
}
|
|
26842
26921
|
|
|
26843
26922
|
// src/cli/cli-skills.ts
|
|
26844
26923
|
function registerSkillsCommands(program) {
|
package/dist/serve/pm2-server.js
CHANGED
|
@@ -8403,10 +8403,10 @@ var require_lib = __commonJS({
|
|
|
8403
8403
|
exports2.analyse = analyse;
|
|
8404
8404
|
var detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
|
8405
8405
|
let fd;
|
|
8406
|
-
const
|
|
8406
|
+
const fs22 = (0, node_1.default)();
|
|
8407
8407
|
const handler = (err, buffer) => {
|
|
8408
8408
|
if (fd) {
|
|
8409
|
-
|
|
8409
|
+
fs22.closeSync(fd);
|
|
8410
8410
|
}
|
|
8411
8411
|
if (err) {
|
|
8412
8412
|
reject(err);
|
|
@@ -8418,9 +8418,9 @@ var require_lib = __commonJS({
|
|
|
8418
8418
|
};
|
|
8419
8419
|
const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
|
|
8420
8420
|
if (sampleSize > 0) {
|
|
8421
|
-
fd =
|
|
8421
|
+
fd = fs22.openSync(filepath, "r");
|
|
8422
8422
|
let sample = Buffer.allocUnsafe(sampleSize);
|
|
8423
|
-
|
|
8423
|
+
fs22.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
|
|
8424
8424
|
if (err) {
|
|
8425
8425
|
handler(err, null);
|
|
8426
8426
|
} else {
|
|
@@ -8432,22 +8432,22 @@ var require_lib = __commonJS({
|
|
|
8432
8432
|
});
|
|
8433
8433
|
return;
|
|
8434
8434
|
}
|
|
8435
|
-
|
|
8435
|
+
fs22.readFile(filepath, handler);
|
|
8436
8436
|
});
|
|
8437
8437
|
exports2.detectFile = detectFile;
|
|
8438
8438
|
var detectFileSync = (filepath, opts = {}) => {
|
|
8439
|
-
const
|
|
8439
|
+
const fs22 = (0, node_1.default)();
|
|
8440
8440
|
if (opts && opts.sampleSize) {
|
|
8441
|
-
const fd =
|
|
8441
|
+
const fd = fs22.openSync(filepath, "r");
|
|
8442
8442
|
let sample = Buffer.allocUnsafe(opts.sampleSize);
|
|
8443
|
-
const bytesRead =
|
|
8443
|
+
const bytesRead = fs22.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
|
8444
8444
|
if (bytesRead < opts.sampleSize) {
|
|
8445
8445
|
sample = sample.subarray(0, bytesRead);
|
|
8446
8446
|
}
|
|
8447
|
-
|
|
8447
|
+
fs22.closeSync(fd);
|
|
8448
8448
|
return (0, exports2.detect)(sample);
|
|
8449
8449
|
}
|
|
8450
|
-
return (0, exports2.detect)(
|
|
8450
|
+
return (0, exports2.detect)(fs22.readFileSync(filepath));
|
|
8451
8451
|
};
|
|
8452
8452
|
exports2.detectFileSync = detectFileSync;
|
|
8453
8453
|
exports2.default = {
|
|
@@ -8542,6 +8542,13 @@ var ADD_MODEL_Config = {
|
|
|
8542
8542
|
// src/cli/cli-utils/getGlobalPath.ts
|
|
8543
8543
|
var import_path2 = __toESM(require("path"));
|
|
8544
8544
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
8545
|
+
|
|
8546
|
+
// src/cli/cli-utils/node-root.ts
|
|
8547
|
+
var { execSync } = require("child_process");
|
|
8548
|
+
var path2 = require("path");
|
|
8549
|
+
var fs = require("fs");
|
|
8550
|
+
|
|
8551
|
+
// src/cli/cli-utils/getGlobalPath.ts
|
|
8545
8552
|
var getDirname = () => __dirname;
|
|
8546
8553
|
function getCodePath() {
|
|
8547
8554
|
let dir = getDirname();
|
|
@@ -9516,10 +9523,10 @@ function mergeDefs(...defs) {
|
|
|
9516
9523
|
function cloneDef(schema) {
|
|
9517
9524
|
return mergeDefs(schema._zod.def);
|
|
9518
9525
|
}
|
|
9519
|
-
function getElementAtPath(obj,
|
|
9520
|
-
if (!
|
|
9526
|
+
function getElementAtPath(obj, path16) {
|
|
9527
|
+
if (!path16)
|
|
9521
9528
|
return obj;
|
|
9522
|
-
return
|
|
9529
|
+
return path16.reduce((acc, key) => acc?.[key], obj);
|
|
9523
9530
|
}
|
|
9524
9531
|
function promiseAllObject(promisesObj) {
|
|
9525
9532
|
const keys = Object.keys(promisesObj);
|
|
@@ -9928,11 +9935,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
9928
9935
|
}
|
|
9929
9936
|
return false;
|
|
9930
9937
|
}
|
|
9931
|
-
function prefixIssues(
|
|
9938
|
+
function prefixIssues(path16, issues) {
|
|
9932
9939
|
return issues.map((iss) => {
|
|
9933
9940
|
var _a3;
|
|
9934
9941
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
9935
|
-
iss.path.unshift(
|
|
9942
|
+
iss.path.unshift(path16);
|
|
9936
9943
|
return iss;
|
|
9937
9944
|
});
|
|
9938
9945
|
}
|
|
@@ -10079,16 +10086,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10079
10086
|
}
|
|
10080
10087
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
10081
10088
|
const fieldErrors = { _errors: [] };
|
|
10082
|
-
const processError = (error52,
|
|
10089
|
+
const processError = (error52, path16 = []) => {
|
|
10083
10090
|
for (const issue2 of error52.issues) {
|
|
10084
10091
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10085
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10092
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
10086
10093
|
} else if (issue2.code === "invalid_key") {
|
|
10087
|
-
processError({ issues: issue2.issues }, [...
|
|
10094
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10088
10095
|
} else if (issue2.code === "invalid_element") {
|
|
10089
|
-
processError({ issues: issue2.issues }, [...
|
|
10096
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10090
10097
|
} else {
|
|
10091
|
-
const fullpath = [...
|
|
10098
|
+
const fullpath = [...path16, ...issue2.path];
|
|
10092
10099
|
if (fullpath.length === 0) {
|
|
10093
10100
|
fieldErrors._errors.push(mapper(issue2));
|
|
10094
10101
|
} else {
|
|
@@ -10115,17 +10122,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10115
10122
|
}
|
|
10116
10123
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
10117
10124
|
const result = { errors: [] };
|
|
10118
|
-
const processError = (error52,
|
|
10125
|
+
const processError = (error52, path16 = []) => {
|
|
10119
10126
|
var _a3, _b;
|
|
10120
10127
|
for (const issue2 of error52.issues) {
|
|
10121
10128
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
10122
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
10129
|
+
issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
|
|
10123
10130
|
} else if (issue2.code === "invalid_key") {
|
|
10124
|
-
processError({ issues: issue2.issues }, [...
|
|
10131
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10125
10132
|
} else if (issue2.code === "invalid_element") {
|
|
10126
|
-
processError({ issues: issue2.issues }, [...
|
|
10133
|
+
processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
|
|
10127
10134
|
} else {
|
|
10128
|
-
const fullpath = [...
|
|
10135
|
+
const fullpath = [...path16, ...issue2.path];
|
|
10129
10136
|
if (fullpath.length === 0) {
|
|
10130
10137
|
result.errors.push(mapper(issue2));
|
|
10131
10138
|
continue;
|
|
@@ -10157,8 +10164,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
10157
10164
|
}
|
|
10158
10165
|
function toDotPath(_path) {
|
|
10159
10166
|
const segs = [];
|
|
10160
|
-
const
|
|
10161
|
-
for (const seg of
|
|
10167
|
+
const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
10168
|
+
for (const seg of path16) {
|
|
10162
10169
|
if (typeof seg === "number")
|
|
10163
10170
|
segs.push(`[${seg}]`);
|
|
10164
10171
|
else if (typeof seg === "symbol")
|
|
@@ -22850,13 +22857,13 @@ function resolveRef(ref, ctx) {
|
|
|
22850
22857
|
if (!ref.startsWith("#")) {
|
|
22851
22858
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
22852
22859
|
}
|
|
22853
|
-
const
|
|
22854
|
-
if (
|
|
22860
|
+
const path16 = ref.slice(1).split("/").filter(Boolean);
|
|
22861
|
+
if (path16.length === 0) {
|
|
22855
22862
|
return ctx.rootSchema;
|
|
22856
22863
|
}
|
|
22857
22864
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
22858
|
-
if (
|
|
22859
|
-
const key =
|
|
22865
|
+
if (path16[0] === defsKey) {
|
|
22866
|
+
const key = path16[1];
|
|
22860
22867
|
if (!key || !ctx.defs[key]) {
|
|
22861
22868
|
throw new Error(`Reference not found: ${ref}`);
|
|
22862
22869
|
}
|
|
@@ -23272,8 +23279,8 @@ var import_langchain = require("langchain");
|
|
|
23272
23279
|
var import_messages = require("@langchain/core/messages");
|
|
23273
23280
|
|
|
23274
23281
|
// src/agent/AIAgent/utils/skill-parser.ts
|
|
23275
|
-
var
|
|
23276
|
-
var
|
|
23282
|
+
var fs6 = require("fs-extra");
|
|
23283
|
+
var path6 = require("path");
|
|
23277
23284
|
var yaml = require_js_yaml();
|
|
23278
23285
|
|
|
23279
23286
|
// src/agent/AIAgent/system-prompt.ts
|
|
@@ -24538,14 +24545,14 @@ function startAgentRoomServer(opts = {}) {
|
|
|
24538
24545
|
logWarning("[agent-room] Service already running");
|
|
24539
24546
|
return wss;
|
|
24540
24547
|
}
|
|
24541
|
-
const
|
|
24548
|
+
const path16 = opts.path ?? "/agent-room";
|
|
24542
24549
|
if (opts.httpServer) {
|
|
24543
|
-
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path:
|
|
24544
|
-
logSuccess(`[agent-room] started, path=${
|
|
24550
|
+
wss = new import_ws2.WebSocketServer({ server: opts.httpServer, path: path16 });
|
|
24551
|
+
logSuccess(`[agent-room] started, path=${path16}`);
|
|
24545
24552
|
} else {
|
|
24546
24553
|
const port = opts.port ?? PORT2;
|
|
24547
|
-
wss = new import_ws2.WebSocketServer({ port, path:
|
|
24548
|
-
logSuccess(`[agent-room] started: ws://localhost:${port}${
|
|
24554
|
+
wss = new import_ws2.WebSocketServer({ port, path: path16 });
|
|
24555
|
+
logSuccess(`[agent-room] started: ws://localhost:${port}${path16}`);
|
|
24549
24556
|
}
|
|
24550
24557
|
wss.on("connection", handleConnection);
|
|
24551
24558
|
return wss;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepfish-ai",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An efficient AI-driven command-line tool designed to bridge the gap between natural language and operating system commands, file operations, and more. It enables non-developers to quickly generate executable instructions through simple natural language descriptions, significantly improving terminal operation efficiency.",
|
|
6
6
|
"repository": {
|