@bendyline/docblocks 2.7.7 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/THIRD_PARTY_NOTICES.txt +7 -7
  2. package/dist/{capabilities-D4Z1xYZV.d.ts → capabilities-CH66e2pR.d.ts} +187 -13
  3. package/dist/{catalog-BQK05tne.d.ts → catalog-BmEXHaZf.d.ts} +30 -4
  4. package/dist/{chunk-5VEIEFFC.js → chunk-CI3DHDPG.js} +1 -1
  5. package/dist/{chunk-FIEMYP2N.js → chunk-D7VUEVAX.js} +10 -1
  6. package/dist/{chunk-R2JX5N3F.js → chunk-L7HADBCQ.js} +49 -0
  7. package/dist/{chunk-66WTIYYG.js → chunk-LP6JHGBP.js} +2 -2
  8. package/dist/{chunk-BC42VRYW.js → chunk-PQBUG5DY.js} +49 -7
  9. package/dist/{chunk-RFEB4N5Q.js → chunk-WE5W7BRL.js} +299 -8
  10. package/dist/{chunk-NECMAJHS.js → chunk-ZBRXXOW5.js} +1 -1
  11. package/dist/document/index.d.ts +3 -0
  12. package/dist/document/index.js +1 -1
  13. package/dist/filesystem/electron.d.ts +1 -1
  14. package/dist/filesystem/electron.js +3 -3
  15. package/dist/filesystem/host.js +2 -2
  16. package/dist/filesystem/index.d.ts +1 -1
  17. package/dist/filesystem/index.js +5 -5
  18. package/dist/host/index.d.ts +3 -2
  19. package/dist/host/index.js +29 -1
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +33 -5
  22. package/dist/mcp/zod.d.ts +542 -542
  23. package/dist/{reconcile-electron-DuwLsuic.d.ts → reconcile-electron-BcwJ7z5Z.d.ts} +1 -1
  24. package/dist/{settings-HrrCikVX.d.ts → settings-C-TS15JZ.d.ts} +28 -2
  25. package/dist/vscode/index.d.ts +1 -1
  26. package/dist/vscode/index.js +1 -1
  27. package/dist/workspace/index.d.ts +2 -2
  28. package/dist/workspace-index/index.d.ts +2 -2
  29. package/dist/workspace-index/index.js +1 -1
  30. package/dist/workspace-settings/index.d.ts +26 -5
  31. package/dist/workspace-settings/index.js +42 -7
  32. package/package.json +2 -2
