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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import fs3 from 'fs-extra';
3
3
  import * as path3 from 'path';
4
- import path3__default from 'path';
4
+ import path3__default, { dirname, join } from 'path';
5
5
  import * as os2 from 'os';
6
6
  import os2__default, { homedir, EOL } from 'os';
7
7
  import { fileURLToPath } from 'url';
@@ -30,6 +30,7 @@ import { v4 } from 'uuid';
30
30
  import whichPkg from 'which';
31
31
  import { glob } from 'glob';
32
32
  import fastGlob from 'fast-glob';
33
+ import { createRequire } from 'module';
33
34
 
34
35
  var __defProp = Object.defineProperty;
35
36
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -309,12 +310,12 @@ var init_service_installer = __esm({
309
310
  * Get the path to the services directory in the package
310
311
  */
311
312
  static getPackageServicesDir() {
312
- const __dirname = path3.dirname(fileURLToPath(import.meta.url));
313
- let servicesPath = path3.join(__dirname, "..", "..", "templates", "services");
313
+ const __dirname2 = path3.dirname(fileURLToPath(import.meta.url));
314
+ let servicesPath = path3.join(__dirname2, "..", "..", "templates", "services");
314
315
  if (fs3.existsSync(servicesPath)) {
315
316
  return servicesPath;
316
317
  }
317
- servicesPath = path3.join(__dirname, "..", "templates", "services");
318
+ servicesPath = path3.join(__dirname2, "..", "templates", "services");
318
319
  if (fs3.existsSync(servicesPath)) {
319
320
  return servicesPath;
320
321
  }
@@ -883,8 +884,8 @@ async function loadYamlConfig(filePath) {
883
884
  async function loadPackageJsonConfig(filePath) {
884
885
  try {
885
886
  const content = await promises.readFile(filePath, "utf-8");
886
- const packageJson = JSON.parse(content);
887
- return packageJson.junoCode || {};
887
+ const packageJson2 = JSON.parse(content);
888
+ return packageJson2.junoCode || {};
888
889
  } catch (error) {
889
890
  throw new Error(`Failed to load package.json config from ${filePath}: ${error}`);
890
891
  }
@@ -6581,7 +6582,7 @@ var init_shell_backend = __esm({
6581
6582
  this.parseAndEmitStreamingEvents(data, request.metadata?.sessionId || "unknown");
6582
6583
  } catch (error) {
6583
6584
  if (this.config.debug) {
6584
- engineLogger.warn(`JSON streaming parse error: ${error instanceof Error ? error.message : String(error)}`);
6585
+ engineLogger.warn(`Streaming parse error: ${error instanceof Error ? error.message : String(error)}`);
6585
6586
  }
6586
6587
  }
6587
6588
  }
@@ -6640,8 +6641,13 @@ var init_shell_backend = __esm({
6640
6641
  });
6641
6642
  }
6642
6643
  /**
6643
- * Parse JSON streaming events from script output
6644
- * Handles both generic StreamingEvent format and Claude CLI specific format
6644
+ * Parse streaming events from script output
6645
+ * Handles both JSON format (Claude) and TEXT format (Codex)
6646
+ *
6647
+ * Strategy:
6648
+ * 1. Try to parse each line as JSON first (for Claude)
6649
+ * 2. If JSON parsing fails, treat as TEXT streaming (for Codex and other text-based subagents)
6650
+ * 3. Emit all non-empty lines as progress events for real-time display
6645
6651
  */
6646
6652
  parseAndEmitStreamingEvents(data, sessionId) {
6647
6653
  if (!this.jsonBuffer) {
@@ -6653,11 +6659,13 @@ var init_shell_backend = __esm({
6653
6659
  for (const line of lines) {
6654
6660
  const trimmedLine = line.trim();
6655
6661
  if (!trimmedLine) continue;
6662
+ let isJsonParsed = false;
6656
6663
  try {
6657
6664
  const jsonEvent = JSON.parse(trimmedLine);
6658
6665
  let progressEvent;
6659
6666
  if (this.isClaudeCliEvent(jsonEvent)) {
6660
6667
  progressEvent = this.convertClaudeEventToProgress(jsonEvent, sessionId, trimmedLine);
6668
+ isJsonParsed = true;
6661
6669
  } else if (this.isGenericStreamingEvent(jsonEvent)) {
6662
6670
  progressEvent = {
6663
6671
  sessionId,
@@ -6668,33 +6676,39 @@ var init_shell_backend = __esm({
6668
6676
  content: jsonEvent.content,
6669
6677
  metadata: jsonEvent.metadata
6670
6678
  };
6679
+ isJsonParsed = true;
6671
6680
  } else {
6672
6681
  if (this.config?.debug) {
6673
- engineLogger.debug(`Unknown JSON format: ${trimmedLine}`);
6682
+ engineLogger.debug(`Unknown JSON format, treating as text: ${trimmedLine}`);
6674
6683
  }
6675
- continue;
6676
6684
  }
6677
- this.emitProgressEvent(progressEvent).catch((error) => {
6678
- if (this.config?.debug) {
6679
- engineLogger.warn(`Failed to emit progress event: ${error instanceof Error ? error.message : String(error)}`);
6680
- }
6681
- });
6682
- } catch (error) {
6683
- if (trimmedLine.length > 0 && !trimmedLine.startsWith("#")) {
6684
- this.emitProgressEvent({
6685
- sessionId,
6686
- timestamp: /* @__PURE__ */ new Date(),
6687
- backend: "shell",
6688
- count: ++this.eventCounter,
6689
- type: "thinking",
6690
- content: trimmedLine,
6691
- metadata: { raw: true, parseError: true }
6692
- }).catch((error2) => {
6685
+ if (isJsonParsed) {
6686
+ this.emitProgressEvent(progressEvent).catch((error) => {
6693
6687
  if (this.config?.debug) {
6694
- engineLogger.warn(`Failed to emit thinking event: ${error2 instanceof Error ? error2.message : String(error2)}`);
6688
+ engineLogger.warn(`Failed to emit progress event: ${error instanceof Error ? error.message : String(error)}`);
6695
6689
  }
6696
6690
  });
6697
6691
  }
6692
+ } catch (error) {
6693
+ isJsonParsed = false;
6694
+ }
6695
+ if (!isJsonParsed && trimmedLine.length > 0) {
6696
+ this.emitProgressEvent({
6697
+ sessionId,
6698
+ timestamp: /* @__PURE__ */ new Date(),
6699
+ backend: "shell",
6700
+ count: ++this.eventCounter,
6701
+ type: "thinking",
6702
+ content: trimmedLine,
6703
+ metadata: {
6704
+ format: "text",
6705
+ raw: true
6706
+ }
6707
+ }).catch((error) => {
6708
+ if (this.config?.debug) {
6709
+ engineLogger.warn(`Failed to emit text streaming event: ${error instanceof Error ? error.message : String(error)}`);
6710
+ }
6711
+ });
6698
6712
  }
6699
6713
  }
6700
6714
  }
@@ -15670,9 +15684,9 @@ ${variables.EDITOR ? `using ${variables.EDITOR} as primary AI subagent` : ""}
15670
15684
  async createMcpFile(junoTaskDir, targetDirectory) {
15671
15685
  const projectName = path3.basename(targetDirectory);
15672
15686
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
15673
- const __filename = fileURLToPath(import.meta.url);
15674
- const __dirname = path3.dirname(__filename);
15675
- process.env.JUNO_TASK_MCP_SERVER_PATH || path3.join(__dirname, "../../../roundtable_mcp_server/roundtable_mcp_server/server.py");
15687
+ const __filename2 = fileURLToPath(import.meta.url);
15688
+ const __dirname2 = path3.dirname(__filename2);
15689
+ process.env.JUNO_TASK_MCP_SERVER_PATH || path3.join(__dirname2, "../../../roundtable_mcp_server/roundtable_mcp_server/server.py");
15676
15690
  const mcpContent = {
15677
15691
  mcpServers: {
15678
15692
  "roundtable-ai": {
@@ -15738,15 +15752,15 @@ ${variables.EDITOR ? `using ${variables.EDITOR} as primary AI subagent` : ""}
15738
15752
  try {
15739
15753
  const scriptsDir = path3.join(junoTaskDir, "scripts");
15740
15754
  await fs3.ensureDir(scriptsDir);
15741
- const __filename = fileURLToPath(import.meta.url);
15742
- const __dirname = path3.dirname(__filename);
15755
+ const __filename2 = fileURLToPath(import.meta.url);
15756
+ const __dirname2 = path3.dirname(__filename2);
15743
15757
  let templatesScriptsDir;
15744
- if (__dirname.includes("/dist/bin") || __dirname.includes("\\dist\\bin")) {
15745
- templatesScriptsDir = path3.join(__dirname, "../templates/scripts");
15746
- } else if (__dirname.includes("/src/cli/commands") || __dirname.includes("\\src\\cli\\commands")) {
15747
- templatesScriptsDir = path3.join(__dirname, "../../templates/scripts");
15758
+ if (__dirname2.includes("/dist/bin") || __dirname2.includes("\\dist\\bin")) {
15759
+ templatesScriptsDir = path3.join(__dirname2, "../templates/scripts");
15760
+ } else if (__dirname2.includes("/src/cli/commands") || __dirname2.includes("\\src\\cli\\commands")) {
15761
+ templatesScriptsDir = path3.join(__dirname2, "../../templates/scripts");
15748
15762
  } else {
15749
- templatesScriptsDir = path3.join(__dirname, "../../templates/scripts");
15763
+ templatesScriptsDir = path3.join(__dirname2, "../../templates/scripts");
15750
15764
  }
15751
15765
  if (!await fs3.pathExists(templatesScriptsDir)) {
15752
15766
  console.log(chalk12.yellow(" \u26A0\uFE0F Template scripts directory not found, skipping script installation"));
@@ -19434,8 +19448,8 @@ async function compactConfigFile(filePath, options = {}) {
19434
19448
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
19435
19449
  const ext = path3.extname(filePath);
19436
19450
  const basename11 = path3.basename(filePath, ext);
19437
- const dirname11 = path3.dirname(filePath);
19438
- backupPath = path3.join(dirname11, `${basename11}.backup.${timestamp}${ext}`);
19451
+ const dirname12 = path3.dirname(filePath);
19452
+ backupPath = path3.join(dirname12, `${basename11}.backup.${timestamp}${ext}`);
19439
19453
  await fs3.writeFile(backupPath, originalContent, "utf-8");
19440
19454
  }
19441
19455
  const compactionAnalysis = analyzeMarkdownStructure(originalContent);
@@ -24782,11 +24796,13 @@ var CompletionCommand = class {
24782
24796
  }
24783
24797
  };
24784
24798
  var completion_default = CompletionCommand;
24785
-
24786
- // src/bin/cli.ts
24787
24799
  inspect.defaultOptions.maxStringLength = Infinity;
24788
24800
  inspect.defaultOptions.breakLength = Infinity;
24789
- var VERSION = "1.0.0";
24801
+ var __filename = fileURLToPath(import.meta.url);
24802
+ var __dirname = dirname(__filename);
24803
+ var require2 = createRequire(import.meta.url);
24804
+ var packageJson = require2(join(__dirname, "../../package.json"));
24805
+ var VERSION = packageJson.version;
24790
24806
  function isConnectionLikeError(err) {
24791
24807
  const msg = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
24792
24808
  const lower = msg.toLowerCase();