@mjasnikovs/pi-task 0.18.32 → 0.18.33

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.
@@ -3,11 +3,23 @@ const DEFAULT_BUDGET = 24_000;
3
3
  const MIN_TOKEN_LEN = 2;
4
4
  const FALLBACK_DTS_CHARS = 12_000;
5
5
  const FALLBACK_README_CHARS = 4_000;
6
+ /**
7
+ * Split on any run of non-identifier characters — NOT on whitespace alone.
8
+ *
9
+ * Splitting on /\s+/ and then stripping punctuation INSIDE each token silently welds
10
+ * multi-part identifiers into one string that occurs nowhere in the corpus:
11
+ * "src/server/routes/auth.ts" -> "srcserverroutesauthts"
12
+ * "Bun.password.hash" -> "Bunpasswordhash"
13
+ * Because buildFtsQuery ORs the tokens, such a token contributes no MATCH at all, so the
14
+ * single most informative term in the query — the path, or the dotted API symbol — was
15
+ * dropped and ranking fell to the surrounding prose. Measured on the 141 real project
16
+ * queries of mx5 run 13, that cost 18% of them any chunk from the file they named
17
+ * (82% -> 99% retrieved once split on punctuation); on the 44 gradable npm queries,
18
+ * discriminative-symbol recall 89.5% -> 96.4%.
19
+ * See scripts/live-project-docs-retrieval-ab.ts and scripts/live-npm-tokenizer-regression.ts.
20
+ */
6
21
  function tokenize(query) {
7
- return query
8
- .split(/\s+/)
9
- .map(t => t.replace(/[^a-zA-Z0-9_]/g, ''))
10
- .filter(t => t.length >= MIN_TOKEN_LEN);
22
+ return query.split(/[^a-zA-Z0-9_]+/).filter(t => t.length >= MIN_TOKEN_LEN);
11
23
  }
12
24
  function buildFtsQuery(tokens) {
13
25
  return tokens.map(t => `"${t}"`).join(' OR ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.18.32",
3
+ "version": "0.18.33",
4
4
  "description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",