@docyrus/docyrus 0.0.31 → 0.0.32
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/agent-loader.js +36 -25
- package/agent-loader.js.map +4 -4
- package/main.js +2 -2
- package/main.js.map +1 -1
- package/package.json +1 -1
- package/resources/pi-agent/extensions/docyrus-web-browser.ts +31 -0
- package/resources/pi-agent/shared/docyrusWebBrowserProtocol.ts +169 -0
- package/resources/pi-agent/skills/diffity-diff/SKILL.md +1 -1
- package/resources/pi-agent/skills/diffity-resolve/SKILL.md +4 -4
- package/resources/pi-agent/skills/diffity-review/SKILL.md +5 -4
- package/resources/pi-agent/skills/docyrus-api-dev/SKILL.md +36 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/acl-endpoints-frontend.md +295 -0
- package/resources/pi-agent/skills/docyrus-api-dev/references/authentication.md +4 -5
- package/resources/pi-agent/skills/docyrus-app-dev-react/SKILL.md +112 -85
- package/resources/pi-agent/skills/docyrus-app-dev-react/references/README.md +1 -0
- package/resources/pi-agent/skills/docyrus-app-dev-react/references/collections-and-patterns.md +1 -0
- package/resources/pi-agent/skills/docyrus-app-dev-react/references/component-selection-guide.md +27 -10
- package/server-loader.js +328 -87
- package/server-loader.js.map +4 -4
package/agent-loader.js
CHANGED
|
@@ -1132,9 +1132,9 @@ ${J2}${i.trimStart()}`), r2 = 3 + (0, import_node_util.stripVTControlCharacters)
|
|
|
1132
1132
|
});
|
|
1133
1133
|
|
|
1134
1134
|
// src/agent/loader.ts
|
|
1135
|
-
var
|
|
1135
|
+
var import_node_fs2 = require("node:fs");
|
|
1136
1136
|
var import_node_url = require("node:url");
|
|
1137
|
-
var
|
|
1137
|
+
var import_node_path4 = require("node:path");
|
|
1138
1138
|
var import_picocolors4 = __toESM(require_picocolors());
|
|
1139
1139
|
|
|
1140
1140
|
// src/agent/envStore.ts
|
|
@@ -1235,9 +1235,29 @@ var AgentEnvStore = class {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
};
|
|
1237
1237
|
|
|
1238
|
+
// src/agent/packagedExtensions.ts
|
|
1239
|
+
var import_node_fs = require("node:fs");
|
|
1240
|
+
var import_node_path2 = require("node:path");
|
|
1241
|
+
var SERVER_ONLY_PACKAGED_EXTENSION_NAMES = /* @__PURE__ */ new Set(["docyrus-web-browser"]);
|
|
1242
|
+
function isPackagedExtensionEntry(entryName, isDirectory) {
|
|
1243
|
+
return isDirectory || entryName.endsWith(".ts") || entryName.endsWith(".js");
|
|
1244
|
+
}
|
|
1245
|
+
function getPackagedExtensionName(entryName) {
|
|
1246
|
+
return entryName.replace(/\.(ts|js)$/u, "");
|
|
1247
|
+
}
|
|
1248
|
+
function resolvePackagedExtensionPaths(resourceRoot, runtime = "terminal") {
|
|
1249
|
+
const extensionsRoot = (0, import_node_path2.join)(resourceRoot, "extensions");
|
|
1250
|
+
if (!(0, import_node_fs.existsSync)(extensionsRoot)) {
|
|
1251
|
+
return [];
|
|
1252
|
+
}
|
|
1253
|
+
return (0, import_node_fs.readdirSync)(extensionsRoot, {
|
|
1254
|
+
withFileTypes: true
|
|
1255
|
+
}).filter((entry) => isPackagedExtensionEntry(entry.name, entry.isDirectory())).filter((entry) => runtime === "server" || !SERVER_ONLY_PACKAGED_EXTENSION_NAMES.has(getPackagedExtensionName(entry.name))).map((entry) => (0, import_node_path2.join)(extensionsRoot, entry.name)).sort((left, right) => left.localeCompare(right));
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1238
1258
|
// src/agent/modelsConfig.ts
|
|
1239
1259
|
var import_promises2 = require("node:fs/promises");
|
|
1240
|
-
var
|
|
1260
|
+
var import_node_path3 = require("node:path");
|
|
1241
1261
|
function createDefaultState2() {
|
|
1242
1262
|
return {
|
|
1243
1263
|
providers: {}
|
|
@@ -1261,7 +1281,7 @@ async function readModelsConfig(filePath) {
|
|
|
1261
1281
|
}
|
|
1262
1282
|
}
|
|
1263
1283
|
async function writeModelsConfig(filePath, state) {
|
|
1264
|
-
const directory = (0,
|
|
1284
|
+
const directory = (0, import_node_path3.dirname)(filePath);
|
|
1265
1285
|
await (0, import_promises2.mkdir)(directory, {
|
|
1266
1286
|
recursive: true,
|
|
1267
1287
|
mode: 448
|
|
@@ -2591,31 +2611,22 @@ function readLoaderRequest() {
|
|
|
2591
2611
|
}
|
|
2592
2612
|
async function loadPiExports() {
|
|
2593
2613
|
const piPackageDir = readRequiredEnv("PI_PACKAGE_DIR");
|
|
2594
|
-
const moduleUrl = (0, import_node_url.pathToFileURL)((0,
|
|
2614
|
+
const moduleUrl = (0, import_node_url.pathToFileURL)((0, import_node_path4.join)(piPackageDir, "dist", "index.js")).href;
|
|
2595
2615
|
return await import(moduleUrl);
|
|
2596
2616
|
}
|
|
2597
2617
|
function resolvePackagedPiResourceRoot() {
|
|
2598
2618
|
const candidates = [
|
|
2599
|
-
(0,
|
|
2600
|
-
(0,
|
|
2601
|
-
(0,
|
|
2602
|
-
(0,
|
|
2619
|
+
(0, import_node_path4.resolve)(process.cwd(), "apps/api-cli/resources/pi-agent"),
|
|
2620
|
+
(0, import_node_path4.resolve)(__dirname, "../resources/pi-agent"),
|
|
2621
|
+
(0, import_node_path4.resolve)(__dirname, "resources/pi-agent"),
|
|
2622
|
+
(0, import_node_path4.resolve)(process.cwd(), "dist/apps/api-cli/resources/pi-agent")
|
|
2603
2623
|
];
|
|
2604
|
-
const resolved = candidates.find((candidate) => (0,
|
|
2624
|
+
const resolved = candidates.find((candidate) => (0, import_node_fs2.existsSync)(candidate));
|
|
2605
2625
|
if (!resolved) {
|
|
2606
2626
|
throw new Error(`Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`);
|
|
2607
2627
|
}
|
|
2608
2628
|
return resolved;
|
|
2609
2629
|
}
|
|
2610
|
-
function resolvePackagedExtensionPaths(resourceRoot) {
|
|
2611
|
-
const extensionsRoot = (0, import_node_path3.join)(resourceRoot, "extensions");
|
|
2612
|
-
if (!(0, import_node_fs.existsSync)(extensionsRoot)) {
|
|
2613
|
-
return [];
|
|
2614
|
-
}
|
|
2615
|
-
return (0, import_node_fs.readdirSync)(extensionsRoot, {
|
|
2616
|
-
withFileTypes: true
|
|
2617
|
-
}).filter((entry) => entry.isDirectory() || entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".js"))).map((entry) => (0, import_node_path3.join)(extensionsRoot, entry.name)).sort((left, right) => left.localeCompare(right));
|
|
2618
|
-
}
|
|
2619
2630
|
function setProcessArgValue(flag, value) {
|
|
2620
2631
|
const existingIndex = process.argv.indexOf(flag);
|
|
2621
2632
|
if (existingIndex >= 0) {
|
|
@@ -2752,17 +2763,17 @@ async function main() {
|
|
|
2752
2763
|
const agentDir = readRequiredEnv("PI_CODING_AGENT_DIR");
|
|
2753
2764
|
const version = process.env.DOCYRUS_PI_VERSION || "dev";
|
|
2754
2765
|
const resourceRoot = resolvePackagedPiResourceRoot();
|
|
2755
|
-
const packagedExtensionPaths = resolvePackagedExtensionPaths(resourceRoot);
|
|
2756
|
-
const mcpConfigPath = (0,
|
|
2766
|
+
const packagedExtensionPaths = resolvePackagedExtensionPaths(resourceRoot, "terminal");
|
|
2767
|
+
const mcpConfigPath = (0, import_node_path4.join)(agentDir, "mcp.json");
|
|
2757
2768
|
const hasPackagedMcpAdapter = packagedExtensionPaths.some((extensionPath) => extensionPath.includes("pi-mcp-adapter"));
|
|
2758
|
-
const envStore = new AgentEnvStore((0,
|
|
2769
|
+
const envStore = new AgentEnvStore((0, import_node_path4.join)(agentDir, "env.json"));
|
|
2759
2770
|
await envStore.hydrateProcessEnv(process.env);
|
|
2760
2771
|
if (hasPackagedMcpAdapter) {
|
|
2761
2772
|
setProcessArgValue("--mcp-config", mcpConfigPath);
|
|
2762
2773
|
}
|
|
2763
|
-
const authStorage = pi.AuthStorage.create((0,
|
|
2774
|
+
const authStorage = pi.AuthStorage.create((0, import_node_path4.join)(agentDir, "auth.json"));
|
|
2764
2775
|
const settingsManager = pi.SettingsManager.create(cwd, agentDir);
|
|
2765
|
-
const modelsJsonPath = (0,
|
|
2776
|
+
const modelsJsonPath = (0, import_node_path4.join)(agentDir, "models.json");
|
|
2766
2777
|
const initialModelRegistry = new pi.ModelRegistry(authStorage, modelsJsonPath);
|
|
2767
2778
|
const isPrintMode = Boolean(request.print) || !process.stdin.isTTY;
|
|
2768
2779
|
const isInteractive = process.stdin.isTTY && !isPrintMode;
|
|
@@ -2826,7 +2837,7 @@ async function main() {
|
|
|
2826
2837
|
agentDir,
|
|
2827
2838
|
settingsManager,
|
|
2828
2839
|
additionalExtensionPaths: packagedExtensionPaths,
|
|
2829
|
-
systemPrompt: (0,
|
|
2840
|
+
systemPrompt: (0, import_node_path4.join)(
|
|
2830
2841
|
resourceRoot,
|
|
2831
2842
|
"prompts",
|
|
2832
2843
|
request.profile === "agent" ? "agent-system.md" : "coder-system.md"
|