@fangorn-network/westmarch 0.0.7-dev → 0.0.9-dev

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/consume/embed.js CHANGED
@@ -152,12 +152,14 @@ export function packVec(vec) {
152
152
  return btoa(s);
153
153
  }
154
154
 
155
- /** base64 int8 → Float32Array. Returns null on anything malformed — a bad vector
155
+ /** base64 int8 → Float16Array (Float32Array where there is none). Returns null on anything malformed — a bad vector
156
156
  * must degrade that row to lexical, never throw mid-search. */
157
157
  export function unpackVec(b64) {
158
158
  try {
159
159
  const s = atob(b64);
160
- const out = new Float32Array(s.length);
160
+ // Half the memory of Float32 where the browser has it: every row holds one of these, and
161
+ // an int8 source loses nothing at 16 bits. Consumers read plain numbers either way.
162
+ const out = new (globalThis.Float16Array ?? Float32Array)(s.length);
161
163
  for (let i = 0; i < s.length; i++) {
162
164
  const b = s.charCodeAt(i);
163
165
  out[i] = (b > 127 ? b - 256 : b) / 127;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fangorn-network/westmarch",
3
- "version": "0.0.7-dev",
3
+ "version": "0.0.9-dev",
4
4
  "description": "Publisher and consumer surfaces for a Fangorn app: shape a graph, publish it, read it back as a searchable, agent-drivable catalog",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/site/worker.js CHANGED
@@ -94,10 +94,12 @@ export default {
94
94
  const p = url.pathname;
95
95
  if (p === "/.well-known/agent-card.json" || p.startsWith("/view/")) out.headers.set("access-control-allow-origin", "*");
96
96
  if (p.startsWith("/assets/")) out.headers.set("cache-control", "public, max-age=31536000, immutable");
97
- // Shards are content-named, but not forever: a retracted record's shard is deleted, and
98
- // pages.dev's edge cache cannot be purged. An hour bounds how long a deleted one lingers.
97
+ // Shards are content-named, so a reader's browser keeps one for good: a change or a
98
+ // retraction writes new names. `private`: pages.dev's edge cache cannot be purged, so it
99
+ // must never hold one, and a retracted record's shard stops being served when the deploy
100
+ // drops it. (This worker's header wins over _headers, which Pages skips for worker responses.)
99
101
  else if (/^\/view\/cdn\/domains\/[^/]+\/shards\//.test(p))
100
- out.headers.set("cache-control", (res.headers.get("content-type") ?? "").includes("html") ? "no-store" : "public, max-age=3600");
102
+ out.headers.set("cache-control", (res.headers.get("content-type") ?? "").includes("html") ? "no-store" : "private, max-age=31536000, immutable");
101
103
  return out;
102
104
  },
103
105
  };