@pipeworx/mcp-guam-code 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Guam Code Annotated (GCA) — Guam territorial statutes, by citation and by
4
4
  topic/keyword search. Keyless.
5
5
 
6
- Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1815+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
6
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 1819+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.
7
7
 
8
8
  ## Tools
9
9
 
@@ -224,7 +224,7 @@ directly, instead of just this one's:
224
224
  }
225
225
  ```
226
226
 
227
- Both URLs reach the same gateway and the same 1815+ data sources. The
227
+ Both URLs reach the same gateway and the same 1819+ data sources. The
228
228
  only difference is which pack's tools are listed **directly**; `ask_pipeworx`
229
229
  reaches all of them from either one.
230
230
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipeworx/mcp-guam-code",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Guam Code Annotated (GCA) — section lookup and search. Fleet #2888.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -26,7 +26,7 @@
26
26
  "@cloudflare/workers-types": "^4.20260405.1"
27
27
  },
28
28
  "pipeworx": {
29
- "sourceHash": "v1-0e8b06ad75d31b79367ea7bccec933bfae1665a234e87b2fd47a9220c214f878",
30
- "sourceCommit": "fe38188882d0fe91e5a45d82b7b989b4aae1e8b6"
29
+ "sourceHash": "v1-e101ffcf2c7ba1d5bce6f1a3825e124694dc1e346ebf10ef701f4239c45c5202",
30
+ "sourceCommit": "a03f96ed672b8c149593c64ecbf30280cabf084c"
31
31
  }
32
32
  }
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.pipeworx-io/guam-code",
4
4
  "title": "Guam Code",
5
5
  "description": "Guam Code Annotated (GCA) — section lookup and search. Fleet #2888.",
6
- "version": "0.1.2",
6
+ "version": "0.1.3",
7
7
  "websiteUrl": "https://pipeworx.io/packs/guam-code",
8
8
  "repository": {
9
9
  "url": "https://github.com/pipeworx-io/mcp-guam-code",
package/src/index.ts CHANGED
@@ -1325,7 +1325,18 @@ async function extractPdfText(buf: ArrayBuffer, options?: PdfExtractOptions): Pr
1325
1325
 
1326
1326
  const TOKEN_RE =
1327
1327
  /\/(\S+)\s+[\d.]+\s+Tf|\[((?:\\.|[^\]])*)\]\s*TJ|<([0-9A-Fa-f\s]*)>\s*Tj|\(((?:\\.|[^()])*)\)\s*Tj|1\s+0\s+0\s+1\s+[\d.-]+\s+([\d.-]+)\s+Tm/g;
1328
- const TJ_PIECE_RE = /\(((?:\\.|[^()])*)\)|<([0-9A-Fa-f\s]*)>/g;
1328
+ // Third alternative (bare number) added for Indonesia's JDIH statute PDFs
1329
+ // (jdih.setneg.go.id, fleet #3121): that producer never writes a literal
1330
+ // space byte between words — "REPUBLIK INDONESIA" is encoded as one TJ run
1331
+ // `[(…K)-269.0(I)…]`, where the -269 IS the word gap, not kerning. Every
1332
+ // sampled font's intra-word kerning tops out around +-30 (observed: 2.0,
1333
+ // -2.9, -14.0, -24.0); the real word gaps in the same document measured
1334
+ // -269, -286, -290, -692, -1396, -1400 — two clusters with nothing between
1335
+ // them, so a flat threshold cleanly separates "kerning" from "space" without
1336
+ // needing the current font size (the TJ number is already in thousandths of
1337
+ // text space, before the Tfs/Th scale-up ISO 32000 §9.4.3 applies).
1338
+ const TJ_PIECE_RE = /\(((?:\\.|[^()])*)\)|<([0-9A-Fa-f\s]*)>|(-?\d+(?:\.\d+)?)/g;
1339
+ const TJ_WORD_GAP_THRESHOLD = -100;
1329
1340
 
1330
1341
  function decodeRun(dec: FontDecoder, literal: string | undefined, hex: string | undefined): string {
1331
1342
  if (literal !== undefined) {
@@ -1450,7 +1461,17 @@ async function extractPdfText(buf: ArrayBuffer, options?: PdfExtractOptions): Pr
1450
1461
  }
1451
1462
  const dec = (currentFont && fontMap.get(currentFont)) || { kind: 'winansi' as const };
1452
1463
  if (m[2] !== undefined) {
1453
- for (const piece of m[2].matchAll(TJ_PIECE_RE)) out += decodeRun(dec, piece[1], piece[2]);
1464
+ for (const piece of m[2].matchAll(TJ_PIECE_RE)) {
1465
+ if (piece[3] !== undefined) {
1466
+ // A big negative adjustment between two TJ pieces with no
1467
+ // literal space byte at all — see TJ_PIECE_RE's comment above.
1468
+ // Skip if `out` already ends in whitespace so a producer that
1469
+ // DOES write literal spaces never gets a doubled one.
1470
+ if (parseFloat(piece[3]) <= TJ_WORD_GAP_THRESHOLD && !/\s$/.test(out)) out += ' ';
1471
+ continue;
1472
+ }
1473
+ out += decodeRun(dec, piece[1], piece[2]);
1474
+ }
1454
1475
  } else if (m[3] !== undefined) {
1455
1476
  out += decodeRun(dec, undefined, m[3]);
1456
1477
  } else if (m[4] !== undefined) {
package/src/server.ts CHANGED
@@ -11,7 +11,7 @@ import * as bakedIndexModule from './gu-baked-data.js';
11
11
  const bakedIndex = Object.fromEntries(Object.entries(bakedIndexModule));
12
12
 
13
13
  const server = new Server(
14
- { name: '@pipeworx/mcp-guam-code', version: '0.1.2' },
14
+ { name: '@pipeworx/mcp-guam-code', version: '0.1.3' },
15
15
  { capabilities: { tools: {} } },
16
16
  );
17
17