@docyrus/docyrus 0.0.64 → 0.0.66
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 +165 -20
- package/agent-loader.js.map +2 -2
- package/main.js +188 -101
- package/main.js.map +4 -4
- package/package.json +5 -4
- package/resources/pi-agent/extensions/browser-tools.ts +1 -1
- package/resources/pi-agent/extensions/context.ts +12 -73
- package/resources/pi-agent/extensions/control.ts +1 -1
- package/resources/pi-agent/extensions/loop.ts +4 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/index.ts +1 -1
- package/resources/pi-agent/extensions/pi-bash-live-view/package.json +3 -3
- package/resources/pi-agent/extensions/pi-fff/README.md +152 -0
- package/resources/pi-agent/extensions/pi-fff/VENDORED_FROM.md +7 -0
- package/resources/pi-agent/extensions/pi-fff/package.json +53 -0
- package/resources/pi-agent/extensions/pi-fff/src/index.ts +820 -0
- package/resources/pi-agent/extensions/pi-mcp-adapter/index.ts +1 -1
- package/resources/pi-agent/extensions/pi-mcp-adapter/package.json +1 -1
- package/resources/pi-agent/extensions/prompt-editor.ts +26 -7
- package/resources/pi-agent/extensions/todos.ts +1 -1
- package/server-loader.js +126 -24
- package/server-loader.js.map +2 -2
package/main.js
CHANGED
|
@@ -18864,7 +18864,7 @@ var require_core3 = __commonJS({
|
|
|
18864
18864
|
return match && match.index === 0;
|
|
18865
18865
|
}
|
|
18866
18866
|
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
18867
|
-
function
|
|
18867
|
+
function join20(regexps, separator = "|") {
|
|
18868
18868
|
let numCaptures = 0;
|
|
18869
18869
|
return regexps.map((regex) => {
|
|
18870
18870
|
numCaptures += 1;
|
|
@@ -19168,7 +19168,7 @@ var require_core3 = __commonJS({
|
|
|
19168
19168
|
this.exec = () => null;
|
|
19169
19169
|
}
|
|
19170
19170
|
const terminators = this.regexes.map((el) => el[1]);
|
|
19171
|
-
this.matcherRe = langRe(
|
|
19171
|
+
this.matcherRe = langRe(join20(terminators), true);
|
|
19172
19172
|
this.lastIndex = 0;
|
|
19173
19173
|
}
|
|
19174
19174
|
/** @param {string} s */
|
|
@@ -102181,7 +102181,7 @@ var require_snapshot_utils = __commonJS({
|
|
|
102181
102181
|
var require_snapshot_recorder = __commonJS({
|
|
102182
102182
|
"../../node_modules/.pnpm/undici@7.24.7/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
|
|
102183
102183
|
"use strict";
|
|
102184
|
-
var { writeFile: writeFile10, readFile: readFile18, mkdir:
|
|
102184
|
+
var { writeFile: writeFile10, readFile: readFile18, mkdir: mkdir12 } = require("node:fs/promises");
|
|
102185
102185
|
var { dirname: dirname14, resolve: resolve2 } = require("node:path");
|
|
102186
102186
|
var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = require("node:timers");
|
|
102187
102187
|
var { InvalidArgumentError, UndiciError } = require_errors3();
|
|
@@ -102413,7 +102413,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
102413
102413
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
102414
102414
|
}
|
|
102415
102415
|
const resolvedPath = resolve2(path8);
|
|
102416
|
-
await
|
|
102416
|
+
await mkdir12(dirname14(resolvedPath), { recursive: true });
|
|
102417
102417
|
const data = Array.from(this.#snapshots.entries()).map(([hash3, snapshot]) => ({
|
|
102418
102418
|
hash: hash3,
|
|
102419
102419
|
snapshot
|
|
@@ -138338,8 +138338,8 @@ function sanitizeName(name2) {
|
|
|
138338
138338
|
}
|
|
138339
138339
|
function rmForce(target) {
|
|
138340
138340
|
try {
|
|
138341
|
-
const
|
|
138342
|
-
if (
|
|
138341
|
+
const stat2 = fs2.lstatSync(target);
|
|
138342
|
+
if (stat2.isSymbolicLink())
|
|
138343
138343
|
fs2.unlinkSync(target);
|
|
138344
138344
|
else
|
|
138345
138345
|
fs2.rmSync(target, { recursive: true, force: true });
|
|
@@ -139349,7 +139349,7 @@ function buildInputSchema(args2, env2, options2) {
|
|
|
139349
139349
|
// package.json
|
|
139350
139350
|
var package_default = {
|
|
139351
139351
|
name: "@docyrus/docyrus",
|
|
139352
|
-
version: "0.0.
|
|
139352
|
+
version: "0.0.66",
|
|
139353
139353
|
private: false,
|
|
139354
139354
|
description: "Docyrus API CLI",
|
|
139355
139355
|
main: "./main.js",
|
|
@@ -139361,16 +139361,16 @@ var package_default = {
|
|
|
139361
139361
|
},
|
|
139362
139362
|
dependencies: {
|
|
139363
139363
|
"@clack/prompts": "^0.11.0",
|
|
139364
|
+
"@ff-labs/fff-node": "0.6.4",
|
|
139364
139365
|
"@hono/node-server": "^1.19.13",
|
|
139365
|
-
"@mariozechner/pi-ai": "0.
|
|
139366
|
-
"@mariozechner/pi-coding-agent": "0.
|
|
139366
|
+
"@mariozechner/pi-ai": "0.70.2",
|
|
139367
|
+
"@mariozechner/pi-coding-agent": "0.70.2",
|
|
139367
139368
|
"@modelcontextprotocol/ext-apps": "^1.2.2",
|
|
139368
139369
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
139369
139370
|
"@mozilla/readability": "^0.6.0",
|
|
139370
139371
|
"@opentui/core": "0.1.96",
|
|
139371
139372
|
"@opentui/react": "0.1.96",
|
|
139372
139373
|
"@repomix/tree-sitter-wasms": "^0.1.16",
|
|
139373
|
-
"@sinclair/typebox": "^0.34.48",
|
|
139374
139374
|
"@xterm/headless": "^5.5.0",
|
|
139375
139375
|
diff: "^9.0.0",
|
|
139376
139376
|
hono: "^4.12.14",
|
|
@@ -139389,6 +139389,7 @@ var package_default = {
|
|
|
139389
139389
|
"strip-ansi": "^7.1.0",
|
|
139390
139390
|
turndown: "^7.2.2",
|
|
139391
139391
|
"turndown-plugin-gfm": "^1.0.2",
|
|
139392
|
+
typebox: "^1.1.24",
|
|
139392
139393
|
undici: "^7.24.0",
|
|
139393
139394
|
unified: "^11.0.5",
|
|
139394
139395
|
"unist-util-visit": "^5.1.0",
|
|
@@ -140220,6 +140221,14 @@ var AUTH_DIR_PATH = (0, import_node_path3.join)((0, import_node_os5.homedir)(),
|
|
|
140220
140221
|
var AUTH_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "auth.json");
|
|
140221
140222
|
var CONFIG_FILE_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "config.json");
|
|
140222
140223
|
var TENANT_OPENAPI_ROOT_PATH = (0, import_node_path3.join)(AUTH_DIR_PATH, "tenans");
|
|
140224
|
+
var DOCYRUS_PI_AGENT_GLOBAL_ROOT_PATH = (0, import_node_path3.join)(
|
|
140225
|
+
AUTH_DIR_PATH,
|
|
140226
|
+
DOCYRUS_PI_DIR_NAME,
|
|
140227
|
+
DOCYRUS_PI_AGENT_DIR_NAME
|
|
140228
|
+
);
|
|
140229
|
+
function getDocyrusPiAgentGlobalRootPath() {
|
|
140230
|
+
return DOCYRUS_PI_AGENT_GLOBAL_ROOT_PATH;
|
|
140231
|
+
}
|
|
140223
140232
|
var TENANT_OPENAPI_PUBLIC_URL_TEMPLATE = "https://api.docyrus.app/storage/v1/object/public/tenant-public/{tenantId}/openapi.json";
|
|
140224
140233
|
var DEFAULT_ENVIRONMENT_ID = "live";
|
|
140225
140234
|
var DEFAULT_ENVIRONMENTS = [
|
|
@@ -147902,7 +147911,7 @@ async function resolveKnowledgeProviderFromAgentRuntime(params) {
|
|
|
147902
147911
|
}
|
|
147903
147912
|
};
|
|
147904
147913
|
}
|
|
147905
|
-
const agentRootPath =
|
|
147914
|
+
const agentRootPath = params.piAgentRootPath ?? getDocyrusPiAgentGlobalRootPath();
|
|
147906
147915
|
const authState = readJsonFile((0, import_node_path14.join)(agentRootPath, "auth.json")) || {};
|
|
147907
147916
|
const envStore = new AgentEnvStore((0, import_node_path14.join)(agentRootPath, "env.json"));
|
|
147908
147917
|
const envState = await envStore.readState();
|
|
@@ -153941,15 +153950,75 @@ var EnvironmentConfigService = class {
|
|
|
153941
153950
|
// src/services/piAgentLauncher.ts
|
|
153942
153951
|
var import_node_child_process8 = require("node:child_process");
|
|
153943
153952
|
var import_node_fs17 = require("node:fs");
|
|
153944
|
-
var
|
|
153945
|
-
var
|
|
153953
|
+
var import_promises24 = require("node:fs/promises");
|
|
153954
|
+
var import_node_path30 = require("node:path");
|
|
153946
153955
|
|
|
153947
|
-
// src/
|
|
153956
|
+
// src/agent/piAgentMigration.ts
|
|
153948
153957
|
var import_promises22 = require("node:fs/promises");
|
|
153949
153958
|
var import_node_path28 = require("node:path");
|
|
153959
|
+
var LEGACY_PI_AGENT_FILES = [
|
|
153960
|
+
"auth.json",
|
|
153961
|
+
"env.json",
|
|
153962
|
+
"models.json",
|
|
153963
|
+
"settings.json"
|
|
153964
|
+
];
|
|
153965
|
+
async function pathExists(filePath) {
|
|
153966
|
+
try {
|
|
153967
|
+
await (0, import_promises22.access)(filePath);
|
|
153968
|
+
return true;
|
|
153969
|
+
} catch {
|
|
153970
|
+
return false;
|
|
153971
|
+
}
|
|
153972
|
+
}
|
|
153973
|
+
async function safeResolveRealPath(filePath) {
|
|
153974
|
+
try {
|
|
153975
|
+
const stats = await (0, import_promises22.stat)(filePath);
|
|
153976
|
+
return stats.isDirectory() ? filePath : void 0;
|
|
153977
|
+
} catch {
|
|
153978
|
+
return void 0;
|
|
153979
|
+
}
|
|
153980
|
+
}
|
|
153981
|
+
async function migrateLegacyPiAgentDir(params) {
|
|
153982
|
+
if (params.legacyRootPath === params.globalRootPath) {
|
|
153983
|
+
return { migrated: false, copiedFiles: [] };
|
|
153984
|
+
}
|
|
153985
|
+
const globalAuthPath = (0, import_node_path28.join)(params.globalRootPath, "auth.json");
|
|
153986
|
+
if (await pathExists(globalAuthPath)) {
|
|
153987
|
+
return { migrated: false, copiedFiles: [] };
|
|
153988
|
+
}
|
|
153989
|
+
const legacyAuthPath = (0, import_node_path28.join)(params.legacyRootPath, "auth.json");
|
|
153990
|
+
if (!await pathExists(legacyAuthPath)) {
|
|
153991
|
+
return { migrated: false, copiedFiles: [] };
|
|
153992
|
+
}
|
|
153993
|
+
const legacyRoot = await safeResolveRealPath(params.legacyRootPath);
|
|
153994
|
+
if (!legacyRoot) {
|
|
153995
|
+
return { migrated: false, copiedFiles: [] };
|
|
153996
|
+
}
|
|
153997
|
+
await (0, import_promises22.mkdir)(params.globalRootPath, {
|
|
153998
|
+
recursive: true,
|
|
153999
|
+
mode: 448
|
|
154000
|
+
});
|
|
154001
|
+
const copiedFiles = [];
|
|
154002
|
+
for (const fileName of LEGACY_PI_AGENT_FILES) {
|
|
154003
|
+
const source = (0, import_node_path28.join)(params.legacyRootPath, fileName);
|
|
154004
|
+
if (!await pathExists(source)) {
|
|
154005
|
+
continue;
|
|
154006
|
+
}
|
|
154007
|
+
const destination = (0, import_node_path28.join)(params.globalRootPath, fileName);
|
|
154008
|
+
await (0, import_promises22.copyFile)(source, destination);
|
|
154009
|
+
await (0, import_promises22.chmod)(destination, 384).catch(() => {
|
|
154010
|
+
});
|
|
154011
|
+
copiedFiles.push(fileName);
|
|
154012
|
+
}
|
|
154013
|
+
return { migrated: true, copiedFiles };
|
|
154014
|
+
}
|
|
154015
|
+
|
|
154016
|
+
// src/services/soulRegistry.ts
|
|
154017
|
+
var import_promises23 = require("node:fs/promises");
|
|
154018
|
+
var import_node_path29 = require("node:path");
|
|
153950
154019
|
function resolveBasePromptPath(params) {
|
|
153951
154020
|
const filename = params.profile === "agent" ? "agent-system.md" : "coder-system.md";
|
|
153952
|
-
return (0,
|
|
154021
|
+
return (0, import_node_path29.join)(params.resourceRoot, "prompts", filename);
|
|
153953
154022
|
}
|
|
153954
154023
|
async function composeSystemPrompt(params) {
|
|
153955
154024
|
const soul = findSoul(params.soulId) ?? findSoul(DEFAULT_SOUL_ID);
|
|
@@ -153963,27 +154032,27 @@ async function composeSystemPrompt(params) {
|
|
|
153963
154032
|
if (!soul.promptFile) {
|
|
153964
154033
|
return basePromptPath;
|
|
153965
154034
|
}
|
|
153966
|
-
const overlayPath = (0,
|
|
154035
|
+
const overlayPath = (0, import_node_path29.join)(params.resourceRoot, "souls", soul.promptFile);
|
|
153967
154036
|
const [basePrompt, overlayPrompt] = await Promise.all([
|
|
153968
|
-
(0,
|
|
153969
|
-
(0,
|
|
154037
|
+
(0, import_promises23.readFile)(basePromptPath, "utf8"),
|
|
154038
|
+
(0, import_promises23.readFile)(overlayPath, "utf8")
|
|
153970
154039
|
]);
|
|
153971
|
-
const composedPath = (0,
|
|
154040
|
+
const composedPath = (0, import_node_path29.join)(params.agentRootPath, `system-prompt-${params.profile}.md`);
|
|
153972
154041
|
const composed = `${basePrompt.trimEnd()}
|
|
153973
154042
|
|
|
153974
154043
|
---
|
|
153975
154044
|
|
|
153976
154045
|
${overlayPrompt.trimEnd()}
|
|
153977
154046
|
`;
|
|
153978
|
-
await (0,
|
|
154047
|
+
await (0, import_promises23.mkdir)((0, import_node_path29.dirname)(composedPath), {
|
|
153979
154048
|
recursive: true,
|
|
153980
154049
|
mode: 448
|
|
153981
154050
|
});
|
|
153982
|
-
await (0,
|
|
154051
|
+
await (0, import_promises23.writeFile)(composedPath, composed, {
|
|
153983
154052
|
encoding: "utf8",
|
|
153984
154053
|
mode: 384
|
|
153985
154054
|
});
|
|
153986
|
-
await (0,
|
|
154055
|
+
await (0, import_promises23.chmod)(composedPath, 384);
|
|
153987
154056
|
return composedPath;
|
|
153988
154057
|
}
|
|
153989
154058
|
|
|
@@ -154050,10 +154119,10 @@ function resolvePackagedPiResourceRoot(options2 = {}) {
|
|
|
154050
154119
|
const dirname14 = options2.dirname ?? __dirname;
|
|
154051
154120
|
const fileExists = options2.existsSyncFn ?? import_node_fs17.existsSync;
|
|
154052
154121
|
const candidates = [
|
|
154053
|
-
(0,
|
|
154054
|
-
(0,
|
|
154055
|
-
(0,
|
|
154056
|
-
(0,
|
|
154122
|
+
(0, import_node_path30.resolve)(cwd, "apps/api-cli/resources/pi-agent"),
|
|
154123
|
+
(0, import_node_path30.resolve)(dirname14, "../resources/pi-agent"),
|
|
154124
|
+
(0, import_node_path30.resolve)(dirname14, "resources/pi-agent"),
|
|
154125
|
+
(0, import_node_path30.resolve)(cwd, "dist/apps/api-cli/resources/pi-agent")
|
|
154057
154126
|
];
|
|
154058
154127
|
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
154059
154128
|
if (!resolved) {
|
|
@@ -154074,23 +154143,23 @@ function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
|
|
|
154074
154143
|
}
|
|
154075
154144
|
};
|
|
154076
154145
|
const collectAncestorCandidates = (startDir) => {
|
|
154077
|
-
let currentDir = (0,
|
|
154146
|
+
let currentDir = (0, import_node_path30.resolve)(startDir);
|
|
154078
154147
|
while (true) {
|
|
154079
|
-
addCandidate((0,
|
|
154080
|
-
addCandidate((0,
|
|
154081
|
-
if ((0,
|
|
154082
|
-
addCandidate((0,
|
|
154148
|
+
addCandidate((0, import_node_path30.join)(currentDir, "dist", "apps", "api-cli", "agent-loader.js"));
|
|
154149
|
+
addCandidate((0, import_node_path30.join)(currentDir, "agent-loader.js"));
|
|
154150
|
+
if ((0, import_node_path30.basename)(currentDir) === "dist") {
|
|
154151
|
+
addCandidate((0, import_node_path30.join)(currentDir, "apps", "api-cli", "agent-loader.js"));
|
|
154083
154152
|
}
|
|
154084
|
-
const parentDir = (0,
|
|
154153
|
+
const parentDir = (0, import_node_path30.resolve)(currentDir, "..");
|
|
154085
154154
|
if (parentDir === currentDir) {
|
|
154086
154155
|
break;
|
|
154087
154156
|
}
|
|
154088
154157
|
currentDir = parentDir;
|
|
154089
154158
|
}
|
|
154090
154159
|
};
|
|
154091
|
-
addCandidate((0,
|
|
154092
|
-
addCandidate((0,
|
|
154093
|
-
addCandidate((0,
|
|
154160
|
+
addCandidate((0, import_node_path30.resolve)(cwd, "dist/apps/api-cli/agent-loader.js"));
|
|
154161
|
+
addCandidate((0, import_node_path30.resolve)(dirname14, "../agent-loader.js"));
|
|
154162
|
+
addCandidate((0, import_node_path30.resolve)(dirname14, "agent-loader.js"));
|
|
154094
154163
|
collectAncestorCandidates(cwd);
|
|
154095
154164
|
collectAncestorCandidates(dirname14);
|
|
154096
154165
|
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
@@ -154110,20 +154179,20 @@ function resolveDocyrusCliEntryPath(options2 = {}) {
|
|
|
154110
154179
|
if (!candidate) {
|
|
154111
154180
|
return;
|
|
154112
154181
|
}
|
|
154113
|
-
const resolvedCandidate = (0,
|
|
154182
|
+
const resolvedCandidate = (0, import_node_path30.resolve)(candidate);
|
|
154114
154183
|
if (!seen.has(resolvedCandidate)) {
|
|
154115
154184
|
seen.add(resolvedCandidate);
|
|
154116
154185
|
candidates.push(resolvedCandidate);
|
|
154117
154186
|
}
|
|
154118
154187
|
};
|
|
154119
154188
|
const argvScript = argv[1]?.trim();
|
|
154120
|
-
const normalizedArgvScript = argvScript ? argvScript.startsWith("/") ? argvScript : (0,
|
|
154189
|
+
const normalizedArgvScript = argvScript ? argvScript.startsWith("/") ? argvScript : (0, import_node_path30.resolve)(cwd, argvScript) : void 0;
|
|
154121
154190
|
if (normalizedArgvScript && normalizedArgvScript.endsWith(".js")) {
|
|
154122
154191
|
addCandidate(normalizedArgvScript);
|
|
154123
154192
|
}
|
|
154124
|
-
addCandidate((0,
|
|
154125
|
-
addCandidate((0,
|
|
154126
|
-
addCandidate((0,
|
|
154193
|
+
addCandidate((0, import_node_path30.resolve)(cwd, "dist/apps/api-cli/main.js"));
|
|
154194
|
+
addCandidate((0, import_node_path30.resolve)(dirname14, "../main.js"));
|
|
154195
|
+
addCandidate((0, import_node_path30.resolve)(dirname14, "main.js"));
|
|
154127
154196
|
if (normalizedArgvScript) {
|
|
154128
154197
|
addCandidate(normalizedArgvScript);
|
|
154129
154198
|
}
|
|
@@ -154146,32 +154215,32 @@ function resolveInstalledPiPackageRootPath(options2 = {}) {
|
|
|
154146
154215
|
}
|
|
154147
154216
|
};
|
|
154148
154217
|
const collectAncestorCandidates = (startDir) => {
|
|
154149
|
-
let currentDir = (0,
|
|
154218
|
+
let currentDir = (0, import_node_path30.resolve)(startDir);
|
|
154150
154219
|
while (true) {
|
|
154151
|
-
addCandidate((0,
|
|
154152
|
-
if ((0,
|
|
154153
|
-
addCandidate((0,
|
|
154220
|
+
addCandidate((0, import_node_path30.join)(currentDir, "node_modules", "@mariozechner", "pi-coding-agent", "package.json"));
|
|
154221
|
+
if ((0, import_node_path30.basename)(currentDir) === "node_modules") {
|
|
154222
|
+
addCandidate((0, import_node_path30.join)(currentDir, "@mariozechner", "pi-coding-agent", "package.json"));
|
|
154154
154223
|
}
|
|
154155
|
-
const parentDir = (0,
|
|
154224
|
+
const parentDir = (0, import_node_path30.resolve)(currentDir, "..");
|
|
154156
154225
|
if (parentDir === currentDir) {
|
|
154157
154226
|
break;
|
|
154158
154227
|
}
|
|
154159
154228
|
currentDir = parentDir;
|
|
154160
154229
|
}
|
|
154161
154230
|
};
|
|
154162
|
-
addCandidate((0,
|
|
154163
|
-
addCandidate((0,
|
|
154231
|
+
addCandidate((0, import_node_path30.resolve)(cwd, "apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
|
|
154232
|
+
addCandidate((0, import_node_path30.resolve)(dirname14, "../../../apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
|
|
154164
154233
|
collectAncestorCandidates(cwd);
|
|
154165
154234
|
collectAncestorCandidates(dirname14);
|
|
154166
154235
|
const resolvedPackageJson = candidates.find((candidate) => fileExists(candidate));
|
|
154167
154236
|
if (!resolvedPackageJson) {
|
|
154168
154237
|
throw new UserInputError(`Unable to locate the installed pi package root. Checked: ${candidates.join(", ")}`);
|
|
154169
154238
|
}
|
|
154170
|
-
return (0,
|
|
154239
|
+
return (0, import_node_path30.resolve)(resolvedPackageJson, "..");
|
|
154171
154240
|
}
|
|
154172
154241
|
function createPiAgentRuntimeSkill(params) {
|
|
154173
154242
|
const commandPrefix = params.scope === "global" ? "docyrus -g" : "docyrus";
|
|
154174
|
-
const knowledgeDir = (0,
|
|
154243
|
+
const knowledgeDir = (0, import_node_path30.join)(params.cwd, "docyrus", "knowledge");
|
|
154175
154244
|
const hasKnowledgeGraph = (0, import_node_fs17.existsSync)(knowledgeDir);
|
|
154176
154245
|
const authLines = params.activeProfile ? [
|
|
154177
154246
|
`- email: \`${params.activeProfile.email}\``,
|
|
@@ -154225,35 +154294,35 @@ function createPiAgentRuntimeSkill(params) {
|
|
|
154225
154294
|
].join("\n");
|
|
154226
154295
|
}
|
|
154227
154296
|
async function syncPackagedSkills(params) {
|
|
154228
|
-
const sourceSkillsRoot = (0,
|
|
154229
|
-
const targetSkillsRoot = (0,
|
|
154230
|
-
await (0,
|
|
154297
|
+
const sourceSkillsRoot = (0, import_node_path30.join)(params.resourceRoot, "skills");
|
|
154298
|
+
const targetSkillsRoot = (0, import_node_path30.join)(params.agentRootPath, "skills");
|
|
154299
|
+
await (0, import_promises24.mkdir)(targetSkillsRoot, {
|
|
154231
154300
|
recursive: true,
|
|
154232
154301
|
mode: 448
|
|
154233
154302
|
});
|
|
154234
|
-
const entries = await (0,
|
|
154303
|
+
const entries = await (0, import_promises24.readdir)(sourceSkillsRoot, {
|
|
154235
154304
|
withFileTypes: true
|
|
154236
154305
|
});
|
|
154237
154306
|
await Promise.all(DOCYRUS_MIGRATED_SKILL_NAMES.map(async (skillName) => {
|
|
154238
|
-
await (0,
|
|
154307
|
+
await (0, import_promises24.rm)((0, import_node_path30.join)(targetSkillsRoot, skillName), {
|
|
154239
154308
|
recursive: true,
|
|
154240
154309
|
force: true
|
|
154241
154310
|
});
|
|
154242
154311
|
}));
|
|
154243
154312
|
await Promise.all(entries.map(async (entry) => {
|
|
154244
|
-
await (0,
|
|
154313
|
+
await (0, import_promises24.cp)((0, import_node_path30.join)(sourceSkillsRoot, entry.name), (0, import_node_path30.join)(targetSkillsRoot, entry.name), {
|
|
154245
154314
|
recursive: true,
|
|
154246
154315
|
force: true
|
|
154247
154316
|
});
|
|
154248
154317
|
}));
|
|
154249
154318
|
}
|
|
154250
154319
|
async function writeRuntimeSkill(params) {
|
|
154251
|
-
const runtimeSkillDir = (0,
|
|
154252
|
-
await (0,
|
|
154320
|
+
const runtimeSkillDir = (0, import_node_path30.join)(params.agentRootPath, "skills", "docyrus-runtime-context");
|
|
154321
|
+
await (0, import_promises24.mkdir)(runtimeSkillDir, {
|
|
154253
154322
|
recursive: true,
|
|
154254
154323
|
mode: 448
|
|
154255
154324
|
});
|
|
154256
|
-
await (0,
|
|
154325
|
+
await (0, import_promises24.writeFile)((0, import_node_path30.join)(runtimeSkillDir, "SKILL.md"), `${params.content}
|
|
154257
154326
|
`, {
|
|
154258
154327
|
encoding: "utf8",
|
|
154259
154328
|
mode: 384
|
|
@@ -154266,10 +154335,10 @@ function resolveNpmCommand() {
|
|
|
154266
154335
|
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
154267
154336
|
}
|
|
154268
154337
|
function resolveManagedDiffityInstallRoot(agentRootPath) {
|
|
154269
|
-
return (0,
|
|
154338
|
+
return (0, import_node_path30.join)(agentRootPath, "tools", "diffity");
|
|
154270
154339
|
}
|
|
154271
154340
|
function resolveManagedDiffityExecutablePath(agentRootPath) {
|
|
154272
|
-
return (0,
|
|
154341
|
+
return (0, import_node_path30.join)(
|
|
154273
154342
|
resolveManagedDiffityInstallRoot(agentRootPath),
|
|
154274
154343
|
"node_modules",
|
|
154275
154344
|
".bin",
|
|
@@ -154277,10 +154346,10 @@ function resolveManagedDiffityExecutablePath(agentRootPath) {
|
|
|
154277
154346
|
);
|
|
154278
154347
|
}
|
|
154279
154348
|
function prependPathEntry(entry, existingPath) {
|
|
154280
|
-
const values = existingPath ? existingPath.split(
|
|
154349
|
+
const values = existingPath ? existingPath.split(import_node_path30.delimiter).filter((value2) => value2.trim().length > 0) : [];
|
|
154281
154350
|
const normalizedEntry = entry.trim();
|
|
154282
154351
|
const remaining = values.filter((value2) => value2 !== normalizedEntry);
|
|
154283
|
-
return [normalizedEntry, ...remaining].join(
|
|
154352
|
+
return [normalizedEntry, ...remaining].join(import_node_path30.delimiter);
|
|
154284
154353
|
}
|
|
154285
154354
|
function createDocyrusSkillsInstallArgs(scope) {
|
|
154286
154355
|
const args2 = [
|
|
@@ -154318,7 +154387,7 @@ function createPackagedDocyrusPlatformInstallArgs(params) {
|
|
|
154318
154387
|
return args2;
|
|
154319
154388
|
}
|
|
154320
154389
|
async function installExternalDocyrusSkillsOnce(params) {
|
|
154321
|
-
const markerPath = (0,
|
|
154390
|
+
const markerPath = (0, import_node_path30.join)(params.agentRootPath, DOCYRUS_EXTERNAL_SKILL_MARKER_FILE);
|
|
154322
154391
|
if ((0, import_node_fs17.existsSync)(markerPath)) {
|
|
154323
154392
|
return;
|
|
154324
154393
|
}
|
|
@@ -154337,7 +154406,7 @@ async function installExternalDocyrusSkillsOnce(params) {
|
|
|
154337
154406
|
);
|
|
154338
154407
|
return;
|
|
154339
154408
|
}
|
|
154340
|
-
await (0,
|
|
154409
|
+
await (0, import_promises24.writeFile)(markerPath, `${JSON.stringify({
|
|
154341
154410
|
source: DOCYRUS_EXTERNAL_SKILL_SOURCE,
|
|
154342
154411
|
skills: DOCYRUS_MIGRATED_SKILL_NAMES,
|
|
154343
154412
|
agents: DOCYRUS_EXTERNAL_SKILL_AGENT_IDS,
|
|
@@ -154351,7 +154420,7 @@ async function installExternalDocyrusSkillsOnce(params) {
|
|
|
154351
154420
|
}
|
|
154352
154421
|
async function ensureManagedDiffityInstalled(params) {
|
|
154353
154422
|
const executablePath = resolveManagedDiffityExecutablePath(params.agentRootPath);
|
|
154354
|
-
const binDir = (0,
|
|
154423
|
+
const binDir = (0, import_node_path30.dirname)(executablePath);
|
|
154355
154424
|
if ((0, import_node_fs17.existsSync)(executablePath)) {
|
|
154356
154425
|
return {
|
|
154357
154426
|
available: true,
|
|
@@ -154390,19 +154459,19 @@ async function ensureManagedDiffityInstalled(params) {
|
|
|
154390
154459
|
};
|
|
154391
154460
|
}
|
|
154392
154461
|
function resolvePackagedDocyrusPlatformSkillPath(resourceRoot) {
|
|
154393
|
-
return (0,
|
|
154462
|
+
return (0, import_node_path30.join)(resourceRoot, "skills", DOCYRUS_PACKAGED_PLATFORM_SKILL_NAME);
|
|
154394
154463
|
}
|
|
154395
154464
|
function resolvePackagedOfficeCliRootPath(resourceRoot) {
|
|
154396
|
-
return (0,
|
|
154465
|
+
return (0, import_node_path30.join)((0, import_node_path30.resolve)(resourceRoot, ".."), "officecli");
|
|
154397
154466
|
}
|
|
154398
154467
|
function resolvePackagedOfficeCliManifestPath(resourceRoot) {
|
|
154399
|
-
return (0,
|
|
154468
|
+
return (0, import_node_path30.join)(resolvePackagedOfficeCliRootPath(resourceRoot), DOCYRUS_OFFICECLI_MANIFEST_FILE_NAME);
|
|
154400
154469
|
}
|
|
154401
154470
|
function resolveManagedOfficeCliInstallRoot(agentRootPath) {
|
|
154402
|
-
return (0,
|
|
154471
|
+
return (0, import_node_path30.join)(agentRootPath, "tools", "officecli");
|
|
154403
154472
|
}
|
|
154404
154473
|
function resolveManagedOfficeCliExecutablePath(agentRootPath) {
|
|
154405
|
-
return (0,
|
|
154474
|
+
return (0, import_node_path30.join)(
|
|
154406
154475
|
resolveManagedOfficeCliInstallRoot(agentRootPath),
|
|
154407
154476
|
process.platform === "win32" ? "officecli.exe" : "officecli"
|
|
154408
154477
|
);
|
|
@@ -154444,14 +154513,14 @@ function resolveOfficeCliReleaseAssetName(options2 = {}) {
|
|
|
154444
154513
|
throw new UserInputError(`OfficeCLI is not supported on ${platform2}/${arch}.`);
|
|
154445
154514
|
}
|
|
154446
154515
|
function resolvePackagedOfficeCliExecutablePath(resourceRoot, options2) {
|
|
154447
|
-
return (0,
|
|
154516
|
+
return (0, import_node_path30.join)(
|
|
154448
154517
|
resolvePackagedOfficeCliRootPath(resourceRoot),
|
|
154449
154518
|
"bundled",
|
|
154450
154519
|
resolveOfficeCliReleaseAssetName(options2)
|
|
154451
154520
|
);
|
|
154452
154521
|
}
|
|
154453
154522
|
async function readPackagedOfficeCliVersion(resourceRoot) {
|
|
154454
|
-
const manifestRaw = await (0,
|
|
154523
|
+
const manifestRaw = await (0, import_promises24.readFile)(resolvePackagedOfficeCliManifestPath(resourceRoot), "utf8");
|
|
154455
154524
|
const manifest = JSON.parse(manifestRaw);
|
|
154456
154525
|
const version2 = typeof manifest.version === "string" ? manifest.version.trim() : "";
|
|
154457
154526
|
if (version2.length === 0) {
|
|
@@ -154467,12 +154536,12 @@ async function downloadOfficeCliBinary(params) {
|
|
|
154467
154536
|
throw new UserInputError(`OfficeCLI download failed with status ${response.status}.`);
|
|
154468
154537
|
}
|
|
154469
154538
|
const binary2 = Buffer.from(await response.arrayBuffer());
|
|
154470
|
-
await (0,
|
|
154539
|
+
await (0, import_promises24.writeFile)(params.destinationPath, binary2, {
|
|
154471
154540
|
mode: process.platform === "win32" ? 384 : 448
|
|
154472
154541
|
});
|
|
154473
154542
|
}
|
|
154474
154543
|
function resolveManagedOfficeCliConfigMarkerPath(agentRootPath) {
|
|
154475
|
-
return (0,
|
|
154544
|
+
return (0, import_node_path30.join)(resolveManagedOfficeCliInstallRoot(agentRootPath), ".docyrus-officecli-configured.json");
|
|
154476
154545
|
}
|
|
154477
154546
|
async function disableManagedOfficeCliAutoUpdate(params) {
|
|
154478
154547
|
const markerPath = resolveManagedOfficeCliConfigMarkerPath(params.agentRootPath);
|
|
@@ -154495,7 +154564,7 @@ async function disableManagedOfficeCliAutoUpdate(params) {
|
|
|
154495
154564
|
);
|
|
154496
154565
|
return;
|
|
154497
154566
|
}
|
|
154498
|
-
await (0,
|
|
154567
|
+
await (0, import_promises24.writeFile)(markerPath, `${JSON.stringify({
|
|
154499
154568
|
configuredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
154500
154569
|
}, null, 2)}
|
|
154501
154570
|
`, {
|
|
@@ -154505,7 +154574,7 @@ async function disableManagedOfficeCliAutoUpdate(params) {
|
|
|
154505
154574
|
}
|
|
154506
154575
|
async function ensureManagedOfficeCliInstalled(params) {
|
|
154507
154576
|
const executablePath = resolveManagedOfficeCliExecutablePath(params.agentRootPath);
|
|
154508
|
-
const binDir = (0,
|
|
154577
|
+
const binDir = (0, import_node_path30.dirname)(executablePath);
|
|
154509
154578
|
if ((0, import_node_fs17.existsSync)(executablePath)) {
|
|
154510
154579
|
await disableManagedOfficeCliAutoUpdate({
|
|
154511
154580
|
agentRootPath: params.agentRootPath,
|
|
@@ -154521,13 +154590,13 @@ async function ensureManagedOfficeCliInstalled(params) {
|
|
|
154521
154590
|
}
|
|
154522
154591
|
const tempPath = `${executablePath}.download${process.platform === "win32" ? ".exe" : ""}`;
|
|
154523
154592
|
try {
|
|
154524
|
-
await (0,
|
|
154593
|
+
await (0, import_promises24.mkdir)(binDir, {
|
|
154525
154594
|
recursive: true,
|
|
154526
154595
|
mode: 448
|
|
154527
154596
|
});
|
|
154528
154597
|
const bundledExecutablePath = resolvePackagedOfficeCliExecutablePath(params.resourceRoot);
|
|
154529
154598
|
if ((0, import_node_fs17.existsSync)(bundledExecutablePath)) {
|
|
154530
|
-
await (0,
|
|
154599
|
+
await (0, import_promises24.cp)(bundledExecutablePath, tempPath, {
|
|
154531
154600
|
force: true
|
|
154532
154601
|
});
|
|
154533
154602
|
} else {
|
|
@@ -154537,7 +154606,7 @@ async function ensureManagedOfficeCliInstalled(params) {
|
|
|
154537
154606
|
});
|
|
154538
154607
|
}
|
|
154539
154608
|
if (process.platform !== "win32") {
|
|
154540
|
-
await (0,
|
|
154609
|
+
await (0, import_promises24.chmod)(tempPath, 448);
|
|
154541
154610
|
}
|
|
154542
154611
|
const verificationResult = params.spawnCommand(tempPath, ["--version"], {
|
|
154543
154612
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -154553,9 +154622,9 @@ async function ensureManagedOfficeCliInstalled(params) {
|
|
|
154553
154622
|
verificationResult.error?.message || summarizeFailure3(verificationResult, "officecli --version")
|
|
154554
154623
|
);
|
|
154555
154624
|
}
|
|
154556
|
-
await (0,
|
|
154625
|
+
await (0, import_promises24.rename)(tempPath, executablePath);
|
|
154557
154626
|
if (process.platform !== "win32") {
|
|
154558
|
-
await (0,
|
|
154627
|
+
await (0, import_promises24.chmod)(executablePath, 448);
|
|
154559
154628
|
}
|
|
154560
154629
|
await disableManagedOfficeCliAutoUpdate({
|
|
154561
154630
|
agentRootPath: params.agentRootPath,
|
|
@@ -154569,7 +154638,7 @@ async function ensureManagedOfficeCliInstalled(params) {
|
|
|
154569
154638
|
binDir
|
|
154570
154639
|
};
|
|
154571
154640
|
} catch (error48) {
|
|
154572
|
-
await (0,
|
|
154641
|
+
await (0, import_promises24.rm)(tempPath, {
|
|
154573
154642
|
force: true
|
|
154574
154643
|
});
|
|
154575
154644
|
process.stderr.write(
|
|
@@ -154628,6 +154697,7 @@ function createPiAgentLauncher(options2) {
|
|
|
154628
154697
|
const resolveLoaderPath = options2.resolveDocyrusPiLoaderEntryPathFn ?? resolveDocyrusPiLoaderEntryPath;
|
|
154629
154698
|
const resolveCliEntryPath = options2.resolveDocyrusCliEntryPathFn ?? resolveDocyrusCliEntryPath;
|
|
154630
154699
|
const resolvePiPackageRoot = options2.resolveInstalledPiPackageRootPathFn ?? resolveInstalledPiPackageRootPath;
|
|
154700
|
+
const resolveAgentRootPath = options2.resolveAgentRootPathFn ?? getDocyrusPiAgentGlobalRootPath;
|
|
154631
154701
|
return async (request) => {
|
|
154632
154702
|
validatePiAgentLaunchRequest({
|
|
154633
154703
|
request,
|
|
@@ -154637,7 +154707,12 @@ function createPiAgentLauncher(options2) {
|
|
|
154637
154707
|
const activeEnvironment = await options2.environmentConfigService.getActiveEnvironment();
|
|
154638
154708
|
const activeProfile = await options2.authStore.getActiveProfile(activeEnvironment.apiBaseUrl);
|
|
154639
154709
|
const settingsRootPath = options2.settingsPaths.rootPath;
|
|
154640
|
-
const agentRootPath =
|
|
154710
|
+
const agentRootPath = resolveAgentRootPath();
|
|
154711
|
+
await migrateLegacyPiAgentDir({
|
|
154712
|
+
legacyRootPath: resolveDocyrusPiAgentRootPath(settingsRootPath),
|
|
154713
|
+
globalRootPath: agentRootPath
|
|
154714
|
+
}).catch(() => {
|
|
154715
|
+
});
|
|
154641
154716
|
const resourceRoot = resolveResourceRoot({ cwd });
|
|
154642
154717
|
spinner.update("Syncing skills...");
|
|
154643
154718
|
await syncPackagedSkills({
|
|
@@ -154708,6 +154783,9 @@ function createPiAgentLauncher(options2) {
|
|
|
154708
154783
|
...process.env,
|
|
154709
154784
|
PI_CODING_AGENT_DIR: agentRootPath,
|
|
154710
154785
|
PI_PACKAGE_DIR: piPackageRoot,
|
|
154786
|
+
// Disable pi-mono's install-telemetry ping (added in pi-mono v0.67.0).
|
|
154787
|
+
// Only users explicitly opting in via DOCYRUS_PI_ENABLE_TELEMETRY=1 will let it fire.
|
|
154788
|
+
PI_TELEMETRY: process.env.DOCYRUS_PI_ENABLE_TELEMETRY === "1" ? process.env.PI_TELEMETRY ?? "" : "0",
|
|
154711
154789
|
DOCYRUS_PI_REQUEST: JSON.stringify(request),
|
|
154712
154790
|
DOCYRUS_PI_VERSION: options2.version || "dev",
|
|
154713
154791
|
DOCYRUS_PI_SYSTEM_PROMPT_PATH: systemPromptPath,
|
|
@@ -154733,7 +154811,7 @@ function createPiAgentLauncher(options2) {
|
|
|
154733
154811
|
// src/services/piAgentServerLauncher.ts
|
|
154734
154812
|
var import_node_child_process9 = require("node:child_process");
|
|
154735
154813
|
var import_node_fs18 = require("node:fs");
|
|
154736
|
-
var
|
|
154814
|
+
var import_node_path31 = require("node:path");
|
|
154737
154815
|
function serializePiAgentServerRequest(request) {
|
|
154738
154816
|
return JSON.stringify(request);
|
|
154739
154817
|
}
|
|
@@ -154747,23 +154825,23 @@ function resolveServerLoaderEntryPath(cwd, dirname14) {
|
|
|
154747
154825
|
}
|
|
154748
154826
|
};
|
|
154749
154827
|
const collectAncestorCandidates = (startDir) => {
|
|
154750
|
-
let currentDir = (0,
|
|
154828
|
+
let currentDir = (0, import_node_path31.resolve)(startDir);
|
|
154751
154829
|
while (true) {
|
|
154752
|
-
addCandidate((0,
|
|
154753
|
-
addCandidate((0,
|
|
154754
|
-
if ((0,
|
|
154755
|
-
addCandidate((0,
|
|
154830
|
+
addCandidate((0, import_node_path31.join)(currentDir, "dist", "apps", "api-cli", "server-loader.js"));
|
|
154831
|
+
addCandidate((0, import_node_path31.join)(currentDir, "server-loader.js"));
|
|
154832
|
+
if ((0, import_node_path31.basename)(currentDir) === "dist") {
|
|
154833
|
+
addCandidate((0, import_node_path31.join)(currentDir, "apps", "api-cli", "server-loader.js"));
|
|
154756
154834
|
}
|
|
154757
|
-
const parentDir = (0,
|
|
154835
|
+
const parentDir = (0, import_node_path31.resolve)(currentDir, "..");
|
|
154758
154836
|
if (parentDir === currentDir) {
|
|
154759
154837
|
break;
|
|
154760
154838
|
}
|
|
154761
154839
|
currentDir = parentDir;
|
|
154762
154840
|
}
|
|
154763
154841
|
};
|
|
154764
|
-
addCandidate((0,
|
|
154765
|
-
addCandidate((0,
|
|
154766
|
-
addCandidate((0,
|
|
154842
|
+
addCandidate((0, import_node_path31.resolve)(cwd, "dist/apps/api-cli/server-loader.js"));
|
|
154843
|
+
addCandidate((0, import_node_path31.resolve)(dirname14, "../server-loader.js"));
|
|
154844
|
+
addCandidate((0, import_node_path31.resolve)(dirname14, "server-loader.js"));
|
|
154767
154845
|
collectAncestorCandidates(cwd);
|
|
154768
154846
|
collectAncestorCandidates(dirname14);
|
|
154769
154847
|
const resolved = candidates.find((candidate) => (0, import_node_fs18.existsSync)(candidate));
|
|
@@ -154774,12 +154852,18 @@ function resolveServerLoaderEntryPath(cwd, dirname14) {
|
|
|
154774
154852
|
}
|
|
154775
154853
|
function createPiAgentServerLauncher(options2) {
|
|
154776
154854
|
const cwd = options2.cwd ?? process.cwd();
|
|
154855
|
+
const resolveAgentRootPath = options2.resolveAgentRootPathFn ?? getDocyrusPiAgentGlobalRootPath;
|
|
154777
154856
|
return async (request) => {
|
|
154778
154857
|
const spinner = createSpinner("Initializing...");
|
|
154779
154858
|
const activeEnvironment = await options2.environmentConfigService.getActiveEnvironment();
|
|
154780
154859
|
const activeProfile = await options2.authStore.getActiveProfile(activeEnvironment.apiBaseUrl);
|
|
154781
154860
|
const settingsRootPath = options2.settingsPaths.rootPath;
|
|
154782
|
-
const agentRootPath =
|
|
154861
|
+
const agentRootPath = resolveAgentRootPath();
|
|
154862
|
+
await migrateLegacyPiAgentDir({
|
|
154863
|
+
legacyRootPath: resolveDocyrusPiAgentRootPath(settingsRootPath),
|
|
154864
|
+
globalRootPath: agentRootPath
|
|
154865
|
+
}).catch(() => {
|
|
154866
|
+
});
|
|
154783
154867
|
const resourceRoot = resolvePackagedPiResourceRoot({ cwd });
|
|
154784
154868
|
spinner.update("Syncing skills...");
|
|
154785
154869
|
await syncPackagedSkills({
|
|
@@ -154819,7 +154903,7 @@ function createPiAgentServerLauncher(options2) {
|
|
|
154819
154903
|
if (request.sandbox) {
|
|
154820
154904
|
const browserConfigDir = settingsRootPath;
|
|
154821
154905
|
(0, import_node_fs18.mkdirSync)(browserConfigDir, { recursive: true, mode: 448 });
|
|
154822
|
-
const browserConfigPath = (0,
|
|
154906
|
+
const browserConfigPath = (0, import_node_path31.join)(browserConfigDir, "browser.json");
|
|
154823
154907
|
const appId = process.env.DOCYRUS_SANDBOX_APP_ID || "";
|
|
154824
154908
|
(0, import_node_fs18.writeFileSync)(browserConfigPath, JSON.stringify({ mode: "sandbox", appId }, null, 2) + "\n", {
|
|
154825
154909
|
encoding: "utf8",
|
|
@@ -154846,6 +154930,9 @@ function createPiAgentServerLauncher(options2) {
|
|
|
154846
154930
|
PATH: runtimePath,
|
|
154847
154931
|
PI_CODING_AGENT_DIR: agentRootPath,
|
|
154848
154932
|
PI_PACKAGE_DIR: piPackageRoot,
|
|
154933
|
+
// Disable pi-mono's install-telemetry ping (added in pi-mono v0.67.0).
|
|
154934
|
+
// Only users explicitly opting in via DOCYRUS_PI_ENABLE_TELEMETRY=1 will let it fire.
|
|
154935
|
+
PI_TELEMETRY: process.env.DOCYRUS_PI_ENABLE_TELEMETRY === "1" ? process.env.PI_TELEMETRY ?? "" : "0",
|
|
154849
154936
|
DOCYRUS_PI_REQUEST: serializePiAgentServerRequest(request),
|
|
154850
154937
|
DOCYRUS_PI_VERSION: options2.version || "dev",
|
|
154851
154938
|
DOCYRUS_PI_SYSTEM_PROMPT_PATH: systemPromptPath,
|
|
@@ -154904,8 +154991,8 @@ async function runWithIncurSkillsOutOfDateWarningSuppressed(params) {
|
|
|
154904
154991
|
}
|
|
154905
154992
|
|
|
154906
154993
|
// src/services/tenantOpenApi.ts
|
|
154907
|
-
var
|
|
154908
|
-
var
|
|
154994
|
+
var import_promises25 = require("node:fs/promises");
|
|
154995
|
+
var import_node_path32 = require("node:path");
|
|
154909
154996
|
function resolveSourceUrl(tenantId, template) {
|
|
154910
154997
|
return template.replace("{tenantId}", encodeURIComponent(tenantId));
|
|
154911
154998
|
}
|
|
@@ -154930,16 +155017,16 @@ var TenantOpenApiService = class {
|
|
|
154930
155017
|
params;
|
|
154931
155018
|
async #writeOpenApiFile(tenantId, parsedContent) {
|
|
154932
155019
|
const filePath = this.getTenantOpenApiFilePath(tenantId);
|
|
154933
|
-
await (0,
|
|
155020
|
+
await (0, import_promises25.mkdir)((0, import_node_path32.dirname)(filePath), {
|
|
154934
155021
|
recursive: true,
|
|
154935
155022
|
mode: 448
|
|
154936
155023
|
});
|
|
154937
|
-
await (0,
|
|
155024
|
+
await (0, import_promises25.writeFile)(filePath, `${JSON.stringify(parsedContent, null, 2)}
|
|
154938
155025
|
`, {
|
|
154939
155026
|
encoding: "utf8",
|
|
154940
155027
|
mode: 384
|
|
154941
155028
|
});
|
|
154942
|
-
await (0,
|
|
155029
|
+
await (0, import_promises25.chmod)(filePath, 384);
|
|
154943
155030
|
return filePath;
|
|
154944
155031
|
}
|
|
154945
155032
|
async #generateTenantOpenApiViaAuthenticatedEndpoint(tenantId, options2) {
|
|
@@ -154976,7 +155063,7 @@ var TenantOpenApiService = class {
|
|
|
154976
155063
|
throw new AuthSessionError("Tenant ID is required to resolve OpenAPI spec path.");
|
|
154977
155064
|
}
|
|
154978
155065
|
const rootPath = this.params?.rootPath || TENANT_OPENAPI_ROOT_PATH;
|
|
154979
|
-
return (0,
|
|
155066
|
+
return (0, import_node_path32.join)(rootPath, normalizedTenantId, "openapi.json");
|
|
154980
155067
|
}
|
|
154981
155068
|
async downloadTenantOpenApi(tenantId, options2 = {}) {
|
|
154982
155069
|
const normalizedTenantId = tenantId.trim();
|