@tangle-network/agent-app 0.45.20 → 0.45.22

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 (113) hide show
  1. package/dist/DesignCanvas-ZG7DJS7C.js +10 -0
  2. package/dist/DesignCanvasEditor-SLFMHOII.js +13 -0
  3. package/dist/app-auth/index.js +2 -2
  4. package/dist/assistant/index.d.ts +1 -1
  5. package/dist/assistant/index.js +5 -5
  6. package/dist/{attachment-validation-CsmUzuI3.d.ts → attachment-validation-BfJDBU1g.d.ts} +41 -5
  7. package/dist/{auth-DJjJBtYw.d.ts → auth-BYtiazA4.d.ts} +1 -1
  8. package/dist/chat-react/index.js +2 -2
  9. package/dist/chat-routes/index.d.ts +8 -4
  10. package/dist/chat-routes/index.js +22 -5
  11. package/dist/chat-routes/index.js.map +1 -1
  12. package/dist/{chunk-KPRBFNGT.js → chunk-3IHYJIDJ.js} +3 -3
  13. package/dist/{chunk-MYS7DHMM.js → chunk-4QVG4WJQ.js} +2 -2
  14. package/dist/{chunk-RMHZKMQ4.js → chunk-73CQJOIU.js} +5 -5
  15. package/dist/{chunk-PAB253MA.js → chunk-7V2I3JGZ.js} +19 -3
  16. package/dist/chunk-7V2I3JGZ.js.map +1 -0
  17. package/dist/chunk-CCVG2TL6.js +327 -0
  18. package/dist/chunk-CCVG2TL6.js.map +1 -0
  19. package/dist/{chunk-U4BXAZCN.js → chunk-DRB77FYL.js} +2 -2
  20. package/dist/{chunk-6MUJROBT.js → chunk-E4DHYENH.js} +2 -2
  21. package/dist/chunk-F7VH4G5C.js +283 -0
  22. package/dist/chunk-F7VH4G5C.js.map +1 -0
  23. package/dist/chunk-I24YIKHO.js +183 -0
  24. package/dist/chunk-I24YIKHO.js.map +1 -0
  25. package/dist/{chunk-AH3IOSWF.js → chunk-NZVBJM73.js} +1432 -187
  26. package/dist/chunk-NZVBJM73.js.map +1 -0
  27. package/dist/{chunk-OO4DROKM.js → chunk-OASVAPRL.js} +3 -3
  28. package/dist/{chunk-ZSGTG6PK.js → chunk-P5PIAQVS.js} +2 -2
  29. package/dist/chunk-PC2WYTK7.js +405 -0
  30. package/dist/chunk-PC2WYTK7.js.map +1 -0
  31. package/dist/{chunk-YEFFHORB.js → chunk-TX6S7XXU.js} +8 -2
  32. package/dist/chunk-TX6S7XXU.js.map +1 -0
  33. package/dist/chunk-UGWQLQDS.js +35 -0
  34. package/dist/chunk-UGWQLQDS.js.map +1 -0
  35. package/dist/{chunk-O22STZ3P.js → chunk-X5DQ5QOP.js} +2 -2
  36. package/dist/{chunk-PCJHEZA7.js → chunk-YABHE2QY.js} +2 -2
  37. package/dist/design-canvas/index.d.ts +3 -3
  38. package/dist/design-canvas/index.js +2 -2
  39. package/dist/design-canvas-react/engine.js +4 -4
  40. package/dist/design-canvas-react/index.js +7 -7
  41. package/dist/design-canvas-react/lazy.js +1 -1
  42. package/dist/documents/index.d.ts +233 -0
  43. package/dist/documents/index.js +495 -0
  44. package/dist/documents/index.js.map +1 -0
  45. package/dist/documents/pdf-inspector.d.ts +60 -0
  46. package/dist/documents/pdf-inspector.js +100 -0
  47. package/dist/documents/pdf-inspector.js.map +1 -0
  48. package/dist/eval/index.d.ts +1 -1
  49. package/dist/fold-DACU7gtf.d.ts +320 -0
  50. package/dist/{mcp-BiKqnsJV.d.ts → mcp-xxoZZfor.d.ts} +2 -2
  51. package/dist/openui/index.d.ts +208 -0
  52. package/dist/openui/index.js +350 -0
  53. package/dist/openui/index.js.map +1 -0
  54. package/dist/openui-react/index.d.ts +119 -0
  55. package/dist/openui-react/index.js +149 -0
  56. package/dist/openui-react/index.js.map +1 -0
  57. package/dist/platform/index.js +2 -2
  58. package/dist/preset-cloudflare/index.d.ts +2 -2
  59. package/dist/rate-limit-BOVmJRXZ.d.ts +35 -0
  60. package/dist/record/drizzle.d.ts +682 -0
  61. package/dist/record/drizzle.js +579 -0
  62. package/dist/record/drizzle.js.map +1 -0
  63. package/dist/record/index.d.ts +16 -0
  64. package/dist/record/index.js +35 -0
  65. package/dist/record/index.js.map +1 -0
  66. package/dist/runtime/index.d.ts +3 -3
  67. package/dist/sandbox/index.d.ts +13 -4
  68. package/dist/sandbox/index.js +6 -3
  69. package/dist/sequences/index.d.ts +3 -3
  70. package/dist/sequences/index.js +1 -1
  71. package/dist/session-shell/index.d.ts +173 -1
  72. package/dist/session-shell/index.js +13 -1
  73. package/dist/teams/index.js +9 -9
  74. package/dist/teams/invitations-api.js +3 -3
  75. package/dist/tools/index.d.ts +5 -5
  76. package/dist/tools/index.js +3 -2
  77. package/dist/{types-DbU-oO5h.d.ts → types-B25Mib1r.d.ts} +11 -0
  78. package/dist/types-DrBidf3O.d.ts +123 -0
  79. package/dist/values-C7RidJuI.d.ts +156 -0
  80. package/dist/web/index.d.ts +197 -31
  81. package/dist/web/index.js +15 -3
  82. package/dist/web-react/async/index.d.ts +309 -0
  83. package/dist/web-react/async/index.js +327 -0
  84. package/dist/web-react/async/index.js.map +1 -0
  85. package/dist/web-react/index.d.ts +338 -2
  86. package/dist/web-react/index.js +52 -6
  87. package/dist/work-product/index.d.ts +1 -1
  88. package/dist/work-product/index.js +2 -1
  89. package/dist/work-product/index.js.map +1 -1
  90. package/dist/workspace-react/index.js +1 -1
  91. package/package.json +43 -3
  92. package/dist/DesignCanvas-NEIW3AER.js +0 -10
  93. package/dist/DesignCanvasEditor-QD33OI2W.js +0 -13
  94. package/dist/chunk-AH3IOSWF.js.map +0 -1
  95. package/dist/chunk-GINKOZFD.js +0 -214
  96. package/dist/chunk-GINKOZFD.js.map +0 -1
  97. package/dist/chunk-J25RST7G.js +0 -126
  98. package/dist/chunk-J25RST7G.js.map +0 -1
  99. package/dist/chunk-PAB253MA.js.map +0 -1
  100. package/dist/chunk-WBHPN5DY.js +0 -158
  101. package/dist/chunk-WBHPN5DY.js.map +0 -1
  102. package/dist/chunk-YEFFHORB.js.map +0 -1
  103. /package/dist/{DesignCanvas-NEIW3AER.js.map → DesignCanvas-ZG7DJS7C.js.map} +0 -0
  104. /package/dist/{DesignCanvasEditor-QD33OI2W.js.map → DesignCanvasEditor-SLFMHOII.js.map} +0 -0
  105. /package/dist/{chunk-KPRBFNGT.js.map → chunk-3IHYJIDJ.js.map} +0 -0
  106. /package/dist/{chunk-MYS7DHMM.js.map → chunk-4QVG4WJQ.js.map} +0 -0
  107. /package/dist/{chunk-RMHZKMQ4.js.map → chunk-73CQJOIU.js.map} +0 -0
  108. /package/dist/{chunk-U4BXAZCN.js.map → chunk-DRB77FYL.js.map} +0 -0
  109. /package/dist/{chunk-6MUJROBT.js.map → chunk-E4DHYENH.js.map} +0 -0
  110. /package/dist/{chunk-OO4DROKM.js.map → chunk-OASVAPRL.js.map} +0 -0
  111. /package/dist/{chunk-ZSGTG6PK.js.map → chunk-P5PIAQVS.js.map} +0 -0
  112. /package/dist/{chunk-O22STZ3P.js.map → chunk-X5DQ5QOP.js.map} +0 -0
  113. /package/dist/{chunk-PCJHEZA7.js.map → chunk-YABHE2QY.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  applySceneOperations,
4
4
  requireElement,
5
5
  requirePage
6
- } from "./chunk-U4BXAZCN.js";
6
+ } from "./chunk-DRB77FYL.js";
7
7
 
