@bonginkan/maria 4.3.43 → 4.3.45

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.43"}`
1712
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.45"}`
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.43"}`,
2437
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.45"}`,
2438
2438
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
2439
2439
  });
2440
2440
  const doFetch = async (token) => {
@@ -16416,8 +16416,8 @@ var require_package = __commonJS({
16416
16416
  "package.json"(exports, module) {
16417
16417
  module.exports = {
16418
16418
  name: "@bonginkan/maria",
16419
- version: "4.3.43",
16420
- description: "\u{1F680} MARIA v4.3.43 - 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.",
16419
+ version: "4.3.45",
16420
+ description: "\u{1F680} MARIA v4.3.45 - 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.",
16421
16421
  keywords: [
16422
16422
  "ai",
16423
16423
  "cli",
@@ -24411,7 +24411,10 @@ var init_video_command = __esm({
24411
24411
  const base = (process.env.MARIA_API_BASE || "https://api.maria-code.ai").replace(/\/$/, "");
24412
24412
  const savedPaths = [];
24413
24413
  const baseDir = "video";
24414
- const promptPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_").replace(/[^A-Za-z0-9_\-]/g, "_") || "untitled";
24414
+ const rawPrefix = (cli.prompt || "").slice(0, 20).replace(/\s+/g, "_");
24415
+ let promptPrefix = rawPrefix.replace(/[\x00-\x1F<>:"/\\|?*]/g, "_").replace(/[. ]+$/g, "");
24416
+ if (!promptPrefix) promptPrefix = "untitled";
24417
+ if (/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(promptPrefix)) promptPrefix = `${promptPrefix}_`;
24415
24418
  const utc = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
24416
24419
  let idx = 0;
24417
24420
  for (const relRaw of filesFromApi) {
@@ -26423,7 +26426,7 @@ var init_about_command = __esm({
26423
26426
  async execute(args2, context2) {
26424
26427
  const output3 = [];
26425
26428
  output3.push("");
26426
- output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.43"));
26429
+ output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.45"));
26427
26430
  output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
26428
26431
  output3.push("");
26429
26432
  output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -39996,47 +39999,68 @@ ${h2.head}`);
39996
39999
  return [];
39997
40000
  }
39998
40001
  }
39999
- async function llmMapBlockToFile(root, request, block, repoFiles) {
40002
+ async function llmMapBlocksBatch(root, request, blocks, repoFiles) {
40000
40003
  try {
40001
- const lang = (block.language || "").toLowerCase();
40002
- const extFilter = lang.includes("html") ? /\.html$/i : /(ts|tsx)/.test(lang) ? /\.(ts|tsx)$/i : /(js|jsx)/.test(lang) ? /\.(js|jsx)$/i : /\.css$/i;
40003
- const candidates = repoFiles.filter((p) => extFilter.test(p)).slice(0, 80);
40004
- const head2 = block.code.split(/\r?\n/).slice(0, 20).join("\n");
40004
+ const candidates = repoFiles.filter((p) => /\.(html|css|js|ts|tsx)$/i.test(p)).slice(0, 120);
40005
+ const blockSnippets = blocks.slice(0, 20).map((b, i2) => {
40006
+ const head2 = (b.code || "").split(/\r?\n/).slice(0, 20).join("\n");
40007
+ return `# block ${i2}
40008
+
40009
+ \`\`\`
40010
+ ${head2}
40011
+ \`\`\``;
40012
+ }).join("\n\n");
40005
40013
  const samples = [];
40006
- for (const p of candidates.slice(0, 40)) {
40014
+ for (const p of candidates.slice(0, 60)) {
40007
40015
  const h2 = await readHeadTail(root, p, 8);
40008
40016
  samples.push(`- ${p}
40009
40017
  ${h2.head}`);
40010
40018
  }
40011
40019
  const system = [
40012
- "Decide where to apply an EDIT vs CREATE for a code block within an existing repository.",
40013
- 'Return JSON: { "action": "modify"|"create", "path": string }.',
40014
- "If modify, path must be one of the candidate repo-relative paths. If create, propose a sensible repo-relative path."
40020
+ "For each provided code block, decide whether to MODIFY an existing repo file or CREATE a new file.",
40021
+ 'Return JSON array of objects: [{ "index": number, "action": "modify"|"create", "path": string }].',
40022
+ "When action is modify, path MUST be one of the candidate repo-relative paths listed."
40015
40023
  ].join("\n");
40016
40024
  const user = [
40017
40025
  `Request: ${request}`,
40018
- "Block:",
40019
- "```",
40020
- head2,
40021
- "```",
40026
+ "Blocks:",
40027
+ blockSnippets,
40022
40028
  "Candidates:",
40023
40029
  samples.join("\n\n")
40024
- ].join("\n");
40030
+ ].join("\n\n");
40031
+ const spin = new ProcessAnimation();
40032
+ spin.start();
40025
40033
  const resp = await executeChat([
40026
40034
  { role: "system", content: system },
40027
40035
  { role: "user", content: user }
40028
40036
  ]);
40037
+ try {
40038
+ spin.stop();
40039
+ } catch {
40040
+ }
40029
40041
  const raw = (resp?.output || "").trim();
40030
- const jsonText = extractJsonSafe(raw, "object") || raw;
40031
- const parsed = JSON.parse(jsonText);
40032
- if (parsed && (parsed.action === "modify" || parsed.action === "create") && typeof parsed.path === "string") {
40033
- return { action: parsed.action, path: parsed.path.replace(/^\/+/, "") };
40042
+ const jsonText = extractJsonSafe(raw, "array") || raw;
40043
+ const arr = JSON.parse(jsonText);
40044
+ const set = new Set(candidates.map((c) => c.toLowerCase()));
40045
+ const out = [];
40046
+ if (Array.isArray(arr)) {
40047
+ for (const item of arr) {
40048
+ const idx = typeof item?.index === "number" ? item.index : -1;
40049
+ const action = item?.action === "modify" ? "modify" : "create";
40050
+ const path65 = typeof item?.path === "string" ? String(item.path) : "";
40051
+ if (idx >= 0 && idx < blocks.length) {
40052
+ if (action === "modify" && set.has(path65.toLowerCase())) out[idx] = { action, path: path65.replace(/^\/+/, "") };
40053
+ else out[idx] = { action: "create", path: path65 || suggestName2(request, blocks[idx].language || "javascript", idx) };
40054
+ }
40055
+ }
40056
+ }
40057
+ for (let i2 = 0; i2 < blocks.length; i2++) {
40058
+ if (!out[i2]) out[i2] = { action: "create", path: suggestName2(request, blocks[i2].language || "javascript", i2) };
40034
40059
  }
40060
+ return out;
40035
40061
  } catch {
40062
+ return blocks.map((b, i2) => ({ action: "create", path: suggestName2(request, b.language || "javascript", i2) }));
40036
40063
  }
40037
- const desired = typeof block.filename === "string" && block.filename.trim() ? block.filename.trim() : null;
40038
- const fallback2 = desired || suggestName2(request, block.language, 0);
40039
- return { action: "create", path: fallback2 };
40040
40064
  }
40041
40065
  function tokenizeRequest(text) {
40042
40066
  return Array.from(new Set(text.toLowerCase().replace(/[^a-z0-9_-]+/g, " ").split(/\s+/).filter((t2) => t2.length >= 3)));
@@ -40306,15 +40330,16 @@ ${editContext}`;
40306
40330
  } else {
40307
40331
  try {
40308
40332
  const repoFiles = await getRepoFiles(opts.root);
40333
+ const decisions = await llmMapBlocksBatch(opts.root, request, blocks, repoFiles);
40309
40334
  for (let i2 = 0; i2 < blocks.length; i2++) {
40310
40335
  const b = blocks[i2];
40311
- const decision = await llmMapBlockToFile(opts.root, request, b, repoFiles);
40312
- if (decision.action === "modify" && repoFiles.includes(decision.path)) {
40313
- const lang = languageFromExt(decision.path.replace(/^.*(\.[a-z0-9]+)$/i, "$1"));
40314
- initial.push({ path: decision.path, kind: "source", action: "modify", description: "Modify existing file", language: lang, preview: b.code });
40336
+ const d = decisions[i2] || { action: "create", path: suggestName2(request, b.language, i2) };
40337
+ if (d.action === "modify" && repoFiles.includes(d.path)) {
40338
+ const lang = languageFromExt(d.path.replace(/^.*(\.[a-z0-9]+)$/i, "$1"));
40339
+ initial.push({ path: d.path, kind: "source", action: "modify", description: "Modify existing file", language: lang, preview: b.code });
40315
40340
  } else {
40316
- const path65 = decision.path || suggestName2(request, b.language, i2);
40317
- initial.push({ path: path65, kind: "source", action: "create", description: describe2(b.language, ""), language: b.language, preview: b.code });
40341
+ const pth = d.path || suggestName2(request, b.language, i2);
40342
+ initial.push({ path: pth, kind: "source", action: "create", description: describe2(b.language, ""), language: b.language, preview: b.code });
40318
40343
  }
40319
40344
  }
40320
40345
  } catch {