@lincyaw/workspace 1.0.0-rc.159 → 1.0.0-rc.160

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lincyaw/workspace",
3
- "version": "1.0.0-rc.159",
3
+ "version": "1.0.0-rc.160",
4
4
  "description": "Presmium's workspace service (presmium serve): documents, their history, reviews and the workspace site",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -38,13 +38,13 @@
38
38
  "mime-types": "3.0.2",
39
39
  "playwright-chromium": "1.64.1",
40
40
  "yaml": "^2.9.1",
41
- "@lincyaw/design": "1.0.0-rc.159",
42
- "@lincyaw/kernel": "1.0.0-rc.159",
43
- "@lincyaw/compiler": "1.0.0-rc.159",
44
- "@lincyaw/server": "1.0.0-rc.159"
41
+ "@lincyaw/compiler": "1.0.0-rc.160",
42
+ "@lincyaw/design": "1.0.0-rc.160",
43
+ "@lincyaw/kernel": "1.0.0-rc.160",
44
+ "@lincyaw/server": "1.0.0-rc.160"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/mime-types": "^3.0.1",
48
- "@lincyaw/mcp": "1.0.0-rc.159"
48
+ "@lincyaw/mcp": "1.0.0-rc.160"
49
49
  }
50
50
  }
@@ -146,7 +146,8 @@ export function createDocumentHistory(options: DocumentHistoryOptions): { servic
146
146
  if (content.includes('\0')) throw new RequestError(422, 'history-file-not-utf8-text')
147
147
  const offset = query.offset ?? 0
148
148
  if (offset > content.length || offset > 0 && /[\uD800-\uDBFF]/.test(content[offset - 1]!) && /[\uDC00-\uDFFF]/.test(content[offset] ?? '')) throw new RequestError(400, 'history-offset-invalid')
149
- const reply = (end: number): DocumentHistoryFile => ({ document, revision: query.revision, path, encoding: 'utf8-text-fragment', text: content.slice(offset, end), offset, ...end < content.length ? { nextOffset: end } : {}, totalChars: content.length, complete: end === content.length, sha256: digest(bytes), verification: 'historical-file-only' })
149
+ const sha256 = digest(bytes)
150
+ const reply = (end: number): DocumentHistoryFile => ({ document, revision: query.revision, path, encoding: 'utf8-text-fragment', text: content.slice(offset, end), offset, ...end < content.length ? { nextOffset: end } : {}, totalChars: content.length, complete: end === content.length, sha256, verification: 'historical-file-only' })
150
151
  let low = offset, high = Math.min(content.length, offset + DOCUMENT_HISTORY_MAX_RESPONSE_CHARS)
151
152
  while (low < high) { const middle = Math.ceil((low + high) / 2); if (size(reply(middle)) <= DOCUMENT_HISTORY_MAX_RESPONSE_CHARS) low = middle; else high = middle - 1 }
152
153
  if (low < content.length && low > offset && /[\uD800-\uDBFF]/.test(content[low - 1]!) && /[\uDC00-\uDFFF]/.test(content[low]!)) low--