@docyrus/docyrus 0.0.35 → 0.0.37

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
@@ -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 join19(regexps, separator = "|") {
18867
+ function join18(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(join19(terminators), true);
19171
+ this.matcherRe = langRe(join18(terminators), true);
19172
19172
  this.lastIndex = 0;
19173
19173
  }
19174
19174
  /** @param {string} s */
@@ -85749,9 +85749,9 @@ var init_lib10 = __esm({
85749
85749
  * @returns {undefined}
85750
85750
  * Nothing.
85751
85751
  */
85752
- set dirname(dirname14) {
85752
+ set dirname(dirname13) {
85753
85753
  assertPath(this.basename, "dirname");
85754
- this.path = import_node_path7.default.join(dirname14 || "", this.basename);
85754
+ this.path = import_node_path7.default.join(dirname13 || "", this.basename);
85755
85755
  }
85756
85756
  /**
85757
85757
  * Get the extname (including dot) (example: `'.js'`).
@@ -85774,18 +85774,18 @@ var init_lib10 = __esm({
85774
85774
  * @returns {undefined}
85775
85775
  * Nothing.
85776
85776
  */
85777
- set extname(extname9) {
85778
- assertPart(extname9, "extname");
85777
+ set extname(extname8) {
85778
+ assertPart(extname8, "extname");
85779
85779
  assertPath(this.dirname, "extname");
85780
- if (extname9) {
85781
- if (extname9.codePointAt(0) !== 46) {
85780
+ if (extname8) {
85781
+ if (extname8.codePointAt(0) !== 46) {
85782
85782
  throw new Error("`extname` must start with `.`");
85783
85783
  }
85784
- if (extname9.includes(".", 1)) {
85784
+ if (extname8.includes(".", 1)) {
85785
85785
  throw new Error("`extname` cannot contain multiple dots");
85786
85786
  }
85787
85787
  }
85788
- this.path = import_node_path7.default.join(this.dirname, this.stem + (extname9 || ""));
85788
+ this.path = import_node_path7.default.join(this.dirname, this.stem + (extname8 || ""));
85789
85789
  }
85790
85790
  /**
85791
85791
  * Get the full path (example: `'~/index.min.js'`).
@@ -110736,7 +110736,7 @@ var require_snapshot_recorder = __commonJS({
110736
110736
  "../../node_modules/.pnpm/undici@7.22.0/node_modules/undici/lib/mock/snapshot-recorder.js"(exports2, module2) {
110737
110737
  "use strict";
110738
110738
  var { writeFile: writeFile9, readFile: readFile16, mkdir: mkdir10 } = require("node:fs/promises");
110739
- var { dirname: dirname14, resolve: resolve2 } = require("node:path");
110739
+ var { dirname: dirname13, resolve: resolve2 } = require("node:path");
110740
110740
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = require("node:timers");
110741
110741
  var { InvalidArgumentError, UndiciError } = require_errors3();
110742
110742
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -110967,7 +110967,7 @@ var require_snapshot_recorder = __commonJS({
110967
110967
  throw new InvalidArgumentError("Snapshot path is required");
110968
110968
  }
110969
110969
  const resolvedPath = resolve2(path3);
110970
- await mkdir10(dirname14(resolvedPath), { recursive: true });
110970
+ await mkdir10(dirname13(resolvedPath), { recursive: true });
110971
110971
  const data = Array.from(this.#snapshots.entries()).map(([hash3, snapshot]) => ({
110972
110972
  hash: hash3,
110973
110973
  snapshot
@@ -147563,7 +147563,7 @@ function buildInputSchema(args2, env2, options2) {
147563
147563
  // package.json
147564
147564
  var package_default = {
147565
147565
  name: "@docyrus/docyrus",
147566
- version: "0.0.35",
147566
+ version: "0.0.37",
147567
147567
  private: false,
147568
147568
  description: "Docyrus API CLI",
147569
147569
  main: "./main.js",
@@ -148730,12 +148730,12 @@ function summarizeFailure(result) {
148730
148730
  }
148731
148731
  function resolveChromeToolsResourceRoot(options2 = {}) {
148732
148732
  const cwd = options2.cwd ?? process.cwd();
148733
- const dirname14 = options2.dirname ?? __dirname;
148733
+ const dirname13 = options2.dirname ?? __dirname;
148734
148734
  const fileExists = options2.existsSyncFn ?? import_node_fs3.existsSync;
148735
148735
  const candidates = options2.candidatePaths ?? [
148736
148736
  (0, import_node_path4.resolve)(cwd, "apps/api-cli/resources/chrome-tools"),
148737
- (0, import_node_path4.resolve)(dirname14, "../resources/chrome-tools"),
148738
- (0, import_node_path4.resolve)(dirname14, "resources/chrome-tools"),
148737
+ (0, import_node_path4.resolve)(dirname13, "../resources/chrome-tools"),
148738
+ (0, import_node_path4.resolve)(dirname13, "resources/chrome-tools"),
148739
148739
  (0, import_node_path4.resolve)(cwd, "dist/apps/api-cli/resources/chrome-tools")
148740
148740
  ];
148741
148741
  const resolved = candidates.find((candidate) => fileExists(candidate));
@@ -150207,7 +150207,7 @@ function createEnvCli(dependencies) {
150207
150207
 
150208
150208
  // src/commands/knowledgeCommands.ts
150209
150209
  var import_node_crypto4 = require("node:crypto");
150210
- var import_node_path19 = require("node:path");
150210
+ var import_node_path18 = require("node:path");
150211
150211
  init_graph();
150212
150212
 
150213
150213
  // src/knowledge/query.ts
@@ -161715,8 +161715,6 @@ async function initializeKnowledgeRepo(params) {
161715
161715
  }
161716
161716
 
161717
161717
  // src/knowledge/hook.ts
161718
- var import_node_child_process4 = require("node:child_process");
161719
- var import_node_path18 = require("node:path");
161720
161718
  init_graph();
161721
161719
 
161722
161720
  // src/knowledge/validation.ts
@@ -162005,205 +162003,13 @@ function formatKnowledgeIndexErrors(errors, styler) {
162005
162003
  return lines;
162006
162004
  }
162007
162005
 
162008
- // src/knowledge/hook.ts
162009
- var DIFF_THRESHOLD = 5;
162010
- var KNOWLEDGE_RATIO = 0.05;
162011
- var KNOWLEDGE_UPPER_THRESHOLD = 50;
162012
- function hasWikiLinks(text3) {
162013
- return /\[\[[^\]]+\]\]/u.test(text3);
162014
- }
162015
- async function readStdin() {
162016
- const chunks = [];
162017
- for await (const chunk of process.stdin) {
162018
- chunks.push(chunk);
162019
- }
162020
- return Buffer.concat(chunks).toString("utf8");
162021
- }
162022
- function outputClaudePromptSubmit(context) {
162023
- process.stdout.write(JSON.stringify({
162024
- hookSpecificOutput: {
162025
- hookEventName: "UserPromptSubmit",
162026
- additionalContext: context
162027
- }
162028
- }));
162029
- }
162030
- function outputClaudeStop(reason) {
162031
- process.stdout.write(JSON.stringify({
162032
- decision: "block",
162033
- reason
162034
- }));
162035
- }
162036
- function outputCursorStop(reason) {
162037
- process.stdout.write(JSON.stringify({
162038
- followup_message: reason
162039
- }));
162040
- }
162041
- async function searchAndExpandContext(params) {
162042
- const provider = await getKnowledgeSearchProviderInfo({
162043
- settingsRootPath: params.settingsRootPath
162044
- });
162045
- if (!provider.provider || !provider.info) {
162046
- return null;
162047
- }
162048
- const context = createKnowledgeContext(params.knowledgeDir, "cli", plainKnowledgeStyler);
162049
- await indexKnowledgeSections({
162050
- knowledgeDir: params.knowledgeDir,
162051
- projectRoot: context.projectRoot,
162052
- settingsRootPath: params.settingsRootPath,
162053
- provider: provider.provider
162054
- });
162055
- const matches = await searchKnowledgeSections({
162056
- query: params.userPrompt,
162057
- knowledgeDir: params.knowledgeDir,
162058
- projectRoot: context.projectRoot,
162059
- settingsRootPath: params.settingsRootPath,
162060
- limit: 5,
162061
- provider: provider.provider
162062
- });
162063
- if (matches.length === 0) {
162064
- return null;
162065
- }
162066
- const parts2 = [
162067
- `Knowledge search results for the user prompt (${matches.length} matches):`,
162068
- ""
162069
- ];
162070
- for (const match of matches) {
162071
- const section2 = await getKnowledgeSection(context, match.section.id);
162072
- if (section2.kind === "found") {
162073
- parts2.push(formatKnowledgeSectionOutput(context, section2));
162074
- parts2.push("");
162075
- }
162076
- }
162077
- return parts2.join("\n");
162078
- }
162079
- function analyzeDiff(projectRoot) {
162080
- let output = "";
162081
- try {
162082
- output = (0, import_node_child_process4.execSync)("git diff HEAD --numstat", {
162083
- cwd: projectRoot,
162084
- encoding: "utf8",
162085
- stdio: ["ignore", "pipe", "ignore"]
162086
- });
162087
- } catch {
162088
- return {
162089
- codeLines: 0,
162090
- knowledgeLines: 0
162091
- };
162092
- }
162093
- let codeLines = 0;
162094
- let knowledgeLines = 0;
162095
- for (const line of output.split("\n")) {
162096
- const [addedRaw, removedRaw, filePath] = line.split(" ");
162097
- if (!addedRaw || !removedRaw || !filePath) {
162098
- continue;
162099
- }
162100
- const changed = (Number.parseInt(addedRaw, 10) || 0) + (Number.parseInt(removedRaw, 10) || 0);
162101
- if (filePath.startsWith("docyrus/knowledge/")) {
162102
- knowledgeLines += changed;
162103
- } else if (KNOWLEDGE_SOURCE_EXTENSIONS.has((0, import_node_path18.extname)(filePath))) {
162104
- codeLines += changed;
162105
- }
162106
- }
162107
- return {
162108
- codeLines,
162109
- knowledgeLines
162110
- };
162111
- }
162112
- async function getStopReason(knowledgeDir) {
162113
- const markdown = await checkKnowledgeMarkdown(knowledgeDir);
162114
- const code = await checkKnowledgeCodeRefs(knowledgeDir);
162115
- const indexErrors = await checkKnowledgeIndex(knowledgeDir);
162116
- const sectionErrors = await checkKnowledgeSections(knowledgeDir);
162117
- const totalErrors = markdown.errors.length + code.errors.length + indexErrors.length + sectionErrors.length;
162118
- const projectRoot = (0, import_node_path18.dirname)((0, import_node_path18.dirname)(knowledgeDir));
162119
- const diff = analyzeDiff(projectRoot);
162120
- let needsSync = false;
162121
- if (diff.codeLines >= DIFF_THRESHOLD && diff.knowledgeLines < KNOWLEDGE_UPPER_THRESHOLD) {
162122
- needsSync = Math.max(diff.knowledgeLines, diff.knowledgeLines === 0 ? 0 : 1) < diff.codeLines * KNOWLEDGE_RATIO;
162123
- }
162124
- if (totalErrors === 0 && !needsSync) {
162125
- return null;
162126
- }
162127
- const parts2 = [];
162128
- if (totalErrors > 0) {
162129
- parts2.push(`docyrus knowledge check failed with ${totalErrors} error${totalErrors === 1 ? "" : "s"}.`);
162130
- }
162131
- if (needsSync) {
162132
- parts2.push(diff.knowledgeLines === 0 ? `Code changed by ${diff.codeLines} lines but docyrus/knowledge/ was not updated.` : `Code changed by ${diff.codeLines} lines but docyrus/knowledge/ changed by only ${diff.knowledgeLines} lines.`);
162133
- }
162134
- parts2.push("Update docyrus/knowledge/ and run `docyrus knowledge check` before finishing.");
162135
- return parts2.join(" ");
162136
- }
162137
- async function handleUserPromptSubmit(params) {
162138
- let userPrompt = "";
162139
- try {
162140
- const parsed = JSON.parse(await readStdin());
162141
- userPrompt = parsed.user_prompt || "";
162142
- } catch {
162143
- userPrompt = "";
162144
- }
162145
- const context = createKnowledgeContext(params.knowledgeDir, "cli", plainKnowledgeStyler);
162146
- const parts2 = [
162147
- `If docyrus/knowledge/ exists, start by running \`${params.commandPrefix} knowledge search\` for the user's intent before editing code.`,
162148
- `Use \`${params.commandPrefix} knowledge section\` to read relevant sections and \`${params.commandPrefix} knowledge expand\` when prompts contain [[refs]].`,
162149
- `Keep docyrus/knowledge/ in sync with code changes and finish with \`${params.commandPrefix} knowledge check\`.`
162150
- ];
162151
- if (userPrompt && hasWikiLinks(userPrompt)) {
162152
- const expanded = await expandKnowledgeText(context, userPrompt);
162153
- if (expanded) {
162154
- parts2.push("", "Expanded user prompt with resolved [[refs]]:", expanded);
162155
- } else {
162156
- parts2.push("", "The user prompt contains [[refs]] that could not be resolved. Ask for a correction if needed.");
162157
- }
162158
- }
162159
- if (userPrompt) {
162160
- const searchContext = await searchAndExpandContext({
162161
- knowledgeDir: params.knowledgeDir,
162162
- userPrompt,
162163
- settingsRootPath: params.settingsRootPath
162164
- });
162165
- if (searchContext) {
162166
- parts2.push("", searchContext);
162167
- }
162168
- }
162169
- outputClaudePromptSubmit(parts2.join("\n\n"));
162170
- }
162171
- async function runKnowledgeHook(params) {
162172
- const knowledgeDir = findKnowledgeDir();
162173
- if (!knowledgeDir) {
162174
- if (params.agent === "claude" && params.event === "UserPromptSubmit") {
162175
- outputClaudePromptSubmit("");
162176
- }
162177
- return;
162178
- }
162179
- if (params.agent === "claude" && params.event === "UserPromptSubmit") {
162180
- await handleUserPromptSubmit({
162181
- knowledgeDir,
162182
- settingsRootPath: params.settingsRootPath,
162183
- commandPrefix: params.commandPrefix
162184
- });
162185
- return;
162186
- }
162187
- if (params.agent === "claude" && params.event === "Stop" || params.agent === "cursor" && params.event.toLowerCase() === "stop") {
162188
- const reason = await getStopReason(knowledgeDir);
162189
- if (!reason) {
162190
- return;
162191
- }
162192
- if (params.agent === "claude") {
162193
- outputClaudeStop(reason);
162194
- } else {
162195
- outputCursorStop(reason);
162196
- }
162197
- }
162198
- }
162199
-
162200
162006
  // src/knowledge/audit.ts
162201
- var import_node_child_process5 = require("node:child_process");
162007
+ var import_node_child_process4 = require("node:child_process");
162202
162008
  var import_node_fs10 = require("node:fs");
162203
162009
  init_graph();
162204
162010
  function runGit(projectRoot, args2) {
162205
162011
  return new Promise((resolve2) => {
162206
- (0, import_node_child_process5.execFile)("git", args2, {
162012
+ (0, import_node_child_process4.execFile)("git", args2, {
162207
162013
  cwd: projectRoot,
162208
162014
  encoding: "utf8",
162209
162015
  maxBuffer: 20 * 1024 * 1024
@@ -162527,6 +162333,161 @@ async function analyzeKnowledgeDoctor(params) {
162527
162333
  };
162528
162334
  }
162529
162335
 
162336
+ // src/knowledge/hook.ts
162337
+ function hasWikiLinks(text3) {
162338
+ return /\[\[[^\]]+\]\]/u.test(text3);
162339
+ }
162340
+ async function readStdin() {
162341
+ const chunks = [];
162342
+ for await (const chunk of process.stdin) {
162343
+ chunks.push(chunk);
162344
+ }
162345
+ return Buffer.concat(chunks).toString("utf8");
162346
+ }
162347
+ function outputClaudePromptSubmit(context) {
162348
+ process.stdout.write(JSON.stringify({
162349
+ hookSpecificOutput: {
162350
+ hookEventName: "UserPromptSubmit",
162351
+ additionalContext: context
162352
+ }
162353
+ }));
162354
+ }
162355
+ function outputClaudeStop(reason) {
162356
+ process.stdout.write(JSON.stringify({
162357
+ decision: "block",
162358
+ reason
162359
+ }));
162360
+ }
162361
+ function outputCursorStop(reason) {
162362
+ process.stdout.write(JSON.stringify({
162363
+ followup_message: reason
162364
+ }));
162365
+ }
162366
+ async function searchAndExpandContext(params) {
162367
+ const provider = await getKnowledgeSearchProviderInfo({
162368
+ settingsRootPath: params.settingsRootPath
162369
+ });
162370
+ if (!provider.provider || !provider.info) {
162371
+ return null;
162372
+ }
162373
+ const context = createKnowledgeContext(params.knowledgeDir, "cli", plainKnowledgeStyler);
162374
+ await indexKnowledgeSections({
162375
+ knowledgeDir: params.knowledgeDir,
162376
+ projectRoot: context.projectRoot,
162377
+ settingsRootPath: params.settingsRootPath,
162378
+ provider: provider.provider
162379
+ });
162380
+ const matches = await searchKnowledgeSections({
162381
+ query: params.userPrompt,
162382
+ knowledgeDir: params.knowledgeDir,
162383
+ projectRoot: context.projectRoot,
162384
+ settingsRootPath: params.settingsRootPath,
162385
+ limit: 5,
162386
+ provider: provider.provider
162387
+ });
162388
+ if (matches.length === 0) {
162389
+ return null;
162390
+ }
162391
+ const parts2 = [
162392
+ `Knowledge search results for the user prompt (${matches.length} matches):`,
162393
+ ""
162394
+ ];
162395
+ for (const match of matches) {
162396
+ const section2 = await getKnowledgeSection(context, match.section.id);
162397
+ if (section2.kind === "found") {
162398
+ parts2.push(formatKnowledgeSectionOutput(context, section2));
162399
+ parts2.push("");
162400
+ }
162401
+ }
162402
+ return parts2.join("\n");
162403
+ }
162404
+ async function getStopReason(knowledgeDir) {
162405
+ const markdown = await checkKnowledgeMarkdown(knowledgeDir);
162406
+ const code = await checkKnowledgeCodeRefs(knowledgeDir);
162407
+ const indexErrors = await checkKnowledgeIndex(knowledgeDir);
162408
+ const sectionErrors = await checkKnowledgeSections(knowledgeDir);
162409
+ const totalErrors = markdown.errors.length + code.errors.length + indexErrors.length + sectionErrors.length;
162410
+ const audit = await analyzeKnowledgeImpacts({
162411
+ projectRoot: process.cwd(),
162412
+ knowledgeDir,
162413
+ mode: "working"
162414
+ });
162415
+ if (totalErrors === 0 && audit.blockingErrors.length === 0) {
162416
+ return null;
162417
+ }
162418
+ const parts2 = [];
162419
+ if (totalErrors > 0) {
162420
+ parts2.push(`docyrus knowledge check failed with ${totalErrors} error${totalErrors === 1 ? "" : "s"}.`);
162421
+ }
162422
+ for (const error48 of audit.blockingErrors) {
162423
+ parts2.push(error48.message);
162424
+ }
162425
+ parts2.push("Update docyrus/knowledge/ and run `docyrus knowledge check` before finishing.");
162426
+ return parts2.join(" ");
162427
+ }
162428
+ async function handleUserPromptSubmit(params) {
162429
+ let userPrompt = "";
162430
+ try {
162431
+ const parsed = JSON.parse(await readStdin());
162432
+ userPrompt = parsed.user_prompt || "";
162433
+ } catch {
162434
+ userPrompt = "";
162435
+ }
162436
+ const context = createKnowledgeContext(params.knowledgeDir, "cli", plainKnowledgeStyler);
162437
+ const parts2 = [
162438
+ `If docyrus/knowledge/ exists, start by running \`${params.commandPrefix} knowledge search\` for the user's intent before editing code.`,
162439
+ `Use \`${params.commandPrefix} knowledge section\` to read relevant sections and \`${params.commandPrefix} knowledge expand\` when prompts contain [[refs]].`,
162440
+ `Keep docyrus/knowledge/ in sync with code changes and finish with \`${params.commandPrefix} knowledge check\`.`
162441
+ ];
162442
+ if (userPrompt && hasWikiLinks(userPrompt)) {
162443
+ const expanded = await expandKnowledgeText(context, userPrompt);
162444
+ if (expanded) {
162445
+ parts2.push("", "Expanded user prompt with resolved [[refs]]:", expanded);
162446
+ } else {
162447
+ parts2.push("", "The user prompt contains [[refs]] that could not be resolved. Ask for a correction if needed.");
162448
+ }
162449
+ }
162450
+ if (userPrompt) {
162451
+ const searchContext = await searchAndExpandContext({
162452
+ knowledgeDir: params.knowledgeDir,
162453
+ userPrompt,
162454
+ settingsRootPath: params.settingsRootPath
162455
+ });
162456
+ if (searchContext) {
162457
+ parts2.push("", searchContext);
162458
+ }
162459
+ }
162460
+ outputClaudePromptSubmit(parts2.join("\n\n"));
162461
+ }
162462
+ async function runKnowledgeHook(params) {
162463
+ const knowledgeDir = findKnowledgeDir();
162464
+ if (!knowledgeDir) {
162465
+ if (params.agent === "claude" && params.event === "UserPromptSubmit") {
162466
+ outputClaudePromptSubmit("");
162467
+ }
162468
+ return;
162469
+ }
162470
+ if (params.agent === "claude" && params.event === "UserPromptSubmit") {
162471
+ await handleUserPromptSubmit({
162472
+ knowledgeDir,
162473
+ settingsRootPath: params.settingsRootPath,
162474
+ commandPrefix: params.commandPrefix
162475
+ });
162476
+ return;
162477
+ }
162478
+ if (params.agent === "claude" && params.event === "Stop" || params.agent === "cursor" && params.event.toLowerCase() === "stop") {
162479
+ const reason = await getStopReason(knowledgeDir);
162480
+ if (!reason) {
162481
+ return;
162482
+ }
162483
+ if (params.agent === "claude") {
162484
+ outputClaudeStop(reason);
162485
+ } else {
162486
+ outputCursorStop(reason);
162487
+ }
162488
+ }
162489
+ }
162490
+
162530
162491
  // src/commands/knowledgeCommands.ts
162531
162492
  function hasStructuredOutputOverride2(argv) {
162532
162493
  return argv.some((token) => token === "--json" || token === "--verbose" || token === "--format");
@@ -162635,7 +162596,7 @@ function createKnowledgeCli(dependencies) {
162635
162596
  brief: context.args.brief
162636
162597
  });
162637
162598
  maybePrintHuman(context, [
162638
- `Generated starter knowledge under ${(0, import_node_path19.join)(process.cwd(), "docyrus", "knowledge")}`,
162599
+ `Generated starter knowledge under ${(0, import_node_path18.join)(process.cwd(), "docyrus", "knowledge")}`,
162639
162600
  `root: ${result.files.rootKnowledgeStatus}`,
162640
162601
  `architecture: ${result.files.architectureStatus}`,
162641
162602
  `features: ${result.files.featuresStatus}`,
@@ -163201,7 +163162,7 @@ function createKnowledgeCli(dependencies) {
163201
163162
 
163202
163163
  // src/services/studioPayload.ts
163203
163164
  var import_promises14 = require("node:fs/promises");
163204
- var import_node_path20 = require("node:path");
163165
+ var import_node_path19 = require("node:path");
163205
163166
  async function readStdinText3() {
163206
163167
  if (process.stdin.isTTY) {
163207
163168
  return "";
@@ -163232,7 +163193,7 @@ async function readStudioWriteInput(params) {
163232
163193
  throw new UserInputError("Provide either --data or --from-file, not both.");
163233
163194
  }
163234
163195
  if (trimmedFromFile) {
163235
- const extension3 = (0, import_node_path20.extname)(trimmedFromFile).toLowerCase();
163196
+ const extension3 = (0, import_node_path19.extname)(trimmedFromFile).toLowerCase();
163236
163197
  if (extension3 && extension3 !== ".json") {
163237
163198
  throw new UserInputError("Studio commands support only JSON files in --from-file.");
163238
163199
  }
@@ -164236,9 +164197,9 @@ function createStudioCli(dependencies) {
164236
164197
  }
164237
164198
 
164238
164199
  // src/commands/tuiCommand.ts
164239
- var import_node_child_process6 = require("node:child_process");
164200
+ var import_node_child_process5 = require("node:child_process");
164240
164201
  var import_node_fs11 = require("node:fs");
164241
- var import_node_path21 = require("node:path");
164202
+ var import_node_path20 = require("node:path");
164242
164203
  function summarizeFailure2(result) {
164243
164204
  const stderr = result.stderr?.toString().trim();
164244
164205
  if (stderr && stderr.length > 0) {
@@ -164255,23 +164216,23 @@ function summarizeFailure2(result) {
164255
164216
  function resolveCliScriptPath() {
164256
164217
  const argvScript = process.argv[1];
164257
164218
  if (argvScript && argvScript.trim().length > 0) {
164258
- return (0, import_node_path21.isAbsolute)(argvScript) ? argvScript : (0, import_node_path21.resolve)(process.cwd(), argvScript);
164219
+ return (0, import_node_path20.isAbsolute)(argvScript) ? argvScript : (0, import_node_path20.resolve)(process.cwd(), argvScript);
164259
164220
  }
164260
164221
  return __filename;
164261
164222
  }
164262
164223
  function resolveOpenTuiEntryPath(options2 = {}) {
164263
164224
  const cwd = options2.cwd ?? process.cwd();
164264
- const dirname14 = options2.dirname ?? __dirname;
164225
+ const dirname13 = options2.dirname ?? __dirname;
164265
164226
  const fileExists = options2.existsSyncFn ?? import_node_fs11.existsSync;
164266
164227
  const candidates = [
164267
164228
  // Source/dev mode in monorepo. Prefer this first so Bun resolves deps via
164268
164229
  // apps/api-cli/node_modules in workspace runs (e.g. `pnpm docyrus tui`).
164269
- (0, import_node_path21.resolve)(cwd, "apps/api-cli/src/tui/opentuiMain.tsx"),
164270
- (0, import_node_path21.resolve)(dirname14, "../tui/opentuiMain.tsx"),
164230
+ (0, import_node_path20.resolve)(cwd, "apps/api-cli/src/tui/opentuiMain.tsx"),
164231
+ (0, import_node_path20.resolve)(dirname13, "../tui/opentuiMain.tsx"),
164271
164232
  // Dist mode (bundled command runtime)
164272
- (0, import_node_path21.resolve)(dirname14, "tui.mjs"),
164273
- (0, import_node_path21.resolve)(dirname14, "../tui.mjs"),
164274
- (0, import_node_path21.resolve)(cwd, "dist/apps/api-cli/tui.mjs")
164233
+ (0, import_node_path20.resolve)(dirname13, "tui.mjs"),
164234
+ (0, import_node_path20.resolve)(dirname13, "../tui.mjs"),
164235
+ (0, import_node_path20.resolve)(cwd, "dist/apps/api-cli/tui.mjs")
164275
164236
  ];
164276
164237
  const resolved = candidates.find((candidate) => fileExists(candidate));
164277
164238
  if (!resolved) {
@@ -164282,7 +164243,7 @@ function resolveOpenTuiEntryPath(options2 = {}) {
164282
164243
  return resolved;
164283
164244
  }
164284
164245
  function ensureBunAvailable(options2 = {}) {
164285
- const spawnCommand = options2.spawnSyncFn ?? import_node_child_process6.spawnSync;
164246
+ const spawnCommand = options2.spawnSyncFn ?? import_node_child_process5.spawnSync;
164286
164247
  const result = spawnCommand("bun", ["--version"], {
164287
164248
  encoding: "utf8"
164288
164249
  });
@@ -164296,7 +164257,7 @@ function ensureBunAvailable(options2 = {}) {
164296
164257
  }
164297
164258
  }
164298
164259
  function launchOpenTuiProcess(options2) {
164299
- const spawnCommand = options2.spawnSyncFn ?? import_node_child_process6.spawnSync;
164260
+ const spawnCommand = options2.spawnSyncFn ?? import_node_child_process5.spawnSync;
164300
164261
  const result = spawnCommand("bun", [options2.entryPath], {
164301
164262
  stdio: ["inherit", "inherit", "pipe"],
164302
164263
  encoding: "utf8",
@@ -165073,7 +165034,7 @@ var AuthSessionService = class {
165073
165034
 
165074
165035
  // src/services/authStore.ts
165075
165036
  var import_promises15 = require("node:fs/promises");
165076
- var import_node_path22 = require("node:path");
165037
+ var import_node_path21 = require("node:path");
165077
165038
  function createEmptyState() {
165078
165039
  return {
165079
165040
  version: 2,
@@ -165149,7 +165110,7 @@ var AuthStore = class {
165149
165110
  });
165150
165111
  }
165151
165112
  const normalized = normalizeState2(validated.data);
165152
- const directory = (0, import_node_path22.dirname)(this.authFilePath);
165113
+ const directory = (0, import_node_path21.dirname)(this.authFilePath);
165153
165114
  await (0, import_promises15.mkdir)(directory, {
165154
165115
  recursive: true,
165155
165116
  mode: 448
@@ -165364,7 +165325,7 @@ var AuthStore = class {
165364
165325
 
165365
165326
  // src/services/environmentConfig.ts
165366
165327
  var import_promises16 = require("node:fs/promises");
165367
- var import_node_path23 = require("node:path");
165328
+ var import_node_path22 = require("node:path");
165368
165329
  var ENVIRONMENT_ID_ALIASES = {
165369
165330
  "local-development": "dev",
165370
165331
  prod: "live"
@@ -165485,7 +165446,7 @@ var EnvironmentConfigService = class {
165485
165446
  });
165486
165447
  }
165487
165448
  const normalized = normalizeState3(validated.data);
165488
- const directory = (0, import_node_path23.dirname)(this.configFilePath);
165449
+ const directory = (0, import_node_path22.dirname)(this.configFilePath);
165489
165450
  await (0, import_promises16.mkdir)(directory, {
165490
165451
  recursive: true,
165491
165452
  mode: 448
@@ -165561,10 +165522,10 @@ var EnvironmentConfigService = class {
165561
165522
  };
165562
165523
 
165563
165524
  // src/services/piAgentLauncher.ts
165564
- var import_node_child_process7 = require("node:child_process");
165525
+ var import_node_child_process6 = require("node:child_process");
165565
165526
  var import_node_fs12 = require("node:fs");
165566
165527
  var import_promises17 = require("node:fs/promises");
165567
- var import_node_path24 = require("node:path");
165528
+ var import_node_path23 = require("node:path");
165568
165529
 
165569
165530
  // src/services/spinner.ts
165570
165531
  var import_picocolors2 = __toESM(require_picocolors());
@@ -165626,13 +165587,13 @@ function summarizeFailure3(result, commandLabel = "Command") {
165626
165587
  }
165627
165588
  function resolvePackagedPiResourceRoot(options2 = {}) {
165628
165589
  const cwd = options2.cwd ?? process.cwd();
165629
- const dirname14 = options2.dirname ?? __dirname;
165590
+ const dirname13 = options2.dirname ?? __dirname;
165630
165591
  const fileExists = options2.existsSyncFn ?? import_node_fs12.existsSync;
165631
165592
  const candidates = [
165632
- (0, import_node_path24.resolve)(cwd, "apps/api-cli/resources/pi-agent"),
165633
- (0, import_node_path24.resolve)(dirname14, "../resources/pi-agent"),
165634
- (0, import_node_path24.resolve)(dirname14, "resources/pi-agent"),
165635
- (0, import_node_path24.resolve)(cwd, "dist/apps/api-cli/resources/pi-agent")
165593
+ (0, import_node_path23.resolve)(cwd, "apps/api-cli/resources/pi-agent"),
165594
+ (0, import_node_path23.resolve)(dirname13, "../resources/pi-agent"),
165595
+ (0, import_node_path23.resolve)(dirname13, "resources/pi-agent"),
165596
+ (0, import_node_path23.resolve)(cwd, "dist/apps/api-cli/resources/pi-agent")
165636
165597
  ];
165637
165598
  const resolved = candidates.find((candidate) => fileExists(candidate));
165638
165599
  if (!resolved) {
@@ -165642,7 +165603,7 @@ function resolvePackagedPiResourceRoot(options2 = {}) {
165642
165603
  }
165643
165604
  function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
165644
165605
  const cwd = options2.cwd ?? process.cwd();
165645
- const dirname14 = options2.dirname ?? __dirname;
165606
+ const dirname13 = options2.dirname ?? __dirname;
165646
165607
  const fileExists = options2.existsSyncFn ?? import_node_fs12.existsSync;
165647
165608
  const seen = /* @__PURE__ */ new Set();
165648
165609
  const candidates = options2.candidatePaths ?? [];
@@ -165653,25 +165614,25 @@ function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
165653
165614
  }
165654
165615
  };
165655
165616
  const collectAncestorCandidates = (startDir) => {
165656
- let currentDir = (0, import_node_path24.resolve)(startDir);
165617
+ let currentDir = (0, import_node_path23.resolve)(startDir);
165657
165618
  while (true) {
165658
- addCandidate((0, import_node_path24.join)(currentDir, "dist", "apps", "api-cli", "agent-loader.js"));
165659
- addCandidate((0, import_node_path24.join)(currentDir, "agent-loader.js"));
165660
- if ((0, import_node_path24.basename)(currentDir) === "dist") {
165661
- addCandidate((0, import_node_path24.join)(currentDir, "apps", "api-cli", "agent-loader.js"));
165619
+ addCandidate((0, import_node_path23.join)(currentDir, "dist", "apps", "api-cli", "agent-loader.js"));
165620
+ addCandidate((0, import_node_path23.join)(currentDir, "agent-loader.js"));
165621
+ if ((0, import_node_path23.basename)(currentDir) === "dist") {
165622
+ addCandidate((0, import_node_path23.join)(currentDir, "apps", "api-cli", "agent-loader.js"));
165662
165623
  }
165663
- const parentDir = (0, import_node_path24.resolve)(currentDir, "..");
165624
+ const parentDir = (0, import_node_path23.resolve)(currentDir, "..");
165664
165625
  if (parentDir === currentDir) {
165665
165626
  break;
165666
165627
  }
165667
165628
  currentDir = parentDir;
165668
165629
  }
165669
165630
  };
165670
- addCandidate((0, import_node_path24.resolve)(cwd, "dist/apps/api-cli/agent-loader.js"));
165671
- addCandidate((0, import_node_path24.resolve)(dirname14, "../agent-loader.js"));
165672
- addCandidate((0, import_node_path24.resolve)(dirname14, "agent-loader.js"));
165631
+ addCandidate((0, import_node_path23.resolve)(cwd, "dist/apps/api-cli/agent-loader.js"));
165632
+ addCandidate((0, import_node_path23.resolve)(dirname13, "../agent-loader.js"));
165633
+ addCandidate((0, import_node_path23.resolve)(dirname13, "agent-loader.js"));
165673
165634
  collectAncestorCandidates(cwd);
165674
- collectAncestorCandidates(dirname14);
165635
+ collectAncestorCandidates(dirname13);
165675
165636
  const resolved = candidates.find((candidate) => fileExists(candidate));
165676
165637
  if (!resolved) {
165677
165638
  throw new UserInputError(`Unable to locate Docyrus pi loader entry file. Checked: ${candidates.join(", ")}`);
@@ -165680,7 +165641,7 @@ function resolveDocyrusPiLoaderEntryPath(options2 = {}) {
165680
165641
  }
165681
165642
  function resolveDocyrusCliEntryPath(options2 = {}) {
165682
165643
  const cwd = options2.cwd ?? process.cwd();
165683
- const dirname14 = options2.dirname ?? __dirname;
165644
+ const dirname13 = options2.dirname ?? __dirname;
165684
165645
  const argv = options2.argv ?? process.argv;
165685
165646
  const fileExists = options2.existsSyncFn ?? import_node_fs12.existsSync;
165686
165647
  const seen = /* @__PURE__ */ new Set();
@@ -165689,20 +165650,20 @@ function resolveDocyrusCliEntryPath(options2 = {}) {
165689
165650
  if (!candidate) {
165690
165651
  return;
165691
165652
  }
165692
- const resolvedCandidate = (0, import_node_path24.resolve)(candidate);
165653
+ const resolvedCandidate = (0, import_node_path23.resolve)(candidate);
165693
165654
  if (!seen.has(resolvedCandidate)) {
165694
165655
  seen.add(resolvedCandidate);
165695
165656
  candidates.push(resolvedCandidate);
165696
165657
  }
165697
165658
  };
165698
165659
  const argvScript = argv[1]?.trim();
165699
- const normalizedArgvScript = argvScript ? argvScript.startsWith("/") ? argvScript : (0, import_node_path24.resolve)(cwd, argvScript) : void 0;
165660
+ const normalizedArgvScript = argvScript ? argvScript.startsWith("/") ? argvScript : (0, import_node_path23.resolve)(cwd, argvScript) : void 0;
165700
165661
  if (normalizedArgvScript && normalizedArgvScript.endsWith(".js")) {
165701
165662
  addCandidate(normalizedArgvScript);
165702
165663
  }
165703
- addCandidate((0, import_node_path24.resolve)(cwd, "dist/apps/api-cli/main.js"));
165704
- addCandidate((0, import_node_path24.resolve)(dirname14, "../main.js"));
165705
- addCandidate((0, import_node_path24.resolve)(dirname14, "main.js"));
165664
+ addCandidate((0, import_node_path23.resolve)(cwd, "dist/apps/api-cli/main.js"));
165665
+ addCandidate((0, import_node_path23.resolve)(dirname13, "../main.js"));
165666
+ addCandidate((0, import_node_path23.resolve)(dirname13, "main.js"));
165706
165667
  if (normalizedArgvScript) {
165707
165668
  addCandidate(normalizedArgvScript);
165708
165669
  }
@@ -165714,7 +165675,7 @@ function resolveDocyrusCliEntryPath(options2 = {}) {
165714
165675
  }
165715
165676
  function resolveInstalledPiPackageRootPath(options2 = {}) {
165716
165677
  const cwd = options2.cwd ?? process.cwd();
165717
- const dirname14 = options2.dirname ?? __dirname;
165678
+ const dirname13 = options2.dirname ?? __dirname;
165718
165679
  const fileExists = options2.existsSyncFn ?? import_node_fs12.existsSync;
165719
165680
  const seen = /* @__PURE__ */ new Set();
165720
165681
  const candidates = options2.candidatePaths ?? [];
@@ -165725,32 +165686,32 @@ function resolveInstalledPiPackageRootPath(options2 = {}) {
165725
165686
  }
165726
165687
  };
165727
165688
  const collectAncestorCandidates = (startDir) => {
165728
- let currentDir = (0, import_node_path24.resolve)(startDir);
165689
+ let currentDir = (0, import_node_path23.resolve)(startDir);
165729
165690
  while (true) {
165730
- addCandidate((0, import_node_path24.join)(currentDir, "node_modules", "@mariozechner", "pi-coding-agent", "package.json"));
165731
- if ((0, import_node_path24.basename)(currentDir) === "node_modules") {
165732
- addCandidate((0, import_node_path24.join)(currentDir, "@mariozechner", "pi-coding-agent", "package.json"));
165691
+ addCandidate((0, import_node_path23.join)(currentDir, "node_modules", "@mariozechner", "pi-coding-agent", "package.json"));
165692
+ if ((0, import_node_path23.basename)(currentDir) === "node_modules") {
165693
+ addCandidate((0, import_node_path23.join)(currentDir, "@mariozechner", "pi-coding-agent", "package.json"));
165733
165694
  }
165734
- const parentDir = (0, import_node_path24.resolve)(currentDir, "..");
165695
+ const parentDir = (0, import_node_path23.resolve)(currentDir, "..");
165735
165696
  if (parentDir === currentDir) {
165736
165697
  break;
165737
165698
  }
165738
165699
  currentDir = parentDir;
165739
165700
  }
165740
165701
  };
165741
- addCandidate((0, import_node_path24.resolve)(cwd, "apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
165742
- addCandidate((0, import_node_path24.resolve)(dirname14, "../../../apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
165702
+ addCandidate((0, import_node_path23.resolve)(cwd, "apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
165703
+ addCandidate((0, import_node_path23.resolve)(dirname13, "../../../apps/api-cli/node_modules/@mariozechner/pi-coding-agent/package.json"));
165743
165704
  collectAncestorCandidates(cwd);
165744
- collectAncestorCandidates(dirname14);
165705
+ collectAncestorCandidates(dirname13);
165745
165706
  const resolvedPackageJson = candidates.find((candidate) => fileExists(candidate));
165746
165707
  if (!resolvedPackageJson) {
165747
165708
  throw new UserInputError(`Unable to locate the installed pi package root. Checked: ${candidates.join(", ")}`);
165748
165709
  }
165749
- return (0, import_node_path24.resolve)(resolvedPackageJson, "..");
165710
+ return (0, import_node_path23.resolve)(resolvedPackageJson, "..");
165750
165711
  }
165751
165712
  function createPiAgentRuntimeSkill(params) {
165752
165713
  const commandPrefix = params.scope === "global" ? "docyrus -g" : "docyrus";
165753
- const knowledgeDir = (0, import_node_path24.join)(params.cwd, "docyrus", "knowledge");
165714
+ const knowledgeDir = (0, import_node_path23.join)(params.cwd, "docyrus", "knowledge");
165754
165715
  const hasKnowledgeGraph = (0, import_node_fs12.existsSync)(knowledgeDir);
165755
165716
  const authLines = params.activeProfile ? [
165756
165717
  `- email: \`${params.activeProfile.email}\``,
@@ -165804,8 +165765,8 @@ function createPiAgentRuntimeSkill(params) {
165804
165765
  ].join("\n");
165805
165766
  }
165806
165767
  async function syncPackagedSkills(params) {
165807
- const sourceSkillsRoot = (0, import_node_path24.join)(params.resourceRoot, "skills");
165808
- const targetSkillsRoot = (0, import_node_path24.join)(params.agentRootPath, "skills");
165768
+ const sourceSkillsRoot = (0, import_node_path23.join)(params.resourceRoot, "skills");
165769
+ const targetSkillsRoot = (0, import_node_path23.join)(params.agentRootPath, "skills");
165809
165770
  await (0, import_promises17.mkdir)(targetSkillsRoot, {
165810
165771
  recursive: true,
165811
165772
  mode: 448
@@ -165814,25 +165775,25 @@ async function syncPackagedSkills(params) {
165814
165775
  withFileTypes: true
165815
165776
  });
165816
165777
  await Promise.all(DOCYRUS_MIGRATED_SKILL_NAMES.map(async (skillName) => {
165817
- await (0, import_promises17.rm)((0, import_node_path24.join)(targetSkillsRoot, skillName), {
165778
+ await (0, import_promises17.rm)((0, import_node_path23.join)(targetSkillsRoot, skillName), {
165818
165779
  recursive: true,
165819
165780
  force: true
165820
165781
  });
165821
165782
  }));
165822
165783
  await Promise.all(entries.map(async (entry) => {
165823
- await (0, import_promises17.cp)((0, import_node_path24.join)(sourceSkillsRoot, entry.name), (0, import_node_path24.join)(targetSkillsRoot, entry.name), {
165784
+ await (0, import_promises17.cp)((0, import_node_path23.join)(sourceSkillsRoot, entry.name), (0, import_node_path23.join)(targetSkillsRoot, entry.name), {
165824
165785
  recursive: true,
165825
165786
  force: true
165826
165787
  });
165827
165788
  }));
165828
165789
  }
165829
165790
  async function writeRuntimeSkill(params) {
165830
- const runtimeSkillDir = (0, import_node_path24.join)(params.agentRootPath, "skills", "docyrus-runtime-context");
165791
+ const runtimeSkillDir = (0, import_node_path23.join)(params.agentRootPath, "skills", "docyrus-runtime-context");
165831
165792
  await (0, import_promises17.mkdir)(runtimeSkillDir, {
165832
165793
  recursive: true,
165833
165794
  mode: 448
165834
165795
  });
165835
- await (0, import_promises17.writeFile)((0, import_node_path24.join)(runtimeSkillDir, "SKILL.md"), `${params.content}
165796
+ await (0, import_promises17.writeFile)((0, import_node_path23.join)(runtimeSkillDir, "SKILL.md"), `${params.content}
165836
165797
  `, {
165837
165798
  encoding: "utf8",
165838
165799
  mode: 384
@@ -165845,10 +165806,10 @@ function resolveNpmCommand() {
165845
165806
  return process.platform === "win32" ? "npm.cmd" : "npm";
165846
165807
  }
165847
165808
  function resolveManagedDiffityInstallRoot(agentRootPath) {
165848
- return (0, import_node_path24.join)(agentRootPath, "tools", "diffity");
165809
+ return (0, import_node_path23.join)(agentRootPath, "tools", "diffity");
165849
165810
  }
165850
165811
  function resolveManagedDiffityExecutablePath(agentRootPath) {
165851
- return (0, import_node_path24.join)(
165812
+ return (0, import_node_path23.join)(
165852
165813
  resolveManagedDiffityInstallRoot(agentRootPath),
165853
165814
  "node_modules",
165854
165815
  ".bin",
@@ -165856,10 +165817,10 @@ function resolveManagedDiffityExecutablePath(agentRootPath) {
165856
165817
  );
165857
165818
  }
165858
165819
  function prependPathEntry(entry, existingPath) {
165859
- const values = existingPath ? existingPath.split(import_node_path24.delimiter).filter((value2) => value2.trim().length > 0) : [];
165820
+ const values = existingPath ? existingPath.split(import_node_path23.delimiter).filter((value2) => value2.trim().length > 0) : [];
165860
165821
  const normalizedEntry = entry.trim();
165861
165822
  const remaining = values.filter((value2) => value2 !== normalizedEntry);
165862
- return [normalizedEntry, ...remaining].join(import_node_path24.delimiter);
165823
+ return [normalizedEntry, ...remaining].join(import_node_path23.delimiter);
165863
165824
  }
165864
165825
  function createDocyrusSkillsInstallArgs(scope) {
165865
165826
  const args2 = [
@@ -165897,7 +165858,7 @@ function createPackagedDocyrusPlatformInstallArgs(params) {
165897
165858
  return args2;
165898
165859
  }
165899
165860
  async function installExternalDocyrusSkillsOnce(params) {
165900
- const markerPath = (0, import_node_path24.join)(params.agentRootPath, DOCYRUS_EXTERNAL_SKILL_MARKER_FILE);
165861
+ const markerPath = (0, import_node_path23.join)(params.agentRootPath, DOCYRUS_EXTERNAL_SKILL_MARKER_FILE);
165901
165862
  if ((0, import_node_fs12.existsSync)(markerPath)) {
165902
165863
  return;
165903
165864
  }
@@ -165930,7 +165891,7 @@ async function installExternalDocyrusSkillsOnce(params) {
165930
165891
  }
165931
165892
  async function ensureManagedDiffityInstalled(params) {
165932
165893
  const executablePath = resolveManagedDiffityExecutablePath(params.agentRootPath);
165933
- const binDir = (0, import_node_path24.dirname)(executablePath);
165894
+ const binDir = (0, import_node_path23.dirname)(executablePath);
165934
165895
  if ((0, import_node_fs12.existsSync)(executablePath)) {
165935
165896
  return {
165936
165897
  available: true,
@@ -165969,13 +165930,13 @@ async function ensureManagedDiffityInstalled(params) {
165969
165930
  };
165970
165931
  }
165971
165932
  function resolvePackagedDocyrusPlatformSkillPath(resourceRoot) {
165972
- return (0, import_node_path24.join)(resourceRoot, "skills", DOCYRUS_PACKAGED_PLATFORM_SKILL_NAME);
165933
+ return (0, import_node_path23.join)(resourceRoot, "skills", DOCYRUS_PACKAGED_PLATFORM_SKILL_NAME);
165973
165934
  }
165974
165935
  function resolveManagedOfficeCliInstallRoot(agentRootPath) {
165975
- return (0, import_node_path24.join)(agentRootPath, "tools", "officecli");
165936
+ return (0, import_node_path23.join)(agentRootPath, "tools", "officecli");
165976
165937
  }
165977
165938
  function resolveManagedOfficeCliExecutablePath(agentRootPath) {
165978
- return (0, import_node_path24.join)(
165939
+ return (0, import_node_path23.join)(
165979
165940
  resolveManagedOfficeCliInstallRoot(agentRootPath),
165980
165941
  process.platform === "win32" ? "officecli.exe" : "officecli"
165981
165942
  );
@@ -166015,7 +165976,7 @@ function resolveOfficeCliReleaseAssetName() {
166015
165976
  }
166016
165977
  async function ensureManagedOfficeCliInstalled(params) {
166017
165978
  const executablePath = resolveManagedOfficeCliExecutablePath(params.agentRootPath);
166018
- const binDir = (0, import_node_path24.dirname)(executablePath);
165979
+ const binDir = (0, import_node_path23.dirname)(executablePath);
166019
165980
  if ((0, import_node_fs12.existsSync)(executablePath)) {
166020
165981
  return {
166021
165982
  available: true,
@@ -166118,7 +166079,7 @@ function validatePiAgentLaunchRequest(params) {
166118
166079
  function createPiAgentLauncher(options2) {
166119
166080
  const cwd = options2.cwd ?? process.cwd();
166120
166081
  const stdinIsTTY = options2.stdinIsTTY ?? process.stdin.isTTY ?? false;
166121
- const spawnCommand = options2.spawnSyncFn ?? import_node_child_process7.spawnSync;
166082
+ const spawnCommand = options2.spawnSyncFn ?? import_node_child_process6.spawnSync;
166122
166083
  const processExecPath = options2.processExecPath ?? process.execPath;
166123
166084
  const resolveResourceRoot = options2.resolvePackagedPiResourceRootFn ?? resolvePackagedPiResourceRoot;
166124
166085
  const resolveLoaderPath = options2.resolveDocyrusPiLoaderEntryPathFn ?? resolveDocyrusPiLoaderEntryPath;
@@ -166208,13 +166169,13 @@ function createPiAgentLauncher(options2) {
166208
166169
  }
166209
166170
 
166210
166171
  // src/services/piAgentServerLauncher.ts
166211
- var import_node_child_process8 = require("node:child_process");
166172
+ var import_node_child_process7 = require("node:child_process");
166212
166173
  var import_node_fs13 = require("node:fs");
166213
- var import_node_path25 = require("node:path");
166174
+ var import_node_path24 = require("node:path");
166214
166175
  function serializePiAgentServerRequest(request) {
166215
166176
  return JSON.stringify(request);
166216
166177
  }
166217
- function resolveServerLoaderEntryPath(cwd, dirname14) {
166178
+ function resolveServerLoaderEntryPath(cwd, dirname13) {
166218
166179
  const seen = /* @__PURE__ */ new Set();
166219
166180
  const candidates = [];
166220
166181
  const addCandidate = (candidate) => {
@@ -166224,25 +166185,25 @@ function resolveServerLoaderEntryPath(cwd, dirname14) {
166224
166185
  }
166225
166186
  };
166226
166187
  const collectAncestorCandidates = (startDir) => {
166227
- let currentDir = (0, import_node_path25.resolve)(startDir);
166188
+ let currentDir = (0, import_node_path24.resolve)(startDir);
166228
166189
  while (true) {
166229
- addCandidate((0, import_node_path25.join)(currentDir, "dist", "apps", "api-cli", "server-loader.js"));
166230
- addCandidate((0, import_node_path25.join)(currentDir, "server-loader.js"));
166231
- if ((0, import_node_path25.basename)(currentDir) === "dist") {
166232
- addCandidate((0, import_node_path25.join)(currentDir, "apps", "api-cli", "server-loader.js"));
166190
+ addCandidate((0, import_node_path24.join)(currentDir, "dist", "apps", "api-cli", "server-loader.js"));
166191
+ addCandidate((0, import_node_path24.join)(currentDir, "server-loader.js"));
166192
+ if ((0, import_node_path24.basename)(currentDir) === "dist") {
166193
+ addCandidate((0, import_node_path24.join)(currentDir, "apps", "api-cli", "server-loader.js"));
166233
166194
  }
166234
- const parentDir = (0, import_node_path25.resolve)(currentDir, "..");
166195
+ const parentDir = (0, import_node_path24.resolve)(currentDir, "..");
166235
166196
  if (parentDir === currentDir) {
166236
166197
  break;
166237
166198
  }
166238
166199
  currentDir = parentDir;
166239
166200
  }
166240
166201
  };
166241
- addCandidate((0, import_node_path25.resolve)(cwd, "dist/apps/api-cli/server-loader.js"));
166242
- addCandidate((0, import_node_path25.resolve)(dirname14, "../server-loader.js"));
166243
- addCandidate((0, import_node_path25.resolve)(dirname14, "server-loader.js"));
166202
+ addCandidate((0, import_node_path24.resolve)(cwd, "dist/apps/api-cli/server-loader.js"));
166203
+ addCandidate((0, import_node_path24.resolve)(dirname13, "../server-loader.js"));
166204
+ addCandidate((0, import_node_path24.resolve)(dirname13, "server-loader.js"));
166244
166205
  collectAncestorCandidates(cwd);
166245
- collectAncestorCandidates(dirname14);
166206
+ collectAncestorCandidates(dirname13);
166246
166207
  const resolved = candidates.find((candidate) => (0, import_node_fs13.existsSync)(candidate));
166247
166208
  if (!resolved) {
166248
166209
  throw new UserInputError(`Unable to locate Docyrus pi server loader entry file. Checked: ${candidates.join(", ")}`);
@@ -166278,26 +166239,26 @@ function createPiAgentServerLauncher(options2) {
166278
166239
  agentRootPath,
166279
166240
  cwd,
166280
166241
  scope: options2.settingsPaths.scope,
166281
- spawnCommand: import_node_child_process8.spawnSync
166242
+ spawnCommand: import_node_child_process7.spawnSync
166282
166243
  });
166283
166244
  installPackagedDocyrusPlatformSkill({
166284
166245
  resourceRoot,
166285
166246
  cwd,
166286
166247
  scope: options2.settingsPaths.scope,
166287
- spawnCommand: import_node_child_process8.spawnSync
166248
+ spawnCommand: import_node_child_process7.spawnSync
166288
166249
  });
166289
166250
  spinner.update("Installing tools...");
166290
166251
  const officeCli = await ensureManagedOfficeCliInstalled({
166291
166252
  agentRootPath,
166292
166253
  cwd,
166293
- spawnCommand: import_node_child_process8.spawnSync
166254
+ spawnCommand: import_node_child_process7.spawnSync
166294
166255
  });
166295
166256
  spinner.stop();
166296
166257
  const loaderEntryPath = resolveServerLoaderEntryPath(cwd, __dirname);
166297
166258
  const piPackageRoot = resolveInstalledPiPackageRootPath({ cwd });
166298
166259
  const cliEntryPath = resolveDocyrusCliEntryPath({ cwd });
166299
166260
  const runtimePath = officeCli.available ? prependPathEntry(officeCli.binDir, process.env.PATH) : process.env.PATH;
166300
- const child = (0, import_node_child_process8.spawn)(process.execPath, [loaderEntryPath], {
166261
+ const child = (0, import_node_child_process7.spawn)(process.execPath, [loaderEntryPath], {
166301
166262
  stdio: "inherit",
166302
166263
  cwd,
166303
166264
  env: {
@@ -166360,7 +166321,7 @@ async function runWithIncurSkillsOutOfDateWarningSuppressed(params) {
166360
166321
 
166361
166322
  // src/services/tenantOpenApi.ts
166362
166323
  var import_promises18 = require("node:fs/promises");
166363
- var import_node_path26 = require("node:path");
166324
+ var import_node_path25 = require("node:path");
166364
166325
  function resolveSourceUrl(tenantId, template) {
166365
166326
  return template.replace("{tenantId}", encodeURIComponent(tenantId));
166366
166327
  }
@@ -166385,7 +166346,7 @@ var TenantOpenApiService = class {
166385
166346
  params;
166386
166347
  async #writeOpenApiFile(tenantId, parsedContent) {
166387
166348
  const filePath = this.getTenantOpenApiFilePath(tenantId);
166388
- await (0, import_promises18.mkdir)((0, import_node_path26.dirname)(filePath), {
166349
+ await (0, import_promises18.mkdir)((0, import_node_path25.dirname)(filePath), {
166389
166350
  recursive: true,
166390
166351
  mode: 448
166391
166352
  });
@@ -166431,7 +166392,7 @@ var TenantOpenApiService = class {
166431
166392
  throw new AuthSessionError("Tenant ID is required to resolve OpenAPI spec path.");
166432
166393
  }
166433
166394
  const rootPath = this.params?.rootPath || TENANT_OPENAPI_ROOT_PATH;
166434
- return (0, import_node_path26.join)(rootPath, normalizedTenantId, "openapi.json");
166395
+ return (0, import_node_path25.join)(rootPath, normalizedTenantId, "openapi.json");
166435
166396
  }
166436
166397
  async downloadTenantOpenApi(tenantId, options2 = {}) {
166437
166398
  const normalizedTenantId = tenantId.trim();