8
8
  // src/design-canvas-react/engine/command-stack.ts
9
9
  var SCENE_COMMAND_HISTORY_LIMIT = 200;
@@ -601,4 +601,4 @@ export {
601
601
  bindSlotCommand,
602
602
  setDocumentTitleCommand
603
603
  };
604
- //# sourceMappingURL=chunk-O22STZ3P.js.map
604
+ //# sourceMappingURL=chunk-X5DQ5QOP.js.map
@@ -2,7 +2,7 @@ import {
2
2
  clearCookieHeader,
3
3
  readCookieValue,
4
4
  serializeCookie
5
- } from "./chunk-J25RST7G.js";
5
+ } from "./chunk-F7VH4G5C.js";
6
6
  import {
7
7
  isTangleBillingEnforcementDisabled
8
8
  } from "./chunk-JML7WKWU.js";
@@ -301,4 +301,4 @@ export {
301
301
  createAdminGuard,
302
302
  assertBillableBalance
303
303
  };
304
- //# sourceMappingURL=chunk-PCJHEZA7.js.map
304
+ //# sourceMappingURL=chunk-YABHE2QY.js.map
@@ -6,10 +6,10 @@ import { a as SceneStore, N as NewSceneDecision, b as SceneDocumentRecord } from
6
6
  export { c as SceneDecision, d as SceneExportFormat, e as SceneExportRecord, S as SceneStoreScope } from '../store-CqfDtnPQ.js';
