@ohtaman/washi 0.9.0 → 0.10.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.
Files changed (117) hide show
  1. package/README.md +9 -10
  2. package/THIRD_PARTY_LICENSES.md +4 -4
  3. package/dist/{browser/washi.js → core-b430-tAc.js} +656 -661
  4. package/dist/solvers/browser-_washi-browser-node-runtime-BOEcR5J2.js +28 -0
  5. package/dist/solvers/browser-browser-worker-CT6498Is.js +13 -0
  6. package/dist/{lib/solvers/loader-b5PNpCmX.js → solvers/browser-loader-D21chr4P.js} +12 -23
  7. package/dist/{lib/solvers/loader-DCtyxsfF.js → solvers/browser-loader-DWFhT0yY.js} +13 -13
  8. package/dist/solvers/browser-lp-writer-DH_1sdsF.js +115 -0
  9. package/dist/solvers/glpk.js +310 -0
  10. package/dist/{lib/solvers/glpk.js → solvers/glpk.node.js} +5 -9
  11. package/dist/{lib/solvers/__vite-browser-external-oLchLuMx.js → solvers/highs-browser-__vite-browser-external-Cu-Zq4Hm.js} +1 -1
  12. package/dist/solvers/highs-browser-runtime.js +2410 -0
  13. package/dist/{lib/solvers → solvers}/highs-node-runtime.js +1 -1
  14. package/dist/{lib/solvers → solvers}/highs-worker.js +2 -2
  15. package/dist/{lib/solvers → solvers}/highs.js +64 -70
  16. package/dist/{browser/solvers/highs-loader-Csn3-0tq.js → solvers/highs.node.js} +520 -138
  17. package/dist/solvers/node-browser-worker-CN93BPoO.js +54 -0
  18. package/dist/{lib/solvers/lp-writer-CLScMFbS.js → solvers/node-lp-writer-CqMLgMIk.js} +1 -1
  19. package/dist/solvers/node-node-runtime-BUlNfXvx.js +10 -0
  20. package/dist/solvers/node-registry-CrYRRk9q.js +907 -0
  21. package/dist/solvers/node-types-BGqPkxwu.js +12 -0
  22. package/dist/{lib/solvers → solvers}/pumpkin-node-runtime.js +1 -1
  23. package/dist/{browser/solvers → solvers}/pumpkin-worker.js +2 -1
  24. package/dist/{lib/solvers → solvers}/pumpkin.js +174 -164
  25. package/dist/solvers/pumpkin.node.js +1228 -0
  26. package/dist/{lib/solvers → solvers}/z3.js +123 -120
  27. package/dist/types/core.d.ts +11 -0
  28. package/dist/types/core.d.ts.map +1 -0
  29. package/dist/types/index.d.ts +3 -4
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/modeler/core.d.ts +14 -0
  32. package/dist/types/modeler/core.d.ts.map +1 -0
  33. package/dist/types/modeler/index.d.ts +1 -13
  34. package/dist/types/modeler/index.d.ts.map +1 -1
  35. package/dist/types/modeler/model.d.ts +1 -1
  36. package/dist/types/modeler/model.d.ts.map +1 -1
  37. package/dist/types/modeler/solvers/browser-worker.d.ts +17 -0
  38. package/dist/types/modeler/solvers/browser-worker.d.ts.map +1 -0
  39. package/dist/types/modeler/solvers/glpk/loader.d.ts +2 -2
  40. package/dist/types/modeler/solvers/glpk/node-runtime.d.ts +5 -0
  41. package/dist/types/modeler/solvers/glpk/node-runtime.d.ts.map +1 -0
  42. package/dist/types/modeler/solvers/highs/worker-client.d.ts +5 -5
  43. package/dist/types/modeler/solvers/highs/worker-client.d.ts.map +1 -1
  44. package/dist/types/modeler/solvers/pumpkin/loader.d.ts +0 -4
  45. package/dist/types/modeler/solvers/pumpkin/loader.d.ts.map +1 -1
  46. package/dist/types/modeler/solvers/pumpkin/solver.d.ts.map +1 -1
  47. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts +4 -3
  48. package/dist/types/modeler/solvers/pumpkin/worker-client.d.ts.map +1 -1
  49. package/dist/types/modeler/solvers/types.d.ts +5 -1
  50. package/dist/types/modeler/solvers/types.d.ts.map +1 -1
  51. package/dist/types/modeler/solvers/z3/loader.d.ts +3 -8
  52. package/dist/types/modeler/solvers/z3/loader.d.ts.map +1 -1
  53. package/dist/types/modeler/solvers/z3/solver.d.ts +3 -2
  54. package/dist/types/modeler/solvers/z3/solver.d.ts.map +1 -1
  55. package/dist/types/modeler/types.d.ts +18 -3
  56. package/dist/types/modeler/types.d.ts.map +1 -1
  57. package/dist/washi.js +4 -0
  58. package/dist/washi.min.js +6 -0
  59. package/dist/washi.node.js +4 -0
  60. package/docs/getting-started/ai-agents.md +23 -22
  61. package/docs/getting-started/coding-agents.md +26 -17
  62. package/docs/getting-started/cross-origin.md +2 -1
  63. package/docs/getting-started/index.md +3 -1
  64. package/docs/getting-started/runtimes.md +53 -63
  65. package/docs/guide/objectives.md +3 -3
  66. package/docs/solvers/custom-solver.md +4 -9
  67. package/docs/solvers/glpk.md +2 -0
  68. package/docs/solvers/highs.md +8 -10
  69. package/docs/solvers/index.md +1 -1
  70. package/docs/solvers/pumpkin.md +7 -7
  71. package/docs/solvers/z3.md +18 -1
  72. package/llms-full.txt +124 -118
  73. package/llms.txt +23 -22
  74. package/package.json +31 -64
  75. package/skills/washi/SKILL.md +18 -18
  76. package/skills/washi/references/single-html.md +7 -12
  77. package/dist/browser/solvers/glpk.js +0 -1263
  78. package/dist/browser/solvers/glpk.min.js +0 -1
  79. package/dist/browser/solvers/highs-__vite-browser-external-xcxOpLMD.js +0 -7
  80. package/dist/browser/solvers/highs-browser-runtime-ccRmE4qj.js +0 -2021
  81. package/dist/browser/solvers/highs-worker.js +0 -55
  82. package/dist/browser/solvers/highs.js +0 -1454
  83. package/dist/browser/solvers/pumpkin-_washi-pumpkin-node-runtime-CEKUDK6d.js +0 -9
  84. package/dist/browser/solvers/pumpkin-loader-BI3n3dWO.js +0 -401
  85. package/dist/browser/solvers/pumpkin.js +0 -1796
  86. package/dist/browser/solvers/z3-built.js +0 -8245
  87. package/dist/browser/solvers/z3-built.wasm +0 -4
  88. package/dist/browser/solvers/z3.js +0 -7842
  89. package/dist/browser/solvers/z3.min.js +0 -5
  90. package/dist/browser/washi.min.js +0 -6
  91. package/dist/lib/solvers/highs-browser-runtime.js +0 -2413
  92. package/dist/lib/solvers/highs.wasm +0 -0
  93. package/dist/lib/solvers/highs.wasm.LICENSE +0 -21
  94. package/dist/lib/solvers/pumpkin-worker.js +0 -47
  95. package/dist/lib/solvers/pumpkin.wasm +0 -0
  96. package/dist/lib/solvers/pumpkin.wasm.LICENSE +0 -21
  97. package/dist/lib/solvers/z3-assets.js +0 -1
  98. package/dist/lib/solvers/z3-built.js +0 -8245
  99. package/dist/lib/solvers/z3-built.wasm +0 -4
  100. package/dist/lib/washi.js +0 -5662
  101. package/dist/types/modeler/solvers/z3/assets.d.ts +0 -11
  102. package/dist/types/modeler/solvers/z3/assets.d.ts.map +0 -1
  103. /package/dist/{lib/solvers/embedded-wasm-CSFlLV5N.js → solvers/browser-embedded-wasm-CSFlLV5N.js} +0 -0
  104. /package/dist/{lib/solvers/registry-CrYRRk9q.js → solvers/browser-registry-CrYRRk9q.js} +0 -0
  105. /package/dist/{lib/solvers/types-BGqPkxwu.js → solvers/browser-types-BGqPkxwu.js} +0 -0
  106. /package/dist/{lib/solvers → solvers}/highs-assets.js +0 -0
  107. /package/dist/{lib/solvers/rolldown-runtime-DtPi1Y-2.js → solvers/highs-browser-rolldown-runtime-DtPi1Y-2.js} +0 -0
  108. /package/dist/{browser/solvers → solvers}/highs-inline.js +0 -0
  109. /package/dist/{lib/solvers → solvers}/highs-runtime.js +0 -0
  110. /package/dist/{lib/solvers → solvers}/highs-worker-factory.js +0 -0
  111. /package/dist/{browser/solvers → solvers}/highs.wasm +0 -0
  112. /package/dist/{browser/solvers → solvers}/highs.wasm.LICENSE +0 -0
  113. /package/dist/{lib/solvers → solvers}/pumpkin-assets.js +0 -0
  114. /package/dist/{browser/solvers → solvers}/pumpkin-inline.js +0 -0
  115. /package/dist/{lib/solvers → solvers}/pumpkin-worker-factory.js +0 -0
  116. /package/dist/{browser/solvers → solvers}/pumpkin.wasm +0 -0
  117. /package/dist/{browser/solvers → solvers}/pumpkin.wasm.LICENSE +0 -0
