@hang.yang/frankcli 0.1.51 → 0.1.53

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.53";
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,22 @@ 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 env X_ID_CONFLUENCE_ACCESS_TOKEN first, then ~/.mpdai/confluence.key, 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 envToken = process21.env.X_ID_CONFLUENCE_ACCESS_TOKEN?.trim();
193980
+ if (envToken)
193981
+ return envToken;
193982
+ const mpdaiDir = join11(homedir6(), ".mpdai");
193983
+ const keyFilePath = join11(mpdaiDir, "confluence.key");
193984
+ if (existsSync6(keyFilePath)) {
193985
+ const value = readFileSync6(keyFilePath, "utf-8").trim();
193986
+ if (value)
193987
+ return value;
193988
+ }
193989
+ const keysJsonPath = join11(mpdaiDir, "keys.json");
193930
193990
  if (!existsSync6(keysJsonPath)) {
193931
193991
  return null;
193932
193992
  }
@@ -193938,17 +193998,27 @@ var init_config2 = __esm({
193938
193998
  }
193939
193999
  return null;
193940
194000
  } catch (error) {
193941
- console.error("Failed to read Confluence token from keys.json:", error);
194001
+ console.error("Failed to read Confluence token:", error);
193942
194002
  return null;
193943
194003
  }
193944
194004
  }
193945
194005
  /**
193946
- * Get Jira Personal Access Token from keys.json
194006
+ * Get Jira Personal Access Token. Checks env X_ID_JIRA_ACCESS_TOKEN first, then ~/.mpdai/jira.key, then keys.json.
193947
194007
  * @returns The Personal Access Token or null if not found
193948
194008
  */
193949
194009
  getJiraToken() {
193950
194010
  try {
193951
- const keysJsonPath = join11(homedir6(), ".mpdai", "keys.json");
194011
+ const envToken = process21.env.X_ID_JIRA_ACCESS_TOKEN?.trim();
194012
+ if (envToken)
194013
+ return envToken;
194014
+ const mpdaiDir = join11(homedir6(), ".mpdai");
194015
+ const keyFilePath = join11(mpdaiDir, "jira.key");
194016
+ if (existsSync6(keyFilePath)) {
194017
+ const value = readFileSync6(keyFilePath, "utf-8").trim();
194018
+ if (value)
194019
+ return value;
194020
+ }
194021
+ const keysJsonPath = join11(mpdaiDir, "keys.json");
193952
194022
  if (!existsSync6(keysJsonPath)) {
193953
194023
  return null;
193954
194024
  }
@@ -193960,7 +194030,7 @@ var init_config2 = __esm({
193960
194030
  }
193961
194031
  return null;
193962
194032
  } catch (error) {
193963
- console.error("Failed to read Jira token from keys.json:", error);
194033
+ console.error("Failed to read Jira token:", error);
193964
194034
  return null;
193965
194035
  }
193966
194036
  }
@@ -194986,6 +195056,95 @@ var init_nonInteractiveToolExecutor = __esm({
194986
195056
  }
194987
195057
  });
194988
195058
 
195059
+ // packages/core/dist/src/cli-tools-runner.js
195060
+ import { join as join12 } from "node:path";
195061
+ import { homedir as homedir7 } from "node:os";
195062
+ import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
195063
+ function llmContentToString(content) {
195064
+ if (typeof content === "string")
195065
+ return content;
195066
+ if (Array.isArray(content)) {
195067
+ return content.map((p) => typeof p === "string" ? p : p?.text ?? "").join("");
195068
+ }
195069
+ return String(content);
195070
+ }
195071
+ function readTokenFromKeyFile(service) {
195072
+ const fileName = service === "confluence" ? "confluence.key" : "jira.key";
195073
+ const keyFilePath = join12(homedir7(), ".mpdai", fileName);
195074
+ if (!existsSync7(keyFilePath))
195075
+ return null;
195076
+ try {
195077
+ const value = readFileSync7(keyFilePath, "utf-8").trim();
195078
+ return value || null;
195079
+ } catch {
195080
+ return null;
195081
+ }
195082
+ }
195083
+ function readTokensFromKeysJson() {
195084
+ const keysJsonPath = join12(homedir7(), ".mpdai", "keys.json");
195085
+ if (!existsSync7(keysJsonPath)) {
195086
+ return { confluence: null, jira: null };
195087
+ }
195088
+ try {
195089
+ const content = readFileSync7(keysJsonPath, "utf-8");
195090
+ const keys = JSON.parse(content);
195091
+ const confluence = keys.find((k) => k.name === "confluence")?.value1 ?? null;
195092
+ const jira = keys.find((k) => k.name === "jira")?.value1 ?? null;
195093
+ return { confluence, jira };
195094
+ } catch {
195095
+ return { confluence: null, jira: null };
195096
+ }
195097
+ }
195098
+ function createMinimalConfigForTools() {
195099
+ const fromKeys = readTokensFromKeysJson();
195100
+ return {
195101
+ getConfluenceToken: () => process.env.X_ID_CONFLUENCE_ACCESS_TOKEN?.trim() || readTokenFromKeyFile("confluence") || fromKeys.confluence,
195102
+ getJiraToken: () => process.env.X_ID_JIRA_ACCESS_TOKEN?.trim() || readTokenFromKeyFile("jira") || fromKeys.jira
195103
+ };
195104
+ }
195105
+ async function runConfluenceGetPage(confluenceUrl) {
195106
+ const config2 = createMinimalConfigForTools();
195107
+ const token2 = config2.getConfluenceToken();
195108
+ if (!token2) {
195109
+ return {
195110
+ success: false,
195111
+ error: CONFLUENCE_TOKEN_MISSING_MESSAGE
195112
+ };
195113
+ }
195114
+ const tool = new ConfluenceGetPageTool(config2);
195115
+ const result = await tool.execute({ confluence_url: confluenceUrl.trim(), convert_to_markdown: true }, void 0);
195116
+ const contentStr = llmContentToString(result.llmContent);
195117
+ if (contentStr.startsWith("Error:")) {
195118
+ return { success: false, error: contentStr };
195119
+ }
195120
+ return { success: true, content: contentStr };
195121
+ }
195122
+ async function runJiraGetIssue(issueKey) {
195123
+ const config2 = createMinimalConfigForTools();
195124
+ const token2 = config2.getJiraToken();
195125
+ if (!token2) {
195126
+ return {
195127
+ success: false,
195128
+ error: JIRA_TOKEN_MISSING_MESSAGE
195129
+ };
195130
+ }
195131
+ const tool = new JiraGetIssueTool(config2);
195132
+ const result = await tool.execute({ issue_key: issueKey.trim() }, void 0);
195133
+ const contentStr = llmContentToString(result.llmContent);
195134
+ if (contentStr.startsWith("Error:")) {
195135
+ return { success: false, error: contentStr };
195136
+ }
195137
+ return { success: true, content: contentStr };
195138
+ }
195139
+ var init_cli_tools_runner = __esm({
195140
+ "packages/core/dist/src/cli-tools-runner.js"() {
195141
+ "use strict";
195142
+ init_confluence_get_page();
195143
+ init_jira_get_issue();
195144
+ init_config2();
195145
+ }
195146
+ });
195147
+
194989
195148
  // packages/core/dist/src/utils/session.js
194990
195149
  import { randomUUID as randomUUID2 } from "crypto";
194991
195150
  var sessionId;
