@docyrus/docyrus 0.0.17 → 0.0.19
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 +8 -0
- package/agent-loader.js +2640 -0
- package/agent-loader.js.map +7 -0
- package/main.js +74 -108
- package/main.js.map +2 -2
- package/package.json +5 -2
- package/resources/pi-agent/skills/docyrus-api-dev/references/data-source-query-guide.md +2 -2
- package/resources/pi-agent/skills/docyrus-api-dev/references/formula-design-guide-llm.md +1 -1
- package/resources/pi-agent/skills/docyrus-app-dev/references/data-source-query-guide.md +2 -2
- package/resources/pi-agent/skills/docyrus-app-dev/references/formula-design-guide-llm.md +1 -1
- package/resources/pi-agent/skills/docyrus-architect/references/data-source-query-guide.md +2 -2
- package/resources/pi-agent/skills/docyrus-architect/references/formula-design-guide-llm.md +1 -1
- package/resources/pi-agent/skills/docyrus-architect/references/formula-reference.md +2 -2
package/main.js
CHANGED
|
@@ -124678,7 +124678,7 @@ function buildInputSchema(args, env2, options2) {
|
|
|
124678
124678
|
// package.json
|
|
124679
124679
|
var package_default = {
|
|
124680
124680
|
name: "@docyrus/docyrus",
|
|
124681
|
-
version: "0.0.
|
|
124681
|
+
version: "0.0.19",
|
|
124682
124682
|
private: false,
|
|
124683
124683
|
description: "Docyrus API CLI",
|
|
124684
124684
|
main: "./main.js",
|
|
@@ -124686,12 +124686,15 @@ var package_default = {
|
|
|
124686
124686
|
docyrus: "main.js"
|
|
124687
124687
|
},
|
|
124688
124688
|
dependencies: {
|
|
124689
|
-
"@
|
|
124689
|
+
"@clack/prompts": "^0.11.0",
|
|
124690
|
+
"@mariozechner/pi-ai": "0.60.0",
|
|
124691
|
+
"@mariozechner/pi-coding-agent": "0.60.0",
|
|
124690
124692
|
"@opentui/core": "^0.1.85",
|
|
124691
124693
|
"@opentui/react": "^0.1.85",
|
|
124692
124694
|
incur: "^0.1.6",
|
|
124693
124695
|
marked: "^15.0.12",
|
|
124694
124696
|
"marked-terminal": "^7.3.0",
|
|
124697
|
+
picocolors: "^1.1.1",
|
|
124695
124698
|
react: "^19.1.1",
|
|
124696
124699
|
undici: "^7.16.0"
|
|
124697
124700
|
},
|
|
@@ -128921,12 +128924,12 @@ function summarizeFailure2(result) {
|
|
|
128921
128924
|
return stderr;
|
|
128922
128925
|
}
|
|
128923
128926
|
if (typeof result.status === "number") {
|
|
128924
|
-
return `pi
|
|
128927
|
+
return `Docyrus pi loader exited with code ${result.status}.`;
|
|
128925
128928
|
}
|
|
128926
128929
|
if (result.signal) {
|
|
128927
|
-
return `pi
|
|
128930
|
+
return `Docyrus pi loader exited due to signal ${result.signal}.`;
|
|
128928
128931
|
}
|
|
128929
|
-
return "pi
|
|
128932
|
+
return "Docyrus pi loader terminated unexpectedly.";
|
|
128930
128933
|
}
|
|
128931
128934
|
function resolvePackagedPiResourceRoot(options2 = {}) {
|
|
128932
128935
|
const cwd = options2.cwd ?? process.cwd();
|
|
@@ -128940,17 +128943,14 @@ function resolvePackagedPiResourceRoot(options2 = {}) {
|
|
|
128940
128943
|
];
|
|
128941
128944
|
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
128942
128945
|
if (!resolved) {
|
|
128943
|
-
throw new UserInputError(
|
|
128944
|
-
`Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`
|
|
128945
|
-
);
|
|
128946
|
+
throw new UserInputError(`Unable to locate pi agent resources. Checked: ${candidates.join(", ")}`);
|
|
128946
128947
|
}
|
|
128947
128948
|
return resolved;
|
|
128948
128949
|
}
|
|
128949
|
-
function
|
|
128950
|
-
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
128950
|
+
function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
|
|
128951
128951
|
const cwd = options2.cwd ?? process.cwd();
|
|
128952
128952
|
const dirname6 = options2.dirname ?? __dirname;
|
|
128953
|
-
const
|
|
128953
|
+
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
128954
128954
|
const seen = /* @__PURE__ */ new Set();
|
|
128955
128955
|
const candidates = options2.candidatePaths ?? [];
|
|
128956
128956
|
const addCandidate = (candidate) => {
|
|
@@ -128962,9 +128962,10 @@ function resolveInstalledPiCliEntryPath(options2 = {}) {
|
|
|
128962
128962
|
const collectAncestorCandidates = (startDir) => {
|
|
128963
128963
|
let currentDir = (0, import_node_path9.resolve)(startDir);
|
|
128964
128964
|
while (true) {
|
|
128965
|
-
addCandidate((0, import_node_path9.join)(currentDir, "
|
|
128966
|
-
|
|
128967
|
-
|
|
128965
|
+
addCandidate((0, import_node_path9.join)(currentDir, "dist", "apps", "api-cli", "agent-loader.js"));
|
|
128966
|
+
addCandidate((0, import_node_path9.join)(currentDir, "agent-loader.js"));
|
|
128967
|
+
if ((0, import_node_path9.basename)(currentDir) === "dist") {
|
|
128968
|
+
addCandidate((0, import_node_path9.join)(currentDir, "apps", "api-cli", "agent-loader.js"));
|
|
128968
128969
|
}
|
|
128969
128970
|
const parentDir = (0, import_node_path9.resolve)(currentDir, "..");
|
|
128970
128971
|
if (parentDir === currentDir) {
|
|
@@ -128973,78 +128974,51 @@ function resolveInstalledPiCliEntryPath(options2 = {}) {
|
|
|
128973
128974
|
currentDir = parentDir;
|
|
128974
128975
|
}
|
|
128975
128976
|
};
|
|
128976
|
-
addCandidate((0, import_node_path9.resolve)(cwd, "apps/api-cli/
|
|
128977
|
+
addCandidate((0, import_node_path9.resolve)(cwd, "dist/apps/api-cli/agent-loader.js"));
|
|
128978
|
+
addCandidate((0, import_node_path9.resolve)(dirname6, "../agent-loader.js"));
|
|
128979
|
+
addCandidate((0, import_node_path9.resolve)(dirname6, "agent-loader.js"));
|
|
128977
128980
|
collectAncestorCandidates(cwd);
|
|
128978
128981
|
collectAncestorCandidates(dirname6);
|
|
128979
|
-
const
|
|
128980
|
-
if (!
|
|
128981
|
-
throw new UserInputError(`Unable to locate pi
|
|
128982
|
+
const resolved = candidates.find((candidate) => fileExists(candidate));
|
|
128983
|
+
if (!resolved) {
|
|
128984
|
+
throw new UserInputError(`Unable to locate Docyrus pi loader entry file. Checked: ${candidates.join(", ")}`);
|
|
128982
128985
|
}
|
|
128983
|
-
return
|
|
128986
|
+
return resolved;
|
|
128984
128987
|
}
|
|
128985
|
-
function
|
|
128986
|
-
|
|
128987
|
-
|
|
128988
|
-
|
|
128989
|
-
|
|
128990
|
-
|
|
128991
|
-
|
|
128992
|
-
|
|
128993
|
-
|
|
128994
|
-
|
|
128995
|
-
|
|
128996
|
-
promptFlag: "--append-system-prompt"
|
|
128988
|
+
function resolveInstalledPiPackageRootPath(options2 = {}) {
|
|
128989
|
+
const cwd = options2.cwd ?? process.cwd();
|
|
128990
|
+
const dirname6 = options2.dirname ?? __dirname;
|
|
128991
|
+
const fileExists = options2.existsSyncFn ?? import_node_fs4.existsSync;
|
|
128992
|
+
const seen = /* @__PURE__ */ new Set();
|
|
128993
|
+
const candidates = options2.candidatePaths ?? [];
|
|
128994
|
+
const addCandidate = (candidate) => {
|
|
128995
|
+
if (!seen.has(candidate)) {
|
|
128996
|
+
seen.add(candidate);
|
|
128997
|
+
candidates.push(candidate);
|
|
128998
|
+
}
|
|
128997
128999
|
};
|
|
128998
|
-
|
|
128999
|
-
|
|
129000
|
-
|
|
129001
|
-
|
|
129002
|
-
|
|
129003
|
-
|
|
129004
|
-
|
|
129005
|
-
|
|
129006
|
-
|
|
129007
|
-
|
|
129008
|
-
|
|
129009
|
-
|
|
129010
|
-
|
|
129011
|
-
|
|
129012
|
-
|
|
129013
|
-
|
|
129014
|
-
|
|
129015
|
-
|
|
129016
|
-
|
|
129017
|
-
|
|
129018
|
-
args.push("--continue");
|
|
129019
|
-
}
|
|
129020
|
-
if (params.request.resume) {
|
|
129021
|
-
args.push("--resume");
|
|
129022
|
-
}
|
|
129023
|
-
if (params.request.provider) {
|
|
129024
|
-
args.push("--provider", params.request.provider);
|
|
129025
|
-
}
|
|
129026
|
-
if (params.request.model) {
|
|
129027
|
-
args.push("--model", params.request.model);
|
|
129028
|
-
}
|
|
129029
|
-
if (params.request.thinking) {
|
|
129030
|
-
args.push("--thinking", params.request.thinking);
|
|
129031
|
-
}
|
|
129032
|
-
if (params.request.session) {
|
|
129033
|
-
args.push("--session", params.request.session);
|
|
129034
|
-
}
|
|
129035
|
-
if (params.request.sessionDir) {
|
|
129036
|
-
args.push("--session-dir", params.request.sessionDir);
|
|
129037
|
-
}
|
|
129038
|
-
if (params.request.apiKey) {
|
|
129039
|
-
args.push("--api-key", params.request.apiKey);
|
|
129040
|
-
}
|
|
129041
|
-
if (params.request.verbose) {
|
|
129042
|
-
args.push("--verbose");
|
|
129043
|
-
}
|
|
129044
|
-
if (params.request.prompt) {
|
|
129045
|
-
args.push(params.request.prompt);
|
|
129000
|
+
const collectAncestorCandidates = (startDir) => {
|
|
129001
|
+
let currentDir = (0, import_node_path9.resolve)(startDir);
|
|
129002
|
+
while (true) {
|
|
129003
|
+
addCandidate((0, import_node_path9.join)(currentDir, "node_modules", "@mariozechner", "pi-coding-agent", "package.json"));
|
|
129004
|
+
if ((0, import_node_path9.basename)(currentDir) === "node_modules") {
|
|
129005
|
+
addCandidate((0, import_node_path9.join)(currentDir, "@mariozechner", "pi-coding-agent", "package.json"));
|
|
129006
|
+
}
|
|
129007
|
+
const parentDir = (0, import_node_path9.resolve)(currentDir, "..");
|
|
129008
|
+
if (parentDir === currentDir) {
|
|
129009
|
+
break;
|
|
129010
|
+
}
|
|
129011
|
+
currentDir = parentDir;
|
|
129012
|
+
}
|
|
129013
|
+
};
|
|
129014
|
+
addCandidate((0, import_node_path9.resolve)(cwd, "apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
|
|
129015
|
+
collectAncestorCandidates(cwd);
|
|
129016
|
+
collectAncestorCandidates(dirname6);
|
|
129017
|
+
const resolvedPackageJson = candidates.find((candidate) => fileExists(candidate));
|
|
129018
|
+
if (!resolvedPackageJson) {
|
|
129019
|
+
throw new UserInputError(`Unable to locate the installed pi package root. Checked: ${candidates.join(", ")}`);
|
|
129046
129020
|
}
|
|
129047
|
-
return
|
|
129021
|
+
return (0, import_node_path9.resolve)(resolvedPackageJson, "..");
|
|
129048
129022
|
}
|
|
129049
129023
|
function createPiAgentRuntimeSkill(params) {
|
|
129050
129024
|
const commandPrefix = params.scope === "global" ? "docyrus -g" : "docyrus";
|
|
@@ -129054,7 +129028,7 @@ function createPiAgentRuntimeSkill(params) {
|
|
|
129054
129028
|
`- userId: \`${params.activeProfile.userId}\``,
|
|
129055
129029
|
`- tenantId: \`${params.activeProfile.tenantId}\``
|
|
129056
129030
|
] : [
|
|
129057
|
-
|
|
129031
|
+
"- No active Docyrus auth session is available.",
|
|
129058
129032
|
`- Authenticate first with \`${commandPrefix} auth login\` before making Docyrus API calls.`
|
|
129059
129033
|
];
|
|
129060
129034
|
return [
|
|
@@ -129101,14 +129075,10 @@ async function syncPackagedSkills(params) {
|
|
|
129101
129075
|
withFileTypes: true
|
|
129102
129076
|
});
|
|
129103
129077
|
await Promise.all(entries.map(async (entry) => {
|
|
129104
|
-
await (0, import_promises7.cp)(
|
|
129105
|
-
|
|
129106
|
-
|
|
129107
|
-
|
|
129108
|
-
recursive: true,
|
|
129109
|
-
force: true
|
|
129110
|
-
}
|
|
129111
|
-
);
|
|
129078
|
+
await (0, import_promises7.cp)((0, import_node_path9.join)(sourceSkillsRoot, entry.name), (0, import_node_path9.join)(targetSkillsRoot, entry.name), {
|
|
129079
|
+
recursive: true,
|
|
129080
|
+
force: true
|
|
129081
|
+
});
|
|
129112
129082
|
}));
|
|
129113
129083
|
}
|
|
129114
129084
|
async function writeRuntimeSkill(params) {
|
|
@@ -129137,7 +129107,8 @@ function createPiAgentLauncher(options2) {
|
|
|
129137
129107
|
const spawnCommand = options2.spawnSyncFn ?? import_node_child_process3.spawnSync;
|
|
129138
129108
|
const processExecPath = options2.processExecPath ?? process.execPath;
|
|
129139
129109
|
const resolveResourceRoot = options2.resolvePackagedPiResourceRootFn ?? resolvePackagedPiResourceRoot;
|
|
129140
|
-
const
|
|
129110
|
+
const resolveLoaderPath = options2.resolveDocyrusPiLoaderEntryPathFn ?? resolveDocyrusPiLoaderEntryPath;
|
|
129111
|
+
const resolvePiPackageRoot = options2.resolveInstalledPiPackageRootPathFn ?? resolveInstalledPiPackageRootPath;
|
|
129141
129112
|
return async (request) => {
|
|
129142
129113
|
validatePiAgentLaunchRequest({
|
|
129143
129114
|
request,
|
|
@@ -129147,9 +129118,7 @@ function createPiAgentLauncher(options2) {
|
|
|
129147
129118
|
const activeProfile = await options2.authStore.getActiveProfile(activeEnvironment.apiBaseUrl);
|
|
129148
129119
|
const settingsRootPath = options2.settingsPaths.rootPath;
|
|
129149
129120
|
const agentRootPath = resolveDocyrusPiAgentRootPath(settingsRootPath);
|
|
129150
|
-
const resourceRoot = resolveResourceRoot({
|
|
129151
|
-
cwd
|
|
129152
|
-
});
|
|
129121
|
+
const resourceRoot = resolveResourceRoot({ cwd });
|
|
129153
129122
|
await syncPackagedSkills({
|
|
129154
129123
|
resourceRoot,
|
|
129155
129124
|
agentRootPath
|
|
@@ -129164,31 +129133,27 @@ function createPiAgentLauncher(options2) {
|
|
|
129164
129133
|
settingsRootPath
|
|
129165
129134
|
})
|
|
129166
129135
|
});
|
|
129167
|
-
const
|
|
129168
|
-
const
|
|
129169
|
-
|
|
129170
|
-
|
|
129171
|
-
});
|
|
129172
|
-
const promptProfile = normalizePiPromptPath(resourceRoot, request.profile);
|
|
129173
|
-
if (!(0, import_node_fs4.existsSync)(promptProfile.promptPath)) {
|
|
129174
|
-
throw new UserInputError(`Unable to locate pi prompt asset at ${promptProfile.promptPath}.`);
|
|
129175
|
-
}
|
|
129176
|
-
const result = spawnCommand(processExecPath, [piCliEntryPath, ...args], {
|
|
129177
|
-
stdio: ["inherit", "inherit", "pipe"],
|
|
129136
|
+
const loaderEntryPath = resolveLoaderPath({ cwd });
|
|
129137
|
+
const piPackageRoot = resolvePiPackageRoot({ cwd });
|
|
129138
|
+
const result = spawnCommand(processExecPath, [loaderEntryPath], {
|
|
129139
|
+
stdio: ["inherit", "inherit", "inherit"],
|
|
129178
129140
|
encoding: "utf8",
|
|
129179
129141
|
cwd,
|
|
129180
129142
|
env: {
|
|
129181
129143
|
...process.env,
|
|
129182
|
-
PI_CODING_AGENT_DIR: agentRootPath
|
|
129144
|
+
PI_CODING_AGENT_DIR: agentRootPath,
|
|
129145
|
+
PI_PACKAGE_DIR: piPackageRoot,
|
|
129146
|
+
DOCYRUS_PI_REQUEST: JSON.stringify(request),
|
|
129147
|
+
DOCYRUS_PI_VERSION: options2.version || "dev"
|
|
129183
129148
|
}
|
|
129184
129149
|
});
|
|
129185
129150
|
if (result.error) {
|
|
129186
|
-
throw new UserInputError(`Unable to start pi
|
|
129151
|
+
throw new UserInputError(`Unable to start Docyrus pi loader: ${result.error.message}`, {
|
|
129187
129152
|
cause: result.error
|
|
129188
129153
|
});
|
|
129189
129154
|
}
|
|
129190
129155
|
if (result.status !== 0) {
|
|
129191
|
-
throw new UserInputError(`pi
|
|
129156
|
+
throw new UserInputError(`Docyrus pi loader failed: ${summarizeFailure2(result)}`);
|
|
129192
129157
|
}
|
|
129193
129158
|
};
|
|
129194
129159
|
}
|
|
@@ -129358,7 +129323,8 @@ function createDocyrusCli(params) {
|
|
|
129358
129323
|
settingsPaths,
|
|
129359
129324
|
environmentConfigService,
|
|
129360
129325
|
authStore,
|
|
129361
|
-
cwd: params?.cwd
|
|
129326
|
+
cwd: params?.cwd,
|
|
129327
|
+
version: package_default.version
|
|
129362
129328
|
});
|
|
129363
129329
|
const createAuthSessionService = (apiBaseUrl) => {
|
|
129364
129330
|
return new AuthSessionService({
|