package/llms-full.txt CHANGED
@@ -56,51 +56,52 @@ import "@ohtaman/washi/solvers/glpk";
56
56
 
57
57
  ### Browser ESM & Classic Script Tags
58
58
 
59
- Classic `<script>` tags load immediately invoked function expression (`IIFE`) bundles that attach a global namespace to `window` (optional solver plugins auto-register when `window.Washi` is present). Assuming `dist/browser/` is hosted at `./washi/`:
59
+ Classic `<script>` tags load immediately invoked function expression (`IIFE`) bundles that attach a global namespace to `window` (optional `glpk.js` and `z3-solver` peer plugins use ESM with an Import Map or bundler rather than IIFE binaries). Assuming `dist/` is hosted at `./washi/`:
60
60
 
61
61
  | Solver | Browser ESM (`<script type="module">`) | Classic `<script>` IIFE |
62
62
  | --- | --- | --- |
63
63
  | **Core (HiGHS & Pumpkin)** | `import { Model, expr, maximize } from "./washi/washi.js";` | `<script src="./washi/washi.min.js"></script>` (global `Washi`) |
64
64
  | **HiGHS** *(subpath API)* | `import { HighsSolver, setHighsWasmUrl } from "./washi/solvers/highs.js";` | Bundled in `washi.min.js` (pass `{ wasmUrl }` per call) |
65
- | **HiGHS Inline WASM** *(no `fetch`)* | `import "./washi/solvers/highs-inline.js";` | `<script src="./washi/solvers/highs-inline.js"></script>` (`@ohtaman/washi/browser/solvers/highs-inline`) |
65
+ | **HiGHS Inline WASM** *(no `fetch`)* | `import "./washi/solvers/highs-inline.js";` | `<script src="./washi/solvers/highs-inline.js"></script>` (`@ohtaman/washi/solvers/highs-inline`) |
66
66
  | **Pumpkin** *(subpath API)* | `import { PumpkinSolver, setPumpkinWasmUrl } from "./washi/solvers/pumpkin.js";` | Bundled in `washi.min.js` (pass `{ wasmUrl }` per call) |
67
- | **Pumpkin Inline WASM** *(no `fetch`)* | `import "./washi/solvers/pumpkin-inline.js";` | `<script src="./washi/solvers/pumpkin-inline.js"></script>` (`@ohtaman/washi/browser/solvers/pumpkin-inline`) |
68
- | **GLPK** *(optional)* | `import "./washi/solvers/glpk.js";` | `<script src="./washi/solvers/glpk.min.js"></script>` (`WashiGLPK`) |
69
- | **Z3** *(optional)* | `import "./washi/solvers/z3.js";` | `<script src="./washi/solvers/z3.min.js"></script>` (`WashiZ3`) |
67
+ | **Pumpkin Inline WASM** *(no `fetch`)* | `import "./washi/solvers/pumpkin-inline.js";` | `<script src="./washi/solvers/pumpkin-inline.js"></script>` (`@ohtaman/washi/solvers/pumpkin-inline`) |
68
+ | **GLPK** *(optional peer)* | `import "./washi/solvers/glpk.js";` *(with Import Map for `"glpk.js"`)* | — *(use ESM + Import Map or a bundler)* |
69
+ | **Z3** *(optional peer)* | `import { registerZ3Solver } from "./washi/solvers/z3.js";` *(with Import Map for `"z3-solver"` + `{ z3JsUrl, z3WasmUrl }`)* | — *(use ESM + Import Map or a bundler)* |
70
70
 
71
71
  ### WebAssembly Asset & Runtime Rules
72
72
 
73
73
  #### Bundled WASM & Custom Asset URLs
74
74
 
75
- - **Automatic resolution**: In Node.js and bundler builds, WaSHI resolves `.wasm` assets under `solvers/` relative to the module with no CDN fallback.
76
- - **Browser self-hosting**: Deploy `dist/browser/` intact (entry scripts, `solvers/` runtime/worker/WASM assets, and chunks). Requests that hit missing URLs or HTML SPA fallbacks fail immediately and report the attempted URL.
77
- - **Custom browser URLs**: Call `setHighsWasmUrl(url)` (from `@ohtaman/washi/solvers/highs`) or `setPumpkinWasmUrl(url)` (from `@ohtaman/washi/solvers/pumpkin`), or pass `{ wasmUrl }` to `m.solve()` / `m.check()`. This override is ignored for HiGHS in Node.js, while Pumpkin accepts `file://` URLs in Node.js. For Z3, call `setZ3Assets({ jsUrl, wasmUrl })` (from `@ohtaman/washi/solvers/z3`) or pass `{ z3JsUrl, z3WasmUrl }`.
75
+ - **Automatic resolution**: In Node.js and bundler builds, WaSHI resolves bundled HiGHS and Pumpkin `.wasm` assets under `solvers/` relative to the module with no CDN fallback. Optional `glpk.js` and `z3-solver` (`z3-built.{js,wasm}`) are not bundled in `@ohtaman/washi`.
76
+ - **Browser self-hosting**: Deploy `dist/` intact (entry scripts, `core-*.js` chunks, and `solvers/` runtime/worker/HiGHS+Pumpkin WASM assets). Requests that hit missing URLs or HTML SPA fallbacks fail immediately and report the attempted URL.
77
+ - **Cross-origin ESM vs IIFE**: Cross-origin CDN ESM (`dist/washi.js`) works on callers' threads with default `useWorker: false`, whereas browsers block cross-origin `new Worker(url)` for ESM Workers; use classic `dist/washi.min.js` (or self-host `dist/` same-origin) if you need `{ useWorker: true }`.
78
+ - **Custom browser URLs & Z3 registration**: Call `setHighsWasmUrl(url)` (from `@ohtaman/washi/solvers/highs`) or `setPumpkinWasmUrl(url)` (from `@ohtaman/washi/solvers/pumpkin`), or pass `{ wasmUrl }` to `m.solve()` / `m.check()`. This override is ignored for HiGHS in Node.js, while Pumpkin accepts `file://` URLs in Node.js. For browser **Z3**, configure `registerZ3Solver({ z3JsUrl, z3WasmUrl })` (from `@ohtaman/washi/solvers/z3`, using e.g. `new URL("z3-solver/build/z3-built.*", import.meta.url).href` in Vite/webpack or CDN URLs) or pass `{ z3JsUrl, z3WasmUrl }` per call.
78
79
 
79
80
  #### Fetch-Free Loading in CSP-Restricted Pages (Inline WASM)
80
81
 
