@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/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.17",
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
- "@mariozechner/pi-coding-agent": "0.58.4",
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 process exited with code ${result.status}.`;
128927
+ return `Docyrus pi loader exited with code ${result.status}.`;
128925
128928
  }
128926
128929
  if (result.signal) {
128927
- return `pi process exited due to signal ${result.signal}.`;
128930
+ return `Docyrus pi loader exited due to signal ${result.signal}.`;
128928
128931
  }
128929
- return "pi process terminated unexpectedly.";
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 resolveInstalledPiCliEntryPath(options2 = {}) {
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 packageSegments = ["@mariozechner", "pi-coding-agent", "dist", "cli.js"];
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, "node_modules", ...packageSegments));
128966
- if ((0, import_node_path9.basename)(currentDir) === "node_modules") {
128967
- addCandidate((0, import_node_path9.join)(currentDir, ...packageSegments));
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/node_modules", ...packageSegments));
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 cliEntryPath = candidates.find((candidate) => fileExists(candidate));
128980
- if (!cliEntryPath) {
128981
- throw new UserInputError(`Unable to locate pi CLI entry file. Checked: ${candidates.join(", ")}`);
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 cliEntryPath;
128986
+ return resolved;
128984
128987
  }
128985
- function normalizePiPromptPath(resourceRoot, profile) {
128986
- if (profile === "agent") {
128987
- return {
128988
- tools: ["read", "bash", "grep", "find", "ls"],
128989
- promptPath: (0, import_node_path9.join)(resourceRoot, "prompts", "agent-system.md"),
128990
- promptFlag: "--system-prompt"
128991
- };
128992
- }
128993
- return {
128994
- tools: ["read", "bash", "edit", "write", "grep", "find", "ls"],
128995
- promptPath: (0, import_node_path9.join)(resourceRoot, "prompts", "coder-append-system.md"),
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
- function toPiMode(mode) {
129000
- return mode;
129001
- }
129002
- function buildPiAgentCliArgs(params) {
129003
- const profile = normalizePiPromptPath(params.resourceRoot, params.request.profile);
129004
- const args = [
129005
- "--tools",
129006
- profile.tools.join(","),
129007
- profile.promptFlag,
129008
- profile.promptPath
129009
- ];
129010
- if (params.request.print) {
129011
- args.push("--print");
129012
- }
129013
- const mode = toPiMode(params.request.mode);
129014
- if (mode) {
129015
- args.push("--mode", mode);
129016
- }
129017
- if (params.request.continue) {
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 args;
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
- `- No active Docyrus auth session is available.`,
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
- (0, import_node_path9.join)(sourceSkillsRoot, entry.name),
129106
- (0, import_node_path9.join)(targetSkillsRoot, entry.name),
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 resolvePiCliEntry = options2.resolveInstalledPiCliEntryPathFn ?? resolveInstalledPiCliEntryPath;
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 piCliEntryPath = resolvePiCliEntry();
129168
- const args = buildPiAgentCliArgs({
129169
- request,
129170
- resourceRoot
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 agent: ${result.error.message}`, {
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 agent failed: ${summarizeFailure2(result)}`);
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({