@@ -21,6 +21,7 @@ var WORKSPACE_SETTINGS_LIMITS = {
21
21
  var WORKSPACE_THEME_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
22
22
  var CATALOG_SORT_ORDERS = ["title", "path", "date"];
23
23
  var CATALOG_JSON_CONTENT_MODES = ["metadata", "markdown"];
24
+ var WORKSPACE_OUTPUT_TEMPLATE_FORMATS = ["html"];
24
25
  var EMPTY_WORKSPACE_SETTINGS = Object.freeze({
25
26
  version: WORKSPACE_SETTINGS_VERSION
26
27
  });
@@ -85,6 +86,32 @@ function boundedPath(value, label) {
85
86
  if (!path) fail(`${label} must not be the workspace root.`);
86
87
  return path;
87
88
  }
89
+ var OUTPUT_TEMPLATE_EXTENSIONS = {
90
+ html: [".html", ".htm"]
91
+ };
92
+ function validateOutputTemplatePath(value, format) {
93
+ const label = `documents.outputTemplates.${format}`;
94
+ const path = boundedPath(value, label);
95
+ const lower = path.toLowerCase();
96
+ if (!OUTPUT_TEMPLATE_EXTENSIONS[format].some((extension) => lower.endsWith(extension))) {
97
+ fail(`${label} must end with ${OUTPUT_TEMPLATE_EXTENSIONS[format].join(" or ")}.`);
98
+ }
99
+ return path;
100
+ }
101
+ function checkOutputTemplatePath(value, format) {
102
+ try {
103
+ return { ok: true, path: validateOutputTemplatePath(value, format) };
104
+ } catch (error) {
105
+ return { ok: false, message: shapeMessage(error) };
106
+ }
107
+ }
108
+ function parseOutputTemplates(value) {
109
+ if (value === void 0) return void 0;
110
+ const record = exactRecord(value, "documents.outputTemplates", WORKSPACE_OUTPUT_TEMPLATE_FORMATS);
111
+ return compact({
112
+ html: record.html === void 0 ? void 0 : validateOutputTemplatePath(record.html, "html")
113
+ });
114
+ }
88
115
  var OUTPUT_EXTENSIONS = {
89
116
  html: [".html", ".htm"],
90
117
  json: [".json"]
@@ -146,6 +173,7 @@ function compact(value) {
146
173
  const entries = Object.entries(value).filter(([, field]) => field !== void 0);
147
174
  return entries.length > 0 ? Object.fromEntries(entries) : void 0;
148
175
  }
176
+ var DOCUMENT_SETTINGS_KEYS = ["defaultTheme", "outputTemplates"];
149
177
  function parseWorkspaceSettings(value) {
150
178
  const root = isRecord(value) ? value : fail("Workspace settings must be a JSON object.");
151
179
  const version = root.version;
@@ -169,9 +197,10 @@ function parseWorkspaceSettings(value) {
169
197
  }
170
198
  let documents;
171
199
  if (root.documents !== void 0) {
172
- const record = exactRecord(root.documents, "documents", ["defaultTheme"]);
200
+ const record = exactRecord(root.documents, "documents", DOCUMENT_SETTINGS_KEYS);
173
201
  documents = compact({
174
- defaultTheme: optionalTheme(record.defaultTheme, "documents.defaultTheme")
202
+ defaultTheme: optionalTheme(record.defaultTheme, "documents.defaultTheme"),
203
+ outputTemplates: parseOutputTemplates(record.outputTemplates)
175
204
  });
176
205
  }
177
206
  let versionHistory;
@@ -278,7 +307,11 @@ function serializeWorkspaceSettings(settings) {
278
307
  if (normalized.$schema !== void 0) ordered.$schema = normalized.$schema;
279
308
  ordered.version = normalized.version;
280
309
  if (normalized.documents) {
281
- ordered.documents = pick(normalized.documents, ["defaultTheme"]);
310
+ const { outputTemplates } = normalized.documents;
311
+ ordered.documents = {
312
+ ...pick(normalized.documents, ["defaultTheme"]),
313
+ ...outputTemplates ? { outputTemplates: pick(outputTemplates, WORKSPACE_OUTPUT_TEMPLATE_FORMATS) } : {}
314
+ };
282
315
  }
283
316
  if (normalized.versionHistory) {
284
317
  ordered.versionHistory = pick(normalized.versionHistory, ["enabled", "keep"]);
@@ -340,7 +373,7 @@ function optionalSection(key, value) {
340
373
  }
341
374
  function diffWorkspaceSettings(before, after) {
342
375
  const base = before ?? EMPTY_WORKSPACE_SETTINGS;
343
- const documents = diffFields(base.documents, after.documents, ["defaultTheme"]);
376
+ const documents = diffFields(base.documents, after.documents, DOCUMENT_SETTINGS_KEYS);
344
377
  const versionHistory = diffFields(base.versionHistory, after.versionHistory, ["enabled", "keep"]);
345
378
  const top = diffFields(
346
379
  base.catalog,
@@ -378,12 +411,13 @@ function parseWorkspaceSettingsPatch(value) {
378
411
  const nullable = (field, parse) => field === null ? null : parse(field);
379
412
  const result = {};
380
413
  if (root.documents !== void 0) {
381
- const record = exactRecord(root.documents, "documents", ["defaultTheme"]);
414
+ const record = exactRecord(root.documents, "documents", DOCUMENT_SETTINGS_KEYS);
382
415
  result.documents = compact({
383
416
  defaultTheme: nullable(
384
417
  record.defaultTheme,
385
418
  (input) => optionalTheme(input, "documents.defaultTheme")
386
- )
419
+ ),
420
+ outputTemplates: nullable(record.outputTemplates, parseOutputTemplates)
387
421
  }) ?? {};
388
422
  }
389
423
  if (root.versionHistory !== void 0) {
@@ -451,11 +485,15 @@ function tryApplyWorkspaceSettingsPatch(base, patch) {
451
485
  }
452
486
  }
453
487
  function isDefaultWorkspaceSettings(settings) {
454
- return settings?.documents?.defaultTheme === void 0 && settings?.versionHistory?.enabled === void 0 && settings?.versionHistory?.keep === void 0 && settings?.catalog?.html?.enabled !== true && settings?.catalog?.json?.enabled !== true;
488
+ return settings?.documents?.defaultTheme === void 0 && settings?.documents?.outputTemplates === void 0 && settings?.versionHistory?.enabled === void 0 && settings?.versionHistory?.keep === void 0 && settings?.catalog?.html?.enabled !== true && settings?.catalog?.json?.enabled !== true;
455
489
  }
456
490
  function resolveWorkspaceDefaultThemeId(settings) {
457
491
  return settings?.documents?.defaultTheme;
458
492
  }
493
+ function resolveWorkspaceOutputTemplate(settings, format) {
494
+ const templates = settings?.documents?.outputTemplates;
495
+ return format === "html" ? templates?.html : void 0;
496
+ }
459
497
  function resolveFallbackThemeId(frontmatterThemeId, settings) {
460
498
  if (frontmatterThemeId) return void 0;
461
499
  return resolveWorkspaceDefaultThemeId(settings);
@@ -494,7 +532,10 @@ export {
494
532
  WORKSPACE_THEME_ID_PATTERN,
495
533
  CATALOG_SORT_ORDERS,
496
534
  CATALOG_JSON_CONTENT_MODES,
535
+ WORKSPACE_OUTPUT_TEMPLATE_FORMATS,
497
536
  EMPTY_WORKSPACE_SETTINGS,
537
+ validateOutputTemplatePath,
538
+ checkOutputTemplatePath,
498
539
  validateCatalogOutputPath,
499
540
  checkCatalogOutputPath,
500
541
  parseWorkspaceSettings,
@@ -508,6 +549,7 @@ export {
508
549
  tryApplyWorkspaceSettingsPatch,
509
550
  isDefaultWorkspaceSettings,
510
551
  resolveWorkspaceDefaultThemeId,
552
+ resolveWorkspaceOutputTemplate,
511
553
  resolveFallbackThemeId,
512
554
  resolveWorkspaceVersioningEnabled,
513
555
  resolveCatalogOutputs
@@ -125,7 +125,7 @@ function deriveHostCapabilities(host) {
125
125
  aiKnowledgeManagement: isRecord(host.ai) && hasMethod(host.ai.knowledge, "state") && hasMethod(host.ai.knowledge, "update"),
126
126
  aiWorkspaceIndex: hasMethod(host.ai, "ensureWorkspace"),
127
127
  aiSearch: hasMethod(host.ai, "search"),
128
- aiImages: hasMethod(host.ai, "generateImage"),
128
+ aiImages: isRecord(host.ai) && hasMethod(host.ai.images, "generate"),
129
129
  aiTranscription: hasMethod(host.ai, "transcribe"),
130
130
  aiSpeechSynthesis: hasMethod(host.ai, "synthesize"),
131
131
  speechInput: hasMethod(host.speech, "transcribe"),
@@ -434,11 +434,11 @@ function parseAiChatRequest(value) {
434
434
  const messages = [];
435
435
  let totalCharacters = 0;
436
436
  for (const entry of value.messages) {
437
- const message2 = parseAiChatMessage(entry);
438
- if (!message2) return null;
439
- totalCharacters += message2.content.length;
437
+ const message3 = parseAiChatMessage(entry);
438
+ if (!message3) return null;
439
+ totalCharacters += message3.content.length;
440
440
  if (totalCharacters > AI_WIRE_LIMITS.promptCharacters) return null;
441
- messages.push(message2);
441
+ messages.push(message3);
442
442
  }
443
443
  if (value.model !== void 0 && !isBoundedString(value.model, HOST_WIRE_LIMITS.identifierCharacters, 1)) {
444
444
  return null;
@@ -757,6 +757,7 @@ var SPEECH_WIRE_LIMITS = Object.freeze({
757
757
  languageCharacters: 16,
758
758
  transcriptCharacters: 64 * 1024,
759
759
  segmentEntries: 4096,
760
+ segmentWordEntries: 1024,
760
761
  synthesizeTextCharacters: 2e4,
761
762
  chunkPcmBytes: 16 * 1024 * 1024,
762
763
  chunkWordEntries: 1024,
@@ -838,8 +839,11 @@ function parseSpeechModelKind(value) {
838
839
  }
839
840
  function parseSpeechTranscribeRequest(value) {
840
841
  if (!isRecord3(value)) return null;
841
- if (!hasKeysWithin2(value, ["audio", "mimeType"], ["prompt", "language"])) return null;
842
+ if (!hasKeysWithin2(value, ["audio", "mimeType"], ["prompt", "language", "timestamps"])) {
843
+ return null;
844
+ }
842
845
  if (value.mimeType !== "audio/wav") return null;
846
+ if (value.timestamps !== void 0 && typeof value.timestamps !== "boolean") return null;
843
847
  const audio = ownedBuffer(value.audio, SPEECH_WIRE_LIMITS.transcribeAudioBytes);
844
848
  if (!audio || !hasRiffWaveHeader(audio)) return null;
845
849
  if (value.prompt !== void 0 && !isBoundedString(value.prompt, SPEECH_WIRE_LIMITS.promptCharacters)) {
@@ -852,7 +856,8 @@ function parseSpeechTranscribeRequest(value) {
852
856
  audio,
853
857
  mimeType: "audio/wav",
854
858
  ...value.prompt === void 0 ? {} : { prompt: value.prompt },
855
- ...value.language === void 0 ? {} : { language: value.language }
859
+ ...value.language === void 0 ? {} : { language: value.language },
860
+ ...value.timestamps === true ? { timestamps: true } : {}
856
861
  };
857
862
  }
858
863
  function parseSpeechSynthesizeRequest(value) {
@@ -1069,13 +1074,29 @@ function parseSpeechPreferences(value) {
1069
1074
  speed: patch.speed
1070
1075
  };
1071
1076
  }
1072
- function parseSpeechSegment(value) {
1077
+ function parseSpeechWord(value) {
1073
1078
  if (!isRecord3(value) || !hasExactKeys2(value, ["start", "end", "text"])) return null;
1074
1079
  if (!isFiniteInRange2(value.start, 0, SPEECH_WIRE_LIMITS.durationCeiling)) return null;
1075
1080
  if (!isFiniteInRange2(value.end, value.start, SPEECH_WIRE_LIMITS.durationCeiling)) return null;
1076
1081
  if (!isBoundedString(value.text, SPEECH_WIRE_LIMITS.transcriptCharacters)) return null;
1077
1082
  return { start: value.start, end: value.end, text: value.text };
1078
1083
  }
1084
+ function parseSpeechSegment(value) {
1085
+ if (!isRecord3(value) || !hasKeysWithin2(value, ["start", "end", "text"], ["words"])) return null;
1086
+ const timed = parseSpeechWord({ start: value.start, end: value.end, text: value.text });
1087
+ if (!timed) return null;
1088
+ if (value.words === void 0) return timed;
1089
+ if (!Array.isArray(value.words) || value.words.length > SPEECH_WIRE_LIMITS.segmentWordEntries) {
1090
+ return null;
1091
+ }
1092
+ const words = [];
1093
+ for (const entry of value.words) {
1094
+ const word = parseSpeechWord(entry);
1095
+ if (!word) return null;
1096
+ words.push(word);
1097
+ }
1098
+ return { ...timed, words };
1099
+ }
1079
1100
  function parseSpeechTranscript(value) {
1080
1101
  if (!isRecord3(value)) return null;
1081
1102
  if (!hasExactKeys2(value, ["text", "language", "segments", "durationMs"])) return null;
@@ -1301,6 +1322,262 @@ function parseAiKnowledgeState(value) {
1301
1322
  return { catalogs, improvement };
1302
1323
  }
1303
1324
 
1325
+ // src/host/ai-images.ts
1326
+ var AI_IMAGE_ASPECTS = ["1:1", "4:3", "3:4", "16:9", "9:16"];
1327
+ var AI_IMAGE_FIT_VERDICTS = [
1328
+ "fits",
1329
+ "tight",
1330
+ "over-limit",
1331
+ "may-not-run",
1332
+ "wont-run"
1333
+ ];
1334
+ var AI_IMAGE_WIRE_LIMITS = Object.freeze({
1335
+ promptCharacters: 4e3,
1336
+ /** A PNG at the largest size a model renders. */
1337
+ imageBytes: 64 * 1024 * 1024,
1338
+ models: 256,
1339
+ pixels: 16384,
1340
+ verificationCodeCharacters: 16
1341
+ });
1342
+ var PNG_SIGNATURE = [137, 80, 78, 71, 13, 10, 26, 10];
1343
+ function record2(value) {
1344
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1345
+ }
1346
+ function exact2(value, keys) {
1347
+ return Object.keys(value).length === keys.length && keys.every((key) => Object.prototype.hasOwnProperty.call(value, key));
1348
+ }
1349
+ function within(value, required, optional) {
1350
+ const allowed = /* @__PURE__ */ new Set([...required, ...optional]);
1351
+ return required.every((key) => Object.prototype.hasOwnProperty.call(value, key)) && Object.keys(value).every((key) => allowed.has(key));
1352
+ }
1353
+ var label2 = (value) => isBoundedString(value, HOST_WIRE_LIMITS.labelCharacters, 1);
1354
+ var message2 = (value) => isBoundedString(value, HOST_WIRE_LIMITS.messageCharacters);
1355
+ var nullableLabel = (value) => value === null || label2(value);
1356
+ var count2 = (value, maximum = Number.MAX_SAFE_INTEGER) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && value <= maximum;
1357
+ var pixels = (value) => count2(value, AI_IMAGE_WIRE_LIMITS.pixels) && value > 0;
1358
+ function isAiImageModelId(value) {
1359
+ return isBoundedString(value, HOST_WIRE_LIMITS.identifierCharacters, 1);
1360
+ }
1361
+ function isAiImageAspect(value) {
1362
+ return typeof value === "string" && AI_IMAGE_ASPECTS.includes(value);
1363
+ }
1364
+ function parseAiImageAccess(value) {
1365
+ if (!record2(value)) return null;
1366
+ switch (value.kind) {
1367
+ case "ready":
1368
+ case "needs-approval":
1369
+ case "provider-outdated":
1370
+ return exact2(value, ["kind"]) ? { kind: value.kind } : null;
1371
+ case "awaiting-approval":
1372
+ if (!exact2(value, ["kind", "verificationCode"])) return null;
1373
+ if (value.verificationCode !== null && !isBoundedString(value.verificationCode, AI_IMAGE_WIRE_LIMITS.verificationCodeCharacters, 1))
1374
+ return null;
1375
+ return { kind: "awaiting-approval", verificationCode: value.verificationCode };
1376
+ case "unavailable":
1377
+ if (!exact2(value, ["kind", "reason", "message"]) || !message2(value.message)) return null;
1378
+ if (value.reason !== "not-connected" && value.reason !== "no-engine" && value.reason !== "graphics-driver" && value.reason !== "platform")
1379
+ return null;
1380
+ return { kind: "unavailable", reason: value.reason, message: value.message };
1381
+ default:
1382
+ return null;
1383
+ }
1384
+ }
1385
+ var MODEL_KEYS = [
1386
+ "id",
1387
+ "label",
1388
+ "description",
1389
+ "state",
1390
+ "downloadBytes",
1391
+ "shared",
1392
+ "license",
1393
+ "commercialUse",
1394
+ "rendersText",
1395
+ "promptStyle",
1396
+ "hardwareTier",
1397
+ "minRamGb",
1398
+ "fit"
1399
+ ];
1400
+ function parseAiImageModel(value) {
1401
+ if (!record2(value) || !exact2(value, MODEL_KEYS)) return null;
1402
+ if (!isAiImageModelId(value.id) || !label2(value.label)) return null;
1403
+ if (value.description !== null && !message2(value.description)) return null;
1404
+ if (value.state !== "installed" && value.state !== "download-required" && value.state !== "downloading")
1405
+ return null;
1406
+ if (value.downloadBytes !== null && !count2(value.downloadBytes)) return null;
1407
+ if (typeof value.shared !== "boolean" || typeof value.rendersText !== "boolean") return null;
1408
+ if (!nullableLabel(value.license)) return null;
1409
+ if (value.commercialUse !== null && typeof value.commercialUse !== "boolean") return null;
1410
+ if (value.promptStyle !== null && value.promptStyle !== "sentences" && value.promptStyle !== "tags")
1411
+ return null;
1412
+ if (value.hardwareTier !== null && value.hardwareTier !== "low" && value.hardwareTier !== "mid" && value.hardwareTier !== "high" && value.hardwareTier !== "workstation")
1413
+ return null;
1414
+ if (value.minRamGb !== null && !count2(value.minRamGb, 1e6)) return null;
1415
+ let fit = null;
1416
+ if (value.fit !== null) {
1417
+ const raw = value.fit;
1418
+ if (!record2(raw) || !exact2(raw, ["verdict", "reason"]) || typeof raw.verdict !== "string" || !AI_IMAGE_FIT_VERDICTS.includes(raw.verdict) || !message2(raw.reason))
1419
+ return null;
1420
+ fit = { verdict: raw.verdict, reason: raw.reason };
1421
+ }
1422
+ return {
1423
+ id: value.id,
1424
+ label: value.label,
1425
+ description: value.description,
1426
+ state: value.state,
1427
+ downloadBytes: value.downloadBytes,
1428
+ shared: value.shared,
1429
+ license: value.license,
1430
+ commercialUse: value.commercialUse,
1431
+ rendersText: value.rendersText,
1432
+ promptStyle: value.promptStyle,
1433
+ hardwareTier: value.hardwareTier,
1434
+ minRamGb: value.minRamGb,
1435
+ fit
1436
+ };
1437
+ }
1438
+ function parseAiImageModelList(value) {
1439
+ if (!Array.isArray(value) || value.length > AI_IMAGE_WIRE_LIMITS.models) return null;
1440
+ const models = [];
1441
+ const ids = /* @__PURE__ */ new Set();
1442
+ for (const raw of value) {
1443
+ const model = parseAiImageModel(raw);
1444
+ if (!model || ids.has(model.id)) return null;
1445
+ ids.add(model.id);
1446
+ models.push(model);
1447
+ }
1448
+ return models;
1449
+ }
1450
+ function parseAiImagePreferences(value) {
1451
+ if (!record2(value) || !exact2(value, ["model", "designModel", "aspect"])) return null;
1452
+ if (value.model !== null && !isAiImageModelId(value.model)) return null;
1453
+ if (value.designModel !== null && !isAiImageModelId(value.designModel)) return null;
1454
+ if (!isAiImageAspect(value.aspect)) return null;
1455
+ return { model: value.model, designModel: value.designModel, aspect: value.aspect };
1456
+ }
1457
+ function parseAiImagePreferencesPatch(value) {
1458
+ if (!record2(value) || !within(value, [], ["model", "designModel", "aspect"])) return null;
1459
+ const patch = {};
1460
+ if ("model" in value) {
1461
+ if (value.model !== null && !isAiImageModelId(value.model)) return null;
1462
+ patch.model = value.model;
1463
+ }
1464
+ if ("designModel" in value) {
1465
+ if (value.designModel !== null && !isAiImageModelId(value.designModel)) return null;
1466
+ patch.designModel = value.designModel;
1467
+ }
1468
+ if ("aspect" in value) {
1469
+ if (!isAiImageAspect(value.aspect)) return null;
1470
+ patch.aspect = value.aspect;
1471
+ }
1472
+ return patch;
1473
+ }
1474
+ function parseAiImageRequest(value) {
1475
+ if (!record2(value) || !within(value, ["prompt"], ["negativePrompt", "model", "aspect", "seed"]))
1476
+ return null;
1477
+ if (!isBoundedString(value.prompt, AI_IMAGE_WIRE_LIMITS.promptCharacters, 1)) return null;
1478
+ if (!value.prompt.trim()) return null;
1479
+ if (value.negativePrompt !== void 0 && !isBoundedString(value.negativePrompt, AI_IMAGE_WIRE_LIMITS.promptCharacters))
1480
+ return null;
1481
+ if (value.model !== void 0 && !isAiImageModelId(value.model)) return null;
1482
+ if (value.aspect !== void 0 && !isAiImageAspect(value.aspect)) return null;
1483
+ if (value.seed !== void 0 && !count2(value.seed, 2147483647)) return null;
1484
+ return {
1485
+ prompt: value.prompt,
1486
+ ...value.negativePrompt !== void 0 ? { negativePrompt: value.negativePrompt } : {},
1487
+ ...value.model !== void 0 ? { model: value.model } : {},
1488
+ ...value.aspect !== void 0 ? { aspect: value.aspect } : {},
1489
+ ...value.seed !== void 0 ? { seed: value.seed } : {}
1490
+ };
1491
+ }
1492
+ function ownedBuffer2(value, maximumBytes) {
1493
+ if (value instanceof ArrayBuffer) {
1494
+ return value.byteLength <= maximumBytes ? value.slice(0) : null;
1495
+ }
1496
+ if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
1497
+ if (value.byteLength > maximumBytes) return null;
1498
+ const copy = new Uint8Array(value.byteLength);
1499
+ copy.set(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));
1500
+ return copy.buffer;
1501
+ }
1502
+ return null;
1503
+ }
1504
+ function isPng(buffer) {
1505
+ if (buffer.byteLength < 24) return false;
1506
+ const bytes = new Uint8Array(buffer, 0, PNG_SIGNATURE.length);
1507
+ return PNG_SIGNATURE.every((byte, index) => bytes[index] === byte);
1508
+ }
1509
+ function parseAiImageResult(value) {
1510
+ if (!record2(value) || !exact2(value, ["mimeType", "data", "width", "height", "seed", "model", "durationMs"]))
1511
+ return null;
1512
+ if (value.mimeType !== "image/png") return null;
1513
+ const data = ownedBuffer2(value.data, AI_IMAGE_WIRE_LIMITS.imageBytes);
1514
+ if (!data || !isPng(data)) return null;
1515
+ if (!pixels(value.width) || !pixels(value.height)) return null;
1516
+ if (!count2(value.seed) || !count2(value.durationMs) || !isAiImageModelId(value.model)) return null;
1517
+ return {
1518
+ mimeType: "image/png",
1519
+ data,
1520
+ width: value.width,
1521
+ height: value.height,
1522
+ seed: value.seed,
1523
+ model: value.model,
1524
+ durationMs: value.durationMs
1525
+ };
1526
+ }
1527
+ function parseAiImageProgress(value) {
1528
+ if (!record2(value) || !exact2(value, ["phase", "step", "totalSteps", "secondsPerStep"]))
1529
+ return null;
1530
+ if (value.phase !== "queued" && value.phase !== "loading-model" && value.phase !== "sampling" && value.phase !== "decoding")
1531
+ return null;
1532
+ if (!count2(value.step, 1e6) || !count2(value.totalSteps, 1e6)) return null;
1533
+ if (value.secondsPerStep !== null && !(typeof value.secondsPerStep === "number" && Number.isFinite(value.secondsPerStep) && value.secondsPerStep >= 0 && value.secondsPerStep <= 86400))
1534
+ return null;
1535
+ return {
1536
+ phase: value.phase,
1537
+ step: value.step,
1538
+ totalSteps: value.totalSteps,
1539
+ secondsPerStep: value.secondsPerStep
1540
+ };
1541
+ }
1542
+ function parseAiImageEvent(value) {
1543
+ if (!record2(value)) return null;
1544
+ if (value.kind === "progress") {
1545
+ if (!exact2(value, ["kind", "progress"])) return null;
1546
+ const progress = parseAiImageProgress(value.progress);
1547
+ return progress ? { kind: "progress", progress } : null;
1548
+ }
1549
+ if (value.kind === "done") {
1550
+ if (!exact2(value, ["kind", "image"])) return null;
1551
+ const image = parseAiImageResult(value.image);
1552
+ return image ? { kind: "done", image } : null;
1553
+ }
1554
+ if (value.kind === "error") {
1555
+ if (!exact2(value, ["kind", "error"])) return null;
1556
+ const error = parseAiError(value.error);
1557
+ return error ? { kind: "error", error } : null;
1558
+ }
1559
+ return null;
1560
+ }
1561
+ function parseAiImageInstallEvent(value) {
1562
+ if (!record2(value)) return null;
1563
+ if (value.kind === "progress") {
1564
+ if (!exact2(value, ["kind", "progress"])) return null;
1565
+ const progress = parseAiProgress(value.progress);
1566
+ return progress ? { kind: "progress", progress } : null;
1567
+ }
1568
+ if (value.kind === "done") {
1569
+ if (!exact2(value, ["kind", "model"])) return null;
1570
+ const model = parseAiImageModel(value.model);
1571
+ return model ? { kind: "done", model } : null;
1572
+ }
1573
+ if (value.kind === "error") {
1574
+ if (!exact2(value, ["kind", "error"])) return null;
1575
+ const error = parseAiError(value.error);
1576
+ return error ? { kind: "error", error } : null;
1577
+ }
1578
+ return null;
1579
+ }
1580
+
1304
1581
  // src/host/index.ts
1305
1582
  function rawHost() {
1306
1583
  if (typeof globalThis === "undefined") return null;
@@ -1382,6 +1659,20 @@ export {
1382
1659
  ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
1383
1660
  parseAiKnowledgeAction,
1384
1661
  parseAiKnowledgeState,
1662
+ AI_IMAGE_ASPECTS,
1663
+ AI_IMAGE_FIT_VERDICTS,
1664
+ AI_IMAGE_WIRE_LIMITS,
1665
+ isAiImageModelId,
1666
+ isAiImageAspect,
1667
+ parseAiImageAccess,
1668
+ parseAiImageModel,
1669
+ parseAiImageModelList,
1670
+ parseAiImagePreferences,
1671
+ parseAiImagePreferencesPatch,
1672
+ parseAiImageRequest,
1673
+ parseAiImageResult,
1674
+ parseAiImageEvent,
1675
+ parseAiImageInstallEvent,
1385
1676
  hasDocBlocksHost,
1386
1677
  getHostCapabilities,
1387
1678
  hostSupports,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FILE_SYSTEM_TRANSFER_LIMITS,
3
3
  maybeGetDocBlocksHost
4
- } from "./chunk-RFEB4N5Q.js";
4
+ } from "./chunk-WE5W7BRL.js";
5
5
  import {
6
6
  parseFileSystemCapabilities
7
7
  } from "./chunk-245W57QP.js";
@@ -200,6 +200,8 @@ interface DocumentSessionConflict {
200
200
  targetKey: string;
201
201
  localContent: string;
202
202
  localRevision: number;
203
+ /** Wall-clock time of this session's latest local edit, when it made one. */
204
+ localEditedAt?: number;
203
205
  externalContent: string | null;
204
206
  externalVersion: DocumentExternalVersion;
205
207
  }
@@ -287,6 +289,7 @@ declare class DocumentSession {
287
289
  private frozen;
288
290
  private error;
289
291
  private conflict;
292
+ private localEditedAt;
290
293
  private autoSaveTimer;
291
294
  private autoSaveRetryAttempt;
292
295
  private drainPromise;
@@ -9,7 +9,7 @@ import {
9
9
  DocumentSession,
10
10
  DocumentSessionConflictError,
11
11
  createFileSystemDocumentTarget
12
- } from "../chunk-FIEMYP2N.js";
12
+ } from "../chunk-D7VUEVAX.js";
13
13
  import "../chunk-XAMILHQP.js";
14
14
  import "../chunk-IYKGM3PV.js";
15
15
  import "../chunk-UTH3HYCZ.js";
@@ -4,7 +4,7 @@ export { isElectronHost } from '../host/index.js';
4
4
  import '../v2-DwxWjFC0.js';
5
5
  import '../workspace-path-CWVrcuPL.js';
6
6
  import '../filesystem-v2-CXdAPR27.js';
7
- import '../capabilities-D4Z1xYZV.js';
7
+ import '../capabilities-CH66e2pR.js';
8
8
 
9
9
  /** Compatibility entry point retaining the Electron backend's exact guarantees. */
10
10
  declare class ElectronFileSystemProviderV2 extends HostFileSystemProviderV2 {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ElectronFileSystemProvider,
3
3
  ElectronFileSystemProviderV2
4
- } from "../chunk-66WTIYYG.js";
5
- import "../chunk-NECMAJHS.js";
4
+ } from "../chunk-LP6JHGBP.js";
5
+ import "../chunk-ZBRXXOW5.js";
6
6
  import {
7
7
  isElectronHost
8
- } from "../chunk-RFEB4N5Q.js";
8
+ } from "../chunk-WE5W7BRL.js";
9
9
  import "../chunk-245W57QP.js";
10
10
  import "../chunk-V5SWLUZY.js";
11
11
  import "../chunk-73OOROXH.js";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  HostFileSystemProviderV2
3
- } from "../chunk-NECMAJHS.js";
3
+ } from "../chunk-ZBRXXOW5.js";
4
4
  import {
5
5
  ELECTRON_FILE_SYSTEM_V2_CAPABILITIES,
6
6
  maybeGetDocBlocksHost
7
- } from "../chunk-RFEB4N5Q.js";
7
+ } from "../chunk-WE5W7BRL.js";
8
8
  import "../chunk-245W57QP.js";
9
9
  import "../chunk-V5SWLUZY.js";
10
10
  import "../chunk-73OOROXH.js";
@@ -15,7 +15,7 @@ export { ElectronFileSystemProvider, ElectronFileSystemProviderV2 } from './elec
15
15
  export { isElectronHost } from '../host/index.js';
16
16
  import '../host-provider-v2-DEWMPiRD.js';
17
17
  import '../filesystem-v2-CXdAPR27.js';
18
- import '../capabilities-D4Z1xYZV.js';
18
+ import '../capabilities-CH66e2pR.js';
19
19
 
20
20
  /** Immediate article/folder suggestions from an already bounded listing. */
21
21
  declare function suggestWikiArticles(files: readonly {
@@ -14,7 +14,7 @@ import {
14
14
  rewriteCompanionReferences,
15
15
  suggestWikiArticles,
16
16
  wikiArticleExists
17
- } from "../chunk-5VEIEFFC.js";
17
+ } from "../chunk-CI3DHDPG.js";
18
18
  import {
19
19
  MARKDOWN_FILE_EXTENSIONS,
20
20
  SQUISQ_RUNTIME_DIRECTORY_NAME,
@@ -50,11 +50,11 @@ import "../chunk-3GSMJ4MQ.js";
50
50
  import {
51
51
  ElectronFileSystemProvider,
52
52
  ElectronFileSystemProviderV2
53
- } from "../chunk-66WTIYYG.js";
54
- import "../chunk-NECMAJHS.js";
53
+ } from "../chunk-LP6JHGBP.js";
54
+ import "../chunk-ZBRXXOW5.js";
55
55
  import {
56
56
  isElectronHost
57
- } from "../chunk-RFEB4N5Q.js";
57
+ } from "../chunk-WE5W7BRL.js";
58
58
  import "../chunk-245W57QP.js";
59
59
  import "../chunk-V5SWLUZY.js";
60
60
  import "../chunk-73OOROXH.js";
@@ -71,7 +71,7 @@ import {
71
71
  isFileSystemMoveRecoveryError,
72
72
  isFileSystemMoveStateError,
73
73
  isFileSystemPartialMoveError
74
- } from "../chunk-FIEMYP2N.js";
74
+ } from "../chunk-D7VUEVAX.js";
75
75
  import {
76
76
  getFileSystemProviderV2,
77
77
  hasFileSystemProviderV2
@@ -1,5 +1,5 @@
1
- import { a as AiChatEvent, d as AiChatKnowledge, g as AiChatProgress, i as AiChatRequest, l as AiError, n as AiFactCheck, o as AiFactCheckRequest, w as AiModelDownloadInfo, y as AiModelInfo, z as AiModelInstallEvent, C as AiPreferences, D as AiPreferencesPatch, E as AiProgress, N as AiStatus, aA as SpeechAudioChunk, aB as SpeechCatalog, aC as SpeechError, aE as SpeechInstallEvent, aG as SpeechModelInfo, aH as SpeechModelKind, aN as SpeechResult, aI as SpeechPreferences, aJ as SpeechPreferencesPatch, aK as SpeechProgress, aL as SpeechReadiness, aP as SpeechStatus, aR as SpeechSynthesisSummary, aS as SpeechSynthesizeEvent, aT as SpeechSynthesizeRequest, aU as SpeechTranscribeRequest, aV as SpeechTranscript, aW as SpeechVoiceInfo, az as OpenRequest, as as HostPinnedDocument, S as DocBlocksHostAPI, ao as HostCapabilities, aq as HostEnvironment } from '../capabilities-D4Z1xYZV.js';
2
- export { A as AiChatCompletion, b as AiChatEvidence, c as AiChatHandle, e as AiChatKnowledgeSource, f as AiChatMessage, h as AiChatPurpose, j as AiConnectionStep, k as AiEnsureWorkspaceHandle, m as AiErrorCode, p as AiFactCheckSentence, q as AiImageRequest, r as AiImageResult, s as AiKnowledgeAPI, t as AiKnowledgeAction, u as AiKnowledgeCatalog, v as AiKnowledgeState, x as AiModelFit, B as AiModelInstallHandle, F as AiProviderInfo, G as AiResponseFormat, H as AiResult, I as AiReviewMode, J as AiSearchHit, K as AiSearchQuery, L as AiSearchResult, M as AiSpeechAudio, O as AiSynthesizeRequest, P as AiTranscribeRequest, Q as AiTranscript, R as AiUnavailableReason, T as DocBlocksHostAiAPI, U as DocBlocksHostClipboardAPI, V as DocBlocksHostExportAPI, W as DocBlocksHostExternalAPI, X as DocBlocksHostFfmpegAPI, Y as DocBlocksHostFsAPI, Z as DocBlocksHostGitAPI, _ as DocBlocksHostLifecycleAPI, $ as DocBlocksHostMenuAPI, a0 as DocBlocksHostShellAPI, a1 as DocBlocksHostSpeechAPI, a2 as DocBlocksHostUpdaterAPI, a3 as DocBlocksHostWorkspacesAPI, a4 as ElectronWorkspaceInfo, a5 as ExternalBinaryCommitResult, a6 as GitBranchInfo, a7 as GitCapabilities, a8 as GitCloneHandle, a9 as GitCloneProgress, aa as GitError, ab as GitErrorCode, ac as GitFileAtRevision, ad as GitFileChange, ae as GitFileStatusCode, af as GitLogEntry, ag as GitLogOptions, ah as GitRemoteInfo, ai as GitRepoDetection, aj as GitResult, ak as GitRevision, al as GitStatus, am as HOST_PLATFORMS, an as HOST_SURFACE_KINDS, ap as HostCloseReason, ar as HostExportTargetGrant, at as HostPlatform, au as HostPrepareCloseRequest, av as HostPrepareCloseResult, aw as HostSurfaceKind, ax as MenuCommand, ay as NO_HOST_CAPABILITIES, aD as SpeechErrorCode, aF as SpeechInstallHandle, aM as SpeechReadinessState, aO as SpeechSegment, aQ as SpeechSynthesisHandle, aX as SpeechWordTiming, aY as UpdateCheckResult, aZ as UpdateInstallResult, a_ as UpdaterStatus, a$ as deriveHostCapabilities, b0 as parseAiKnowledgeAction, b1 as parseAiKnowledgeState, b2 as parseHostEnvironment } from '../capabilities-D4Z1xYZV.js';
1
+ import { d as AiChatEvent, g as AiChatKnowledge, j as AiChatProgress, l as AiChatRequest, o as AiError, q as AiFactCheck, r as AiFactCheckRequest, O as AiModelDownloadInfo, Q as AiModelInfo, R as AiModelInstallEvent, T as AiPreferences, U as AiPreferencesPatch, V as AiProgress, a2 as AiStatus, aR as SpeechAudioChunk, aS as SpeechCatalog, aT as SpeechError, aV as SpeechInstallEvent, aX as SpeechModelInfo, aY as SpeechModelKind, b2 as SpeechResult, aZ as SpeechPreferences, a_ as SpeechPreferencesPatch, a$ as SpeechProgress, b0 as SpeechReadiness, b4 as SpeechStatus, b6 as SpeechSynthesisSummary, b7 as SpeechSynthesizeEvent, b8 as SpeechSynthesizeRequest, b9 as SpeechTranscribeRequest, ba as SpeechTranscript, bb as SpeechVoiceInfo, aQ as OpenRequest, aJ as HostPinnedDocument, a7 as DocBlocksHostAPI, aF as HostCapabilities, aH as HostEnvironment } from '../capabilities-CH66e2pR.js';
2
+ export { A as AI_IMAGE_ASPECTS, a as AI_IMAGE_FIT_VERDICTS, b as AI_IMAGE_WIRE_LIMITS, c as AiChatCompletion, e as AiChatEvidence, f as AiChatHandle, h as AiChatKnowledgeSource, i as AiChatMessage, k as AiChatPurpose, m as AiConnectionStep, n as AiEnsureWorkspaceHandle, p as AiErrorCode, s as AiFactCheckSentence, t as AiImageAccess, u as AiImageAspect, v as AiImageEvent, w as AiImageHandle, x as AiImageInstallEvent, y as AiImageInstallHandle, z as AiImageModel, B as AiImageModelFit, C as AiImagePhase, D as AiImagePreferences, E as AiImagePreferencesPatch, F as AiImageProgress, G as AiImageRequest, H as AiImageResult, I as AiImageUnavailableReason, J as AiImagesAPI, K as AiKnowledgeAPI, L as AiKnowledgeAction, M as AiKnowledgeCatalog, N as AiKnowledgeState, P as AiModelFit, S as AiModelInstallHandle, W as AiProviderInfo, X as AiResponseFormat, Y as AiResult, Z as AiReviewMode, _ as AiSearchHit, $ as AiSearchQuery, a0 as AiSearchResult, a1 as AiSpeechAudio, a3 as AiSynthesizeRequest, a4 as AiTranscribeRequest, a5 as AiTranscript, a6 as AiUnavailableReason, a8 as DocBlocksHostAiAPI, a9 as DocBlocksHostClipboardAPI, aa as DocBlocksHostExportAPI, ab as DocBlocksHostExternalAPI, ac as DocBlocksHostFfmpegAPI, ad as DocBlocksHostFsAPI, ae as DocBlocksHostGitAPI, af as DocBlocksHostLifecycleAPI, ag as DocBlocksHostMenuAPI, ah as DocBlocksHostShellAPI, ai as DocBlocksHostSpeechAPI, aj as DocBlocksHostUpdaterAPI, ak as DocBlocksHostWorkspacesAPI, al as ElectronWorkspaceInfo, am as ExternalBinaryCommitResult, an as GitBranchInfo, ao as GitCapabilities, ap as GitCloneHandle, aq as GitCloneProgress, ar as GitError, as as GitErrorCode, at as GitFileAtRevision, au as GitFileChange, av as GitFileStatusCode, aw as GitLogEntry, ax as GitLogOptions, ay as GitRemoteInfo, az as GitRepoDetection, aA as GitResult, aB as GitRevision, aC as GitStatus, aD as HOST_PLATFORMS, aE as HOST_SURFACE_KINDS, aG as HostCloseReason, aI as HostExportTargetGrant, aK as HostPlatform, aL as HostPrepareCloseRequest, aM as HostPrepareCloseResult, aN as HostSurfaceKind, aO as MenuCommand, aP as NO_HOST_CAPABILITIES, aU as SpeechErrorCode, aW as SpeechInstallHandle, b1 as SpeechReadinessState, b3 as SpeechSegment, b5 as SpeechSynthesisHandle, bc as SpeechWord, bd as SpeechWordTiming, be as UpdateCheckResult, bf as UpdateInstallResult, bg as UpdaterStatus, bh as deriveHostCapabilities, bi as isAiImageAspect, bj as isAiImageModelId, bk as parseAiImageAccess, bl as parseAiImageEvent, bm as parseAiImageInstallEvent, bn as parseAiImageModel, bo as parseAiImageModelList, bp as parseAiImagePreferences, bq as parseAiImagePreferencesPatch, br as parseAiImageRequest, bs as parseAiImageResult, bt as parseAiKnowledgeAction, bu as parseAiKnowledgeState, bv as parseHostEnvironment } from '../capabilities-CH66e2pR.js';
3
3
  export { D as DocBlocksHostFsV2API, E as ELECTRON_FILE_SYSTEM_V2_CAPABILITIES, F as FILE_SYSTEM_TRANSFER_LIMITS, H as HostFileSystemReadTransfer, a as HostFileSystemV2OpenRequest, b as HostFileSystemV2Result, c as HostFileSystemV2WatchMessage } from '../filesystem-v2-CXdAPR27.js';
4
4
  import '../types-DLteNrK0.js';
5
5
  import '../v2-DwxWjFC0.js';
@@ -87,6 +87,7 @@ declare const SPEECH_WIRE_LIMITS: Readonly<{
87
87
  languageCharacters: 16;
88
88
  transcriptCharacters: number;
89
89
  segmentEntries: 4096;
90
+ segmentWordEntries: 1024;
90
91
  synthesizeTextCharacters: 20000;
91
92
  chunkPcmBytes: number;
92
93
  chunkWordEntries: 1024;