juno-code 1.0.17 → 1.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cli.js CHANGED
@@ -28,6 +28,7 @@ var uuid = require('uuid');
28
28
  var whichPkg = require('which');
29
29
  var glob = require('glob');
30
30
  var fastGlob = require('fast-glob');
31
+ var module$1 = require('module');
31
32
 
32
33
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
33
34
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -343,12 +344,12 @@ var init_service_installer = __esm({
343
344
  * Get the path to the services directory in the package
344
345
  */
345
346
  static getPackageServicesDir() {
346
- const __dirname = path3__namespace.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href))));
347
- let servicesPath = path3__namespace.join(__dirname, "..", "..", "templates", "services");
347
+ const __dirname2 = path3__namespace.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href))));
348
+ let servicesPath = path3__namespace.join(__dirname2, "..", "..", "templates", "services");
348
349
  if (fs3__default.default.existsSync(servicesPath)) {
349
350
  return servicesPath;
350
351
  }
351
- servicesPath = path3__namespace.join(__dirname, "..", "templates", "services");
352
+ servicesPath = path3__namespace.join(__dirname2, "..", "templates", "services");
352
353
  if (fs3__default.default.existsSync(servicesPath)) {
353
354
  return servicesPath;
354
355
  }
@@ -917,8 +918,8 @@ async function loadYamlConfig(filePath) {
917
918
  async function loadPackageJsonConfig(filePath) {
918
919
  try {
919
920
  const content = await nodeFs.promises.readFile(filePath, "utf-8");
920
- const packageJson = JSON.parse(content);
921
- return packageJson.junoCode || {};
921
+ const packageJson2 = JSON.parse(content);
922
+ return packageJson2.junoCode || {};
922
923
  } catch (error) {
923
924
  throw new Error(`Failed to load package.json config from ${filePath}: ${error}`);
924
925
  }
@@ -6615,7 +6616,7 @@ var init_shell_backend = __esm({
6615
6616
  this.parseAndEmitStreamingEvents(data, request.metadata?.sessionId || "unknown");
6616
6617
  } catch (error) {
6617
6618
  if (this.config.debug) {
6618
- engineLogger.warn(`JSON streaming parse error: ${error instanceof Error ? error.message : String(error)}`);
6619
+ engineLogger.warn(`Streaming parse error: ${error instanceof Error ? error.message : String(error)}`);
6619
6620
  }
6620
6621
  }
6621
6622
  }
@@ -6674,8 +6675,13 @@ var init_shell_backend = __esm({
6674
6675
  });
6675
6676
  }
6676
6677
  /**
6677
- * Parse JSON streaming events from script output
6678
- * Handles both generic StreamingEvent format and Claude CLI specific format
6678
+ * Parse streaming events from script output
6679
+ * Handles both JSON format (Claude) and TEXT format (Codex)
6680
+ *
6681
+ * Strategy:
6682
+ * 1. Try to parse each line as JSON first (for Claude)
6683
+ * 2. If JSON parsing fails, treat as TEXT streaming (for Codex and other text-based subagents)
6684
+ * 3. Emit all non-empty lines as progress events for real-time display
6679
6685
  */
6680
6686
  parseAndEmitStreamingEvents(data, sessionId) {
6681
6687
  if (!this.jsonBuffer) {
@@ -6687,11 +6693,13 @@ var init_shell_backend = __esm({
6687
6693
  for (const line of lines) {
6688
6694
  const trimmedLine = line.trim();
6689
6695
  if (!trimmedLine) continue;
6696
+ let isJsonParsed = false;
6690
6697
  try {
6691
6698
  const jsonEvent = JSON.parse(trimmedLine);
6692
6699
  let progressEvent;
6693
6700
  if (this.isClaudeCliEvent(jsonEvent)) {
6694
6701
  progressEvent = this.convertClaudeEventToProgress(jsonEvent, sessionId, trimmedLine);
6702
+ isJsonParsed = true;
6695
6703
  } else if (this.isGenericStreamingEvent(jsonEvent)) {
6696
6704
  progressEvent = {
6697
6705
  sessionId,
@@ -6702,33 +6710,39 @@ var init_shell_backend = __esm({
6702
6710
  content: jsonEvent.content,
6703
6711
  metadata: jsonEvent.metadata
6704
6712
  };
6713
+ isJsonParsed = true;
6705
6714
  } else {
6706
6715
  if (this.config?.debug) {
6707
- engineLogger.debug(`Unknown JSON format: ${trimmedLine}`);
6716
+ engineLogger.debug(`Unknown JSON format, treating as text: ${trimmedLine}`);
6708
6717
  }
6709
- continue;
6710
6718
  }
6711
- this.emitProgressEvent(progressEvent).catch((error) => {
6712
- if (this.config?.debug) {
6713
- engineLogger.warn(`Failed to emit progress event: ${error instanceof Error ? error.message : String(error)}`);
6714
- }
6715
- });
6716
- } catch (error) {
6717
- if (trimmedLine.length > 0 && !trimmedLine.startsWith("#")) {
6718
- this.emitProgressEvent({
6719
- sessionId,
6720
- timestamp: /* @__PURE__ */ new Date(),
6721
- backend: "shell",
6722
- count: ++this.eventCounter,
6723
- type: "thinking",
6724
- content: trimmedLine,
6725
- metadata: { raw: true, parseError: true }
6726
- }).catch((error2) => {
6719
+ if (isJsonParsed) {
6720
+ this.emitProgressEvent(progressEvent).catch((error) => {
6727
6721
  if (this.config?.debug) {
6728
- engineLogger.warn(`Failed to emit thinking event: ${error2 instanceof Error ? error2.message : String(error2)}`);
6722
+ engineLogger.warn(`Failed to emit progress event: ${error instanceof Error ? error.message : String(error)}`);
6729
6723
  }
6730
6724
  });
6731
6725
  }
6726
+ } catch (error) {
6727
+ isJsonParsed = false;
6728
+ }
6729
+ if (!isJsonParsed && trimmedLine.length > 0) {
6730
+ this.emitProgressEvent({
6731
+ sessionId,
6732
+ timestamp: /* @__PURE__ */ new Date(),
6733
+ backend: "shell",
6734
+ count: ++this.eventCounter,
6735
+ type: "thinking",
6736
+ content: trimmedLine,
6737
+ metadata: {
6738
+ format: "text",
6739
+ raw: true
6740
+ }
6741
+ }).catch((error) => {
6742
+ if (this.config?.debug) {
6743
+ engineLogger.warn(`Failed to emit text streaming event: ${error instanceof Error ? error.message : String(error)}`);
6744
+ }
6745
+ });
6732
6746
  }
6733
6747
  }
6734
6748
  }
@@ -15704,9 +15718,9 @@ ${variables.EDITOR ? `using ${variables.EDITOR} as primary AI subagent` : ""}
15704
15718
  async createMcpFile(junoTaskDir, targetDirectory) {
15705
15719
  const projectName = path3__namespace.basename(targetDirectory);
15706
15720
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
15707
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
15708
- const __dirname = path3__namespace.dirname(__filename);
15709
- process.env.JUNO_TASK_MCP_SERVER_PATH || path3__namespace.join(__dirname, "../../../roundtable_mcp_server/roundtable_mcp_server/server.py");
15721
+ const __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
15722
+ const __dirname2 = path3__namespace.dirname(__filename2);
15723
+ process.env.JUNO_TASK_MCP_SERVER_PATH || path3__namespace.join(__dirname2, "../../../roundtable_mcp_server/roundtable_mcp_server/server.py");
15710
15724
  const mcpContent = {
15711
15725
  mcpServers: {
15712
15726
  "roundtable-ai": {
@@ -15772,15 +15786,15 @@ ${variables.EDITOR ? `using ${variables.EDITOR} as primary AI subagent` : ""}
15772
15786
  try {
15773
15787
  const scriptsDir = path3__namespace.join(junoTaskDir, "scripts");
15774
15788
  await fs3__default.default.ensureDir(scriptsDir);
15775
- const __filename = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
15776
- const __dirname = path3__namespace.dirname(__filename);
15789
+ const __filename2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
15790
+ const __dirname2 = path3__namespace.dirname(__filename2);
15777
15791
  let templatesScriptsDir;
15778
- if (__dirname.includes("/dist/bin") || __dirname.includes("\\dist\\bin")) {
15779
- templatesScriptsDir = path3__namespace.join(__dirname, "../templates/scripts");
15780
- } else if (__dirname.includes("/src/cli/commands") || __dirname.includes("\\src\\cli\\commands")) {
15781
- templatesScriptsDir = path3__namespace.join(__dirname, "../../templates/scripts");
15792
+ if (__dirname2.includes("/dist/bin") || __dirname2.includes("\\dist\\bin")) {
15793
+ templatesScriptsDir = path3__namespace.join(__dirname2, "../templates/scripts");
15794
+ } else if (__dirname2.includes("/src/cli/commands") || __dirname2.includes("\\src\\cli\\commands")) {
15795
+ templatesScriptsDir = path3__namespace.join(__dirname2, "../../templates/scripts");
15782
15796
  } else {
15783
- templatesScriptsDir = path3__namespace.join(__dirname, "../../templates/scripts");
15797
+ templatesScriptsDir = path3__namespace.join(__dirname2, "../../templates/scripts");
15784
15798
  }
15785
15799
  if (!await fs3__default.default.pathExists(templatesScriptsDir)) {
15786
15800
  console.log(chalk12__default.default.yellow(" \u26A0\uFE0F Template scripts directory not found, skipping script installation"));
@@ -19468,8 +19482,8 @@ async function compactConfigFile(filePath, options = {}) {
19468
19482
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
19469
19483
  const ext = path3__namespace.extname(filePath);
19470
19484
  const basename11 = path3__namespace.basename(filePath, ext);
19471
- const dirname11 = path3__namespace.dirname(filePath);
19472
- backupPath = path3__namespace.join(dirname11, `${basename11}.backup.${timestamp}${ext}`);
19485
+ const dirname12 = path3__namespace.dirname(filePath);
19486
+ backupPath = path3__namespace.join(dirname12, `${basename11}.backup.${timestamp}${ext}`);
19473
19487
  await fs3__default.default.writeFile(backupPath, originalContent, "utf-8");
19474
19488
  }
19475
19489
  const compactionAnalysis = analyzeMarkdownStructure(originalContent);
@@ -24816,11 +24830,13 @@ var CompletionCommand = class {
24816
24830
  }
24817
24831
  };
24818
24832
  var completion_default = CompletionCommand;
24819
-
24820
- // src/bin/cli.ts
24821
24833
  util.inspect.defaultOptions.maxStringLength = Infinity;
24822
24834
  util.inspect.defaultOptions.breakLength = Infinity;
24823
- var VERSION = "1.0.0";
24835
+ var __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
24836
+ var __dirname$1 = path3.dirname(__filename$1);
24837
+ var require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('cli.js', document.baseURI).href)));
24838
+ var packageJson = require2(path3.join(__dirname$1, "../../package.json"));
24839
+ var VERSION = packageJson.version;
24824
24840
  function isConnectionLikeError(err) {
24825
24841
  const msg = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
24826
24842
  const lower = msg.toLowerCase();