acp-kernel 0.0.99-pr.477.345 → 0.0.99-pr.484.354

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/index.js CHANGED
@@ -1272,10 +1272,12 @@ function isNeverPreserveRecent(msg, patterns, preservePatterns) {
1272
1272
  return false;
1273
1273
  }
1274
1274
  function matchToolPattern(toolName, pattern) {
1275
- if (pattern.endsWith("*")) {
1276
- return toolName.startsWith(pattern.slice(0, -1));
1275
+ const name = toolName.toLowerCase();
1276
+ const pat = pattern.toLowerCase();
1277
+ if (pat.endsWith("*")) {
1278
+ return name.startsWith(pat.slice(0, -1));
1277
1279
  }
1278
- return toolName === pattern;
1280
+ return name === pat;
1279
1281
  }
1280
1282
  function isMessageProtected(msg, config) {
1281
1283
  if (msg.contentType !== "tool-call" && msg.contentType !== "tool-result" || !msg.toolName) {
@@ -7529,30 +7531,12 @@ function parseStringCore(cleaned, callId, diag) {
7529
7531
  if (value !== null && typeof value === "object" && !Array.isArray(value)) {
7530
7532
  return parseObjectValue(value, callId, diag);
7531
7533
  }
7532
- if (typeof value === "string") {
7533
- const recovered2 = salvageLineFormEntries(value, callId);
7534
- if (recovered2.ranges.length > 0)
7535
- return finishLineFormSalvage(recovered2, diag, false);
7536
- }
7537
7534
  if (value !== void 0) {
7538
7535
  diag.kind = "not-object";
7539
7536
  return finish([], diag);
7540
7537
  }
7541
- let entries = salvageContentEntries(cleaned);
7542
- let fromStringSlot = false;
7543
- if (entries.length === 0) {
7544
- entries = salvageStringSlotEntries(cleaned);
7545
- fromStringSlot = entries.length > 0;
7546
- }
7547
- if (entries.length > 0) {
7548
- const out = finishSalvage(entries, callId, diag, true);
7549
- if (fromStringSlot && out.ranges.length > 0) diag.contentSalvage = true;
7550
- return out;
7551
- }
7552
- const recovered = salvageLineFormEntries(cleaned, callId);
7553
- if (recovered.ranges.length > 0)
7554
- return finishLineFormSalvage(recovered, diag, looksTruncated(cleaned));
7555
- return finishSalvage([], callId, diag, looksTruncated(cleaned));
7538
+ const entries = salvageContentEntries(cleaned);
7539
+ return finishSalvage(entries, callId, diag, looksTruncated(cleaned));
7556
7540
  }
7557
7541
  function parseObjectValue(value, callId, diag) {
7558
7542
  diag.keys = Object.keys(value);
@@ -7574,11 +7558,11 @@ function parseObjectValue(value, callId, diag) {
7574
7558
  const parsed = parseContentArray(content);
7575
7559
  if (parsed === null || parsed.entries.length === 0 && content.trim().length > 0) {
7576
7560
  const bare = stripJsonWrapperResidue(content);
7577
- const entries2 = inlineSingleLineEntry(splitLineEntries(bare));
7561
+ const entries2 = splitLineEntries(bare);
7578
7562
  const { ranges: ranges2, invalid: invalid2, reasons: reasons2 } = validateEntries(entries2, callId);
7579
- diag.invalidItems = invalid2;
7580
- if (reasons2.length > 0) diag.invalidReasons = reasons2;
7581
7563
  if (ranges2.length > 0) {
7564
+ diag.invalidItems = invalid2;
7565
+ if (reasons2.length > 0) diag.invalidReasons = reasons2;
7582
7566
  diag.kind = "ok";
7583
7567
  return finish(ranges2, diag);
7584
7568
  }
@@ -8039,56 +8023,6 @@ function looksTruncated(s) {
8039
8023
  }
8040
8024
  return depth > 0 || inString;
8041
8025
  }
8042
- function inlineSingleLineEntry(entries) {
8043
- if (entries.length !== 1) return entries;
8044
- const e = entries[0];
8045
- if (typeof e !== "string" || e.includes("\n")) return entries;
8046
- const head = e.trim();
8047
- const m = REF_PAIR_IN_LINE.exec(head) ?? SINGLE_REF_IN_LINE.exec(head);
8048
- if (m === null) return entries;
8049
- const rest = head.slice(m.index + m[0].length).trim();
8050
- if (!/\p{L}|\p{N}/u.test(rest)) return entries;
8051
- return [m[0] + "\n" + rest];
8052
- }
8053
- function salvageLineFormEntries(text, callId) {
8054
- return validateEntries(
8055
- inlineSingleLineEntry(splitLineEntries(stripJsonWrapperResidue(text))),
8056
- callId
8057
- );
8058
- }
8059
- function finishLineFormSalvage(result, diag, truncatedShape) {
8060
- diag.stringSalvage = true;
8061
- diag.invalidItems = result.invalid;
8062
- if (result.reasons.length > 0) diag.invalidReasons = result.reasons;
8063
- diag.kind = truncatedShape ? "truncated" : "ok";
8064
- return finish(result.ranges, diag);
8065
- }
8066
- function salvageStringSlotEntries(raw) {
8067
- const match = /"content"\s*:\s*"/.exec(raw);
8068
- if (match === null) return [];
8069
- const start = match.index + match[0].length;
8070
- let i = start;
8071
- let terminated = false;
8072
- while (i < raw.length) {
8073
- const ch = raw.charAt(i);
8074
- if (ch === "\\") {
8075
- i += 2;
8076
- continue;
8077
- }
8078
- if (ch === '"') {
8079
- terminated = true;
8080
- break;
8081
- }
8082
- i++;
8083
- }
8084
- const body = raw.slice(start, i).replace(/\\n/g, "\n");
8085
- const parts = splitLineEntries(body);
8086
- if (!terminated) {
8087
- if (parts.length <= 1) return [];
8088
- parts.pop();
8089
- }
8090
- return parts;
8091
- }
8092
8026
  function salvageContentEntries(raw) {
8093
8027
  const match = /"content"\s*:\s*\[/.exec(raw);
8094
8028
  if (match === null) return [];