@somewhere-cloud/cli 0.38.32 → 0.38.33

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,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.33
4
+
5
+ ### Changed
6
+
7
+ - Typecheck knows the typed browser specifier `somewhere:rooms` (joinRoom,
8
+ watchLive), so a TypeScript page can import the rooms client without TS2307
9
+ (tsk_5cc533ad). The absolute `/__sw/rooms/client.js` path still builds.
10
+ - A leftover `sw.db.live` call is reported with the rename to
11
+ `sw.rooms.live(name, sw.db.from(...))` instead of a bare missing-property
12
+ error.
13
+ - The vendored platform parser, types, lint, deploy-path policy and repro
14
+ guidance are re-synced with the platform at consumer contract 5 (tech
15
+ 8a604872).
16
+
3
17
  ## 0.38.32
4
18
 
5
19
  ### Changed
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.32",
3
+ "version": "0.38.33",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.32",
9
+ "version": "0.38.33",
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.32",
3
+ "version": "0.38.33",
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": "47475e7f0b74ec556a52f6dfd7136ebe9633d3c9290e5c2ca3ddda1c5fc657d9",
9
+ "worker/containers/compile/consumer-contract.cjs": "bc8f00cf7428bd82cd42a5916a011102920730fc3565640b5b77f039a25c824c",
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": "4aa3d3573913878cf5e2cfbb1053151866411c7684874bce180573efced864c4",
14
+ "worker/containers/compile/runtime-types.cjs": "451690bc1977d68139a538c270dc1ae1c28260f07249eb569c5a743db9d192cb",
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",
@@ -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": "73d74d3226288de4a926def943348271bfb45d404336fa9bba476587af19aa8b"
60
+ "sha256": "a3601e32a6d4ec1891d7a578e1a3d79bf702facad4d31649e7331b8461f8fada"
61
61
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "repository": "Somewhere-Cloud/somewhere-tech",
3
- "commit": "5145fd90dcda2663283460370a0fafed72f252fd"
3
+ "commit": "8a604872d7d3c96341bd6085abf59b349029f7b6"
4
4
  }
@@ -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": "599ac29a849502e00d9941e50e79a74e9ddd83655d9d85d56e3fd75c64ee1fd5",
69
+ "worker/src/runtime/live-client.ts": "39b6722d564e655b9273e6276688b6b612c455d7984dcf78a43431a7fd0d3aca",
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",
@@ -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": "7e2f4c7b4bbd96d04cf38bc2b12d0ad181a017d045d64a5900de0270b89948c0",
91
+ "worker/src/runtime/version.ts": "2cafb059376c6c3f6937fd8bb58eb60eeb2a6f482d032f37db119d7ec80f47fa",
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",
@@ -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": "66a28bcc40a12505bad023a2d9cf20c78a55d58b15e8fb743cba22a972f77c89",
164
+ "sha256": "e80dc821dd9ebbff91fc1b2c2f3207a29259f66d51f1c8b8ec0a44db3c2c2fe0",
165
165
  "fixtures_sha256": "908827d1430f4af5a83cae59ed476abc51dc9648757eac0089fe6e6db95f66c5"
166
166
  }
@@ -1277,6 +1277,8 @@ interface SomewhereServerDb {
1277
1277
  aggregate<T extends SomewhereDbTable>(table: T, options: SomewhereDbAggregateOptionsFor<T>): Promise<SomewhereDbAggregateResult<SomewhereDbAggregateRow<T>>>;
1278
1278
  }
