shariq-pi-extensions 0.2.36 → 0.2.37

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.
@@ -206,6 +206,11 @@ function extractTextContent(content: unknown): string {
206
206
  return "";
207
207
  }
208
208
 
209
+ function cleanExtractedUrl(rawUrl: string): string {
210
+ // Strip trailing punctuation often attached in prose or markdown (e.g. `url`, `url`,)
211
+ return rawUrl.replace(/[`'",.;:!?)\]]+$/, "");
212
+ }
213
+
209
214
  export function extractProtectedFacts(messages: AgentMessage[], previousSummary?: string): string[] {
210
215
  const facts = new Set<string>();
211
216
  const userSources = messages
@@ -227,16 +232,12 @@ export function extractProtectedFacts(messages: AgentMessage[], previousSummary?
227
232
  /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
228
233
  ];
229
234
 
230
- for (const source of constraintSources) {
231
- for (const segment of source.split(/(?<=[.!?])\s+|\n+/)) {
232
- const trimmed = segment.trim();
233
- const constraint = trimmed.match(/\b(?:never|do not|don't|must not)\b.*$/i)?.[0]?.trim();
234
- if (constraint && constraint.length <= 1000) facts.add(constraint);
235
- }
236
- }
237
235
  for (const source of identifierSources) {
238
236
  for (const pattern of identifierPatterns) {
239
- for (const match of source.matchAll(pattern)) facts.add(match[0]);
237
+ for (const match of source.matchAll(pattern)) {
238
+ const val = match[0].startsWith("http") ? cleanExtractedUrl(match[0]) : match[0];
239
+ if (val) facts.add(val);
240
+ }
240
241
  }
241
242
  }
242
243
  return [...facts];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shariq-pi-extensions",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "Cross-platform extension suite for the Pi coding agent.",
5
5
  "license": "MIT",
6
6
  "author": "Shariq Riaz",