@bendyline/docblocks 2.4.0 → 2.5.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.
@@ -1,5 +1,7 @@
1
1
  // src/share/index.ts
2
2
  var SHARED_DOCUMENT_LIMITS = Object.freeze({
3
+ /** Conservative ceiling for a locally rendered, medium-correction QR code. */
4
+ qrUrlCharacters: 2048,
3
5
  /** A conservative interoperability threshold, not a universal browser limit. */
4
6
  portableUrlCharacters: 4096,
5
7
  /** Hard cap applied before a hash is copied or decoded. */
@@ -273,6 +273,11 @@ var DocumentSession = class {
273
273
  if (this.conflict.localContent === this.content && this.conflict.localRevision === this.revision && this.conflict.externalContent === change.content && this.conflict.externalVersion === externalVersion) {
274
274
  return "ignored";
275
275
  }
276
+ const localBranchIsStillClean = this.savingRevision === null && this.lifecycle === "open" && this.persistedRevision === this.revision && this.persistedContent === this.content && this.conflict.localRevision === this.revision && this.conflict.localContent === this.content;
277
+ if (localBranchIsStillClean && change.content !== null) {
278
+ this.adoptExternalContent(change.content);
279
+ return "applied";
280
+ }
276
281
  this.clearAutoSaveTimer();
277
282
  this.haltDrain = true;
278
283
  this.conflict = {
@@ -292,13 +297,7 @@ var DocumentSession = class {
292
297
  }
293
298
  const isClean = this.persistedRevision === this.revision && this.savingRevision === null && this.error === null && this.conflict === null;
294
299
  if (isClean && change.content !== null) {
295
- this.content = change.content;
296
- this.revision += 1;
297
- this.persistedRevision = this.revision;
298
- this.persistedContent = change.content;
299
- this.generation += 1;
300
- this.discardRecoverySnapshot();
301
- this.emit();
300
+ this.adoptExternalContent(change.content);
302
301
  return "applied";
303
302
  }
304
303
  this.clearAutoSaveTimer();
@@ -315,6 +314,20 @@ var DocumentSession = class {
315
314
  this.emit();
316
315
  return "conflict";
317
316
  }
317
+ adoptExternalContent(content) {
318
+ this.clearAutoSaveTimer();
319
+ this.autoSaveRetryAttempt = 0;
320
+ this.content = content;
321
+ this.revision += 1;
322
+ this.persistedRevision = this.revision;
323
+ this.persistedContent = content;
324
+ this.generation += 1;
325
+ this.haltDrain = false;
326
+ this.error = null;
327
+ this.conflict = null;
328
+ this.discardRecoverySnapshot();
329
+ this.emit();
330
+ }
318
331
  resolveConflict(strategy) {
319
332
  return this.enqueueOperation(async () => {
320
333
  if (!this.conflict) return this.snapshot;
@@ -102,6 +102,19 @@ function parseArtifactRef(value) {
102
102
  };
103
103
  }
104
104
  function parseDocumentSource(value) {
105
+ if (typeof value === "string") {
106
+ const text = value.trim();
107
+ if (text.startsWith("{")) {
108
+ try {
109
+ return parseDocumentSource(JSON.parse(text));
110
+ } catch {
111
+ return null;
112
+ }
113
+ }
114
+ if (isArtifactUri(text)) return { kind: "artifact", uri: text };
115
+ const parsedPath = parseNonRootWorkspacePath(text);
116
+ return parsedPath === null ? null : { kind: "file", rootId: null, path: parsedPath, format: null };
117
+ }
105
118
  if (!isRecord(value) || typeof value.kind !== "string") return null;
106
119
  switch (value.kind) {
107
120
  case "markdown": {
@@ -116,13 +129,14 @@ function parseDocumentSource(value) {
116
129
  return { kind: "markdown", markdown, name };
117
130
  }
118
131
  case "file": {
119
- if (!hasExactKeys(value, ["kind", "rootId", "path"]) && !hasExactKeys(value, ["kind", "rootId", "path", "format"])) {
132
+ if (!hasExactKeys(value, ["kind", "rootId", "path"]) && !hasExactKeys(value, ["kind", "rootId", "path", "format"]) && !hasExactKeys(value, ["kind", "path"]) && !hasExactKeys(value, ["kind", "path", "format"])) {
120
133
  return null;
121
134
  }
122
- const { rootId, path } = value;
135
+ const path = value.path;
136
+ const rootId = Object.prototype.hasOwnProperty.call(value, "rootId") ? value.rootId : null;
123
137
  const format = Object.prototype.hasOwnProperty.call(value, "format") ? value.format : null;
124
138
  const parsedPath = parseNonRootWorkspacePath(path);
125
- if (!isIdentifier(rootId) || parsedPath === null || !(format === null || isFormat(format))) {
139
+ if (!(rootId === null || isIdentifier(rootId)) || parsedPath === null || !(format === null || isFormat(format))) {
126
140
  return null;
127
141
  }
128
142
  return { kind: "file", rootId, path: parsedPath, format };
@@ -310,6 +310,7 @@ declare class DocumentSession {
310
310
  * adopt it. Dirty or saving sessions preserve local text and enter conflict.
311
311
  */
312
312
  observeExternal(change: DocumentExternalSnapshot): DocumentExternalChangeResult;
313
+ private adoptExternalContent;
313
314
  resolveConflict(strategy: DocumentConflictStrategy): Promise<DocumentSessionSnapshot>;
314
315
  /**
315
316
  * Freeze edits and flush through the latest revision. A successful call
@@ -7,7 +7,7 @@ import {
7
7
  DocumentSessionConflictError,
8
8
  createFileSystemDocumentTarget,
9
9
  getDefaultDocumentRecoveryStorage
10
- } from "../chunk-6L3JRDE7.js";
10
+ } from "../chunk-KLQKU74Q.js";
11
11
  import "../chunk-QI6YKTQV.js";
12
12
  import "../chunk-M5ZNQGR5.js";
13
13
  import "../chunk-AYWKIZLD.js";
@@ -1,7 +1,7 @@
1
1
  import { s as FileSystemProviderV2, r as FileSystemProviderCapabilities, k as FileSystemEntrySnapshot, m as FileSystemFileRead, K as FileSystemWriteOptions, n as FileSystemFileSnapshot, g as FileSystemCreateDirectoryOptions, h as FileSystemDirectorySnapshot, u as FileSystemRemoveOptions, v as FileSystemRemoveResult, o as FileSystemMoveOptions, w as FileSystemSnapshot, C as FileSystemWatchEvent, H as FileSystemWatchOptions, I as FileSystemWatchSubscription, q as FileSystemProvider, F as FileCommitResult, j as FileSystemEntry, b as FileMeta } from '../types-Bb3yccTH.js';
2
2
  import { a as WorkspacePath } from '../workspace-path-CWVrcuPL.js';
3
3
  export { isElectronHost } from '../host/index.js';
4
- import '../types-D2CRLJB6.js';
4
+ import '../types-ZU8tTM7T.js';
5
5
 
6
6
  /** Pure renderer-side client for the typed Electron filesystem v2 transport. */
7
7
  declare class ElectronFileSystemProviderV2 implements FileSystemProviderV2 {
@@ -10,7 +10,7 @@ import { MediaProvider } from '@bendyline/squisq/schemas';
10
10
  export { NativeFileSystemMovePathState, NativeFileSystemMoveRecoveryError, NativeFileSystemMoveRecoveryState, NativeFileSystemProvider, NativeFileSystemProviderV2, isNativeFileSystemSupported, loadDirectoryHandle, openNativeFolder, removeDirectoryHandle, restoreNativeFolder, storeDirectoryHandle } from './native.js';
11
11
  export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 } from './electron.js';
12
12
  export { isElectronHost } from '../host/index.js';
13
- import '../types-D2CRLJB6.js';
13
+ import '../types-ZU8tTM7T.js';
14
14
 
15
15
  interface DecodeUtf8TextOptions {
16
16
  /** User-facing description of the payload being decoded. */
@@ -1,5 +1,5 @@
1
- import { Q as OpenRequest, M as HostPinnedDocument, D as DocBlocksHostAPI } from '../types-D2CRLJB6.js';
2
- export { a as DocBlocksHostClipboardAPI, b as DocBlocksHostExportAPI, c as DocBlocksHostExternalAPI, d as DocBlocksHostFfmpegAPI, e as DocBlocksHostFsAPI, f as DocBlocksHostFsV2API, g as DocBlocksHostGitAPI, h as DocBlocksHostLifecycleAPI, i as DocBlocksHostMenuAPI, j as DocBlocksHostShellAPI, k as DocBlocksHostUpdaterAPI, l as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, m as ElectronWorkspaceInfo, n as ExternalBinaryCommitResult, G as GitBranchInfo, o as GitCapabilities, p as GitCloneHandle, q as GitCloneProgress, r as GitError, s as GitErrorCode, t as GitFileAtRevision, u as GitFileChange, v as GitFileStatusCode, w as GitLogEntry, x as GitLogOptions, y as GitRemoteInfo, z as GitRepoDetection, A as GitResult, B as GitRevision, C as GitStatus, H as HostCloseReason, F as HostEnvironment, I as HostExportTargetGrant, J as HostFileSystemV2OpenRequest, K as HostFileSystemV2Result, L as HostFileSystemV2WatchMessage, N as HostPrepareCloseRequest, O as HostPrepareCloseResult, P as MenuCommand, U as UpdateCheckResult, R as UpdateInstallResult, S as UpdaterStatus } from '../types-D2CRLJB6.js';
1
+ import { Q as OpenRequest, M as HostPinnedDocument, D as DocBlocksHostAPI } from '../types-ZU8tTM7T.js';
2
+ export { a as DocBlocksHostClipboardAPI, b as DocBlocksHostExportAPI, c as DocBlocksHostExternalAPI, d as DocBlocksHostFfmpegAPI, e as DocBlocksHostFsAPI, f as DocBlocksHostFsV2API, g as DocBlocksHostGitAPI, h as DocBlocksHostLifecycleAPI, i as DocBlocksHostMenuAPI, j as DocBlocksHostShellAPI, k as DocBlocksHostUpdaterAPI, l as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, m as ElectronWorkspaceInfo, n as ExternalBinaryCommitResult, G as GitBranchInfo, o as GitCapabilities, p as GitCloneHandle, q as GitCloneProgress, r as GitError, s as GitErrorCode, t as GitFileAtRevision, u as GitFileChange, v as GitFileStatusCode, w as GitLogEntry, x as GitLogOptions, y as GitRemoteInfo, z as GitRepoDetection, A as GitResult, B as GitRevision, C as GitStatus, H as HostCloseReason, F as HostEnvironment, I as HostExportTargetGrant, J as HostFileSystemV2OpenRequest, K as HostFileSystemV2Result, L as HostFileSystemV2WatchMessage, N as HostPrepareCloseRequest, O as HostPrepareCloseResult, P as MenuCommand, U as UpdateCheckResult, R as UpdateInstallResult, S as UpdaterStatus } from '../types-ZU8tTM7T.js';
3
3
  import '../types-Bb3yccTH.js';
4
4
  import '../workspace-path-CWVrcuPL.js';
5
5
 
package/dist/index.d.ts CHANGED
@@ -9,6 +9,6 @@ export { DOCUMENT_RECOVERY_JOURNAL_SCHEMA_VERSION, DOCUMENT_RECOVERY_JOURNAL_STO
9
9
  export { ElectronWorkspaceReconciliation, TransientOrigin, WorkspaceDescriptor, ensureDefaultWorkspace, getTransientWorkspace, getWorkspace, listWorkspaces, parsePersistedWorkspaceList, reconcileElectronWorkspaceDescriptors, registerTransientWorkspace, removeWorkspace, saveWorkspace, touchWorkspace, unregisterTransientWorkspace } from './workspace/index.js';
10
10
  export { HOST_WIRE_LIMITS, MAX_HOST_PINNED_DOCUMENTS, getDocBlocksHost, isBoundedBytePayload, isBoundedString, isElectronHost, isTrustedRendererUrl, maybeGetDocBlocksHost, parseExternalHttpUrl, parseOpenRequest, parsePinnedMenuDocuments } from './host/index.js';
11
11
  export { SHARED_DOCUMENT_LIMITS, SharedDocumentHashParseResult, SharedDocumentMode, SharedDocumentPayload, createSharedDocumentHash, createSharedDocumentUrl, parseSharedDocumentHash } from './share/index.js';
12
- export { D as DocBlocksHostAPI, a as DocBlocksHostClipboardAPI, b as DocBlocksHostExportAPI, c as DocBlocksHostExternalAPI, d as DocBlocksHostFfmpegAPI, e as DocBlocksHostFsAPI, f as DocBlocksHostFsV2API, g as DocBlocksHostGitAPI, h as DocBlocksHostLifecycleAPI, i as DocBlocksHostMenuAPI, j as DocBlocksHostShellAPI, k as DocBlocksHostUpdaterAPI, l as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, m as ElectronWorkspaceInfo, n as ExternalBinaryCommitResult, G as GitBranchInfo, o as GitCapabilities, p as GitCloneHandle, q as GitCloneProgress, r as GitError, s as GitErrorCode, t as GitFileAtRevision, u as GitFileChange, v as GitFileStatusCode, w as GitLogEntry, x as GitLogOptions, y as GitRemoteInfo, z as GitRepoDetection, A as GitResult, B as GitRevision, C as GitStatus, H as HostCloseReason, F as HostEnvironment, I as HostExportTargetGrant, J as HostFileSystemV2OpenRequest, K as HostFileSystemV2Result, L as HostFileSystemV2WatchMessage, M as HostPinnedDocument, N as HostPrepareCloseRequest, O as HostPrepareCloseResult, P as MenuCommand, Q as OpenRequest, U as UpdateCheckResult, R as UpdateInstallResult, S as UpdaterStatus } from './types-D2CRLJB6.js';
12
+ export { D as DocBlocksHostAPI, a as DocBlocksHostClipboardAPI, b as DocBlocksHostExportAPI, c as DocBlocksHostExternalAPI, d as DocBlocksHostFfmpegAPI, e as DocBlocksHostFsAPI, f as DocBlocksHostFsV2API, g as DocBlocksHostGitAPI, h as DocBlocksHostLifecycleAPI, i as DocBlocksHostMenuAPI, j as DocBlocksHostShellAPI, k as DocBlocksHostUpdaterAPI, l as DocBlocksHostWorkspacesAPI, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, m as ElectronWorkspaceInfo, n as ExternalBinaryCommitResult, G as GitBranchInfo, o as GitCapabilities, p as GitCloneHandle, q as GitCloneProgress, r as GitError, s as GitErrorCode, t as GitFileAtRevision, u as GitFileChange, v as GitFileStatusCode, w as GitLogEntry, x as GitLogOptions, y as GitRemoteInfo, z as GitRepoDetection, A as GitResult, B as GitRevision, C as GitStatus, H as HostCloseReason, F as HostEnvironment, I as HostExportTargetGrant, J as HostFileSystemV2OpenRequest, K as HostFileSystemV2Result, L as HostFileSystemV2WatchMessage, M as HostPinnedDocument, N as HostPrepareCloseRequest, O as HostPrepareCloseResult, P as MenuCommand, Q as OpenRequest, U as UpdateCheckResult, R as UpdateInstallResult, S as UpdaterStatus } from './types-ZU8tTM7T.js';
13
13
  import '@bendyline/squisq/storage';
14
14
  import '@bendyline/squisq/schemas';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createSharedDocumentHash,
4
4
  createSharedDocumentUrl,
5
5
  parseSharedDocumentHash
6
- } from "./chunk-LMMOFRGQ.js";
6
+ } from "./chunk-FBCGLK6N.js";
7
7
  import {
8
8
  FileSystemContentContainer,
9
9
  LegacyFileSystemProviderV2Adapter,
@@ -69,7 +69,7 @@ import {
69
69
  DocumentSessionConflictError,
70
70
  createFileSystemDocumentTarget,
71
71
  getDefaultDocumentRecoveryStorage
72
- } from "./chunk-6L3JRDE7.js";
72
+ } from "./chunk-KLQKU74Q.js";
73
73
  import {
74
74
  FileSystemMoveRecoveryError,
75
75
  FileSystemPartialMoveError,
@@ -1,5 +1,5 @@
1
- import { A as ArtifactRef, C as ComparisonResult, a as ConversionResult, D as DocumentSource, I as InspectionResult, M as MaterializationOptions, b as McpDiagnostic, c as McpErrorResult, P as PreviewResult } from '../types-DapJIsC2.js';
2
- export { d as AppliedOption, e as AppliedOptionValue, f as ApplyInferredThemeResult, g as ArtifactDocumentSource, h as AssetSummary, i as AuthoringContextResult, j as AuthoringGoal, k as AuthoringSyntaxSummary, l as AuthoringTemplateSummary, B as BlockSummary, m as BundleAssetContentSource, n as BundleAssetRef, o as BundleDocumentSource, p as ComparisonCategory, q as ComparisonChange, r as ComparisonMetric, s as ComparisonStatus, t as ConversionFidelity, u as ConvertDocumentResult, v as DOCBLOCKS_MCP_TOOL_NAMES, w as DOCBLOCKS_MCP_WIRE_VERSION, x as DescribeTemplateResult, y as DescribeThemeResult, z as DescribedTemplate, E as DiagnosticLocation, F as DiagnosticSeverity, G as DiagnosticStage, H as DocBlocksMcpToolName, J as DocBlocksMcpWireVersion, K as DocumentItemSummary, L as DocumentMetadataSummary, N as DocumentStatistics, O as EngineVersion, Q as FileDocumentSource, R as FormatCapabilitySummary, S as FormatDirectionCapability, T as InferThemeResult, U as InferredLayoutSummary, V as InspectPptxLayoutsResult, W as LinkSummary, X as ListFormatsResult, Y as ListRootsResult, Z as ListTemplatesResult, _ as ListThemesResult, $ as ListTransformStylesResult, a0 as MarkdownDocumentSource, a1 as McpErrorDetail, a2 as McpSuccessResult, a3 as OutlineEntry, a4 as PptxLayoutSummary, a5 as PptxSlideSize, a6 as PreviewItem, a7 as PreviewItemKind, a8 as RecommendTemplatesResult, a9 as RootGrantSummary, aa as SaveArtifactResult, ab as SavedArtifactDestination, ac as SourceRange, ad as TableSummary, ae as TemplateAuthoringRole, af as TemplateBodyPolicy, ag as TemplateContentProfile, ah as TemplateInputSummary, ai as TemplateRecommendation, aj as TemplateSummary, ak as ThemeCatalogEntry, al as ThemeDescription, am as ThemeDescriptionColors, an as ThemeSummary, ao as TransformStyleSummary } from '../types-DapJIsC2.js';
1
+ import { A as ArtifactRef, C as ComparisonResult, a as ConversionResult, D as DocumentSource, I as InspectionResult, M as MaterializationOptions, b as McpDiagnostic, c as McpErrorResult, P as PreviewResult } from '../types-Oy9U5FST.js';
2
+ export { d as AppliedOption, e as AppliedOptionValue, f as ApplyInferredThemeResult, g as ArtifactDocumentSource, h as AssetSummary, i as AuthoringContextResult, j as AuthoringGoal, k as AuthoringSyntaxSummary, l as AuthoringTemplateSummary, B as BlockSummary, m as BundleAssetContentSource, n as BundleAssetRef, o as BundleDocumentSource, p as ComparisonCategory, q as ComparisonChange, r as ComparisonMetric, s as ComparisonStatus, t as ConversionFidelity, u as ConvertDocumentResult, v as DOCBLOCKS_MCP_TOOL_NAMES, w as DOCBLOCKS_MCP_WIRE_VERSION, x as DescribeTemplateResult, y as DescribeThemeResult, z as DescribedTemplate, E as DiagnosticLocation, F as DiagnosticSeverity, G as DiagnosticStage, H as DocBlocksMcpToolName, J as DocBlocksMcpWireVersion, K as DocumentItemSummary, L as DocumentMetadataSummary, N as DocumentStatistics, O as EngineVersion, Q as FileDocumentSource, R as FormatCapabilitySummary, S as FormatDirectionCapability, T as InferThemeResult, U as InferredLayoutSummary, V as InspectPptxLayoutsResult, W as LinkSummary, X as ListFormatsResult, Y as ListRootsResult, Z as ListTemplatesResult, _ as ListThemesResult, $ as ListTransformStylesResult, a0 as MarkdownDocumentSource, a1 as McpErrorDetail, a2 as McpSuccessResult, a3 as OutlineEntry, a4 as PptxLayoutSummary, a5 as PptxSlideSize, a6 as PreviewItem, a7 as PreviewItemKind, a8 as RecommendTemplatesResult, a9 as RootGrantSummary, aa as SaveArtifactResult, ab as SavedArtifactDestination, ac as SourceRange, ad as TableSummary, ae as TemplateAuthoringRole, af as TemplateBodyPolicy, ag as TemplateContentProfile, ah as TemplateInputSummary, ai as TemplateRecommendation, aj as TemplateSummary, ak as ThemeCatalogEntry, al as ThemeDescription, am as ThemeDescriptionColors, an as ThemeSummary, ao as TransformStyleSummary } from '../types-Oy9U5FST.js';
3
3
  import '../workspace-path-CWVrcuPL.js';
4
4
 
5
5
  /** Quantitative limits for untrusted MCP payloads. */
package/dist/mcp/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  parseMcpDiagnostic,
12
12
  parseMcpErrorResult,
13
13
  parsePreviewResult
14
- } from "../chunk-EG3WGSZH.js";
14
+ } from "../chunk-YWYT6K6J.js";
15
15
  import "../chunk-AYWKIZLD.js";
16
16
  export {
17
17
  DOCBLOCKS_MCP_TOOL_NAMES,
package/dist/mcp/zod.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { z as z$1 } from 'zod/v4';
3
- import { H as DocBlocksMcpToolName } from '../types-DapJIsC2.js';
3
+ import { H as DocBlocksMcpToolName } from '../types-Oy9U5FST.js';
4
4
  import '../workspace-path-CWVrcuPL.js';
5
5
 
6
6
  /** Canonical Zod projection of the exact MCP wire contract for protocol SDKs. */
@@ -167,7 +167,22 @@ declare const bundleDocumentSourceSchema: z.ZodObject<{
167
167
  }[];
168
168
  name?: string | null | undefined;
169
169
  }>;
170
- declare const documentSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
170
+ /**
171
+ * Document source, with a flat-string convenience form.
172
+ *
173
+ * Small local models emitting tool calls through textual salvage produce
174
+ * flat KEY→string argument maps, so a structured `source` object arrives
175
+ * as a plain string — historically an instant .strict() rejection, and
176
+ * the first structural-args toolset turned that into unbreakable retry
177
+ * loops for every sub-frontier model (gezel's 2026-08-22 scorecard:
178
+ * PPTX production 0/33 across 11 local models). Accept the string
179
+ * spelling at the schema boundary instead: an artifact URI string is an
180
+ * artifact source, anything else is a root-relative file path. Inline
181
+ * markdown must still use the structured `{kind:"markdown"}` form — a
182
+ * bare string is far more often a path, and silently turning a mistyped
183
+ * path into a one-line document would be worse than rejecting it.
184
+ */
185
+ declare const documentSourceSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
171
186
  kind: z.ZodLiteral<"markdown">;
172
187
  markdown: z.ZodString;
173
188
  name: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
@@ -181,19 +196,19 @@ declare const documentSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject
181
196
  name?: string | null | undefined;
182
197
  }>, z.ZodObject<{
183
198
  kind: z.ZodLiteral<"file">;
184
- rootId: z.ZodString;
199
+ rootId: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
185
200
  path: z.ZodEffects<z.ZodString, string, string>;
186
201
  format: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
187
202
  }, "strict", z.ZodTypeAny, {
188
203
  path: string;
189
204
  format: string | null;
190
205
  kind: "file";
191
- rootId: string;
206
+ rootId: string | null;
192
207
  }, {
193
208
  path: string;
194
209
  kind: "file";
195
- rootId: string;
196
210
  format?: string | null | undefined;
211
+ rootId?: string | null | undefined;
197
212
  }>, z.ZodObject<{
198
213
  kind: z.ZodLiteral<"artifact">;
199
214
  uri: z.ZodString;
@@ -302,7 +317,38 @@ declare const documentSourceSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject
302
317
  license: string | null;
303
318
  }[];
304
319
  name?: string | null | undefined;
305
- }>]>;
320
+ }>]>, {
321
+ name: string | null;
322
+ markdown: string;
323
+ kind: "bundle";
324
+ assets: {
325
+ path: string;
326
+ source: {
327
+ path: string;
328
+ kind: "file";
329
+ rootId: string;
330
+ } | {
331
+ uri: string;
332
+ kind: "artifact";
333
+ };
334
+ mimeType: string | null;
335
+ altText: string | null;
336
+ credit: string | null;
337
+ license: string | null;
338
+ }[];
339
+ } | {
340
+ name: string | null;
341
+ markdown: string;
342
+ kind: "markdown";
343
+ } | {
344
+ path: string;
345
+ format: string | null;
346
+ kind: "file";
347
+ rootId: string | null;
348
+ } | {
349
+ uri: string;
350
+ kind: "artifact";
351
+ }, unknown>;
306
352
  declare const artifactRefSchema: z.ZodEffects<z.ZodObject<{
307
353
  id: z.ZodString;
308
354
  uri: z.ZodString;
package/dist/mcp/zod.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  parseConversionResult,
6
6
  parseInspectionResult,
7
7
  parsePreviewResult
8
- } from "../chunk-EG3WGSZH.js";
8
+ } from "../chunk-YWYT6K6J.js";
9
9
  import "../chunk-AYWKIZLD.js";
10
10
 
11
11
  // src/mcp/zod.ts
@@ -70,7 +70,7 @@ var bundleDocumentSourceSchema = z.object({
70
70
  assets: z.array(bundleAssetSchema).max(MCP_WIRE_LIMITS.bundleAssets),
71
71
  name: labelSchema.nullable().optional().default(null)
72
72
  }).strict();
73
- var documentSourceSchema = z.discriminatedUnion("kind", [
73
+ var structuredDocumentSourceSchema = z.discriminatedUnion("kind", [
74
74
  z.object({
75
75
  kind: z.literal("markdown"),
76
76
  markdown: z.string().max(MAX_MARKDOWN_CHARACTERS).regex(WIRE_STRING_PATTERN, "NUL and DEL are not permitted on the MCP wire"),
@@ -78,13 +78,31 @@ var documentSourceSchema = z.discriminatedUnion("kind", [
78
78
  }).strict(),
79
79
  z.object({
80
80
  kind: z.literal("file"),
81
- rootId: idSchema,
81
+ // Nullable-with-default: a null rootId means "the server's sole
82
+ // read-enabled root". Agents on a one-root server (the common MCP
83
+ // setup) no longer round-trip list_roots before every conversion;
84
+ // multi-root servers still get an actionable error naming the
85
+ // candidates. See McpFileAuthority.authorizeRootRead.
86
+ rootId: idSchema.nullable().optional().default(null),
82
87
  path: workspacePathSchema,
83
88
  format: formatSchema.nullable().optional().default(null)
84
89
  }).strict(),
85
90
  z.object({ kind: z.literal("artifact"), uri: artifactUriSchema }).strict(),
86
91
  bundleDocumentSourceSchema
87
92
  ]);
93
+ var documentSourceSchema = z.preprocess((value) => {
94
+ if (typeof value !== "string") return value;
95
+ const text = value.trim();
96
+ if (text.startsWith("{")) {
97
+ try {
98
+ return JSON.parse(text);
99
+ } catch {
100
+ return value;
101
+ }
102
+ }
103
+ if (ARTIFACT_URI_PATTERN.test(text)) return { kind: "artifact", uri: text };
104
+ return { kind: "file", path: text };
105
+ }, structuredDocumentSourceSchema);
88
106
  var appliedOptionSchema = z.object({
89
107
  name: idSchema,
90
108
  value: z.union([boundedString, z.number().finite(), z.boolean(), z.null()])
@@ -24,6 +24,8 @@ type SharedDocumentHashParseResult = {
24
24
  readonly message: string;
25
25
  };
26
26
  declare const SHARED_DOCUMENT_LIMITS: Readonly<{
27
+ /** Conservative ceiling for a locally rendered, medium-correction QR code. */
28
+ qrUrlCharacters: 2048;
27
29
  /** A conservative interoperability threshold, not a universal browser limit. */
28
30
  portableUrlCharacters: 4096;
29
31
  /** Hard cap applied before a hash is copied or decoded. */
@@ -3,7 +3,7 @@ import {
3
3
  createSharedDocumentHash,
4
4
  createSharedDocumentUrl,
5
5
  parseSharedDocumentHash
6
- } from "../chunk-LMMOFRGQ.js";
6
+ } from "../chunk-FBCGLK6N.js";
7
7
  export {
8
8
  SHARED_DOCUMENT_LIMITS,
9
9
  createSharedDocumentHash,
@@ -55,10 +55,17 @@ interface MarkdownDocumentSource {
55
55
  readonly markdown: string;
56
56
  readonly name: string | null;
57
57
  }
58
- /** A file selected from a server-configured, authority-scoped root. */
58
+ /**
59
+ * A file selected from a server-configured, authority-scoped root.
60
+ *
61
+ * A null rootId means "the server's sole read-enabled root": callers on
62
+ * a one-root server may omit it, and the authority resolves or rejects
63
+ * with the candidate ids. It never grants new authority — resolution
64
+ * still goes through the same root allow-list.
65
+ */
59
66
  interface FileDocumentSource {
60
67
  readonly kind: 'file';
61
- readonly rootId: string;
68
+ readonly rootId: string | null;
62
69
  readonly path: WorkspacePath;
63
70
  readonly format: string | null;
64
71
  }
@@ -306,6 +306,8 @@ interface DocBlocksHostWorkspacesAPI {
306
306
  interface DocBlocksHostShellAPI {
307
307
  /** Reveal a registered workspace root or one root-relative entry. */
308
308
  revealInFolder(workspaceId: string, workspacePath?: string): Promise<void>;
309
+ /** Open a registered workspace root in Finder or the platform file manager. */
310
+ openWorkspaceFolder(workspaceId: string): Promise<void>;
309
311
  /** Open a URL in the default browser. */
310
312
  openExternal(url: string): Promise<void>;
311
313
  }
@@ -313,6 +315,8 @@ interface DocBlocksHostShellAPI {
313
315
  interface DocBlocksHostClipboardAPI {
314
316
  /** Replace the system clipboard's plain-text contents. */
315
317
  writeText(text: string): Promise<void>;
318
+ /** Resolve a registered workspace entry in main and copy its absolute path. */
319
+ writeWorkspacePath(workspaceId: string, workspacePath: string): Promise<void>;
316
320
  }
317
321
  /** Exact, main-owned export authority. The display path is never authority. */
318
322
  interface HostExportTargetGrant {
@@ -1,5 +1,5 @@
1
1
  import { q as FileSystemProvider } from '../types-Bb3yccTH.js';
2
- import { m as ElectronWorkspaceInfo, F as HostEnvironment } from '../types-D2CRLJB6.js';
2
+ import { m as ElectronWorkspaceInfo, F as HostEnvironment } from '../types-ZU8tTM7T.js';
3
3
  import '../workspace-path-CWVrcuPL.js';
4
4
 
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/docblocks",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Core data structures and filesystem abstractions for DocBlocks",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -106,7 +106,7 @@
106
106
  "typecheck": "tsc --noEmit"
107
107
  },
108
108
  "dependencies": {
109
- "@bendyline/squisq": "2.8.0",
109
+ "@bendyline/squisq": "2.9.0",
110
110
  "zod": "3.25.76"
111
111
  }
112
112
  }