1279
1279
  interface SomewhereCallerDb {
1280
+ /** @deprecated Replaced by sw.rooms.live(name, sw.db.from(...)); deploy refuses sw.db.live. */
1281
+ live(name: 'sw.db.live was replaced by sw.rooms.live(name, sw.db.from(...))', read: never): never;
1280
1282
  query(sql: string, params?: readonly unknown[] | null, options?: SomewhereDbRawCallerOptions | null): Promise<SomewhereDbResult>;
1281
1283
  batch(statements: readonly SomewhereRawDbStatement[], options?: SomewhereDbRawCallerOptions | null): Promise<SomewhereRawBatchResult[]>;
1282
1284
  aggregate<T extends SomewhereDbTable>(table: T, options: SomewhereDbAggregateOptionsFor<T> & { asServer?: true }): Promise<SomewhereDbAggregateResult<SomewhereDbAggregateRow<T>>>;
@@ -3476,6 +3478,42 @@ declare module 'somewhere:push' {
3476
3478
  export function listenToPush(handler: (message: PushMessage) => void): () => void;
3477
3479
  }
3478
3480
 
3481
+ // The rooms browser module (/__sw/rooms/client.js), typed under this
3482
+ // specifier. Plain browser scripts import the absolute path directly.
3483
+ declare module 'somewhere:rooms' {
3484
+ export interface RoomPerson { id: string; user: string | null; me: boolean; info: Record<string, unknown> | null }
3485
+ export type RoomStatus = 'connecting' | 'open' | 'reconnecting' | 'closed';
3486
+ export interface Room {
3487
+ readonly table: string;
3488
+ readonly id: string | number;
3489
+ readonly state: Record<string, unknown>;
3490
+ readonly version: number;
3491
+ readonly people: RoomPerson[];
3492
+ readonly status: RoomStatus;
3493
+ readonly me: { readonly info: Record<string, unknown> | null; set(info: Record<string, unknown>): void };
3494
+ on(event: 'state', handler: (state: Record<string, unknown>, change: { by: string; pending?: boolean } | null) => void): () => void;
3495
+ on(event: 'people', handler: (people: RoomPerson[]) => void): () => void;
3496
+ on(event: 'message', handler: (data: unknown, from: string) => void): () => void;
3497
+ on(event: 'status', handler: (status: RoomStatus) => void): () => void;
3498
+ on(event: 'timer_failed', handler: () => void): () => void;
3499
+ // Rooms without a referee: merge top-level keys (null deletes one).
3500
+ set(patch: Record<string, unknown>): Promise<Record<string, unknown>>;
3501
+ // Rooms with a referee: resolves with the state after the referee accepts.
3502
+ act(action: unknown): Promise<Record<string, unknown>>;
3503
+ // A throwaway message to everyone else; false when not connected.
3504
+ send(data: unknown): boolean;
3505
+ leave(): void;
3506
+ }
3507
+ export function joinRoom(table: string, id: string | number): Promise<Room>;
3508
+ // A live list declared with sw.rooms.live: load re-calls your function,
3509
+ // render gets its data array and the whole result. Returns stop().
3510
+ export function watchLive<Row = Record<string, unknown>>(
3511
+ load: () => Promise<{ data: Row[]; live?: unknown }> | { data: Row[]; live?: unknown },
3512
+ render: (rows: Row[], result: { data: Row[]; live?: unknown }) => void,
3513
+ onError?: (error: Error & { code?: string }, info: { attempt: number; retrying: boolean }) => void,
3514
+ ): () => void;
3515
+ }
3516
+
3479
3517
  // \u2500\u2500 sw.queue / sw.jobs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
3480
3518
  interface SomewhereQueuePushOptions {
3481
3519
  // A project-relative /api path or an https:// URL.
@@ -4407,8 +4445,8 @@ var require_consumer_contract = __commonJS({
4407
4445
  "worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
4408
4446
  "use strict";
4409
4447
  var CONSUMER_CONTRACT2 = Object.freeze({
4410
- version: 4,
4411
- digest: "ccf5c29211e634d5f41a4a6e2574103d3491e236188aeb53079dbf2842fcc19e"
4448
+ version: 5,
4449
+ digest: "5624c3f3f8db6bb4535b5e3e1466700b3967b33e907ad4315681cbcb2b1d1996"
4412
4450
  });
4413
4451
  var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
4414
4452
  var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
@@ -17690,6 +17690,9 @@ const LIVE_PING_MS = 25000;
17690
17690
  const LIVE_PONG_TIMEOUT_MS = 10000;
17691
17691
  const LIVE_SAFETY_REFRESH_MS = 60000;
17692
17692
  const LIVE_RETRY_LIMIT = 6;
17693
+ // Refusals that another attempt cannot change: report once, do not retry.
17694
+ // The next reconnect, focus or safety refresh still asks again.
17695
+ const LIVE_FINAL = { LIVE_ROLE_REQUIRED: 1, LIVE_MEMBERSHIP_REQUIRED: 1, LIVE_SCOPE_NOT_SUBSCRIBABLE: 1, LIVE_VIEW_NOT_DECLARED: 1, LIVE_VIEW_POLICY_SCOPE_UNSUPPORTED: 1, LIVE_NOT_DECLARED: 1, ROOMS_DRAFT_UNAVAILABLE: 1 };
17693
17696
 
17694
17697
  function liveError(code, message, cause) {
17695
17698
  const err = new Error(message);
@@ -17733,7 +17736,7 @@ export function watchLive(load, render, onError) {
17733
17736
  }
17734
17737
 
17735
17738
  function fail(err, reconnect) {
17736
- failures += 1;
17739
+ failures = err && LIVE_FINAL[err.code] ? LIVE_RETRY_LIMIT + 1 : failures + 1;
17737
17740
  report(err);
17738
17741
  scheduleRetry(reconnect);
17739
17742
  }
@@ -17769,7 +17772,9 @@ export function watchLive(load, render, onError) {
17769
17772
  if (stopped || generation !== socketGeneration) return;
17770
17773
  pingTimer = setInterval(function () {
17771
17774
  if (stopped || generation !== socketGeneration) return;
17772
- try { ws.send(LIVE_PING_FRAME); } catch (_) { return; }
17775
+ // A socket that is no longer open is dead even if its close event is late.
17776
+ if (ws.readyState !== 1) { onClose(); return; }
17777
+ try { ws.send(LIVE_PING_FRAME); } catch (_) { onClose(); return; }
17773
17778
  if (pongTimer === null) pongTimer = setTimeout(function () {
17774
17779
  pongTimer = null;
17775
17780
  if (generation === socketGeneration) { try { ws.close(4000, 'no_pong'); } catch (_) {} onClose(); }