7
7
  export { C as CHANNEL_PRESETS, a as ChannelPreset, b as ChannelPresetId, c as ChannelScaleResult, E as EXPORT_PRESETS, d as ExportCropRect, e as ExportFormat, f as ExportPreset, S as SIZE_PRESETS, g as SizePreset, h as bleedAwareExportBounds, i as bleedAwareExportRect, j as findPreset, m as matchPreset, r as requireChannelPreset, s as scaleForPreset, k as scalePageForChannelPreset } from '../export-presets-mgVulRaV.js';
8
8
  import { a as McpToolDefinition } from '../mcp-rpc-DYwPlYbZ.js';
9
- import { S as ScopedMcpServerEntryOptions, A as AppToolMcpServer } from '../mcp-BiKqnsJV.js';
9
+ import { S as ScopedMcpServerEntryOptions, A as AppToolMcpServer } from '../mcp-xxoZZfor.js';
10
10
  import '@tangle-network/agent-interface';
11
- import '../types-DbU-oO5h.js';
12
- import '../auth-DJjJBtYw.js';
11
+ import '../types-B25Mib1r.js';
12
+ import '../auth-BYtiazA4.js';
13
13
 
14
14
  /**
15
15
  * Pre-write validation for scene operations. Every rule runs against a
@@ -31,8 +31,8 @@ import {
31
31
  validateSceneOperation,
32
32
  validateSceneOperations,
33
33
  validateSlotValue
34
- } from "../chunk-U4BXAZCN.js";
35
- import "../chunk-J25RST7G.js";
34
+ } from "../chunk-DRB77FYL.js";
35
+ import "../chunk-F7VH4G5C.js";
36
36
  import {
37
37
  buildScopedMcpServerEntry,
38
38
  createMcpToolHandler
@@ -18,7 +18,7 @@ import {
18
18
  mintElementId,
19
19
  nudgeDelta,
20
20
  resolveExportParams
21
- } from "../chunk-MYS7DHMM.js";
21
+ } from "../chunk-4QVG4WJQ.js";
22
22
  import {
23
23
  SCENE_COMMAND_HISTORY_LIMIT,
24
24
  addElementCommand,
@@ -37,12 +37,12 @@ import {
37
37
  setPageGuidesCommand,
38
38
  setPagePropsCommand,
39
39
  ungroupElementCommand
40
- } from "../chunk-O22STZ3P.js";
40
+ } from "../chunk-X5DQ5QOP.js";
41
41
  import {
42
42
  bleedAwareExportBounds,
43
43
  scaleForPreset
44
- } from "../chunk-U4BXAZCN.js";
45
- import "../chunk-J25RST7G.js";
44
+ } from "../chunk-DRB77FYL.js";
45
+ import "../chunk-F7VH4G5C.js";
46
46
  export {
47
47
  DEFAULT_INSERT_TEMPLATES,
48
48
  DUPLICATE_OFFSET,
@@ -12,7 +12,7 @@ import {
12
12
  downloadDataUrl,
13
13
  exportDocumentJson,
14
14
  exportPageDataUrl
15
- } from "../chunk-RMHZKMQ4.js";
15
+ } from "../chunk-73CQJOIU.js";
16
16
  import {
17
17
  BTN,
18
18
  BTN_ACTIVE,
@@ -41,7 +41,7 @@ import {
41
41
  buildRulerTicks,
42
42
  formatRulerLabel,
43
43
  selectTickStep
44
- } from "../chunk-KPRBFNGT.js";
44
+ } from "../chunk-3IHYJIDJ.js";
45
45
  import "../chunk-TZO3SOUL.js";
46
46
  import "../chunk-ZN5J47UX.js";
47
47
  import {
@@ -63,7 +63,7 @@ import {
63
63
  mintElementId,
64
64
  nudgeDelta,
65
65
  resolveExportParams
66
- } from "../chunk-MYS7DHMM.js";
66
+ } from "../chunk-4QVG4WJQ.js";
67
67
  import {
68
68
  SCENE_COMMAND_HISTORY_LIMIT,
69
69
  addElementCommand,
@@ -82,17 +82,17 @@ import {
82
82
  setPageGuidesCommand,
83
83
  setPagePropsCommand,
84
84
  ungroupElementCommand
85
- } from "../chunk-O22STZ3P.js";
85
+ } from "../chunk-X5DQ5QOP.js";
86
86
  import {
87
87
  DesignCanvasChromeLazy,
88
88
  DesignCanvasLazy
89
- } from "../chunk-OO4DROKM.js";
89
+ } from "../chunk-OASVAPRL.js";
90
90
  import {
91
91
  assertSceneMediaSrc,
92
92
  bleedAwareExportBounds,
93
93
  scaleForPreset
94
- } from "../chunk-U4BXAZCN.js";
95
- import "../chunk-J25RST7G.js";
94
+ } from "../chunk-DRB77FYL.js";
95
+ import "../chunk-F7VH4G5C.js";
96
96
 
97
97
  // src/design-canvas-react/components/CanvasInsertPanel.tsx
98
98
  import { useEffect, useRef, useState } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DesignCanvasChromeLazy,
3
3
  DesignCanvasLazy
4
- } from "../chunk-OO4DROKM.js";
4
+ } from "../chunk-OASVAPRL.js";
5
5
  export {
6
6
  DesignCanvasChromeLazy,
7
7
  DesignCanvasLazy
@@ -0,0 +1,233 @@
1
+ import { P as PdfEngine, a as PdfTextFormat, D as DocumentOutcome, E as ExtractedDocument, b as PdfClassification, c as DocxExtractionDetail, d as DocumentFormat } from '../types-DrBidf3O.js';
2
+ export { e as DocumentExtractionError, f as DocumentExtractionErrorCode, g as DocumentExtractionStage, h as PdfContentKind, i as PdfExtractionDetail, j as PdfPageClassification } from '../types-DrBidf3O.js';
3
+
4
+ /**
5
+ * The extraction pipeline: size gate → media type → (PDF: classify, then
6
+ * extract) / (DOCX: OPC read) / (text: strict decode).
7
+ *
8
+ * Two rules make this safe to build a product on.
9
+ *
10
+ * 1. **Classify before extracting a PDF.** The wasm engine's `extractText`
11
+ * panics (`RuntimeError: unreachable`) on any page with no text layer, and
12
+ * that is measured, not theoretical — including on `mixed` documents where
13
+ * only ONE page is an image. Classification runs first and decides whether
14
+ * extraction is even reachable, which is also what produces the OCR signal.
15
+ * 2. **A scanned PDF is `pdf-needs-ocr`, never an empty string.** Both hand-
16
+ * rolled predecessors of this module got this right and it is the single
17
+ * behaviour a product cannot afford to lose: silent empty text lets a
18
+ * downstream model answer confidently about a document nobody read.
19
+ */
20
+
21
+ /** 25 MB — the cap both predecessor implementations converged on, and roughly
22
+ * the point where a Worker's memory budget stops tolerating a full decode. */
23
+ declare const DEFAULT_MAX_DOCUMENT_BYTES: number;
24
+ interface ExtractDocumentOptions {
25
+ /** The type the upload declared. Falls back to `filename`'s extension when
26
+ * missing or `application/octet-stream`. */
27
+ readonly mediaType?: string;
28
+ /** Used to resolve the media type, and named in error messages. */
29
+ readonly filename?: string;
30
+ /** Required to extract PDFs. Supplied by the caller because the wasm asset
31
+ * must come from the consumer's bundler — see
32
+ * `@tangle-network/agent-app/documents/pdf-inspector`. */
33
+ readonly pdf?: PdfEngine;
34
+ /** Byte cap on the uploaded ARCHIVE, default
35
+ * {@link DEFAULT_MAX_DOCUMENT_BYTES}. */
36
+ readonly maxBytes?: number;
37
+ /**
38
+ * Byte cap on what any ONE part of an Office package may expand to, default
39
+ * {@link DEFAULT_MAX_ZIP_ENTRY_BYTES}.
40
+ *
41
+ * A separate dial from {@link maxBytes} because they bound different things:
42
+ * deflate reaches ~1000:1 on repetitive input, so capping the upload does
43
+ * nothing to cap the decompression it asks for.
44
+ */
45
+ readonly maxUncompressedPartBytes?: number;
46
+ /**
47
+ * Plain text (default) preserves source line breaks, which line-anchored
48
+ * parsers depend on; markdown carries headings and page markers but reflows
49
+ * lines into paragraphs.
50
+ *
51
+ * A *preference*, because of exactly one measured case: on a partially
52
+ * scanned PDF the plain-text engine panics, and only the markdown engine can
53
+ * recover the pages that do have text. The result reports what you actually
54
+ * got in {@link PdfExtractionDetail.textFormat} — check it when the
55
+ * distinction matters.
56
+ */
57
+ readonly preferredPdfFormat?: PdfTextFormat;
58
+ }
59
+ /**
60
+ * Classify a PDF: whether it has a text layer, and which pages do not.
61
+ *
62
+ * Safe on every input — classification is what makes extraction safe, so it can
63
+ * never be the thing that panics. Call this directly when a product wants to
64
+ * show "3 of 40 pages need OCR" before deciding to extract.
65
+ */
66
+ declare function classifyPdfDocument(bytes: Uint8Array, pdf: PdfEngine): DocumentOutcome<PdfClassification>;
67
+ /**
68
+ * Extract a document's text.
69
+ *
70
+ * Every failure is a typed {@link DocumentExtractionError} naming the stage it
71
+ * stopped at; nothing throws, and success never carries empty text.
72
+ */
73
+ declare function extractDocument(input: ArrayBuffer | Uint8Array, options?: ExtractDocumentOptions): Promise<DocumentOutcome<ExtractedDocument>>;
74
+ interface DocumentExtractorConfig {
75
+ readonly pdf?: PdfEngine;
76
+ readonly maxBytes?: number;
77
+ readonly maxUncompressedPartBytes?: number;
78
+ readonly preferredPdfFormat?: PdfTextFormat;
79
+ }
80
+ interface DocumentExtractor {
81
+ readonly extract: (input: ArrayBuffer | Uint8Array, options?: Omit<ExtractDocumentOptions, 'pdf' | 'maxBytes' | 'maxUncompressedPartBytes' | 'preferredPdfFormat'>) => Promise<DocumentOutcome<ExtractedDocument>>;
82
+ /** Classify a PDF without extracting. Fails with `pdf-engine-unavailable`
83
+ * when the extractor was built without a PDF engine. */
84
+ readonly classifyPdf: (input: ArrayBuffer | Uint8Array) => DocumentOutcome<PdfClassification>;
85
+ }
86
+ /**
87
+ * Bind an engine and limits once, at worker start, so call sites read
88
+ * `documents.extract(bytes, { mediaType })` and never re-wire the wasm.
89
+ */
90
+ declare function createDocumentExtractor(config?: DocumentExtractorConfig): DocumentExtractor;
91
+
92
+ /**
93
+ * The slice of PKZIP an OOXML package needs: read the central directory, then
94
+ * inflate one named entry.
95
+ *
96
+ * Why not a zip library: DOCX text extraction is the only reason this module
97
+ * needs a zip, and the runtime already supplies the hard part —
98
+ * `DecompressionStream('deflate-raw')` is a standard API present in workerd
99
+ * and in Node, so the whole reader is header arithmetic plus a stream. Pulling
100
+ * a zip package in would put ten transitive Node-shaped dependencies into every
101
+ * consumer's Worker bundle to avoid ~120 lines.
102
+ *
103
+ * The CENTRAL DIRECTORY is the source of truth, not the local headers: an
104
+ * archive written with data descriptors (streamed output) carries zeros for
105
+ * the sizes in its local headers, and reading those is the classic way a
106
+ * hand-rolled zip reader silently returns nothing.
107
+ */
108
+ type ZipOutcome<T> = {
109
+ succeeded: true;
110
+ value: T;
111
+ } | {
112
+ succeeded: false;
113
+ error: string;
114
+ };
115
+ interface ZipEntry {
116
+ readonly name: string;
117
+ readonly compressionMethod: number;
118
+ readonly compressedSize: number;
119
+ readonly uncompressedSize: number;
120
+ readonly localHeaderOffset: number;
121
+ readonly encrypted: boolean;
122
+ }
123
+ /** Read every central-directory entry. Names are decoded as UTF-8, which is
124
+ * what OOXML producers write (general-purpose bit 11). */
125
+ declare function readZipDirectory(bytes: Uint8Array): ZipOutcome<ZipEntry[]>;
126
+ /**
127
+ * Ceiling on what ONE entry may expand to. A deflate stream reaches ~1000:1 on
128
+ * repetitive input, so an archive small enough to pass any upload gate can ask
129
+ * for gigabytes: measured here, a 305,893-byte archive declared a single entry
130
+ * expanding to 314,572,800 bytes. A Cloudflare Worker isolate has 128 MB, so
131
+ * that is an out-of-memory crash, not a slow path — and a crash is not a typed
132
+ * error a product can report. 32 MB is far past any real Office part (the main
133
+ * document of a 400-page contract is single-digit MB) and far under the
134
+ * isolate's budget.
135
+ */
136
+ declare const DEFAULT_MAX_ZIP_ENTRY_BYTES: number;
137
+ /** Options for {@link readZipEntry}. */
138
+ interface ReadZipEntryOptions {
139
+ /** Ceiling on the entry's UNCOMPRESSED size. Defaults to
140
+ * {@link DEFAULT_MAX_ZIP_ENTRY_BYTES}. Checked against the directory's
141
+ * declared size before any inflate runs, and again against the real output
142
+ * as it streams, because the declared size is the archive's claim. */
143
+ readonly maxUncompressedBytes?: number;
144
+ }
145
+ /** Inflate one entry's bytes. The local header supplies only the variable-length
146
+ * field sizes needed to find the payload; sizes come from the directory. */
147
+ declare function readZipEntry(bytes: Uint8Array, entry: ZipEntry, options?: ReadZipEntryOptions): Promise<ZipOutcome<Uint8Array>>;
148
+
149
+ /**
150
+ * DOCX → plain text, one paragraph per line.
151
+ *
152
+ * The main document part is resolved through the OPC relationship graph
153
+ * (`_rels/.rels` → the `officeDocument` relationship's target) rather than
154
+ * assuming `word/document.xml`, because the part name is a producer's choice,
155
+ * not a constant.
156
+ *
157
+ * WordprocessingML text lives in `<w:t>` runs. Everything else is markup, with
158
+ * four exceptions that carry meaning a reader would otherwise lose: `<w:tab/>`,
159
+ * `<w:br/>`, `<w:cr/>`, and the paragraph boundary `</w:p>`. Two element bodies
160
+ * are deliberately DROPPED — `<w:instrText>` (field instruction codes such as
161
+ * `HYPERLINK "…"`, which are machinery, not prose) and `<w:delText>` (text a
162
+ * tracked-changes revision deleted; extracting it would show a reader words the
163
+ * author removed).
164
+ *
165
+ * One line per paragraph, not blank-line-separated paragraphs: extractors
166
+ * downstream match line-anchored patterns against form and contract text, so a
167
+ * predictable line structure is the useful shape.
168
+ */
169
+
170
+ /** Resolve XML character/entity references. Unknown entities are left verbatim
171
+ * rather than dropped, so nothing silently disappears from a document. */
172
+ declare function decodeXmlEntities(input: string): string;
173
+ interface DocxText {
174
+ readonly text: string;
175
+ readonly paragraphCount: number;
176
+ }
177
+ /**
178
+ * Walk WordprocessingML and emit its readable text.
179
+ *
180
+ * Hand-scanned rather than regex-split because comments and CDATA sections may
181
+ * contain `>`; a `/<[^>]*>/` scan ends the tag early on the first one and
182
+ * corrupts everything after it.
183
+ */
184
+ declare function wordprocessingXmlToText(xml: string): DocxText;
185
+ /**
186
+ * Extract the readable text of a `.docx` / `.docm` package. Every failure names
187
+ * the archive-level cause; a package this cannot read is an error, never an
188
+ * empty document.
189
+ *
190
+ * `zip.maxUncompressedBytes` bounds what each part may expand to. It defaults
191
+ * to the zip reader's own ceiling, which is what keeps a deflate bomb inside a
192
+ * small `.docx` a typed error instead of an out-of-memory crash.
193
+ */
194
+ declare function extractDocxText(bytes: Uint8Array, mediaType: string, zip?: ReadZipEntryOptions): Promise<DocumentOutcome<{
195
+ text: string;
196
+ detail: DocxExtractionDetail;
197
+ }>>;
198
+
199
+ /**
200
+ * Media type → extraction format. Resolution order is declared type first,
201
+ * filename extension second (products routinely receive `application/octet-stream`
202
+ * from a browser upload), and nothing else — byte sniffing belongs to the
203
+ * upload gate that reads untrusted bytes, not to the extractor that has already
204
+ * been handed a decision.
205
+ */
206
+
207
+ /** OOXML WordprocessingML — the `.docx` a word processor writes. */
208
+ declare const DOCX_MEDIA_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
209
+ /** Macro-enabled WordprocessingML (`.docm`). Same part structure, so text
210
+ * extraction is identical; the VBA project is never read or executed. */
211
+ declare const DOCM_MEDIA_TYPE = "application/vnd.ms-word.document.macroEnabled.12";
212
+ declare const PDF_MEDIA_TYPE = "application/pdf";
213
+ interface ResolvedMediaType {
214
+ readonly format: DocumentFormat;
215
+ /** Canonical media type for the resolved format. */
216
+ readonly mediaType: string;
217
+ }
218
+ /** Strip parameters and case from a media type: `Text/Plain; charset=utf-8` →
219
+ * `text/plain`. */
220
+ declare function normalizeMediaType(mediaType: string): string;
221
+ interface ResolveMediaTypeInput {
222
+ /** The type the upload declared. May be empty or `application/octet-stream`. */
223
+ readonly mediaType?: string;
224
+ /** Consulted only when `mediaType` is missing or generic. */
225
+ readonly filename?: string;
226
+ }
227
+ /**
228
+ * Decide which extractor handles these bytes. Fails loud rather than guessing:
229
+ * an unrecognized type names itself and lists what is supported.
230
+ */
231
+ declare function resolveMediaType(input: ResolveMediaTypeInput): DocumentOutcome<ResolvedMediaType>;
232
+
233
+ export { DEFAULT_MAX_DOCUMENT_BYTES, DEFAULT_MAX_ZIP_ENTRY_BYTES, DOCM_MEDIA_TYPE, DOCX_MEDIA_TYPE, type DocumentExtractor, type DocumentExtractorConfig, DocumentFormat, DocumentOutcome, DocxExtractionDetail, type DocxText, type ExtractDocumentOptions, ExtractedDocument, PDF_MEDIA_TYPE, PdfClassification, PdfEngine, PdfTextFormat, type ReadZipEntryOptions, type ResolveMediaTypeInput, type ResolvedMediaType, type ZipEntry, type ZipOutcome, classifyPdfDocument, createDocumentExtractor, decodeXmlEntities, extractDocument, extractDocxText, normalizeMediaType, readZipDirectory, readZipEntry, resolveMediaType, wordprocessingXmlToText };