@somewhere-cloud/cli 0.38.31 → 0.38.32

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.32
4
+
5
+ ### Changed
6
+
7
+ - Typecheck and lint follow live lists to `sw.rooms.live(name, read)`.
8
+ `live()` now lives on `SomewhereRuntimeRooms`, so `sw.db.live` is
9
+ reported as an error, as the platform refuses it. The browser follows a list
10
+ with `watchLive` from `/__sw/rooms/client.js`. The vendored platform
11
+ parser, types, lint, deploy-path policy and repro guidance are re-synced
12
+ with the platform at consumer contract 4 (tech 5145fd90, tsk_8b1197b2).
13
+ - The bundled skills pack is re-synced with the platform: seven skills,
14
+ including `design`, and live lists taught through `sw.rooms.live`.
15
+
3
16
  ## 0.38.31
4
17
 
5
18
  ### Changed
@@ -1,8 +1,8 @@
1
1
  export const BUNDLED_SKILLS_PACK = {
2
2
  "schema": 1,
3
3
  "name": "somewhere-skills",
4
- "version": "1+9dcf2d17607c",
5
- "sha256": "9dcf2d17607c72a8f9a7c8a6abfb839f2874583801b81a9c8a7c85f3b4ef0f74",
4
+ "version": "1+3de6f61d06b1",
5
+ "sha256": "3de6f61d06b1c660fceba8f8ac8f09a6367c5410cbea4ddccd9b6098669cb68d",
6
6
  "files": [
7
7
  {
8
8
  "path": "deploy-verify-loop/SKILL.md",
@@ -26,13 +26,13 @@ export const BUNDLED_SKILLS_PACK = {
26
26
  },
27
27
  {
28
28
  "path": "realtime-and-background/SKILL.md",
29
- "sha256": "57cfe286888621dc49023c155a41f584f87647bc5abfa1f813f590685d90fd28",
30
- "content": "---\nname: realtime-and-background\ndescription: When the page must update without a reload, or work must run outside one request.\n---\n\n# Live views, jobs, queues, cron\n\n## Live view: the page updates when rows change\n\n`sw.db.live(name, sw.db.from(...))` is the live path a signed-in browser can subscribe to.\n\n```ts\n// api/open-notes.ts — the declaration and the SELECT stay server-side\nexport default async function (_req: Request, sw: SomewhereRuntimeContext) {\n return Response.json(await sw.db.live('notes.open', sw.db.from('notes', {\n where: { done: false },\n columns: ['id', 'title', 'done', 'created_at'],\n order: [['created_at', 'desc'], ['id', 'asc']],\n limit: 20,\n })))\n}\n```\n\n## Job: slow work with a status\n\nRun work that shouldn't block a user request in a job. Make handlers idempotent — they may run more than once.\n\n```ts\nconst job = await sw.jobs.create({\n handler: '/api/jobs/summarize-notes',\n idempotency_key: `summary:${user.id}:${operationId}`,\n // user_id comes from the verified session, so the handler can trust it.\n payload: { summary_id: `${user.id}:${operationId}`, user_id: user.id },\n});\n```\n\n```ts\nif (!(await sw.jobs.verifyInvocation(request))) {\n return Response.json({ error: 'forbidden' }, { status: 403 });\n}\n```\n\n## Cron: on a schedule\n\nSchedules run on every plan. The finest granularity is one minute: a 5-field expression has no seconds field.\n\n```js\ncron_create({\n project_id: \"my-app\",\n schedule: \"0 9 * * *\", // 5-field cron expression\n timezone: \"America/Los_Angeles\", // optional; defaults to UTC\n handler: \"/api/jobs/daily-digest\",\n payload: { segment: \"daily\" } // optional\n})\n```\n\n```bash\nsomewhere cron run cleanup --project <project> --wait # run once now and wait for the result (id or name)\n```\n\n## Failure 1: REALTIME_RETIRED (410) or CHANNEL_FORBIDDEN (403)\n\nCaller-named channels are retired. This is not a configuration problem and there is no flag to turn them on.\n\n## Failure 2: CRON_SCHEDULE_TOO_FREQUENT\n\nA schedule tighter than `min_interval_minutes` is refused when you create or edit it, with `CRON_SCHEDULE_TOO_FREQUENT` naming both intervals.\n\nSources (`somewhere docs <topic>`): cron, live, sw.jobs, troubleshooting.\n"
29
+ "sha256": "052f73a08a0fe58cae7ddab2ef85a35f4e0dbf4150db09ce1c76d3cf30d07cd3",
30
+ "content": "---\nname: realtime-and-background\ndescription: When the page must update without a reload, or work must run outside one request.\n---\n\n# Live lists, jobs, cron\n\n## Live list: the page updates when rows change\n\nDeclare the list in a function with `sw.rooms.live(name, sw.db.from(...))` and follow it with `watchLive` from `/__sw/rooms/client.js`.\n\n```ts\n// api/open-notes.ts\nexport default async function (_req: Request, sw: SomewhereRuntimeContext) {\n return Response.json(await sw.rooms.live('notes.open', sw.db.from('notes', {\n where: { done: false },\n columns: ['id', 'title', 'done', 'created_at'],\n order: [['created_at', 'desc'], ['id', 'asc']],\n limit: 20,\n })))\n}\n```\n\n```js\n// browser\nimport { watchLive } from '/__sw/rooms/client.js'\n\nconst stop = watchLive(\n () => fetch('/api/open-notes', { credentials: 'include' }).then((r) => {\n if (!r.ok) throw new Error('Could not load notes (' + r.status + ').')\n return r.json()\n }),\n (rows) => render(rows),\n (err) => showProblem(err.message), // optional; console.error otherwise\n)\n```\n\n## Job: slow work with a status\n\nRun work that shouldn't block a user request in a job. Make handlers idempotent — they may run more than once.\n\n```ts\nconst job = await sw.jobs.create({\n handler: '/api/jobs/summarize-notes',\n idempotency_key: `summary:${user.id}:${operationId}`,\n // user_id comes from the verified session, so the handler can trust it.\n payload: { summary_id: `${user.id}:${operationId}`, user_id: user.id },\n});\n```\n\n```ts\nif (!(await sw.jobs.verifyInvocation(request))) {\n return Response.json({ error: 'forbidden' }, { status: 403 });\n}\n```\n\n## Cron: on a schedule\n\nThe finest granularity is one minute: a 5-field expression has no seconds field.\n\n```js\ncron_create({\n project_id: \"my-app\",\n schedule: \"0 9 * * *\", // 5-field cron expression\n timezone: \"America/Los_Angeles\", // optional; defaults to UTC\n handler: \"/api/jobs/daily-digest\",\n payload: { segment: \"daily\" } // optional\n})\n```\n\n## Failure 1: CRON_SCHEDULE_TOO_FREQUENT\n\nA schedule tighter than `min_interval_minutes` is refused when you create or edit it, with `CRON_SCHEDULE_TOO_FREQUENT` naming both intervals.\n\nSources (`somewhere docs <topic>`): cron, live, sw.jobs.\n"
31
31
  },
32
32
  {
33
33
  "path": "email-and-test-inbox/SKILL.md",
34
- "sha256": "30515eda46f2dcbea1d7f7cb6a9331c48030ed45b8afbaa071e5bf0ff37fdfe5",
35
- "content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts — call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n reply_to: 'support@yourapp.com', // optional\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email people registered with this project (including pending magic-link sign-ins) or the project's owner.\n\n## Test inbox\n\nAddresses `<anything>@<project-subdomain>.test.somewhere.site` never reach a real mailbox. Read it with `somewhere email test-inbox <address>` (or `sw.email.inbox(address)`) → `{ address, messages: [{ id, to, subject, text, html, magic_link, verification_code, created_at }] }`. `verification_code` is the code an auth message carries (the 6-digit email verification or sign-in code), or `null`.\n\n## Failure 1: MANAGED_SENDER_RECIPIENT_NOT_A_USER\n\nOther recipients return `MANAGED_SENDER_RECIPIENT_NOT_A_USER`; verify your own sender domain for outreach.\n\n## Failure 2: gating on status 'sent'\n\nDo not gate follow-up work on `status === 'sent'` alone: a captured test send and a replay of a delivered message are both successful sends.\n\nSources (`somewhere docs <topic>`): sw.email.\n"
34
+ "sha256": "27174b0d8109fa3089a53082192502ac3992e2c933d1a61e0fbdee58c9168b78",
35
+ "content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts — call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email the project's owner and users who have verified their email address with this project; a pending sign-in or an unverified sign-up does not count.\n\n## Test inbox\n\nAddresses `<anything>@<project-subdomain>.test.somewhere.site` never reach a real mailbox. Read it with `somewhere email test-inbox <address>` (or `sw.email.inbox(address)`) → `{ address, messages: [{ id, to, subject, text, html, magic_link, verification_code, created_at }] }`. `verification_code` is the code an auth message carries (the 6-digit email verification or sign-in code), or `null`.\n\n## Failure 1: MANAGED_SENDER_RECIPIENT_NOT_A_USER\n\nOther recipients return `MANAGED_SENDER_RECIPIENT_NOT_A_USER`; verify your own sender domain for outreach.\n\n## Failure 2: gating on status 'sent'\n\nDo not gate follow-up work on `status === 'sent'` alone: a captured test send and a replay of a delivered message are both successful sends.\n\nSources (`somewhere docs <topic>`): sw.email.\n"
36
36
  },
37
37
  {
38
38
  "path": "design/SKILL.md",
@@ -1 +1 @@
1
- {"version":3,"file":"skills-pack.generated.js","sourceRoot":"","sources":["../../src/lib/skills-pack.generated.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,kEAAkE;IAC5E,OAAO,EAAE;QACP;YACE,MAAM,EAAE,6BAA6B;YACrC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,mnEAAmnE;SAC/nE;QACD;YACE,MAAM,EAAE,yBAAyB;YACjC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,22EAA22E;SACv3E;QACD;YACE,MAAM,EAAE,wBAAwB;YAChC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,miGAAmiG;SAC/iG;QACD;YACE,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,s2DAAs2D;SACl3D;QACD;YACE,MAAM,EAAE,kCAAkC;YAC1C,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,yxEAAyxE;SACryE;QACD;YACE,MAAM,EAAE,+BAA+B;YACvC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,k3DAAk3D;SAC93D;QACD;YACE,MAAM,EAAE,iBAAiB;YACzB,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,44FAA44F;SACx5F;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"skills-pack.generated.js","sourceRoot":"","sources":["../../src/lib/skills-pack.generated.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,kBAAkB;IAC1B,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,kEAAkE;IAC5E,OAAO,EAAE;QACP;YACE,MAAM,EAAE,6BAA6B;YACrC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,mnEAAmnE;SAC/nE;QACD;YACE,MAAM,EAAE,yBAAyB;YACjC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,22EAA22E;SACv3E;QACD;YACE,MAAM,EAAE,wBAAwB;YAChC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,miGAAmiG;SAC/iG;QACD;YACE,MAAM,EAAE,0BAA0B;YAClC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,s2DAAs2D;SACl3D;QACD;YACE,MAAM,EAAE,kCAAkC;YAC1C,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,wzEAAwzE;SACp0E;QACD;YACE,MAAM,EAAE,+BAA+B;YACvC,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,82DAA82D;SAC13D;QACD;YACE,MAAM,EAAE,iBAAiB;YACzB,QAAQ,EAAE,kEAAkE;YAC5E,SAAS,EAAE,44FAA44F;SACx5F;KACF;CACF,CAAC"}
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.31",
3
+ "version": "0.38.32",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.31",
9
+ "version": "0.38.32",
10
10
  "bundleDependencies": [
11
11
  "@modelcontextprotocol/sdk",
12
12
  "chokidar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.31",
3
+ "version": "0.38.32",
4
4
  "description": "CLI for somewhere.cloud — auth, projects, deploy, pull, promote, db, logs, env, MCP bridge.",
5
5
  "keywords": [
6
6
  "somewhere",
@@ -6,12 +6,12 @@
6
6
  "shared/d1-session.ts": "2ae29b74bba68016c86d25fa2a58f8c2fce4aca8fe57fafc253d380c47a3c0ab",
7
7
  "shared/types/placeholder-identity.ts": "089a46e2474a21193d3611eddd9c94b6bbe62441b3039ed80fc8499bada447ca",
8
8
  "worker/containers/compile/checker-contract.cjs": "3a8355b9477d89d00bca47cf74032c3b3c6458941cf5c57ddae9e2228b51915d",
9
- "worker/containers/compile/consumer-contract.cjs": "66ca384f1c1a0b4bf6fcd701457121d9b3f622ebe28874e46f100525ee58542a",
9
+ "worker/containers/compile/consumer-contract.cjs": "47475e7f0b74ec556a52f6dfd7136ebe9633d3c9290e5c2ca3ddda1c5fc657d9",
10
10
  "worker/containers/compile/declared-data-contract.cjs": "47ab54cbf6fb20b77e00b2f06e0d283733ee1f3774459f2a6f82c77042c1c93a",
11
11
  "worker/containers/compile/generated-declarations-render.cjs": "7ffdb34645cc9eccac6eba39dc86b646a41c4de8a1a038d2b5b46f42df9f1157",
12
12
  "worker/containers/compile/generated-declarations.cjs": "6e9902e054c5c784fd9b3c3fafc1869e79954100a45014e1132247cd82833ec4",
13
13
  "worker/containers/compile/groups-types.cjs": "7c22b4bb96c9391005d434852600dc02bc8a6bbb99d78d2b8e3eb152f7b72c58",
14
- "worker/containers/compile/runtime-types.cjs": "381ecf0d77e930b7e8bc2ffa6c8cc0ec040139673a7b4ccc38aef17fd39de9ec",
14
+ "worker/containers/compile/runtime-types.cjs": "4aa3d3573913878cf5e2cfbb1053151866411c7684874bce180573efced864c4",
15
15
  "worker/containers/compile/schema-types.cjs": "c62cc074de5da631c44f7da33ad949e3db2d288b2d2d63b2b615c5bc549c7f4a",
16
16
  "worker/containers/compile/typed-data.cjs": "1c8bec853fbee4ffd34c651076a4e1f4d8b18c0c2be5e99e31df7c9283207627",
17
17
  "worker/containers/compile/typed-files.cjs": "a0b1818afbc7673f84583c76436a3b3ca1d1fdf63d8d8db138b36646103f0708",
@@ -43,7 +43,7 @@
43
43
  "worker/src/utils/db-schema-deploy/schema-ownership.ts": "e6c811a87bc657707be3518dfe547c6d97718ac073108b126eb7f791c9c08202",
44
44
  "worker/src/utils/dev-health-class.ts": "fd430f31b9c8469f3d90e118fd8c75d1836ebcf705c1f9e93915ffa53a4cb066",
45
45
  "worker/src/utils/errors.ts": "0583d1381c6275dbfb552d75c4b292247dcfab8f0efe51fd22afb8f516e8d6f4",
46
- "worker/src/utils/event-log.ts": "9e5748c07d1512fd7421727dfc82ca8af7efee5081f15d79dde5d13ffafc9d0c",
46
+ "worker/src/utils/event-log.ts": "75dba8684274f670d1249afec472774b9a55c48c08a0b8b0fa577e9a6c80f72e",
47
47
  "worker/src/utils/feed-kinds.ts": "f5973cbe0337e54294f7d38fc93397adc2ad77110d431a101c5dc1214371e8a1",
48
48
  "worker/src/utils/journey-segment.ts": "b1d27c58bea03a791193d7120d88d232ea1c8374d6f25f72cd86b5b8c33c73a1",
49
49
  "worker/src/utils/json-exact-integers.ts": "e2eb8d3b2e17da363eb14fb46d876208579e2e92bfac173fb27527e6c4fb575e",
@@ -57,5 +57,5 @@
57
57
  "worker/src/utils/telegram-attempt-receipts.ts": "a9ba55ae71f63ada44a105f1ceae04b0491bda0d6e77e5762db2dbecdd2981dd",
58
58
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da"
59
59
  },
60
- "sha256": "9e147be7eca99015a2ab84590f52d6fdaef3c2cf6d96d06b9aa0e919aa46cefb"
60
+ "sha256": "73d74d3226288de4a926def943348271bfb45d404336fa9bba476587af19aa8b"
61
61
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "repository": "Somewhere-Cloud/somewhere-tech",
3
- "commit": "04f14841b86b2b04c2fc8428ee228c93a1a3761a"
3
+ "commit": "5145fd90dcda2663283460370a0fafed72f252fd"
4
4
  }
@@ -26,8 +26,8 @@
26
26
  "worker/src/runtime/billing.ts": "1402812ce082564bb5cb520c99a657f076d356f090e600b1ff7a8bd90bdb4206",
27
27
  "worker/src/runtime/calendar.ts": "483a7e0151b5cff2b0cccadc52da2a32d547c87a565edbbe66d7a2a26b537371",
28
28
  "worker/src/runtime/connect.ts": "45bba4d2f90d3fe5bc60a985dacf459e1132f89fbbcbe369ec2829100acc049a",
29
- "worker/src/runtime/context-head.ts": "7dbd107a0fc96cbf0968fa9b96a5a33182b4d899d53c1e52d2b8b343fa4aae7b",
30
- "worker/src/runtime/context-tail.ts": "3cf2e59cf0a62d9ac9a4b5b526e15f6698a1ba610f0d75e320da499d27b38d6d",
29
+ "worker/src/runtime/context-head.ts": "89c6bafe08a666812a3ac35bcd5c1da7b367a8bdd9677ccc047bb01310d3578c",
30
+ "worker/src/runtime/context-tail.ts": "8fa257b0117e01a7852dc27d5dd6c74064f1161b66353e7fdf4f36d73f30472a",
31
31
  "worker/src/runtime/context.ts": "e3810d92c7c7bab05c12d518b012fcc84523e8aee0f1003a319ca11e8593e409",
32
32
  "worker/src/runtime/cron.ts": "4aac732fe8ce072dec8e3dafaebfc1b48818ec34bb13b388a4f1bb3f184b4383",
33
33
  "worker/src/runtime/crypto.ts": "5c91be24e7da79a8c11f04e06f70158ce89e09940a0918711c656d4cc893915d",
@@ -36,19 +36,19 @@
36
36
  "worker/src/runtime/db-composed-writes.ts": "9c0fb6e8118cddf5dab51a2c5e2250a74097d4515349777d86365400943d0b7b",
37
37
  "worker/src/runtime/db-generated-owner-read.ts": "56c177501f161434a4700150665b2b068dab8106fe34aa068f9b44af0b5df046",
38
38
  "worker/src/runtime/db-intake.ts": "d7b7f4b5865f002c741a06c8214af4e54806295826ab69575ed9c403100f0752",
39
- "worker/src/runtime/db-live-invalidation.ts": "7697afe746de632cf8669dec657e340185e989ec87c76322ff0755f0b5d8b06f",
39
+ "worker/src/runtime/db-live-invalidation.ts": "c59c97b9a6cb1ff466496e8ef3358a0b8451ca64b1820717de7fdb102f35c771",
40
40
  "worker/src/runtime/db-managed.ts": "e434117b5a852bda83ed199ad73a9eacf3409e5028e539e12618f68a58e61461",
41
41
  "worker/src/runtime/db-policy.ts": "51ca5ceba706abfcd2680feeb679a05f885bbfc1f216bed777c4af838ab772d3",
42
42
  "worker/src/runtime/db-public-read.ts": "f63d5599a20d54af83b2337fec58a4aafbc744b77e33d4bd87795d8b2f5cc573",
43
- "worker/src/runtime/db-raw.ts": "9db223a63cc806b3f0ba740cd3dc51d108a887aba8f138f6099803af7e0d51c1",
43
+ "worker/src/runtime/db-raw.ts": "37405137552f543fa6f4ced1d8339d168a5b42692acb0ecc93b471a69952bf3b",
44
44
  "worker/src/runtime/db-relations.ts": "342cfa0da6a9495d29ec81a26d8e342bab6abb7477e586059a4a907674679c94",
45
45
  "worker/src/runtime/db-render-ir.ts": "9163f992462dd23231571da3865bd80ae50f6e6a2ab0cbf8eeee118fdfbc16a7",
46
46
  "worker/src/runtime/db-result-fidelity.ts": "224ae06727afcccd648ed73cffb4216321542e53d2bf7a7212dd0c5d00792f4e",
47
47
  "worker/src/runtime/db-row-links.ts": "af41e679181cb4ecefb2df04f0d8f91f1f23abf50d0594c347fff15d59d4cb66",
48
48
  "worker/src/runtime/db-session-recovery.ts": "7115703aad233f46295915273b05d04f4848ebe05ff1ec0f25f5ce5d298b418e",
49
- "worker/src/runtime/db-structured-execution.ts": "c562aa1cbfdc894af5ea6d064f888b1b08eaa0fdd0a6a3ffdfd132ce78ed7083",
49
+ "worker/src/runtime/db-structured-execution.ts": "9f222d728b1b80621bfa772762c2c2b0b91dd2e290327dc7279aa5f204e5e218",
50
50
  "worker/src/runtime/db-typed-errors.ts": "508f0cc79e85f6722c6696f777f4dfdf6e65ac8ff17157a8ae9b5358377c20b3",
51
- "worker/src/runtime/db.ts": "2cac4792006fa3062c5eac0d1bf829cdb5fc32353d165213be3a834016e222c1",
51
+ "worker/src/runtime/db.ts": "621aaa1351052b87a972b3462eadd2e3054ea54007cc21221b9282d8a3f357a4",
52
52
  "worker/src/runtime/declared-data-read-plan.ts": "6748db1e3449248f7f049382e820e3738eb1d459247f418fd68b7988323e8ff2",
53
53
  "worker/src/runtime/declared-data.ts": "f8d591994626651057bef642ad672d9db3c5e12d714cfbe5e1974e3a53b05841",
54
54
  "worker/src/runtime/declared-files.ts": "18ce00c0e8531167e5ec9d331daffc9651678c2bac467b0bab8c38b1c639a5ca",
@@ -66,7 +66,7 @@
66
66
  "worker/src/runtime/inbox.ts": "ace614a3e25f21c05f19c89526d564dc678f2b6131993963ef29e1ef1a53c154",
67
67
  "worker/src/runtime/jobs.ts": "eeb96f356cdb51dcc72517d43f1d83d461127f2537c4b970bebba70d313979aa",
68
68
  "worker/src/runtime/live-bridge.ts": "2909c5d38625b3ea9d21a10906fe7a503644c9d69f521701fd1cfbed38ea7fd5",
69
- "worker/src/runtime/live-client.ts": "0cdb12b9fdf1662bf9b9c064531dafe6d813fa511b66bfcfaaab6cd4e20d93cd",
69
+ "worker/src/runtime/live-client.ts": "599ac29a849502e00d9941e50e79a74e9ddd83655d9d85d56e3fd75c64ee1fd5",
70
70
  "worker/src/runtime/logs.ts": "0a28e0c3770bcda51a1daa4efdc6af9324568197cf0b3730ee609b376019b265",
71
71
  "worker/src/runtime/managed-intent-wire.ts": "f983c34732c20f98a17cdd2a8087b46dd313f37e1d1ad5fb6771cc6f2a40a6a9",
72
72
  "worker/src/runtime/notifications.ts": "52360bfd5a14d5e588ce00bc2db623da510f9e9fc57b1275d1ea85a2b6117396",
@@ -79,8 +79,8 @@
79
79
  "worker/src/runtime/queue.ts": "8f0bdda9bb857125d42cfbe0a4a50561daca56cc929f17bc91e1d4ba151cc998",
80
80
  "worker/src/runtime/rate-limit.ts": "a63481a2144a46f39228b3e22b2c18df6e4f02d3ae4fac928cd2ee708cc1d1c8",
81
81
  "worker/src/runtime/render.ts": "cbb484f18e410d26fcc87db259e1d10a1b18308405256b6c1a26afc2985707ed",
82
- "worker/src/runtime/rooms-client.ts": "33a1a2406ec0e539014dbbc893f6c0045e2db478936f669ce280b198e98887cf",
83
- "worker/src/runtime/rooms.ts": "de09e890882f0f0a59d8936417191a1df2ec0f02d73cbe99cbb638356c60b240",
82
+ "worker/src/runtime/rooms-client.ts": "c9af172a9f1386c654abc4e30610eed3f0a122b2781556ea3cdfa5735b7e0926",
83
+ "worker/src/runtime/rooms.ts": "081fecc37d0dcf09ee9f25ccf6060a29ade7b273e21225d962c74b9dd004904f",
84
84
  "worker/src/runtime/runtime-console-capture.ts": "db26d6b10dd811fe01ca43405a8a8a6209fb46befae13e2bb1354baeed824fdd",
85
85
  "worker/src/runtime/runtime-log-lifecycle.ts": "2019cb8c7c828528c64efbd0150875acb728c552ee4f3a6dbed75c2b836f97fa",
86
86
  "worker/src/runtime/schema-validator.ts": "052d004a46aa6730f9275d25c1e69d0abbfc4e825741d4ca496a4f2aabb316be",
@@ -88,7 +88,7 @@
88
88
  "worker/src/runtime/storage.ts": "15c7953b994497c7883b774f79ae93bae96e16373a0826cc733d21005de22ad7",
89
89
  "worker/src/runtime/tasks.ts": "75efa2e3083853bfba1dc49745ede8865ddd218b84d568a00da2dbd669f9ab23",
90
90
  "worker/src/runtime/verify-signup.ts": "dcac46b4581794fe875e3f85e3d93a2253b470f60a3c7fcee68543d8be8a6fa1",
91
- "worker/src/runtime/version.ts": "72b2f5a746f08fa0391f690437afbd5b9c01e984391ff695d5d5f4dde474e37b",
91
+ "worker/src/runtime/version.ts": "7e2f4c7b4bbd96d04cf38bc2b12d0ad181a017d045d64a5900de0270b89948c0",
92
92
  "worker/src/runtime/visitor-session.generated.ts": "f788a0c4efe22b18c313d8433150931d48a5f872e3bd98549d94138a5b0dfe5d",
93
93
  "worker/src/runtime/web.ts": "269590d44ffa6239bb6e79999b58ba42435c230f045daea52bf73d09519afb0e",
94
94
  "worker/src/security/browser-secret-scan.ts": "31ebc9dd94eed4d0a9a6b67b3b1e2505d4f7812c557c90337e034c1e3994c039",
@@ -135,12 +135,12 @@
135
135
  "worker/src/utils/endpoint-auth-mode.ts": "101344f5b2595448fce1e5b29a80ec1caf5d2fd3657fd047cf6a04b7df61e792",
136
136
  "worker/src/utils/endpoint-rate-limit.ts": "d22a1d9901200403c30a35ba9325552c7e8ca54b47a2279f63d686b75735e598",
137
137
  "worker/src/utils/errors.ts": "0583d1381c6275dbfb552d75c4b292247dcfab8f0efe51fd22afb8f516e8d6f4",
138
- "worker/src/utils/event-log.ts": "9e5748c07d1512fd7421727dfc82ca8af7efee5081f15d79dde5d13ffafc9d0c",
138
+ "worker/src/utils/event-log.ts": "75dba8684274f670d1249afec472774b9a55c48c08a0b8b0fa577e9a6c80f72e",
139
139
  "worker/src/utils/feed-kinds.ts": "f5973cbe0337e54294f7d38fc93397adc2ad77110d431a101c5dc1214371e8a1",
140
140
  "worker/src/utils/function-bundle-metadata.ts": "f1a3c29046a224c6a8299bae4356c56477433b3bc66a22abf0ddd9a45a63f5e7",
141
141
  "worker/src/utils/function-bundle-postgres.ts": "4afd199c82e98a940a36af01f305080907b6e450f97d894d971a4a6b6a933a9e",
142
142
  "worker/src/utils/function-bundle-transport.ts": "88fa4aafae50cf68178b1a415453d96e8aa31e74aa5791c5ce3e62586642ba78",
143
- "worker/src/utils/function-bundle.ts": "272fab9c430ddc11eabad6f1ea6b5583df022c613b4a74b1e6a4dec3c6566761",
143
+ "worker/src/utils/function-bundle.ts": "c10528b9229f28ff6b6effd6664bc2e8f0c1c114c3d2d3c7a62723b1a22b8114",
144
144
  "worker/src/utils/function-trace-source.ts": "bdffc75e405e0772a693b835c752d4b72fbf491bef3e1e38daa7c8307bd40161",
145
145
  "worker/src/utils/journey-segment.ts": "b1d27c58bea03a791193d7120d88d232ea1c8374d6f25f72cd86b5b8c33c73a1",
146
146
  "worker/src/utils/json-exact-integers.ts": "e2eb8d3b2e17da363eb14fb46d876208579e2e92bfac173fb27527e6c4fb575e",
@@ -161,6 +161,6 @@
161
161
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da",
162
162
  "worker/src/vendor/neondatabase-serverless/source.generated.ts": "96a3c18fde7d8888fdb53a4d7cd0721c238a234521d2084d1e66868a8df8e69c"
163
163
  },
164
- "sha256": "a06f24856820f66a3a5597037fc9a86bf4b4b9f392a1d731bc7bbf7da4a20d0e",
164
+ "sha256": "66a28bcc40a12505bad023a2d9cf20c78a55d58b15e8fb743cba22a972f77c89",
165
165
  "fixtures_sha256": "908827d1430f4af5a83cae59ed476abc51dc9648757eac0089fe6e6db95f66c5"
166
166
  }
@@ -1237,7 +1237,7 @@ interface SomewhereDbAggregateResult<Row = Record<string, unknown>> {
1237
1237
  interface SomewhereDbRawCallerOptions { unscoped?: true | null; asServer?: true | null; user?: never }
1238
1238
  type SomewhereDbLiveState =
1239
1239
  | { name: string; state: 'ready'; release_id?: string; fingerprint: string; subscribe_url: string; expires_at: number }
1240
- | { name: string; state: 'resync_required'; reason: string };
1240
+ | { name: string; state: 'resync_required' | 'unavailable'; reason: string };
1241
1241
  type SomewhereDbLiveResult<Row = Record<string, unknown>> = SomewhereDbResult<Row> & { live: SomewhereDbLiveState };
1242
1242
  type SomewhereDbScopeDeclaration =
1243
1243
  | { intent?: 'scoped' | null; owner_column: string; sensitive_columns?: readonly string[] | null }
@@ -1280,8 +1280,6 @@ interface SomewhereCallerDb {
1280
1280
  query(sql: string, params?: readonly unknown[] | null, options?: SomewhereDbRawCallerOptions | null): Promise<SomewhereDbResult>;
1281
1281
  batch(statements: readonly SomewhereRawDbStatement[], options?: SomewhereDbRawCallerOptions | null): Promise<SomewhereRawBatchResult[]>;
1282
1282
  aggregate<T extends SomewhereDbTable>(table: T, options: SomewhereDbAggregateOptionsFor<T> & { asServer?: true }): Promise<SomewhereDbAggregateResult<SomewhereDbAggregateRow<T>>>;
1283
- // read must be the exact sw.db.from(...) result (or its promise) this release declares under name.
1284
- live<Row>(name: string, read: SomewhereDbResult<Row> | PromiseLike<SomewhereDbResult<Row>>): Promise<SomewhereDbLiveResult<Row>>;
1285
1283
  tables(): Promise<string[]>;
1286
1284
  readonly scope: SomewhereDbScopeApi;
1287
1285
  }
@@ -3847,6 +3845,9 @@ interface SomewhereRoomOps {
3847
3845
  interface SomewhereRuntimeRooms extends SomewhereRoomOps {
3848
3846
  readonly server: SomewhereRoomOps;
3849
3847
  event(req: Request): Promise<SomewhereRoomEvent>;
3848
+ // A live list: read must be the exact sw.db.from(...) result (or its promise) this release
3849
+ // declares under name. Return it from a function; the browser follows it with watchLive.
3850
+ live<Row>(name: string, read: SomewhereDbResult<Row> | PromiseLike<SomewhereDbResult<Row>>): Promise<SomewhereDbLiveResult<Row>>;
3850
3851
  }
3851
3852
 
3852
3853
  interface SomewhereRuntimeContext {
@@ -4406,8 +4407,8 @@ var require_consumer_contract = __commonJS({
4406
4407
  "worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
4407
4408
  "use strict";
4408
4409
  var CONSUMER_CONTRACT2 = Object.freeze({
4409
- version: 3,
4410
- digest: "21c4d644e0ac9a86858201e65ef5a31fe9b8d86e0863af334f539b78904f64e9"
4410
+ version: 4,
4411
+ digest: "ccf5c29211e634d5f41a4a6e2574103d3491e236188aeb53079dbf2842fcc19e"
4411
4412
  });
4412
4413
  var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
4413
4414
  var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
@@ -1667,120 +1667,6 @@ function __sw_runtimeErrorMetadata(error) {
1667
1667
  // worker/src/utils/database-plane-bindings.ts
1668
1668
  var LEGACY_DATABASE_LAYOUT = Object.freeze({ layout: "legacy" });
1669
1669
 
1670
- // worker/src/runtime/live-client.ts
1671
- var LIVE_CLIENT_MODULE_JS = `
1672
- export function watchLive(load, render) {
1673
- if (typeof load !== 'function' || typeof render !== 'function') {
1674
- throw new TypeError('watchLive takes exactly (load, render)');
1675
- }
1676
- let stopped = false;
1677
- let socket = null;
1678
- let socketGeneration = 0;
1679
- let liveKey = null;
1680
- let inFlight = null;
1681
- let dirty = false;
1682
- let reconnectRequested = false;
1683
- let debounceTimer = null;
1684
- let retryTimer = null;
1685
- let retryFailures = 0;
1686
-
1687
- function connect(live) {
1688
- if (!live || live.state !== 'ready' || typeof live.subscribe_url !== 'string') return;
1689
- if (retryTimer !== null) return;
1690
- const nextKey = String(live.release_id) + ':' + String(live.fingerprint);
1691
- const generation = ++socketGeneration;
1692
- if (socket) { try { socket.close(1000, 'refresh'); } catch (_) {} }
1693
- liveKey = nextKey;
1694
- socket = new WebSocket(live.subscribe_url);
1695
- socket.onmessage = function (message) {
1696
- if (stopped || generation !== socketGeneration) return;
1697
- let frame = null;
1698
- try { frame = JSON.parse(message.data); } catch (_) { return; }
1699
- if (frame && frame.type === 'live_control') {
1700
- schedule(frame.event === 'release_changed', 100);
1701
- }
1702
- };
1703
- let failed = false;
1704
- socket.onopen = function () {
1705
- if (stopped || generation !== socketGeneration) return;
1706
- retryFailures = 0;
1707
- if (retryTimer !== null) { clearTimeout(retryTimer); retryTimer = null; }
1708
- };
1709
- function scheduleRetry() {
1710
- if (stopped || generation !== socketGeneration || retryTimer !== null) return;
1711
- const delay = Math.min(500 * Math.pow(2, retryFailures), 30000);
1712
- retryFailures = Math.min(retryFailures + 1, 6);
1713
- retryTimer = setTimeout(function () {
1714
- retryTimer = null;
1715
- if (!stopped && generation === socketGeneration) refresh(true).catch(scheduleRetry);
1716
- }, delay);
1717
- }
1718
- function retry() {
1719
- if (stopped || generation !== socketGeneration || failed) return;
1720
- failed = true;
1721
- scheduleRetry();
1722
- }
1723
- socket.onclose = retry;
1724
- socket.onerror = retry;
1725
- }
1726
-
1727
- function refresh(reconnect) {
1728
- if (stopped) return Promise.resolve(null);
1729
- if (inFlight) {
1730
- dirty = true;
1731
- reconnectRequested = reconnectRequested || reconnect;
1732
- return inFlight;
1733
- }
1734
- inFlight = Promise.resolve().then(load).then(function (snapshot) {
1735
- if (stopped) return snapshot;
1736
- render(snapshot && snapshot.data, snapshot);
1737
- const live = snapshot && snapshot.live;
1738
- const nextKey = live && String(live.release_id) + ':' + String(live.fingerprint);
1739
- if (reconnect || !socket || nextKey !== liveKey) connect(live);
1740
- return snapshot;
1741
- }).finally(function () {
1742
- inFlight = null;
1743
- if (dirty && !stopped) {
1744
- const reconnectAfter = reconnectRequested;
1745
- dirty = false;
1746
- reconnectRequested = false;
1747
- schedule(reconnectAfter, 0);
1748
- }
1749
- });
1750
- return inFlight;
1751
- }
1752
-
1753
- function schedule(reconnect, delay) {
1754
- if (stopped) return;
1755
- reconnectRequested = reconnectRequested || reconnect;
1756
- if (debounceTimer !== null) return;
1757
- debounceTimer = setTimeout(function () {
1758
- debounceTimer = null;
1759
- const reconnectNow = reconnectRequested;
1760
- reconnectRequested = false;
1761
- refresh(reconnectNow);
1762
- }, delay);
1763
- }
1764
-
1765
- function onVisibility() {
1766
- if (document.visibilityState === 'visible') schedule(false, 0);
1767
- }
1768
- document.addEventListener('visibilitychange', onVisibility);
1769
- const periodic = setInterval(function () { schedule(false, 0); }, 30000);
1770
- refresh(true);
1771
-
1772
- return function stop() {
1773
- stopped = true;
1774
- socketGeneration++;
1775
- if (debounceTimer !== null) clearTimeout(debounceTimer);
1776
- if (retryTimer !== null) clearTimeout(retryTimer);
1777
- clearInterval(periodic);
1778
- document.removeEventListener('visibilitychange', onVisibility);
1779
- if (socket) { try { socket.close(1000, 'stopped'); } catch (_) {} }
1780
- };
1781
- }
1782
- `.trim();
1783
-
1784
1670
  // worker/src/runtime/runtime-console-capture.ts
1785
1671
  var RUNTIME_CONSOLE_MAX_ENTRIES = 200;
1786
1672
  var RUNTIME_CONSOLE_MAX_BYTES = 64 * 1024;
@@ -2355,6 +2241,9 @@ function __sw_parseTraceparent(raw) {
2355
2241
  // sw.rooms -> its platform-private door half (the browser ticket door). Module
2356
2242
  // scope: customer modules cannot name it, and nothing is stored on sw.
2357
2243
  const __sw_roomsDoor = new WeakMap();
2244
+ // sw.db namespace -> its live-list declare (sw.rooms.live delegates to it): the
2245
+ // composed-read brands live in the db closure. Module scope, never on sw.
2246
+ const __sw_liveDoor = new WeakMap();
2358
2247
  const __sw_FS_OPS = { move: 1, copy: 1, restore: 1, stat: 1, versions: 1, diff: 1, glob: 1, search: 1, replace: 1, sign: 1, 'public-url': 1, visibility: 1 };
2359
2248
  const __sw_FS_METHOD_OPS = { GET: 'sw.fs.get', HEAD: 'sw.fs.get', PUT: 'sw.fs.write', DELETE: 'sw.fs.delete', POST: 'sw.fs.post' };
2360
2249
  function __sw_traceOpName(path, method) {
@@ -4753,7 +4642,7 @@ var DB_STRUCTURED_EXECUTION_JS = ` async function __sw_structExec(label, ir
4753
4642
  // delta. A failure cannot undo the committed write; clients repair
4754
4643
  // through their mandatory function refresh policy.
4755
4644
  // Only group keys and (user, group) pairs leave the returned rows.
4756
- liveDelivery = await __sw_publishStructuredLiveInvalidation(ir, mutation, principalId, __sw_liveGroupEvidenceFor(ir, mutation, rows));
4645
+ liveDelivery = await __sw_publishStructuredLiveInvalidation(ir, mutation, principalId, __sw_liveGroupEvidenceFor(ir, mutation, rows), __sw_liveOwnersFor(ir, mutation, rows, principalId));
4757
4646
  }
4758
4647
  const result = {
4759
4648
  data: __sw_structDecodeRows(ir, rows, !!mutation),
@@ -7351,15 +7240,82 @@ var DB_LIVE_INVALIDATION_JS = ` function __sw_liveInvalidation(table) {
7351
7240
  return evidence;
7352
7241
  }
7353
7242
 
7354
- async function __sw_publishStructuredLiveInvalidation(ir, mutation, principalId, evidence) {
7243
+ // Owner lists: the owners (old and new) of the rows a write touched. A
7244
+ // write in the owner's own scope can only touch the writer's rows; any
7245
+ // other write (server, job, another scope) is attributed from its own
7246
+ // returned rows, plus the owner its filter pinned when it moves a row.
7247
+ // Missing evidence is reported, never guessed.
7248
+ function __sw_liveOwnersFor(ir, mutation, rows, principalId) {
7249
+ if (!mutation) return null;
7250
+ const written = (ir.values || []).concat(ir.increments || []).map(function (item) { return String(item.column).toLowerCase(); });
7251
+ const candidates = __sw_liveCandidates(__sw_liveInvalidation(mutation.table), mutation.op, written);
7252
+ const wanted = String(mutation.table || '').toLowerCase();
7253
+ let column = null, mixed = false;
7254
+ for (let i = 0; i < candidates.length; i++) {
7255
+ const view = __sw_liveViewByName(candidates[i]);
7256
+ const deps = (view && view.dependencies) || [];
7257
+ for (let j = 0; j < deps.length; j++) {
7258
+ const dep = deps[j];
7259
+ if (!dep || dep.table !== wanted || !dep.scope || dep.scope.mode !== 'user') continue;
7260
+ const c = String(dep.scope.ownerColumn).toLowerCase();
7261
+ if (column !== null && column !== c) mixed = true;
7262
+ column = c;
7263
+ }
7264
+ }
7265
+ if (column === null) return null;
7266
+ const subjectOf = function (value) {
7267
+ const id = typeof value === 'number' ? value : String(value);
7268
+ return { kind: /^anon_[a-zA-Z0-9_-]{8,}$/.test(String(value)) ? 'visitor' : 'app_user', id: id };
7269
+ };
7270
+ if (ir.scope && ir.scope.mode === 'user' && principalId !== undefined && principalId !== null) {
7271
+ return { owners: [subjectOf(principalId)], complete: !mixed };
7272
+ }
7273
+ const scalar = function (value) {
7274
+ return (typeof value === 'string' && value.length > 0 && value.length <= 200) || (typeof value === 'number' && Number.isSafeInteger(value));
7275
+ };
7276
+ const seen = new Set();
7277
+ const owners = [];
7278
+ let complete = !mixed;
7279
+ const add = function (value) {
7280
+ if (value === null || value === undefined) return;
7281
+ if (!scalar(value)) { complete = false; return; }
7282
+ const key = typeof value + ':' + String(value);
7283
+ if (seen.has(key)) return;
7284
+ seen.add(key);
7285
+ owners.push(subjectOf(value));
7286
+ };
7287
+ const list = rows || [];
7288
+ for (let i = 0; i < list.length; i++) {
7289
+ const row = list[i];
7290
+ let found = false;
7291
+ if (row && typeof row === 'object') {
7292
+ const keys = Object.keys(row);
7293
+ for (let k = 0; k < keys.length; k++) if (keys[k].toLowerCase() === column) { found = true; add(row[keys[k]]); }
7294
+ }
7295
+ if (!found) complete = false;
7296
+ }
7297
+ if (mutation.op === 'update' && written.indexOf(column) !== -1) {
7298
+ let pinned = false;
7299
+ const where = ir.where || [];
7300
+ for (let i = 0; i < where.length; i++) {
7301
+ const p = where[i];
7302
+ if (p && p.op === 'eq' && String(p.column).toLowerCase() === column && scalar(p.value)) { add(p.value); pinned = true; }
7303
+ }
7304
+ if (!pinned) complete = false;
7305
+ }
7306
+ if (owners.length > 100) return { owners: owners.slice(0, 100), complete: false };
7307
+ return { owners: owners, complete: complete };
7308
+ }
7309
+
7310
+ async function __sw_publishStructuredLiveInvalidation(ir, mutation, principalId, evidence, owned) {
7355
7311
  if (isDraftExecution || !env.SW_RELEASE_ID) return null;
7356
7312
  const entry = __sw_liveInvalidation(mutation.table);
7357
7313
  const written = (ir.values || []).concat(ir.increments || []).map(function (item) { return String(item.column).toLowerCase(); });
7358
7314
  const candidates = __sw_liveCandidates(entry, mutation.op, written);
7359
7315
  if (!candidates.length) return null;
7360
7316
  // A group list's table or membership table is attributed by its group
7361
- // evidence, not by the writer; a server-only membership write has no subject.
7362
- const subject = __sw_liveSubject(ir, principalId) || (evidence ? { kind: 'shared', id: null } : null);
7317
+ // evidence and an owner list by its owners, not by the writer.
7318
+ const subject = __sw_liveSubject(ir, principalId) || (evidence || owned ? { kind: 'shared', id: null } : null);
7363
7319
  if (!subject) return { delivery: 'resync_required', reason: 'LIVE_SCOPE_NOT_SUBSCRIBABLE' };
7364
7320
  const body = {
7365
7321
  projectId: projectId,
@@ -7371,17 +7327,32 @@ var DB_LIVE_INVALIDATION_JS = ` function __sw_liveInvalidation(table) {
7371
7327
  };
7372
7328
  if (evidence && evidence.groups) body.groups = evidence.groups;
7373
7329
  if (evidence && evidence.memberships) body.memberships = evidence.memberships;
7374
- try {
7375
- const response = await platformFetch('/v1/live/invalidate', {
7376
- method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body),
7377
- });
7378
- if (!response.ok) return { delivery: 'resync_required', reason: 'DELIVERY_UNAVAILABLE' };
7379
- if (evidence && !evidence.complete) return { delivery: 'resync_required', reason: 'LIVE_GROUP_EVIDENCE_INCOMPLETE' };
7380
- return { delivery: 'invalidated' };
7381
- } catch (error) {
7382
- console.warn('[SW_LIVE_INVALIDATION] delivery failed: ' + ((error && error.message) || String(error)));
7383
- return { delivery: 'resync_required', reason: 'DELIVERY_UNAVAILABLE' };
7330
+ if (owned) body.owners = owned.owners;
7331
+ // Bounded retry: three attempts over about a second. The write has
7332
+ // already committed; a final failure is logged and reported, never thrown.
7333
+ let lastReason = 'DELIVERY_UNAVAILABLE';
7334
+ for (let attempt = 0; attempt < 3; attempt++) {
7335
+ if (attempt > 0) await new Promise(function (resolve) { setTimeout(resolve, attempt * 300); });
7336
+ try {
7337
+ const response = await platformFetch('/v1/live/invalidate', {
7338
+ method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body),
7339
+ });
7340
+ if (response.ok) {
7341
+ if (evidence && !evidence.complete) return { delivery: 'resync_required', reason: 'LIVE_GROUP_EVIDENCE_INCOMPLETE' };
7342
+ if (owned && !owned.complete) {
7343
+ console.warn('[SW_LIVE_INVALIDATION] ' + body.table + ': not every owner was named in the write result; those owner lists catch up on their next refresh.');
7344
+ return { delivery: 'resync_required', reason: 'LIVE_OWNER_EVIDENCE_INCOMPLETE' };
7345
+ }
7346
+ return { delivery: 'invalidated' };
7347
+ }
7348
+ lastReason = 'DELIVERY_UNAVAILABLE';
7349
+ if (response.status < 500) { lastReason = 'DELIVERY_REFUSED_' + response.status; break; }
7350
+ } catch (error) {
7351
+ lastReason = 'DELIVERY_UNAVAILABLE';
7352
+ }
7384
7353
  }
7354
+ console.error('[SW_LIVE_INVALIDATION] ' + body.table + ' ' + body.op + ': the change committed, but live lists were not notified (' + lastReason + '). Open lists catch up on reconnect, focus or within 60 s.');
7355
+ return { delivery: 'resync_required', reason: lastReason };
7385
7356
  }
7386
7357
 
7387
7358
  `;
@@ -9320,19 +9291,19 @@ ${DB_RENDER_IR_JS}
9320
9291
  async function __sw_liveDeclare(name, read) {
9321
9292
  const result = await read;
9322
9293
  if (typeof name !== 'string' || !name || arguments.length !== 2) {
9323
- __sw_structThrow('sw.db.live takes exactly (name, read).');
9294
+ __sw_structThrow('sw.rooms.live takes exactly (name, read).');
9324
9295
  }
9325
9296
  const view = __sw_liveViewByName(name);
9326
9297
  if (!view) {
9327
- __sw_structThrow403('LIVE_VIEW_NOT_DECLARED', 'sw.db.live("' + name + '") is not declared by this release. Declare the exact composed read directly in sw.db.live(name, sw.db.from(...)) and deploy.');
9298
+ __sw_structThrow403('LIVE_VIEW_NOT_DECLARED', 'sw.rooms.live("' + name + '") is not declared by this release. Declare the exact composed read directly in sw.rooms.live(name, sw.db.from(...)) and deploy.');
9328
9299
  }
9329
9300
  const brand = result && typeof result === 'object' ? __sw_liveReadBrands.get(result) : null;
9330
9301
  if (!brand || brand.fingerprint !== view.fingerprint) {
9331
- __sw_structThrow403('LIVE_READ_NOT_COMPOSED', 'sw.db.live requires the exact successful sw.db.from result declared for this name. A raw query, cloned result, failed read, or different composed shape cannot mint a subscription.');
9302
+ __sw_structThrow403('LIVE_READ_NOT_COMPOSED', 'sw.rooms.live requires the exact successful sw.db.from result declared for this name. A raw query, cloned result, failed read, or different composed shape cannot mint a subscription.');
9332
9303
  }
9333
9304
  const dependency = view.dependencies && view.dependencies.find(function (item) { return item.kind === 'rows'; });
9334
9305
  if (!dependency || (dependency.scope.mode === 'policy' && !(dependency.scope.policy && (dependency.scope.policy.k === 'g' || __sw_liveRoleChain(dependency.scope.policy) || __sw_liveGroupChain(dependency.scope.policy))))) {
9335
- __sw_structThrow403('LIVE_VIEW_POLICY_SCOPE_UNSUPPORTED', 'sw.db.live does not subscribe policy-scoped tables yet.');
9306
+ __sw_structThrow403('LIVE_VIEW_POLICY_SCOPE_UNSUPPORTED', 'sw.rooms.live does not subscribe policy-scoped tables yet.');
9336
9307
  }
9337
9308
  const subject = __sw_liveSubject(brand.ir, brand.principalId);
9338
9309
  if (!subject) {
@@ -9436,10 +9407,6 @@ ${DB_AGGREGATE_JS}
9436
9407
  // sw.db.delete is a trivial alias of sw.db.remove (both call the same
9437
9408
  // composer). A scope argument fails loudly, never silently.
9438
9409
  from(table, opts, legacyScope) { __sw_structNoScopeArg(legacyScope, 'from'); return __sw_structFrom(table, opts); },
9439
- live(name, read) {
9440
- if (arguments.length !== 2) __sw_structThrow('sw.db.live takes exactly (name, read).');
9441
- return __sw_liveDeclare(name, read);
9442
- },
9443
9410
  count(table, opts, legacyScope) { __sw_structNoScopeArg(legacyScope, 'count'); return __sw_structCount(table, opts); },
9444
9411
  // Composed aggregates (tsk_d3edbf2b) \u2014 count/sum/avg/min/max with
9445
9412
  // group-by over the rows the caller is allowed to read.
@@ -9501,6 +9468,7 @@ ${DB_AGGREGATE_JS}
9501
9468
  };
9502
9469
  })(),
9503
9470
  };
9471
+ __sw_liveDoor.set(__sw_dbNamespace, __sw_liveDeclare);
9504
9472
  return __sw_registerGeneratedOwnerRead(__sw_dbNamespace);`;
9505
9473
 
9506
9474
  // worker/src/runtime/db-raw.ts
@@ -9602,6 +9570,19 @@ var DB_RAW_JS = ` var __sw_rawReadDbInstance = null;
9602
9570
  });
9603
9571
  __sw_pendingBackground.push(pending);
9604
9572
  }
9573
+ // A raw SQL write names no rows the platform can attribute, so it cannot
9574
+ // notify a live list. Say so once per table per request instead of
9575
+ // leaving the list silently stale (structured writes notify).
9576
+ var __sw_rawLiveWarned;
9577
+ function __sw_rawLiveWarn(sql) {
9578
+ const mut = __sw_mutationOf(sql);
9579
+ if (!mut || !__sw_liveInvalidation(mut.table)) return;
9580
+ __sw_rawLiveWarned = __sw_rawLiveWarned || new Set();
9581
+ const table = String(mut.table).toLowerCase();
9582
+ if (__sw_rawLiveWarned.has(table)) return;
9583
+ __sw_rawLiveWarned.add(table);
9584
+ console.warn('[SW_LIVE] A raw SQL ' + mut.op + ' on ' + table + ' does not notify its live lists; open lists catch up on reconnect, focus or within 60 s. Write it with sw.db.insert/update/remove to update them at once.');
9585
+ }
9605
9586
  function __sw_rawResultWrote(results) {
9606
9587
  const list = __sw_arrayIsArray(results) ? results : [results];
9607
9588
  return list.some(function (r) {
@@ -9635,6 +9616,7 @@ var DB_RAW_JS = ` var __sw_rawReadDbInstance = null;
9635
9616
  const rows = r.results || [];
9636
9617
  const mut = __sw_mutationOf(sql);
9637
9618
  if (mut || __sw_rawResultWrote(r)) __sw_publicDataInvalidate();
9619
+ if (mut) __sw_rawLiveWarn(sql);
9638
9620
  if (mut) {
9639
9621
  __sw_deferDbSizeObservation(r);
9640
9622
  }
@@ -9676,6 +9658,7 @@ var DB_RAW_JS = ` var __sw_rawReadDbInstance = null;
9676
9658
  throw error;
9677
9659
  }
9678
9660
  if (batchMutates || __sw_rawResultWrote(results)) __sw_publicDataInvalidate();
9661
+ if (batchMutates) for (const s of statements) __sw_rawLiveWarn(s.sql);
9679
9662
  if (batchMutates) {
9680
9663
  __sw_deferDbSizeObservation(results);
9681
9664
  }
@@ -16011,11 +15994,10 @@ var ROOMS_JS = ` rooms: (function () {
16011
15994
  if (!visitor && issueVisitor && typeof __sw_resolveVisitorIdentity === 'function') {
16012
15995
  // The ticket door gives a first-time anonymous visitor a session when the
16013
15996
  // app declares visitor identity, so the person is the same on reconnect.
16014
- try { await __sw_resolveVisitorIdentity(); visitor = __sw_roomsVisitorToken(); }
16015
- catch (err) { if (!err || err.code !== 'VISITOR_IDENTITY_UNAVAILABLE') throw err; }
15997
+ await __sw_resolveVisitorIdentity(); visitor = __sw_roomsVisitorToken();
16016
15998
  }
16017
15999
  if (visitor) return { 'X-Somewhere-Rooms-Authority': 'visitor', 'X-Sw-Visitor-Session': visitor };
16018
- return { 'X-Somewhere-Rooms-Authority': 'none' };
16000
+ throw __sw_roomsError('AUTH_REQUIRED', 'Rooms require a signed-in or visitor session.', 401);
16019
16001
  }
16020
16002
  async function __sw_roomsCall(path, headers, body) {
16021
16003
  const r = await platformFetch(path, {
@@ -16093,6 +16075,14 @@ var ROOMS_JS = ` rooms: (function () {
16093
16075
  const __sw_rooms = Object.assign(__sw_roomsOps('sw.rooms', '/v1/rooms/', function (label) { return __sw_roomsCallerHeaders(label, false); }), {
16094
16076
  server: Object.freeze(__sw_roomsOps('sw.rooms.server', '/v1/rooms/server/', __sw_roomsServerHeaders)),
16095
16077
  event: __sw_roomsEvent,
16078
+ // A live list: the declared composed read plus a refresh subscription
16079
+ // (worker/src/runtime/db.ts __sw_liveDeclare). Rows stay in the read.
16080
+ live: function live(name, read) {
16081
+ if (arguments.length !== 2) throw __sw_roomsError('VALIDATION_ERROR', 'sw.rooms.live takes exactly (name, read): a declared name and sw.db.from(...).', 400);
16082
+ const declare = __sw_liveDoor.get(sw.db);
16083
+ if (typeof declare !== 'function') throw __sw_roomsError('ROOMS_LIVE_UNAVAILABLE', 'Live lists are unavailable in this runtime.', 500);
16084
+ return declare(name, read);
16085
+ },
16096
16086
  });
16097
16087
  Object.freeze(__sw_rooms);
16098
16088
  // Platform-private: the browser ticket door (/__sw/rooms/ticket) asks for a
@@ -16117,7 +16107,7 @@ var CONTEXT_TAIL_JS = ` };
16117
16107
  // teaches nothing (pfb_3645abbfa717). One thrower, mounted on both the
16118
16108
  // standard sw and the draft proxy, so the answer is identical either way.
16119
16109
  function __sw_realtimeRetired() {
16120
- const err = new Error('sw.realtime is not part of the runtime. For browser live updates, declare the read in a function with sw.db.live(name, sw.db.from(...)) and subscribe with watchLive from /__sw/live/client.js. For durable events and history, write rows with sw.db.');
16110
+ const err = new Error('sw.realtime is not part of the runtime. For browser live updates, declare the read in a function with sw.rooms.live(name, sw.db.from(...)) and subscribe with watchLive from /__sw/rooms/client.js. For durable events and history, write rows with sw.db.');
16121
16111
  err.code = 'REALTIME_RETIRED';
16122
16112
  err.status = 410;
16123
16113
  throw __sw_markExpected(err);
@@ -16226,7 +16216,13 @@ var CONTEXT_TAIL_JS = ` };
16226
16216
  throw err;
16227
16217
  }
16228
16218
  const draftRoomsOps = { act: draftRoomsUnavailable, set: draftRoomsUnavailable, send: draftRoomsUnavailable, get: draftRoomsUnavailable };
16229
- const draftRooms = Object.freeze(Object.assign({}, draftRoomsOps, { server: Object.freeze(Object.assign({}, draftRoomsOps)), event: draftRoomsUnavailable }));
16219
+ // A preview still shows a live list's rows; only the subscription is unavailable.
16220
+ async function draftRoomsLive(name, read) {
16221
+ if (arguments.length !== 2) draftRoomsUnavailable();
16222
+ const result = await read;
16223
+ return Object.assign({}, result, { live: { name: name, state: 'unavailable', reason: 'ROOMS_DRAFT_UNAVAILABLE' } });
16224
+ }
16225
+ const draftRooms = Object.freeze(Object.assign({}, draftRoomsOps, { server: Object.freeze(Object.assign({}, draftRoomsOps)), event: draftRoomsUnavailable, live: draftRoomsLive }));
16230
16226
  const draftSafe = new Set([
16231
16227
  'project_id', 'subdomain', 'tier', 'env', 'request_id', 'params',
16232
16228
  // Groups stays discoverable only to return its draft refusal before transport.
@@ -17687,6 +17683,185 @@ async function __sw_handlePushDoor(request, sw, env) {
17687
17683
  }
17688
17684
  `;
17689
17685
 
17686
+ // worker/src/runtime/live-client.ts
17687
+ var LIVE_CLIENT_MODULE_JS = `
17688
+ const LIVE_PING_FRAME = '{"type":"sw_ping"}';
17689
+ const LIVE_PING_MS = 25000;
17690
+ const LIVE_PONG_TIMEOUT_MS = 10000;
17691
+ const LIVE_SAFETY_REFRESH_MS = 60000;
17692
+ const LIVE_RETRY_LIMIT = 6;
17693
+
17694
+ function liveError(code, message, cause) {
17695
+ const err = new Error(message);
17696
+ err.code = code;
17697
+ if (cause !== undefined) err.cause = cause;
17698
+ return err;
17699
+ }
17700
+
17701
+ export function watchLive(load, render, onError) {
17702
+ if (typeof load !== 'function' || typeof render !== 'function' || (onError !== undefined && typeof onError !== 'function')) {
17703
+ throw new TypeError('watchLive(load, render, onError?): load and render are functions; onError is an optional function');
17704
+ }
17705
+ let stopped = false;
17706
+ let socket = null;
17707
+ let socketGeneration = 0;
17708
+ let liveKey = null;
17709
+ let inFlight = null;
17710
+ let dirty = false;
17711
+ let reconnectRequested = false;
17712
+ let retryTimer = null;
17713
+ let failures = 0;
17714
+ let pingTimer = null;
17715
+ let pongTimer = null;
17716
+ let reconnectTimer = null;
17717
+ let drops = 0;
17718
+
17719
+ function report(err) {
17720
+ const retrying = failures <= LIVE_RETRY_LIMIT;
17721
+ const info = { attempt: failures, retrying: retrying };
17722
+ if (onError) {
17723
+ try { onError(err, info); } catch (handlerError) { console.error('[watchLive] onError threw', handlerError); }
17724
+ } else {
17725
+ console.error('[watchLive] ' + (err && err.code ? err.code + ': ' : '') + ((err && err.message) || String(err)) + (retrying ? ' (retrying)' : ' (gave up; the list refreshes again on reconnect, focus or within 60 s)'), err);
17726
+ }
17727
+ }
17728
+
17729
+ function scheduleRetry(reconnect) {
17730
+ if (stopped || retryTimer !== null || failures > LIVE_RETRY_LIMIT) return;
17731
+ const delay = Math.min(500 * Math.pow(2, failures - 1), 15000);
17732
+ retryTimer = setTimeout(function () { retryTimer = null; refresh(reconnect); }, delay);
17733
+ }
17734
+
17735
+ function fail(err, reconnect) {
17736
+ failures += 1;
17737
+ report(err);
17738
+ scheduleRetry(reconnect);
17739
+ }
17740
+
17741
+ function stopPing() {
17742
+ if (pingTimer !== null) { clearInterval(pingTimer); pingTimer = null; }
17743
+ if (pongTimer !== null) { clearTimeout(pongTimer); pongTimer = null; }
17744
+ }
17745
+
17746
+ function connect(live) {
17747
+ const nextKey = String(live.release_id) + ':' + String(live.fingerprint);
17748
+ const generation = ++socketGeneration;
17749
+ stopPing();
17750
+ if (socket) { try { socket.close(1000, 'refresh'); } catch (_) {} }
17751
+ liveKey = nextKey;
17752
+ let ws;
17753
+ try { ws = new WebSocket(live.subscribe_url); } catch (err) { socket = null; fail(liveError('LIVE_CONNECT_FAILED', 'The live connection could not be opened.', err), true); return; }
17754
+ socket = ws;
17755
+ let closed = false;
17756
+ ws.onmessage = function (message) {
17757
+ if (stopped || generation !== socketGeneration) return;
17758
+ if (pongTimer !== null) { clearTimeout(pongTimer); pongTimer = null; }
17759
+ drops = 0;
17760
+ let frame = null;
17761
+ try { frame = JSON.parse(message.data); } catch (_) { return; }
17762
+ if (!frame || frame.type !== 'live_control') return;
17763
+ // resync_required: rows changed, or this socket just went live.
17764
+ // release_changed / access_revoked / reauthorize_required: the socket
17765
+ // closes next; the close handler reconnects through a fresh load.
17766
+ if (frame.event === 'resync_required') refresh(false);
17767
+ };
17768
+ ws.onopen = function () {
17769
+ if (stopped || generation !== socketGeneration) return;
17770
+ pingTimer = setInterval(function () {
17771
+ if (stopped || generation !== socketGeneration) return;
17772
+ try { ws.send(LIVE_PING_FRAME); } catch (_) { return; }
17773
+ if (pongTimer === null) pongTimer = setTimeout(function () {
17774
+ pongTimer = null;
17775
+ if (generation === socketGeneration) { try { ws.close(4000, 'no_pong'); } catch (_) {} onClose(); }
17776
+ }, LIVE_PONG_TIMEOUT_MS);
17777
+ }, LIVE_PING_MS);
17778
+ };
17779
+ function onClose() {
17780
+ if (closed || stopped || generation !== socketGeneration) return;
17781
+ closed = true;
17782
+ stopPing();
17783
+ // An error may leave the socket half-open; close it explicitly so no stale
17784
+ // connection lingers behind the replacement.
17785
+ try { ws.close(1000, 'replaced'); } catch (_) {}
17786
+ socket = null;
17787
+ liveKey = null;
17788
+ // A fresh load re-checks access and mints a new ticket; it also shows
17789
+ // anything that changed while the socket was down. The first drop
17790
+ // reconnects at once; repeated drops back off and are reported.
17791
+ drops += 1;
17792
+ if (drops > 3) report(liveError('LIVE_DISCONNECTED', 'The live connection keeps closing; reconnecting.'));
17793
+ if (reconnectTimer !== null) return;
17794
+ const delay = drops === 1 ? 0 : Math.min(500 * Math.pow(2, drops - 2), 15000);
17795
+ reconnectTimer = setTimeout(function () { reconnectTimer = null; refresh(true); }, delay);
17796
+ }
17797
+ ws.onclose = onClose;
17798
+ ws.onerror = onClose;
17799
+ }
17800
+
17801
+ function refresh(reconnect) {
17802
+ if (stopped) return Promise.resolve(null);
17803
+ if (inFlight) {
17804
+ dirty = true;
17805
+ reconnectRequested = reconnectRequested || !!reconnect;
17806
+ return inFlight;
17807
+ }
17808
+ if (retryTimer !== null) { clearTimeout(retryTimer); retryTimer = null; }
17809
+ if (reconnect && reconnectTimer !== null) { clearTimeout(reconnectTimer); reconnectTimer = null; }
17810
+ let snapshot = null;
17811
+ inFlight = Promise.resolve().then(load).then(function (value) {
17812
+ snapshot = value;
17813
+ if (stopped) return;
17814
+ render(snapshot && snapshot.data, snapshot);
17815
+ const live = snapshot && snapshot.live;
17816
+ if (!live || live.state !== 'ready' || typeof live.subscribe_url !== 'string') {
17817
+ // The rows rendered, but nothing will tell this page about changes.
17818
+ throw liveError((live && live.reason) || 'LIVE_NOT_DECLARED',
17819
+ live ? 'The list loaded, but it could not subscribe to changes (' + (live.reason || live.state) + ').'
17820
+ : 'load() must return the JSON of a function that returns sw.rooms.live(name, read).');
17821
+ }
17822
+ failures = 0;
17823
+ const nextKey = String(live.release_id) + ':' + String(live.fingerprint);
17824
+ if (reconnect || !socket || nextKey !== liveKey) connect(live);
17825
+ }).catch(function (err) {
17826
+ if (!stopped) fail(err && err.code ? err : liveError('LIVE_REFRESH_FAILED', 'Refreshing the live list failed: ' + ((err && err.message) || String(err)), err), reconnect || !socket);
17827
+ }).then(function () {
17828
+ inFlight = null;
17829
+ if (dirty && !stopped) {
17830
+ const again = reconnectRequested;
17831
+ dirty = false;
17832
+ reconnectRequested = false;
17833
+ refresh(again);
17834
+ }
17835
+ return snapshot;
17836
+ });
17837
+ return inFlight;
17838
+ }
17839
+
17840
+ function repair() {
17841
+ if (stopped) return;
17842
+ failures = Math.min(failures, LIVE_RETRY_LIMIT);
17843
+ refresh(!socket && reconnectTimer === null);
17844
+ }
17845
+ function onVisibility() { if (document.visibilityState === 'visible') repair(); }
17846
+ document.addEventListener('visibilitychange', onVisibility);
17847
+ if (typeof window !== 'undefined') window.addEventListener('online', repair);
17848
+ const safety = setInterval(function () { if (document.visibilityState !== 'hidden') repair(); }, LIVE_SAFETY_REFRESH_MS);
17849
+ refresh(true);
17850
+
17851
+ return function stop() {
17852
+ stopped = true;
17853
+ socketGeneration++;
17854
+ stopPing();
17855
+ if (retryTimer !== null) clearTimeout(retryTimer);
17856
+ if (reconnectTimer !== null) clearTimeout(reconnectTimer);
17857
+ clearInterval(safety);
17858
+ document.removeEventListener('visibilitychange', onVisibility);
17859
+ if (typeof window !== 'undefined') window.removeEventListener('online', repair);
17860
+ if (socket) { try { socket.close(1000, 'stopped'); } catch (_) {} }
17861
+ };
17862
+ }
17863
+ `.trim();
17864
+
17690
17865
  // worker/src/runtime/rooms-client.ts
17691
17866
  var ROOMS_CLIENT_MODULE_JS = `
17692
17867
  const TICKET_PATH = '/__sw/rooms/ticket';
@@ -18082,7 +18257,7 @@ export async function joinRoom(table, id) {
18082
18257
  if (!(typeof id === 'string' && id) && !Number.isSafeInteger(id)) throw new TypeError('joinRoom(table, id): id is the row id');
18083
18258
  return new Room(table, id)._start();
18084
18259
  }
18085
- `.trim();
18260
+ `.trim() + "\n\n" + LIVE_CLIENT_MODULE_JS;
18086
18261
  var ROOMS_DOOR_RUNTIME_JS = String.raw`
18087
18262
  const __SW_ROOMS_CLIENT_MODULE = ${JSON.stringify(ROOMS_CLIENT_MODULE_JS)};
18088
18263
  function __sw_roomsDoorMatch(url) {