@hang.yang/frankcli 0.1.51 → 0.1.52

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/bundle/gemini.js CHANGED
@@ -62351,7 +62351,7 @@ async function createContentGeneratorConfig(model, authType) {
62351
62351
  return contentGeneratorConfig;
62352
62352
  }
62353
62353
  async function createContentGenerator(config2, sessionId2) {
62354
- const version3 = "0.1.51";
62354
+ const version3 = "0.1.52";
62355
62355
  const httpOptions = {
62356
62356
  headers: {
62357
62357
  "User-Agent": `GeminiCLI/${version3} (${process.platform}; ${process.arch})`
@@ -105554,8 +105554,8 @@ function many(p) {
105554
105554
  function many1(p) {
105555
105555
  return ab(p, many(p), (head, tail) => [head, ...tail]);
105556
105556
  }
105557
- function ab(pa, pb, join29) {
105558
- return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join29(ma.value, vb, data, i, j)));
105557
+ function ab(pa, pb, join31) {
105558
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapInner(pb(data, ma.position), (vb, j) => join31(ma.value, vb, data, i, j)));
105559
105559
  }
105560
105560
  function left(pa, pb) {
105561
105561
  return ab(pa, pb, (va) => va);
@@ -105563,8 +105563,8 @@ function left(pa, pb) {
105563
105563
  function right(pa, pb) {
105564
105564
  return ab(pa, pb, (va, vb) => vb);
105565
105565
  }
105566
- function abc(pa, pb, pc, join29) {
105567
- return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join29(ma.value, mb.value, vc, data, i, j))));
105566
+ function abc(pa, pb, pc, join31) {
105567
+ return (data, i) => mapOuter(pa(data, i), (ma) => mapOuter(pb(data, ma.position), (mb) => mapInner(pc(data, mb.position), (vc, j) => join31(ma.value, mb.value, vc, data, i, j))));
105568
105568
  }
105569
105569
  function middle(pa, pb, pc) {
105570
105570
  return abc(pa, pb, pc, (ra2, rb) => rb);
@@ -110538,24 +110538,25 @@ var init_confluence_get_page = __esm({
110538
110538
  init_schemaValidator();
110539
110539
  init_tools();
110540
110540
  init_errors();
110541
+ init_config2();
110541
110542
  CONFLUENCE_FETCH_TIMEOUT_MS = 3e4;
110542
110543
  CONFLUENCE_URL = "https://confluence.rakuten-it.com/confluence";
110543
110544
  ConfluenceGetPageTool = class _ConfluenceGetPageTool extends BaseTool {
110544
110545
  config;
110545
110546
  static Name = "confluence_get_page";
110546
110547
  constructor(config2) {
110547
- super(_ConfluenceGetPageTool.Name, "ConfluenceGetPage", "Retrieves content from a Confluence page by its ID. Uses Personal Access Token from keys.json for authentication and can convert HTML content to markdown.", {
110548
+ super(_ConfluenceGetPageTool.Name, "ConfluenceGetPage", "Retrieves content from a Confluence page by its URL. and the url include confluence.rakuten-it.com, Fetches the page to resolve page ID from HTML, then retrieves content via REST API. Uses Personal Access Token from keys.json and can convert HTML to markdown.", {
110548
110549
  properties: {
110549
- page_id: {
110550
- description: "The ID of the Confluence page to retrieve",
110550
+ confluence_url: {
110551
+ description: "The full Confluence page URL (e.g. https://confluence.rakuten-it.com/confluence/pages/viewpage.action?pageId=12345). Page ID is extracted from the page.",
110551
110552
  type: Type15.STRING
110552
110553
  },
110553
110554
  convert_to_markdown: {
110554
110555
  description: "Whether to convert HTML content to markdown format (default: true)",
110555
- type: Type15.STRING
110556
+ type: Type15.BOOLEAN
110556
110557
  }
110557
110558
  },
110558
- required: ["page_id"],
110559
+ required: ["confluence_url"],
110559
110560
  type: Type15.OBJECT
110560
110561
  });
110561
110562
  this.config = config2;
@@ -110565,13 +110566,51 @@ var init_confluence_get_page = __esm({
110565
110566
  if (errors) {
110566
110567
  return errors;
110567
110568
  }
110568
- if (!params.page_id || params.page_id.trim() === "") {
110569
- return "The 'page_id' parameter cannot be empty.";
110569
+ if (!params.confluence_url || params.confluence_url.trim() === "") {
110570
+ return "The 'confluence_url' parameter cannot be empty.";
110570
110571
  }
110571
110572
  return null;
110572
110573
  }
110573
110574
  getDescription(params) {
110574
- return `Retrieving Confluence page ${params.page_id} from ${CONFLUENCE_URL}`;
110575
+ return `Retrieving Confluence page from URL: ${params.confluence_url}`;
110576
+ }
110577
+ /**
110578
+ * Fetch the Confluence page URL (HTML) and extract page_id from <meta name="ajs-page-id" content="...">.
110579
+ * Mirrors logic in get_page_id_from_url.py.
110580
+ */
110581
+ async getPageIdFromUrl(confluenceUrl, token2, signal) {
110582
+ const controller = new AbortController();
110583
+ const timeoutId = setTimeout(() => controller.abort(), CONFLUENCE_FETCH_TIMEOUT_MS);
110584
+ try {
110585
+ const response = await fetch(confluenceUrl.trim(), {
110586
+ method: "GET",
110587
+ headers: {
110588
+ "Authorization": `Bearer ${token2}`,
110589
+ "Accept": "text/html, application/xhtml+xml, */*"
110590
+ },
110591
+ signal: signal || controller.signal
110592
+ });
110593
+ clearTimeout(timeoutId);
110594
+ if (response.status !== 200) {
110595
+ return {
110596
+ error: `Failed to fetch URL: HTTP ${response.status}. Check the URL and that your token has access to the page.`
110597
+ };
110598
+ }
110599
+ const html = await response.text();
110600
+ const metaMatch = html.match(/<meta\s+name="ajs-page-id"\s+content="([^"]*)"\s*\/?>/i) || html.match(/<meta[^>]+content="([^"]*)"[^>]+name="ajs-page-id"[^>]*>/i);
110601
+ const pageId = metaMatch ? (metaMatch[1] || "").trim() : "";
110602
+ if (!pageId) {
110603
+ return {
110604
+ error: 'Page ID not found: no <meta name="ajs-page-id" content="..."> in the response. Ensure the URL is a Confluence page view URL.'
110605
+ };
110606
+ }
110607
+ return { pageId };
110608
+ } catch (e2) {
110609
+ clearTimeout(timeoutId);
110610
+ return {
110611
+ error: `Network or parse error while fetching URL: ${getErrorMessage(e2)}. Check the URL and network.`
110612
+ };
110613
+ }
110575
110614
  }
110576
110615
  /**
110577
110616
  * Process HTML content to handle user mentions and page links
@@ -110610,15 +110649,23 @@ var init_confluence_get_page = __esm({
110610
110649
  returnDisplay: validationError
110611
110650
  };
110612
110651
  }
110613
- const { page_id, convert_to_markdown = true } = params;
110652
+ const { confluence_url, convert_to_markdown = true } = params;
110614
110653
  const personal_access_token = this.config.getConfluenceToken();
110615
110654
  if (!personal_access_token) {
110616
110655
  return {
110617
- llmContent: "Error: Confluence Personal Access Token not found in keys.json. Please configure it first.",
110618
- returnDisplay: "Confluence token not configured"
110656
+ llmContent: `Error: ${CONFLUENCE_TOKEN_MISSING_MESSAGE}`,
110657
+ returnDisplay: CONFLUENCE_TOKEN_MISSING_MESSAGE
110619
110658
  };
110620
110659
  }
110621
110660
  try {
110661
+ const resolved = await this.getPageIdFromUrl(confluence_url, personal_access_token, signal);
110662
+ if ("error" in resolved) {
110663
+ return {
110664
+ llmContent: `Error: ${resolved.error}`,
110665
+ returnDisplay: resolved.error
110666
+ };
110667
+ }
110668
+ const page_id = resolved.pageId;
110622
110669
  const isCloud = CONFLUENCE_URL.includes(".atlassian.net");
110623
110670
  const apiUrl = `${CONFLUENCE_URL.replace(/\/$/, "")}/rest/api/content/${page_id}`;
110624
110671
  const paramsObj = new URLSearchParams({
@@ -110727,7 +110774,7 @@ ${processedContent}
110727
110774
  returnDisplay: `Retrieved Confluence page: ${title}`
110728
110775
  };
110729
110776
  } catch (error) {
110730
- const errorMessage = `Error retrieving Confluence page ${page_id}: ${getErrorMessage(error)}`;
110777
+ const errorMessage = `Error retrieving Confluence page: ${getErrorMessage(error)}`;
110731
110778
  console.error(errorMessage, error);
110732
110779
  return {
110733
110780
  llmContent: `Error: ${errorMessage}`,
@@ -110748,6 +110795,7 @@ var init_jira_get_issue = __esm({
110748
110795
  init_schemaValidator();
110749
110796
  init_tools();
110750
110797
  init_errors();
110798
+ init_config2();
110751
110799
  JIRA_FETCH_TIMEOUT_MS = 3e4;
110752
110800
  JIRA_URL = "https://jira.rakuten-it.com/jira";
110753
110801
  JiraGetIssueTool = class _JiraGetIssueTool extends BaseTool {
@@ -110869,8 +110917,8 @@ var init_jira_get_issue = __esm({
110869
110917
  const personal_access_token = this.config.getJiraToken();
110870
110918
  if (!personal_access_token) {
110871
110919
  return {
110872
- llmContent: "Error: Jira Personal Access Token not found in keys.json. Please configure it first.",
110873
- returnDisplay: "Jira token not configured"
110920
+ llmContent: `Error: ${JIRA_TOKEN_MISSING_MESSAGE}`,
110921
+ returnDisplay: JIRA_TOKEN_MISSING_MESSAGE
110874
110922
  };
110875
110923
  }
110876
110924
  try {
@@ -159656,7 +159704,7 @@ var require_homedir = __commonJS({
159656
159704
  "node_modules/resolve/lib/homedir.js"(exports2, module2) {
159657
159705
  "use strict";
159658
159706
  var os24 = __require("os");
159659
- module2.exports = os24.homedir || function homedir18() {
159707
+ module2.exports = os24.homedir || function homedir19() {
159660
159708
  var home = process.env.HOME;
159661
159709
  var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
159662
159710
  if (process.platform === "win32") {
@@ -160137,11 +160185,11 @@ var require_async2 = __commonJS({
160137
160185
  var normalizeOptions = require_normalize_options();
160138
160186
  var isCore = require_is_core_module();
160139
160187
  var realpathFS = process.platform !== "win32" && fs54.realpath && typeof fs54.realpath.native === "function" ? fs54.realpath.native : fs54.realpath;
160140
- var homedir18 = getHomedir();
160188
+ var homedir19 = getHomedir();
160141
160189
  var defaultPaths = function() {
160142
160190
  return [
160143
- path56.join(homedir18, ".node_modules"),
160144
- path56.join(homedir18, ".node_libraries")
160191
+ path56.join(homedir19, ".node_modules"),
160192
+ path56.join(homedir19, ".node_libraries")
160145
160193
  ];
160146
160194
  };
160147
160195
  var defaultIsFile = function isFile(file, cb) {
@@ -160627,11 +160675,11 @@ var require_sync = __commonJS({
160627
160675
  var nodeModulesPaths = require_node_modules_paths();
160628
160676
  var normalizeOptions = require_normalize_options();
160629
160677
  var realpathFS = process.platform !== "win32" && fs54.realpathSync && typeof fs54.realpathSync.native === "function" ? fs54.realpathSync.native : fs54.realpathSync;
160630
- var homedir18 = getHomedir();
160678
+ var homedir19 = getHomedir();
160631
160679
  var defaultPaths = function() {
160632
160680
  return [
160633
- path56.join(homedir18, ".node_modules"),
160634
- path56.join(homedir18, ".node_libraries")
160681
+ path56.join(homedir19, ".node_modules"),
160682
+ path56.join(homedir19, ".node_libraries")
160635
160683
  ];
160636
160684
  };
160637
160685
  var defaultIsFile = function isFile(file) {
@@ -160668,8 +160716,8 @@ var require_sync = __commonJS({
160668
160716
  }
160669
160717
  return x;
160670
160718
  };
160671
- var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync23, pkgfile) {
160672
- var body = readFileSync23(pkgfile);
160719
+ var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync24, pkgfile) {
160720
+ var body = readFileSync24(pkgfile);
160673
160721
  try {
160674
160722
  var pkg2 = JSON.parse(body);
160675
160723
  return pkg2;
@@ -160689,7 +160737,7 @@ var require_sync = __commonJS({
160689
160737
  }
160690
160738
  var opts = normalizeOptions(x, options);
160691
160739
  var isFile = opts.isFile || defaultIsFile;
160692
- var readFileSync23 = opts.readFileSync || fs54.readFileSync;
160740
+ var readFileSync24 = opts.readFileSync || fs54.readFileSync;
160693
160741
  var isDirectory = opts.isDirectory || defaultIsDir;
160694
160742
  var realpathSync2 = opts.realpathSync || defaultRealpathSync;
160695
160743
  var readPackageSync2 = opts.readPackageSync || defaultReadPackageSync;
@@ -160746,7 +160794,7 @@ var require_sync = __commonJS({
160746
160794
  if (!isFile(pkgfile)) {
160747
160795
  return loadpkg(path56.dirname(dir));
160748
160796
  }
160749
- var pkg2 = readPackageSync2(readFileSync23, pkgfile);
160797
+ var pkg2 = readPackageSync2(readFileSync24, pkgfile);
160750
160798
  if (pkg2 && opts.packageFilter) {
160751
160799
  pkg2 = opts.packageFilter(
160752
160800
  pkg2,
@@ -160760,7 +160808,7 @@ var require_sync = __commonJS({
160760
160808
  var pkgfile = path56.join(maybeRealpathSync(realpathSync2, x2, opts), "/package.json");
160761
160809
  if (isFile(pkgfile)) {
160762
160810
  try {
160763
- var pkg2 = readPackageSync2(readFileSync23, pkgfile);
160811
+ var pkg2 = readPackageSync2(readFileSync24, pkgfile);
160764
160812
  } catch (e2) {
160765
160813
  }
160766
160814
  if (pkg2 && opts.packageFilter) {
@@ -193579,7 +193627,7 @@ import process21 from "node:process";
193579
193627
  import { existsSync as existsSync6, readFileSync as readFileSync6 } from "node:fs";
193580
193628
  import { join as join11 } from "node:path";
193581
193629
  import { homedir as homedir6 } from "node:os";
193582
- var ApprovalMode, MCPServerConfig, Config;
193630
+ var CONFLUENCE_TOKEN_MISSING_MESSAGE, JIRA_TOKEN_MISSING_MESSAGE, ApprovalMode, MCPServerConfig, Config;
193583
193631
  var init_config2 = __esm({
193584
193632
  "packages/core/dist/src/config/config.js"() {
193585
193633
  "use strict";
@@ -193609,6 +193657,8 @@ var init_config2 = __esm({
193609
193657
  init_telemetry();
193610
193658
  init_models();
193611
193659
  init_clearcut_logger();
193660
+ CONFLUENCE_TOKEN_MISSING_MESSAGE = "Confluence Personal Access Token not found. Set it with: frankcli set confluence token <Personal Access Tokens>. Create a token at: https://confluence.rakuten-it.com/confluence/plugins/personalaccesstokens/usertokens.action";
193661
+ JIRA_TOKEN_MISSING_MESSAGE = "Jira Personal Access Token not found. Set it with: frankcli set jira token <Personal Access Tokens>. Create a token at: https://jira.rakuten-it.com/jira/secure/ViewProfile.jspa";
193612
193662
  (function(ApprovalMode2) {
193613
193663
  ApprovalMode2["DEFAULT"] = "default";
193614
193664
  ApprovalMode2["AUTO_EDIT"] = "autoEdit";
@@ -193921,12 +193971,19 @@ var init_config2 = __esm({
193921
193971
  return { memoryContent, fileCount };
193922
193972
  }
193923
193973
  /**
193924
- * Get Confluence Advanced Access Token from keys.json
193974
+ * Get Confluence Advanced Access Token. Checks ~/.mpdai/confluence.key first, then keys.json.
193925
193975
  * @returns The Personal Access Token or null if not found
193926
193976
  */
193927
193977
  getConfluenceToken() {
193928
193978
  try {
193929
- const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
193979
+ const mpdaiDir = join11(homedir6(), ".mpdai");
193980
+ const keyFilePath = join11(mpdaiDir, "confluence.key");
193981
+ if (existsSync6(keyFilePath)) {
193982
+ const value = readFileSync6(keyFilePath, "utf-8").trim();
193983
+ if (value)
193984
+ return value;
193985
+ }
193986
+ const keysJsonPath = join11(mpdaiDir, "keys.json");
193930
193987
  if (!existsSync6(keysJsonPath)) {
193931
193988
  return null;
193932
193989
  }
@@ -193938,17 +193995,24 @@ var init_config2 = __esm({
193938
193995
  }
193939
193996
  return null;
193940
193997
  } catch (error) {
193941
- console.error("Failed to read Confluence token from keys.json:", error);
193998
+ console.error("Failed to read Confluence token:", error);
193942
193999
  return null;
193943
194000
  }
193944
194001
  }
193945
194002
  /**
193946
- * Get Jira Personal Access Token from keys.json
194003
+ * Get Jira Personal Access Token. Checks ~/.mpdai/jira.key first, then keys.json.
193947
194004
  * @returns The Personal Access Token or null if not found
193948
194005
  */
193949
194006
  getJiraToken() {
193950
194007
  try {
193951
- const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
194008
+ const mpdaiDir = join11(homedir6(), ".mpdai");
194009
+ const keyFilePath = join11(mpdaiDir, "jira.key");
194010
+ if (existsSync6(keyFilePath)) {
194011
+ const value = readFileSync6(keyFilePath, "utf-8").trim();
194012
+ if (value)
194013
+ return value;
194014
+ }
194015
+ const keysJsonPath = join11(mpdaiDir, "keys.json");
193952
194016
  if (!existsSync6(keysJsonPath)) {
193953
194017
  return null;
193954
194018
  }
@@ -193960,7 +194024,7 @@ var init_config2 = __esm({
193960
194024
  }
193961
194025
  return null;
193962
194026
  } catch (error) {
193963
- console.error("Failed to read Jira token from keys.json:", error);
194027
+ console.error("Failed to read Jira token:", error);
193964
194028
  return null;
193965
194029
  }
193966
194030
  }
@@ -194986,6 +195050,95 @@ var init_nonInteractiveToolExecutor = __esm({
194986
195050
  }
194987
195051
  });
194988
195052
 
195053
+ // packages/core/dist/src/cli-tools-runner.js
195054
+ import { join as join12 } from "node:path";
195055
+ import { homedir as homedir7 } from "node:os";
195056
+ import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
195057
+ function llmContentToString(content) {
195058
+ if (typeof content === "string")
195059
+ return content;
195060
+ if (Array.isArray(content)) {
195061
+ return content.map((p) => typeof p === "string" ? p : p?.text ?? "").join("");
195062
+ }
195063
+ return String(content);
195064
+ }
195065
+ function readTokenFromKeyFile(service) {
195066
+ const fileName = service === "confluence" ? "confluence.key" : "jira.key";
195067
+ const keyFilePath = join12(homedir7(), ".mpdai", fileName);
195068
+ if (!existsSync7(keyFilePath))
195069
+ return null;
195070
+ try {
195071
+ const value = readFileSync7(keyFilePath, "utf-8").trim();
195072
+ return value || null;
195073
+ } catch {
195074
+ return null;
195075
+ }
195076
+ }
195077
+ function readTokensFromKeysJson() {
195078
+ const keysJsonPath = join12(homedir7(), ".mpdai", "keys.json");
195079
+ if (!existsSync7(keysJsonPath)) {
195080
+ return { confluence: null, jira: null };
195081
+ }
195082
+ try {
195083
+ const content = readFileSync7(keysJsonPath, "utf-8");
195084
+ const keys = JSON.parse(content);
195085
+ const confluence = keys.find((k) => k.name === "confluence")?.value1 ?? null;
195086
+ const jira = keys.find((k) => k.name === "jira")?.value1 ?? null;
195087
+ return { confluence, jira };
195088
+ } catch {
195089
+ return { confluence: null, jira: null };
195090
+ }
195091
+ }
195092
+ function createMinimalConfigForTools() {
195093
+ const fromKeys = readTokensFromKeysJson();
195094
+ return {
195095
+ getConfluenceToken: () => readTokenFromKeyFile("confluence") ?? fromKeys.confluence,
195096
+ getJiraToken: () => readTokenFromKeyFile("jira") ?? fromKeys.jira
195097
+ };
195098
+ }
195099
+ async function runConfluenceGetPage(confluenceUrl) {
195100
+ const config2 = createMinimalConfigForTools();
195101
+ const token2 = config2.getConfluenceToken();
195102
+ if (!token2) {
195103
+ return {
195104
+ success: false,
195105
+ error: CONFLUENCE_TOKEN_MISSING_MESSAGE
195106
+ };
195107
+ }
195108
+ const tool = new ConfluenceGetPageTool(config2);
195109
+ const result = await tool.execute({ confluence_url: confluenceUrl.trim(), convert_to_markdown: true }, void 0);
195110
+ const contentStr = llmContentToString(result.llmContent);
195111
+ if (contentStr.startsWith("Error:")) {
195112
+ return { success: false, error: contentStr };
195113
+ }
195114
+ return { success: true, content: contentStr };
195115
+ }
195116
+ async function runJiraGetIssue(issueKey) {
195117
+ const config2 = createMinimalConfigForTools();
195118
+ const token2 = config2.getJiraToken();
195119
+ if (!token2) {
195120
+ return {
195121
+ success: false,
195122
+ error: JIRA_TOKEN_MISSING_MESSAGE
195123
+ };
195124
+ }
195125
+ const tool = new JiraGetIssueTool(config2);
195126
+ const result = await tool.execute({ issue_key: issueKey.trim() }, void 0);
195127
+ const contentStr = llmContentToString(result.llmContent);
195128
+ if (contentStr.startsWith("Error:")) {
195129
+ return { success: false, error: contentStr };
195130
+ }
195131
+ return { success: true, content: contentStr };
195132
+ }
195133
+ var init_cli_tools_runner = __esm({
195134
+ "packages/core/dist/src/cli-tools-runner.js"() {
195135
+ "use strict";
195136
+ init_confluence_get_page();
195137
+ init_jira_get_issue();
195138
+ init_config2();
195139
+ }
195140
+ });
195141
+
194989
195142
  // packages/core/dist/src/utils/session.js
194990
195143
  import { randomUUID as randomUUID2 } from "crypto";
194991
195144
  var sessionId;
@@ -195039,6 +195192,7 @@ var init_src = __esm({
195039
195192
  init_read_many_files();
195040
195193
  init_mcp_client();
195041
195194
  init_mcp_tool();
195195
+ init_cli_tools_runner();
195042
195196
  init_telemetry();
195043
195197
  init_session();
195044
195198
  }
@@ -195056,6 +195210,7 @@ __export(dist_exports, {
195056
195210
  BaseTool: () => BaseTool,
195057
195211
  CODE_ASSIST_API_VERSION: () => CODE_ASSIST_API_VERSION,
195058
195212
  CODE_ASSIST_ENDPOINT: () => CODE_ASSIST_ENDPOINT,
195213
+ CONFLUENCE_TOKEN_MISSING_MESSAGE: () => CONFLUENCE_TOKEN_MISSING_MESSAGE,
195059
195214
  CodeAssistServer: () => CodeAssistServer,
195060
195215
  Config: () => Config,
195061
195216
  CoreToolScheduler: () => CoreToolScheduler,
@@ -195080,6 +195235,7 @@ __export(dist_exports, {
195080
195235
  GlobTool: () => GlobTool,
195081
195236
  GrepTool: () => GrepTool,
195082
195237
  IneligibleTierReasonCode: () => IneligibleTierReasonCode,
195238
+ JIRA_TOKEN_MISSING_MESSAGE: () => JIRA_TOKEN_MISSING_MESSAGE,
195083
195239
  LSTool: () => LSTool,
195084
195240
  Logger: () => Logger,
195085
195241
  MCPDiscoveryState: () => MCPDiscoveryState,
@@ -195156,6 +195312,8 @@ __export(dist_exports, {
195156
195312
  openDiff: () => openDiff,
195157
195313
  partListUnionToString: () => partListUnionToString,
195158
195314
  removeMCPStatusChangeListener: () => removeMCPStatusChangeListener,
195315
+ runConfluenceGetPage: () => runConfluenceGetPage,
195316
+ runJiraGetIssue: () => runJiraGetIssue,
195159
195317
  sanitizeParameters: () => sanitizeParameters,
195160
195318
  sessionId: () => sessionId,
195161
195319
  setGeminiMdFilename: () => setGeminiMdFilename,
@@ -199244,9 +199402,9 @@ var init_lib3 = __esm({
199244
199402
  });
199245
199403
 
199246
199404
  // packages/cli/src/telemetry/langfuseConfig.ts
199247
- import { readFileSync as readFileSync7, existsSync as existsSync7 } from "fs";
199248
- import { join as join12 } from "path";
199249
- import { homedir as homedir7 } from "os";
199405
+ import { readFileSync as readFileSync8, existsSync as existsSync8 } from "fs";
199406
+ import { join as join13 } from "path";
199407
+ import { homedir as homedir8 } from "os";
199250
199408
  var LangfuseConfigManager;
199251
199409
  var init_langfuseConfig = __esm({
199252
199410
  "packages/cli/src/telemetry/langfuseConfig.ts"() {
@@ -199267,15 +199425,15 @@ var init_langfuseConfig = __esm({
199267
199425
  return this.config;
199268
199426
  }
199269
199427
  try {
199270
- const userConfigPath = join12(homedir7(), ".mpdai", "settings.conf");
199271
- if (existsSync7(userConfigPath)) {
199272
- const configContent = readFileSync7(userConfigPath, "utf-8");
199428
+ const userConfigPath = join13(homedir8(), ".mpdai", "settings.conf");
199429
+ if (existsSync8(userConfigPath)) {
199430
+ const configContent = readFileSync8(userConfigPath, "utf-8");
199273
199431
  this.config = JSON.parse(configContent);
199274
199432
  return this.config;
199275
199433
  }
199276
- const projectConfigPath = join12(process.cwd(), ".langfuse", "settings.conf");
199277
- if (existsSync7(projectConfigPath)) {
199278
- const configContent = readFileSync7(projectConfigPath, "utf-8");
199434
+ const projectConfigPath = join13(process.cwd(), ".langfuse", "settings.conf");
199435
+ if (existsSync8(projectConfigPath)) {
199436
+ const configContent = readFileSync8(projectConfigPath, "utf-8");
199279
199437
  this.config = JSON.parse(configContent);
199280
199438
  return this.config;
199281
199439
  }
@@ -199307,9 +199465,9 @@ var init_langfuseConfig = __esm({
199307
199465
  });
199308
199466
 
199309
199467
  // packages/cli/src/telemetry/langfuseClient.ts
199310
- import { join as join13 } from "path";
199311
- import { homedir as homedir8 } from "os";
199312
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
199468
+ import { join as join14 } from "path";
199469
+ import { homedir as homedir9 } from "os";
199470
+ import { existsSync as existsSync9, readFileSync as readFileSync9 } from "fs";
199313
199471
  var LangfuseClient;
199314
199472
  var init_langfuseClient = __esm({
199315
199473
  "packages/cli/src/telemetry/langfuseClient.ts"() {
@@ -199411,7 +199569,7 @@ var init_langfuseClient = __esm({
199411
199569
  userId,
199412
199570
  metadata: {
199413
199571
  ...safeMetadata,
199414
- cli_version: this.safeString("0.1.51", "unknown"),
199572
+ cli_version: this.safeString("0.1.52", "unknown"),
199415
199573
  model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
199416
199574
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
199417
199575
  environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
@@ -199723,9 +199881,9 @@ var init_langfuseClient = __esm({
199723
199881
  // 获取用户ID
199724
199882
  getUserId() {
199725
199883
  try {
199726
- const userJsonPath = join13(homedir8(), ".mpdai", "user.json");
199727
- if (existsSync8(userJsonPath)) {
199728
- const content = readFileSync8(userJsonPath, "utf-8");
199884
+ const userJsonPath = join14(homedir9(), ".mpdai", "user.json");
199885
+ if (existsSync9(userJsonPath)) {
199886
+ const content = readFileSync9(userJsonPath, "utf-8");
199729
199887
  const userData = JSON.parse(content);
199730
199888
  if (userData.username) {
199731
199889
  return userData.username;
@@ -200578,7 +200736,7 @@ var init_langfuseIntegration = __esm({
200578
200736
  const metadata = {
200579
200737
  model: this.config.getModel(),
200580
200738
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200581
- cli_version: "0.1.51",
200739
+ cli_version: "0.1.52",
200582
200740
  start_time: (/* @__PURE__ */ new Date()).toISOString(),
200583
200741
  session_id: this.sessionId
200584
200742
  };
@@ -200637,7 +200795,7 @@ var init_langfuseIntegration = __esm({
200637
200795
  totalCachedTokens: sessionStats.totalCachedTokens,
200638
200796
  totalPromptTokens: sessionStats.totalPromptTokens,
200639
200797
  metadata: {
200640
- cli_version: "0.1.51",
200798
+ cli_version: "0.1.52",
200641
200799
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200642
200800
  session_end_time: (/* @__PURE__ */ new Date()).toISOString()
200643
200801
  }
@@ -200709,7 +200867,7 @@ var init_langfuseIntegration = __esm({
200709
200867
  error,
200710
200868
  metadata: {
200711
200869
  session_id: this.sessionId,
200712
- cli_version: "0.1.51",
200870
+ cli_version: "0.1.52",
200713
200871
  auth_type: this.config.getContentGeneratorConfig()?.authType
200714
200872
  }
200715
200873
  });
@@ -206100,6 +206258,11 @@ var init_read_package_up = __esm({
206100
206258
  });
206101
206259
 
206102
206260
  // packages/cli/src/utils/package.ts
206261
+ var package_exports = {};
206262
+ __export(package_exports, {
206263
+ getPackageJson: () => getPackageJson,
206264
+ getPackageRoot: () => getPackageRoot
206265
+ });
206103
206266
  import { fileURLToPath as fileURLToPath6 } from "url";
206104
206267
  import path36 from "path";
206105
206268
  async function getPackageJson() {
@@ -206111,9 +206274,14 @@ async function getPackageJson() {
206111
206274
  return;
206112
206275
  }
206113
206276
  packageJson = result.packageJson;
206277
+ packageRoot = path36.dirname(result.path);
206114
206278
  return packageJson;
206115
206279
  }
206116
- var __filename, __dirname3, packageJson;
206280
+ async function getPackageRoot() {
206281
+ await getPackageJson();
206282
+ return packageRoot;
206283
+ }
206284
+ var __filename, __dirname3, packageJson, packageRoot;
206117
206285
  var init_package = __esm({
206118
206286
  "packages/cli/src/utils/package.ts"() {
206119
206287
  "use strict";
@@ -206130,7 +206298,7 @@ __export(version_exports, {
206130
206298
  });
206131
206299
  async function getCliVersion() {
206132
206300
  const pkgJson = await getPackageJson();
206133
- return "0.1.51";
206301
+ return "0.1.52";
206134
206302
  }
206135
206303
  var init_version5 = __esm({
206136
206304
  "packages/cli/src/utils/version.ts"() {
@@ -206140,9 +206308,9 @@ var init_version5 = __esm({
206140
206308
  });
206141
206309
 
206142
206310
  // packages/cli/src/config/mpdaiConfig.ts
206143
- import { readFileSync as readFileSync9, existsSync as existsSync10 } from "fs";
206144
- import { join as join15 } from "path";
206145
- import { homedir as homedir10 } from "os";
206311
+ import { readFileSync as readFileSync10, existsSync as existsSync11 } from "fs";
206312
+ import { join as join16 } from "path";
206313
+ import { homedir as homedir11 } from "os";
206146
206314
  var MpdaiConfigManager;
206147
206315
  var init_mpdaiConfig = __esm({
206148
206316
  "packages/cli/src/config/mpdaiConfig.ts"() {
@@ -206163,15 +206331,15 @@ var init_mpdaiConfig = __esm({
206163
206331
  return this.config;
206164
206332
  }
206165
206333
  try {
206166
- const userConfigPath = join15(homedir10(), ".mpdai", "config.json");
206167
- if (existsSync10(userConfigPath)) {
206168
- const configContent = readFileSync9(userConfigPath, "utf-8");
206334
+ const userConfigPath = join16(homedir11(), ".mpdai", "config.json");
206335
+ if (existsSync11(userConfigPath)) {
206336
+ const configContent = readFileSync10(userConfigPath, "utf-8");
206169
206337
  this.config = JSON.parse(configContent);
206170
206338
  return this.config;
206171
206339
  }
206172
- const projectConfigPath = join15(process.cwd(), ".mpdai", "config.json");
206173
- if (existsSync10(projectConfigPath)) {
206174
- const configContent = readFileSync9(projectConfigPath, "utf-8");
206340
+ const projectConfigPath = join16(process.cwd(), ".mpdai", "config.json");
206341
+ if (existsSync11(projectConfigPath)) {
206342
+ const configContent = readFileSync10(projectConfigPath, "utf-8");
206175
206343
  this.config = JSON.parse(configContent);
206176
206344
  return this.config;
206177
206345
  }
@@ -207660,9 +207828,9 @@ var EnvConfigManager_exports = {};
207660
207828
  __export(EnvConfigManager_exports, {
207661
207829
  EnvConfigManager: () => EnvConfigManager
207662
207830
  });
207663
- import { readFileSync as readFileSync10, writeFileSync as writeFileSync3, existsSync as existsSync11, mkdirSync as mkdirSync3 } from "fs";
207664
- import { join as join16, dirname as dirname6 } from "path";
207665
- import { homedir as homedir11 } from "os";
207831
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync3, existsSync as existsSync12, mkdirSync as mkdirSync3 } from "fs";
207832
+ import { join as join17, dirname as dirname6 } from "path";
207833
+ import { homedir as homedir12 } from "os";
207666
207834
  var EnvConfigManager;
207667
207835
  var init_EnvConfigManager = __esm({
207668
207836
  "packages/cli/src/services/EnvConfigManager.ts"() {
@@ -207684,17 +207852,17 @@ var init_EnvConfigManager = __esm({
207684
207852
  let currentDir = startDir;
207685
207853
  while (true) {
207686
207854
  for (const envPath of this.envPaths) {
207687
- const fullPath = join16(currentDir, envPath);
207688
- if (existsSync11(fullPath)) {
207855
+ const fullPath = join17(currentDir, envPath);
207856
+ if (existsSync12(fullPath)) {
207689
207857
  return fullPath;
207690
207858
  }
207691
207859
  }
207692
- const parentDir = join16(currentDir, "..");
207860
+ const parentDir = join17(currentDir, "..");
207693
207861
  if (parentDir === currentDir) {
207694
- const homeDir2 = homedir11();
207862
+ const homeDir2 = homedir12();
207695
207863
  for (const envPath of this.envPaths) {
207696
- const fullPath = join16(homeDir2, envPath);
207697
- if (existsSync11(fullPath)) {
207864
+ const fullPath = join17(homeDir2, envPath);
207865
+ if (existsSync12(fullPath)) {
207698
207866
  return fullPath;
207699
207867
  }
207700
207868
  }
@@ -207709,7 +207877,7 @@ var init_EnvConfigManager = __esm({
207709
207877
  */
207710
207878
  readEnvFile(envPath) {
207711
207879
  try {
207712
- const content = readFileSync10(envPath, "utf-8");
207880
+ const content = readFileSync11(envPath, "utf-8");
207713
207881
  const envVars = {};
207714
207882
  content.split("\n").forEach((line) => {
207715
207883
  line = line.trim();
@@ -207754,7 +207922,7 @@ var init_EnvConfigManager = __esm({
207754
207922
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207755
207923
  try {
207756
207924
  const dir = dirname6(envPath);
207757
- if (!existsSync11(dir)) {
207925
+ if (!existsSync12(dir)) {
207758
207926
  mkdirSync3(dir, { recursive: true });
207759
207927
  }
207760
207928
  const envContent = Object.entries(envConfig).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";
@@ -207771,8 +207939,8 @@ var init_EnvConfigManager = __esm({
207771
207939
  * 更新或创建.env文件
207772
207940
  */
207773
207941
  updateEnvFile(model, targetPath) {
207774
- const envPath = targetPath || this.findEnvFile(process.cwd()) || join16(process.cwd(), ".mpdai", ".env");
207775
- const existingConfig = existsSync11(envPath) ? this.readEnvFile(envPath) : {};
207942
+ const envPath = targetPath || this.findEnvFile(process.cwd()) || join17(process.cwd(), ".mpdai", ".env");
207943
+ const existingConfig = existsSync12(envPath) ? this.readEnvFile(envPath) : {};
207776
207944
  const newConfig = this.generateEnvConfig(model, existingConfig);
207777
207945
  this.writeEnvFile(newConfig, envPath);
207778
207946
  return envPath;
@@ -208157,9 +208325,9 @@ var AuthService_exports = {};
208157
208325
  __export(AuthService_exports, {
208158
208326
  AuthService: () => AuthService
208159
208327
  });
208160
- import { readFileSync as readFileSync11, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync4 } from "fs";
208161
- import { join as join17 } from "path";
208162
- import { homedir as homedir12 } from "os";
208328
+ import { readFileSync as readFileSync12, writeFileSync as writeFileSync4, existsSync as existsSync13, mkdirSync as mkdirSync4 } from "fs";
208329
+ import { join as join18 } from "path";
208330
+ import { homedir as homedir13 } from "os";
208163
208331
  var readlineSync, AuthService;
208164
208332
  var init_AuthService = __esm({
208165
208333
  "packages/cli/src/services/AuthService.ts"() {
@@ -208179,15 +208347,15 @@ var init_AuthService = __esm({
208179
208347
  this.mpdaiConfig = MpdaiConfigManager.getInstance();
208180
208348
  this.authApiUrl = authApiUrl || this.mpdaiConfig.getAuthUrl();
208181
208349
  this.tokenApiUrl = this.mpdaiConfig.getTokenUrl();
208182
- this.userJsonPath = join17(homedir12(), ".mpdai", "user.json");
208183
- this.keysJsonPath = join17(homedir12(), ".mpdai", "keys.json");
208184
- this.idTokenPath = join17(homedir12(), ".mpdai", "id.token");
208350
+ this.userJsonPath = join18(homedir13(), ".mpdai", "user.json");
208351
+ this.keysJsonPath = join18(homedir13(), ".mpdai", "keys.json");
208352
+ this.idTokenPath = join18(homedir13(), ".mpdai", "id.token");
208185
208353
  }
208186
208354
  /**
208187
208355
  * 检查本地是否存在用户凭据文件
208188
208356
  */
208189
208357
  hasLocalCredentials() {
208190
- return existsSync12(this.userJsonPath);
208358
+ return existsSync13(this.userJsonPath);
208191
208359
  }
208192
208360
  /**
208193
208361
  * 从本地文件读取用户凭据
@@ -208197,7 +208365,7 @@ var init_AuthService = __esm({
208197
208365
  if (!this.hasLocalCredentials()) {
208198
208366
  return null;
208199
208367
  }
208200
- const content = readFileSync11(this.userJsonPath, "utf-8");
208368
+ const content = readFileSync12(this.userJsonPath, "utf-8");
208201
208369
  const credentials = JSON.parse(content);
208202
208370
  if (credentials.sso) {
208203
208371
  return credentials;
@@ -208220,7 +208388,7 @@ var init_AuthService = __esm({
208220
208388
  if (!this.hasLocalCredentials()) {
208221
208389
  return false;
208222
208390
  }
208223
- const content = readFileSync11(this.userJsonPath, "utf-8");
208391
+ const content = readFileSync12(this.userJsonPath, "utf-8");
208224
208392
  const credentials = JSON.parse(content);
208225
208393
  if (credentials.sso) {
208226
208394
  return false;
@@ -208235,10 +208403,10 @@ var init_AuthService = __esm({
208235
208403
  */
208236
208404
  readIdToken() {
208237
208405
  try {
208238
- if (!existsSync12(this.idTokenPath)) {
208406
+ if (!existsSync13(this.idTokenPath)) {
208239
208407
  return null;
208240
208408
  }
208241
- const token2 = readFileSync11(this.idTokenPath, "utf-8").trim();
208409
+ const token2 = readFileSync12(this.idTokenPath, "utf-8").trim();
208242
208410
  return token2 || null;
208243
208411
  } catch (error) {
208244
208412
  console.error("Failed to read id.token:", error);
@@ -208305,8 +208473,8 @@ var init_AuthService = __esm({
208305
208473
  */
208306
208474
  saveCredentials(credentials) {
208307
208475
  try {
208308
- const dir = join17(homedir12(), ".mpdai");
208309
- if (!existsSync12(dir)) {
208476
+ const dir = join18(homedir13(), ".mpdai");
208477
+ if (!existsSync13(dir)) {
208310
208478
  mkdirSync4(dir, { recursive: true });
208311
208479
  }
208312
208480
  const credentialsToSave = {
@@ -208327,7 +208495,7 @@ var init_AuthService = __esm({
208327
208495
  * 检查本地是否存在 keys 文件
208328
208496
  */
208329
208497
  hasLocalKeys() {
208330
- return existsSync12(this.keysJsonPath);
208498
+ return existsSync13(this.keysJsonPath);
208331
208499
  }
208332
208500
  /**
208333
208501
  * 从本地文件读取 keys
@@ -208337,7 +208505,7 @@ var init_AuthService = __esm({
208337
208505
  if (!this.hasLocalKeys()) {
208338
208506
  return null;
208339
208507
  }
208340
- const content = readFileSync11(this.keysJsonPath, "utf-8");
208508
+ const content = readFileSync12(this.keysJsonPath, "utf-8");
208341
208509
  const keys = JSON.parse(content);
208342
208510
  return keys;
208343
208511
  } catch (error) {
@@ -208350,8 +208518,8 @@ var init_AuthService = __esm({
208350
208518
  */
208351
208519
  saveKeys(keys) {
208352
208520
  try {
208353
- const dir = join17(homedir12(), ".mpdai");
208354
- if (!existsSync12(dir)) {
208521
+ const dir = join18(homedir13(), ".mpdai");
208522
+ if (!existsSync13(dir)) {
208355
208523
  mkdirSync4(dir, { recursive: true });
208356
208524
  }
208357
208525
  writeFileSync4(this.keysJsonPath, JSON.stringify(keys, null, 2), "utf-8");
@@ -209861,7 +210029,7 @@ var init_update = __esm({
209861
210029
  });
209862
210030
 
209863
210031
  // packages/router/dist/src/utils/diagnose.js
209864
- import { existsSync as existsSync13 } from "fs";
210032
+ import { existsSync as existsSync14 } from "fs";
209865
210033
  import https3 from "https";
209866
210034
  import http2 from "http";
209867
210035
  async function diagnoseRouterConfig() {
@@ -209876,7 +210044,7 @@ async function diagnoseRouterConfig() {
209876
210044
  try {
209877
210045
  const configFilePath2 = await getConfigFilePath();
209878
210046
  result.configFile = configFilePath2;
209879
- result.configExists = existsSync13(configFilePath2);
210047
+ result.configExists = existsSync14(configFilePath2);
209880
210048
  if (!result.configExists) {
209881
210049
  result.issues.push(`Configuration file does not exist: ${configFilePath2}`);
209882
210050
  return result;
@@ -215544,7 +215712,7 @@ var require_thread_stream = __commonJS({
215544
215712
  var { version: version3 } = require_package6();
215545
215713
  var { EventEmitter: EventEmitter7 } = __require("events");
215546
215714
  var { Worker } = __require("worker_threads");
215547
- var { join: join29 } = __require("path");
215715
+ var { join: join31 } = __require("path");
215548
215716
  var { pathToFileURL } = __require("url");
215549
215717
  var { wait } = require_wait();
215550
215718
  var {
@@ -215580,7 +215748,7 @@ var require_thread_stream = __commonJS({
215580
215748
  function createWorker(stream2, opts) {
215581
215749
  const { filename, workerData } = opts;
215582
215750
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
215583
- const toExecute = bundlerOverrides["thread-stream-worker"] || join29(__dirname, "lib", "worker.js");
215751
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join31(__dirname, "lib", "worker.js");
215584
215752
  const worker = new Worker(toExecute, {
215585
215753
  ...opts.workerOpts,
215586
215754
  trackUnmanagedFds: false,
@@ -215966,7 +216134,7 @@ var require_transport2 = __commonJS({
215966
216134
  "use strict";
215967
216135
  var { createRequire: createRequire2 } = __require("module");
215968
216136
  var getCallers = require_caller2();
215969
- var { join: join29, isAbsolute: isAbsolute4, sep: sep3 } = __require("node:path");
216137
+ var { join: join31, isAbsolute: isAbsolute4, sep: sep3 } = __require("node:path");
215970
216138
  var sleep2 = require_atomic_sleep();
215971
216139
  var onExit2 = require_on_exit_leak_free();
215972
216140
  var ThreadStream = require_thread_stream();
@@ -216029,7 +216197,7 @@ var require_transport2 = __commonJS({
216029
216197
  throw new Error("only one of target or targets can be specified");
216030
216198
  }
216031
216199
  if (targets) {
216032
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
216200
+ target = bundlerOverrides["pino-worker"] || join31(__dirname, "worker.js");
216033
216201
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
216034
216202
  return {
216035
216203
  ...dest,
@@ -216047,7 +216215,7 @@ var require_transport2 = __commonJS({
216047
216215
  });
216048
216216
  });
216049
216217
  } else if (pipeline) {
216050
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
216218
+ target = bundlerOverrides["pino-worker"] || join31(__dirname, "worker.js");
216051
216219
  options.pipelines = [pipeline.map((dest) => {
216052
216220
  return {
216053
216221
  ...dest,
@@ -216069,7 +216237,7 @@ var require_transport2 = __commonJS({
216069
216237
  return origin;
216070
216238
  }
216071
216239
  if (origin === "pino/file") {
216072
- return join29(__dirname, "..", "file.js");
216240
+ return join31(__dirname, "..", "file.js");
216073
216241
  }
216074
216242
  let fixTarget2;
216075
216243
  for (const filePath of callers) {
@@ -217058,7 +217226,7 @@ var require_safe_stable_stringify = __commonJS({
217058
217226
  return circularValue;
217059
217227
  }
217060
217228
  let res = "";
217061
- let join29 = ",";
217229
+ let join31 = ",";
217062
217230
  const originalIndentation = indentation;
217063
217231
  if (Array.isArray(value)) {
217064
217232
  if (value.length === 0) {
@@ -217072,7 +217240,7 @@ var require_safe_stable_stringify = __commonJS({
217072
217240
  indentation += spacer;
217073
217241
  res += `
217074
217242
  ${indentation}`;
217075
- join29 = `,
217243
+ join31 = `,
217076
217244
  ${indentation}`;
217077
217245
  }
217078
217246
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -217080,13 +217248,13 @@ ${indentation}`;
217080
217248
  for (; i < maximumValuesToStringify - 1; i++) {
217081
217249
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
217082
217250
  res += tmp2 !== void 0 ? tmp2 : "null";
217083
- res += join29;
217251
+ res += join31;
217084
217252
  }
217085
217253
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
217086
217254
  res += tmp !== void 0 ? tmp : "null";
217087
217255
  if (value.length - 1 > maximumBreadth) {
217088
217256
  const removedKeys = value.length - maximumBreadth - 1;
217089
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
217257
+ res += `${join31}"... ${getItemCount(removedKeys)} not stringified"`;
217090
217258
  }
217091
217259
  if (spacer !== "") {
217092
217260
  res += `
@@ -217107,7 +217275,7 @@ ${originalIndentation}`;
217107
217275
  let separator = "";
217108
217276
  if (spacer !== "") {
217109
217277
  indentation += spacer;
217110
- join29 = `,
217278
+ join31 = `,
217111
217279
  ${indentation}`;
217112
217280
  whitespace = " ";
217113
217281
  }
@@ -217121,13 +217289,13 @@ ${indentation}`;
217121
217289
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
217122
217290
  if (tmp !== void 0) {
217123
217291
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
217124
- separator = join29;
217292
+ separator = join31;
217125
217293
  }
217126
217294
  }
217127
217295
  if (keyLength > maximumBreadth) {
217128
217296
  const removedKeys = keyLength - maximumBreadth;
217129
217297
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
217130
- separator = join29;
217298
+ separator = join31;
217131
217299
  }
217132
217300
  if (spacer !== "" && separator.length > 1) {
217133
217301
  res = `
@@ -217168,7 +217336,7 @@ ${originalIndentation}`;
217168
217336
  }
217169
217337
  const originalIndentation = indentation;
217170
217338
  let res = "";
217171
- let join29 = ",";
217339
+ let join31 = ",";
217172
217340
  if (Array.isArray(value)) {
217173
217341
  if (value.length === 0) {
217174
217342
  return "[]";
@@ -217181,7 +217349,7 @@ ${originalIndentation}`;
217181
217349
  indentation += spacer;
217182
217350
  res += `
217183
217351
  ${indentation}`;
217184
- join29 = `,
217352
+ join31 = `,
217185
217353
  ${indentation}`;
217186
217354
  }
217187
217355
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -217189,13 +217357,13 @@ ${indentation}`;
217189
217357
  for (; i < maximumValuesToStringify - 1; i++) {
217190
217358
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
217191
217359
  res += tmp2 !== void 0 ? tmp2 : "null";
217192
- res += join29;
217360
+ res += join31;
217193
217361
  }
217194
217362
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
217195
217363
  res += tmp !== void 0 ? tmp : "null";
217196
217364
  if (value.length - 1 > maximumBreadth) {
217197
217365
  const removedKeys = value.length - maximumBreadth - 1;
217198
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
217366
+ res += `${join31}"... ${getItemCount(removedKeys)} not stringified"`;
217199
217367
  }
217200
217368
  if (spacer !== "") {
217201
217369
  res += `
@@ -217208,7 +217376,7 @@ ${originalIndentation}`;
217208
217376
  let whitespace = "";
217209
217377
  if (spacer !== "") {
217210
217378
  indentation += spacer;
217211
- join29 = `,
217379
+ join31 = `,
217212
217380
  ${indentation}`;
217213
217381
  whitespace = " ";
217214
217382
  }
@@ -217217,7 +217385,7 @@ ${indentation}`;
217217
217385
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
217218
217386
  if (tmp !== void 0) {
217219
217387
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
217220
- separator = join29;
217388
+ separator = join31;
217221
217389
  }
217222
217390
  }
217223
217391
  if (spacer !== "" && separator.length > 1) {
@@ -217275,20 +217443,20 @@ ${originalIndentation}`;
217275
217443
  indentation += spacer;
217276
217444
  let res2 = `
217277
217445
  ${indentation}`;
217278
- const join30 = `,
217446
+ const join32 = `,
217279
217447
  ${indentation}`;
217280
217448
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
217281
217449
  let i = 0;
217282
217450
  for (; i < maximumValuesToStringify - 1; i++) {
217283
217451
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
217284
217452
  res2 += tmp2 !== void 0 ? tmp2 : "null";
217285
- res2 += join30;
217453
+ res2 += join32;
217286
217454
  }
217287
217455
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
217288
217456
  res2 += tmp !== void 0 ? tmp : "null";
217289
217457
  if (value.length - 1 > maximumBreadth) {
217290
217458
  const removedKeys = value.length - maximumBreadth - 1;
217291
- res2 += `${join30}"... ${getItemCount(removedKeys)} not stringified"`;
217459
+ res2 += `${join32}"... ${getItemCount(removedKeys)} not stringified"`;
217292
217460
  }
217293
217461
  res2 += `
217294
217462
  ${originalIndentation}`;
@@ -217304,16 +217472,16 @@ ${originalIndentation}`;
217304
217472
  return '"[Object]"';
217305
217473
  }
217306
217474
  indentation += spacer;
217307
- const join29 = `,
217475
+ const join31 = `,
217308
217476
  ${indentation}`;
217309
217477
  let res = "";
217310
217478
  let separator = "";
217311
217479
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
217312
217480
  if (isTypedArrayWithEntries(value)) {
217313
- res += stringifyTypedArray(value, join29, maximumBreadth);
217481
+ res += stringifyTypedArray(value, join31, maximumBreadth);
217314
217482
  keys = keys.slice(value.length);
217315
217483
  maximumPropertiesToStringify -= value.length;
217316
- separator = join29;
217484
+ separator = join31;
217317
217485
  }
217318
217486
  if (deterministic) {
217319
217487
  keys = sort(keys, comparator);
@@ -217324,13 +217492,13 @@ ${indentation}`;
217324
217492
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
217325
217493
  if (tmp !== void 0) {
217326
217494
  res += `${separator}${strEscape(key2)}: ${tmp}`;
217327
- separator = join29;
217495
+ separator = join31;
217328
217496
  }
217329
217497
  }
217330
217498
  if (keyLength > maximumBreadth) {
217331
217499
  const removedKeys = keyLength - maximumBreadth;
217332
217500
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
217333
- separator = join29;
217501
+ separator = join31;
217334
217502
  }
217335
217503
  if (separator !== "") {
217336
217504
  res = `
@@ -274010,7 +274178,7 @@ var require_send = __commonJS({
274010
274178
  var { parseTokenList } = require_parseTokenList();
274011
274179
  var { createHttpError } = require_createHttpError();
274012
274180
  var extname3 = path56.extname;
274013
- var join29 = path56.join;
274181
+ var join31 = path56.join;
274014
274182
  var normalize5 = path56.normalize;
274015
274183
  var resolve18 = path56.resolve;
274016
274184
  var sep3 = path56.sep;
@@ -274097,7 +274265,7 @@ var require_send = __commonJS({
274097
274265
  return { statusCode: 403 };
274098
274266
  }
274099
274267
  parts = path57.split(sep3);
274100
- path57 = normalize5(join29(root, path57));
274268
+ path57 = normalize5(join31(root, path57));
274101
274269
  } else {
274102
274270
  if (UP_PATH_REGEXP.test(path57)) {
274103
274271
  debug2('malicious path "%s"', path57);
@@ -274380,7 +274548,7 @@ var require_send = __commonJS({
274380
274548
  let err;
274381
274549
  for (let i = 0; i < options.index.length; i++) {
274382
274550
  const index = options.index[i];
274383
- const p = join29(path57, index);
274551
+ const p = join31(path57, index);
274384
274552
  const { error, stat: stat4 } = await tryStat(p);
274385
274553
  if (error) {
274386
274554
  err = error;
@@ -276856,7 +277024,7 @@ var init_esm15 = __esm({
276856
277024
  import { get_encoding } from "tiktoken";
276857
277025
  import { readFile as readFile5, access as access3 } from "fs/promises";
276858
277026
  import { opendir, stat as stat3 } from "fs/promises";
276859
- import { join as join18 } from "path";
277027
+ import { join as join19 } from "path";
276860
277028
  var enc, calculateTokenCount, readConfigFile2, getProjectSpecificRouter, getUseModel, router, sessionProjectCache, searchProjectBySession;
276861
277029
  var init_router = __esm({
276862
277030
  "packages/router/dist/src/utils/router.js"() {
@@ -276924,8 +277092,8 @@ var init_router = __esm({
276924
277092
  if (req.sessionId) {
276925
277093
  const project = await searchProjectBySession(req.sessionId);
276926
277094
  if (project) {
276927
- const projectConfigPath = join18(HOME_DIR, project, "config.json");
276928
- const sessionConfigPath = join18(HOME_DIR, project, `${req.sessionId}.json`);
277095
+ const projectConfigPath = join19(HOME_DIR, project, "config.json");
277096
+ const sessionConfigPath = join19(HOME_DIR, project, `${req.sessionId}.json`);
276929
277097
  const sessionConfig = await readConfigFile2(sessionConfigPath);
276930
277098
  if (sessionConfig && sessionConfig.Router) {
276931
277099
  return sessionConfig.Router;
@@ -277032,7 +277200,7 @@ var init_router = __esm({
277032
277200
  }
277033
277201
  }
277034
277202
  const checkPromises = folderNames.map(async (folderName) => {
277035
- const sessionFilePath = join18(CLAUDE_PROJECTS_DIR, folderName, `${sessionId2}.jsonl`);
277203
+ const sessionFilePath = join19(CLAUDE_PROJECTS_DIR, folderName, `${sessionId2}.jsonl`);
277036
277204
  try {
277037
277205
  const fileStat = await stat3(sessionFilePath);
277038
277206
  return fileStat.isFile() ? folderName : null;
@@ -277102,9 +277270,9 @@ var require_package7 = __commonJS({
277102
277270
  });
277103
277271
 
277104
277272
  // packages/router/dist/src/server.js
277105
- import { join as join19, dirname as dirname7 } from "path";
277273
+ import { join as join20, dirname as dirname7 } from "path";
277106
277274
  import { fileURLToPath as fileURLToPath7 } from "url";
277107
- import { readdirSync as readdirSync2, statSync as statSync2, readFileSync as readFileSync12, writeFileSync as writeFileSync5, existsSync as existsSync14 } from "fs";
277275
+ import { readdirSync as readdirSync2, statSync as statSync2, readFileSync as readFileSync13, writeFileSync as writeFileSync5, existsSync as existsSync15 } from "fs";
277108
277276
  var import_static, __filename2, __dirname4, createServer4;
277109
277277
  var init_server3 = __esm({
277110
277278
  "packages/router/dist/src/server.js"() {
@@ -277156,7 +277324,7 @@ var init_server3 = __esm({
277156
277324
  });
277157
277325
  try {
277158
277326
  server.app.register(import_static.default, {
277159
- root: join19(__dirname4, "..", "dist", "ui"),
277327
+ root: join20(__dirname4, "..", "dist", "ui"),
277160
277328
  prefix: "/ui/",
277161
277329
  maxAge: "1h"
277162
277330
  });
@@ -277196,13 +277364,13 @@ var init_server3 = __esm({
277196
277364
  });
277197
277365
  server.app.get("/api/logs/files", async (req, reply) => {
277198
277366
  try {
277199
- const logDir = join19(HOME_DIR, "logs");
277367
+ const logDir = join20(HOME_DIR, "logs");
277200
277368
  const logFiles = [];
277201
- if (existsSync14(logDir)) {
277369
+ if (existsSync15(logDir)) {
277202
277370
  const files = readdirSync2(logDir);
277203
277371
  for (const file of files) {
277204
277372
  if (file.endsWith(".log")) {
277205
- const filePath = join19(logDir, file);
277373
+ const filePath = join20(logDir, file);
277206
277374
  const stats = statSync2(filePath);
277207
277375
  logFiles.push({
277208
277376
  name: file,
@@ -277227,12 +277395,12 @@ var init_server3 = __esm({
277227
277395
  if (filePath) {
277228
277396
  logFilePath = filePath;
277229
277397
  } else {
277230
- logFilePath = join19(HOME_DIR, "logs", "app.log");
277398
+ logFilePath = join20(HOME_DIR, "logs", "app.log");
277231
277399
  }
277232
- if (!existsSync14(logFilePath)) {
277400
+ if (!existsSync15(logFilePath)) {
277233
277401
  return [];
277234
277402
  }
277235
- const logContent = readFileSync12(logFilePath, "utf8");
277403
+ const logContent = readFileSync13(logFilePath, "utf8");
277236
277404
  const logLines = logContent.split("\n").filter((line) => line.trim());
277237
277405
  return logLines;
277238
277406
  } catch (error) {
@@ -277247,9 +277415,9 @@ var init_server3 = __esm({
277247
277415
  if (filePath) {
277248
277416
  logFilePath = filePath;
277249
277417
  } else {
277250
- logFilePath = join19(HOME_DIR, "logs", "app.log");
277418
+ logFilePath = join20(HOME_DIR, "logs", "app.log");
277251
277419
  }
277252
- if (existsSync14(logFilePath)) {
277420
+ if (existsSync15(logFilePath)) {
277253
277421
  writeFileSync5(logFilePath, "", "utf8");
277254
277422
  }
277255
277423
  return { success: true, message: "Logs cleared successfully" };
@@ -278269,7 +278437,7 @@ var require_dist10 = __commonJS({
278269
278437
  });
278270
278438
 
278271
278439
  // packages/router/dist/src/utils/processCheck.js
278272
- import { existsSync as existsSync15, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
278440
+ import { existsSync as existsSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
278273
278441
  import { execSync as execSync2 } from "child_process";
278274
278442
  async function isProcessRunning(pid) {
278275
278443
  try {
@@ -278281,33 +278449,33 @@ async function isProcessRunning(pid) {
278281
278449
  }
278282
278450
  function incrementReferenceCount() {
278283
278451
  let count = 0;
278284
- if (existsSync15(REFERENCE_COUNT_FILE)) {
278285
- count = parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278452
+ if (existsSync16(REFERENCE_COUNT_FILE)) {
278453
+ count = parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278286
278454
  }
278287
278455
  count++;
278288
278456
  writeFileSync6(REFERENCE_COUNT_FILE, count.toString());
278289
278457
  }
278290
278458
  function decrementReferenceCount() {
278291
278459
  let count = 0;
278292
- if (existsSync15(REFERENCE_COUNT_FILE)) {
278293
- count = parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278460
+ if (existsSync16(REFERENCE_COUNT_FILE)) {
278461
+ count = parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278294
278462
  }
278295
278463
  count = Math.max(0, count - 1);
278296
278464
  writeFileSync6(REFERENCE_COUNT_FILE, count.toString());
278297
278465
  }
278298
278466
  function getReferenceCount() {
278299
- if (!existsSync15(REFERENCE_COUNT_FILE)) {
278467
+ if (!existsSync16(REFERENCE_COUNT_FILE)) {
278300
278468
  return 0;
278301
278469
  }
278302
- return parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278470
+ return parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278303
278471
  }
278304
278472
  function isServiceRunning() {
278305
- if (!existsSync15(PID_FILE)) {
278473
+ if (!existsSync16(PID_FILE)) {
278306
278474
  return false;
278307
278475
  }
278308
278476
  let pid;
278309
278477
  try {
278310
- const pidStr = readFileSync13(PID_FILE, "utf-8");
278478
+ const pidStr = readFileSync14(PID_FILE, "utf-8");
278311
278479
  pid = parseInt(pidStr, 10);
278312
278480
  if (isNaN(pid)) {
278313
278481
  cleanupPidFile();
@@ -278339,7 +278507,7 @@ function savePid(pid) {
278339
278507
  writeFileSync6(PID_FILE, pid.toString());
278340
278508
  }
278341
278509
  function cleanupPidFile() {
278342
- if (existsSync15(PID_FILE)) {
278510
+ if (existsSync16(PID_FILE)) {
278343
278511
  try {
278344
278512
  const fs54 = __require("fs");
278345
278513
  fs54.unlinkSync(PID_FILE);
@@ -278348,11 +278516,11 @@ function cleanupPidFile() {
278348
278516
  }
278349
278517
  }
278350
278518
  function getServicePid() {
278351
- if (!existsSync15(PID_FILE)) {
278519
+ if (!existsSync16(PID_FILE)) {
278352
278520
  return null;
278353
278521
  }
278354
278522
  try {
278355
- const pid = parseInt(readFileSync13(PID_FILE, "utf-8"));
278523
+ const pid = parseInt(readFileSync14(PID_FILE, "utf-8"));
278356
278524
  return isNaN(pid) ? null : pid;
278357
278525
  } catch (e2) {
278358
278526
  return null;
@@ -278793,16 +278961,16 @@ var init_agents = __esm({
278793
278961
  });
278794
278962
 
278795
278963
  // packages/router/dist/src/index.js
278796
- import { existsSync as existsSync16 } from "fs";
278964
+ import { existsSync as existsSync17 } from "fs";
278797
278965
  import { writeFile as writeFile3 } from "fs/promises";
278798
- import { homedir as homedir13 } from "os";
278799
- import { join as join20 } from "path";
278966
+ import { homedir as homedir14 } from "os";
278967
+ import { join as join21 } from "path";
278800
278968
  import { createRequire } from "module";
278801
278969
  import { EventEmitter as EventEmitter6 } from "node:events";
278802
278970
  async function initializeClaudeConfig() {
278803
- const homeDir2 = homedir13();
278804
- const configPath = join20(homeDir2, ".claude.json");
278805
- if (!existsSync16(configPath)) {
278971
+ const homeDir2 = homedir14();
278972
+ const configPath = join21(homeDir2, ".claude.json");
278973
+ if (!existsSync17(configPath)) {
278806
278974
  const userID = Array.from({ length: 64 }, () => Math.random().toString(16)[2]).join("");
278807
278975
  const configContent = {
278808
278976
  numStartups: 184,
@@ -278884,7 +279052,7 @@ async function run(options = {}) {
278884
279052
  providers: config2.Providers || config2.providers,
278885
279053
  HOST,
278886
279054
  PORT: servicePort,
278887
- LOG_FILE: join20(homedir13(), ".mpdai", "mpdai-router.log")
279055
+ LOG_FILE: join21(homedir14(), ".mpdai", "mpdai-router.log")
278888
279056
  },
278889
279057
  logger: loggerConfig
278890
279058
  });
@@ -279134,10 +279302,10 @@ var init_src2 = __esm({
279134
279302
  });
279135
279303
 
279136
279304
  // packages/router/dist/src/utils/close.js
279137
- import { readFileSync as readFileSync14 } from "fs";
279138
- import { join as join21 } from "path";
279305
+ import { readFileSync as readFileSync15 } from "fs";
279306
+ import { join as join22 } from "path";
279139
279307
  async function closeService() {
279140
- const PID_FILE2 = join21(HOME_DIR, ".mpdai-router.pid");
279308
+ const PID_FILE2 = join22(HOME_DIR, ".mpdai-router.pid");
279141
279309
  const isRunning = await isServiceRunning();
279142
279310
  if (!isRunning) {
279143
279311
  console.log("No service is currently running.");
@@ -279147,7 +279315,7 @@ async function closeService() {
279147
279315
  return;
279148
279316
  }
279149
279317
  try {
279150
- const pid = parseInt(readFileSync14(PID_FILE2, "utf-8"));
279318
+ const pid = parseInt(readFileSync15(PID_FILE2, "utf-8"));
279151
279319
  process.kill(pid);
279152
279320
  cleanupPidFile();
279153
279321
  console.log("mpdai router service has been successfully stopped.");
@@ -291125,7 +291293,7 @@ var require_require_directory = __commonJS({
291125
291293
  "node_modules/require-directory/index.js"(exports2, module2) {
291126
291294
  "use strict";
291127
291295
  var fs54 = __require("fs");
291128
- var join29 = __require("path").join;
291296
+ var join31 = __require("path").join;
291129
291297
  var resolve18 = __require("path").resolve;
291130
291298
  var dirname12 = __require("path").dirname;
291131
291299
  var defaultOptions2 = {
@@ -291162,7 +291330,7 @@ var require_require_directory = __commonJS({
291162
291330
  }
291163
291331
  path56 = !path56 ? dirname12(m.filename) : resolve18(dirname12(m.filename), path56);
291164
291332
  fs54.readdirSync(path56).forEach(function(filename) {
291165
- var joined = join29(path56, filename), files, key, obj;
291333
+ var joined = join31(path56, filename), files, key, obj;
291166
291334
  if (fs54.statSync(joined).isDirectory() && options.recurse) {
291167
291335
  files = requireDirectory(m, joined, options);
291168
291336
  if (Object.keys(files).length) {
@@ -294710,7 +294878,7 @@ var require_deep_extend = __commonJS({
294710
294878
  var require_rc = __commonJS({
294711
294879
  "node_modules/rc/index.js"(exports2, module2) {
294712
294880
  var cc2 = require_utils14();
294713
- var join29 = __require("path").join;
294881
+ var join31 = __require("path").join;
294714
294882
  var deepExtend = require_deep_extend();
294715
294883
  var etc = "/etc";
294716
294884
  var win = process.platform === "win32";
@@ -294735,15 +294903,15 @@ var require_rc = __commonJS({
294735
294903
  }
294736
294904
  if (!win)
294737
294905
  [
294738
- join29(etc, name2, "config"),
294739
- join29(etc, name2 + "rc")
294906
+ join31(etc, name2, "config"),
294907
+ join31(etc, name2 + "rc")
294740
294908
  ].forEach(addConfigFile);
294741
294909
  if (home)
294742
294910
  [
294743
- join29(home, ".config", name2, "config"),
294744
- join29(home, ".config", name2),
294745
- join29(home, "." + name2, "config"),
294746
- join29(home, "." + name2 + "rc")
294911
+ join31(home, ".config", name2, "config"),
294912
+ join31(home, ".config", name2),
294913
+ join31(home, "." + name2, "config"),
294914
+ join31(home, "." + name2 + "rc")
294747
294915
  ].forEach(addConfigFile);
294748
294916
  addConfigFile(cc2.find("." + name2 + "rc"));
294749
294917
  if (env6.config) addConfigFile(env6.config);
@@ -311178,9 +311346,9 @@ var clearCommand = {
311178
311346
  };
311179
311347
 
311180
311348
  // packages/cli/src/ui/commands/logoutCommand.ts
311181
- import { existsSync as existsSync9, unlinkSync } from "fs";
311182
- import { join as join14 } from "path";
311183
- import { homedir as homedir9 } from "os";
311349
+ import { existsSync as existsSync10, unlinkSync } from "fs";
311350
+ import { join as join15 } from "path";
311351
+ import { homedir as homedir10 } from "os";
311184
311352
  var logoutCommand = {
311185
311353
  name: "logout",
311186
311354
  description: "logout and clear user credentials and settings, then exit",
@@ -311188,8 +311356,8 @@ var logoutCommand = {
311188
311356
  const now = /* @__PURE__ */ new Date();
311189
311357
  const { sessionStartTime } = context2.session.stats;
311190
311358
  const wallDuration = now.getTime() - sessionStartTime.getTime();
311191
- const userJsonPath = join14(homedir9(), ".mpdai", "user.json");
311192
- if (existsSync9(userJsonPath)) {
311359
+ const userJsonPath = join15(homedir10(), ".mpdai", "user.json");
311360
+ if (existsSync10(userJsonPath)) {
311193
311361
  try {
311194
311362
  unlinkSync(userJsonPath);
311195
311363
  context2.ui.addItem({
@@ -311203,8 +311371,8 @@ var logoutCommand = {
311203
311371
  }, now.getTime());
311204
311372
  }
311205
311373
  }
311206
- const keysJsonPath = join14(homedir9(), ".mpdai", "keys.json");
311207
- if (existsSync9(keysJsonPath)) {
311374
+ const keysJsonPath = join15(homedir10(), ".mpdai", "keys.json");
311375
+ if (existsSync10(keysJsonPath)) {
311208
311376
  try {
311209
311377
  unlinkSync(keysJsonPath);
311210
311378
  context2.ui.addItem({
@@ -311218,8 +311386,8 @@ var logoutCommand = {
311218
311386
  }, now.getTime());
311219
311387
  }
311220
311388
  }
311221
- const userSettingsPath = join14(homedir9(), ".mpdai", "settings.json");
311222
- if (existsSync9(userSettingsPath)) {
311389
+ const userSettingsPath = join15(homedir10(), ".mpdai", "settings.json");
311390
+ if (existsSync10(userSettingsPath)) {
311223
311391
  try {
311224
311392
  unlinkSync(userSettingsPath);
311225
311393
  context2.ui.addItem({
@@ -311329,7 +311497,7 @@ init_dist4();
311329
311497
  init_dist4();
311330
311498
  init_dist4();
311331
311499
  init_dist4();
311332
- import { readFileSync as readFileSync16, existsSync as existsSync18, unlinkSync as unlinkSync2 } from "fs";
311500
+ import { readFileSync as readFileSync17, existsSync as existsSync19, unlinkSync as unlinkSync2 } from "fs";
311333
311501
  async function waitForService(timeout2 = 1e4, initialDelay = 1e3) {
311334
311502
  await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
311335
311503
  const startTime = Date.now();
@@ -328672,9 +328840,9 @@ init_dist3();
328672
328840
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
328673
328841
  import * as fs39 from "fs";
328674
328842
  import * as path43 from "path";
328675
- import { homedir as homedir14 } from "os";
328843
+ import { homedir as homedir15 } from "os";
328676
328844
  var SETTINGS_DIRECTORY_NAME = ".mpdai";
328677
- var USER_SETTINGS_DIR = path43.join(homedir14(), SETTINGS_DIRECTORY_NAME);
328845
+ var USER_SETTINGS_DIR = path43.join(homedir15(), SETTINGS_DIRECTORY_NAME);
328678
328846
  var USER_SETTINGS_PATH = path43.join(USER_SETTINGS_DIR, "settings.json");
328679
328847
  var LoadedSettings = class {
328680
328848
  constructor(user, workspace, errors) {
@@ -328757,11 +328925,11 @@ function findEnvFile(startDir) {
328757
328925
  }
328758
328926
  const parentDir = path43.dirname(currentDir);
328759
328927
  if (parentDir === currentDir || !parentDir) {
328760
- const homeGeminiEnvPath = path43.join(homedir14(), MPDAI_CONFIG_DIR, ".env");
328928
+ const homeGeminiEnvPath = path43.join(homedir15(), MPDAI_CONFIG_DIR, ".env");
328761
328929
  if (fs39.existsSync(homeGeminiEnvPath)) {
328762
328930
  return homeGeminiEnvPath;
328763
328931
  }
328764
- const homeEnvPath = path43.join(homedir14(), ".env");
328932
+ const homeEnvPath = path43.join(homedir15(), ".env");
328765
328933
  if (fs39.existsSync(homeEnvPath)) {
328766
328934
  return homeEnvPath;
328767
328935
  }
@@ -330547,7 +330715,7 @@ function stripQuotes(val) {
330547
330715
  }
330548
330716
 
330549
330717
  // node_modules/yargs-parser/build/lib/index.js
330550
- import { readFileSync as readFileSync18 } from "fs";
330718
+ import { readFileSync as readFileSync19 } from "fs";
330551
330719
  var _a5;
330552
330720
  var _b;
330553
330721
  var _c;
@@ -330574,7 +330742,7 @@ var parser4 = new YargsParser({
330574
330742
  if (typeof __require !== "undefined") {
330575
330743
  return __require(path56);
330576
330744
  } else if (path56.match(/\.json$/)) {
330577
- return JSON.parse(readFileSync18(path56, "utf8"));
330745
+ return JSON.parse(readFileSync19(path56, "utf8"));
330578
330746
  } else {
330579
330747
  throw Error("only .json config files are supported in ESM");
330580
330748
  }
@@ -330902,17 +331070,17 @@ function sync_default(start, callback) {
330902
331070
 
330903
331071
  // node_modules/yargs/lib/platform-shims/esm.mjs
330904
331072
  import { inspect } from "util";
330905
- import { readFileSync as readFileSync20 } from "fs";
331073
+ import { readFileSync as readFileSync21 } from "fs";
330906
331074
  import { fileURLToPath as fileURLToPath8 } from "url";
330907
331075
  import { basename as basename4, dirname as dirname11, extname as extname2, relative as relative6, resolve as resolve17 } from "path";
330908
331076
 
330909
331077
  // node_modules/y18n/build/lib/platform-shims/node.js
330910
- import { readFileSync as readFileSync19, statSync as statSync4, writeFile as writeFile5 } from "fs";
331078
+ import { readFileSync as readFileSync20, statSync as statSync4, writeFile as writeFile5 } from "fs";
330911
331079
  import { format as format2 } from "util";
330912
331080
  import { resolve as resolve16 } from "path";
330913
331081
  var node_default = {
330914
331082
  fs: {
330915
- readFileSync: readFileSync19,
331083
+ readFileSync: readFileSync20,
330916
331084
  writeFile: writeFile5
330917
331085
  },
330918
331086
  format: format2,
@@ -331136,7 +331304,7 @@ var esm_default7 = {
331136
331304
  nextTick: process.nextTick,
331137
331305
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
331138
331306
  },
331139
- readFileSync: readFileSync20,
331307
+ readFileSync: readFileSync21,
331140
331308
  require: () => {
331141
331309
  throw new YError(REQUIRE_ERROR);
331142
331310
  },
@@ -332358,7 +332526,7 @@ init_dist3();
332358
332526
  init_langfuseClient();
332359
332527
  import { execSync as execSync4 } from "child_process";
332360
332528
  import { promises as fs41 } from "fs";
332361
- import { join as join26 } from "path";
332529
+ import { join as join27 } from "path";
332362
332530
  var DataCollector = class {
332363
332531
  langfuseClient;
332364
332532
  constructor() {
@@ -332468,7 +332636,7 @@ var DataCollector = class {
332468
332636
  // 提取元数据
332469
332637
  extractMetadata(data) {
332470
332638
  return {
332471
- cli_version: "0.1.51",
332639
+ cli_version: "0.1.52",
332472
332640
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
332473
332641
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
332474
332642
  project_path: data.projectPath,
@@ -332685,7 +332853,7 @@ var DataCollector = class {
332685
332853
  const walkDir = async (dir) => {
332686
332854
  const entries = await fs41.readdir(dir, { withFileTypes: true });
332687
332855
  for (const entry of entries) {
332688
- const fullPath = join26(dir, entry.name);
332856
+ const fullPath = join27(dir, entry.name);
332689
332857
  if (entry.isDirectory()) {
332690
332858
  dirCount++;
332691
332859
  await walkDir(fullPath);
@@ -339033,6 +339201,8 @@ async function readStdin() {
339033
339201
  import { basename as basename5 } from "node:path";
339034
339202
  import v8 from "node:v8";
339035
339203
  import os23 from "node:os";
339204
+ import { join as join30 } from "node:path";
339205
+ import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync11 } from "node:fs";
339036
339206
  import { spawn as spawn11 } from "node:child_process";
339037
339207
 
339038
339208
  // packages/cli/src/utils/sandbox.ts
@@ -339828,10 +339998,10 @@ async function runNonInteractive(config2, input) {
339828
339998
  // packages/cli/src/utils/cleanup.ts
339829
339999
  init_dist3();
339830
340000
  import { promises as fs52 } from "fs";
339831
- import { join as join27 } from "path";
340001
+ import { join as join28 } from "path";
339832
340002
  async function cleanupCheckpoints() {
339833
340003
  const tempDir = getProjectTempDir(process.cwd());
339834
- const checkpointsDir = join27(tempDir, "checkpoints");
340004
+ const checkpointsDir = join28(tempDir, "checkpoints");
339835
340005
  try {
339836
340006
  await fs52.rm(checkpointsDir, { recursive: true, force: true });
339837
340007
  } catch {
@@ -339846,9 +340016,9 @@ init_EnvConfigManager();
339846
340016
  init_mpdaiConfig();
339847
340017
  import * as fs53 from "fs";
339848
340018
  import * as path55 from "path";
339849
- import { homedir as homedir17 } from "os";
340019
+ import { homedir as homedir18 } from "os";
339850
340020
  function initializeLangfuseConfig() {
339851
- const langfuseDir = path55.join(homedir17(), ".mpdai");
340021
+ const langfuseDir = path55.join(homedir18(), ".mpdai");
339852
340022
  const settingsFile = path55.join(langfuseDir, "settings.conf");
339853
340023
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
339854
340024
  try {
@@ -339929,7 +340099,7 @@ init_dist4();
339929
340099
  init_dist4();
339930
340100
  init_dist4();
339931
340101
  init_dist4();
339932
- import { readFileSync as readFileSync22, existsSync as existsSync23, unlinkSync as unlinkSync3 } from "fs";
340102
+ import { readFileSync as readFileSync23, existsSync as existsSync24, unlinkSync as unlinkSync3 } from "fs";
339933
340103
  async function waitForService2(timeout2 = 1e4, initialDelay = 1e3) {
339934
340104
  await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
339935
340105
  const startTime = Date.now();
@@ -339955,10 +340125,10 @@ async function handleRouterCommand(command, args) {
339955
340125
  return true;
339956
340126
  case "stop":
339957
340127
  try {
339958
- const pid = parseInt(readFileSync22(PID_FILE, "utf-8"));
340128
+ const pid = parseInt(readFileSync23(PID_FILE, "utf-8"));
339959
340129
  process.kill(pid);
339960
340130
  cleanupPidFile();
339961
- if (existsSync23(REFERENCE_COUNT_FILE)) {
340131
+ if (existsSync24(REFERENCE_COUNT_FILE)) {
339962
340132
  try {
339963
340133
  unlinkSync3(REFERENCE_COUNT_FILE);
339964
340134
  } catch (e2) {
@@ -339972,10 +340142,10 @@ async function handleRouterCommand(command, args) {
339972
340142
  return true;
339973
340143
  case "restart":
339974
340144
  try {
339975
- const pid = parseInt(readFileSync22(PID_FILE, "utf-8"));
340145
+ const pid = parseInt(readFileSync23(PID_FILE, "utf-8"));
339976
340146
  process.kill(pid);
339977
340147
  cleanupPidFile();
339978
- if (existsSync23(REFERENCE_COUNT_FILE)) {
340148
+ if (existsSync24(REFERENCE_COUNT_FILE)) {
339979
340149
  try {
339980
340150
  unlinkSync3(REFERENCE_COUNT_FILE);
339981
340151
  } catch (e2) {
@@ -340149,6 +340319,31 @@ async function main() {
340149
340319
  console.log(version3);
340150
340320
  return;
340151
340321
  }
340322
+ if (args.length > 0 && args[0] === "version") {
340323
+ const { getCliVersion: getCliVersion2 } = await Promise.resolve().then(() => (init_version5(), version_exports));
340324
+ const version3 = await getCliVersion2();
340325
+ console.log(version3);
340326
+ return;
340327
+ }
340328
+ if (args.length > 0 && args[0] === "publish") {
340329
+ const { getPackageJson: getPackageJson2, getPackageRoot: getPackageRoot2 } = await Promise.resolve().then(() => (init_package(), package_exports));
340330
+ const pkg2 = await getPackageJson2();
340331
+ const root = await getPackageRoot2();
340332
+ const releaseScript = pkg2?.scripts?.release;
340333
+ if (releaseScript && root) {
340334
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
340335
+ const child = spawn11(npm, ["run", "release"], {
340336
+ cwd: root,
340337
+ stdio: "inherit",
340338
+ shell: true
340339
+ });
340340
+ child.on("close", (code) => process.exit(code ?? 0));
340341
+ return;
340342
+ }
340343
+ console.error("Publish is only available when run from the FRANK CLI project root.");
340344
+ console.error("In the repo, run: npm run release");
340345
+ process.exit(1);
340346
+ }
340152
340347
  const commandName = basename5(process.argv[1]);
340153
340348
  if (commandName === "frankcode") {
340154
340349
  const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
@@ -340184,6 +340379,74 @@ async function main() {
340184
340379
  return;
340185
340380
  }
340186
340381
  }
340382
+ if (args.length >= 1 && args[0] === "set") {
340383
+ if (args.length >= 4 && args[2] === "token") {
340384
+ const service = args[1];
340385
+ const token2 = args[3]?.trim();
340386
+ if (service === "confluence" && token2) {
340387
+ const dir = join30(os23.homedir(), ".mpdai");
340388
+ try {
340389
+ mkdirSync7(dir, { recursive: true });
340390
+ writeFileSync11(join30(dir, "confluence.key"), token2, "utf-8");
340391
+ console.log("Confluence token saved to ~/.mpdai/confluence.key");
340392
+ } catch (err) {
340393
+ console.error("Failed to save Confluence token:", err);
340394
+ process.exit(1);
340395
+ }
340396
+ return;
340397
+ }
340398
+ if (service === "jira" && token2) {
340399
+ const dir = join30(os23.homedir(), ".mpdai");
340400
+ try {
340401
+ mkdirSync7(dir, { recursive: true });
340402
+ writeFileSync11(join30(dir, "jira.key"), token2, "utf-8");
340403
+ console.log("Jira token saved to ~/.mpdai/jira.key");
340404
+ } catch (err) {
340405
+ console.error("Failed to save Jira token:", err);
340406
+ process.exit(1);
340407
+ }
340408
+ return;
340409
+ }
340410
+ }
340411
+ if (args[1] === "confluence" || args[1] === "jira") {
340412
+ console.error(`Usage: frankcli set ${args[1] || "<confluence|jira>"} token <Personal Access Token>`);
340413
+ process.exit(1);
340414
+ }
340415
+ }
340416
+ if (args.length > 0 && args[0] === "confluence") {
340417
+ if (args.length >= 3 && args[1] === "get") {
340418
+ const confluenceUrl = args[2];
340419
+ const { runConfluenceGetPage: runConfluenceGetPage2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports));
340420
+ const result = await runConfluenceGetPage2(confluenceUrl);
340421
+ if (result.success) {
340422
+ console.log(result.content);
340423
+ } else {
340424
+ console.error(result.error);
340425
+ process.exit(1);
340426
+ }
340427
+ return;
340428
+ }
340429
+ console.error("Usage: frankcli confluence get <confluence_url>");
340430
+ console.error("Example: frankcli confluence get https://confluence.rakuten-it.com/confluence/x/TDae8Q");
340431
+ process.exit(1);
340432
+ }
340433
+ if (args.length > 0 && args[0] === "jira") {
340434
+ if (args.length >= 3 && args[1] === "get") {
340435
+ const issueKey = args[2];
340436
+ const { runJiraGetIssue: runJiraGetIssue2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports));
340437
+ const result = await runJiraGetIssue2(issueKey);
340438
+ if (result.success) {
340439
+ console.log(result.content);
340440
+ } else {
340441
+ console.error(result.error);
340442
+ process.exit(1);
340443
+ }
340444
+ return;
340445
+ }
340446
+ console.error("Usage: frankcli jira get <issue_key>");
340447
+ console.error("Example: frankcli jira get MOPS-6815");
340448
+ process.exit(1);
340449
+ }
340187
340450
  loadStartupConfig();
340188
340451
  const workspaceRoot = process.cwd();
340189
340452
  let settings = loadSettings(workspaceRoot);
@@ -340398,7 +340661,7 @@ async function performUserAuthentication() {
340398
340661
  const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
340399
340662
  const fs54 = await import("fs/promises");
340400
340663
  const path56 = await import("path");
340401
- const { homedir: homedir18 } = await import("os");
340664
+ const { homedir: homedir19 } = await import("os");
340402
340665
  let shouldUpdate = false;
340403
340666
  try {
340404
340667
  const configFilePath2 = await getConfigFilePath2();