@stll/folio-cli 0.4.4 → 0.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.
@@ -241,6 +241,11 @@ const acquireEditorLease = async ({ documentPath, owner, txId = `editor-${random
241
241
  now
242
242
  });
243
243
  };
244
+ const surfaceBackgroundError = (error) => {
245
+ queueMicrotask(() => {
246
+ throw error instanceof Error ? error : new Error(String(error));
247
+ });
248
+ };
244
249
  /**
245
250
  * Renew `lease` every `intervalMs` until stopped. When a renewal is refused
246
251
  * (the lease was taken over or expired), renewing stops and `onLost` runs:
@@ -256,7 +261,9 @@ const keepEditorLeaseAlive = (lease, { intervalMs = EDITOR_RENEW_MS, onLost }) =
256
261
  onLost(renewed.error);
257
262
  }
258
263
  };
259
- const timer = setInterval(() => void renew(), intervalMs);
264
+ const timer = setInterval(() => {
265
+ renew().catch(surfaceBackgroundError);
266
+ }, intervalMs);
260
267
  timer.unref();
261
268
  return { stop: () => {
262
269
  stopped = true;
@@ -287,12 +294,14 @@ const watchFlushRequests = ({ documentPath, token, onRequest, pollMs = 100 }) =>
287
294
  }
288
295
  };
289
296
  const watcher = Result.try(() => watch(path.dirname(documentPath), (_event, name) => {
290
- if (name === null || name.startsWith(prefix)) check();
297
+ if (name === null || name.startsWith(prefix)) check().catch(surfaceBackgroundError);
291
298
  }));
292
299
  if (watcher.isOk()) watcher.value.on("error", () => void 0);
293
- const timer = setInterval(() => void check(), pollMs);
300
+ const timer = setInterval(() => {
301
+ check().catch(surfaceBackgroundError);
302
+ }, pollMs);
294
303
  timer.unref();
295
- check();
304
+ check().catch(surfaceBackgroundError);
296
305
  return { close: () => {
297
306
  closed = true;
298
307
  clearInterval(timer);
@@ -219,14 +219,15 @@ const writeRedline = async ({ source, args, options }) => {
219
219
  })
220
220
  });
221
221
  if (redline.isErr()) return Result.err(redline.error);
222
- const { buffer, applied, skipped, unprocessedStories } = redline.value;
222
+ const { buffer, applied, skipped, unprocessedStories, referenceWarnings } = redline.value;
223
223
  return Result.ok({
224
224
  bytes: new Uint8Array(buffer),
225
225
  saveStrategy: "redline",
226
226
  result: {
227
227
  applied: applied.length,
228
228
  skipped,
229
- unprocessedStories
229
+ unprocessedStories,
230
+ referenceWarnings
230
231
  },
231
232
  receipts: [],
232
233
  inputs: { revised: {
package/dist/mcp.js CHANGED
@@ -91,7 +91,7 @@ const envelopeProperties = (tool) => {
91
91
  /** Arguments only the MCP surface takes, beside the registry's. */
92
92
  const MCP_ONLY_PROPERTIES = { read_document: { formatting: {
93
93
  type: "boolean",
94
- description: "Return each block's fields (kind, displayLabel, headingLevel, listLevel, blockTextHash, blockIdSource, tableCell) instead of `[id] text` lines."
94
+ description: "Return each block's fields (kind, displayLabel, headingLevel, paragraph statedNumbering and listReference when applicable, blockTextHash, blockIdSource, tableCell) instead of `[id] text` lines. Diagnostic blocks omit paragraph numbering fields."
95
95
  } } };
96
96
  /** The tool's full MCP input schema: its own arguments plus the file envelope. */
97
97
  const mcpInputSchema = (tool) => {
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.4.4";
2
+ var version = "0.5.0";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stll/folio-cli",
3
- "version": "0.4.4",
3
+ "version": "0.5.0",
4
4
  "description": "Command line and stdio MCP server for reading, reviewing, and redlining .docx files with folio: tracked-change edits, comments, and comparisons written atomically with version preconditions.",
5
5
  "keywords": [
6
6
  "cli",
@@ -57,7 +57,7 @@
57
57
  "build": "rm -rf dist && tsdown",
58
58
  "prepack": "bun run build",
59
59
  "pack:dry-run": "bun pm pack --dry-run",
60
- "typecheck": "bun ../../scripts/tsc-native.ts --noEmit -p tsconfig.build.json",
60
+ "typecheck": "bun check --no-pretty --all --project=tsconfig.build.json",
61
61
  "test": "bun test src"
62
62
  },
63
63
  "dependencies": {
@@ -71,8 +71,8 @@
71
71
  "@fontsource/tinos": "^5.2.7",
72
72
  "@modelcontextprotocol/server": "2.0.0",
73
73
  "@stll/agent-input": "0.1.0",
74
- "@stll/folio-agents": "^0.15.5",
75
- "@stll/folio-core": "^0.58.0",
74
+ "@stll/folio-agents": "^0.16.0",
75
+ "@stll/folio-core": "^0.59.0",
76
76
  "better-result": "3.0.1",
77
77
  "fast-xml-parser": "^5.10.1",
78
78
  "jszip": "3.10.2"