@bonginkan/maria 4.3.40 → 4.3.41

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/cli.cjs CHANGED
@@ -1709,7 +1709,7 @@ var init_AuthenticationManager = __esm({
1709
1709
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
1710
1710
  headers: {
1711
1711
  "Authorization": `Bearer ${tokens2.accessToken}`,
1712
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.40"}`
1712
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.41"}`
1713
1713
  }
1714
1714
  });
1715
1715
  if (response.status === 401) {
@@ -2434,7 +2434,7 @@ async function callApi(path65, init3 = {}) {
2434
2434
  "Authorization": `Bearer ${token}`,
2435
2435
  "X-Device-Id": getDeviceId(),
2436
2436
  "X-Session-Id": getSessionId() || "",
2437
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.40"}`,
2437
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.41"}`,
2438
2438
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
2439
2439
  });
2440
2440
  const doFetch = async (token) => {
@@ -16382,8 +16382,8 @@ var require_package = __commonJS({
16382
16382
  "package.json"(exports, module) {
16383
16383
  module.exports = {
16384
16384
  name: "@bonginkan/maria",
16385
- version: "4.3.40",
16386
- description: "\u{1F680} MARIA v4.3.40 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16385
+ version: "4.3.41",
16386
+ description: "\u{1F680} MARIA v4.3.41 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
16387
16387
  keywords: [
16388
16388
  "ai",
16389
16389
  "cli",
@@ -26389,7 +26389,7 @@ var init_about_command = __esm({
26389
26389
  async execute(args2, context2) {
26390
26390
  const output3 = [];
26391
26391
  output3.push("");
26392
- output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.40"));
26392
+ output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.41"));
26393
26393
  output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
26394
26394
  output3.push("");
26395
26395
  output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -39846,20 +39846,6 @@ var init_policy = __esm({
39846
39846
  }
39847
39847
  });
39848
39848
 
39849
- // src/utils/esm-compat.ts
39850
- var esm_compat_exports = {};
39851
- __export(esm_compat_exports, {
39852
- loadGlobby: () => loadGlobby
39853
- });
39854
- async function loadGlobby() {
39855
- const mod = await import('globby');
39856
- return mod?.globby ?? mod?.default ?? mod;
39857
- }
39858
- var init_esm_compat = __esm({
39859
- "src/utils/esm-compat.ts"() {
39860
- }
39861
- });
39862
-
39863
39849
  // src/services/code-orchestrator/Orchestrator.ts
39864
39850
  var Orchestrator_exports = {};
39865
39851
  __export(Orchestrator_exports, {
@@ -39933,6 +39919,14 @@ async function readHeadTail(root, rel, n) {
39933
39919
  return { head: "", tail: "" };
39934
39920
  }
39935
39921
  }
39922
+ function extractJsonSafe(text, kind) {
39923
+ if (!text) return null;
39924
+ const fenceRegex = /```\s*(json)?\s*\r?\n([\s\S]*?)```/i;
39925
+ const fence = fenceRegex.exec(text);
39926
+ if (fence && fence[2]) text = fence[2];
39927
+ const match2 = kind === "object" ? text.match(/\{[\s\S]*\}/) : text.match(/\[[\s\S]*\]/);
39928
+ return match2 ? match2[0] : null;
39929
+ }
39936
39930
  async function llmSelectEditTargets(root, request, repoFiles) {
39937
39931
  try {
39938
39932
  const candidates = repoFiles.filter((p) => /\.(html|css|js|ts|tsx)$/i.test(p)).slice(0, 150);
@@ -39945,7 +39939,7 @@ ${h2.head}`);
39945
39939
  const system = [
39946
39940
  "You select existing repository files that should be EDITED to satisfy a user request.",
39947
39941
  "Consider path names and the first lines. Return JSON array of repo-relative paths to edit.",
39948
- "Keep the list short (<= 10). If none are relevant, return []. Do not invent paths."
39942
+ "If none are relevant, return []. Do not invent paths."
39949
39943
  ].join("\n");
39950
39944
  const user = [`Request: ${request}`, "Candidates:", samples.join("\n\n")].join("\n\n");
39951
39945
  const resp = await executeChat([
@@ -40065,9 +40059,10 @@ async function orchestrate(request, opts) {
40065
40059
  explicitAbsMap[rel] = pathMod.join(opts.root, rel);
40066
40060
  }
40067
40061
  }
40068
- const isEditIntent = await detectEditIntentEnhanced(opts.root, request, {
40069
- hasAttachments: !!(opts.attachedFiles && opts.attachedFiles.length > 0),
40070
- explicitFiles});
40062
+ const isEditIntent = await detectEditIntentLLM(opts.root, request, {
40063
+ explicitFiles,
40064
+ attachmentsCount: Array.isArray(opts.attachedFiles) ? opts.attachedFiles.length : 0
40065
+ });
40071
40066
  let editTargets = explicitFiles;
40072
40067
  if (isEditIntent && editTargets.length === 0) {
40073
40068
  try {
@@ -40171,7 +40166,6 @@ ${editContext}`;
40171
40166
  if (attachedPathSet.has(key)) continue;
40172
40167
  const stat13 = await fs52.stat(full).catch(() => null);
40173
40168
  if (!stat13 || !stat13.isFile()) continue;
40174
- const ext2 = (pathMod.extname(full) || "").toLowerCase();
40175
40169
  const buf = await fs52.readFile(full);
40176
40170
  pathAttachments.push({
40177
40171
  name: pathMod.basename(full),
@@ -40427,7 +40421,7 @@ ${editContext}`;
40427
40421
  }
40428
40422
  }
40429
40423
  const allowOverwrite = opts.flags.overwriteAllowed === true || !!opts.flags.yes || isEditIntent;
40430
- const applyRes = await applyPlans(approved, { root: opts.root, overwriteAllowed: allowOverwrite, rollback: opts.flags.rollback !== false, signal: opts.abortSignal, onProgress: (w, t2) => {
40424
+ const applyRes = await applyPlans(approved, { root: opts.root, overwriteAllowed: allowOverwrite, rollback: opts.flags.rollback !== false, signal: opts.abortSignal, onProgress: () => {
40431
40425
  }, eol: profile.eol });
40432
40426
  appliedCount = applyRes.appliedCount;
40433
40427
  durationMs = applyRes.durationMs;
@@ -40707,73 +40701,50 @@ function parseExplicitFilenames(request) {
40707
40701
  }
40708
40702
  return out;
40709
40703
  }
40710
- function detectEditIntent(request, ctx2) {
40711
- const r2 = request.toLowerCase();
40712
- const editKeywords = ["modify", "edit", "update", "fix", "refactor", "change", "patch", "\u5DEE\u5206", "\u4FEE\u6B63", "\u5909\u66F4", "\u65E2\u5B58", "\u8FFD\u8A18"];
40713
- const mentionsEdit = editKeywords.some((k) => r2.includes(k));
40714
- return ctx2.hasAttachments || ctx2.explicitFilesCount > 0 || mentionsEdit;
40715
- }
40716
- async function detectEditIntentEnhanced(root, request, ctx2) {
40717
- const baseline = detectEditIntent(request, { hasAttachments: ctx2.hasAttachments, explicitFilesCount: ctx2.explicitFiles.length });
40718
- if (baseline) return true;
40719
- const r2 = request.toLowerCase();
40720
- const softHints = ["improve", "enhance", "make it", "change the", "adjust", "tweak", "rework", "revamp", "retro", "modernize", "clean up", "polish"];
40721
- const hasSoftHint = softHints.some((k) => r2.includes(k));
40722
- if (!hasSoftHint) return false;
40723
- try {
40724
- const fs52 = await import('fs/promises');
40725
- const pathMod = await import('path');
40726
- const { loadGlobby: loadGlobby2 } = await Promise.resolve().then(() => (init_esm_compat(), esm_compat_exports));
40727
- const globby = await loadGlobby2();
40728
- const ignore = [
40729
- "**/node_modules/**",
40730
- "**/.git/**",
40731
- "**/dist/**",
40732
- "**/build/**",
40733
- "**/.maria/**",
40734
- "**/.next/**",
40735
- "**/coverage/**",
40736
- "**/.DS_Store/**",
40737
- "**/.DS_Store",
40738
- "**/.Spotlight-V100/**",
40739
- "**/.Spotlight-V100",
40740
- "**/.Trashes/**",
40741
- "**/.Trashes",
40742
- "**/.fseventsd/**",
40743
- "**/.fseventsd",
40744
- "**/.TemporaryItems/**",
40745
- "**/.TemporaryItems"
40746
- ];
40747
- const candidates = await globby(["**/*.{html,css,js,ts,tsx}"], { cwd: root, absolute: true, gitignore: true, ignore, deep: 3 });
40748
- if (candidates && candidates.length > 0) return true;
40749
- } catch {
40750
- }
40704
+ async function detectEditIntentLLM(root, request, ctx2) {
40751
40705
  try {
40752
- const short = request.trim().length <= 160;
40753
- if (!short) return false;
40706
+ const repoFiles = await getRepoFiles(root);
40707
+ const candidates = repoFiles;
40708
+ const headSnippets = [];
40709
+ for (const p of candidates) {
40710
+ const h2 = await readHeadTail(root, p, 5);
40711
+ headSnippets.push(`- ${p}
40712
+ ${h2.head}`);
40713
+ }
40754
40714
  const system = [
40755
- "You are classifying whether the user intends to EDIT existing files vs CREATE a new project.",
40756
- 'Return JSON: { "edit": true|false } only.'
40715
+ "Classify the user intent for the MARIA code orchestrator.",
40716
+ "Decide strictly between EDIT_EXISTING (modify existing files) or CREATE_NEW (generate new project/files).",
40717
+ "User is likely to have EDIT_EXITING intent when:",
40718
+ "- the coding language is not specified",
40719
+ "- it has a clear and/or relevant path of the file/directory exists",
40720
+ "- it has attachments",
40721
+ "- the wording implies modifying existing files (ex. fix, improve, update, change, patch, make it, clean up, etc.)",
40722
+ 'Return JSON: { "intent": "EDIT_EXISTING" | "CREATE_NEW" } only. No commentary.'
40757
40723
  ].join("\n");
40758
- const user = `Instruction: ${request}`;
40724
+ const user = [
40725
+ `Request: ${request}`,
40726
+ `ExplicitFiles: ${JSON.stringify(ctx2.explicitFiles || [])}`,
40727
+ `AttachmentsCount: ${ctx2.attachmentsCount}`,
40728
+ "Repo snapshot (paths with file heads):",
40729
+ headSnippets.join("\n\n")
40730
+ ].join("\n\n");
40731
+ const spin1 = new ProcessAnimation();
40732
+ spin1.start();
40759
40733
  const resp = await executeChat([
40760
40734
  { role: "system", content: system },
40761
40735
  { role: "user", content: user }
40762
40736
  ]);
40737
+ try {
40738
+ spin1.stop();
40739
+ } catch {
40740
+ }
40763
40741
  const raw = (resp?.output || "").trim();
40764
- const jsonText = (() => {
40765
- try {
40766
- const m2 = raw.match(/\{[\s\S]*\}/);
40767
- return m2 ? m2[0] : raw;
40768
- } catch {
40769
- return raw;
40770
- }
40771
- })();
40742
+ const jsonText = extractJsonSafe(raw, "object") || raw;
40772
40743
  const parsed = JSON.parse(jsonText);
40773
- if (typeof parsed?.edit === "boolean") return !!parsed.edit;
40744
+ return parsed?.intent === "EDIT_EXISTING";
40774
40745
  } catch {
40746
+ return ctx2.explicitFiles && ctx2.explicitFiles.length > 0 || ctx2.attachmentsCount > 0;
40775
40747
  }
40776
- return false;
40777
40748
  }
40778
40749
  function sanitizeFolderName(name2) {
40779
40750
  const base = name2.toLowerCase().replace(/[`~!@#$%^&*()+=\[\]{}|;:'",<>/?\\]/g, " ").replace(/\s+/g, "-").replace(/^-+|-+$/g, "").slice(0, 48);
@@ -40895,7 +40866,6 @@ async function resolveExplicitPaths(root, files, hintText) {
40895
40866
  const lowerRel = normalized.toLowerCase();
40896
40867
  const ext2 = (pathMod.extname(normalized) || "").toLowerCase();
40897
40868
  const base = pathMod.basename(normalized);
40898
- base.replace(/\.[^.]+$/, "").toLowerCase();
40899
40869
  const parentPath = pathMod.dirname(normalized);
40900
40870
  const parent = parentPath.split("/").pop() || "";
40901
40871
  const dirParts = parentPath === "." ? [] : parentPath.split("/").filter(Boolean).map((s2) => s2.toLowerCase());
@@ -41056,6 +41026,7 @@ var init_Orchestrator = __esm({
41056
41026
  init_AttachmentMapper();
41057
41027
  init_FallbackManager();
41058
41028
  init_policy();
41029
+ init_animations();
41059
41030
  codeFallbackManager = null;
41060
41031
  _repoFileIndexCache = null;
41061
41032
  codeFallbackPolicySignature = null;
@@ -42546,6 +42517,16 @@ var init_loader = __esm({
42546
42517
  }
42547
42518
  });
42548
42519
 
42520
+ // src/utils/esm-compat.ts
42521
+ async function loadGlobby() {
42522
+ const mod = await import('globby');
42523
+ return mod?.globby ?? mod?.default ?? mod;
42524
+ }
42525
+ var init_esm_compat = __esm({
42526
+ "src/utils/esm-compat.ts"() {
42527
+ }
42528
+ });
42529
+
42549
42530
  // src/services/init/scanner.ts
42550
42531
  var scanner_exports = {};
42551
42532
  __export(scanner_exports, {