81
- - **When `fetch()` is blocked (`connect-src 'none'`)**: Hosted AI sandboxes—including **Claude.ai Artifacts** (edit and published links), **ChatGPT inline visualizations**, and **Codex inline visualizations**—allow CDN scripts (`script-src`) while blocking `fetch()` via `connect-src` and blocking Web Workers via `worker-src`. Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtaman/washi/browser/solvers/highs-inline` and `solvers/pumpkin-inline.js` / `@ohtaman/washi/browser/solvers/pumpkin-inline`) **before** your first `solve()`, `check()`, or `warmup*()` call—zero base64 or binary-setter boilerplate is required.
82
- - **Dual ESM & Classic `<script>` support (prefer ESM)**: Each `*-inline.js` file has no `import`/`export` statements, so the exact same file works via ESM `import` and classic `<script src="...">`, and default loaders (`washi.js`, `washi.min.js`, `dist/lib/*`) never reference it. Prefer **ESM (`<script type="module">`)** in dynamically injected sandboxes (such as ChatGPT inline visualizations), where classic `<script src>` tags can race with inline scripts on cold loads.
82
+ - **When `fetch()` is blocked (`connect-src 'none'`)**: Hosted AI sandboxes—including **Claude.ai Artifacts** (edit and published links), **ChatGPT inline visualizations**, and **Codex inline visualizations**—allow CDN scripts (`script-src`) while blocking `fetch()` via `connect-src`. Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtaman/washi/solvers/highs-inline` and `solvers/pumpkin-inline.js` / `@ohtaman/washi/solvers/pumpkin-inline`) **before** your first `solve()`, `check()`, or `warmup*()` call—zero base64 or binary-setter boilerplate is required.
83
+ - **Dual ESM & Classic `<script>` support (prefer ESM)**: Each `*-inline.js` file has no `import`/`export` statements, so the exact same file works via ESM `import` and classic `<script src="...">`, and default loaders (`washi.js`, `washi.node.js`, `washi.min.js`) never reference it. Prefer **ESM (`<script type="module">`)** in dynamically injected sandboxes (such as ChatGPT inline visualizations), where classic `<script src>` tags can race with inline scripts on cold loads.
83
84
  - **Initialization semantics**: Load the inline pack **before** the first solver initialization (`solve()`, `check()`, or `warmup*()`). Before first initialization, load order between core (`washi.js` / `washi.min.js`) and `*-inline.js` does not matter. Once a solver's default WASM source is selected on first initialization, WaSHI latches it and does not switch on late pack loads (keeping main-thread and Worker behavior consistent). Explicit `set*WasmUrl()` / `{ wasmUrl }` still override the embedded pack when provided.
84
- - **Worker behavior & `useWorker: false` trade-offs**: WaSHI keeps `useWorker: true` as the default on `http(s):` origins (including regular web apps, Gemini Canvas, and Google Sites, where `*-inline.js` transfers embedded bytes via `postMessage` without calling `fetch()`). In Worker-restricted sandboxes (Claude Artifacts, ChatGPT/Codex inline visualizations, or `file://`), pass `{ useWorker: false }` along with a `timeLimit` (main-thread execution blocks UI rendering, prevents immediate mid-solve `AbortSignal` interruption and live `onProgress` repaints, and lacks Worker crash isolation). Embedded previews whose CSP omits `'wasm-unsafe-eval'` (such as Antigravity's HTML artifact preview) cannot compile WebAssembly; open exported HTML in Chrome/Safari or via a local server.
85
+ - **Sandbox notes (`timeLimit`, Workers, & CSP)**: Set a `timeLimit` on main-thread UI solves so long runs do not freeze rendering; if opting into `{ useWorker: true }` on same-origin `http(s):` apps (or via classic `washi.min.js`), `*-inline.js` also transfers embedded bytes via `postMessage` without calling `fetch()`. Embedded previews whose CSP omits `'wasm-unsafe-eval'` (such as Antigravity's HTML artifact preview) cannot compile WebAssembly; open exported HTML in Chrome/Safari or via a local server.
85
86
 
86
87
  ```html
87
- <!-- Recommended: ESM (<script type="module">) + { useWorker: false } -->
88
+ <!-- Recommended: ESM (<script type="module">) -->
88
89
  <!-- Works across Claude Artifacts, ChatGPT/Codex inline visualizations, Gemini Canvas, Google Sites & file:// -->
89
90
  <script type="module">
90
- import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.js";
91
- import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/highs-inline.js";
92
- // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/pumpkin-inline.js";
91
+ import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.js";
92
+ import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/highs-inline.js";
93
+ // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/pumpkin-inline.js";
93
94
 
94
95
  const m = new Model("CspFreeEsm");
95
96
  const x = m.integer("x", { lb: 0 });
96
97
  m.objective(maximize(x));
97
98
  m.constraint(expr`${x} <= 10`, "cap");
98
- await m.solve({ useWorker: false, timeLimit: 5 }); // Omit useWorker: false where Workers are allowed (e.g. Gemini Canvas, self-hosted)
99
+ await m.solve({ timeLimit: 5 }); // Default calling thread works cross-origin; use same-origin ESM or washi.min.js for { useWorker: true }
99
100
  </script>
100
101
 
101
102
  <!-- Classic <script> fallback (prefer ESM above in dynamically injected sandboxes) -->
102
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.min.js"></script>
103
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/highs-inline.js"></script>
103
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.min.js"></script>
104
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/highs-inline.js"></script>
104
105
  <script>
105
106
  (async () => {
106
107
  const { Model, expr, maximize } = Washi;
@@ -108,7 +109,7 @@ Classic `<script>` tags load immediately invoked function expression (`IIFE`) bu
108
109
  const x = m.integer("x", { lb: 0 });
109
110
  m.objective(maximize(x));
110
111
  m.constraint(expr`${x} <= 10`, "cap");
111
- await m.solve({ useWorker: false, timeLimit: 5 });
112
+ await m.solve({ timeLimit: 5 });
112
113
  })();
113
114
  </script>
114
115
  ```
@@ -124,9 +125,9 @@ Classic `<script>` tags load immediately invoked function expression (`IIFE`) bu
124
125
 
125
126
  #### Web Workers & Cancellation (`AbortSignal`)
126
127
 
127
- - **Default Workers**: On standard browser origins (`window.origin !== "null"`), HiGHS and Pumpkin default to Web Workers (`useWorker: true`). On opaque origins (`window.origin === "null"`, such as `file://` pages or sandboxed iframes without `allow-same-origin`), both default to `useWorker: false`.
128
- - **Worker cancellation**: Pre-solve cancellation (`signal.aborted`) works on all solvers, and `{ signal }` terminates in-flight HiGHS and Pumpkin Workers immediately.
129
- - **Main-thread & Node.js cancellation**: HiGHS checks `signal` during `onProgress` callbacks, Pumpkin polls `signal` at search checkpoints, and GLPK/Z3 only check `signal` before starting.
128
+ - **Default Execution (`useWorker: false`)**: HiGHS and Pumpkin run on the calling thread by default in both browsers and Node.js, so `file://`, CSP-restricted environments (`worker-src 'none'`), and sandboxed iframes work without configuration. Pass `{ useWorker: true }` in browser environments to offload interactive UIs or long-running solves to a Web Worker (throws if browser Web Workers are unavailable).
129
+ - **Worker cancellation**: Pre-solve cancellation (`signal.aborted`) works on all solvers, and `{ signal }` with `{ useWorker: true }` terminates in-flight HiGHS and Pumpkin Workers immediately.
130
+ - **Main-thread & Node.js cancellation**: On the default calling thread (`useWorker: false`), HiGHS checks `signal` during `onProgress` callbacks, Pumpkin polls `signal` at search checkpoints, and GLPK/Z3 only check `signal` before starting.
130
131
 
131
132
  #### Solver Capabilities, Options, & Validation Errors
132
133
 
@@ -448,7 +449,7 @@ export function verifyNegativePatterns() {
448
449
 
449
450
  # Introduction & Installation
450
451
 
451
- **WaSHI** (WebAssembly-backed, Solver-independent, High-level modeling Interface) brings Python PuLP-style algebraic modeling to TypeScript and JavaScript. You can write linear, quadratic, and logical expressions with tagged templates (`expr`) and model mathematical optimization and constraint programming problems directly in **Node.js (18+)** and modern browsers.
452
+ **WaSHI** (WebAssembly-backed, Solver-independent, High-level modeling Interface) brings Python PuLP-style algebraic modeling to TypeScript and JavaScript. You can write linear, quadratic, and logical expressions with tagged templates (`expr`) and model mathematical optimization and constraint programming problems directly in **Node.js** and modern browsers.
452
453
 
453
454
  ---
454
455
 
@@ -488,6 +489,8 @@ npm install glpk.js # Optional: GLPK solver (GPL-3.0)
488
489
 
489
490
  In browsers, Z3 requires a Secure Context and Cross-Origin Isolation headers — `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy`, abbreviated `COOP`/`COEP`. See [Cross-Origin Isolation](docs/getting-started/cross-origin.md) for server setup.
490
491
 
492
+ For bundler-free browser or CDN usage (`https://esm.sh/@ohtaman/washi`, `dist/washi.js`, or Gemini Canvas), HiGHS and Pumpkin run out of the box with no extra imports. In `fetch()`-restricted HTML sandboxes (`connect-src 'none'` / `'self'`, such as **Claude.ai Artifacts**, **ChatGPT**, and **Codex**), also load `dist/solvers/highs-inline.js` / `pumpkin-inline.js`—see [Runtime Environments & Deployment](docs/getting-started/runtimes.md#csp-fetch-free).
493
+
491
494
  ---
492
495
 
493
496
  ## 🚀 Quick Start
@@ -544,11 +547,11 @@ WaSHI runs across JavaScript and TypeScript runtimes and deployment targets with
544
547
 
545
548
  | Target Environment | Entry Point | Worker & Header Notes |
546
549
  | --- | --- | --- |
547
- | **Node.js (v18+), Bun, Deno** | `@ohtaman/washi` (`npm:@ohtaman/washi` in Deno) | Loads bundled `.wasm` from disk; no HTTP headers required. |
548
- | **Vite, Next.js, Webpack, Rollup** | `@ohtaman/washi` | Runs HiGHS and Pumpkin in Web Workers by default. |
549
- | **Tauri, Capacitor, PWA** | `@ohtaman/washi` (standard Vite build) | Runs offline; allow `'wasm-unsafe-eval'` in `script-src` and `worker-src 'self' blob:` (or pass `{ useWorker: false }`) in your Content Security Policy (`CSP`). |
550
- | **Browser ESM (`<script type="module">`)** | `dist/browser/washi.js` | Keep all `dist/browser/` files together when self-hosting. |
551
- | **Standalone HTML / CDN (`<script>`)** | `dist/browser/washi.min.js` | Exposes `window.Washi`; CDN builds also run directly on `file://`. |
550
+ | **Node.js, Bun, Deno** | `@ohtaman/washi` (`npm:@ohtaman/washi` in Deno) | Loads bundled `.wasm` from disk; no HTTP headers required. |
551
+ | **Vite, Next.js, Webpack, Rollup** | `@ohtaman/washi` | Runs HiGHS and Pumpkin on the calling thread by default (`useWorker: false`); pass `{ useWorker: true }` to offload solves to a Web Worker. |
552
+ | **Tauri, Capacitor, PWA** | `@ohtaman/washi` (standard Vite build) | Runs offline; allow `'wasm-unsafe-eval'` in `script-src` (and `worker-src 'self' blob:` if opting into `{ useWorker: true }`) in your Content Security Policy (`CSP`). |
553
+ | **Browser ESM (`<script type="module">`)** | `dist/washi.js` | Keep `dist/` files together when self-hosting; use default `useWorker: false` on cross-origin CDNs. |
554
+ | **Standalone HTML / CDN (`<script>`)** | `dist/washi.min.js` | Exposes `window.Washi`; supports cross-origin `{ useWorker: true }` and runs directly on `file://`. |
552
555
 
553
556
  ---
554
557
 
@@ -556,7 +559,7 @@ WaSHI runs across JavaScript and TypeScript runtimes and deployment targets with
556
559
 
557
560
  ### Node.js
558
561
 
559
- WaSHI supports Node.js 18+ with standard ECMAScript Modules (`ESM`). Both bundled WebAssembly engines—HiGHS (default) and Pumpkin (`{ solver: "pumpkin" }`)—load directly from `solvers/` inside the installed package with zero extra imports:
562
+ WaSHI supports Node.js with standard ECMAScript Modules (`ESM`). Both bundled WebAssembly engines—HiGHS (default) and Pumpkin (`{ solver: "pumpkin" }`)—load directly from `solvers/` inside the installed package with zero extra imports:
560
563
 
561
564
  ```typescript
562
565
  import { Model, expr, maximize } from "@ohtaman/washi";
@@ -609,7 +612,7 @@ if (m.hasPrimalSolution) {
609
612
 
610
613
  ### Modern Bundlers & Static Deployment
611
614
 
612
- The package root export (`@ohtaman/washi`) resolves `import` and `default` to `./dist/lib/washi.js` (and `types` to `./dist/types/index.d.ts`). That unified ESM bundle detects Node.js versus browser runtimes automatically at execution time:
615
+ The package root export (`@ohtaman/washi`) resolves `node` to `./dist/washi.node.js`, `default` (browsers and bundlers) to `./dist/washi.js`, and `types` to `./dist/types/index.d.ts`, sharing one deduped core chunk (`dist/core-*.js`) and one set of `.wasm` binaries:
613
616
 
614
617
  ```typescript
615
618
  import { Model, maximize } from "@ohtaman/washi";
@@ -625,31 +628,34 @@ export async function runOptimization() {
625
628
 
626
629
  Because the modeler (JS/TS) and bundled solvers (WebAssembly) execute entirely on the client, static builds from `vite build` deploy directly to **GitHub Pages, Cloudflare Pages, Vercel, or Netlify** without a backend server. HiGHS, Pumpkin, and GLPK need no special HTTP headers; for Z3's browser headers, see **Offline, Intranet & Strict CSP Environments** below.
627
630
 
628
- #### Background Web Worker Execution (Default)
631
+ #### Calling-Thread Default & Optional Web Worker Execution
629
632
 
630
- In browsers, **HiGHS** and **Pumpkin** run inside dedicated Web Workers by default. This keeps the main UI thread responsive during `LP`, `MIP`, `QP`, and `CP` solves while enabling `onProgress` callbacks and `AbortSignal` cancellation.
633
+ In both browsers and Node.js, **HiGHS** and **Pumpkin** default to `useWorker: false` (executing on the calling thread). This lets `LP`, `MIP`, `QP`, and `CP` solves run out of the box under strict CSP (`worker-src 'none'`), `file://`, and sandboxed iframes without Worker setup.
631
634
 
632
- Pass `useWorker: false` if your environment prohibits Web Workers or you prefer main-thread execution:
635
+ Pass `{ useWorker: true }` in interactive browser UIs when you want background Web Worker execution so long solves do not block rendering, UI callbacks repaint live on `onProgress`, and `AbortSignal` can terminate an active solve immediately (throws in Node.js or when browser Web Workers are unavailable). On cross-origin CDN builds, `{ useWorker: true }` automatically bridges Workers with a small ES module `Blob` bootstrap:
633
636
 
634
637
  ```typescript
635
- await m.solve({ useWorker: false });
638
+ await m.solve({ useWorker: true });
636
639
  ```
637
640
 
638
641
  #### Customizing WASM Asset URLs
639
642
 
640
643
  By default, WaSHI resolves `solvers/highs.wasm` and `solvers/pumpkin.wasm` relative to the bundle via `import.meta.url`. It **never** falls back to external CDNs (`jsDelivr`, `unpkg`, etc.).
641
644
 
642
- If your browser host serves `.wasm` files from a custom path, override the URL globally or per call. For HiGHS, `setHighsWasmUrl()` (from `@ohtaman/washi/solvers/highs`) and `{ wasmUrl }` are browser-only (ignored in Node.js); Pumpkin (`setPumpkinWasmUrl()` from `@ohtaman/washi/solvers/pumpkin`) also accepts `file://` URLs in Node.js, and Z3 uses `setZ3Assets()` or `{ z3JsUrl, z3WasmUrl }`:
645
+ If your browser host serves `.wasm` files from a custom path, override the URL globally or per call. For HiGHS, `setHighsWasmUrl()` (from `@ohtaman/washi/solvers/highs`) and `{ wasmUrl }` are browser-only (ignored in Node.js); Pumpkin (`setPumpkinWasmUrl()` from `@ohtaman/washi/solvers/pumpkin`) also accepts `file://` URLs in Node.js. For optional **Z3** (`z3-solver`, unbundled peer), configure `registerZ3Solver({ z3JsUrl, z3WasmUrl })` or pass `{ z3JsUrl, z3WasmUrl }` per call:
643
646
 
644
647
  ```typescript
645
648
  import { setHighsWasmUrl } from "@ohtaman/washi/solvers/highs";
646
649
  import { setPumpkinWasmUrl } from "@ohtaman/washi/solvers/pumpkin";
647
- import { setZ3Assets } from "@ohtaman/washi/solvers/z3"; // Optional Z3 plugin
650
+ import { registerZ3Solver } from "@ohtaman/washi/solvers/z3"; // Optional Z3 plugin
648
651
 
649
652
  // Option A: Configure globally before solving
650
653
  setHighsWasmUrl("/assets/wasm/highs.wasm");
651
654
  setPumpkinWasmUrl("/assets/wasm/pumpkin.wasm");
652
- setZ3Assets({ jsUrl: "/assets/z3/z3-built.js", wasmUrl: "/assets/z3/z3-built.wasm" });
655
+ registerZ3Solver({
656
+ z3JsUrl: new URL("z3-solver/build/z3-built.js", import.meta.url).href,
657
+ z3WasmUrl: new URL("z3-solver/build/z3-built.wasm", import.meta.url).href,
658
+ });
653
659
 
654
660
  // Option B: Configure per solve / check call
655
661
  await m.solve({ wasmUrl: "/assets/wasm/highs.wasm" });
@@ -692,13 +698,13 @@ export default function OptimizerComponent() {
692
698
 
693
699
  Standard Vite frontends bundle **HiGHS** and **Pumpkin** as static assets for offline execution. They run in Tauri (`tauri://localhost` or `http://tauri.localhost`), Capacitor mobile WebViews, and offline PWAs with no native solver build step.
694
700
 
695
- In `tauri.conf.json`, include `'wasm-unsafe-eval'` and `worker-src 'self' blob:` in your `CSP` string. If you run on the main thread with `{ useWorker: false }`, you can omit `worker-src` (see the full CSP table below):
701
+ In `tauri.conf.json`, default calling-thread execution only needs `'wasm-unsafe-eval'` in `script-src` (`worker-src` is unnecessary). Include `worker-src 'self' blob:` if your app opts into `{ useWorker: true }` (see the full CSP table below):
696
702
 
697
703
  ```json
698
704
  {
699
705
  "app": {
700
706
  "security": {
701
- "csp": "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self' blob:"
707
+ "csp": "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'"
702
708
  }
703
709
  }
704
710
  }
@@ -714,11 +720,11 @@ Without a bundler, import the pre-built browser ESM module from your own static
714
720
 
715
721
  ```html
716
722
  <script type="module">
717
- // From an npm CDN (or "./dist/browser/washi.js" when self-hosted; includes HiGHS and Pumpkin):
718
- import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.js";
723
+ // From an npm CDN (or "./dist/washi.js" when self-hosted; includes HiGHS and Pumpkin):
724
+ import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.js";
719
725
  // Optional solver plugins:
720
- // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/glpk.js";
721
- // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/z3.js";
726
+ // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/glpk.js";
727
+ // import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/z3.js";
722
728
 
723
729
  const m = new Model("BrowserESM");
724
730
  const x = m.integer("x", { lb: 0, ub: 100 });
@@ -752,11 +758,8 @@ For single-file HTML pages, CodePen, or JSFiddle, load `washi.min.js` via a clas
752
758
  <h1>WaSHI Browser Optimization</h1>
753
759
  <pre id="output">Solving...</pre>
754
760
 
755
- <!-- Core WaSHI + bundled HiGHS & Pumpkin (MIT) via CDN (or "./dist/browser/washi.min.js" when self-hosted) -->
756
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.min.js"></script>
757
- <!-- Optional plugins (load after washi.min.js; auto-register when window.Washi is present): -->
758
- <!-- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/glpk.min.js"></script> -->
759
- <!-- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/z3.min.js"></script> -->
761
+ <!-- Core WaSHI + bundled HiGHS & Pumpkin (MIT) via CDN (or "./dist/washi.min.js" when self-hosted) -->
762
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.min.js"></script>
760
763
 
761
764
  <script>
762
765
  (async () => {
@@ -783,16 +786,11 @@ For single-file HTML pages, CodePen, or JSFiddle, load `washi.min.js` via a clas
783
786
  </html>
784
787
  ```
785
788
 
786
- ### Cross-Origin CDN Workers
787
-
788
- On standard `http://` and `https://` origins, browsers block direct `new Worker("https://cdn...")` calls. WaSHI automatically bridges cross-origin CDN workers with a small ES module `Blob` bootstrap.
789
-
790
789
  ### Opening Local `.html` Files Directly (`file://`)
791
790
 
792
791
  | Scenario | Behavior & Requirement |
793
792
  | --- | --- |
794
793
  | **CDN scripts** | Loading `washi.min.js` from an HTTPS CDN includes both HiGHS and Pumpkin and works by double-clicking a local `.html` file (`file://`) with no local server. |
795
- | **Opaque origins (`window.origin === "null"`)** | On `file://` pages or sandboxed `<iframe>` embeds without `allow-same-origin`, WaSHI runs HiGHS and Pumpkin on the main thread when `useWorker` is omitted. |
796
794
  | **Self-hosted `.wasm` & Z3** | Local `.wasm` files require `http://` or `https://` because browsers block `fetch()` on `file://`. Z3 also requires Cross-Origin Isolation (see below). |
797
795
  | **Offline single-file HTML + npm libs** | To bundle `@ohtaman/washi` (HiGHS & Pumpkin) alongside third-party npm packages into one zero-network `index.html` for `file://`, follow [`skills/washi/references/single-html.md`](https://github.com/ohtaman/washi/blob/main/skills/washi/references/single-html.md) inside the `washi` Agent Skill. |
798
796
 
@@ -802,38 +800,37 @@ On standard `http://` and `https://` origins, browsers block direct `new Worker(
802
800
 
803
801
  WaSHI never phones home or falls back to public CDNs. To self-host in an air-gapped intranet or under a strict `CSP`, configure three areas:
804
802
 
805
- ### 1. Deploy `dist/browser/` Intact
803
+ ### 1. Deploy `dist/` Intact
806
804
 
807
- Copy `node_modules/@ohtaman/washi/dist/browser/` to your static origin as a complete directory. Even the classic IIFE bundle (`washi.min.js`) spawns `solvers/highs-worker.js` and `solvers/pumpkin-worker.js` as Web Workers by default unless `{ useWorker: false }` is passed. Both the ESM entry points and these worker scripts import hashed `*.js` chunks under `dist/browser/` via relative paths.
805
+ Copy `node_modules/@ohtaman/washi/dist/` to your static origin (keeping `.js` chunks and `solvers/` together). When you opt into `{ useWorker: true }` on same-origin hosting (or cross-origin via classic `washi.min.js`), both ESM bundles and `washi.min.js` spawn `solvers/highs-worker.js` and `solvers/pumpkin-worker.js` as Web Workers, referencing shared chunks under `dist/` and `dist/solvers/` via relative paths. Note that browsers forbid cross-origin module Workers on `dist/washi.js`; keep the default `useWorker: false` for cross-origin CDN ESM or use `dist/washi.min.js` when `{ useWorker: true }` is needed.
808
806
 
809
- | Bundle | Required Files under `dist/browser/` |
807
+ | Bundle | Required Files under `dist/` |
810
808
  | --- | --- |
811
- | **Core** | `washi.js` / `washi.min.js` |
812
- | **Bundled HiGHS** | `solvers/highs.js`, `solvers/highs.wasm`, `solvers/highs-worker.js`, and `solvers/highs-*.js` chunks |
813
- | **Bundled Pumpkin** | `solvers/pumpkin.js`, `solvers/pumpkin.wasm`, `solvers/pumpkin-worker.js`, and `solvers/pumpkin-*.js` chunks |
814
- | **Optional GLPK** | `solvers/glpk.js` / `solvers/glpk.min.js` |
815
- | **Optional Z3** | `solvers/z3.js` / `solvers/z3.min.js`, `solvers/z3-built.js`, `solvers/z3-built.wasm` |
809
+ | **Core** | `washi.js`, `core-*.js` / `washi.min.js` |
810
+ | **Bundled HiGHS** | `solvers/highs.js`, `solvers/highs.wasm`, `solvers/highs-worker.js`, `solvers/highs-*.js`, `core-*.js` |
811
+ | **Bundled Pumpkin** | `solvers/pumpkin.js`, `solvers/pumpkin.wasm`, `solvers/pumpkin-worker.js`, `solvers/pumpkin-*.js`, `core-*.js` |
812
+ | **Optional GLPK** *(unbundled peer)* | `solvers/glpk.js` (requires `glpk.js` resolved via bundler or `<script type="importmap">`) |
813
+ | **Optional Z3** *(unbundled peer)* | `solvers/z3.js` (requires `z3-solver` plus `z3-built.js` & `z3-built.wasm` configured via `registerZ3Solver()`) |
816
814
 
817
815
  ### 2. Configure CSP Directives
818
816
 
819
817
  | Directive | Required Value | Purpose |
820
818
  | --- | --- | --- |
821
819
  | `script-src` | `'wasm-unsafe-eval'` | Allows WebAssembly module compilation. |
822
- | `worker-src` | `'self' blob:` | Allows default Web Workers and CDN `Blob` worker bootstraps. |
823
- | `worker-src` (if `blob:` is disallowed) | `'self'` only | Serve `solvers/highs-worker.js` / `solvers/pumpkin-worker.js` from `'self'`, or pass `{ useWorker: false }`. |
820
+ | `worker-src` *(only if `{ useWorker: true }`)* | `'self' blob:` | Optional: only needed when opting into Web Workers (`'self'` only is sufficient for same-origin hosting; omitted/`'none'` works with default `useWorker: false`). |
824
821
 
825
822
  ### 3. CSP-Restricted Pages Without `fetch()` (`connect-src 'none'`) {#csp-fetch-free}
826
823
 
827
- Hosted AI sandboxes—such as **Claude.ai Artifacts** (both edit views and published share links), **ChatGPT inline visualizations**, and **Codex inline visualizations**—allow scripts from CDNs (`script-src`) while blocking `.wasm` `fetch()` (`connect-src 'none'`) and blocking Web Workers (`worker-src`). In these environments, default HiGHS and Pumpkin initialization fails because they fetch `.wasm` files.
824
+ Hosted AI sandboxes—such as **Claude.ai Artifacts** (both edit views and published share links), **ChatGPT inline visualizations**, and **Codex inline visualizations**—allow scripts from CDNs (`script-src`) while blocking `.wasm` `fetch()` (`connect-src 'none'`). In these environments, default HiGHS and Pumpkin initialization fails because standard bundles fetch `.wasm` files.
828
825
 
829
- Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtaman/washi/browser/solvers/highs-inline` and `solvers/pumpkin-inline.js` / `@ohtaman/washi/browser/solvers/pumpkin-inline`) **before** your first `solve()`, `check()`, or `warmup*()` call—no manual base64 decoding or binary setter calls are required. Each inline pack contains no `import` or `export` statements, so the exact same file works in both ESM and classic `<script>` mode, and default loaders never reference it:
826
+ Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtaman/washi/solvers/highs-inline` and `solvers/pumpkin-inline.js` / `@ohtaman/washi/solvers/pumpkin-inline`) **before** your first `solve()`, `check()`, or `warmup*()` call—no manual base64 decoding or binary setter calls are required. Each inline pack contains no `import` or `export` statements, so the exact same file works in both ESM and classic `<script>` mode, and default loaders never reference it:
830
827
 
831
828
  ```html
832
- <!-- Option A (Recommended): ESM (<script type="module">) + { useWorker: false } -->
829
+ <!-- Option A (Recommended): ESM (<script type="module">) -->
833
830
  <script type="module">
834
- import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.js";
835
- import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/highs-inline.js";
836
- import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/pumpkin-inline.js";
831
+ import { Model, expr, maximize } from "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.js";
832
+ import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/highs-inline.js";
833
+ import "https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/pumpkin-inline.js";
837
834
 
838
835
  const m = new Model("CspFreeExample");
839
836
  const x = m.integer("x", { lb: 0 });
@@ -841,13 +838,13 @@ Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtam
841
838
  m.objective(maximize(expr`30 * ${x} + 50 * ${y}`));
842
839
  m.constraint(expr`${x} + 2 * ${y} <= 40`);
843
840
  m.constraint(expr`2 * ${x} + ${y} <= 50`);
844
- await m.solve({ useWorker: false, timeLimit: 5 }); // Works across all supported AI sandboxes
841
+ await m.solve({ timeLimit: 5 }); // Works across all supported AI sandboxes
845
842
  </script>
846
843
 
847
844
  <!-- Option B: Classic <script> (prefer Option A in dynamically injected sandboxes) -->
848
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/washi.min.js"></script>
849
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/highs-inline.js"></script>
850
- <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/browser/solvers/pumpkin-inline.js"></script>
845
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/washi.min.js"></script>
846
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/highs-inline.js"></script>
847
+ <script src="https://cdn.jsdelivr.net/npm/@ohtaman/washi/dist/solvers/pumpkin-inline.js"></script>
851
848
  <script>
852
849
  (async () => {
853
850
  const { Model, expr, maximize } = Washi;
@@ -857,31 +854,27 @@ Load the self-registering inline WASM packs (`solvers/highs-inline.js` / `@ohtam
857
854
  m.objective(maximize(expr`30 * ${x} + 50 * ${y}`));
858
855
  m.constraint(expr`${x} + 2 * ${y} <= 40`);
859
856
  m.constraint(expr`2 * ${x} + ${y} <= 50`);
860
- await m.solve({ useWorker: false, timeLimit: 5 }); // Zero fetch(), zero Blob URLs, zero Workers
857
+ await m.solve({ timeLimit: 5 }); // Zero fetch(), zero Blob URLs, zero Workers
861
858
  })();
862
859
  </script>
863
860
  ```
864
861
 
865
862
  #### Hosted AI Sandbox Compatibility (Empirically Verified)
866
863
 
867
- | Environment | `fetch(.wasm)` | `*-inline.js` + `{ useWorker: false }` | `useWorker: true` | Recommended Setup |
864
+ | Environment | `fetch(.wasm)` | `*-inline.js` | `{ useWorker: true }` | Recommended Setup |
868
865
  | --- | :---: | :---: | :---: | --- |
869
- | **Claude.ai Artifacts** *(edit & published links)* | Blocked | Works *(ESM & Classic)* | Blocked | Option A (ESM + `*-inline.js` + `{ useWorker: false }`) |
870
- | **ChatGPT Inline Visualization** *(`codex-inline-visualization-*`)* | Blocked | Works *(ESM reliable; Classic can race on cold load)* | Blocked | Option A (ESM + `*-inline.js` + `{ useWorker: false }`) |
871
- | **Codex Inline Visualization** *(`codex-sandbox://...`)* | Blocked | Works *(ESM & Classic)* | Blocked | Option A (ESM + `*-inline.js` + `{ useWorker: false }`) |
872
- | **Gemini Canvas & Google Sites** *(1-click publish)* | Works | Works *(ESM & Classic)* | Works | Option A works everywhere; default `useWorker: true` also works |
866
+ | **Claude.ai Artifacts** *(edit & published links)* | Blocked | Works *(ESM & Classic)* | Blocked | Option A (ESM + `*-inline.js`) |
867
+ | **ChatGPT Inline Visualization** *(`codex-inline-visualization-*`)* | Blocked | Works *(ESM reliable; Classic can race on cold load)* | Blocked | Option A (ESM + `*-inline.js`) |
868
+ | **Codex Inline Visualization** *(`codex-sandbox://...`)* | Blocked | Works *(ESM & Classic)* | Blocked | Option A (ESM + `*-inline.js`) |
869
+ | **Gemini Canvas & Google Sites** *(1-click publish)* | Works | Works *(ESM & Classic)* | Works *(Classic `washi.min.js`)* | Option A works everywhere (default `useWorker: false`); use Option B (`washi.min.js`) for `{ useWorker: true }` |
873
870
  | **Antigravity HTML Artifact Preview** | Blocked *(CDN blocked)* | Blocked *(CSP omits `'wasm-unsafe-eval'`)* | Blocked | Preview via local server + built-in browser or open `.html` in Chrome/Safari |
874
- | **Local Browser `file://`** *(Chrome / Safari)* | Works via HTTPS CDN | Works *(CDN or Vite offline bundle)* | Auto main-thread | CDN Option A or offline [`skills/washi/references/single-html.md`](https://github.com/ohtaman/washi/blob/main/skills/washi/references/single-html.md) |
871
+ | **Local Browser `file://`** *(Chrome / Safari)* | Works via HTTPS CDN | Works *(CDN or Vite offline bundle)* | Blocked | CDN Option A or offline [`skills/washi/references/single-html.md`](https://github.com/ohtaman/washi/blob/main/skills/washi/references/single-html.md) |
875
872
 
876
873
  - **Why prefer Option A (ESM) over Option B (Classic `<script>`)**: Sandboxes that dynamically inject HTML into the DOM (such as ChatGPT inline visualizations) may evaluate inline classic `<script>` blocks before external `<script src>` downloads complete or after `window` `load` has already fired. ESM `<script type="module">` `import` statements strictly wait for all dependencies before executing.
877
874
  - **Initialization semantics**: Load `*-inline.js` before the first solver initialization (`solve()`, `check()`, or `warmup*()`). Load order between core (`washi.js` / `washi.min.js`) and `*-inline.js` does not matter before first initialization. Once a solver's default WASM source is selected on first initialization, WaSHI latches it and ignores late pack registration so main-thread and Worker behavior stay consistent.
878
- - **Web Worker mode**: When `useWorker: true`, WaSHI transfers the embedded bytes once per Worker instance via `postMessage` so Worker startup does not call `fetch()`. If `worker-src` blocks `blob:` or Workers, pass `{ useWorker: false }`.
875
+ - **Web Worker mode**: If you opt into `{ useWorker: true }`, WaSHI transfers the embedded bytes once per Worker instance via `postMessage` so Worker startup does not call `fetch()` (requires `worker-src blob:` or same-origin Workers).
879
876
  - **GLPK & Z3**: **GLPK** (`solvers/glpk.js`) already embeds its WASM inline without `fetch()`. **Z3** requires `SharedArrayBuffer` and Cross-Origin Isolation headers (below).
880
-
881
- > [!TIP]
882
- > **Choosing Between `useWorker: true` and `useWorker: false`**:
883
- > - **Use `useWorker: true` (default on standard `http(s):` origins)** for regular web apps, Vite/Next.js bundles, Gemini Canvas, and Google Sites. Running in a Web Worker keeps the browser UI responsive, allows immediate `AbortSignal` worker termination, supports live `onProgress` UI repaints, and isolates solver crashes.
884
- > - **Use `{ useWorker: false }`** only where Web Workers are disallowed (Claude.ai Artifacts, ChatGPT/Codex inline visualizations, or `file://` pages). Main-thread solving blocks UI painting and user clicks while running, prevents mid-solve `AbortSignal` interruption and live progress updates, and shares the UI thread on crash—so always pass a sensible `timeLimit` (for example, `timeLimit: 5`) and yield a frame before showing a loading spinner.
877
+ - **Main-thread responsiveness**: Set a sensible `timeLimit` (for example, `timeLimit: 5`) and yield a frame before showing a loading spinner for non-trivial main-thread solves; pass `{ useWorker: true }` for slow interactive `http(s):` apps.
885
878
 
886
879
  ### 4. Enable Cross-Origin Isolation (Z3 Only)
887
880
 
@@ -1011,12 +1004,13 @@ On the first visit, the Service Worker registers and reloads the page once so `w
1011
1004
 
1012
1005
  ## Runtime Check in WaSHI
1013
1006
 
1014
- Before initializing Z3 in a browser, WaSHI validates both preconditions in order:
1007
+ Before initializing Z3 in a browser, WaSHI validates these preconditions in order:
1015
1008
 
1016
1009
  | Check | Failure Condition | Result |
1017
1010
  | --- | --- | --- |
1018
1011
  | **Secure Context** | `!window.isSecureContext` and hostname is not `localhost`, `127.0.0.1`, or `[::1]` | `solve()` / `check()` immediately rejects with an HTTPS or `localhost` requirement error. |
1019
1012
  | **Cross-Origin Isolation** | `SharedArrayBuffer` is missing or `window.crossOriginIsolated !== true` | `solve()` / `check()` immediately rejects listing the required `COOP` and `COEP` headers instead of hanging. |
1013
+ | **Browser Asset URLs** | `z3JsUrl` or `z3WasmUrl` not configured via `registerZ3Solver()` or per-call options | `solve()` / `check()` immediately rejects with setup examples for bundlers and CDNs (see [Z3 Solver Guide](docs/solvers/z3.md)). |
1020
1014
 
1021
1015
  ---
1022
1016
 
@@ -1903,7 +1897,7 @@ const status = await m.solve({
1903
1897
  | `presolve` | `"on"` \| `"off"` \| `"choose"` | `"choose"` | Controls solver presolve reduction prior to optimization. |
1904
1898
  | `relax` | `boolean` | `false` | Solves the continuous LP relaxation (equivalent to `m.relax()`); supported on HiGHS and GLPK. |
1905
1899
  | `outputFlag` / `verbose` | `boolean` | `false` | Emits internal solver logs (`outputFlag` for HiGHS, `verbose` for GLPK). |
1906
- | `useWorker` | `boolean` | `true` (browser) / `false` (Node.js) | Runs HiGHS and Pumpkin in a browser Web Worker. Set `false` for main-thread browser runs; omit or set `false` in Node.js (explicit `true` fails). |
1900
+ | `useWorker` | `boolean` | `false` | Runs HiGHS and Pumpkin in a browser Web Worker when `true`. Omit or set `false` for calling-thread execution; `true` throws in Node.js or when browser Web Workers are unavailable. |
1907
1901
  | `wasmUrl` | `string` | Auto-resolved | Custom URL to load `highs.wasm` or `pumpkin.wasm` in browser deployments. |
1908
1902
  | `signal` | `AbortSignal` | `undefined` | Cancellation signal (`AbortController.signal`); see cancellation limitations below. |
1909
1903
  | `onProgress` | `(e: SolveProgressEvent) => void` | `undefined` | Callback receiving live solver progress snapshots. |
@@ -2002,8 +1996,8 @@ console.log("Has incumbent:", m.hasPrimalSolution); // true if an incumbent was
2002
1996
 
2003
1997
  > [!NOTE]
2004
1998
  > **`AbortSignal` Behavior Across Backends**:
2005
- > - **Asynchronous preemptive cancellation**: On HiGHS and Pumpkin inside a browser Web Worker (`useWorker: true`), aborting terminates the worker immediately.
2006
- > - **Cooperative mid-solve cancellation**: On HiGHS and Pumpkin in Node.js or on the browser main thread (`useWorker: false`), aborting inside `onProgress` (and during Pumpkin search checkpoints) stops the active solve cleanly.
1999
+ > - **Asynchronous preemptive cancellation**: On HiGHS and Pumpkin with browser Web Workers (`useWorker: true`), aborting terminates the worker immediately.
2000
+ > - **Cooperative mid-solve cancellation**: By default (`useWorker: false`, Node.js or browser calling thread), aborting inside `onProgress` (and during Pumpkin search checkpoints) stops the active solve cleanly.
2007
2001
  > - **Pre-solve cancellation only**: On GLPK and Z3, `AbortSignal` is checked only before starting a solve.
2008
2002
 
2009
2003
  ### `SolveProgressEvent` Fields
@@ -2945,7 +2939,7 @@ WaSHI uses a pluggable solver architecture. You write a model once with the unif
2945
2939
  | :--- | :--- | :--- | :--- | :--- |
2946
2940
  | **[HiGHS](docs/solvers/highs.md)** | **MIT** | **LP, MIP, Convex QP** (continuous, integer, boolean) | Production optimization, operations research, portfolio QP | **Bundled default** (zero extra deps, no extra import; subpath API: `@ohtaman/washi/solvers/highs`) |
2947
2941
  | **[Pumpkin](docs/solvers/pumpkin.md)** | **MIT** | **CP, Propositional Logic** (bounded integer & boolean only; no `Continuous`) | Non-overlapping scheduling, CP global constraints, discrete `unsatCore` | **Bundled** (`{ solver: "pumpkin" }`, zero extra deps, no extra import; subpath API: `@ohtaman/washi/solvers/pumpkin`) |
2948
- | **[Z3](docs/solvers/z3.md)** (`z3-solver`) | **MIT** | **SMT, SAT, LP/MIP** (continuous, integer, boolean) | Logical rules with continuous variables or decimal coefficients, mixed continuous/integer `unsatCore` diagnosis | **Optional peer** (`@ohtaman/washi/solvers/z3`, requires `z3-solver`); browsers require a Secure Context (`HTTPS`/`localhost`) and `COOP`/`COEP` headers |
2942
+ | **[Z3](docs/solvers/z3.md)** (`z3-solver`) | **MIT** | **SMT, SAT, LP/MIP** (continuous, integer, boolean) | Logical rules with continuous variables or decimal coefficients, mixed continuous/integer `unsatCore` diagnosis | **Optional peer** (`@ohtaman/washi/solvers/z3`, requires `z3-solver`); browsers require a Secure Context (`HTTPS`/`localhost`), `COOP`/`COEP` headers, and `registerZ3Solver({ z3JsUrl, z3WasmUrl })` |
2949
2943
  | **[GLPK](docs/solvers/glpk.md)** (`glpk.js`) | **GPL-3.0** | **LP, MIP** (continuous, integer) | Academic benchmarks, legacy GLPK compatibility | **Optional peer** (`@ohtaman/washi/solvers/glpk`, requires `glpk.js`; note GPL-3.0 license) |
2950
2944
  | **Mock** (`MockSolver`) | **MIT** | *Any* (fixed-response stub) | Fast CI unit tests without loading WebAssembly | **Built-in** (`solver: "mock"` or `new MockSolver(...)`) |
2951
2945
 
@@ -2995,7 +2989,7 @@ See [Conflict Diagnosis, Validation & Debugging](docs/guide/unsat-core.md) for f
2995
2989
 
2996
2990
  **HiGHS** is an open-source mathematical optimization solver started at the University of Edinburgh ([highs.dev](https://highs.dev/) · [ERGO-Code/HiGHS](https://github.com/ERGO-Code/HiGHS)). It solves Linear Programming (LP), Mixed-Integer Programming (MIP), and convex Quadratic Programming (QP) problems.
2997
2991
 
2998
- In `@ohtaman/washi`, HiGHS is the built-in default solver under the MIT license. It ships as a single-threaded WebAssembly binary with zero external dependencies, runs in Node.js and browser Web Workers, and requires no `SharedArrayBuffer` or `COOP`/`COEP` headers (see [Cross-Origin Isolation](docs/getting-started/cross-origin.md)).
2992
+ In `@ohtaman/washi`, HiGHS is the built-in default solver under the MIT license. It ships as a single-threaded WebAssembly binary with zero external dependencies, runs on the calling thread by default in both Node.js and browsers (with optional Web Worker execution via `useWorker: true`), and requires no `SharedArrayBuffer` or `COOP`/`COEP` headers (see [Cross-Origin Isolation](docs/getting-started/cross-origin.md)).
2999
2993
 
3000
2994
  ---
3001
2995
 
@@ -3093,7 +3087,7 @@ Pass execution options into `model.solve()` or the `HighsSolver` constructor. Hi
3093
3087
  | `presolve` | `"on" \| "off" \| "choose"` | Controls model presolve before optimization. |
3094
3088
  | `outputFlag` | `boolean` | Enables internal solver logs (`false` by default). |
3095
3089
  | `relax` | `boolean` | Solves the continuous LP relaxation of a MIP model without modifying variable declarations. |
3096
- | `useWorker` | `boolean` | Runs HiGHS in a browser Web Worker (`true` by default in browsers; falls back to `false` on `file:` URLs or opaque origins). Passing `useWorker: true` in Node.js throws an `Error`. |
3090
+ | `useWorker` | `boolean` | Runs HiGHS in a browser Web Worker when `true` (`false` by default in both browsers and Node.js). Passing `useWorker: true` in Node.js or environments without browser Web Workers throws an `Error`. |
3097
3091
  | `wasmUrl` | `string` | Overrides the `highs.wasm` asset URL for this call (call `setHighsWasmUrl(null)` to reset to the bundled binary). |
3098
3092
  | `signal` | `AbortSignal` | Cancels an in-flight solve. In a browser Web Worker, aborts preemptively and returns the last captured MIP incumbent if available; on the main thread or in Node.js, cancels cooperatively. |
3099
3093
  | `onProgress` | `(ev) => void` | Receives live elapsed time, primal objective, dual bound, and gap updates. |
@@ -3143,9 +3137,7 @@ if (model.hasPrimalSolution) {
3143
3137
 
3144
3138
  ## Web Worker & WASM Configuration in Browsers
3145
3139
 
3146
- In browsers, WaSHI runs HiGHS inside a dedicated Web Worker by default. This keeps UI rendering responsive and allows `onProgress` updates and `AbortSignal` cancellation during long solves.
3147
-
3148
- To run on the main thread (for example, in environments that restrict Web Workers) or serve `highs.wasm` from a custom path, configure `useWorker`, `setHighsWasmUrl`, or `wasmUrl`:
3140
+ In both browsers and Node.js, HiGHS runs on the calling thread by default (`useWorker: false`), so strict CSP (`worker-src 'none'`), `file://`, and sandboxed iframes work without configuration. To offload interactive UIs or long-running solves to a dedicated browser Web Worker (keeping UI rendering responsive and enabling immediate preemptive `AbortSignal` termination), pass `useWorker: true`, or configure `setHighsWasmUrl` / `wasmUrl` to load `highs.wasm` from a custom path:
3149
3141
 
3150
3142
  ```typescript
3151
3143
  import { Model, expr, maximize } from "@ohtaman/washi";
@@ -3158,18 +3150,18 @@ const model = new Model({ solver: "highs" });
3158
3150
  const x = model.continuous("x", { lb: 0, ub: 10 });
3159
3151
  model.objective(maximize(expr`${x}`));
3160
3152
 
3161
- // Option 1: Disable the Web Worker or override wasmUrl per solve call
3162
- await model.solve({ useWorker: false, wasmUrl: "/assets/wasm/highs.wasm" });
3153
+ // Option 1: Enable a browser Web Worker or override wasmUrl per solve call
3154
+ await model.solve({ useWorker: true, wasmUrl: "/assets/wasm/highs.wasm" });
3163
3155
 
3164
3156
  // Option 2: Configure defaults on a HighsSolver instance
3165
- const syncModel = new Model({
3166
- solver: new HighsSolver({ useWorker: false }),
3157
+ const workerModel = new Model({
3158
+ solver: new HighsSolver({ useWorker: true }),
3167
3159
  });
3168
3160
  ```
3169
3161
 
3170
3162
  If `highs.wasm` fails to load or returns an HTML error page, WaSHI throws an error with the attempted URL instead of silently falling back to an external CDN.
3171
3163
 
3172
- For CSP-restricted pages where `fetch()` is blocked (`connect-src 'none'`), load the self-registering inline WASM pack (`@ohtaman/washi/browser/solvers/highs-inline` / `solvers/highs-inline.js`, usable via ESM `import` or a classic `<script>` tag) before the first `solve()` or `warmupHighs()` call—this works in both main-thread and Web Worker mode without `fetch()` (pass `{ useWorker: false }` if Workers/`blob:` are blocked). See [Runtime Environments & Deployment](docs/getting-started/runtimes.md#csp-fetch-free).
3164
+ For CSP-restricted pages where `fetch()` is blocked (`connect-src 'none'`), load the self-registering inline WASM pack (`@ohtaman/washi/solvers/highs-inline` / `solvers/highs-inline.js`, usable via ESM `import` or a classic `<script>` tag) before the first `solve()` or `warmupHighs()` call—this works without `fetch()` (and also works with `{ useWorker: true }` if `worker-src blob:` is permitted). See [Runtime Environments & Deployment](docs/getting-started/runtimes.md#csp-fetch-free).
3173
3165
 
3174
3166
  ---
3175
3167
 
@@ -3288,7 +3280,7 @@ Pass execution options into `model.solve()`, `model.check()`, or `new PumpkinSol
3288
3280
  | Option | Type | Description |
3289
3281
  | :--- | :--- | :--- |
3290
3282
  | `timeLimit` | `number` | Maximum solve or check time in seconds. |
3291
- | `useWorker` | `boolean` | Runs Pumpkin in a browser Web Worker (`true` by default in browsers; falls back to `false` on `file:` URLs or opaque origins). Passing `useWorker: true` in Node.js throws an `Error`. |
3283
+ | `useWorker` | `boolean` | Runs Pumpkin in a browser Web Worker when `true` (`false` by default in both browsers and Node.js). Passing `useWorker: true` in Node.js or environments without browser Web Workers throws an `Error`. |
3292
3284
  | `wasmUrl` | `string \| null` | Overrides the `pumpkin.wasm` asset URL (`null` uses the bundled binary; call `setPumpkinWasmUrl()` to set a global URL). |
3293
3285
  | `signal` | `AbortSignal` | Cancels an in-flight call. In a browser Web Worker, aborts preemptively and preserves the last captured incumbent if available; on the main thread or in Node.js, cancels cooperatively at checkpoints. |
3294
3286
  | `onProgress` | `(ev) => void` | Receives live elapsed time and incumbent objective updates (`solve()` only; ignored by `check()`). |
@@ -3340,9 +3332,9 @@ Pumpkin solves **bounded integer and boolean** models only. Unsupported variable
3340
3332
 
3341
3333
  ## Browser Worker & WASM Hosting
3342
3334
 
3343
- By default in browsers, Pumpkin loads `pumpkin.wasm` inside a dedicated Web Worker. On `file:` URLs or sandboxed iframes without an origin, it falls back to the main thread automatically.
3335
+ In both browsers and Node.js, Pumpkin runs on the calling thread by default (`useWorker: false`), so `file://` URLs, CSP-restricted environments (`worker-src 'none'`), and sandboxed iframes work out of the box.
3344
3336
 
3345
- To force main-thread execution or serve `pumpkin.wasm` from a custom URL:
3337
+ To offload solves to a dedicated browser Web Worker (or serve `pumpkin.wasm` from a custom URL):
3346
3338
 
3347
3339
  ```typescript
3348
3340
  import { Model, expr, minimize } from "@ohtaman/washi";
@@ -3355,16 +3347,16 @@ const model = new Model({ solver: "pumpkin" });
3355
3347
  const x = model.integer("x", { lb: 0, ub: 10 });
3356
3348
  model.objective(minimize(expr`${x}`));
3357
3349
 
3358
- // Option 1: Force main-thread execution for a single call
3359
- await model.solve({ useWorker: false });
3350
+ // Option 1: Opt into browser Web Worker execution for a single call
3351
+ await model.solve({ useWorker: true });
3360
3352
 
3361
3353
  // Option 2: Configure defaults on a PumpkinSolver instance
3362
- const syncModel = new Model({ solver: new PumpkinSolver({ useWorker: false }) });
3354
+ const workerModel = new Model({ solver: new PumpkinSolver({ useWorker: true }) });
3363
3355
  ```
3364
3356
 
3365
3357
  If `pumpkin.wasm` fails to load or returns an HTML fallback page, WaSHI throws an error with the attempted URL instead of silently falling back to a CDN.
3366
3358
 
3367
- For CSP-restricted pages where `fetch()` is blocked (`connect-src 'none'`), load the self-registering inline WASM pack (`@ohtaman/washi/browser/solvers/pumpkin-inline` / `solvers/pumpkin-inline.js`, usable via ESM `import` or a classic `<script>` tag) before the first `solve()`, `check()`, or `warmupPumpkin()` call—this works in both main-thread and Web Worker mode without `fetch()` (pass `{ useWorker: false }` if Workers/`blob:` are blocked). See [Runtime Environments & Deployment](docs/getting-started/runtimes.md#csp-fetch-free).
3359
+ For CSP-restricted pages where `fetch()` is blocked (`connect-src 'none'`), load the self-registering inline WASM pack (`@ohtaman/washi/solvers/pumpkin-inline` / `solvers/pumpkin-inline.js`, usable via ESM `import` or a classic `<script>` tag) before the first `solve()`, `check()`, or `warmupPumpkin()` call—this works without `fetch()` (and also works with `{ useWorker: true }` if `worker-src blob:` is permitted). See [Runtime Environments & Deployment](docs/getting-started/runtimes.md#csp-fetch-free).
3368
3360
 
3369
3361
  ---
3370
3362
 
@@ -3464,7 +3456,7 @@ Z3 validates options strictly and throws a runtime `Error` when unsupported opti
3464
3456
 
3465
3457
  ### Supported Options
3466
3458
 
3467
- - `z3JsUrl` / `z3WasmUrl`: Override browser asset URLs for `z3-built.js` and `z3-built.wasm` (or configure globally with `setZ3Assets()`).
3459
+ - `z3JsUrl` / `z3WasmUrl`: Required in browser environments unless configured via `registerZ3Solver({ z3JsUrl, z3WasmUrl })` (override per call if needed).
3468
3460
  - `signal`: `AbortSignal` checked **before** Z3 starts solving (pre-solve cancellation only; it cannot interrupt an active Z3 call).
3469
3461
  - `onProgress`: Applies to `solve()` only (ignored by `check()`). Invoked once after `solve()` completes with elapsed time and, when a solution exists, the final objective value.
3470
3462
 
@@ -3484,6 +3476,23 @@ In browsers, Z3 uses `SharedArrayBuffer` and Emscripten pthreads. Your page must
3484
3476
 
3485
3477
  1. **Secure Context**: Served over `HTTPS` or `localhost`.
3486
3478
  2. **Cross-Origin Isolation (`COOP`/`COEP`)**: Document responses must send `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp`.
3479
+ 3. **Explicit Asset Registration**: `@ohtaman/washi` does not bundle `z3-solver` or `z3-built.{js,wasm}`. Configure browser asset URLs once via `registerZ3Solver({ z3JsUrl, z3WasmUrl })` (Node.js requires zero configuration):
3480
+
3481
+ ```typescript
3482
+ import { registerZ3Solver } from "@ohtaman/washi/solvers/z3";
3483
+
3484
+ // Bundlers (Vite dev & build, webpack 5 — no optimizeDeps.exclude needed):
3485
+ registerZ3Solver({
3486
+ z3JsUrl: new URL("z3-solver/build/z3-built.js", import.meta.url).href,
3487
+ z3WasmUrl: new URL("z3-solver/build/z3-built.wasm", import.meta.url).href,
3488
+ });
3489
+
3490
+ // Or explicit CDN / self-hosted static URLs (pair with an Import Map for "z3-solver" if not using a bundler):
3491
+ registerZ3Solver({
3492
+ z3JsUrl: "https://cdn.jsdelivr.net/npm/z3-solver/build/z3-built.js",
3493
+ z3WasmUrl: "https://cdn.jsdelivr.net/npm/z3-solver/build/z3-built.wasm",
3494
+ });
3495
+ ```
3487
3496
 
3488
3497
  See the [Cross-Origin Isolation Guide](docs/getting-started/cross-origin.md) for server setup. If you cannot configure these headers and only need bounded integers and booleans, use [Pumpkin](docs/solvers/pumpkin.md) instead.
3489
3498
 
@@ -3555,6 +3564,8 @@ console.log("Objective:", model.objectiveValue); // 40
3555
3564
  console.log("Shadow price:", cap.dual); // 2
3556
3565
  ```
3557
3566
 
3567
+ In Node.js and Vite/webpack bundlers, `import "@ohtaman/washi/solvers/glpk"` resolves `glpk.js` automatically. When loading `dist/solvers/glpk.js` directly in HTML without a bundler, map `"glpk.js"` via `<script type="importmap">` (e.g. `https://cdn.jsdelivr.net/npm/glpk.js/+esm` or `https://esm.sh/glpk.js`).
3568
+
3558
3569
  ---
3559
3570
 
3560
3571
  ## Solver Options & Execution Model
@@ -4096,20 +4107,15 @@ To publish your solver as an independent npm package (such as `@my-org/washi-sol
4096
4107
  "name": "@my-org/washi-solver-cplex",
4097
4108
  "version": "1.0.0",
4098
4109
  "type": "module",
4099
- "main": "./dist/lib/index.js",
4110
+ "main": "./dist/index.js",
4100
4111
  "types": "./dist/types/index.d.ts",
4101
4112
  "exports": {
4102
4113
  ".": {
4103
4114
  "types": "./dist/types/index.d.ts",
4104
- "import": "./dist/lib/index.js",
4105
- "default": "./dist/lib/index.js"
4106
- },
4107
- "./browser": {
4108
- "types": "./dist/types/index.d.ts",
4109
- "import": "./dist/browser/index.js",
4110
- "default": "./dist/browser/index.js"
4115
+ "node": "./dist/index.node.js",
4116
+ "default": "./dist/index.js"
4111
4117
  },
4112
- "./browser/index.min.js": "./dist/browser/index.min.js"
4118
+ "./index.min.js": "./dist/index.min.js"
4113
4119
  },
4114
4120
  "peerDependencies": {
4115
4121
  "@ohtaman/washi": ">=0.8.0"