@opencode/schema 0.0.0-dev-21794 → 0.0.0-dev-21795

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 (2) hide show
  1. package/dist/prompt.js +2 -1
  2. package/package.json +1 -1
package/dist/prompt.js CHANGED
@@ -13,7 +13,8 @@ export const FileSource = Schema.Union([
13
13
  ])
14
14
  .pipe(Schema.toTaggedUnion("type"))
15
15
  .annotate({ identifier: "Prompt.FileSource" });
16
- export const Base64 = Schema.String.check(Schema.isPattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u)).annotate({ identifier: "Prompt.Base64" });
16
+ // The canonical pattern backtracks on large inputs, so it only supplies metadata (OpenAPI, errors) while an equivalent linear check runs.
17
+ export const Base64 = Schema.String.check(Schema.makeFilter((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/u.test(value), Schema.isPattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u).annotations)).annotate({ identifier: "Prompt.Base64" });
17
18
  export const FileAttachment = Schema.Struct({
18
19
  data: Base64,
19
20
  mime: Schema.String,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "0.0.0-dev-21794",
4
+ "version": "0.0.0-dev-21795",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {