@shuji-bonji/pdf-reader-mcp 0.15.5 → 0.16.1

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/README.ja.md +5 -4
  3. package/README.md +4 -3
  4. package/dist/schemas/tier2.d.ts +8 -0
  5. package/dist/schemas/tier2.d.ts.map +1 -1
  6. package/dist/schemas/tier2.js +18 -0
  7. package/dist/schemas/tier2.js.map +1 -1
  8. package/dist/services/catalog-service.d.ts +30 -0
  9. package/dist/services/catalog-service.d.ts.map +1 -0
  10. package/dist/services/catalog-service.js +436 -0
  11. package/dist/services/catalog-service.js.map +1 -0
  12. package/dist/services/reading-scope.d.ts +8 -1
  13. package/dist/services/reading-scope.d.ts.map +1 -1
  14. package/dist/services/reading-scope.js +1 -0
  15. package/dist/services/reading-scope.js.map +1 -1
  16. package/dist/services/xmp-service.d.ts +66 -0
  17. package/dist/services/xmp-service.d.ts.map +1 -0
  18. package/dist/services/xmp-service.js +160 -0
  19. package/dist/services/xmp-service.js.map +1 -0
  20. package/dist/tools/index.d.ts.map +1 -1
  21. package/dist/tools/index.js +2 -0
  22. package/dist/tools/index.js.map +1 -1
  23. package/dist/tools/tier1/summarize.d.ts +10 -0
  24. package/dist/tools/tier1/summarize.d.ts.map +1 -1
  25. package/dist/tools/tier1/summarize.js +31 -5
  26. package/dist/tools/tier1/summarize.js.map +1 -1
  27. package/dist/tools/tier2/inspect-catalog.d.ts +6 -0
  28. package/dist/tools/tier2/inspect-catalog.d.ts.map +1 -0
  29. package/dist/tools/tier2/inspect-catalog.js +63 -0
  30. package/dist/tools/tier2/inspect-catalog.js.map +1 -0
  31. package/dist/types.d.ts +197 -0
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/utils/formatter.d.ts +2 -1
  34. package/dist/utils/formatter.d.ts.map +1 -1
  35. package/dist/utils/formatter.js +143 -5
  36. package/dist/utils/formatter.js.map +1 -1
  37. package/package.json +4 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,94 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.16.1] - 2026-10-15