@@ -195039,6 +195198,7 @@ var init_src = __esm({
195039
195198
  init_read_many_files();
195040
195199
  init_mcp_client();
195041
195200
  init_mcp_tool();
195201
+ init_cli_tools_runner();
195042
195202
  init_telemetry();
195043
195203
  init_session();
195044
195204
  }
@@ -195056,6 +195216,7 @@ __export(dist_exports, {
195056
195216
  BaseTool: () => BaseTool,
195057
195217
  CODE_ASSIST_API_VERSION: () => CODE_ASSIST_API_VERSION,
195058
195218
  CODE_ASSIST_ENDPOINT: () => CODE_ASSIST_ENDPOINT,
195219
+ CONFLUENCE_TOKEN_MISSING_MESSAGE: () => CONFLUENCE_TOKEN_MISSING_MESSAGE,
195059
195220
  CodeAssistServer: () => CodeAssistServer,
195060
195221
  Config: () => Config,
195061
195222
  CoreToolScheduler: () => CoreToolScheduler,
@@ -195080,6 +195241,7 @@ __export(dist_exports, {
195080
195241
  GlobTool: () => GlobTool,
195081
195242
  GrepTool: () => GrepTool,
195082
195243
  IneligibleTierReasonCode: () => IneligibleTierReasonCode,
195244
+ JIRA_TOKEN_MISSING_MESSAGE: () => JIRA_TOKEN_MISSING_MESSAGE,
195083
195245
  LSTool: () => LSTool,
195084
195246
  Logger: () => Logger,
195085
195247
  MCPDiscoveryState: () => MCPDiscoveryState,
@@ -195156,6 +195318,8 @@ __export(dist_exports, {
195156
195318
  openDiff: () => openDiff,
195157
195319
  partListUnionToString: () => partListUnionToString,
195158
195320
  removeMCPStatusChangeListener: () => removeMCPStatusChangeListener,
195321
+ runConfluenceGetPage: () => runConfluenceGetPage,
195322
+ runJiraGetIssue: () => runJiraGetIssue,
195159
195323
  sanitizeParameters: () => sanitizeParameters,
195160
195324
  sessionId: () => sessionId,
195161
195325
  setGeminiMdFilename: () => setGeminiMdFilename,
@@ -199244,9 +199408,9 @@ var init_lib3 = __esm({
199244
199408
  });
199245
199409
 
199246
199410
  // 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";
199411
+ import { readFileSync as readFileSync8, existsSync as existsSync8 } from "fs";
199412
+ import { join as join13 } from "path";
199413
+ import { homedir as homedir8 } from "os";
199250
199414
  var LangfuseConfigManager;
199251
199415
  var init_langfuseConfig = __esm({
199252
199416
  "packages/cli/src/telemetry/langfuseConfig.ts"() {
@@ -199267,15 +199431,15 @@ var init_langfuseConfig = __esm({
199267
199431
  return this.config;
199268
199432
  }
199269
199433
  try {
199270
- const userConfigPath = join12(homedir7(), ".mpdai", "settings.conf");
199271
- if (existsSync7(userConfigPath)) {
199272
- const configContent = readFileSync7(userConfigPath, "utf-8");
199434
+ const userConfigPath = join13(homedir8(), ".mpdai", "settings.conf");
199435
+ if (existsSync8(userConfigPath)) {
199436
+ const configContent = readFileSync8(userConfigPath, "utf-8");
199273
199437
  this.config = JSON.parse(configContent);
199274
199438
  return this.config;
199275
199439
  }
199276
- const projectConfigPath = join12(process.cwd(), ".langfuse", "settings.conf");
199277
- if (existsSync7(projectConfigPath)) {
199278
- const configContent = readFileSync7(projectConfigPath, "utf-8");
199440
+ const projectConfigPath = join13(process.cwd(), ".langfuse", "settings.conf");
199441
+ if (existsSync8(projectConfigPath)) {
199442
+ const configContent = readFileSync8(projectConfigPath, "utf-8");
199279
199443
  this.config = JSON.parse(configContent);
199280
199444
  return this.config;
199281
199445
  }
@@ -199307,9 +199471,9 @@ var init_langfuseConfig = __esm({
199307
199471
  });
199308
199472
 
199309
199473
  // 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";
199474
+ import { join as join14 } from "path";
199475
+ import { homedir as homedir9 } from "os";
199476
+ import { existsSync as existsSync9, readFileSync as readFileSync9 } from "fs";
199313
199477
  var LangfuseClient;
199314
199478
  var init_langfuseClient = __esm({
199315
199479
  "packages/cli/src/telemetry/langfuseClient.ts"() {
@@ -199411,7 +199575,7 @@ var init_langfuseClient = __esm({
199411
199575
  userId,
199412
199576
  metadata: {
199413
199577
  ...safeMetadata,
199414
- cli_version: this.safeString("0.1.51", "unknown"),
199578
+ cli_version: this.safeString("0.1.53", "unknown"),
199415
199579
  model: this.safeString(process.env.CUSTOM_LLM_MODEL_NAME, "gemini"),
199416
199580
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
199417
199581
  environment: this.safeString(this.configManager.getConfig()?.environment, "unknown")
@@ -199723,9 +199887,9 @@ var init_langfuseClient = __esm({
199723
199887
  // 获取用户ID
199724
199888
  getUserId() {
199725
199889
  try {
199726
- const userJsonPath = join13(homedir8(), ".mpdai", "user.json");
199727
- if (existsSync8(userJsonPath)) {
199728
- const content = readFileSync8(userJsonPath, "utf-8");
199890
+ const userJsonPath = join14(homedir9(), ".mpdai", "user.json");
199891
+ if (existsSync9(userJsonPath)) {
199892
+ const content = readFileSync9(userJsonPath, "utf-8");
199729
199893
  const userData = JSON.parse(content);
199730
199894
  if (userData.username) {
199731
199895
  return userData.username;
@@ -200578,7 +200742,7 @@ var init_langfuseIntegration = __esm({
200578
200742
  const metadata = {
200579
200743
  model: this.config.getModel(),
200580
200744
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200581
- cli_version: "0.1.51",
200745
+ cli_version: "0.1.53",
200582
200746
  start_time: (/* @__PURE__ */ new Date()).toISOString(),
200583
200747
  session_id: this.sessionId
200584
200748
  };
@@ -200637,7 +200801,7 @@ var init_langfuseIntegration = __esm({
200637
200801
  totalCachedTokens: sessionStats.totalCachedTokens,
200638
200802
  totalPromptTokens: sessionStats.totalPromptTokens,
200639
200803
  metadata: {
200640
- cli_version: "0.1.51",
200804
+ cli_version: "0.1.53",
200641
200805
  auth_type: this.config.getContentGeneratorConfig()?.authType,
200642
200806
  session_end_time: (/* @__PURE__ */ new Date()).toISOString()
200643
200807
  }
@@ -200709,7 +200873,7 @@ var init_langfuseIntegration = __esm({
200709
200873
  error,
200710
200874
  metadata: {
200711
200875
  session_id: this.sessionId,
200712
- cli_version: "0.1.51",
200876
+ cli_version: "0.1.53",
200713
200877
  auth_type: this.config.getContentGeneratorConfig()?.authType
200714
200878
  }
200715
200879
  });
@@ -206100,6 +206264,11 @@ var init_read_package_up = __esm({
206100
206264
  });
206101
206265
 
206102
206266
  // packages/cli/src/utils/package.ts
206267
+ var package_exports = {};
206268
+ __export(package_exports, {
206269
+ getPackageJson: () => getPackageJson,
206270
+ getPackageRoot: () => getPackageRoot
206271
+ });
206103
206272
  import { fileURLToPath as fileURLToPath6 } from "url";
206104
206273
  import path36 from "path";
206105
206274
  async function getPackageJson() {
@@ -206111,9 +206280,14 @@ async function getPackageJson() {
206111
206280
  return;
206112
206281
  }
206113
206282
  packageJson = result.packageJson;
206283
+ packageRoot = path36.dirname(result.path);
206114
206284
  return packageJson;
206115
206285
  }
206116
- var __filename, __dirname3, packageJson;
206286
+ async function getPackageRoot() {
206287
+ await getPackageJson();
206288
+ return packageRoot;
206289
+ }
206290
+ var __filename, __dirname3, packageJson, packageRoot;
206117
206291
  var init_package = __esm({
206118
206292
  "packages/cli/src/utils/package.ts"() {
206119
206293
  "use strict";
@@ -206130,7 +206304,7 @@ __export(version_exports, {
206130
206304
  });
206131
206305
  async function getCliVersion() {
206132
206306
  const pkgJson = await getPackageJson();
206133
- return "0.1.51";
206307
+ return "0.1.53";
206134
206308
  }
206135
206309
  var init_version5 = __esm({
206136
206310
  "packages/cli/src/utils/version.ts"() {
@@ -206140,9 +206314,9 @@ var init_version5 = __esm({
206140
206314
  });
206141
206315
 
206142
206316
  // 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";
206317
+ import { readFileSync as readFileSync10, existsSync as existsSync11 } from "fs";
206318
+ import { join as join16 } from "path";
206319
+ import { homedir as homedir11 } from "os";
206146
206320
  var MpdaiConfigManager;
206147
206321
  var init_mpdaiConfig = __esm({
206148
206322
  "packages/cli/src/config/mpdaiConfig.ts"() {
@@ -206163,15 +206337,15 @@ var init_mpdaiConfig = __esm({
206163
206337
  return this.config;
206164
206338
  }
206165
206339
  try {
206166
- const userConfigPath = join15(homedir10(), ".mpdai", "config.json");
206167
- if (existsSync10(userConfigPath)) {
206168
- const configContent = readFileSync9(userConfigPath, "utf-8");
206340
+ const userConfigPath = join16(homedir11(), ".mpdai", "config.json");
206341
+ if (existsSync11(userConfigPath)) {
206342
+ const configContent = readFileSync10(userConfigPath, "utf-8");
206169
206343
  this.config = JSON.parse(configContent);
206170
206344
  return this.config;
206171
206345
  }
206172
- const projectConfigPath = join15(process.cwd(), ".mpdai", "config.json");
206173
- if (existsSync10(projectConfigPath)) {
206174
- const configContent = readFileSync9(projectConfigPath, "utf-8");
206346
+ const projectConfigPath = join16(process.cwd(), ".mpdai", "config.json");
206347
+ if (existsSync11(projectConfigPath)) {
206348
+ const configContent = readFileSync10(projectConfigPath, "utf-8");
206175
206349
  this.config = JSON.parse(configContent);
206176
206350
  return this.config;
206177
206351
  }
@@ -207660,9 +207834,9 @@ var EnvConfigManager_exports = {};
207660
207834
  __export(EnvConfigManager_exports, {
207661
207835
  EnvConfigManager: () => EnvConfigManager
207662
207836
  });
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";
207837
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync3, existsSync as existsSync12, mkdirSync as mkdirSync3 } from "fs";
207838
+ import { join as join17, dirname as dirname6 } from "path";
207839
+ import { homedir as homedir12 } from "os";
207666
207840
  var EnvConfigManager;
207667
207841
  var init_EnvConfigManager = __esm({
207668
207842
  "packages/cli/src/services/EnvConfigManager.ts"() {
@@ -207684,17 +207858,17 @@ var init_EnvConfigManager = __esm({
207684
207858
  let currentDir = startDir;
207685
207859
  while (true) {
207686
207860
  for (const envPath of this.envPaths) {
207687
- const fullPath = join16(currentDir, envPath);
207688
- if (existsSync11(fullPath)) {
207861
+ const fullPath = join17(currentDir, envPath);
207862
+ if (existsSync12(fullPath)) {
207689
207863
  return fullPath;
207690
207864
  }
207691
207865
  }
207692
- const parentDir = join16(currentDir, "..");
207866
+ const parentDir = join17(currentDir, "..");
207693
207867
  if (parentDir === currentDir) {
207694
- const homeDir2 = homedir11();
207868
+ const homeDir2 = homedir12();
207695
207869
  for (const envPath of this.envPaths) {
207696
- const fullPath = join16(homeDir2, envPath);
207697
- if (existsSync11(fullPath)) {
207870
+ const fullPath = join17(homeDir2, envPath);
207871
+ if (existsSync12(fullPath)) {
207698
207872
  return fullPath;
207699
207873
  }
207700
207874
  }
@@ -207709,7 +207883,7 @@ var init_EnvConfigManager = __esm({
207709
207883
  */
207710
207884
  readEnvFile(envPath) {
207711
207885
  try {
207712
- const content = readFileSync10(envPath, "utf-8");
207886
+ const content = readFileSync11(envPath, "utf-8");
207713
207887
  const envVars = {};
207714
207888
  content.split("\n").forEach((line) => {
207715
207889
  line = line.trim();
@@ -207754,7 +207928,7 @@ var init_EnvConfigManager = __esm({
207754
207928
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
207755
207929
  try {
207756
207930
  const dir = dirname6(envPath);
207757
- if (!existsSync11(dir)) {
207931
+ if (!existsSync12(dir)) {
207758
207932
  mkdirSync3(dir, { recursive: true });
207759
207933
  }
207760
207934
  const envContent = Object.entries(envConfig).map(([key, value]) => `${key}=${value}`).join("\n") + "\n";
@@ -207771,8 +207945,8 @@ var init_EnvConfigManager = __esm({
207771
207945
  * 更新或创建.env文件
207772
207946
  */
207773
207947
  updateEnvFile(model, targetPath) {
207774
- const envPath = targetPath || this.findEnvFile(process.cwd()) || join16(process.cwd(), ".mpdai", ".env");
207775
- const existingConfig = existsSync11(envPath) ? this.readEnvFile(envPath) : {};
207948
+ const envPath = targetPath || this.findEnvFile(process.cwd()) || join17(process.cwd(), ".mpdai", ".env");
207949
+ const existingConfig = existsSync12(envPath) ? this.readEnvFile(envPath) : {};
207776
207950
  const newConfig = this.generateEnvConfig(model, existingConfig);
207777
207951
  this.writeEnvFile(newConfig, envPath);
207778
207952
  return envPath;
@@ -208157,9 +208331,9 @@ var AuthService_exports = {};
208157
208331
  __export(AuthService_exports, {
208158
208332
  AuthService: () => AuthService
208159
208333
  });
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";
208334
+ import { readFileSync as readFileSync12, writeFileSync as writeFileSync4, existsSync as existsSync13, mkdirSync as mkdirSync4 } from "fs";
208335
+ import { join as join18 } from "path";
208336
+ import { homedir as homedir13 } from "os";
208163
208337
  var readlineSync, AuthService;
208164
208338
  var init_AuthService = __esm({
208165
208339
  "packages/cli/src/services/AuthService.ts"() {
@@ -208179,15 +208353,15 @@ var init_AuthService = __esm({
208179
208353
  this.mpdaiConfig = MpdaiConfigManager.getInstance();
208180
208354
  this.authApiUrl = authApiUrl || this.mpdaiConfig.getAuthUrl();
208181
208355
  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");
208356
+ this.userJsonPath = join18(homedir13(), ".mpdai", "user.json");
208357
+ this.keysJsonPath = join18(homedir13(), ".mpdai", "keys.json");
208358
+ this.idTokenPath = join18(homedir13(), ".mpdai", "id.token");
208185
208359
  }
208186
208360
  /**
208187
208361
  * 检查本地是否存在用户凭据文件
208188
208362
  */
208189
208363
  hasLocalCredentials() {
208190
- return existsSync12(this.userJsonPath);
208364
+ return existsSync13(this.userJsonPath);
208191
208365
  }
208192
208366
  /**
208193
208367
  * 从本地文件读取用户凭据
@@ -208197,7 +208371,7 @@ var init_AuthService = __esm({
208197
208371
  if (!this.hasLocalCredentials()) {
208198
208372
  return null;
208199
208373
  }
208200
- const content = readFileSync11(this.userJsonPath, "utf-8");
208374
+ const content = readFileSync12(this.userJsonPath, "utf-8");
208201
208375
  const credentials = JSON.parse(content);
208202
208376
  if (credentials.sso) {
208203
208377
  return credentials;
@@ -208220,7 +208394,7 @@ var init_AuthService = __esm({
208220
208394
  if (!this.hasLocalCredentials()) {
208221
208395
  return false;
208222
208396
  }
208223
- const content = readFileSync11(this.userJsonPath, "utf-8");
208397
+ const content = readFileSync12(this.userJsonPath, "utf-8");
208224
208398
  const credentials = JSON.parse(content);
208225
208399
  if (credentials.sso) {
208226
208400
  return false;
@@ -208235,10 +208409,10 @@ var init_AuthService = __esm({
208235
208409
  */
208236
208410
  readIdToken() {
208237
208411
  try {
208238
- if (!existsSync12(this.idTokenPath)) {
208412
+ if (!existsSync13(this.idTokenPath)) {
208239
208413
  return null;
208240
208414
  }
208241
- const token2 = readFileSync11(this.idTokenPath, "utf-8").trim();
208415
+ const token2 = readFileSync12(this.idTokenPath, "utf-8").trim();
208242
208416
  return token2 || null;
208243
208417
  } catch (error) {
208244
208418
  console.error("Failed to read id.token:", error);
@@ -208305,8 +208479,8 @@ var init_AuthService = __esm({
208305
208479
  */
208306
208480
  saveCredentials(credentials) {
208307
208481
  try {
208308
- const dir = join17(homedir12(), ".mpdai");
208309
- if (!existsSync12(dir)) {
208482
+ const dir = join18(homedir13(), ".mpdai");
208483
+ if (!existsSync13(dir)) {
208310
208484
  mkdirSync4(dir, { recursive: true });
208311
208485
  }
208312
208486
  const credentialsToSave = {
@@ -208327,7 +208501,7 @@ var init_AuthService = __esm({
208327
208501
  * 检查本地是否存在 keys 文件
208328
208502
  */
208329
208503
  hasLocalKeys() {
208330
- return existsSync12(this.keysJsonPath);
208504
+ return existsSync13(this.keysJsonPath);
208331
208505
  }
208332
208506
  /**
208333
208507
  * 从本地文件读取 keys
@@ -208337,7 +208511,7 @@ var init_AuthService = __esm({
208337
208511
  if (!this.hasLocalKeys()) {
208338
208512
  return null;
208339
208513
  }
208340
- const content = readFileSync11(this.keysJsonPath, "utf-8");
208514
+ const content = readFileSync12(this.keysJsonPath, "utf-8");
208341
208515
  const keys = JSON.parse(content);
208342
208516
  return keys;
208343
208517
  } catch (error) {
@@ -208350,8 +208524,8 @@ var init_AuthService = __esm({
208350
208524
  */
208351
208525
  saveKeys(keys) {
208352
208526
  try {
208353
- const dir = join17(homedir12(), ".mpdai");
208354
- if (!existsSync12(dir)) {
208527
+ const dir = join18(homedir13(), ".mpdai");
208528
+ if (!existsSync13(dir)) {
208355
208529
  mkdirSync4(dir, { recursive: true });
208356
208530
  }
208357
208531
  writeFileSync4(this.keysJsonPath, JSON.stringify(keys, null, 2), "utf-8");
@@ -209861,7 +210035,7 @@ var init_update = __esm({
209861
210035
  });
209862
210036
 
209863
210037
  // packages/router/dist/src/utils/diagnose.js
209864
- import { existsSync as existsSync13 } from "fs";
210038
+ import { existsSync as existsSync14 } from "fs";
209865
210039
  import https3 from "https";
209866
210040
  import http2 from "http";
209867
210041
  async function diagnoseRouterConfig() {
@@ -209876,7 +210050,7 @@ async function diagnoseRouterConfig() {
209876
210050
  try {
209877
210051
  const configFilePath2 = await getConfigFilePath();
209878
210052
  result.configFile = configFilePath2;
209879
- result.configExists = existsSync13(configFilePath2);
210053
+ result.configExists = existsSync14(configFilePath2);
209880
210054
  if (!result.configExists) {
209881
210055
  result.issues.push(`Configuration file does not exist: ${configFilePath2}`);
209882
210056
  return result;
@@ -215544,7 +215718,7 @@ var require_thread_stream = __commonJS({
215544
215718
  var { version: version3 } = require_package6();
215545
215719
  var { EventEmitter: EventEmitter7 } = __require("events");
215546
215720
  var { Worker } = __require("worker_threads");
215547
- var { join: join29 } = __require("path");
215721
+ var { join: join31 } = __require("path");
215548
215722
  var { pathToFileURL } = __require("url");
215549
215723
  var { wait } = require_wait();
215550
215724
  var {
@@ -215580,7 +215754,7 @@ var require_thread_stream = __commonJS({
215580
215754
  function createWorker(stream2, opts) {
215581
215755
  const { filename, workerData } = opts;
215582
215756
  const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
215583
- const toExecute = bundlerOverrides["thread-stream-worker"] || join29(__dirname, "lib", "worker.js");
215757
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join31(__dirname, "lib", "worker.js");
215584
215758
  const worker = new Worker(toExecute, {
215585
215759
  ...opts.workerOpts,
215586
215760
  trackUnmanagedFds: false,
@@ -215966,7 +216140,7 @@ var require_transport2 = __commonJS({
215966
216140
  "use strict";
215967
216141
  var { createRequire: createRequire2 } = __require("module");
215968
216142
  var getCallers = require_caller2();
215969
- var { join: join29, isAbsolute: isAbsolute4, sep: sep3 } = __require("node:path");
216143
+ var { join: join31, isAbsolute: isAbsolute4, sep: sep3 } = __require("node:path");
215970
216144
  var sleep2 = require_atomic_sleep();
215971
216145
  var onExit2 = require_on_exit_leak_free();
215972
216146
  var ThreadStream = require_thread_stream();
@@ -216029,7 +216203,7 @@ var require_transport2 = __commonJS({
216029
216203
  throw new Error("only one of target or targets can be specified");
216030
216204
  }
216031
216205
  if (targets) {
216032
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
216206
+ target = bundlerOverrides["pino-worker"] || join31(__dirname, "worker.js");
216033
216207
  options.targets = targets.filter((dest) => dest.target).map((dest) => {
216034
216208
  return {
216035
216209
  ...dest,
@@ -216047,7 +216221,7 @@ var require_transport2 = __commonJS({
216047
216221
  });
216048
216222
  });
216049
216223
  } else if (pipeline) {
216050
- target = bundlerOverrides["pino-worker"] || join29(__dirname, "worker.js");
216224
+ target = bundlerOverrides["pino-worker"] || join31(__dirname, "worker.js");
216051
216225
  options.pipelines = [pipeline.map((dest) => {
216052
216226
  return {
216053
216227
  ...dest,
@@ -216069,7 +216243,7 @@ var require_transport2 = __commonJS({
216069
216243
  return origin;
216070
216244
  }
216071
216245
  if (origin === "pino/file") {
216072
- return join29(__dirname, "..", "file.js");
216246
+ return join31(__dirname, "..", "file.js");
216073
216247
  }
216074
216248
  let fixTarget2;
216075
216249
  for (const filePath of callers) {
@@ -217058,7 +217232,7 @@ var require_safe_stable_stringify = __commonJS({
217058
217232
  return circularValue;
217059
217233
  }
217060
217234
  let res = "";
217061
- let join29 = ",";
217235
+ let join31 = ",";
217062
217236
  const originalIndentation = indentation;
217063
217237
  if (Array.isArray(value)) {
217064
217238
  if (value.length === 0) {
@@ -217072,7 +217246,7 @@ var require_safe_stable_stringify = __commonJS({
217072
217246
  indentation += spacer;
217073
217247
  res += `
217074
217248
  ${indentation}`;
217075
- join29 = `,
217249
+ join31 = `,
217076
217250
  ${indentation}`;
217077
217251
  }
217078
217252
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -217080,13 +217254,13 @@ ${indentation}`;
217080
217254
  for (; i < maximumValuesToStringify - 1; i++) {
217081
217255
  const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
217082
217256
  res += tmp2 !== void 0 ? tmp2 : "null";
217083
- res += join29;
217257
+ res += join31;
217084
217258
  }
217085
217259
  const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
217086
217260
  res += tmp !== void 0 ? tmp : "null";
217087
217261
  if (value.length - 1 > maximumBreadth) {
217088
217262
  const removedKeys = value.length - maximumBreadth - 1;
217089
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
217263
+ res += `${join31}"... ${getItemCount(removedKeys)} not stringified"`;
217090
217264
  }
217091
217265
  if (spacer !== "") {
217092
217266
  res += `
@@ -217107,7 +217281,7 @@ ${originalIndentation}`;
217107
217281
  let separator = "";
217108
217282
  if (spacer !== "") {
217109
217283
  indentation += spacer;
217110
- join29 = `,
217284
+ join31 = `,
217111
217285
  ${indentation}`;
217112
217286
  whitespace = " ";
217113
217287
  }
@@ -217121,13 +217295,13 @@ ${indentation}`;
217121
217295
  const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
217122
217296
  if (tmp !== void 0) {
217123
217297
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
217124
- separator = join29;
217298
+ separator = join31;
217125
217299
  }
217126
217300
  }
217127
217301
  if (keyLength > maximumBreadth) {
217128
217302
  const removedKeys = keyLength - maximumBreadth;
217129
217303
  res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
217130
- separator = join29;
217304
+ separator = join31;
217131
217305
  }
217132
217306
  if (spacer !== "" && separator.length > 1) {
217133
217307
  res = `
@@ -217168,7 +217342,7 @@ ${originalIndentation}`;
217168
217342
  }
217169
217343
  const originalIndentation = indentation;
217170
217344
  let res = "";
217171
- let join29 = ",";
217345
+ let join31 = ",";
217172
217346
  if (Array.isArray(value)) {
217173
217347
  if (value.length === 0) {
217174
217348
  return "[]";
@@ -217181,7 +217355,7 @@ ${originalIndentation}`;
217181
217355
  indentation += spacer;
217182
217356
  res += `
217183
217357
  ${indentation}`;
217184
- join29 = `,
217358
+ join31 = `,
217185
217359
  ${indentation}`;
217186
217360
  }
217187
217361
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
@@ -217189,13 +217363,13 @@ ${indentation}`;
217189
217363
  for (; i < maximumValuesToStringify - 1; i++) {
217190
217364
  const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
217191
217365
  res += tmp2 !== void 0 ? tmp2 : "null";
217192
- res += join29;
217366
+ res += join31;
217193
217367
  }
217194
217368
  const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
217195
217369
  res += tmp !== void 0 ? tmp : "null";
217196
217370
  if (value.length - 1 > maximumBreadth) {
217197
217371
  const removedKeys = value.length - maximumBreadth - 1;
217198
- res += `${join29}"... ${getItemCount(removedKeys)} not stringified"`;
217372
+ res += `${join31}"... ${getItemCount(removedKeys)} not stringified"`;
217199
217373
  }
217200
217374
  if (spacer !== "") {
217201
217375
  res += `
@@ -217208,7 +217382,7 @@ ${originalIndentation}`;
217208
217382
  let whitespace = "";
217209
217383
  if (spacer !== "") {
217210
217384
  indentation += spacer;
217211
- join29 = `,
217385
+ join31 = `,
217212
217386
  ${indentation}`;
217213
217387
  whitespace = " ";
217214
217388
  }
@@ -217217,7 +217391,7 @@ ${indentation}`;
217217
217391
  const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
217218
217392
  if (tmp !== void 0) {
217219
217393
  res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
217220
- separator = join29;
217394
+ separator = join31;
217221
217395
  }
217222
217396
  }
217223
217397
  if (spacer !== "" && separator.length > 1) {
@@ -217275,20 +217449,20 @@ ${originalIndentation}`;
217275
217449
  indentation += spacer;
217276
217450
  let res2 = `
217277
217451
  ${indentation}`;
217278
- const join30 = `,
217452
+ const join32 = `,
217279
217453
  ${indentation}`;
217280
217454
  const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
217281
217455
  let i = 0;
217282
217456
  for (; i < maximumValuesToStringify - 1; i++) {
217283
217457
  const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
217284
217458
  res2 += tmp2 !== void 0 ? tmp2 : "null";
217285
- res2 += join30;
217459
+ res2 += join32;
217286
217460
  }
217287
217461
  const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
217288
217462
  res2 += tmp !== void 0 ? tmp : "null";
217289
217463
  if (value.length - 1 > maximumBreadth) {
217290
217464
  const removedKeys = value.length - maximumBreadth - 1;
217291
- res2 += `${join30}"... ${getItemCount(removedKeys)} not stringified"`;
217465
+ res2 += `${join32}"... ${getItemCount(removedKeys)} not stringified"`;
217292
217466
  }
217293
217467
  res2 += `
217294
217468
  ${originalIndentation}`;
@@ -217304,16 +217478,16 @@ ${originalIndentation}`;
217304
217478
  return '"[Object]"';
217305
217479
  }
217306
217480
  indentation += spacer;
217307
- const join29 = `,
217481
+ const join31 = `,
217308
217482
  ${indentation}`;
217309
217483
  let res = "";
217310
217484
  let separator = "";
217311
217485
  let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
217312
217486
  if (isTypedArrayWithEntries(value)) {
217313
- res += stringifyTypedArray(value, join29, maximumBreadth);
217487
+ res += stringifyTypedArray(value, join31, maximumBreadth);
217314
217488
  keys = keys.slice(value.length);
217315
217489
  maximumPropertiesToStringify -= value.length;
217316
- separator = join29;
217490
+ separator = join31;
217317
217491
  }
217318
217492
  if (deterministic) {
217319
217493
  keys = sort(keys, comparator);
@@ -217324,13 +217498,13 @@ ${indentation}`;
217324
217498
  const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
217325
217499
  if (tmp !== void 0) {
217326
217500
  res += `${separator}${strEscape(key2)}: ${tmp}`;
217327
- separator = join29;
217501
+ separator = join31;
217328
217502
  }
217329
217503
  }
217330
217504
  if (keyLength > maximumBreadth) {
217331
217505
  const removedKeys = keyLength - maximumBreadth;
217332
217506
  res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
217333
- separator = join29;
217507
+ separator = join31;
217334
217508
  }
217335
217509
  if (separator !== "") {
217336
217510
  res = `
@@ -274010,7 +274184,7 @@ var require_send = __commonJS({
274010
274184
  var { parseTokenList } = require_parseTokenList();
274011
274185
  var { createHttpError } = require_createHttpError();
274012
274186
  var extname3 = path56.extname;
274013
- var join29 = path56.join;
274187
+ var join31 = path56.join;
274014
274188
  var normalize5 = path56.normalize;
274015
274189
  var resolve18 = path56.resolve;
274016
274190
  var sep3 = path56.sep;
@@ -274097,7 +274271,7 @@ var require_send = __commonJS({
274097
274271
  return { statusCode: 403 };
274098
274272
  }
274099
274273
  parts = path57.split(sep3);
274100
- path57 = normalize5(join29(root, path57));
274274
+ path57 = normalize5(join31(root, path57));
274101
274275
  } else {
274102
274276
  if (UP_PATH_REGEXP.test(path57)) {
274103
274277
  debug2('malicious path "%s"', path57);
@@ -274380,7 +274554,7 @@ var require_send = __commonJS({
274380
274554
  let err;
274381
274555
  for (let i = 0; i < options.index.length; i++) {
274382
274556
  const index = options.index[i];
274383
- const p = join29(path57, index);
274557
+ const p = join31(path57, index);
274384
274558
  const { error, stat: stat4 } = await tryStat(p);
274385
274559
  if (error) {
274386
274560
  err = error;
@@ -276856,7 +277030,7 @@ var init_esm15 = __esm({
276856
277030
  import { get_encoding } from "tiktoken";
276857
277031
  import { readFile as readFile5, access as access3 } from "fs/promises";
276858
277032
  import { opendir, stat as stat3 } from "fs/promises";
276859
- import { join as join18 } from "path";
277033
+ import { join as join19 } from "path";
276860
277034
  var enc, calculateTokenCount, readConfigFile2, getProjectSpecificRouter, getUseModel, router, sessionProjectCache, searchProjectBySession;
276861
277035
  var init_router = __esm({
276862
277036
  "packages/router/dist/src/utils/router.js"() {
@@ -276924,8 +277098,8 @@ var init_router = __esm({
276924
277098
  if (req.sessionId) {
276925
277099
  const project = await searchProjectBySession(req.sessionId);
276926
277100
  if (project) {
276927
- const projectConfigPath = join18(HOME_DIR, project, "config.json");
276928
- const sessionConfigPath = join18(HOME_DIR, project, `${req.sessionId}.json`);
277101
+ const projectConfigPath = join19(HOME_DIR, project, "config.json");
277102
+ const sessionConfigPath = join19(HOME_DIR, project, `${req.sessionId}.json`);
276929
277103
  const sessionConfig = await readConfigFile2(sessionConfigPath);
276930
277104
  if (sessionConfig && sessionConfig.Router) {
276931
277105
  return sessionConfig.Router;
@@ -277032,7 +277206,7 @@ var init_router = __esm({
277032
277206
  }
277033
277207
  }
277034
277208
  const checkPromises = folderNames.map(async (folderName) => {
277035
- const sessionFilePath = join18(CLAUDE_PROJECTS_DIR, folderName, `${sessionId2}.jsonl`);
277209
+ const sessionFilePath = join19(CLAUDE_PROJECTS_DIR, folderName, `${sessionId2}.jsonl`);
277036
277210
  try {
277037
277211
  const fileStat = await stat3(sessionFilePath);
277038
277212
  return fileStat.isFile() ? folderName : null;
@@ -277102,9 +277276,9 @@ var require_package7 = __commonJS({
277102
277276
  });
277103
277277
 
277104
277278
  // packages/router/dist/src/server.js
277105
- import { join as join19, dirname as dirname7 } from "path";
277279
+ import { join as join20, dirname as dirname7 } from "path";
277106
277280
  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";
277281
+ import { readdirSync as readdirSync2, statSync as statSync2, readFileSync as readFileSync13, writeFileSync as writeFileSync5, existsSync as existsSync15 } from "fs";
277108
277282
  var import_static, __filename2, __dirname4, createServer4;
277109
277283
  var init_server3 = __esm({
277110
277284
  "packages/router/dist/src/server.js"() {
@@ -277156,7 +277330,7 @@ var init_server3 = __esm({
277156
277330
  });
277157
277331
  try {
277158
277332
  server.app.register(import_static.default, {
277159
- root: join19(__dirname4, "..", "dist", "ui"),
277333
+ root: join20(__dirname4, "..", "dist", "ui"),
277160
277334
  prefix: "/ui/",
277161
277335
  maxAge: "1h"
277162
277336
  });
@@ -277196,13 +277370,13 @@ var init_server3 = __esm({
277196
277370
  });
277197
277371
  server.app.get("/api/logs/files", async (req, reply) => {
277198
277372
  try {
277199
- const logDir = join19(HOME_DIR, "logs");
277373
+ const logDir = join20(HOME_DIR, "logs");
277200
277374
  const logFiles = [];
277201
- if (existsSync14(logDir)) {
277375
+ if (existsSync15(logDir)) {
277202
277376
  const files = readdirSync2(logDir);
277203
277377
  for (const file of files) {
277204
277378
  if (file.endsWith(".log")) {
277205
- const filePath = join19(logDir, file);
277379
+ const filePath = join20(logDir, file);
277206
277380
  const stats = statSync2(filePath);
277207
277381
  logFiles.push({
277208
277382
  name: file,
@@ -277227,12 +277401,12 @@ var init_server3 = __esm({
277227
277401
  if (filePath) {
277228
277402
  logFilePath = filePath;
277229
277403
  } else {
277230
- logFilePath = join19(HOME_DIR, "logs", "app.log");
277404
+ logFilePath = join20(HOME_DIR, "logs", "app.log");
277231
277405
  }
277232
- if (!existsSync14(logFilePath)) {
277406
+ if (!existsSync15(logFilePath)) {
277233
277407
  return [];
277234
277408
  }
277235
- const logContent = readFileSync12(logFilePath, "utf8");
277409
+ const logContent = readFileSync13(logFilePath, "utf8");
277236
277410
  const logLines = logContent.split("\n").filter((line) => line.trim());
277237
277411
  return logLines;
277238
277412
  } catch (error) {
@@ -277247,9 +277421,9 @@ var init_server3 = __esm({
277247
277421
  if (filePath) {
277248
277422
  logFilePath = filePath;
277249
277423
  } else {
277250
- logFilePath = join19(HOME_DIR, "logs", "app.log");
277424
+ logFilePath = join20(HOME_DIR, "logs", "app.log");
277251
277425
  }
277252
- if (existsSync14(logFilePath)) {
277426
+ if (existsSync15(logFilePath)) {
277253
277427
  writeFileSync5(logFilePath, "", "utf8");
277254
277428
  }
277255
277429
  return { success: true, message: "Logs cleared successfully" };
@@ -278269,7 +278443,7 @@ var require_dist10 = __commonJS({
278269
278443
  });
278270
278444
 
278271
278445
  // packages/router/dist/src/utils/processCheck.js
278272
- import { existsSync as existsSync15, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "fs";
278446
+ import { existsSync as existsSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync6 } from "fs";
278273
278447
  import { execSync as execSync2 } from "child_process";
278274
278448
  async function isProcessRunning(pid) {
278275
278449
  try {
@@ -278281,33 +278455,33 @@ async function isProcessRunning(pid) {
278281
278455
  }
278282
278456
  function incrementReferenceCount() {
278283
278457
  let count = 0;
278284
- if (existsSync15(REFERENCE_COUNT_FILE)) {
278285
- count = parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278458
+ if (existsSync16(REFERENCE_COUNT_FILE)) {
278459
+ count = parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278286
278460
  }
278287
278461
  count++;
278288
278462
  writeFileSync6(REFERENCE_COUNT_FILE, count.toString());
278289
278463
  }
278290
278464
  function decrementReferenceCount() {
278291
278465
  let count = 0;
278292
- if (existsSync15(REFERENCE_COUNT_FILE)) {
278293
- count = parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278466
+ if (existsSync16(REFERENCE_COUNT_FILE)) {
278467
+ count = parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278294
278468
  }
278295
278469
  count = Math.max(0, count - 1);
278296
278470
  writeFileSync6(REFERENCE_COUNT_FILE, count.toString());
278297
278471
  }
278298
278472
  function getReferenceCount() {
278299
- if (!existsSync15(REFERENCE_COUNT_FILE)) {
278473
+ if (!existsSync16(REFERENCE_COUNT_FILE)) {
278300
278474
  return 0;
278301
278475
  }
278302
- return parseInt(readFileSync13(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278476
+ return parseInt(readFileSync14(REFERENCE_COUNT_FILE, "utf-8")) || 0;
278303
278477
  }
278304
278478
  function isServiceRunning() {
278305
- if (!existsSync15(PID_FILE)) {
278479
+ if (!existsSync16(PID_FILE)) {
278306
278480
  return false;
278307
278481
  }
278308
278482
  let pid;
278309
278483
  try {
278310
- const pidStr = readFileSync13(PID_FILE, "utf-8");
278484
+ const pidStr = readFileSync14(PID_FILE, "utf-8");
278311
278485
  pid = parseInt(pidStr, 10);
278312
278486
  if (isNaN(pid)) {
278313
278487
  cleanupPidFile();
@@ -278339,7 +278513,7 @@ function savePid(pid) {
278339
278513
  writeFileSync6(PID_FILE, pid.toString());
278340
278514
  }
278341
278515
  function cleanupPidFile() {
278342
- if (existsSync15(PID_FILE)) {
278516
+ if (existsSync16(PID_FILE)) {
278343
278517
  try {
278344
278518
  const fs54 = __require("fs");
278345
278519
  fs54.unlinkSync(PID_FILE);
@@ -278348,11 +278522,11 @@ function cleanupPidFile() {
278348
278522
  }
278349
278523
  }
278350
278524
  function getServicePid() {
278351
- if (!existsSync15(PID_FILE)) {
278525
+ if (!existsSync16(PID_FILE)) {
278352
278526
  return null;
278353
278527
  }
278354
278528
  try {
278355
- const pid = parseInt(readFileSync13(PID_FILE, "utf-8"));
278529
+ const pid = parseInt(readFileSync14(PID_FILE, "utf-8"));
278356
278530
  return isNaN(pid) ? null : pid;
278357
278531
  } catch (e2) {
278358
278532
  return null;
@@ -278793,16 +278967,16 @@ var init_agents = __esm({
278793
278967
  });
278794
278968
 
278795
278969
  // packages/router/dist/src/index.js
278796
- import { existsSync as existsSync16 } from "fs";
278970
+ import { existsSync as existsSync17 } from "fs";
278797
278971
  import { writeFile as writeFile3 } from "fs/promises";
278798
- import { homedir as homedir13 } from "os";
278799
- import { join as join20 } from "path";
278972
+ import { homedir as homedir14 } from "os";
278973
+ import { join as join21 } from "path";
278800
278974
  import { createRequire } from "module";
278801
278975
  import { EventEmitter as EventEmitter6 } from "node:events";
278802
278976
  async function initializeClaudeConfig() {
278803
- const homeDir2 = homedir13();
278804
- const configPath = join20(homeDir2, ".claude.json");
278805
- if (!existsSync16(configPath)) {
278977
+ const homeDir2 = homedir14();
278978
+ const configPath = join21(homeDir2, ".claude.json");
278979
+ if (!existsSync17(configPath)) {
278806
278980
  const userID = Array.from({ length: 64 }, () => Math.random().toString(16)[2]).join("");
278807
278981
  const configContent = {
278808
278982
  numStartups: 184,
@@ -278884,7 +279058,7 @@ async function run(options = {}) {
278884
279058
  providers: config2.Providers || config2.providers,
278885
279059
  HOST,
278886
279060
  PORT: servicePort,
278887
- LOG_FILE: join20(homedir13(), ".mpdai", "mpdai-router.log")
279061
+ LOG_FILE: join21(homedir14(), ".mpdai", "mpdai-router.log")
278888
279062
  },
278889
279063
  logger: loggerConfig
278890
279064
  });
@@ -279134,10 +279308,10 @@ var init_src2 = __esm({
279134
279308
  });
279135
279309
 
279136
279310
  // packages/router/dist/src/utils/close.js
279137
- import { readFileSync as readFileSync14 } from "fs";
279138
- import { join as join21 } from "path";
279311
+ import { readFileSync as readFileSync15 } from "fs";
279312
+ import { join as join22 } from "path";
279139
279313
  async function closeService() {
279140
- const PID_FILE2 = join21(HOME_DIR, ".mpdai-router.pid");
279314
+ const PID_FILE2 = join22(HOME_DIR, ".mpdai-router.pid");
279141
279315
  const isRunning = await isServiceRunning();
279142
279316
  if (!isRunning) {
279143
279317
  console.log("No service is currently running.");
@@ -279147,7 +279321,7 @@ async function closeService() {
279147
279321
  return;
279148
279322
  }
279149
279323
  try {
279150
- const pid = parseInt(readFileSync14(PID_FILE2, "utf-8"));
279324
+ const pid = parseInt(readFileSync15(PID_FILE2, "utf-8"));
279151
279325
  process.kill(pid);
279152
279326
  cleanupPidFile();
279153
279327
  console.log("mpdai router service has been successfully stopped.");
@@ -291125,7 +291299,7 @@ var require_require_directory = __commonJS({
291125
291299
  "node_modules/require-directory/index.js"(exports2, module2) {
291126
291300
  "use strict";
291127
291301
  var fs54 = __require("fs");
291128
- var join29 = __require("path").join;
291302
+ var join31 = __require("path").join;
291129
291303
  var resolve18 = __require("path").resolve;
291130
291304
  var dirname12 = __require("path").dirname;
291131
291305
  var defaultOptions2 = {
@@ -291162,7 +291336,7 @@ var require_require_directory = __commonJS({
291162
291336
  }
291163
291337
  path56 = !path56 ? dirname12(m.filename) : resolve18(dirname12(m.filename), path56);
291164
291338
  fs54.readdirSync(path56).forEach(function(filename) {
291165
- var joined = join29(path56, filename), files, key, obj;
291339
+ var joined = join31(path56, filename), files, key, obj;
291166
291340
  if (fs54.statSync(joined).isDirectory() && options.recurse) {
291167
291341
  files = requireDirectory(m, joined, options);
291168
291342
  if (Object.keys(files).length) {
@@ -294710,7 +294884,7 @@ var require_deep_extend = __commonJS({
294710
294884
  var require_rc = __commonJS({
294711
294885
  "node_modules/rc/index.js"(exports2, module2) {
294712
294886
  var cc2 = require_utils14();
294713
- var join29 = __require("path").join;
294887
+ var join31 = __require("path").join;
294714
294888
  var deepExtend = require_deep_extend();
294715
294889
  var etc = "/etc";
294716
294890
  var win = process.platform === "win32";
@@ -294735,15 +294909,15 @@ var require_rc = __commonJS({
294735
294909
  }
294736
294910
  if (!win)
294737
294911
  [
294738
- join29(etc, name2, "config"),
294739
- join29(etc, name2 + "rc")
294912
+ join31(etc, name2, "config"),
294913
+ join31(etc, name2 + "rc")
294740
294914
  ].forEach(addConfigFile);
294741
294915
  if (home)
294742
294916
  [
294743
- join29(home, ".config", name2, "config"),
294744
- join29(home, ".config", name2),
294745
- join29(home, "." + name2, "config"),
294746
- join29(home, "." + name2 + "rc")
294917
+ join31(home, ".config", name2, "config"),
294918
+ join31(home, ".config", name2),
294919
+ join31(home, "." + name2, "config"),
294920
+ join31(home, "." + name2 + "rc")
294747
294921
  ].forEach(addConfigFile);
294748
294922
  addConfigFile(cc2.find("." + name2 + "rc"));
294749
294923
  if (env6.config) addConfigFile(env6.config);
@@ -311178,9 +311352,9 @@ var clearCommand = {
311178
311352
  };
311179
311353
 
311180
311354
  // 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";
311355
+ import { existsSync as existsSync10, unlinkSync } from "fs";
311356
+ import { join as join15 } from "path";
311357
+ import { homedir as homedir10 } from "os";
311184
311358
  var logoutCommand = {
311185
311359
  name: "logout",
311186
311360
  description: "logout and clear user credentials and settings, then exit",
@@ -311188,8 +311362,8 @@ var logoutCommand = {
311188
311362
  const now = /* @__PURE__ */ new Date();
311189
311363
  const { sessionStartTime } = context2.session.stats;
311190
311364
  const wallDuration = now.getTime() - sessionStartTime.getTime();
311191
- const userJsonPath = join14(homedir9(), ".mpdai", "user.json");
311192
- if (existsSync9(userJsonPath)) {
311365
+ const userJsonPath = join15(homedir10(), ".mpdai", "user.json");
311366
+ if (existsSync10(userJsonPath)) {
311193
311367
  try {
311194
311368
  unlinkSync(userJsonPath);
311195
311369
  context2.ui.addItem({
@@ -311203,8 +311377,8 @@ var logoutCommand = {
311203
311377
  }, now.getTime());
311204
311378
  }
311205
311379
  }
311206
- const keysJsonPath = join14(homedir9(), ".mpdai", "keys.json");
311207
- if (existsSync9(keysJsonPath)) {
311380
+ const keysJsonPath = join15(homedir10(), ".mpdai", "keys.json");
311381
+ if (existsSync10(keysJsonPath)) {
311208
311382
  try {
311209
311383
  unlinkSync(keysJsonPath);
311210
311384
  context2.ui.addItem({
@@ -311218,8 +311392,8 @@ var logoutCommand = {
311218
311392
  }, now.getTime());
311219
311393
  }
311220
311394
  }
311221
- const userSettingsPath = join14(homedir9(), ".mpdai", "settings.json");
311222
- if (existsSync9(userSettingsPath)) {
311395
+ const userSettingsPath = join15(homedir10(), ".mpdai", "settings.json");
311396
+ if (existsSync10(userSettingsPath)) {
311223
311397
  try {
311224
311398
  unlinkSync(userSettingsPath);
311225
311399
  context2.ui.addItem({
@@ -311329,7 +311503,7 @@ init_dist4();
311329
311503
  init_dist4();
311330
311504
  init_dist4();
311331
311505
  init_dist4();
311332
- import { readFileSync as readFileSync16, existsSync as existsSync18, unlinkSync as unlinkSync2 } from "fs";
311506
+ import { readFileSync as readFileSync17, existsSync as existsSync19, unlinkSync as unlinkSync2 } from "fs";
311333
311507
  async function waitForService(timeout2 = 1e4, initialDelay = 1e3) {
311334
311508
  await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
311335
311509
  const startTime = Date.now();
@@ -328672,9 +328846,9 @@ init_dist3();
328672
328846
  var import_strip_json_comments = __toESM(require_strip_json_comments(), 1);
328673
328847
  import * as fs39 from "fs";
328674
328848
  import * as path43 from "path";
328675
- import { homedir as homedir14 } from "os";
328849
+ import { homedir as homedir15 } from "os";
328676
328850
  var SETTINGS_DIRECTORY_NAME = ".mpdai";
328677
- var USER_SETTINGS_DIR = path43.join(homedir14(), SETTINGS_DIRECTORY_NAME);
328851
+ var USER_SETTINGS_DIR = path43.join(homedir15(), SETTINGS_DIRECTORY_NAME);
328678
328852
  var USER_SETTINGS_PATH = path43.join(USER_SETTINGS_DIR, "settings.json");
328679
328853
  var LoadedSettings = class {
328680
328854
  constructor(user, workspace, errors) {
@@ -328757,11 +328931,11 @@ function findEnvFile(startDir) {
328757
328931
  }
328758
328932
  const parentDir = path43.dirname(currentDir);
328759
328933
  if (parentDir === currentDir || !parentDir) {
328760
- const homeGeminiEnvPath = path43.join(homedir14(), MPDAI_CONFIG_DIR, ".env");
328934
+ const homeGeminiEnvPath = path43.join(homedir15(), MPDAI_CONFIG_DIR, ".env");
328761
328935
  if (fs39.existsSync(homeGeminiEnvPath)) {
328762
328936
  return homeGeminiEnvPath;
328763
328937
  }
328764
- const homeEnvPath = path43.join(homedir14(), ".env");
328938
+ const homeEnvPath = path43.join(homedir15(), ".env");
328765
328939
  if (fs39.existsSync(homeEnvPath)) {
328766
328940
  return homeEnvPath;
328767
328941
  }
@@ -330547,7 +330721,7 @@ function stripQuotes(val) {
330547
330721
  }
330548
330722
 
330549
330723
  // node_modules/yargs-parser/build/lib/index.js
330550
- import { readFileSync as readFileSync18 } from "fs";
330724
+ import { readFileSync as readFileSync19 } from "fs";
330551
330725
  var _a5;
330552
330726
  var _b;
330553
330727
  var _c;
@@ -330574,7 +330748,7 @@ var parser4 = new YargsParser({
330574
330748
  if (typeof __require !== "undefined") {
330575
330749
  return __require(path56);
330576
330750
  } else if (path56.match(/\.json$/)) {
330577
- return JSON.parse(readFileSync18(path56, "utf8"));
330751
+ return JSON.parse(readFileSync19(path56, "utf8"));
330578
330752
  } else {
330579
330753
  throw Error("only .json config files are supported in ESM");
330580
330754
  }
@@ -330902,17 +331076,17 @@ function sync_default(start, callback) {
330902
331076
 
330903
331077
  // node_modules/yargs/lib/platform-shims/esm.mjs
330904
331078
  import { inspect } from "util";
330905
- import { readFileSync as readFileSync20 } from "fs";
331079
+ import { readFileSync as readFileSync21 } from "fs";
330906
331080
  import { fileURLToPath as fileURLToPath8 } from "url";
330907
331081
  import { basename as basename4, dirname as dirname11, extname as extname2, relative as relative6, resolve as resolve17 } from "path";
330908
331082
 
330909
331083
  // node_modules/y18n/build/lib/platform-shims/node.js
330910
- import { readFileSync as readFileSync19, statSync as statSync4, writeFile as writeFile5 } from "fs";
331084
+ import { readFileSync as readFileSync20, statSync as statSync4, writeFile as writeFile5 } from "fs";
330911
331085
  import { format as format2 } from "util";
330912
331086
  import { resolve as resolve16 } from "path";
330913
331087
  var node_default = {
330914
331088
  fs: {
330915
- readFileSync: readFileSync19,
331089
+ readFileSync: readFileSync20,
330916
331090
  writeFile: writeFile5
330917
331091
  },
330918
331092
  format: format2,
@@ -331136,7 +331310,7 @@ var esm_default7 = {
331136
331310
  nextTick: process.nextTick,
331137
331311
  stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
331138
331312
  },
331139
- readFileSync: readFileSync20,
331313
+ readFileSync: readFileSync21,
331140
331314
  require: () => {
331141
331315
  throw new YError(REQUIRE_ERROR);
331142
331316
  },
@@ -332358,7 +332532,7 @@ init_dist3();
332358
332532
  init_langfuseClient();
332359
332533
  import { execSync as execSync4 } from "child_process";
332360
332534
  import { promises as fs41 } from "fs";
332361
- import { join as join26 } from "path";
332535
+ import { join as join27 } from "path";
332362
332536
  var DataCollector = class {
332363
332537
  langfuseClient;
332364
332538
  constructor() {
@@ -332468,7 +332642,7 @@ var DataCollector = class {
332468
332642
  // 提取元数据
332469
332643
  extractMetadata(data) {
332470
332644
  return {
332471
- cli_version: "0.1.51",
332645
+ cli_version: "0.1.53",
332472
332646
  model: process.env.CUSTOM_LLM_MODEL_NAME || "gemini",
332473
332647
  auth_type: process.env.USE_CUSTOM_LLM ? "custom_llm" : "google_oauth",
332474
332648
  project_path: data.projectPath,
@@ -332685,7 +332859,7 @@ var DataCollector = class {
332685
332859
  const walkDir = async (dir) => {
332686
332860
  const entries = await fs41.readdir(dir, { withFileTypes: true });
332687
332861
  for (const entry of entries) {
332688
- const fullPath = join26(dir, entry.name);
332862
+ const fullPath = join27(dir, entry.name);
332689
332863
  if (entry.isDirectory()) {
332690
332864
  dirCount++;
332691
332865
  await walkDir(fullPath);
@@ -339033,6 +339207,8 @@ async function readStdin() {
339033
339207
  import { basename as basename5 } from "node:path";
339034
339208
  import v8 from "node:v8";
339035
339209
  import os23 from "node:os";
339210
+ import { join as join30 } from "node:path";
339211
+ import { mkdirSync as mkdirSync7, writeFileSync as writeFileSync11 } from "node:fs";
339036
339212
  import { spawn as spawn11 } from "node:child_process";
339037
339213
 
339038
339214
  // packages/cli/src/utils/sandbox.ts
@@ -339828,10 +340004,10 @@ async function runNonInteractive(config2, input) {
339828
340004
  // packages/cli/src/utils/cleanup.ts
339829
340005
  init_dist3();
339830
340006
  import { promises as fs52 } from "fs";
339831
- import { join as join27 } from "path";
340007
+ import { join as join28 } from "path";
339832
340008
  async function cleanupCheckpoints() {
339833
340009
  const tempDir = getProjectTempDir(process.cwd());
339834
- const checkpointsDir = join27(tempDir, "checkpoints");
340010
+ const checkpointsDir = join28(tempDir, "checkpoints");
339835
340011
  try {
339836
340012
  await fs52.rm(checkpointsDir, { recursive: true, force: true });
339837
340013
  } catch {
@@ -339846,9 +340022,9 @@ init_EnvConfigManager();
339846
340022
  init_mpdaiConfig();
339847
340023
  import * as fs53 from "fs";
339848
340024
  import * as path55 from "path";
339849
- import { homedir as homedir17 } from "os";
340025
+ import { homedir as homedir18 } from "os";
339850
340026
  function initializeLangfuseConfig() {
339851
- const langfuseDir = path55.join(homedir17(), ".mpdai");
340027
+ const langfuseDir = path55.join(homedir18(), ".mpdai");
339852
340028
  const settingsFile = path55.join(langfuseDir, "settings.conf");
339853
340029
  const isDebugMode = process.env.DEBUG === "true" || process.env.DEBUG_MODE === "true" || process.env.dev === "true";
339854
340030
  try {
@@ -339929,7 +340105,7 @@ init_dist4();
339929
340105
  init_dist4();
339930
340106
  init_dist4();
339931
340107
  init_dist4();
339932
- import { readFileSync as readFileSync22, existsSync as existsSync23, unlinkSync as unlinkSync3 } from "fs";
340108
+ import { readFileSync as readFileSync23, existsSync as existsSync24, unlinkSync as unlinkSync3 } from "fs";
339933
340109
  async function waitForService2(timeout2 = 1e4, initialDelay = 1e3) {
339934
340110
  await new Promise((resolve18) => setTimeout(resolve18, initialDelay));
339935
340111
  const startTime = Date.now();
@@ -339955,10 +340131,10 @@ async function handleRouterCommand(command, args) {
339955
340131
  return true;
339956
340132
  case "stop":
339957
340133
  try {
339958
- const pid = parseInt(readFileSync22(PID_FILE, "utf-8"));
340134
+ const pid = parseInt(readFileSync23(PID_FILE, "utf-8"));
339959
340135
  process.kill(pid);
339960
340136
  cleanupPidFile();
339961
- if (existsSync23(REFERENCE_COUNT_FILE)) {
340137
+ if (existsSync24(REFERENCE_COUNT_FILE)) {
339962
340138
  try {
339963
340139
  unlinkSync3(REFERENCE_COUNT_FILE);
339964
340140
  } catch (e2) {
@@ -339972,10 +340148,10 @@ async function handleRouterCommand(command, args) {
339972
340148
  return true;
339973
340149
  case "restart":
339974
340150
  try {
339975
- const pid = parseInt(readFileSync22(PID_FILE, "utf-8"));
340151
+ const pid = parseInt(readFileSync23(PID_FILE, "utf-8"));
339976
340152
  process.kill(pid);
339977
340153
  cleanupPidFile();
339978
- if (existsSync23(REFERENCE_COUNT_FILE)) {
340154
+ if (existsSync24(REFERENCE_COUNT_FILE)) {
339979
340155
  try {
339980
340156
  unlinkSync3(REFERENCE_COUNT_FILE);
339981
340157
  } catch (e2) {
@@ -340149,6 +340325,31 @@ async function main() {
340149
340325
  console.log(version3);
340150
340326
  return;
340151
340327
  }
340328
+ if (args.length > 0 && args[0] === "version") {
340329
+ const { getCliVersion: getCliVersion2 } = await Promise.resolve().then(() => (init_version5(), version_exports));
340330
+ const version3 = await getCliVersion2();
340331
+ console.log(version3);
340332
+ return;
340333
+ }
340334
+ if (args.length > 0 && args[0] === "publish") {
340335
+ const { getPackageJson: getPackageJson2, getPackageRoot: getPackageRoot2 } = await Promise.resolve().then(() => (init_package(), package_exports));
340336
+ const pkg2 = await getPackageJson2();
340337
+ const root = await getPackageRoot2();
340338
+ const releaseScript = pkg2?.scripts?.release;
340339
+ if (releaseScript && root) {
340340
+ const npm = process.platform === "win32" ? "npm.cmd" : "npm";
340341
+ const child = spawn11(npm, ["run", "release"], {
340342
+ cwd: root,
340343
+ stdio: "inherit",
340344
+ shell: true
340345
+ });
340346
+ child.on("close", (code) => process.exit(code ?? 0));
340347
+ return;
340348
+ }
340349
+ console.error("Publish is only available when run from the FRANK CLI project root.");
340350
+ console.error("In the repo, run: npm run release");
340351
+ process.exit(1);
340352
+ }
340152
340353
  const commandName = basename5(process.argv[1]);
340153
340354
  if (commandName === "frankcode") {
340154
340355
  const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
@@ -340184,6 +340385,74 @@ async function main() {
340184
340385
  return;
340185
340386
  }
340186
340387
  }
340388
+ if (args.length >= 1 && args[0] === "set") {
340389
+ if (args.length >= 4 && args[2] === "token") {
340390
+ const service = args[1];
340391
+ const token2 = args[3]?.trim();
340392
+ if (service === "confluence" && token2) {
340393
+ const dir = join30(os23.homedir(), ".mpdai");
340394
+ try {
340395
+ mkdirSync7(dir, { recursive: true });
340396
+ writeFileSync11(join30(dir, "confluence.key"), token2, "utf-8");
340397
+ console.log("Confluence token saved to ~/.mpdai/confluence.key");
340398
+ } catch (err) {
340399
+ console.error("Failed to save Confluence token:", err);
340400
+ process.exit(1);
340401
+ }
340402
+ return;
340403
+ }
340404
+ if (service === "jira" && token2) {
340405
+ const dir = join30(os23.homedir(), ".mpdai");
340406
+ try {
340407
+ mkdirSync7(dir, { recursive: true });
340408
+ writeFileSync11(join30(dir, "jira.key"), token2, "utf-8");
340409
+ console.log("Jira token saved to ~/.mpdai/jira.key");
340410
+ } catch (err) {
340411
+ console.error("Failed to save Jira token:", err);
340412
+ process.exit(1);
340413
+ }
340414
+ return;
340415
+ }
340416
+ }
340417
+ if (args[1] === "confluence" || args[1] === "jira") {
340418
+ console.error(`Usage: frankcli set ${args[1] || "<confluence|jira>"} token <Personal Access Token>`);
340419
+ process.exit(1);
340420
+ }
340421
+ }
340422
+ if (args.length > 0 && args[0] === "confluence") {
340423
+ if (args.length >= 3 && args[1] === "get") {
340424
+ const confluenceUrl = args[2];
340425
+ const { runConfluenceGetPage: runConfluenceGetPage2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports));
340426
+ const result = await runConfluenceGetPage2(confluenceUrl);
340427
+ if (result.success) {
340428
+ console.log(result.content);
340429
+ } else {
340430
+ console.error(result.error);
340431
+ process.exit(1);
340432
+ }
340433
+ return;
340434
+ }
340435
+ console.error("Usage: frankcli confluence get <confluence_url>");
340436
+ console.error("Example: frankcli confluence get https://confluence.rakuten-it.com/confluence/x/TDae8Q");
340437
+ process.exit(1);
340438
+ }
340439
+ if (args.length > 0 && args[0] === "jira") {
340440
+ if (args.length >= 3 && args[1] === "get") {
340441
+ const issueKey = args[2];
340442
+ const { runJiraGetIssue: runJiraGetIssue2 } = await Promise.resolve().then(() => (init_dist3(), dist_exports));
340443
+ const result = await runJiraGetIssue2(issueKey);
340444
+ if (result.success) {
340445
+ console.log(result.content);
340446
+ } else {
340447
+ console.error(result.error);
340448
+ process.exit(1);
340449
+ }
340450
+ return;
340451
+ }
340452
+ console.error("Usage: frankcli jira get <issue_key>");
340453
+ console.error("Example: frankcli jira get MOPS-6815");
340454
+ process.exit(1);
340455
+ }
340187
340456
  loadStartupConfig();
340188
340457
  const workspaceRoot = process.cwd();
340189
340458
  let settings = loadSettings(workspaceRoot);
@@ -340398,7 +340667,7 @@ async function performUserAuthentication() {
340398
340667
  const { getConfigFilePath: getConfigFilePath2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports2));
340399
340668
  const fs54 = await import("fs/promises");
340400
340669
  const path56 = await import("path");
340401
- const { homedir: homedir18 } = await import("os");
340670
+ const { homedir: homedir19 } = await import("os");
340402
340671
  let shouldUpdate = false;
340403
340672
  try {
340404
340673
  const configFilePath2 = await getConfigFilePath2();