@bendyline/docblocks 1.1.2 → 2.0.0
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 +76 -11
- package/dist/chunk-2D7Y4IR3.js +1293 -0
- package/dist/chunk-2D7Y4IR3.js.map +1 -0
- package/dist/chunk-5MYAICRE.js +957 -0
- package/dist/chunk-5MYAICRE.js.map +1 -0
- package/dist/chunk-75UUF6C4.js +802 -0
- package/dist/chunk-75UUF6C4.js.map +1 -0
- package/dist/chunk-AEHCVWU5.js +25 -0
- package/dist/chunk-AEHCVWU5.js.map +1 -0
- package/dist/chunk-AYZ4HN5M.js +20 -0
- package/dist/chunk-AYZ4HN5M.js.map +1 -0
- package/dist/chunk-EGNDADXB.js +111 -0
- package/dist/chunk-EGNDADXB.js.map +1 -0
- package/dist/chunk-EZKJZUNJ.js +13 -0
- package/dist/chunk-EZKJZUNJ.js.map +1 -0
- package/dist/chunk-FNW556FN.js +75 -0
- package/dist/chunk-FNW556FN.js.map +1 -0
- package/dist/chunk-GCPBEMMH.js +563 -0
- package/dist/chunk-GCPBEMMH.js.map +1 -0
- package/dist/chunk-J32GU3F3.js +1664 -0
- package/dist/chunk-J32GU3F3.js.map +1 -0
- package/dist/chunk-PGR7LK6D.js +1062 -0
- package/dist/chunk-PGR7LK6D.js.map +1 -0
- package/dist/chunk-RQJRQF46.js +787 -0
- package/dist/chunk-RQJRQF46.js.map +1 -0
- package/dist/{chunk-ME76RUMR.js → chunk-RVQHY3XU.js} +15 -1
- package/dist/chunk-RVQHY3XU.js.map +1 -0
- package/dist/chunk-SI2LU2RP.js +224 -0
- package/dist/chunk-SI2LU2RP.js.map +1 -0
- package/dist/chunk-W5UUUII5.js +142 -0
- package/dist/chunk-W5UUUII5.js.map +1 -0
- package/dist/document/document-session.d.ts +127 -0
- package/dist/document/document-session.d.ts.map +1 -0
- package/dist/document/document-session.js +749 -0
- package/dist/document/document-session.js.map +1 -0
- package/dist/document/filesystem-target.d.ts +17 -0
- package/dist/document/filesystem-target.d.ts.map +1 -0
- package/dist/document/filesystem-target.js +70 -0
- package/dist/document/filesystem-target.js.map +1 -0
- package/dist/document/index.d.ts +6 -0
- package/dist/document/index.d.ts.map +1 -0
- package/dist/document/index.js +4 -0
- package/dist/document/index.js.map +1 -0
- package/dist/document/recovery-journal.d.ts +125 -0
- package/dist/document/recovery-journal.d.ts.map +1 -0
- package/dist/document/recovery-journal.js +385 -0
- package/dist/document/recovery-journal.js.map +1 -0
- package/dist/document/types.d.ts +89 -0
- package/dist/document/types.d.ts.map +1 -0
- package/dist/document/types.js +9 -0
- package/dist/document/types.js.map +1 -0
- package/dist/filesystem/commit-lock.d.ts +3 -0
- package/dist/filesystem/commit-lock.d.ts.map +1 -0
- package/dist/filesystem/commit-lock.js +20 -0
- package/dist/filesystem/commit-lock.js.map +1 -0
- package/dist/filesystem/dbk-workspace.d.ts +34 -0
- package/dist/filesystem/dbk-workspace.d.ts.map +1 -0
- package/dist/filesystem/dbk-workspace.js +85 -0
- package/dist/filesystem/dbk-workspace.js.map +1 -0
- package/dist/filesystem/electron-provider-v2.d.ts +36 -0
- package/dist/filesystem/electron-provider-v2.d.ts.map +1 -0
- package/dist/filesystem/electron-provider-v2.js +503 -0
- package/dist/filesystem/electron-provider-v2.js.map +1 -0
- package/dist/filesystem/electron-provider.d.ts +6 -3
- package/dist/filesystem/electron-provider.d.ts.map +1 -1
- package/dist/filesystem/electron-provider.js +18 -13
- package/dist/filesystem/electron-provider.js.map +1 -1
- package/dist/filesystem/electron.d.ts +4 -0
- package/dist/filesystem/electron.d.ts.map +1 -0
- package/dist/filesystem/electron.js +4 -0
- package/dist/filesystem/electron.js.map +1 -0
- package/dist/filesystem/filesystem-content-container.d.ts +1 -1
- package/dist/filesystem/filesystem-content-container.d.ts.map +1 -1
- package/dist/filesystem/filesystem-content-container.js +50 -13
- package/dist/filesystem/filesystem-content-container.js.map +1 -1
- package/dist/filesystem/fs-error.d.ts +46 -0
- package/dist/filesystem/fs-error.d.ts.map +1 -0
- package/dist/filesystem/fs-error.js +170 -0
- package/dist/filesystem/fs-error.js.map +1 -0
- package/dist/filesystem/index.d.ts +15 -1
- package/dist/filesystem/index.d.ts.map +1 -1
- package/dist/filesystem/index.js +13 -0
- package/dist/filesystem/index.js.map +1 -1
- package/dist/filesystem/indexeddb-content-container.d.ts +3 -1
- package/dist/filesystem/indexeddb-content-container.d.ts.map +1 -1
- package/dist/filesystem/indexeddb-content-container.js +18 -11
- package/dist/filesystem/indexeddb-content-container.js.map +1 -1
- package/dist/filesystem/indexeddb-provider-v2.d.ts +96 -0
- package/dist/filesystem/indexeddb-provider-v2.d.ts.map +1 -0
- package/dist/filesystem/indexeddb-provider-v2.js +1241 -0
- package/dist/filesystem/indexeddb-provider-v2.js.map +1 -0
- package/dist/filesystem/indexeddb-provider.d.ts +21 -14
- package/dist/filesystem/indexeddb-provider.d.ts.map +1 -1
- package/dist/filesystem/indexeddb-provider.js +111 -261
- package/dist/filesystem/indexeddb-provider.js.map +1 -1
- package/dist/filesystem/indexeddb-store.d.ts +34 -0
- package/dist/filesystem/indexeddb-store.d.ts.map +1 -0
- package/dist/filesystem/indexeddb-store.js +165 -0
- package/dist/filesystem/indexeddb-store.js.map +1 -0
- package/dist/filesystem/indexeddb.d.ts +5 -0
- package/dist/filesystem/indexeddb.d.ts.map +1 -0
- package/dist/filesystem/indexeddb.js +5 -0
- package/dist/filesystem/indexeddb.js.map +1 -0
- package/dist/filesystem/legacy-v2-adapter.d.ts +62 -0
- package/dist/filesystem/legacy-v2-adapter.d.ts.map +1 -0
- package/dist/filesystem/legacy-v2-adapter.js +499 -0
- package/dist/filesystem/legacy-v2-adapter.js.map +1 -0
- package/dist/filesystem/memory-provider-v2.d.ts +92 -0
- package/dist/filesystem/memory-provider-v2.d.ts.map +1 -0
- package/dist/filesystem/memory-provider-v2.js +615 -0
- package/dist/filesystem/memory-provider-v2.js.map +1 -0
- package/dist/filesystem/memory-provider.d.ts +54 -0
- package/dist/filesystem/memory-provider.d.ts.map +1 -0
- package/dist/filesystem/memory-provider.js +132 -0
- package/dist/filesystem/memory-provider.js.map +1 -0
- package/dist/filesystem/memory.d.ts +4 -0
- package/dist/filesystem/memory.d.ts.map +1 -0
- package/dist/filesystem/memory.js +4 -0
- package/dist/filesystem/memory.js.map +1 -0
- package/dist/filesystem/move-entry.d.ts +9 -0
- package/dist/filesystem/move-entry.d.ts.map +1 -0
- package/dist/filesystem/move-entry.js +103 -0
- package/dist/filesystem/move-entry.js.map +1 -0
- package/dist/filesystem/move-error.d.ts +53 -0
- package/dist/filesystem/move-error.d.ts.map +1 -0
- package/dist/filesystem/move-error.js +99 -0
- package/dist/filesystem/move-error.js.map +1 -0
- package/dist/filesystem/native-provider-v2.d.ts +75 -0
- package/dist/filesystem/native-provider-v2.d.ts.map +1 -0
- package/dist/filesystem/native-provider-v2.js +849 -0
- package/dist/filesystem/native-provider-v2.js.map +1 -0
- package/dist/filesystem/native-provider.d.ts +9 -1
- package/dist/filesystem/native-provider.d.ts.map +1 -1
- package/dist/filesystem/native-provider.js +172 -37
- package/dist/filesystem/native-provider.js.map +1 -1
- package/dist/filesystem/native.d.ts +4 -0
- package/dist/filesystem/native.d.ts.map +1 -0
- package/dist/filesystem/native.js +4 -0
- package/dist/filesystem/native.js.map +1 -0
- package/dist/filesystem/types.d.ts +37 -4
- package/dist/filesystem/types.d.ts.map +1 -1
- package/dist/filesystem/types.js +11 -3
- package/dist/filesystem/types.js.map +1 -1
- package/dist/filesystem/v2.d.ts +172 -0
- package/dist/filesystem/v2.d.ts.map +1 -0
- package/dist/filesystem/v2.js +16 -0
- package/dist/filesystem/v2.js.map +1 -0
- package/dist/filesystem/workspace-path.d.ts +21 -0
- package/dist/filesystem/workspace-path.d.ts.map +1 -0
- package/dist/filesystem/workspace-path.js +80 -0
- package/dist/filesystem/workspace-path.js.map +1 -0
- package/dist/host/filesystem-v2.d.ts +45 -0
- package/dist/host/filesystem-v2.d.ts.map +1 -0
- package/dist/host/filesystem-v2.js +13 -0
- package/dist/host/filesystem-v2.js.map +1 -0
- package/dist/host/git.d.ts +200 -0
- package/dist/host/git.d.ts.map +1 -0
- package/dist/host/git.js +15 -0
- package/dist/host/git.js.map +1 -0
- package/dist/host/index.d.ts +4 -1
- package/dist/host/index.d.ts.map +1 -1
- package/dist/host/index.js +2 -0
- package/dist/host/index.js.map +1 -1
- package/dist/host/types.d.ts +114 -31
- package/dist/host/types.d.ts.map +1 -1
- package/dist/host/wire-policy.d.ts +22 -0
- package/dist/host/wire-policy.d.ts.map +1 -0
- package/dist/host/wire-policy.js +92 -0
- package/dist/host/wire-policy.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +4 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/types.d.ts +466 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +25 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/mcp/wire.d.ts +29 -0
- package/dist/mcp/wire.d.ts.map +1 -0
- package/dist/mcp/wire.js +1046 -0
- package/dist/mcp/wire.js.map +1 -0
- package/dist/mcp/zod.d.ts +5763 -0
- package/dist/mcp/zod.d.ts.map +1 -0
- package/dist/mcp/zod.js +908 -0
- package/dist/mcp/zod.js.map +1 -0
- package/dist/types-CX893hgH.d.ts +468 -0
- package/dist/types-CsX6EN2t.d.ts +301 -0
- package/dist/types-eOlt9J7n.d.ts +478 -0
- package/dist/vscode/index.d.ts +3 -0
- package/dist/vscode/index.d.ts.map +1 -0
- package/dist/vscode/index.js +3 -0
- package/dist/vscode/index.js.map +1 -0
- package/dist/vscode/messages.d.ts +204 -0
- package/dist/vscode/messages.d.ts.map +1 -0
- package/dist/vscode/messages.js +494 -0
- package/dist/vscode/messages.js.map +1 -0
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/index.js.map +1 -1
- package/dist/workspace/reconcile-electron.d.ts +19 -0
- package/dist/workspace/reconcile-electron.d.ts.map +1 -0
- package/dist/workspace/reconcile-electron.js +42 -0
- package/dist/workspace/reconcile-electron.js.map +1 -0
- package/dist/workspace/types.d.ts +41 -1
- package/dist/workspace/types.d.ts.map +1 -1
- package/dist/workspace/types.js +0 -4
- package/dist/workspace/types.js.map +1 -1
- package/dist/workspace/workspace-manager.d.ts +17 -5
- package/dist/workspace/workspace-manager.d.ts.map +1 -1
- package/dist/workspace/workspace-manager.js +55 -11
- package/dist/workspace/workspace-manager.js.map +1 -1
- package/dist/workspace-path-CWVrcuPL.d.ts +21 -0
- package/package.json +43 -2
- package/src/document/document-session.ts +834 -0
- package/src/document/filesystem-target.ts +109 -0
- package/src/document/index.ts +41 -0
- package/src/document/recovery-journal.ts +536 -0
- package/src/document/types.ts +116 -0
- package/src/filesystem/commit-lock.ts +29 -0
- package/src/filesystem/dbk-workspace.ts +135 -0
- package/src/filesystem/electron-provider-v2.ts +630 -0
- package/src/filesystem/electron-provider.ts +25 -14
- package/src/filesystem/electron.ts +3 -0
- package/src/filesystem/filesystem-content-container.ts +53 -15
- package/src/filesystem/fs-error.ts +234 -0
- package/src/filesystem/index.ts +119 -0
- package/src/filesystem/indexeddb-content-container.ts +20 -12
- package/src/filesystem/indexeddb-provider-v2.ts +1740 -0
- package/src/filesystem/indexeddb-provider.ts +126 -300
- package/src/filesystem/indexeddb-store.ts +207 -0
- package/src/filesystem/indexeddb.ts +12 -0
- package/src/filesystem/legacy-v2-adapter.ts +779 -0
- package/src/filesystem/memory-provider-v2.ts +896 -0
- package/src/filesystem/memory-provider.ts +180 -0
- package/src/filesystem/memory.ts +15 -0
- package/src/filesystem/move-entry.ts +142 -0
- package/src/filesystem/move-error.ts +159 -0
- package/src/filesystem/native-provider-v2.ts +1165 -0
- package/src/filesystem/native-provider.ts +194 -41
- package/src/filesystem/native.ts +16 -0
- package/src/filesystem/types.ts +49 -4
- package/src/filesystem/v2.ts +231 -0
- package/src/filesystem/workspace-path.ts +92 -0
- package/src/host/filesystem-v2.ts +104 -0
- package/src/host/git.ts +246 -0
- package/src/host/index.ts +46 -0
- package/src/host/types.ts +155 -34
- package/src/host/wire-policy.ts +103 -0
- package/src/index.ts +2 -1
- package/src/mcp/index.ts +3 -0
- package/src/mcp/types.ts +594 -0
- package/src/mcp/wire.ts +1280 -0
- package/src/mcp/zod.ts +1000 -0
- package/src/vscode/index.ts +2 -0
- package/src/vscode/messages.ts +704 -0
- package/src/workspace/index.ts +8 -1
- package/src/workspace/reconcile-electron.ts +65 -0
- package/src/workspace/types.ts +39 -1
- package/src/workspace/workspace-manager.ts +71 -10
- package/dist/chunk-GUNM43XZ.js +0 -63
- package/dist/chunk-GUNM43XZ.js.map +0 -1
- package/dist/chunk-IM7LCQJ6.js +0 -850
- package/dist/chunk-IM7LCQJ6.js.map +0 -1
- package/dist/chunk-ME76RUMR.js.map +0 -1
- package/dist/index-pgBHBQ9G.d.ts +0 -213
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mcp/types.ts","../src/mcp/wire.ts"],"sourcesContent":["import type { WorkspacePath } from '../filesystem/workspace-path.js';\n\n/** Version of the exact DocBlocks MCP wire envelopes in this module. */\nexport const DOCBLOCKS_MCP_WIRE_VERSION = 1 as const;\n\nexport type DocBlocksMcpWireVersion = typeof DOCBLOCKS_MCP_WIRE_VERSION;\n\n/** Canonical artifact-first tools exposed by the local DocBlocks MCP server. */\nexport const DOCBLOCKS_MCP_TOOL_NAMES = [\n 'list_roots',\n 'get_conversion_report',\n 'convert_document',\n 'create_document_bundle',\n 'save_artifact',\n 'inspect_document',\n 'validate_document',\n 'preview_document',\n 'compare_documents',\n 'list_templates',\n 'describe_template',\n 'recommend_templates',\n 'describe_theme',\n 'infer_theme_from_file',\n 'inspect_pptx_layouts',\n 'apply_inferred_theme',\n 'list_formats',\n 'list_themes',\n 'list_transform_styles',\n] as const;\n\nexport type DocBlocksMcpToolName = (typeof DOCBLOCKS_MCP_TOOL_NAMES)[number];\n\nexport type AppliedOptionValue = string | number | boolean | null;\n\nexport interface AppliedOption {\n readonly name: string;\n readonly value: AppliedOptionValue;\n}\n\nexport interface EngineVersion {\n readonly name: string;\n readonly version: string;\n}\n\n/** Immutable, session-scoped output which can be read through an MCP resource. */\nexport interface ArtifactRef {\n readonly id: string;\n readonly uri: string;\n readonly format: string;\n readonly mimeType: string;\n readonly size: number;\n readonly sha256: string;\n readonly sourceFormat: string | null;\n readonly sourceSha256: string | null;\n readonly suggestedFilename: string;\n readonly appliedOptions: readonly AppliedOption[];\n readonly engineVersions: readonly EngineVersion[];\n readonly createdAt: string;\n readonly expiresAt: string | null;\n}\n\n/** Exactly one bounded, authority-scoped content source for a bundle asset. */\nexport type BundleAssetContentSource =\n | {\n readonly kind: 'file';\n readonly rootId: string;\n readonly path: WorkspacePath;\n }\n | {\n readonly kind: 'artifact';\n readonly uri: string;\n };\n\n/** An asset retained beside Markdown at one canonical path in a document bundle. */\nexport interface BundleAssetRef {\n readonly path: WorkspacePath;\n readonly source: BundleAssetContentSource;\n readonly mimeType: string | null;\n readonly altText: string | null;\n readonly credit: string | null;\n readonly license: string | null;\n}\n\n/** Inline Markdown. Use artifact or file sources for large or binary documents. */\nexport interface MarkdownDocumentSource {\n readonly kind: 'markdown';\n readonly markdown: string;\n readonly name: string | null;\n}\n\n/** A file selected from a server-configured, authority-scoped root. */\nexport interface FileDocumentSource {\n readonly kind: 'file';\n readonly rootId: string;\n readonly path: WorkspacePath;\n readonly format: string | null;\n}\n\n/** A previously produced immutable artifact. */\nexport interface ArtifactDocumentSource {\n readonly kind: 'artifact';\n readonly uri: string;\n}\n\n/** Markdown plus artifact-backed media, preserving a complete document tree. */\nexport interface BundleDocumentSource {\n readonly kind: 'bundle';\n readonly markdown: string;\n readonly assets: readonly BundleAssetRef[];\n readonly name: string | null;\n}\n\nexport type DocumentSource =\n | MarkdownDocumentSource\n | FileDocumentSource\n | ArtifactDocumentSource\n | BundleDocumentSource;\n\nexport type DiagnosticSeverity = 'info' | 'warning' | 'error';\n\nexport type DiagnosticStage =\n | 'resolve'\n | 'import'\n | 'parse'\n | 'inspect'\n | 'validate'\n | 'transform'\n | 'convert'\n | 'render'\n | 'export'\n | 'materialize'\n | 'compare';\n\nexport type DiagnosticLocation =\n | {\n readonly kind: 'source';\n readonly line: number;\n readonly column: number;\n }\n | {\n readonly kind: 'block';\n readonly blockId: string;\n readonly nodeType: string;\n }\n | {\n readonly kind: 'asset';\n readonly path: WorkspacePath;\n }\n | {\n readonly kind: 'item';\n readonly itemKind: 'page' | 'slide' | 'sheet' | 'frame';\n readonly index: number;\n };\n\n/** Stable, machine-actionable diagnostic shared by every MCP operation. */\nexport interface McpDiagnostic {\n readonly code: string;\n readonly severity: DiagnosticSeverity;\n readonly stage: DiagnosticStage;\n readonly format: string | null;\n readonly count: number;\n readonly message: string;\n readonly remediation: string | null;\n readonly retryable: boolean;\n readonly location: DiagnosticLocation | null;\n}\n\nexport interface McpErrorDetail {\n readonly code: string;\n readonly message: string;\n readonly stage: DiagnosticStage | null;\n readonly format: string | null;\n readonly hint: string | null;\n readonly retryable: boolean;\n readonly operationLoad: {\n readonly active: number;\n readonly capacity: number;\n } | null;\n}\n\n/** Exact failure envelope returned as structured content by MCP tools. */\nexport interface McpErrorResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'error';\n readonly result: null;\n readonly error: McpErrorDetail;\n}\n\n/** Exact success envelope used by MCP tool structured content. */\nexport interface McpSuccessResult<T> {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'success';\n readonly result: T;\n readonly error: null;\n}\n\nexport type ConversionFidelity = 'semantic' | 'editable-native' | 'rendered-fidelity' | 'hybrid';\n\nexport interface ConversionResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'conversion';\n readonly sourceFormat: string;\n readonly targetFormat: string;\n readonly artifact: ArtifactRef;\n readonly fidelity: ConversionFidelity;\n readonly appliedThemeId: string | null;\n readonly appliedTransformId: string | null;\n /** Source-side assets available to the conversion, including durable attribution metadata. */\n readonly sourceAssets: readonly AssetSummary[];\n readonly sourceAssetCount: number;\n readonly diagnostics: readonly McpDiagnostic[];\n}\n\n/** Successful payload returned by the canonical multi-target conversion tool. */\nexport interface ConvertDocumentResult {\n readonly results: readonly ConversionResult[];\n}\n\nexport interface DocumentMetadataSummary {\n readonly title: string | null;\n readonly author: string | null;\n readonly description: string | null;\n}\n\nexport interface DocumentStatistics {\n readonly blockCount: number;\n readonly wordCount: number;\n readonly characterCount: number;\n readonly tableCount: number;\n readonly linkCount: number;\n readonly assetCount: number;\n readonly pageCount: number | null;\n readonly slideCount: number | null;\n readonly sheetCount: number | null;\n}\n\nexport interface OutlineEntry {\n readonly id: string;\n readonly title: string;\n readonly level: number;\n readonly blockIndex: number;\n}\n\nexport interface SourceRange {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface BlockSummary {\n readonly id: string;\n readonly type: string;\n readonly text: string;\n readonly wordCount: number;\n readonly templateId: string | null;\n readonly sourceRange: SourceRange | null;\n}\n\nexport interface TableSummary {\n readonly index: number;\n readonly rowCount: number;\n readonly columnCount: number;\n readonly headers: readonly string[];\n}\n\nexport interface LinkSummary {\n readonly index: number;\n readonly text: string;\n readonly target: string;\n}\n\nexport interface DocumentItemSummary {\n readonly kind: PreviewItemKind;\n readonly index: number;\n readonly label: string | null;\n readonly blockIds: readonly string[];\n}\n\nexport interface AssetSummary {\n readonly path: WorkspacePath;\n readonly mimeType: string;\n readonly size: number;\n readonly sha256: string | null;\n readonly altText: string | null;\n readonly credit: string | null;\n readonly license: string | null;\n}\n\nexport interface ThemeSummary {\n readonly id: string;\n readonly name: string;\n readonly source: 'built-in' | 'document' | 'inferred';\n readonly layouts: readonly string[];\n}\n\nexport interface InspectionResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'inspection';\n readonly sourceFormat: string;\n readonly metadata: DocumentMetadataSummary;\n readonly statistics: DocumentStatistics;\n readonly outline: readonly OutlineEntry[];\n readonly blocks: readonly BlockSummary[];\n readonly blockOffset: number;\n readonly nextCursor: string | null;\n readonly tables: readonly TableSummary[];\n readonly links: readonly LinkSummary[];\n readonly items: readonly DocumentItemSummary[];\n readonly assets: readonly AssetSummary[];\n readonly theme: ThemeSummary | null;\n readonly truncated: boolean;\n readonly detailsTruncated: boolean;\n readonly diagnostics: readonly McpDiagnostic[];\n}\n\nexport interface ValidationSummary {\n readonly errorCount: number;\n readonly warningCount: number;\n readonly infoCount: number;\n}\n\nexport interface ValidationResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'validation';\n readonly sourceFormat: string;\n readonly targetFormat: string | null;\n readonly valid: boolean;\n readonly summary: ValidationSummary;\n readonly diagnostics: readonly McpDiagnostic[];\n}\n\nexport type PreviewItemKind = 'page' | 'slide' | 'sheet' | 'frame';\n\nexport interface PreviewItem {\n readonly kind: PreviewItemKind;\n readonly index: number;\n readonly label: string | null;\n readonly artifact: ArtifactRef;\n readonly width: number;\n readonly height: number;\n}\n\nexport interface PreviewResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'preview';\n readonly sourceFormat: string;\n readonly previewBasis: 'source-render' | 'reconstructed-import' | 'native-extracted';\n readonly totalItems: number;\n readonly items: readonly PreviewItem[];\n readonly truncated: boolean;\n readonly diagnostics: readonly McpDiagnostic[];\n}\n\nexport type ComparisonCategory =\n | 'text'\n | 'structure'\n | 'table'\n | 'media'\n | 'theme'\n | 'layout'\n | 'metadata'\n | 'timing'\n | 'accessibility';\n\nexport type ComparisonStatus = 'retained' | 'changed' | 'degraded' | 'omitted' | 'added';\n\nexport interface ComparisonChange {\n readonly category: ComparisonCategory;\n readonly status: ComparisonStatus;\n readonly path: string | null;\n readonly message: string;\n}\n\nexport interface ComparisonMetric {\n readonly name: string;\n readonly leftValue: number;\n readonly rightValue: number;\n readonly similarity: number;\n}\n\nexport interface ComparisonResult {\n readonly version: DocBlocksMcpWireVersion;\n readonly kind: 'comparison';\n readonly leftFormat: string;\n readonly rightFormat: string;\n readonly equivalent: boolean;\n readonly score: number;\n readonly changes: readonly ComparisonChange[];\n readonly metrics: readonly ComparisonMetric[];\n readonly diagnostics: readonly McpDiagnostic[];\n}\n\nexport interface RootGrantSummary {\n readonly id: string;\n readonly label: string;\n readonly read: boolean;\n readonly write: boolean;\n}\n\nexport interface ListRootsResult {\n readonly roots: readonly RootGrantSummary[];\n}\n\nexport interface SavedArtifactDestination {\n readonly rootId: string;\n readonly path: WorkspacePath;\n}\n\nexport interface SaveArtifactResult {\n readonly artifact: ArtifactRef;\n readonly destination: SavedArtifactDestination;\n readonly sha256: string;\n}\n\nexport type FormatDirectionCapability =\n | {\n readonly supported: true;\n readonly tool: 'inspect_document' | 'convert_document';\n }\n | {\n readonly supported: false;\n readonly excludedReason: string;\n };\n\nexport interface FormatCapabilitySummary {\n readonly id: string;\n readonly label: string;\n readonly mimeType: string;\n readonly extensions: readonly string[];\n readonly import: FormatDirectionCapability;\n readonly export: FormatDirectionCapability;\n}\n\nexport interface ListFormatsResult {\n readonly formats: readonly FormatCapabilitySummary[];\n}\n\nexport interface ThemeCatalogEntry {\n readonly id: string;\n readonly name: string;\n readonly description?: string;\n}\n\nexport interface ListThemesResult {\n readonly themes: readonly ThemeCatalogEntry[];\n}\n\nexport interface TransformStyleSummary {\n readonly id: string;\n readonly name: string;\n readonly description: string;\n}\n\nexport interface ListTransformStylesResult {\n readonly styles: readonly TransformStyleSummary[];\n}\n\nexport interface TemplateSummary {\n readonly id: string;\n readonly label: string;\n readonly description: string;\n}\n\nexport interface ListTemplatesResult {\n readonly templates: readonly TemplateSummary[];\n}\n\nexport interface TemplateInputSummary {\n readonly key: string;\n readonly description: string;\n readonly type: string;\n readonly required: boolean;\n readonly values: readonly string[];\n readonly valueHint: string | null;\n}\n\nexport interface DescribedTemplate extends TemplateSummary {\n readonly inputs: readonly TemplateInputSummary[];\n}\n\nexport interface DescribeTemplateResult {\n readonly template: DescribedTemplate;\n readonly annotationExample: string;\n}\n\nexport interface TemplateContentProfile {\n readonly hasImage: boolean;\n readonly imageCount: number;\n readonly hasVideo: boolean;\n readonly hasBlockquote: boolean;\n readonly hasList: boolean;\n readonly hasTable: boolean;\n readonly hasDate: boolean;\n readonly hasNumberHighlight: boolean;\n readonly wordCount: number;\n readonly hasAsciiDiagram: boolean;\n readonly hasTimeline: boolean;\n readonly hasTree: boolean;\n}\n\nexport interface TemplateRecommendation {\n readonly blockId: string;\n readonly title: string | null;\n readonly profile: TemplateContentProfile;\n readonly recommendedTemplateIds: readonly string[];\n}\n\nexport interface RecommendTemplatesResult {\n readonly recommendations: readonly TemplateRecommendation[];\n readonly totalBlocks: number;\n readonly truncated: boolean;\n}\n\nexport interface ThemeDescriptionColors {\n readonly primary: string;\n readonly secondary: string;\n readonly background: string;\n readonly text: string;\n readonly highlight: string;\n}\n\nexport interface ThemeDescription {\n readonly id: string;\n readonly name: string;\n readonly description: string;\n readonly colors: ThemeDescriptionColors;\n readonly bodyFont: string;\n readonly titleFont: string;\n}\n\nexport interface DescribeThemeResult {\n readonly theme: ThemeDescription;\n readonly source: 'built-in' | 'document';\n}\n\nexport interface InferredLayoutSummary {\n readonly id: string;\n readonly name: string;\n readonly description: string;\n}\n\nexport interface InferThemeResult {\n readonly sourceFormat: string;\n readonly sourceSha256: string;\n readonly theme: ThemeDescription;\n readonly layouts: readonly InferredLayoutSummary[];\n readonly warnings: readonly string[];\n}\n\nexport interface PptxSlideSize {\n readonly cx: number;\n readonly cy: number;\n}\n\nexport interface PptxLayoutSummary {\n readonly layoutPath: string;\n readonly name: string;\n readonly masterName: string | null;\n readonly type: string | null;\n readonly slideCount: number;\n readonly verdict: 'builtin' | 'custom' | 'plain' | 'skip';\n readonly templateId: string | null;\n readonly notes: readonly string[];\n}\n\nexport interface InspectPptxLayoutsResult {\n readonly slideSize: PptxSlideSize;\n readonly layouts: readonly PptxLayoutSummary[];\n}\n\nexport interface ApplyInferredThemeResult {\n readonly result: ConversionResult;\n readonly theme: ThemeDescription;\n readonly layoutIds: readonly string[];\n readonly warnings: readonly string[];\n}\n\n/**\n * Safe materialization never overwrites by default. Replacement is available\n * only as a process-serialized, hash-conditional update which revalidates the\n * observed target bytes immediately before atomic publication.\n */\nexport type MaterializationOptions =\n | {\n readonly rootId: string;\n readonly path: WorkspacePath;\n readonly ifExists: 'error';\n readonly expectedSha256: null;\n }\n | {\n readonly rootId: string;\n readonly path: WorkspacePath;\n readonly ifExists: 'replace';\n readonly expectedSha256: string;\n };\n","import { tryParseWorkspacePath, type WorkspacePath } from '../filesystem/workspace-path.js';\nimport {\n DOCBLOCKS_MCP_WIRE_VERSION,\n type AppliedOption,\n type ArtifactRef,\n type AssetSummary,\n type BlockSummary,\n type BundleAssetRef,\n type BundleAssetContentSource,\n type ComparisonChange,\n type ComparisonMetric,\n type ComparisonResult,\n type ConversionFidelity,\n type ConversionResult,\n type DiagnosticLocation,\n type DiagnosticSeverity,\n type DiagnosticStage,\n type DocumentMetadataSummary,\n type DocumentItemSummary,\n type DocumentSource,\n type DocumentStatistics,\n type EngineVersion,\n type InspectionResult,\n type LinkSummary,\n type MaterializationOptions,\n type McpDiagnostic,\n type McpErrorResult,\n type OutlineEntry,\n type PreviewItem,\n type PreviewResult,\n type SourceRange,\n type ThemeSummary,\n type TableSummary,\n type ValidationResult,\n type ValidationSummary,\n} from './types.js';\n\n/** Quantitative limits for untrusted MCP payloads. */\nexport const MCP_WIRE_LIMITS = Object.freeze({\n identifierCharacters: 256,\n formatCharacters: 64,\n mimeTypeCharacters: 256,\n labelCharacters: 1_024,\n pathCharacters: 4_096,\n uriCharacters: 8_192,\n messageCharacters: 4_000,\n excerptCharacters: 4_096,\n documentCharacters: 20 * 1024 * 1024,\n artifactBytes: 500 * 1024 * 1024,\n bundleAssets: 256,\n arrayEntries: 10_000,\n previewItems: 1_000,\n imageDimension: 32_768,\n});\n\nconst IDENTIFIER_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]*$/u;\nconst ENGINE_NAME_PATTERN =\n /^(?:[A-Za-z0-9][A-Za-z0-9._:-]*|@[A-Za-z0-9][A-Za-z0-9._-]*\\/[A-Za-z0-9][A-Za-z0-9._-]*)$/u;\nconst FORMAT_PATTERN = /^[a-z0-9][a-z0-9.+_-]*$/u;\nconst MIME_TYPE_PATTERN = /^[a-z0-9!#$&^_.+-]+\\/[a-z0-9!#$&^_.+-]+$/iu;\nconst SHA256_PATTERN = /^[a-f0-9]{64}$/u;\nconst ISO_TIMESTAMP_PATTERN = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/u;\n\nexport function parseArtifactRef(value: unknown): ArtifactRef | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'id',\n 'uri',\n 'format',\n 'mimeType',\n 'size',\n 'sha256',\n 'sourceFormat',\n 'sourceSha256',\n 'suggestedFilename',\n 'appliedOptions',\n 'engineVersions',\n 'createdAt',\n 'expiresAt',\n ])\n ) {\n return null;\n }\n\n const {\n id,\n uri,\n format,\n mimeType,\n size,\n sha256,\n sourceFormat,\n sourceSha256,\n suggestedFilename,\n createdAt,\n expiresAt,\n } = value;\n const appliedOptions = parseArray(value.appliedOptions, parseAppliedOption);\n const engineVersions = parseArray(value.engineVersions, parseEngineVersion);\n if (\n !isIdentifier(id) ||\n !isArtifactUri(uri, id) ||\n !isFormat(format) ||\n !isMimeType(mimeType) ||\n !isBoundedInteger(size, 0, MCP_WIRE_LIMITS.artifactBytes) ||\n !isSha256(sha256) ||\n !(sourceFormat === null || isFormat(sourceFormat)) ||\n !(sourceSha256 === null || isSha256(sourceSha256)) ||\n !isSafeFilename(suggestedFilename) ||\n appliedOptions === null ||\n engineVersions === null ||\n hasDuplicateNames(appliedOptions) ||\n hasDuplicateNames(engineVersions) ||\n !isIsoTimestamp(createdAt) ||\n !(expiresAt === null || isIsoTimestamp(expiresAt)) ||\n (expiresAt !== null && Date.parse(expiresAt) <= Date.parse(createdAt))\n ) {\n return null;\n }\n\n return {\n id,\n uri,\n format,\n mimeType,\n size,\n sha256,\n sourceFormat,\n sourceSha256,\n suggestedFilename,\n appliedOptions,\n engineVersions,\n createdAt,\n expiresAt,\n };\n}\n\nexport function parseDocumentSource(value: unknown): DocumentSource | null {\n if (!isRecord(value) || typeof value.kind !== 'string') return null;\n\n switch (value.kind) {\n case 'markdown': {\n if (!hasExactKeys(value, ['kind', 'markdown', 'name'])) return null;\n const { markdown, name } = value;\n if (\n !isBoundedString(markdown, MCP_WIRE_LIMITS.documentCharacters) ||\n !isNullableBoundedString(name, MCP_WIRE_LIMITS.labelCharacters)\n ) {\n return null;\n }\n return { kind: 'markdown', markdown, name };\n }\n case 'file': {\n if (!hasExactKeys(value, ['kind', 'rootId', 'path', 'format'])) return null;\n const { rootId, path, format } = value;\n const parsedPath = parseNonRootWorkspacePath(path);\n if (!isIdentifier(rootId) || parsedPath === null || !(format === null || isFormat(format))) {\n return null;\n }\n return { kind: 'file', rootId, path: parsedPath, format };\n }\n case 'artifact': {\n if (!hasExactKeys(value, ['kind', 'uri']) || !isArtifactUri(value.uri)) return null;\n return { kind: 'artifact', uri: value.uri };\n }\n case 'bundle': {\n if (!hasExactKeys(value, ['kind', 'markdown', 'assets', 'name'])) return null;\n const { markdown, name } = value;\n if (\n !isBoundedString(markdown, MCP_WIRE_LIMITS.documentCharacters) ||\n !isNullableBoundedString(name, MCP_WIRE_LIMITS.labelCharacters)\n ) {\n return null;\n }\n const assets = parseArray(value.assets, parseBundleAssetRef, MCP_WIRE_LIMITS.bundleAssets);\n if (assets === null || hasDuplicatePaths(assets)) return null;\n return { kind: 'bundle', markdown, assets, name };\n }\n default:\n return null;\n }\n}\n\nexport function parseMcpDiagnostic(value: unknown): McpDiagnostic | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'code',\n 'severity',\n 'stage',\n 'format',\n 'count',\n 'message',\n 'remediation',\n 'retryable',\n 'location',\n ])\n ) {\n return null;\n }\n\n const { code, severity, stage, format, count, message, remediation, retryable } = value;\n const location = parseNullable(value.location, parseDiagnosticLocation);\n if (\n !isIdentifier(code) ||\n !isDiagnosticSeverity(severity) ||\n !isDiagnosticStage(stage) ||\n !(format === null || isFormat(format)) ||\n !isBoundedInteger(count, 1, Number.MAX_SAFE_INTEGER) ||\n !isBoundedString(message, MCP_WIRE_LIMITS.messageCharacters, 1) ||\n !isNullableBoundedString(remediation, MCP_WIRE_LIMITS.messageCharacters) ||\n typeof retryable !== 'boolean' ||\n location === undefined\n ) {\n return null;\n }\n\n return {\n code,\n severity,\n stage,\n format,\n count,\n message,\n remediation,\n retryable,\n location,\n };\n}\n\nexport function parseMcpErrorResult(value: unknown): McpErrorResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['version', 'kind', 'result', 'error']) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'error' ||\n value.result !== null ||\n !isRecord(value.error) ||\n !hasExactKeys(value.error, [\n 'code',\n 'message',\n 'stage',\n 'format',\n 'hint',\n 'retryable',\n 'operationLoad',\n ])\n ) {\n return null;\n }\n const { code, message, stage, format, hint, retryable, operationLoad } = value.error;\n if (\n !isIdentifier(code) ||\n !isBoundedString(message, MCP_WIRE_LIMITS.messageCharacters, 1) ||\n !(stage === null || isDiagnosticStage(stage)) ||\n !(format === null || isFormat(format)) ||\n !isNullableBoundedString(hint, MCP_WIRE_LIMITS.messageCharacters) ||\n typeof retryable !== 'boolean' ||\n !(\n operationLoad === null ||\n (isRecord(operationLoad) &&\n hasExactKeys(operationLoad, ['active', 'capacity']) &&\n isBoundedInteger(operationLoad.active, 0, 32) &&\n isBoundedInteger(operationLoad.capacity, 1, 32) &&\n operationLoad.active <= operationLoad.capacity)\n )\n ) {\n return null;\n }\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'error',\n result: null,\n error: {\n code,\n message,\n stage,\n format,\n hint,\n retryable,\n operationLoad:\n operationLoad === null\n ? null\n : {\n active: operationLoad.active as number,\n capacity: operationLoad.capacity as number,\n },\n },\n };\n}\n\nexport function parseConversionResult(value: unknown): ConversionResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'version',\n 'kind',\n 'sourceFormat',\n 'targetFormat',\n 'artifact',\n 'fidelity',\n 'appliedThemeId',\n 'appliedTransformId',\n 'sourceAssets',\n 'sourceAssetCount',\n 'diagnostics',\n ]) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'conversion' ||\n !isFormat(value.sourceFormat) ||\n !isFormat(value.targetFormat) ||\n !isConversionFidelity(value.fidelity) ||\n !isNullableIdentifier(value.appliedThemeId) ||\n !isNullableIdentifier(value.appliedTransformId) ||\n !isBoundedInteger(value.sourceAssetCount, 0, MCP_WIRE_LIMITS.arrayEntries)\n ) {\n return null;\n }\n\n const artifact = parseArtifactRef(value.artifact);\n const sourceAssets = parseArray(value.sourceAssets, parseAssetSummary);\n const diagnostics = parseArray(value.diagnostics, parseMcpDiagnostic);\n if (\n artifact === null ||\n sourceAssets === null ||\n diagnostics === null ||\n sourceAssets.length !== value.sourceAssetCount ||\n hasDuplicatePaths(sourceAssets) ||\n artifact.format !== value.targetFormat ||\n (artifact.sourceFormat !== null && artifact.sourceFormat !== value.sourceFormat)\n ) {\n return null;\n }\n\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'conversion',\n sourceFormat: value.sourceFormat,\n targetFormat: value.targetFormat,\n artifact,\n fidelity: value.fidelity,\n appliedThemeId: value.appliedThemeId,\n appliedTransformId: value.appliedTransformId,\n sourceAssets,\n sourceAssetCount: value.sourceAssetCount,\n diagnostics,\n };\n}\n\nexport function parseInspectionResult(value: unknown): InspectionResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'version',\n 'kind',\n 'sourceFormat',\n 'metadata',\n 'statistics',\n 'outline',\n 'blocks',\n 'blockOffset',\n 'nextCursor',\n 'tables',\n 'links',\n 'items',\n 'assets',\n 'theme',\n 'truncated',\n 'detailsTruncated',\n 'diagnostics',\n ]) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'inspection' ||\n !isFormat(value.sourceFormat) ||\n !isBoundedInteger(value.blockOffset, 0, MCP_WIRE_LIMITS.arrayEntries) ||\n !isNullableBoundedString(value.nextCursor, MCP_WIRE_LIMITS.identifierCharacters) ||\n typeof value.truncated !== 'boolean' ||\n typeof value.detailsTruncated !== 'boolean'\n ) {\n return null;\n }\n\n const metadata = parseDocumentMetadata(value.metadata);\n const statistics = parseDocumentStatistics(value.statistics);\n const outline = parseArray(value.outline, parseOutlineEntry);\n const blocks = parseArray(value.blocks, parseBlockSummary);\n const tables = parseArray(value.tables, parseTableSummary);\n const links = parseArray(value.links, parseLinkSummary);\n const items = parseArray(value.items, parseDocumentItemSummary);\n const assets = parseArray(value.assets, parseAssetSummary);\n const theme = parseNullable(value.theme, parseThemeSummary);\n const diagnostics = parseArray(value.diagnostics, parseMcpDiagnostic);\n if (\n metadata === null ||\n statistics === null ||\n outline === null ||\n blocks === null ||\n tables === null ||\n links === null ||\n items === null ||\n assets === null ||\n theme === undefined ||\n diagnostics === null ||\n statistics.blockCount < value.blockOffset + blocks.length ||\n statistics.assetCount < assets.length ||\n (!value.truncated && statistics.blockCount !== value.blockOffset + blocks.length) ||\n value.truncated !== (value.nextCursor !== null) ||\n statistics.tableCount < tables.length ||\n statistics.linkCount < links.length ||\n hasDuplicateIds(outline) ||\n hasDuplicateIds(blocks) ||\n hasDuplicateIndexes(tables) ||\n hasDuplicateIndexes(links) ||\n hasDuplicateItemIndexes(items) ||\n hasDuplicatePaths(assets) ||\n outline.some((entry) => entry.blockIndex >= statistics.blockCount) ||\n blocks.some(\n (block) => block.sourceRange !== null && block.sourceRange.end > statistics.characterCount,\n )\n ) {\n return null;\n }\n\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'inspection',\n sourceFormat: value.sourceFormat,\n metadata,\n statistics,\n outline,\n blocks,\n blockOffset: value.blockOffset,\n nextCursor: value.nextCursor,\n tables,\n links,\n items,\n assets,\n theme,\n truncated: value.truncated,\n detailsTruncated: value.detailsTruncated,\n diagnostics,\n };\n}\n\nexport function parseValidationResult(value: unknown): ValidationResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'version',\n 'kind',\n 'sourceFormat',\n 'targetFormat',\n 'valid',\n 'summary',\n 'diagnostics',\n ]) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'validation' ||\n !isFormat(value.sourceFormat) ||\n !(value.targetFormat === null || isFormat(value.targetFormat)) ||\n typeof value.valid !== 'boolean'\n ) {\n return null;\n }\n\n const summary = parseValidationSummary(value.summary);\n const diagnostics = parseArray(value.diagnostics, parseMcpDiagnostic);\n if (summary === null || diagnostics === null) return null;\n const actualSummary = summarizeDiagnostics(diagnostics);\n if (\n summary.errorCount !== actualSummary.errorCount ||\n summary.warningCount !== actualSummary.warningCount ||\n summary.infoCount !== actualSummary.infoCount ||\n value.valid !== (summary.errorCount === 0)\n ) {\n return null;\n }\n\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'validation',\n sourceFormat: value.sourceFormat,\n targetFormat: value.targetFormat,\n valid: value.valid,\n summary,\n diagnostics,\n };\n}\n\nexport function parsePreviewResult(value: unknown): PreviewResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'version',\n 'kind',\n 'sourceFormat',\n 'previewBasis',\n 'totalItems',\n 'items',\n 'truncated',\n 'diagnostics',\n ]) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'preview' ||\n !isFormat(value.sourceFormat) ||\n !(\n value.previewBasis === 'source-render' ||\n value.previewBasis === 'reconstructed-import' ||\n value.previewBasis === 'native-extracted'\n ) ||\n !isBoundedInteger(value.totalItems, 0, Number.MAX_SAFE_INTEGER) ||\n typeof value.truncated !== 'boolean'\n ) {\n return null;\n }\n\n const items = parseArray(value.items, parsePreviewItem, MCP_WIRE_LIMITS.previewItems);\n const diagnostics = parseArray(value.diagnostics, parseMcpDiagnostic);\n if (\n items === null ||\n diagnostics === null ||\n value.totalItems < items.length ||\n (!value.truncated && value.totalItems !== items.length) ||\n hasDuplicatePreviewIndexes(items) ||\n items.some(\n (item) =>\n item.artifact.sourceFormat !== null && item.artifact.sourceFormat !== value.sourceFormat,\n )\n ) {\n return null;\n }\n\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'preview',\n sourceFormat: value.sourceFormat,\n previewBasis: value.previewBasis,\n totalItems: value.totalItems,\n items,\n truncated: value.truncated,\n diagnostics,\n };\n}\n\nexport function parseComparisonResult(value: unknown): ComparisonResult | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'version',\n 'kind',\n 'leftFormat',\n 'rightFormat',\n 'equivalent',\n 'score',\n 'changes',\n 'metrics',\n 'diagnostics',\n ]) ||\n value.version !== DOCBLOCKS_MCP_WIRE_VERSION ||\n value.kind !== 'comparison' ||\n !isFormat(value.leftFormat) ||\n !isFormat(value.rightFormat) ||\n typeof value.equivalent !== 'boolean' ||\n !isBoundedNumber(value.score, 0, 1)\n ) {\n return null;\n }\n\n const changes = parseArray(value.changes, parseComparisonChange);\n const metrics = parseArray(value.metrics, parseComparisonMetric);\n const diagnostics = parseArray(value.diagnostics, parseMcpDiagnostic);\n if (\n changes === null ||\n metrics === null ||\n diagnostics === null ||\n hasDuplicateNames(metrics) ||\n (value.equivalent &&\n (value.score !== 1 || changes.some((change) => change.status !== 'retained')))\n ) {\n return null;\n }\n\n return {\n version: DOCBLOCKS_MCP_WIRE_VERSION,\n kind: 'comparison',\n leftFormat: value.leftFormat,\n rightFormat: value.rightFormat,\n equivalent: value.equivalent,\n score: value.score,\n changes,\n metrics,\n diagnostics,\n };\n}\n\nexport function parseMaterializationOptions(value: unknown): MaterializationOptions | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['rootId', 'path', 'ifExists', 'expectedSha256']) ||\n !isIdentifier(value.rootId)\n ) {\n return null;\n }\n const path = parseNonRootWorkspacePath(value.path);\n if (path === null) return null;\n\n if (value.ifExists === 'error' && value.expectedSha256 === null) {\n return { rootId: value.rootId, path, ifExists: 'error', expectedSha256: null };\n }\n if (value.ifExists === 'replace' && isSha256(value.expectedSha256)) {\n return {\n rootId: value.rootId,\n path,\n ifExists: 'replace',\n expectedSha256: value.expectedSha256,\n };\n }\n return null;\n}\n\nfunction parseBundleAssetRef(value: unknown): BundleAssetRef | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['path', 'source', 'mimeType', 'altText', 'credit', 'license'])\n ) {\n return null;\n }\n const path = parseNonRootWorkspacePath(value.path);\n const source = parseBundleAssetContentSource(value.source);\n if (\n path === null ||\n source === null ||\n !(value.mimeType === null || isMimeType(value.mimeType)) ||\n !isNullableBoundedString(value.altText, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.credit, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.license, MCP_WIRE_LIMITS.labelCharacters)\n ) {\n return null;\n }\n return {\n path,\n source,\n mimeType: value.mimeType,\n altText: value.altText,\n credit: value.credit,\n license: value.license,\n };\n}\n\nfunction parseBundleAssetContentSource(value: unknown): BundleAssetContentSource | null {\n if (!isRecord(value) || typeof value.kind !== 'string') return null;\n if (value.kind === 'file') {\n if (!hasExactKeys(value, ['kind', 'rootId', 'path']) || !isIdentifier(value.rootId)) {\n return null;\n }\n const path = parseNonRootWorkspacePath(value.path);\n return path === null ? null : { kind: 'file', rootId: value.rootId, path };\n }\n if (value.kind === 'artifact') {\n return hasExactKeys(value, ['kind', 'uri']) && isArtifactUri(value.uri)\n ? { kind: 'artifact', uri: value.uri }\n : null;\n }\n return null;\n}\n\nfunction parseDiagnosticLocation(value: unknown): DiagnosticLocation | null {\n if (!isRecord(value) || typeof value.kind !== 'string') return null;\n switch (value.kind) {\n case 'source':\n return hasExactKeys(value, ['kind', 'line', 'column']) &&\n isBoundedInteger(value.line, 1, Number.MAX_SAFE_INTEGER) &&\n isBoundedInteger(value.column, 1, Number.MAX_SAFE_INTEGER)\n ? { kind: 'source', line: value.line, column: value.column }\n : null;\n case 'block':\n return hasExactKeys(value, ['kind', 'blockId', 'nodeType']) &&\n isIdentifier(value.blockId) &&\n isIdentifier(value.nodeType)\n ? { kind: 'block', blockId: value.blockId, nodeType: value.nodeType }\n : null;\n case 'asset': {\n if (!hasExactKeys(value, ['kind', 'path'])) return null;\n const path = parseNonRootWorkspacePath(value.path);\n return path === null ? null : { kind: 'asset', path };\n }\n case 'item':\n return hasExactKeys(value, ['kind', 'itemKind', 'index']) &&\n isPreviewItemKind(value.itemKind) &&\n isBoundedInteger(value.index, 0, Number.MAX_SAFE_INTEGER)\n ? { kind: 'item', itemKind: value.itemKind, index: value.index }\n : null;\n default:\n return null;\n }\n}\n\nfunction parseAppliedOption(value: unknown): AppliedOption | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['name', 'value']) ||\n !isIdentifier(value.name) ||\n !isAppliedOptionValue(value.value)\n ) {\n return null;\n }\n return { name: value.name, value: value.value };\n}\n\nfunction parseEngineVersion(value: unknown): EngineVersion | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['name', 'version']) ||\n !isEngineName(value.name) ||\n !isBoundedString(value.version, MCP_WIRE_LIMITS.identifierCharacters, 1)\n ) {\n return null;\n }\n return { name: value.name, version: value.version };\n}\n\nfunction parseDocumentMetadata(value: unknown): DocumentMetadataSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['title', 'author', 'description']) ||\n !isNullableBoundedString(value.title, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.author, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.description, MCP_WIRE_LIMITS.messageCharacters)\n ) {\n return null;\n }\n return { title: value.title, author: value.author, description: value.description };\n}\n\nfunction parseDocumentStatistics(value: unknown): DocumentStatistics | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, [\n 'blockCount',\n 'wordCount',\n 'characterCount',\n 'tableCount',\n 'linkCount',\n 'assetCount',\n 'pageCount',\n 'slideCount',\n 'sheetCount',\n ]) ||\n !isNonNegativeInteger(value.blockCount) ||\n !isNonNegativeInteger(value.wordCount) ||\n !isNonNegativeInteger(value.characterCount) ||\n !isNonNegativeInteger(value.tableCount) ||\n !isNonNegativeInteger(value.linkCount) ||\n !isNonNegativeInteger(value.assetCount) ||\n !isNullableNonNegativeInteger(value.pageCount) ||\n !isNullableNonNegativeInteger(value.slideCount) ||\n !isNullableNonNegativeInteger(value.sheetCount)\n ) {\n return null;\n }\n return {\n blockCount: value.blockCount,\n wordCount: value.wordCount,\n characterCount: value.characterCount,\n tableCount: value.tableCount,\n linkCount: value.linkCount,\n assetCount: value.assetCount,\n pageCount: value.pageCount,\n slideCount: value.slideCount,\n sheetCount: value.sheetCount,\n };\n}\n\nfunction parseOutlineEntry(value: unknown): OutlineEntry | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['id', 'title', 'level', 'blockIndex']) ||\n !isIdentifier(value.id) ||\n !isBoundedString(value.title, MCP_WIRE_LIMITS.labelCharacters, 1) ||\n !isBoundedInteger(value.level, 1, 6) ||\n !isNonNegativeInteger(value.blockIndex)\n ) {\n return null;\n }\n return { id: value.id, title: value.title, level: value.level, blockIndex: value.blockIndex };\n}\n\nfunction parseBlockSummary(value: unknown): BlockSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['id', 'type', 'text', 'wordCount', 'templateId', 'sourceRange']) ||\n !isIdentifier(value.id) ||\n !isIdentifier(value.type) ||\n !isBoundedString(value.text, MCP_WIRE_LIMITS.excerptCharacters) ||\n !isNonNegativeInteger(value.wordCount) ||\n !isNullableIdentifier(value.templateId)\n ) {\n return null;\n }\n const sourceRange = parseNullable(value.sourceRange, parseSourceRange);\n if (sourceRange === undefined) return null;\n return {\n id: value.id,\n type: value.type,\n text: value.text,\n wordCount: value.wordCount,\n templateId: value.templateId,\n sourceRange,\n };\n}\n\nfunction parseSourceRange(value: unknown): SourceRange | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['start', 'end']) ||\n !isNonNegativeInteger(value.start) ||\n !isNonNegativeInteger(value.end) ||\n value.end < value.start\n ) {\n return null;\n }\n return { start: value.start, end: value.end };\n}\n\nfunction parseTableSummary(value: unknown): TableSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['index', 'rowCount', 'columnCount', 'headers']) ||\n !isNonNegativeInteger(value.index) ||\n !isNonNegativeInteger(value.rowCount) ||\n !isNonNegativeInteger(value.columnCount)\n ) {\n return null;\n }\n const headers = parseArray(value.headers, (entry) =>\n isBoundedString(entry, MCP_WIRE_LIMITS.labelCharacters) ? entry : null,\n );\n if (headers === null || headers.length > value.columnCount) return null;\n return {\n index: value.index,\n rowCount: value.rowCount,\n columnCount: value.columnCount,\n headers,\n };\n}\n\nfunction parseLinkSummary(value: unknown): LinkSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['index', 'text', 'target']) ||\n !isNonNegativeInteger(value.index) ||\n !isBoundedString(value.text, MCP_WIRE_LIMITS.labelCharacters) ||\n !isBoundedString(value.target, MCP_WIRE_LIMITS.uriCharacters, 1)\n ) {\n return null;\n }\n return { index: value.index, text: value.text, target: value.target };\n}\n\nfunction parseDocumentItemSummary(value: unknown): DocumentItemSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['kind', 'index', 'label', 'blockIds']) ||\n !isPreviewItemKind(value.kind) ||\n !isNonNegativeInteger(value.index) ||\n !isNullableBoundedString(value.label, MCP_WIRE_LIMITS.labelCharacters)\n ) {\n return null;\n }\n const blockIds = parseArray(value.blockIds, (entry) => (isIdentifier(entry) ? entry : null));\n if (blockIds === null || new Set(blockIds).size !== blockIds.length) return null;\n return { kind: value.kind, index: value.index, label: value.label, blockIds };\n}\n\nfunction parseAssetSummary(value: unknown): AssetSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['path', 'mimeType', 'size', 'sha256', 'altText', 'credit', 'license'])\n ) {\n return null;\n }\n const path = parseNonRootWorkspacePath(value.path);\n if (\n path === null ||\n !isMimeType(value.mimeType) ||\n !isBoundedInteger(value.size, 0, MCP_WIRE_LIMITS.artifactBytes) ||\n !(value.sha256 === null || isSha256(value.sha256)) ||\n !isNullableBoundedString(value.altText, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.credit, MCP_WIRE_LIMITS.labelCharacters) ||\n !isNullableBoundedString(value.license, MCP_WIRE_LIMITS.labelCharacters)\n ) {\n return null;\n }\n return {\n path,\n mimeType: value.mimeType,\n size: value.size,\n sha256: value.sha256,\n altText: value.altText,\n credit: value.credit,\n license: value.license,\n };\n}\n\nfunction parseThemeSummary(value: unknown): ThemeSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['id', 'name', 'source', 'layouts']) ||\n !isIdentifier(value.id) ||\n !isBoundedString(value.name, MCP_WIRE_LIMITS.labelCharacters, 1) ||\n !(value.source === 'built-in' || value.source === 'document' || value.source === 'inferred')\n ) {\n return null;\n }\n const layouts = parseStringArray(value.layouts, MCP_WIRE_LIMITS.labelCharacters);\n if (layouts === null || new Set(layouts).size !== layouts.length) return null;\n return { id: value.id, name: value.name, source: value.source, layouts };\n}\n\nfunction parseValidationSummary(value: unknown): ValidationSummary | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['errorCount', 'warningCount', 'infoCount']) ||\n !isNonNegativeInteger(value.errorCount) ||\n !isNonNegativeInteger(value.warningCount) ||\n !isNonNegativeInteger(value.infoCount)\n ) {\n return null;\n }\n return {\n errorCount: value.errorCount,\n warningCount: value.warningCount,\n infoCount: value.infoCount,\n };\n}\n\nfunction parsePreviewItem(value: unknown): PreviewItem | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['kind', 'index', 'label', 'artifact', 'width', 'height']) ||\n !isPreviewItemKind(value.kind) ||\n !isNonNegativeInteger(value.index) ||\n !isNullableBoundedString(value.label, MCP_WIRE_LIMITS.labelCharacters) ||\n !isBoundedInteger(value.width, 1, MCP_WIRE_LIMITS.imageDimension) ||\n !isBoundedInteger(value.height, 1, MCP_WIRE_LIMITS.imageDimension)\n ) {\n return null;\n }\n const artifact = parseArtifactRef(value.artifact);\n if (artifact === null || !artifact.mimeType.startsWith('image/')) return null;\n return {\n kind: value.kind,\n index: value.index,\n label: value.label,\n artifact,\n width: value.width,\n height: value.height,\n };\n}\n\nfunction parseComparisonChange(value: unknown): ComparisonChange | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['category', 'status', 'path', 'message']) ||\n !isComparisonCategory(value.category) ||\n !isComparisonStatus(value.status) ||\n !isNullableBoundedString(value.path, MCP_WIRE_LIMITS.pathCharacters) ||\n !isBoundedString(value.message, MCP_WIRE_LIMITS.messageCharacters, 1)\n ) {\n return null;\n }\n return {\n category: value.category,\n status: value.status,\n path: value.path,\n message: value.message,\n };\n}\n\nfunction parseComparisonMetric(value: unknown): ComparisonMetric | null {\n if (\n !isRecord(value) ||\n !hasExactKeys(value, ['name', 'leftValue', 'rightValue', 'similarity']) ||\n !isIdentifier(value.name) ||\n !isFiniteNumber(value.leftValue) ||\n !isFiniteNumber(value.rightValue) ||\n !isBoundedNumber(value.similarity, 0, 1)\n ) {\n return null;\n }\n return {\n name: value.name,\n leftValue: value.leftValue,\n rightValue: value.rightValue,\n similarity: value.similarity,\n };\n}\n\nfunction summarizeDiagnostics(diagnostics: readonly McpDiagnostic[]): ValidationSummary {\n let errorCount = 0;\n let warningCount = 0;\n let infoCount = 0;\n for (const diagnostic of diagnostics) {\n if (diagnostic.severity === 'error') errorCount += diagnostic.count;\n else if (diagnostic.severity === 'warning') warningCount += diagnostic.count;\n else infoCount += diagnostic.count;\n }\n return { errorCount, warningCount, infoCount };\n}\n\nfunction parseArray<T>(\n value: unknown,\n parser: (entry: unknown) => T | null,\n maximumEntries: number = MCP_WIRE_LIMITS.arrayEntries,\n): T[] | null {\n if (!Array.isArray(value) || value.length > maximumEntries) return null;\n const parsed: T[] = [];\n for (const entry of value) {\n const result = parser(entry);\n if (result === null) return null;\n parsed.push(result);\n }\n return parsed;\n}\n\nfunction parseStringArray(value: unknown, maximumCharacters: number): string[] | null {\n if (!Array.isArray(value) || value.length > MCP_WIRE_LIMITS.arrayEntries) return null;\n const parsed: string[] = [];\n for (const entry of value) {\n if (!isBoundedString(entry, maximumCharacters, 1)) return null;\n parsed.push(entry);\n }\n return parsed;\n}\n\nfunction parseNullable<T>(\n value: unknown,\n parser: (entry: unknown) => T | null,\n): T | null | undefined {\n if (value === null) return null;\n return parser(value) ?? undefined;\n}\n\nfunction parseNonRootWorkspacePath(value: unknown): WorkspacePath | null {\n if (\n !isBoundedString(value, MCP_WIRE_LIMITS.pathCharacters, 1) ||\n value.includes('\\\\') ||\n value.startsWith('/') ||\n value.endsWith('/') ||\n value.includes('//')\n ) {\n return null;\n }\n const parsed = tryParseWorkspacePath(value);\n return parsed !== null && parsed !== '' && parsed === value ? parsed : null;\n}\n\nfunction isArtifactUri(value: unknown, expectedId?: string): value is string {\n if (!isBoundedString(value, MCP_WIRE_LIMITS.uriCharacters, 1)) return false;\n try {\n const url = new URL(value);\n if (\n url.protocol !== 'docblocks:' ||\n url.hostname !== 'artifacts' ||\n url.username !== '' ||\n url.password !== '' ||\n url.port !== '' ||\n url.search !== '' ||\n url.hash !== ''\n ) {\n return false;\n }\n const id = url.pathname.slice(1);\n return (\n !id.includes('/') &&\n isIdentifier(id) &&\n value === `docblocks://artifacts/${id}` &&\n (expectedId === undefined || id === expectedId)\n );\n } catch {\n return false;\n }\n}\n\nfunction isSafeFilename(value: unknown): value is string {\n return (\n isBoundedString(value, MCP_WIRE_LIMITS.labelCharacters, 1) &&\n value !== '.' &&\n value !== '..' &&\n !value.includes('/') &&\n !value.includes('\\\\')\n );\n}\n\nfunction isIsoTimestamp(value: unknown): value is string {\n if (typeof value !== 'string' || !ISO_TIMESTAMP_PATTERN.test(value)) return false;\n const timestamp = Date.parse(value);\n return Number.isFinite(timestamp) && new Date(timestamp).toISOString() === value;\n}\n\nfunction isIdentifier(value: unknown): value is string {\n return (\n isBoundedString(value, MCP_WIRE_LIMITS.identifierCharacters, 1) &&\n IDENTIFIER_PATTERN.test(value)\n );\n}\n\nfunction isEngineName(value: unknown): value is string {\n return (\n isBoundedString(value, MCP_WIRE_LIMITS.identifierCharacters, 1) &&\n ENGINE_NAME_PATTERN.test(value)\n );\n}\n\nfunction isNullableIdentifier(value: unknown): value is string | null {\n return value === null || isIdentifier(value);\n}\n\nfunction isFormat(value: unknown): value is string {\n return isBoundedString(value, MCP_WIRE_LIMITS.formatCharacters, 1) && FORMAT_PATTERN.test(value);\n}\n\nfunction isMimeType(value: unknown): value is string {\n return (\n isBoundedString(value, MCP_WIRE_LIMITS.mimeTypeCharacters, 3) && MIME_TYPE_PATTERN.test(value)\n );\n}\n\nfunction isSha256(value: unknown): value is string {\n return typeof value === 'string' && SHA256_PATTERN.test(value);\n}\n\nfunction isAppliedOptionValue(value: unknown): value is string | number | boolean | null {\n return (\n value === null ||\n typeof value === 'boolean' ||\n isBoundedString(value, MCP_WIRE_LIMITS.messageCharacters) ||\n isFiniteNumber(value)\n );\n}\n\nfunction isDiagnosticSeverity(value: unknown): value is DiagnosticSeverity {\n return value === 'info' || value === 'warning' || value === 'error';\n}\n\nfunction isDiagnosticStage(value: unknown): value is DiagnosticStage {\n return (\n value === 'resolve' ||\n value === 'import' ||\n value === 'parse' ||\n value === 'inspect' ||\n value === 'validate' ||\n value === 'transform' ||\n value === 'convert' ||\n value === 'render' ||\n value === 'export' ||\n value === 'materialize' ||\n value === 'compare'\n );\n}\n\nfunction isConversionFidelity(value: unknown): value is ConversionFidelity {\n return (\n value === 'semantic' ||\n value === 'editable-native' ||\n value === 'rendered-fidelity' ||\n value === 'hybrid'\n );\n}\n\nfunction isPreviewItemKind(value: unknown): value is PreviewItem['kind'] {\n return value === 'page' || value === 'slide' || value === 'sheet' || value === 'frame';\n}\n\nfunction isComparisonCategory(value: unknown): value is ComparisonChange['category'] {\n return (\n value === 'text' ||\n value === 'structure' ||\n value === 'table' ||\n value === 'media' ||\n value === 'theme' ||\n value === 'layout' ||\n value === 'metadata' ||\n value === 'timing' ||\n value === 'accessibility'\n );\n}\n\nfunction isComparisonStatus(value: unknown): value is ComparisonChange['status'] {\n return (\n value === 'retained' ||\n value === 'changed' ||\n value === 'degraded' ||\n value === 'omitted' ||\n value === 'added'\n );\n}\n\nfunction hasDuplicateNames(values: readonly { readonly name: string }[]): boolean {\n return new Set(values.map((value) => value.name)).size !== values.length;\n}\n\nfunction hasDuplicateIds(values: readonly { readonly id: string }[]): boolean {\n return new Set(values.map((value) => value.id)).size !== values.length;\n}\n\nfunction hasDuplicatePaths(values: readonly { readonly path: WorkspacePath }[]): boolean {\n return new Set(values.map((value) => value.path)).size !== values.length;\n}\n\nfunction hasDuplicateIndexes(values: readonly { readonly index: number }[]): boolean {\n return new Set(values.map((value) => value.index)).size !== values.length;\n}\n\nfunction hasDuplicateItemIndexes(values: readonly DocumentItemSummary[]): boolean {\n return new Set(values.map((value) => `${value.kind}:${value.index}`)).size !== values.length;\n}\n\nfunction hasDuplicatePreviewIndexes(values: readonly PreviewItem[]): boolean {\n const keys = values.map((value) => `${value.kind}:${value.index}`);\n return new Set(keys).size !== keys.length;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction hasExactKeys(value: Record<string, unknown>, keys: readonly string[]): boolean {\n const actual = Object.keys(value);\n return (\n actual.length === keys.length &&\n keys.every((key) => Object.prototype.hasOwnProperty.call(value, key))\n );\n}\n\nfunction isBoundedString(\n value: unknown,\n maximumCharacters: number,\n minimumCharacters = 0,\n): value is string {\n return (\n typeof value === 'string' &&\n value.length >= minimumCharacters &&\n value.length <= maximumCharacters &&\n ![...value].some((character) => {\n const codePoint = character.codePointAt(0) ?? 0;\n return codePoint === 0 || codePoint === 0x7f;\n })\n );\n}\n\nfunction isNullableBoundedString(\n value: unknown,\n maximumCharacters: number,\n): value is string | null {\n return value === null || isBoundedString(value, maximumCharacters);\n}\n\nfunction isFiniteNumber(value: unknown): value is number {\n return typeof value === 'number' && Number.isFinite(value);\n}\n\nfunction isBoundedNumber(value: unknown, minimum: number, maximum: number): value is number {\n return isFiniteNumber(value) && value >= minimum && value <= maximum;\n}\n\nfunction isBoundedInteger(value: unknown, minimum: number, maximum: number): value is number {\n return (\n Number.isSafeInteger(value) && typeof value === 'number' && value >= minimum && value <= maximum\n );\n}\n\nfunction isNonNegativeInteger(value: unknown): value is number {\n return isBoundedInteger(value, 0, Number.MAX_SAFE_INTEGER);\n}\n\nfunction isNullableNonNegativeInteger(value: unknown): value is number | null {\n return value === null || isNonNegativeInteger(value);\n}\n"],"mappings":";;;;;AAGO,IAAM,6BAA6B;AAKnC,IAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ACUO,IAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,sBAAsB;AAAA,EACtB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,oBAAoB,KAAK,OAAO;AAAA,EAChC,eAAe,MAAM,OAAO;AAAA,EAC5B,cAAc;AAAA,EACd,cAAc;AAAA,EACd,cAAc;AAAA,EACd,gBAAgB;AAClB,CAAC;AAED,IAA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AEA,SAAS,aAAa,OAAgC,MAAkC;AACtF,QAAM,SAAS,OAAO,KAAK,KAAK;AAChC,SACE,OAAO,WAAW,KAAK,UACvB,KAAK,MAAM,CAAC,QAAQ,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC;AAExE;AAEA,SAAS,gBACP,OACA,mBACA,oBAAoB,GACH;AACjB,SACE,OAAO,UAAU,YACjB,MAAM,UAAU,qBAChB,MAAM,UAAU,qBAChB,CAAC,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,cAAc;AAC9B,UAAM,YAAY,UAAU,YAAY,CAAC,KAAK;AAC9C,WAAO,cAAc,KAAK,cAAc;AAAA,EAC1C,CAAC;AAEL;AAEA,SAAS,wBACP,OACA,mBACwB;AACxB,SAAO,UAAU,QAAQ,gBAAgB,OAAO,iBAAiB;AACnE;AAEA,SAAS,eAAe,OAAiC;AACvD,SAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAC3D;AAEA,SAAS,gBAAgB,OAAgB,SAAiB,SAAkC;AAC1F,SAAO,eAAe,KAAK,KAAK,SAAS,WAAW,SAAS;AAC/D;AAEA,SAAS,iBAAiB,OAAgB,SAAiB,SAAkC;AAC3F,SACE,OAAO,cAAc,KAAK,KAAK,OAAO,UAAU,YAAY,SAAS,WAAW,SAAS;AAE7F;AAEA,SAAS,qBAAqB,OAAiC;AAC7D,SAAO,iBAAiB,OAAO,GAAG,OAAO,gBAAgB;AAC3D;AAEA,SAAS,6BAA6B,OAAwC;AAC5E,SAAO,UAAU,QAAQ,qBAAqB,KAAK;AACrD;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/filesystem/commit-lock.ts
|
|
2
|
+
var localTails = /* @__PURE__ */ new Map();
|
|
3
|
+
async function withFileCommitLock(key, operation) {
|
|
4
|
+
const lockManager = typeof navigator === "undefined" ? void 0 : navigator.locks;
|
|
5
|
+
if (lockManager) {
|
|
6
|
+
return lockManager.request(`docblocks:${key}`, operation);
|
|
7
|
+
}
|
|
8
|
+
const previous = localTails.get(key) ?? Promise.resolve();
|
|
9
|
+
const run = previous.then(operation, operation);
|
|
10
|
+
const tail = run.then(
|
|
11
|
+
() => void 0,
|
|
12
|
+
() => void 0
|
|
13
|
+
);
|
|
14
|
+
localTails.set(key, tail);
|
|
15
|
+
try {
|
|
16
|
+
return await run;
|
|
17
|
+
} finally {
|
|
18
|
+
if (localTails.get(key) === tail) localTails.delete(key);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
withFileCommitLock
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-AEHCVWU5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filesystem/commit-lock.ts"],"sourcesContent":["type LockNavigator = Navigator & {\n locks?: {\n request<T>(name: string, callback: () => Promise<T>): Promise<T>;\n };\n};\n\nconst localTails = new Map<string, Promise<void>>();\n\n/** Serialize conditional commits across providers and, when available, tabs. */\nexport async function withFileCommitLock<T>(key: string, operation: () => Promise<T>): Promise<T> {\n const lockManager =\n typeof navigator === 'undefined' ? undefined : (navigator as LockNavigator).locks;\n if (lockManager) {\n return lockManager.request(`docblocks:${key}`, operation);\n }\n\n const previous = localTails.get(key) ?? Promise.resolve();\n const run = previous.then(operation, operation);\n const tail = run.then(\n () => undefined,\n () => undefined,\n );\n localTails.set(key, tail);\n try {\n return await run;\n } finally {\n if (localTails.get(key) === tail) localTails.delete(key);\n }\n}\n"],"mappings":";AAMA,IAAM,aAAa,oBAAI,IAA2B;AAGlD,eAAsB,mBAAsB,KAAa,WAAyC;AAChG,QAAM,cACJ,OAAO,cAAc,cAAc,SAAa,UAA4B;AAC9E,MAAI,aAAa;AACf,WAAO,YAAY,QAAQ,aAAa,GAAG,IAAI,SAAS;AAAA,EAC1D;AAEA,QAAM,WAAW,WAAW,IAAI,GAAG,KAAK,QAAQ,QAAQ;AACxD,QAAM,MAAM,SAAS,KAAK,WAAW,SAAS;AAC9C,QAAM,OAAO,IAAI;AAAA,IACf,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACA,aAAW,IAAI,KAAK,IAAI;AACxB,MAAI;AACF,WAAO,MAAM;AAAA,EACf,UAAE;AACA,QAAI,WAAW,IAAI,GAAG,MAAM,KAAM,YAAW,OAAO,GAAG;AAAA,EACzD;AACF;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/filesystem/v2.ts
|
|
2
|
+
function parseFileSystemVersion(value) {
|
|
3
|
+
if (typeof value !== "string" || !value || value.length > 1024 || value.includes("\0")) {
|
|
4
|
+
throw new TypeError("Filesystem version tokens must be non-empty bounded strings.");
|
|
5
|
+
}
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
function tryParseFileSystemVersion(value) {
|
|
9
|
+
try {
|
|
10
|
+
return parseFileSystemVersion(value);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
parseFileSystemVersion,
|
|
18
|
+
tryParseFileSystemVersion
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=chunk-AYZ4HN5M.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filesystem/v2.ts"],"sourcesContent":["import type { FsError } from './fs-error.js';\nimport type { WorkspacePath } from './workspace-path.js';\n\n/**\n * Opaque provider-issued token representing one observed entry/tree state.\n * Tokens support equality only within the issuing provider; callers must not\n * parse them or assume a move or byte-identical rewrite changes the token.\n * A token need not be a content hash, but it must change whenever the issuing\n * provider observes a potentially different kind, payload, or descendant\n * state. Detection of non-cooperating external changes is bounded by the\n * backend's declared capabilities and metadata precision.\n */\ndeclare const fileSystemVersionBrand: unique symbol;\nexport type FileSystemVersion = string & {\n readonly [fileSystemVersionBrand]: 'FileSystemVersion';\n};\n\n/** Validate/rebrand a version received from a provider transport. */\nexport function parseFileSystemVersion(value: unknown): FileSystemVersion {\n if (typeof value !== 'string' || !value || value.length > 1024 || value.includes('\\0')) {\n throw new TypeError('Filesystem version tokens must be non-empty bounded strings.');\n }\n return value as FileSystemVersion;\n}\n\nexport function tryParseFileSystemVersion(value: unknown): FileSystemVersion | null {\n try {\n return parseFileSystemVersion(value);\n } catch {\n return null;\n }\n}\n\n/** `process` excludes this provider's local peers; `cross-context` also excludes cooperating tabs/processes. */\nexport type FileSystemAtomicity = 'none' | 'process' | 'cross-context';\nexport type FileSystemCaseSensitivity = 'sensitive' | 'insensitive' | 'platform';\nexport type FileSystemDurability = 'volatile' | 'best-effort' | 'durable';\nexport type FileSystemConditionalWriteStrength =\n | 'none'\n | 'process'\n | 'cross-context'\n | 'storage-atomic';\nexport type FileSystemSymlinkPolicy = 'unsupported' | 'reject' | 'follow-contained' | 'preserve';\n\n/** Serializable feature declaration; consumers never need provider instanceof checks. */\nexport interface FileSystemProviderCapabilities {\n /** Isolation of one successful file replacement from cooperating writers. */\n readonly writeAtomicity: FileSystemAtomicity;\n /** Isolation of one successful source-to-destination move. */\n readonly moveAtomicity: FileSystemAtomicity;\n /** Writers excluded while one complete snapshot is captured. */\n readonly snapshotAtomicity: FileSystemAtomicity;\n /** Strongest boundary at which expectedVersion is checked with mutation. */\n readonly conditionalWrite: FileSystemConditionalWriteStrength;\n readonly recursiveRemove: boolean;\n /** True only when watch has a real ready barrier and sequenced events. */\n readonly watch: boolean;\n readonly caseSensitivity: FileSystemCaseSensitivity;\n readonly symlinkPolicy: FileSystemSymlinkPolicy;\n readonly durability: FileSystemDurability;\n}\n\ninterface FileSystemEntrySnapshotBase {\n readonly path: WorkspacePath;\n readonly name: string;\n readonly version: FileSystemVersion;\n /** ISO-8601 timestamp supplied by the backend; versions remain authoritative. */\n readonly lastModified: string;\n}\n\nexport interface FileSystemFileSnapshot extends FileSystemEntrySnapshotBase {\n readonly kind: 'file';\n readonly size: number;\n}\n\nexport interface FileSystemDirectorySnapshot extends FileSystemEntrySnapshotBase {\n readonly kind: 'directory';\n readonly size: null;\n}\n\nexport type FileSystemEntrySnapshot = FileSystemFileSnapshot | FileSystemDirectorySnapshot;\n\n/** A read always couples owned bytes to the exact metadata version they represent. */\nexport interface FileSystemFileRead {\n readonly entry: FileSystemFileSnapshot;\n readonly data: ArrayBuffer;\n}\n\nexport interface FileSystemSnapshotFile extends FileSystemFileSnapshot {\n readonly data: ArrayBuffer;\n}\n\nexport type FileSystemSnapshotEntry = FileSystemSnapshotFile | FileSystemDirectorySnapshot;\n\n/**\n * Complete best-available tree traversal. `snapshotAtomicity` declares\n * whether concurrent local/cross-context mutations are excluded while it is\n * captured. Implementations must never expose aliased buffers.\n */\nexport interface FileSystemSnapshot {\n readonly version: FileSystemVersion;\n readonly entries: readonly FileSystemSnapshotEntry[];\n}\n\nexport type FileSystemWriteMode = 'upsert' | 'create' | 'replace';\n\nexport interface FileSystemWriteOptions {\n /** Defaults to upsert. */\n readonly mode?: FileSystemWriteMode;\n /** Defaults to false so structure creation is never implicit. */\n readonly createParents?: boolean;\n /** null means the entry must not exist; a token requires an exact match. */\n readonly expectedVersion?: FileSystemVersion | null;\n}\n\nexport type FileSystemCreateDirectoryMode = 'ensure' | 'create';\n\nexport interface FileSystemCreateDirectoryOptions {\n /** Defaults to ensure (idempotently return an existing directory). */\n readonly mode?: FileSystemCreateDirectoryMode;\n /** Defaults to false. */\n readonly createParents?: boolean;\n}\n\nexport interface FileSystemRemoveOptions {\n /** Defaults to false; non-empty directories otherwise fail with not-empty. */\n readonly recursive?: boolean;\n /** Defaults to error. */\n readonly missing?: 'ignore' | 'error';\n readonly expectedVersion?: FileSystemVersion;\n}\n\nexport interface FileSystemRemoveResult {\n readonly removed: boolean;\n /** Version of the complete tree after the removal attempt. */\n readonly version: FileSystemVersion;\n}\n\nexport interface FileSystemMoveOptions {\n /** Defaults to false. Destinations are never overwritten. */\n readonly createParents?: boolean;\n readonly expectedVersion?: FileSystemVersion;\n}\n\nexport type FileSystemWatchEventType = 'created' | 'modified' | 'removed' | 'moved' | 'overflow';\nexport type FileSystemWatchEventOrigin = 'local' | 'external' | 'unknown';\n\ninterface FileSystemWatchEventBase {\n readonly sequence: number;\n readonly origin: FileSystemWatchEventOrigin;\n readonly path: WorkspacePath;\n}\n\nexport interface FileSystemEntryWatchEvent extends FileSystemWatchEventBase {\n readonly type: Exclude<FileSystemWatchEventType, 'overflow'>;\n readonly kind: 'file' | 'directory';\n readonly destinationPath: WorkspacePath | null;\n readonly version: FileSystemVersion | null;\n readonly previousVersion: FileSystemVersion | null;\n}\n\nexport interface FileSystemOverflowWatchEvent extends FileSystemWatchEventBase {\n readonly type: 'overflow';\n readonly kind: null;\n readonly destinationPath: null;\n readonly version: null;\n readonly previousVersion: null;\n}\n\nexport type FileSystemWatchEvent = FileSystemEntryWatchEvent | FileSystemOverflowWatchEvent;\n\nexport type FileSystemWatchListener = (event: FileSystemWatchEvent) => void;\nexport type FileSystemWatchErrorListener = (error: FsError) => void;\n\nexport interface FileSystemWatchOptions {\n readonly onError?: FileSystemWatchErrorListener;\n}\n\nexport interface FileSystemWatchSubscription {\n readonly closed: boolean;\n /** Resolves after the backend watch is installed and no initial event can be missed. */\n readonly ready: Promise<void>;\n /** Idempotent and awaitable so resource release can join provider shutdown. */\n dispose(): Promise<void>;\n}\n\n/**\n * Correctness-first filesystem contract. Every logical path has exactly one\n * kind and one byte payload; conditional writes and lifecycle disposal are\n * mandatory rather than optional provider extensions.\n */\nexport interface FileSystemProviderV2 {\n readonly id: string;\n readonly label: string;\n readonly capabilities: FileSystemProviderCapabilities;\n\n /** Absence is represented only by null; permission/I/O/wrong-kind errors throw FsError. */\n stat(path: WorkspacePath): Promise<FileSystemEntrySnapshot | null>;\n /** Absence is represented only by null; a directory at path is type-mismatch. */\n readFile(path: WorkspacePath): Promise<FileSystemFileRead | null>;\n /** Missing paths and file paths throw; results are canonical and deterministic. */\n readDirectory(path: WorkspacePath): Promise<readonly FileSystemEntrySnapshot[]>;\n\n writeFile(\n path: WorkspacePath,\n data: ArrayBuffer | Uint8Array,\n options?: FileSystemWriteOptions,\n ): Promise<FileSystemFileSnapshot>;\n createDirectory(\n path: WorkspacePath,\n options?: FileSystemCreateDirectoryOptions,\n ): Promise<FileSystemDirectorySnapshot>;\n remove(path: WorkspacePath, options?: FileSystemRemoveOptions): Promise<FileSystemRemoveResult>;\n move(\n oldPath: WorkspacePath,\n newPath: WorkspacePath,\n options?: FileSystemMoveOptions,\n ): Promise<FileSystemEntrySnapshot>;\n\n snapshot(): Promise<FileSystemSnapshot>;\n /**\n * Always returns a disposable subscription. When `capabilities.watch` is\n * false, `ready` rejects with `FsError('not-supported')` and `onError`\n * observes the same failure; callers can therefore use one cleanup path.\n */\n watch(\n listener: FileSystemWatchListener,\n options?: FileSystemWatchOptions,\n ): FileSystemWatchSubscription;\n dispose(): Promise<void>;\n}\n"],"mappings":";AAkBO,SAAS,uBAAuB,OAAmC;AACxE,MAAI,OAAO,UAAU,YAAY,CAAC,SAAS,MAAM,SAAS,QAAQ,MAAM,SAAS,IAAI,GAAG;AACtF,UAAM,IAAI,UAAU,8DAA8D;AAAA,EACpF;AACA,SAAO;AACT;AAEO,SAAS,0BAA0B,OAA0C;AAClF,MAAI;AACF,WAAO,uBAAuB,KAAK;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseWorkspacePath
|
|
3
|
+
} from "./chunk-SI2LU2RP.js";
|
|
4
|
+
import {
|
|
5
|
+
getFileSystemProviderV2
|
|
6
|
+
} from "./chunk-EZKJZUNJ.js";
|
|
7
|
+
|
|
8
|
+
// src/filesystem/move-error.ts
|
|
9
|
+
function locationFromPresence(source, destination) {
|
|
10
|
+
if (source === "unknown" || destination === "unknown") return "unknown";
|
|
11
|
+
if (source === "present" && destination === "present") return "both";
|
|
12
|
+
if (source === "present") return "source";
|
|
13
|
+
if (destination === "present") return "destination";
|
|
14
|
+
return "neither";
|
|
15
|
+
}
|
|
16
|
+
var FileSystemMoveRecoveryError = class extends Error {
|
|
17
|
+
constructor(sourcePath, destinationPath, state, moveError) {
|
|
18
|
+
super(
|
|
19
|
+
`The move did not restore one authoritative path. Entry location: ${locationFromPresence(
|
|
20
|
+
state.source,
|
|
21
|
+
state.destination
|
|
22
|
+
)}.`
|
|
23
|
+
);
|
|
24
|
+
this.sourcePath = sourcePath;
|
|
25
|
+
this.destinationPath = destinationPath;
|
|
26
|
+
this.state = state;
|
|
27
|
+
this.moveError = moveError;
|
|
28
|
+
this.code = "partial-move";
|
|
29
|
+
this.name = "FileSystemMoveRecoveryError";
|
|
30
|
+
}
|
|
31
|
+
get location() {
|
|
32
|
+
return locationFromPresence(this.state.source, this.state.destination);
|
|
33
|
+
}
|
|
34
|
+
/** Alias used by DocumentSession's document-retarget recovery protocol. */
|
|
35
|
+
get documentLocation() {
|
|
36
|
+
return this.location;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var FileSystemPartialMoveError = class extends Error {
|
|
40
|
+
constructor(sourcePath, destinationPath, companionSourcePath, companionDestinationPath, state, moveError, rollbackError) {
|
|
41
|
+
super(
|
|
42
|
+
`The document move could not be rolled back. Document location: ${locationFromPresence(
|
|
43
|
+
state.source,
|
|
44
|
+
state.destination
|
|
45
|
+
)}; companion location: ${locationFromPresence(
|
|
46
|
+
state.companionSource,
|
|
47
|
+
state.companionDestination
|
|
48
|
+
)}.`
|
|
49
|
+
);
|
|
50
|
+
this.sourcePath = sourcePath;
|
|
51
|
+
this.destinationPath = destinationPath;
|
|
52
|
+
this.companionSourcePath = companionSourcePath;
|
|
53
|
+
this.companionDestinationPath = companionDestinationPath;
|
|
54
|
+
this.state = state;
|
|
55
|
+
this.moveError = moveError;
|
|
56
|
+
this.rollbackError = rollbackError;
|
|
57
|
+
this.code = "partial-move";
|
|
58
|
+
this.name = "FileSystemPartialMoveError";
|
|
59
|
+
}
|
|
60
|
+
get documentLocation() {
|
|
61
|
+
return locationFromPresence(this.state.source, this.state.destination);
|
|
62
|
+
}
|
|
63
|
+
get companionLocation() {
|
|
64
|
+
return locationFromPresence(this.state.companionSource, this.state.companionDestination);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
function isFileSystemPartialMoveError(error) {
|
|
68
|
+
return error instanceof FileSystemPartialMoveError;
|
|
69
|
+
}
|
|
70
|
+
function isFileSystemMoveRecoveryError(error) {
|
|
71
|
+
return error instanceof FileSystemMoveRecoveryError;
|
|
72
|
+
}
|
|
73
|
+
function isFileSystemMoveStateError(error) {
|
|
74
|
+
return isFileSystemMoveRecoveryError(error) || isFileSystemPartialMoveError(error);
|
|
75
|
+
}
|
|
76
|
+
async function probePath(provider, path) {
|
|
77
|
+
try {
|
|
78
|
+
const providerV2 = getFileSystemProviderV2(provider);
|
|
79
|
+
const present = providerV2 ? await providerV2.stat(parseWorkspacePath(path)) !== null : await provider.exists(path);
|
|
80
|
+
return present ? "present" : "missing";
|
|
81
|
+
} catch {
|
|
82
|
+
return "unknown";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function describePartialMove(provider, sourcePath, destinationPath, companionSourcePath, companionDestinationPath) {
|
|
86
|
+
const [source, destination, companionSource, companionDestination] = await Promise.all([
|
|
87
|
+
probePath(provider, sourcePath),
|
|
88
|
+
probePath(provider, destinationPath),
|
|
89
|
+
probePath(provider, companionSourcePath),
|
|
90
|
+
probePath(provider, companionDestinationPath)
|
|
91
|
+
]);
|
|
92
|
+
return { source, destination, companionSource, companionDestination };
|
|
93
|
+
}
|
|
94
|
+
async function describeEntryMove(provider, sourcePath, destinationPath) {
|
|
95
|
+
const [source, destination] = await Promise.all([
|
|
96
|
+
probePath(provider, sourcePath),
|
|
97
|
+
probePath(provider, destinationPath)
|
|
98
|
+
]);
|
|
99
|
+
return { source, destination };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
FileSystemMoveRecoveryError,
|
|
104
|
+
FileSystemPartialMoveError,
|
|
105
|
+
isFileSystemPartialMoveError,
|
|
106
|
+
isFileSystemMoveRecoveryError,
|
|
107
|
+
isFileSystemMoveStateError,
|
|
108
|
+
describePartialMove,
|
|
109
|
+
describeEntryMove
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=chunk-EGNDADXB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filesystem/move-error.ts"],"sourcesContent":["import { getFileSystemProviderV2, type FileSystemProvider } from './types.js';\nimport { parseWorkspacePath } from './workspace-path.js';\n\nexport type FileSystemPathPresence = 'present' | 'missing' | 'unknown';\n\nexport interface FileSystemPartialMoveState {\n readonly source: FileSystemPathPresence;\n readonly destination: FileSystemPathPresence;\n readonly companionSource: FileSystemPathPresence;\n readonly companionDestination: FileSystemPathPresence;\n}\n\nexport type FileSystemMoveLocation = 'source' | 'destination' | 'both' | 'neither' | 'unknown';\n\nexport interface FileSystemEntryMoveState {\n readonly source: FileSystemPathPresence;\n readonly destination: FileSystemPathPresence;\n}\n\nfunction locationFromPresence(\n source: FileSystemPathPresence,\n destination: FileSystemPathPresence,\n): FileSystemMoveLocation {\n if (source === 'unknown' || destination === 'unknown') return 'unknown';\n if (source === 'present' && destination === 'present') return 'both';\n if (source === 'present') return 'source';\n if (destination === 'present') return 'destination';\n return 'neither';\n}\n\n/**\n * One provider move failed without restoring a provable source-only state.\n * This is backend-neutral: callers must use `location`, never infer from the\n * original exception or a provider's advertised move atomicity.\n */\nexport class FileSystemMoveRecoveryError extends Error {\n public readonly code = 'partial-move' as const;\n\n public constructor(\n public readonly sourcePath: string,\n public readonly destinationPath: string,\n public readonly state: FileSystemEntryMoveState,\n public readonly moveError: unknown,\n ) {\n super(\n `The move did not restore one authoritative path. Entry location: ${locationFromPresence(\n state.source,\n state.destination,\n )}.`,\n );\n this.name = 'FileSystemMoveRecoveryError';\n }\n\n public get location(): FileSystemMoveLocation {\n return locationFromPresence(this.state.source, this.state.destination);\n }\n\n /** Alias used by DocumentSession's document-retarget recovery protocol. */\n public get documentLocation(): FileSystemMoveLocation {\n return this.location;\n }\n}\n\n/**\n * A compound document/companion move failed and the document rollback also\n * failed. Callers must use the recorded post-state instead of assuming the\n * original path is still authoritative.\n */\nexport class FileSystemPartialMoveError extends Error {\n readonly code = 'partial-move' as const;\n\n constructor(\n readonly sourcePath: string,\n readonly destinationPath: string,\n readonly companionSourcePath: string,\n readonly companionDestinationPath: string,\n readonly state: FileSystemPartialMoveState,\n readonly moveError: unknown,\n readonly rollbackError: unknown,\n ) {\n super(\n `The document move could not be rolled back. Document location: ${locationFromPresence(\n state.source,\n state.destination,\n )}; companion location: ${locationFromPresence(\n state.companionSource,\n state.companionDestination,\n )}.`,\n );\n this.name = 'FileSystemPartialMoveError';\n }\n\n get documentLocation(): FileSystemMoveLocation {\n return locationFromPresence(this.state.source, this.state.destination);\n }\n\n get companionLocation(): FileSystemMoveLocation {\n return locationFromPresence(this.state.companionSource, this.state.companionDestination);\n }\n}\n\nexport function isFileSystemPartialMoveError(error: unknown): error is FileSystemPartialMoveError {\n return error instanceof FileSystemPartialMoveError;\n}\n\nexport function isFileSystemMoveRecoveryError(\n error: unknown,\n): error is FileSystemMoveRecoveryError {\n return error instanceof FileSystemMoveRecoveryError;\n}\n\nexport function isFileSystemMoveStateError(\n error: unknown,\n): error is FileSystemMoveRecoveryError | FileSystemPartialMoveError {\n return isFileSystemMoveRecoveryError(error) || isFileSystemPartialMoveError(error);\n}\n\nasync function probePath(\n provider: FileSystemProvider,\n path: string,\n): Promise<FileSystemPathPresence> {\n try {\n const providerV2 = getFileSystemProviderV2(provider);\n const present = providerV2\n ? (await providerV2.stat(parseWorkspacePath(path))) !== null\n : await provider.exists(path);\n return present ? 'present' : 'missing';\n } catch {\n return 'unknown';\n }\n}\n\nexport async function describePartialMove(\n provider: FileSystemProvider,\n sourcePath: string,\n destinationPath: string,\n companionSourcePath: string,\n companionDestinationPath: string,\n): Promise<FileSystemPartialMoveState> {\n const [source, destination, companionSource, companionDestination] = await Promise.all([\n probePath(provider, sourcePath),\n probePath(provider, destinationPath),\n probePath(provider, companionSourcePath),\n probePath(provider, companionDestinationPath),\n ]);\n return { source, destination, companionSource, companionDestination };\n}\n\nexport async function describeEntryMove(\n provider: FileSystemProvider,\n sourcePath: string,\n destinationPath: string,\n): Promise<FileSystemEntryMoveState> {\n const [source, destination] = await Promise.all([\n probePath(provider, sourcePath),\n probePath(provider, destinationPath),\n ]);\n return { source, destination };\n}\n"],"mappings":";;;;;;;;AAmBA,SAAS,qBACP,QACA,aACwB;AACxB,MAAI,WAAW,aAAa,gBAAgB,UAAW,QAAO;AAC9D,MAAI,WAAW,aAAa,gBAAgB,UAAW,QAAO;AAC9D,MAAI,WAAW,UAAW,QAAO;AACjC,MAAI,gBAAgB,UAAW,QAAO;AACtC,SAAO;AACT;AAOO,IAAM,8BAAN,cAA0C,MAAM;AAAA,EAG9C,YACW,YACA,iBACA,OACA,WAChB;AACA;AAAA,MACE,oEAAoE;AAAA,QAClE,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAVgB;AACA;AACA;AACA;AANlB,SAAgB,OAAO;AAcrB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA,IAAW,WAAmC;AAC5C,WAAO,qBAAqB,KAAK,MAAM,QAAQ,KAAK,MAAM,WAAW;AAAA,EACvE;AAAA;AAAA,EAGA,IAAW,mBAA2C;AACpD,WAAO,KAAK;AAAA,EACd;AACF;AAOO,IAAM,6BAAN,cAAyC,MAAM;AAAA,EAGpD,YACW,YACA,iBACA,qBACA,0BACA,OACA,WACA,eACT;AACA;AAAA,MACE,kEAAkE;AAAA,QAChE,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC,yBAAyB;AAAA,QACxB,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAhBS;AACA;AACA;AACA;AACA;AACA;AACA;AATX,SAAS,OAAO;AAoBd,SAAK,OAAO;AAAA,EACd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
|
+
function hasFileSystemProviderV2(provider) {
|
|
3
|
+
return provider.v2 !== void 0 && provider.v2 !== null;
|
|
4
|
+
}
|
|
5
|
+
function getFileSystemProviderV2(provider) {
|
|
6
|
+
return provider.v2 ?? null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
hasFileSystemProviderV2,
|
|
11
|
+
getFileSystemProviderV2
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-EZKJZUNJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/filesystem/types.ts"],"sourcesContent":["/**\n * FileSystemProvider — abstract interface for a virtual filesystem.\n *\n * Legacy text-oriented facade retained while consumers migrate to\n * FileSystemProviderV2. New persistence code must use the provider's `v2`\n * contract so paths, errors, operation modes, and capabilities are explicit.\n */\n\n// ── Entry types ────────────────────────────────────────────────────\n\nimport type { FileSystemProviderV2 } from './v2.js';\n\nexport interface FileEntry {\n kind: 'file';\n name: string;\n path: string;\n}\n\nexport interface FolderEntry {\n kind: 'directory';\n name: string;\n path: string;\n}\n\nexport type FileSystemEntry = FileEntry | FolderEntry;\n\nexport interface FileMeta {\n name: string;\n path: string;\n size: number;\n lastModified: string;\n}\n\nexport type FileCommitResult =\n | { status: 'committed'; version: string | null }\n | { status: 'conflict'; content: string | null; version: string | null };\n\n// ── Provider interface ─────────────────────────────────────────────\n\n/**\n * @deprecated Compatibility facade for external providers and older callers.\n * Implement new backends with `FileSystemProviderV2`; built-in facades expose\n * their authoritative implementation through `v2`.\n */\nexport interface FileSystemProvider {\n /** Unique identifier for this provider instance. */\n readonly id: string;\n\n /** Human-readable label (e.g., folder name or \"Browser Storage\"). */\n readonly label: string;\n\n /** Optional correctness-first implementation exposed during the v1-to-v2 migration. */\n readonly v2?: FileSystemProviderV2;\n\n /** Read the text content of a file. Returns null if the file doesn't exist. */\n readFile(path: string): Promise<string | null>;\n\n /** Write text content to a file, creating it (and parent dirs) if needed. */\n writeFile(path: string, content: string): Promise<void>;\n\n /**\n * Conditionally replace a text file when it still matches the caller's\n * persisted baseline. Production providers implement this at their\n * strongest available serialization boundary.\n */\n commitFile?(\n path: string,\n content: string,\n expectedContent: string | null,\n ): Promise<FileCommitResult>;\n\n /**\n * Legacy recursive removal of a file or directory subtree. Workspace root\n * deletion is forbidden. Prefer v2 `remove({ recursive })`.\n */\n delete(path: string): Promise<void>;\n\n /** Rename or move an entry. Rejects missing sources and existing destinations. */\n rename(oldPath: string, newPath: string): Promise<void>;\n\n /** List immediate children of a directory. */\n readDirectory(path: string): Promise<FileSystemEntry[]>;\n\n /** Check whether a path exists. */\n exists(path: string): Promise<boolean>;\n\n /** Create a directory (and parents if needed). */\n createDirectory(path: string): Promise<void>;\n\n /** Get metadata for a file. Returns null if not found. */\n stat(path: string): Promise<FileMeta | null>;\n\n /** Read raw binary content. Returns null if not found. */\n readBinary(path: string): Promise<ArrayBuffer | null>;\n\n /** Write raw binary content. */\n writeBinary(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;\n}\n\nexport type FileSystemProviderWithV2 = FileSystemProvider & {\n readonly v2: FileSystemProviderV2;\n};\n\n/** Discover a provider-owned v2 implementation without coupling consumers to a concrete class. */\nexport function hasFileSystemProviderV2(\n provider: FileSystemProvider,\n): provider is FileSystemProviderWithV2 {\n return provider.v2 !== undefined && provider.v2 !== null;\n}\n\n/** Return the provider-owned v2 implementation when migration support is available. */\nexport function getFileSystemProviderV2(provider: FileSystemProvider): FileSystemProviderV2 | null {\n return provider.v2 ?? null;\n}\n"],"mappings":";AAwGO,SAAS,wBACd,UACsC;AACtC,SAAO,SAAS,OAAO,UAAa,SAAS,OAAO;AACtD;AAGO,SAAS,wBAAwB,UAA2D;AACjG,SAAO,SAAS,MAAM;AACxB;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/host/wire-policy.ts
|
|
2
|
+
var HOST_WIRE_LIMITS = Object.freeze({
|
|
3
|
+
identifierCharacters: 256,
|
|
4
|
+
labelCharacters: 1024,
|
|
5
|
+
pathCharacters: 4096,
|
|
6
|
+
urlCharacters: 8192,
|
|
7
|
+
messageCharacters: 2e3,
|
|
8
|
+
documentCharacters: 20 * 1024 * 1024,
|
|
9
|
+
binaryBytes: 100 * 1024 * 1024,
|
|
10
|
+
base64Characters: 140 * 1024 * 1024,
|
|
11
|
+
arrayEntries: 1e4
|
|
12
|
+
});
|
|
13
|
+
function hasExactKeys(value, keys) {
|
|
14
|
+
const actual = Object.keys(value);
|
|
15
|
+
return actual.length === keys.length && keys.every((key) => Object.prototype.hasOwnProperty.call(value, key));
|
|
16
|
+
}
|
|
17
|
+
function isBoundedString(value, maximumCharacters, minimumCharacters = 0) {
|
|
18
|
+
return typeof value === "string" && value.length >= minimumCharacters && value.length <= maximumCharacters && !value.includes("\0");
|
|
19
|
+
}
|
|
20
|
+
function isBoundedBytePayload(value, maximumBytes = HOST_WIRE_LIMITS.binaryBytes) {
|
|
21
|
+
return (value instanceof ArrayBuffer || value instanceof Uint8Array) && value.byteLength <= maximumBytes;
|
|
22
|
+
}
|
|
23
|
+
function parseOpenRequest(value) {
|
|
24
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
25
|
+
const record = value;
|
|
26
|
+
if (record.kind === "workspace-file") {
|
|
27
|
+
if (!hasExactKeys(record, ["kind", "workspaceId", "path"])) return null;
|
|
28
|
+
if (!isBoundedString(record.workspaceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;
|
|
29
|
+
if (!isBoundedString(record.path, HOST_WIRE_LIMITS.pathCharacters, 1)) return null;
|
|
30
|
+
return { kind: "workspace-file", workspaceId: record.workspaceId, path: record.path };
|
|
31
|
+
}
|
|
32
|
+
if (record.kind === "external-file" || record.kind === "external-bundle") {
|
|
33
|
+
if (!hasExactKeys(record, ["kind", "resourceId", "name"])) return null;
|
|
34
|
+
if (!isBoundedString(record.resourceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;
|
|
35
|
+
if (!isBoundedString(record.name, HOST_WIRE_LIMITS.labelCharacters, 1)) return null;
|
|
36
|
+
return { kind: record.kind, resourceId: record.resourceId, name: record.name };
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
function parseExternalHttpUrl(value) {
|
|
41
|
+
if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return null;
|
|
42
|
+
try {
|
|
43
|
+
const url = new URL(value);
|
|
44
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") return null;
|
|
45
|
+
if (url.username || url.password) return null;
|
|
46
|
+
const canonical = url.href;
|
|
47
|
+
return canonical.length <= HOST_WIRE_LIMITS.urlCharacters ? canonical : null;
|
|
48
|
+
} catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function isTrustedRendererUrl(value, developmentOrigin) {
|
|
53
|
+
if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return false;
|
|
54
|
+
try {
|
|
55
|
+
const url = new URL(value);
|
|
56
|
+
if (url.protocol === "app:" && url.hostname === "docblocks" && url.port === "" && url.username === "" && url.password === "") {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (!developmentOrigin) return false;
|
|
60
|
+
const trustedDevelopmentOrigin = new URL(developmentOrigin);
|
|
61
|
+
return url.origin === trustedDevelopmentOrigin.origin;
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
HOST_WIRE_LIMITS,
|
|
69
|
+
isBoundedString,
|
|
70
|
+
isBoundedBytePayload,
|
|
71
|
+
parseOpenRequest,
|
|
72
|
+
parseExternalHttpUrl,
|
|
73
|
+
isTrustedRendererUrl
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-FNW556FN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/host/wire-policy.ts"],"sourcesContent":["import type { OpenRequest } from './types.js';\n\n/** Quantitative limits shared by privileged host boundaries. */\nexport const HOST_WIRE_LIMITS = Object.freeze({\n identifierCharacters: 256,\n labelCharacters: 1_024,\n pathCharacters: 4_096,\n urlCharacters: 8_192,\n messageCharacters: 2_000,\n documentCharacters: 20 * 1024 * 1024,\n binaryBytes: 100 * 1024 * 1024,\n base64Characters: 140 * 1024 * 1024,\n arrayEntries: 10_000,\n});\n\nfunction hasExactKeys(value: Record<string, unknown>, keys: readonly string[]): boolean {\n const actual = Object.keys(value);\n return (\n actual.length === keys.length &&\n keys.every((key) => Object.prototype.hasOwnProperty.call(value, key))\n );\n}\n\nexport function isBoundedString(\n value: unknown,\n maximumCharacters: number,\n minimumCharacters = 0,\n): value is string {\n return (\n typeof value === 'string' &&\n value.length >= minimumCharacters &&\n value.length <= maximumCharacters &&\n !value.includes('\\0')\n );\n}\n\nexport function isBoundedBytePayload(\n value: unknown,\n maximumBytes = HOST_WIRE_LIMITS.binaryBytes,\n): value is ArrayBuffer | Uint8Array {\n return (\n (value instanceof ArrayBuffer || value instanceof Uint8Array) &&\n value.byteLength <= maximumBytes\n );\n}\n\n/** Parse one exact, bounded main-to-renderer open request. */\nexport function parseOpenRequest(value: unknown): OpenRequest | null {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return null;\n const record = value as Record<string, unknown>;\n\n if (record.kind === 'workspace-file') {\n if (!hasExactKeys(record, ['kind', 'workspaceId', 'path'])) return null;\n if (!isBoundedString(record.workspaceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;\n if (!isBoundedString(record.path, HOST_WIRE_LIMITS.pathCharacters, 1)) return null;\n return { kind: 'workspace-file', workspaceId: record.workspaceId, path: record.path };\n }\n\n if (record.kind === 'external-file' || record.kind === 'external-bundle') {\n if (!hasExactKeys(record, ['kind', 'resourceId', 'name'])) return null;\n if (!isBoundedString(record.resourceId, HOST_WIRE_LIMITS.identifierCharacters, 1)) return null;\n if (!isBoundedString(record.name, HOST_WIRE_LIMITS.labelCharacters, 1)) return null;\n return { kind: record.kind, resourceId: record.resourceId, name: record.name };\n }\n\n return null;\n}\n\n/** Return one canonical HTTP(S) URL, or null when external navigation is unsafe. */\nexport function parseExternalHttpUrl(value: unknown): string | null {\n if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return null;\n try {\n const url = new URL(value);\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;\n if (url.username || url.password) return null;\n const canonical = url.href;\n return canonical.length <= HOST_WIRE_LIMITS.urlCharacters ? canonical : null;\n } catch {\n return null;\n }\n}\n\n/** True only for the packaged renderer origin or the exact configured dev origin. */\nexport function isTrustedRendererUrl(value: unknown, developmentOrigin?: string): boolean {\n if (!isBoundedString(value, HOST_WIRE_LIMITS.urlCharacters, 1)) return false;\n try {\n const url = new URL(value);\n if (\n url.protocol === 'app:' &&\n url.hostname === 'docblocks' &&\n url.port === '' &&\n url.username === '' &&\n url.password === ''\n ) {\n return true;\n }\n if (!developmentOrigin) return false;\n const trustedDevelopmentOrigin = new URL(developmentOrigin);\n return url.origin === trustedDevelopmentOrigin.origin;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAGO,IAAM,mBAAmB,OAAO,OAAO;AAAA,EAC5C,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,oBAAoB,KAAK,OAAO;AAAA,EAChC,aAAa,MAAM,OAAO;AAAA,EAC1B,kBAAkB,MAAM,OAAO;AAAA,EAC/B,cAAc;AAChB,CAAC;AAED,SAAS,aAAa,OAAgC,MAAkC;AACtF,QAAM,SAAS,OAAO,KAAK,KAAK;AAChC,SACE,OAAO,WAAW,KAAK,UACvB,KAAK,MAAM,CAAC,QAAQ,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG,CAAC;AAExE;AAEO,SAAS,gBACd,OACA,mBACA,oBAAoB,GACH;AACjB,SACE,OAAO,UAAU,Y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