11
+
12
+ ### Fixed
13
+
14
+ - `inspect_structure` (markdown output) — the `Unreadable` line under *Object Statistics* is
15
+ now printed when the count is 0, as `- **Unreadable**: 0`. The JSON output always carried
16
+ `objectStats.unreadable`; the markdown only printed the line when it was non-zero, so a
17
+ reader could not tell "nothing was unreadable" from "unreadability was not observed"
18
+ (SPEC-READER-INSPECT-STRUCTURE-009).
19
+
20
+ ### Changed
21
+
22
+ - `scripts/sync-plugin-version.mjs` (run by the `npm version` hook) now also keeps
23
+ `server.json` — the MCP Registry manifest — at the package version, in both places it
24
+ appears (`version` and `packages[].version`), and `--check` reports either file when it
25
+ drifts. Without this, `mcp-publisher publish` fails with "cannot publish duplicate
26
+ version" after a release, as happened to pdf-spec-mcp 0.6.2 on 2026-10-13. No change to
27
+ the server's behaviour.
28
+ - Development: specifications now live in `openspec/specs/` (OpenSpec 1.14.1) with
29
+ `SPEC-READER-*` ids checked against test names by `spec-ids` 0.5.0 in CI (`spec-gate`).
30
+ See `AGENTS.md`. The first capability written down is `inspect-structure`. No change to
31
+ the server's behaviour.
32
+
33
+ ## [0.16.0] - 2026-10-12
34
+
35
+ ### Added
36
+
37
+ - **`inspect_catalog`** — a document-level inventory read from the catalog dictionary
38
+ (ISO 32000-2 §7.7.2, Table 29), for the parts of a PDF that are not page content and that
39
+ page-oriented readers drop (#27; the PDF Association's "FAQ: AI and PDF" lists them as
40
+ things an AI ingestion should not lose):
41
+ - `/Outlines` (§12.3.3): item count and depth by walking `/First` / `/Next` (not `/Count`),
42
+ the first `max_outline_items` items with title and target page — through `/Dest` or a
43
+ `GoTo` `/A`.
44
+ - `/OCProperties` (§8.11.4): every optional content group's `/Name`; the default
45
+ configuration's `BaseState` and `ON` / `OFF` counts; the number of alternate configurations.
46
+ - `/Names` → `/EmbeddedFiles` (§7.7.4, §7.11.4): file name (`/UF` before `/F`, §7.11.3),
47
+ MIME type (`/Subtype`), size (`/Params /Size`, else the decoded length),
48
+ `/AFRelationship` (Table 43), `/Desc`; plus the count of document-level `/AF` (§14.13).
49
+ - `/Names` → `/Dests` and `/JavaScript` counts. A document-level JavaScript entry runs when
50
+ the document opens (§12.6.4.17).
51
+ - `/Metadata` (§14.3.2): packet size, `/Subtype`, every `xmlns:` declared, and the
52
+ **declared** values of `pdfaid:part` / `pdfaid:conformance`, `pdfuaid:part`, and the W3C
53
+ TDMRep `tdm:reservation` / `tdm:policy`. `include_xmp: true` returns the packet text
54
+ (capped at 64 KiB). Prefixes are resolved through their namespace URI, and both the
55
+ attribute and the element form are read.
56
+ - `/OpenAction` and `/AA` (Table 200): the action's `/S`, target page / file / URI, whether
57
+ it carries `/JS`, and the `/S` of each action in its `/Next` chain.
58
+ - `/Collection` presence.
59
+
60
+ Each entry is a value, `{ status: "absent" }` (the catalog has no such key — an observed
61
+ fact) or `{ status: "unreadable", reason }` (the key is there but its value could not be
62
+ reached). An encrypted document whose key cannot be derived from the empty user password
63
+ reports every entry as unreadable, never as absent.
64
+
65
+ What this tool does **not** do: it does not verify a `pdfuaid:part` claim (that is
66
+ pdf-verify-mcp `validate_conformance`), does not decide whether a `tdm:reservation` should
67
+ be honoured, and does not judge an action. `get_metadata` continues to read the Info
68
+ dictionary (§14.3.3), which is a different object from the XMP packet.
69
+
70
+ - **`summarize` reads the XMP declarations** (#29). A new `declaredConformance` field carries
71
+ what the packet (§14.3.2) declares — `pdfaid`, `pdfuaid`, `tdm` — as written, and `scope`
72
+ gains a fifth reading, `xmpDeclarations`. Until now the `next` suggestions were derived from
73
+ `MarkInfo /Marked` alone, so the author's PDF/UA declaration — the cue the PDF Association's
74
+ FAQ names for trusting the structure tree over inferred reading order — was invisible at the
75
+ entry point of the read. `next` now says, when `pdfuaid:part` is declared and the catalog is
76
+ marked, to take the structure route first; when it is declared but `/Marked` is not true, it
77
+ reports the disagreement and points at `inspect_tags` and pdf-verify-mcp
78
+ `validate_conformance`. The wording stays at *declares*: the claim is not verified here.
79
+ A document with no `/Metadata` reports all-null blocks with the reading `done`; one whose
80
+ packet could not be read reports `null` and says so in `scope`.
81
+
82
+ - **W3C TDMRep is read from XMP** (#28): `tdm:reservation` (1 = text-and-data-mining rights
83
+ reserved, 0 = not reserved) and `tdm:policy` (URL), per the TDM Reservation Protocol Final
84
+ Community Group Report (2024-05-10) §6.6. Both namespace spellings the report uses —
85
+ `http://www.w3.org/ns/tdmrep/` (its PDF section) and `http://www.w3.org/ns/tdmrep#` (its
86
+ EPUB section) — are recognised, and the prefix is resolved through the URI. The value is
87
+ returned in `inspect_catalog` (`metadata.declarations.tdm`) and `summarize`
88
+ (`declaredConformance.tdm`), as written. This server does not act on it: it reports the
89
+ rights holder's statement and leaves the decision to the caller. `get_metadata` is unchanged
90
+ — it reads the Info dictionary, which cannot carry this.
91
+
92
+ - `tests/fixtures/catalog-features.pdf`: outlines on two levels, two layers, two attachments,
93
+ an XMP packet declaring PDF/A-3B, PDF/UA-1 and a TDM reservation, a `GoTo` open action with
94
+ a `/Next` JavaScript action, and a `WC` additional action.
95
+
8
96
  ## [0.15.1] - 2026-09-15
9
97
 
10
98
  ### Fixed
package/README.ja.md CHANGED
@@ -22,7 +22,7 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
22
22
 
23
23
  ## 機能
24
24
 
25
- **19 ツール** を 3 層構成で提供します。
25
+ **20 ツール** を 3 層構成で提供します。
26
26
 
27
27
  ### Tier 1: 基本機能
28
28
 
@@ -33,7 +33,7 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
33
33
  | `read_text` | テキスト抽出(Y座標ベースの読み順保持。`split_columns: 2 \| 3` で **タグなし** 多カラム PDF、`compact_whitespace` で 帳票 の U+3000 連続空白を畳み込み)。`/ActualText` 置換(§14.9.4。構造要素・`Span` マーク付きコンテンツの両経路)を解決。ページごとに**テキスト抽出可能性**(§9.10.1)を併記するので、空の結果が「空のページ」と取り違えられない。**論理順**が要るタグ付き PDF の本文は `extract_structured_text` を推奨 |
34
34
  | `search_text` | 全文検索(前後コンテキスト付き)。`read_text` と同じテキスト(`/ActualText` 解決済み)を検索するため、ヒット=読み手に見えている語(位置合わせできなかったページがあれば `note` で名指し) |
35
35
  | `read_images` | 埋め込み画像 XObject を **PNG / JPEG ファイル**として抽出し、MCP の image コンテンツブロックで返す(視覚モデルがそのまま読める)。`max_width` / `max_height` で面積平均による縮小。応答にはバイト予算があり、返さなかった画像は理由付きで名指しする |
36
- | `read_url` | リモート PDF を取得して**テキストだけ**を返す。取得したバイト列は保存しない。URL 上の PDF に他の 18 ツールを使うには、先にローカルへダウンロードしてそのパスを渡す(「read_url と read-only の境界」参照) |
36
+ | `read_url` | リモート PDF を取得して**テキストだけ**を返す。取得したバイト列は保存しない。URL 上の PDF に他の 19 ツールを使うには、先にローカルへダウンロードしてそのパスを渡す(「read_url と read-only の境界」参照) |
37
37
  | `render_page` | ページを **PNG/JPEG** にラスタライズ(PDFium の WASM 版・optionalDependencies の `@hyzyla/pdfium`)。テキスト抽出可能性が `no_text_layer` / `not_extractable` のときの次の一手。ベクタ図形・フォーム込みでページ全体を描く |
38
38
  | `summarize` | 全体概要レポート(メタデータ + テキスト + 画像数 + 文書全体のテキスト抽出可能性) |
39
39
 
@@ -42,6 +42,7 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
42
42
  | ツール | 説明 |
43
43
  | --------------------- | -------------------------------------------------------- |
44
44
  | `inspect_structure` | オブジェクトツリー・カタログ辞書の解析 |
45
+ | `inspect_catalog` | カタログ直下の文書レベルの目録(ISO 32000-2 §7.7.2)。ブックマーク(`/Outlines`)・レイヤー(`/OCProperties`)・添付ファイル(`/EmbeddedFiles`、`/AFRelationship` 付き)・**XMP パケット**とそこに書かれた `pdfaid` / `pdfuaid` / W3C **TDMRep**(`tdm:reservation`)の宣言値・開いたときに走るもの(`/OpenAction`・`/AA`・文書レベル JavaScript)。各項目は「無い(absent)」と「読めなかった(unreadable)」を分けて返す。宣言は書いてあるとおりに返し、検証はしない |
45
46
  | `inspect_tags` | Tagged PDF のタグツリー可視化 |
46
47
  | `inspect_fonts` | フォント一覧(埋め込み/サブセット/Type判定) |
47
48
  | `inspect_annotations` | 注釈一覧(タイプ別分類) |
@@ -62,7 +63,7 @@ PDF 内部構造解析に特化した MCP (Model Context Protocol) サーバー
62
63
 
63
64
  `read_url` が返すのはテキストだけ。これは設計判断であり、今回それを暗黙から明文にした。
64
65
  取得したバイト列は抽出後に破棄する。保存すれば reader のツールがファイルシステムに
65
- 書き込むことになり、本サーバの全 19 ツールが read-only(`readOnlyHint: true`)という
66
+ 書き込むことになり、本サーバの全 20 ツールが read-only(`readOnlyHint: true`)という
66
67
  不変条件が成り立たなくなるため。
67
68
 
68
69
  URL 上の PDF に `search_text` / `inspect_structure` / `extract_tables` / `render_page`
@@ -90,7 +91,7 @@ render_page({ file_path: "/path/to/scan.pdf", pages: "1-3", format: "jpeg" })
90
91
  描画エンジンは **PDFium の WebAssembly 版**(`@hyzyla/pdfium`・optionalDependencies)。
91
92
  WASM はどのプラットフォームでも同じバイト列なので、`npx` で入る公開版の挙動が環境に
92
93
  よらない — ネイティブアドオンを使わない理由がそのまま満たせる。未インストールなら
93
- `render_page` はインストール方法を返し、他の 18 ツールは通常どおり動く。
94
+ `render_page` はインストール方法を返し、他の 19 ツールは通常どおり動く。
94
95
  PDFium(BSD-3-Clause)はテキスト読み取りに使っている pdf.js とは別エンジンであり、
95
96
  その旨は description に明記してある(エンジン間の描画差をファイルの性質と
96
97
  取り違えないため)。
package/README.md CHANGED
@@ -22,7 +22,7 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
22
22
 
23
23
  ## Features
24
24
 
25
- **19 tools** organized into three tiers:
25
+ **20 tools** organized into three tiers:
26
26
 
27
27
  ### Tier 1: Basic Operations
28
28
 
@@ -33,7 +33,7 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
33
33
  | `read_text` | Text extraction with Y-coordinate reading order (opt-in `split_columns: 2 \| 3` for untagged multi-column PDFs, `compact_whitespace` for Japanese forms). Resolves `/ActualText` replacements (§14.9.4, both the structure-element and the `Span` marked-content path). Reports **text extractability** per page (§9.10.1) so an empty result is never mistaken for an empty page. For **logical** order in tagged PDFs, prefer `extract_structured_text` |
34
34
  | `search_text` | Full-text search with surrounding context. Searches the same text `read_text` returns, `/ActualText` included, so a hit means what a reader sees (a `note` names any page whose marked content could not be aligned) |
35
35
  | `read_images` | Embedded image XObjects as **PNG or JPEG files**, returned as MCP image content blocks so a vision model can read them. `max_width` / `max_height` downscale by area average; the response has a byte budget and names anything it leaves out |
36
- | `read_url` | Fetch a remote PDF and extract its **text** — nothing more. The bytes are not saved; to use the other 18 tools on a URL's PDF, download it first and pass the local path (see "read_url and the read-only boundary") |
36
+ | `read_url` | Fetch a remote PDF and extract its **text** — nothing more. The bytes are not saved; to use the other 19 tools on a URL's PDF, download it first and pass the local path (see "read_url and the read-only boundary") |
37
37
  | `render_page` | Rasterise pages to **PNG/JPEG** via PDFium-WASM (optional dependency `@hyzyla/pdfium`). The next step when text extractability says `no_text_layer` / `not_extractable` — draws the whole page, vector art and forms included |
38
38
  | `summarize` | Quick overview report (metadata + text + image count + per-document text extractability) |
39
39
 
@@ -42,6 +42,7 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
42
42
  | Tool | Description |
43
43
  | --------------------- | ------------------------------------------------------------------- |
44
44
  | `inspect_structure` | Object tree and catalog dictionary analysis |
45
+ | `inspect_catalog` | Document-level inventory from the catalog (ISO 32000-2 §7.7.2): bookmarks (`/Outlines`), layers (`/OCProperties`), attachments (`/EmbeddedFiles`, with `/AFRelationship`), the **XMP packet** with its declared `pdfaid` / `pdfuaid` / W3C **TDMRep** (`tdm:reservation`) values, and what runs on open (`/OpenAction`, `/AA`, document-level JavaScript). Each entry says `absent` or `unreadable` — never one for the other. Declarations are reported as written, not verified |
45
46
  | `inspect_tags` | Tagged PDF structure tree visualization |
46
47
  | `inspect_fonts` | Font inventory (embedded/subset/type detection) |
47
48
  | `inspect_annotations` | Annotation listing (categorized by subtype) |
@@ -63,7 +64,7 @@ While typical PDF MCP servers are thin wrappers for text extraction, this projec
63
64
  `read_url` returns text, and only text. This is a decision, now stated rather than implied:
64
65
  the fetched bytes are discarded after extraction, because saving them would make a reader
65
66
  tool write to the file system, and every tool of this server is read-only
66
- (`readOnlyHint: true` — all 19 of them).
67
+ (`readOnlyHint: true` — all 20 of them).
67
68
 
68
69
  To run `search_text`, `inspect_structure`, `extract_tables`, `render_page` or anything else
69
70
  against a PDF that lives at a URL, download the file first — with whatever fetch capability
@@ -23,6 +23,13 @@ export declare const InspectAnnotationsSchema: z.ZodObject<{
23
23
  pages: z.ZodOptional<z.ZodString>;
24
24
  response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
25
25
  }, z.core.$strict>;
26
+ /** inspect_catalog */
27
+ export declare const InspectCatalogSchema: z.ZodObject<{
28
+ file_path: z.ZodString;
29
+ max_outline_items: z.ZodDefault<z.ZodNumber>;
30
+ include_xmp: z.ZodDefault<z.ZodBoolean>;
31
+ response_format: z.ZodDefault<z.ZodEnum<typeof import("../constants.js").ResponseFormat>>;
32
+ }, z.core.$strict>;
26
33
  /** locate_objects */
27
34
  export declare const LocateObjectsSchema: z.ZodObject<{
28
35
  file_path: z.ZodString;
@@ -52,6 +59,7 @@ export type InspectStructureInput = z.infer<typeof InspectStructureSchema>;
52
59
  export type InspectTagsInput = z.infer<typeof InspectTagsSchema>;
53
60
  export type InspectFontsInput = z.infer<typeof InspectFontsSchema>;
54
61
  export type InspectAnnotationsInput = z.infer<typeof InspectAnnotationsSchema>;
62
+ export type InspectCatalogInput = z.infer<typeof InspectCatalogSchema>;
55
63
  export type InspectSignaturesInput = z.infer<typeof InspectSignaturesSchema>;
56
64
  export type ExtractTablesInput = z.infer<typeof ExtractTablesSchema>;
57
65
  export type ExtractStructuredTextInput = z.infer<typeof ExtractStructuredTextSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"tier2.d.ts","sourceRoot":"","sources":["../../src/schemas/tier2.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,wBAAwB;AACxB,eAAO,MAAM,sBAAsB;;;kBAKxB,CAAC;AAEZ,mBAAmB;AACnB,eAAO,MAAM,iBAAiB;;;kBAKnB,CAAC;AAEZ,oBAAoB;AACpB,eAAO,MAAM,kBAAkB;;;kBAKpB,CAAC;AAEZ,0BAA0B;AAC1B,eAAO,MAAM,wBAAwB;;;;kBAM1B,CAAC;AAEZ,qBAAqB;AACrB,eAAO,MAAM,mBAAmB;;;;kBAarB,CAAC;AAEZ,8BAA8B;AAC9B,eAAO,MAAM,2BAA2B;;;;;;kBA2B7B,CAAC;AAEZ,yBAAyB;AACzB,eAAO,MAAM,uBAAuB;;;kBAKzB,CAAC;AAEZ,mDAAmD;AACnD,eAAO,MAAM,mBAAmB;;;;kBAMrB,CAAC;AAGZ,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CA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,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -32,6 +32,24 @@ export const InspectAnnotationsSchema = z
32
32
  response_format: ResponseFormatSchema,
33
33
  })
34
34
  .strict();
35
+ /** inspect_catalog */
36
+ export const InspectCatalogSchema = z
37
+ .object({
38
+ file_path: FilePathSchema,
39
+ max_outline_items: z
40
+ .number()
41
+ .int()
42
+ .min(1)
43
+ .max(500)
44
+ .default(50)
45
+ .describe('How many outline (bookmark) items to list. The count and depth are always computed over the whole tree.'),
46
+ include_xmp: z
47
+ .boolean()
48
+ .default(false)
49
+ .describe('Return the XMP packet text itself (capped at 64 KiB). Off by default: the declared values are extracted either way.'),
50
+ response_format: ResponseFormatSchema,
51
+ })
52
+ .strict();
35
53
  /** locate_objects */
36
54
  export const LocateObjectsSchema = z
37
55
  .object({
@@ -1 +1 @@
1
- {"version":3,"file":"tier2.js","sourceRoot":"","sources":["../../src/schemas/tier2.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEhF,wBAAwB;AACxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;IACzB,eAAe,EAAE,oBAAoB;C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B,+EAA+E;QAC7E,uFAAuF,CAC1F;IACD,KAAK,EAAE,CAAC;SACL,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,EAAE;SACV,QAAQ,CACP,yFAAyF,CAC1F;IACH,YAAY,EAAE,CAAC;SACZ,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CACP,mFAAmF;QACjF,oFAAoF;QACpF,qFAAqF;QACrF,iFAAiF;QACjF,uFAAuF;QACvF,yDAAyD,CAC5D;IACH,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,yBAAyB;AACzB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;IACzB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,SAAS,EAAE,cAAc;IACzB,KAAK,EAAE,WAAW;IAClB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * 文書レベルの目録を読む(`inspect_catalog`、#27)。
3
+ *
4
+ * カタログ辞書(ISO 32000-2 §7.7.2 Table 29)の直下にあって、ページの中身ではない
5
+ * 構成要素 —— ブックマーク(`/Outlines` §12.3.3)・レイヤー(`/OCProperties` §8.11.4)・
6
+ * 添付ファイル(`/Names` → `/EmbeddedFiles` §7.7.4 / §7.11.4)・XMP(`/Metadata` §14.3.2)・
7
+ * 開いたときに走るアクション(`/OpenAction`・`/AA` §12.6.3 Table 200)—— を 1 回で列挙する。
8
+ *
9
+ * `inspect_structure` は同じカタログのキーの一覧を COS 型付きで返すが、値の中へは
10
+ * 入らない。ここは中へ入って「何があるか」を数える。
11
+ *
12
+ * 🔴 判定は書かない。添付が PDF/A か、アクションが危険か、`tdm:reservation` に従うべきかは
13
+ * ここでは言わない(pdf-verify-mcp と呼び出し側の責務)。
14
+ *
15
+ * 🔴 「無い」と「読めなかった」を分ける。キーが無いことは観測できた事実(`absent`)で、
16
+ * キーはあるが値に届かないのは観測できなかったこと(`unreadable`)である。
17
+ * 両方を `null` に畳むと、鍵が導けない暗号化文書が「添付もブックマークも無い文書」の顔をする。
18
+ */
19
+ import type { CatalogInventory } from '../types.js';
20
+ export interface InspectCatalogOptions {
21
+ /** 返す outline 項目の上限(数え上げは全件行う)。 */
22
+ maxOutlineItems: number;
23
+ }
24
+ export declare function inspectCatalog(filePath: string, options: InspectCatalogOptions): Promise<CatalogInventory>;
25
+ /**
26
+ * XMP パケット本文は、頼まれたときだけ・上限付きで返す。宣言値は常に残す
27
+ * (パケットを読む理由がそれだから)。
28
+ */
29
+ export declare function applyXmpPolicy(inventory: CatalogInventory, includeXmp: boolean): CatalogInventory;
30
+ //# sourceMappingURL=catalog-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog-service.d.ts","sourceRoot":"","sources":["../../src/services/catalog-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAkBH,OAAO,KAAK,EAEV,gBAAgB,EAOjB,MAAM,aAAa,CAAC;AAoBrB,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAmE3B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,GAAG,gBAAgB,CAUjG"}