portable-agent-layer 0.85.1 → 0.85.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "portable-agent-layer",
3
- "version": "0.85.1",
3
+ "version": "0.85.2",
4
4
  "description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,13 +9,16 @@ import { extractKeywords, similarity } from "./text-similarity";
9
9
  export type Reaction = "corrected" | "repeated" | "approved" | "new-topic" | "follow-up";
10
10
 
11
11
  const CORRECTION_RE =
12
- /^(?:(?:no|nope|wrong)(?:[,.!]|$)|(?:that'?s|this is|it'?s) (?:wrong|not)\b|not what i\b|i said\b|i told you\b|you forgot\b|you missed\b|still (?:broken|failing|wrong)\b)/i;
12
+ /^(?:(?:no|nope|wrong)(?:[,.!]|$)|(?:that'?s|this is|it'?s) (?:wrong|not)\b|not what i\b|i said\b|i told you\b|you forgot\b|you missed\b|still (?:broken|failing|wrong)\b|i don'?t see (?:the|your) (?!(?:problem|issue|point|harm|difference|need|reason)\b))/i;
13
+
14
+ const CLAIM_DISPUTED_RE =
15
+ /\byou(?:'re| are) (?:partially |partly |completely |totally )?wrong\b|\b(?:isn'?t|wasn'?t|aren'?t|weren'?t) (?:added|included|fixed|pushed|committed|applied|merged)\b/i;
13
16
 
14
17
  const APPROVAL_RE =
15
- /^(?:good|great|nice|perfect|cool|amazing|awesome|excellent|brilliant|works|it works|thanks|thank you|thx|y+e+s+|yep|yeah|yup|sure|exactly|correct|agreed|lgtm|well done|love it|sounds good|looks good|that'?s it|(?:it|this|that) (?:is|'s) (?:fine|good|great|right))\b/i;
18
+ /^(?:(?:understood|got it|ok(?:ay)?),?\s+)?(?:good|great|nice|perfect|cool|amazing|awesome|excellent|brilliant|works|it works|thanks|thank you|thx|y+e+s+|yep|yeah|yup|sure|exactly|correct|agreed|lgtm|well done|love it|sounds good|looks good|that'?s it|(?:it|this|that) (?:is|'s) (?:fine|good|great|right))\b/i;
16
19
 
17
20
  const GO_AHEAD_RE =
18
- /^(?:go ahead|go|do it|proceed|continue|merge|push|ship|commit|build|start|fix (?:all|them|both)|approved|let'?s (?:see|do|go))\b/i;
21
+ /^(?:go ahead|go|do it|proceed|continue|merge|push|ship|commit|build|start|fix (?:all|them|both)|approved|let'?s (?:see|do|go|build|start|fix|ship)|(?:add|do|fix) (?:it )?(?:pls|please))\b/i;
19
22
 
20
23
  const NEW_TOPIC_RE =
21
24
  /^(?:(?:ok(?:ay)?|btw|also),?\s+)?(?:new (?:\w+ ){0,2}(?:task|topic|question|thing)|(?:different|unrelated|separate|another) (?:task|topic|question|thing)|unrelated\b|switching (?:gears|topics?)|change of (?:topic|subject))/i;
@@ -23,11 +26,13 @@ const NEW_TOPIC_RE =
23
26
  const GO_AHEAD_MAX_WORDS = 6;
24
27
  const BARE_OK_RE = /^(?:ok(?:ay)?|k)[,.!]?(?:\s+\S+){0,2}$/i;
25
28
  const HEDGE_RE = /\b(?:but|however|though|except|instead)\b/i;
29
+ const FAILURE_RE = /\b(?:fail(?:ed|s|ing)?|broken|broke|errors?|crash(?:ed|es)?)\b/i;
26
30
  const REPEAT_SIMILARITY = 0.6;
27
31
  const REPEAT_MIN_KEYWORDS = 5;
28
32
 
29
33
  export function isCorrection(text: string): boolean {
30
- return CORRECTION_RE.test(text.trim());
34
+ const trimmed = text.trim();
35
+ return CORRECTION_RE.test(trimmed) || CLAIM_DISPUTED_RE.test(trimmed);
31
36
  }
32
37
 
33
38
  export function isRepeat(text: string, previous: string | undefined): boolean {
@@ -39,21 +44,21 @@ function isShortGoAhead(sentence: string): boolean {
39
44
  return GO_AHEAD_RE.test(sentence) && sentence.split(/\s+/).length <= GO_AHEAD_MAX_WORDS;
40
45
  }
41
46
 
42
- function lastSentence(text: string): string {
43
- return (
44
- text
45
- .split(/[.!\n]\s*/)
46
- .filter(Boolean)
47
- .at(-1)
48
- ?.trim() ?? ""
49
- );
47
+ function sentences(text: string): string[] {
48
+ return text
49
+ .split(/[.!\n]\s*/)
50
+ .map((s) => s.trim())
51
+ .filter(Boolean);
50
52
  }
51
53
 
52
54
  function isApproval(text: string): boolean {
53
55
  const trimmed = text.trim();
54
- if (trimmed.includes("?") || HEDGE_RE.test(trimmed.split(/[.!?\n]/)[0])) return false;
56
+ if (trimmed.includes("?") || FAILURE_RE.test(trimmed)) return false;
57
+ if (HEDGE_RE.test(trimmed.split(/[.!?\n]/)[0])) return false;
55
58
  if (APPROVAL_RE.test(trimmed) || BARE_OK_RE.test(trimmed)) return true;
56
- return isShortGoAhead(trimmed) || isShortGoAhead(lastSentence(trimmed));
59
+ const all = sentences(trimmed);
60
+ if (isShortGoAhead(all.at(-1) ?? "")) return true;
61
+ return isShortGoAhead(all[0] ?? "") && !HEDGE_RE.test(trimmed);
57
62
  }
58
63
 
59
64
  /** Word overlap was measured against real messages and does not separate topics; only saying so does. */