@somewhere-cloud/cli 0.38.132 → 0.38.134

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.132",
3
+ "version": "0.38.134",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.132",
9
+ "version": "0.38.134",
10
10
  "license": "MIT",
11
11
  "bin": {
12
12
  "cli": "bin/somewhere.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.132",
3
+ "version": "0.38.134",
4
4
  "description": "CLI for somewhere.cloud — auth, projects, deploy, pull, promote, db, logs, env, MCP bridge.",
5
5
  "keywords": [
6
6
  "somewhere",
@@ -67,5 +67,5 @@
67
67
  },
68
68
  "bundleDependencies": [],
69
69
  "bundledDependencies": [],
70
- "gitHead": "560be7a78f3ae3c3d7c1e55321a6f22ba94a1b94"
70
+ "gitHead": "22311ce30475062979fd409d7ab2f248bc718a02"
71
71
  }
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "esbuild": "0.24.0",
3
3
  "source_files": {
4
- "shared/app-model-catalog.ts": "9d1b9014772d570760a7b71222b7b5108ab054e9194aacf51eab6fcfb209fa79",
4
+ "shared/app-model-catalog.ts": "6c3bdb81fd45c298cc4404e4891c2b465895bbb18ccabdc149c9eb39d79b1101",
5
5
  "shared/cloud-dev-entitlement.ts": "1993a9e1c781d9daed29b3cfef0e8a370e150ce06d2acc7c408c2a24c50b4960",
6
6
  "shared/d1-region.ts": "71cda96cfead241b4f4e35b8cd6b1d8e577f072257e91a8dbe0deaa1b142b378",
7
7
  "shared/d1-session.ts": "2ae29b74bba68016c86d25fa2a58f8c2fce4aca8fe57fafc253d380c47a3c0ab",
8
8
  "shared/transient-read.ts": "2f22daebdc74fed6255a29df7deda0db307f9165c1d9988dba3ee872b2584ffd",
9
9
  "shared/types/placeholder-identity.ts": "089a46e2474a21193d3611eddd9c94b6bbe62441b3039ed80fc8499bada447ca",
10
10
  "worker/containers/compile/checker-contract.cjs": "c6d4ebc9ec058b3562655cc4f18dc1cea7e4492eb35b7f0fd0d87e974c26b492",
11
- "worker/containers/compile/consumer-contract.cjs": "5fc79cc69fba2669939f45eeda274f072bac69898890e7907c6e8fd5e172666c",
11
+ "worker/containers/compile/consumer-contract.cjs": "e4f14acd6166f6577495fdea6092cbe82acc065a57b9adcb535dc7f776b27473",
12
12
  "worker/containers/compile/declared-data-contract.cjs": "1261275ab4ff75b3001456a30b041a7c639578ffff0b67b42706d7b0ff11d744",
13
13
  "worker/containers/compile/generated-declarations-render.cjs": "7ffdb34645cc9eccac6eba39dc86b646a41c4de8a1a038d2b5b46f42df9f1157",
14
14
  "worker/containers/compile/generated-declarations.cjs": "6e9902e054c5c784fd9b3c3fafc1869e79954100a45014e1132247cd82833ec4",
15
15
  "worker/containers/compile/groups-types.cjs": "7c22b4bb96c9391005d434852600dc02bc8a6bbb99d78d2b8e3eb152f7b72c58",
16
- "worker/containers/compile/runtime-types.cjs": "a91c245c82b5b8f18fb3d33359f1bc2adaeb639c15cfa88010aded4207a54e1a",
16
+ "worker/containers/compile/runtime-types.cjs": "b5d1fec7c57d24c44fde1c995c51b04ccb0095512626350c319a19a6f4f3b030",
17
17
  "worker/containers/compile/schema-types.cjs": "4cd8d79a9401271bcb948865069b90d3d5f13a10c96c51cb084e22e63cbb57d8",
18
18
  "worker/containers/compile/typed-data.cjs": "1c8bec853fbee4ffd34c651076a4e1f4d8b18c0c2be5e99e31df7c9283207627",
19
19
  "worker/containers/compile/typed-files.cjs": "f2568567a53994575ede91f9a0839965e64f94eb92ae11315650189b6de0f79c",
@@ -37,7 +37,7 @@
37
37
  "worker/src/utils/authority/intake-bake.ts": "7216e288e40673819295d999b3bdbf5e4319e1e21608e3b81eda9d102ff8d636",
38
38
  "worker/src/utils/authority/role-domain-map.ts": "dc1b6abba79278a970cc5a07c4eb7ea73acac262425b489670e90508b95a5ff1",
39
39
  "worker/src/utils/authority/scope-enforcement.ts": "ab035b28380cacc160e032b9dc47485ce3f56a51b184c653ff6ee33dd8d02a1d",
40
- "worker/src/utils/console-privacy.ts": "749789561a9865b59ce4ce7dc275aa7dc1e96c397b533d74a2388b88251073d7",
40
+ "worker/src/utils/console-privacy.ts": "fa486acf3f5701f095bf3e80786ee2e9e3ea46728c2037548b4789d798e1b9f3",
41
41
  "worker/src/utils/db-schema-deploy/bigint-text.ts": "ef3f581daeecb234d2c1e288bc09495a6facd7b0354b300134918f6c0cf10cc2",
42
42
  "worker/src/utils/db-schema-deploy/client-contract-source.ts": "b0a3b5e6e32a3269e6911c4f5c90d93457d8d93d5486678a9be082049f937be8",
43
43
  "worker/src/utils/db-schema-deploy/client-permissions.ts": "3db42f781ca6bb4f763a33be9470d43d74c58c7d3339a46d1271689d5100b64e",
@@ -58,11 +58,11 @@
58
58
  "worker/src/utils/db-schema-deploy/schema-ownership.ts": "e6c811a87bc657707be3518dfe547c6d97718ac073108b126eb7f791c9c08202",
59
59
  "worker/src/utils/dev-health-class.ts": "fd430f31b9c8469f3d90e118fd8c75d1836ebcf705c1f9e93915ffa53a4cb066",
60
60
  "worker/src/utils/errors.ts": "f9d22810c285d2a512d258853bdd17cf9c1445c3983d51f3adbbcede273ac07d",
61
- "worker/src/utils/event-log.ts": "70e6d8611cd303eadf42edff01461f48a66dee76be3dd9f7d5f69f02cc918c4f",
62
- "worker/src/utils/feed-kinds.ts": "e13d89c70e2e1a3600e09d1c125eee4b5faae93a682abf8cf5183eed6ebcf891",
63
- "worker/src/utils/journey-segment.ts": "61f63ca2fc2da0c514df48a7c8dc424797d21d4dac6edc072366f00fab4b6498",
61
+ "worker/src/utils/event-log.ts": "1f878064deef5ca490b7b84bed9c1fc50a8b7fc84b3d55a9eeada86f570e37b0",
62
+ "worker/src/utils/feed-kinds.ts": "b7315ca703ce08b8c796033d2e91039580fcc4cf3d43be06599f2baaa86334f0",
63
+ "worker/src/utils/journey-segment.ts": "7b73ff51d30d904d4588aede4fe6cb83e0bf4adc6bab47bc644b979e6a933e95",
64
64
  "worker/src/utils/json-exact-integers.ts": "e2eb8d3b2e17da363eb14fb46d876208579e2e92bfac173fb27527e6c4fb575e",
65
- "worker/src/utils/log-sanitize.ts": "e5a6172f5298bd053ea80f7334fdd53fb5fc718ea8fd2d23508ed045b0cb1688",
65
+ "worker/src/utils/log-sanitize.ts": "f4591089c16a34e4cbc271ec22b48566b970a62e30d3e9856b7dcd9c479fb0e8",
66
66
  "worker/src/utils/managed-groups/errors.ts": "18d952edd7f46bb7e459d4e6678226f4bd6e040ab40073ee5a8d0802be2f3721",
67
67
  "worker/src/utils/managed-groups/policy.ts": "2c5b48479a2925bea9a820022c63ca5fa827e2ff5531fe1ab6c0b058b7212b39",
68
68
  "worker/src/utils/platform-compile-failure.ts": "eb4cea8a54599e2ca852b67f576a4402fb0281da4c7f45a7ed735bc36a684883",
@@ -73,5 +73,5 @@
73
73
  "worker/src/utils/telegram.ts": "dfbc9e756b44b445b3c3504c90a1094a94e6f9853ff9c0e0a84fba0e8c4518da",
74
74
  "worker/src/utils/workers-ai-comparison.ts": "18b5d5ea96f817387a5ef49733ba611c99cbb14987143c28118b1c90f3b637d4"
75
75
  },
76
- "sha256": "8cf4ed28070c29560ff72aa1a267dd4da34a6e7e5aec51fb07783c0ff85523e2"
76
+ "sha256": "96fe68de3f6dd3c26f7e495a386524b7e2857c487e7380291b3f81b6cbe79316"
77
77
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha256": "480d78c44a868510b82c6b9f24fc7dae89fdcfadc24f943fc35702b3d22603cf"
2
+ "sha256": "c726568702ad5b4fc6affb61a43ade93d3b84d080bba730271ef681dac6a07b7"
3
3
  }
@@ -35,29 +35,37 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
35
35
 
36
36
 
37
37
  function createConsoleDiagnostics() {
38
+ const nativeStackGetter = Object.getOwnPropertyDescriptor(new Error(), "stack")?.get;
38
39
  function sanitizeMessage(input) {
39
40
  return input.slice(0, 8192).replace(/https?:\/\/[^\s<>"')]+/gi, (url) => url.replace(/(https?:\/\/)[^/@\s]+@/gi, "$1<redacted>@").split(/[?#]/, 1)[0]).replace(/(["']?(?:password|code|token|key|secret|signature|access_token|refresh_token|authorization|cookie)["']?\s*:\s*)(?:"[^"]*"|'[^']*'|[^\s,}]+)/gi, "$1<redacted>").replace(/\b(?:Cookie|Set-Cookie)\s*[:=]\s*[^\r\n]+/gi, "Cookie: <redacted>").replace(/\bBearer\s+[^\s,;'"<>]+/gi, "Bearer <redacted>").replace(/\b(?:token|code|key|secret|password|signature|access_token|refresh_token|session|sid|sessionid)\s*=\s*(?:"[^"]*"|'[^']*'|[^\s&;,]+)/gi, (match) => match.slice(0, match.indexOf("=") + 1) + "<redacted>").replace(/[A-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi, "<email>").replace(/\b[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g, "<redacted>").replace(/\b(?:smt_|(?:sk|pk)[_-])[A-Za-z0-9_-]+/g, "<redacted>").replace(/[A-Za-z0-9+/_-]{32,}={0,2}/g, "<redacted>").slice(0, 300);
40
41
  }
41
42
  function safeError(value) {
42
43
  try {
43
44
  const record2 = Object.create(null);
45
+ let stackGetter;
46
+ let unsafeFormatting = false;
44
47
  if (value && typeof value === "object") {
45
48
  let current = value;
46
49
  for (let depth = 0; current && depth < 6; depth++, current = Object.getPrototypeOf(current)) {
47
50
  for (const key of ["name", "message", "status", "code", "stack"]) {
48
51
  if (Object.hasOwn(record2, key)) continue;
49
52
  const descriptor = Object.getOwnPropertyDescriptor(current, key);
50
- if (descriptor) record2[key] = "value" in descriptor ? descriptor.value : "[Getter]";
53
+ if (descriptor) {
54
+ record2[key] = "value" in descriptor ? descriptor.value : "[Getter]";
55
+ if (key === "stack" && descriptor.get && descriptor.get === nativeStackGetter) stackGetter = descriptor.get;
56
+ if ((key === "name" || key === "message") && (!("value" in descriptor) || typeof descriptor.value !== "string")) unsafeFormatting = true;
57
+ }
51
58
  }
52
59
  }
53
60
  }
61
+ if (stackGetter && !unsafeFormatting && typeof record2.name === "string" && typeof record2.message === "string") record2.stack = stackGetter.call(value);
54
62
  const name = typeof record2.name === "string" ? sanitizeMessage(record2.name).slice(0, 80) : "Error";
55
63
  const message = typeof record2.message === "string" ? record2.message : typeof value === "string" ? value : "Unknown error";
56
64
  const status = typeof record2.status === "number" && Number.isInteger(record2.status) && record2.status >= 100 && record2.status <= 599 ? record2.status : 0;
57
65
  const failure = /Network connection lost/i.test(message) ? "connection_lost" : /DEADLINE|timed? ?out/i.test(message) ? "deadline_exceeded" : /object.*reset|reset.*object/i.test(message) ? "object_reset" : /no such column/i.test(message) ? "missing_column" : /no such table/i.test(message) ? "missing_table" : /SQLITE_CONSTRAINT|constraint failed/i.test(message) ? "constraint" : /overload|too many requests|too many resources consumed/i.test(message) ? "overloaded" : "unclassified";
58
66
  const code = typeof record2.code === "string" && /^[A-Z][A-Z0-9_]{0,63}$/.test(record2.code) ? sanitizeMessage(record2.code) : void 0;
59
67
  const frames = typeof record2.stack === "string" ? record2.stack.split("\n").slice(1).flatMap((line) => {
60
- const match = line.match(/([^\s()]+?):(\d+)(?::\d+)?\)?$/);
68
+ const match = (line.length > 512 ? line.slice(-512) : line).match(/([^\s()]+?):(\d+)(?::\d+)?\)?$/);
61
69
  if (!match) return [];
62
70
  const file = match[1].split(/[\\/]/).pop() ?? "";
63
71
  return [sanitizeMessage(file) + ":" + match[2]];
@@ -80,6 +88,21 @@ var init_console_privacy = __esm({
80
88
  });
81
89
 
82
90
 
91
+ var init_d1_region = __esm({
92
+ "shared/d1-region.ts"() {
93
+ "use strict";
94
+ }
95
+ });
96
+
97
+
98
+ var init_d1_session = __esm({
99
+ "shared/d1-session.ts"() {
100
+ "use strict";
101
+ init_d1_region();
102
+ }
103
+ });
104
+
105
+
83
106
  var require_declared_data_contract = __commonJS({
84
107
  "worker/containers/compile/declared-data-contract.cjs"(exports2, module2) {
85
108
  "use strict";
@@ -1540,6 +1563,17 @@ interface SomewhereAuthUserDeletion {
1540
1563
  removed: readonly string[];
1541
1564
  kept: readonly { readonly category: string; readonly reason: string }[];
1542
1565
  not_covered: readonly string[];
1566
+ /** Present with { erase: 'owned' }: the erase of the person's own rows and files, which finishes in the background. */
1567
+ erasure?: { id: string; state: 'requested' | 'closed' | 'complete' | 'incomplete' | 'failed' | 'cancelled'; counts: Record<string, number>; skipped: readonly string[]; reason?: string };
1568
+ }
1569
+ interface SomewhereAuthUserCopy {
1570
+ exported_at: string;
1571
+ profile: Record<string, unknown>;
1572
+ rows: Record<string, Record<string, unknown>[]>;
1573
+ files: { path: string; size_bytes: number; content_type: string | null; created_at: number; updated_at: number; visibility: string }[];
1574
+ passkeys: { name: string | null; created_at: number }[];
1575
+ not_in_copy: { tables: readonly string[]; reason: string };
1576
+ not_covered: readonly string[];
1543
1577
  }
1544
1578
  interface SomewhereRuntimeAuthModeration {
1545
1579
  ban(req: Request, userId: string, options?: { reason?: string | null } | null): Promise<SomewhereAuthModerationRevoked & {
@@ -1608,10 +1642,12 @@ interface SomewhereRuntimeAuth {
1608
1642
  // Email verification for the request's own session (cookie or Bearer); no token in app code.
1609
1643
  requestEmailVerificationWithCookie(req: Request): Promise<SomewhereAuthVerificationSent>;
1610
1644
  verifyEmailWithCookie(req: Request, options: { code: string }): Promise<{ verified: true }>;
1611
- deleteUser(token: string): Promise<SomewhereAuthUserDeletion>;
1645
+ deleteUser(token: string, options?: { erase?: 'owned' }): Promise<SomewhereAuthUserDeletion>;
1646
+ /** The signed-in person's own copy of their data. */
1647
+ exportUser(token: string): Promise<SomewhereAuthUserCopy>;
1612
1648
  // Password change and account deletion end every session of the account; these clear the cookies.
1613
1649
  updatePasswordWithCookie(req: Request, options: { new_password: string; current_password?: string }): Promise<{ updated: true }>;
1614
- deleteUserWithCookie(req: Request): Promise<SomewhereAuthUserDeletion>;
1650
+ deleteUserWithCookie(req: Request, options?: { erase?: 'owned' }): Promise<SomewhereAuthUserDeletion>;
1615
1651
  // Start Google/GitHub/Discord sign-in from a server handler: stages this attempt's HttpOnly
1616
1652
  // verifier cookie on the response and resolves the provider start URL (only its challenge travels).
1617
1653
  oauthStart(provider: 'google' | 'github' | 'discord', options: { redirect_uri: string }): Promise<string>;
@@ -1635,7 +1671,8 @@ interface SomewhereRuntimeAuth {
1635
1671
  signupWithCookie(options: SomewhereAuthSignupOptions): Promise<{ user: SomewhereAuthUser }>;
1636
1672
  clearSessionCookies(): void;
1637
1673
  logoutWithCookie(req: Request): Promise<{ ok: true }>;
1638
- signInWithOtp(options: { email: string; redirect_uri?: string }): Promise<SomewhereAuthOtpSent>;
1674
+ // purpose 'confirm' words the same link "Confirm your request" (a booking, an order) instead of "Sign in".
1675
+ signInWithOtp(options: { email: string; redirect_uri?: string; purpose?: 'sign_in' | 'confirm' }): Promise<SomewhereAuthOtpSent>;
1639
1676
  verifyOtp(options: { token: string }): Promise<SomewhereAuthOtpSession>;
1640
1677
  // One invite email; the link signs the invitee in as the invited address.
1641
1678
  invite(options: SomewhereAuthInviteOptions): Promise<SomewhereAuthInviteSent>;
@@ -2091,6 +2128,32 @@ interface SomewhereCalendarPolicyInput {
2091
2128
  turnaround_hours?: number | null;
2092
2129
  // Seats per exact [start, end) class slot. Omitted or null: one reservation per overlapping range.
2093
2130
  capacity?: number | null;
2131
+ // Weekly open hours in one IANA zone; hold and rebook refuse ranges outside them (CALENDAR_OUTSIDE_HOURS).
2132
+ hours?: SomewhereCalendarHours | null;
2133
+ // Starts at most this many days from now; hold and rebook refuse later ones (CALENDAR_TOO_FAR_AHEAD).
2134
+ max_days_ahead?: number | null;
2135
+ }
2136
+ type SomewhereCalendarWeekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
2137
+ interface SomewhereCalendarHours {
2138
+ timezone: string;
2139
+ // 'HH:MM-HH:MM' wall-clock windows per day, e.g. { mon: ['09:00-12:00', '13:00-17:00'] }. A missing day is closed.
2140
+ weekly: Partial<Record<SomewhereCalendarWeekday, readonly string[]>>;
2141
+ }
2142
+ interface SomewhereCalendarSlotsOptions {
2143
+ resource: string;
2144
+ range: SomewhereCalendarReadRange;
2145
+ duration_minutes: number;
2146
+ // Distance between starts; defaults to duration_minutes.
2147
+ step_minutes?: number;
2148
+ }
2149
+ interface SomewhereCalendarOpenSlot { start_ms: number; end_ms: number; start: string; end: string }
2150
+ interface SomewhereCalendarSlotsResult {
2151
+ resource: string;
2152
+ range: { start_ms: number; end_ms: number };
2153
+ duration_minutes: number;
2154
+ step_minutes: number;
2155
+ timezone: string | null;
2156
+ slots: SomewhereCalendarOpenSlot[];
2094
2157
  }
2095
2158
  type SomewhereCalendarSetPolicyOptions = { resource: string } & ({ policy: SomewhereCalendarPolicyInput } | (SomewhereCalendarPolicyInput & { policy?: never }));
2096
2159
  interface SomewhereCalendarPolicy {
@@ -2101,6 +2164,8 @@ interface SomewhereCalendarPolicy {
2101
2164
  bookable_from_ms: number | null;
2102
2165
  turnaround_hours: number | null;
2103
2166
  capacity: number | null;
2167
+ hours: SomewhereCalendarHours | null;
2168
+ max_days_ahead: number | null;
2104
2169
  created_at: number | null;
2105
2170
  updated_at: number | null;
2106
2171
  }
@@ -2149,6 +2214,8 @@ interface SomewhereRuntimeCalendar {
2149
2214
  getPolicy(resourceOrOpts: string | { resource: string }): Promise<{ policy: SomewhereCalendarPolicy }>;
2150
2215
  availability(opts: { resource: string; range: SomewhereCalendarReadRange }): Promise<SomewhereCalendarAvailabilityResult>;
2151
2216
  availability(resource: string, range: SomewhereCalendarReadRange): Promise<SomewhereCalendarAvailabilityResult>;
2217
+ slots(opts: SomewhereCalendarSlotsOptions): Promise<SomewhereCalendarSlotsResult>;
2218
+ slots(resource: string, range: SomewhereCalendarReadRange, opts: { duration_minutes: number; step_minutes?: number }): Promise<SomewhereCalendarSlotsResult>;
2152
2219
  list(opts: SomewhereCalendarListOptions): Promise<SomewhereCalendarListResult>;
2153
2220
  list(resource: string, opts?: SomewhereCalendarListExtras | null): Promise<SomewhereCalendarListResult>;
2154
2221
  get(idOrOpts: string | __SomewhereCalendarIdRef): Promise<{ reservation: SomewhereCalendarReservation }>;
@@ -2962,10 +3029,11 @@ interface SomewhereAgentStep {
2962
3029
  duration_ms: number;
2963
3030
  completion_reason: string;
2964
3031
  on_step?: unknown;
2965
- // Non-enumerable; null while the step's cost is pending.
3032
+ // This model call's cost in cents; null while it is pending. Kept in a durable run's stored steps.
2966
3033
  readonly cost_cents: number | null;
2967
3034
  }
2968
3035
  interface SomewhereAgentPrepareStepContext {
3036
+ // 0 for a run's first model call (it equals the number of steps already taken).
2969
3037
  stepNumber: number;
2970
3038
  steps: SomewhereAgentStep[];
2971
3039
  messages: SomewhereAiMessage[];
@@ -2985,7 +3053,7 @@ interface SomewhereAgentPrepareStepOverride {
2985
3053
  toolChoice?: string | SomewhereJsonObject;
2986
3054
  maxTokens?: number;
2987
3055
  }
2988
- interface SomewhereAgentStepEvent { step: SomewhereAgentStep; steps: SomewhereAgentStep[] }
3056
+ interface SomewhereAgentStepEvent { step: SomewhereAgentStep; steps: SomewhereAgentStep[]; agentId: string | null }
2989
3057
  interface SomewhereAgentOnStepEvent {
2990
3058
  agentId: string | null;
2991
3059
  turn: number;
@@ -3119,6 +3187,8 @@ type SomewhereEmailSendOptions = {
3119
3187
  in_reply_to?: string;
3120
3188
  references?: readonly string[];
3121
3189
  app_user_id?: string;
3190
+ // Up to 3 files, 256 KB total, content in base64. Extensions: ics pdf png jpg jpeg gif webp csv txt json.
3191
+ attachments?: readonly { filename: string; content_type?: string; content: string }[];
3122
3192
  } & __SomewhereEmailBody;
3123
3193
  interface SomewhereEmailSendResult {
3124
3194
  id: string;
@@ -3186,6 +3256,8 @@ interface SomewhereEmailTestInboxMessage {
3186
3256
  magic_link: string | null;
3187
3257
  /** The code an auth message carries (email verification, sign-in code); null otherwise. */
3188
3258
  verification_code: string | null;
3259
+ /** Files the send attached; content is base64. Empty when none. */
3260
+ attachments: { filename: string; content_type: string; content: string }[];
3189
3261
  created_at: string;
3190
3262
  }
3191
3263
  interface SomewhereRuntimeEmail {
@@ -3223,179 +3295,6 @@ interface SomewhereRuntimeContacts {
3223
3295
  list(options?: { limit?: number; offset?: number } | null): Promise<{ contacts: SomewhereEmailContact[] }>;
3224
3296
  }
3225
3297
 
3226
- // \u2500\u2500 sw.inbox \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\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
3227
- type SomewhereInboxOwnershipStatus = 'app_user' | 'project_owner' | 'legacy_project';
3228
- // At least one of body / text / html is required (body is an alias of text).
3229
- type __SomewhereInboxBody =
3230
- | { body: string; text?: string; html?: string }
3231
- | { text: string; body?: string; html?: string }
3232
- | { html: string; body?: string; text?: string };
3233
- interface SomewhereInboxAddressCreateOptions {
3234
- address: string;
3235
- label?: string;
3236
- webhook_url?: string;
3237
- forward_to?: string;
3238
- }
3239
- interface SomewhereInboxAddressCreated {
3240
- id: string;
3241
- project_id: string;
3242
- address: string;
3243
- label: string | null;
3244
- kind: 'admin' | 'app';
3245
- ownership_status: 'app_user' | 'project_owner';
3246
- webhook_url: string | null;
3247
- // Returned once, only when webhook_url was set.
3248
- webhook_secret: string | null;
3249
- forward?: SomewhereJsonObject;
3250
- created_at: string;
3251
- }
3252
- interface SomewhereInboxAddress {
3253
- id: string;
3254
- address: string;
3255
- label: string | null;
3256
- created_at: string;
3257
- webhook_url: string | null;
3258
- forward_to: string | null;
3259
- forward_status: 'active' | 'pending_verification' | null;
3260
- ownership_status: SomewhereInboxOwnershipStatus;
3261
- }
3262
- interface SomewhereInboxListOptions {
3263
- address_id?: string;
3264
- limit?: number;
3265
- unread?: boolean;
3266
- q?: string;
3267
- include_spam?: boolean;
3268
- }
3269
- interface SomewhereInboxMessageSummary {
3270
- id: string;
3271
- address_id: string;
3272
- mail_from: string;
3273
- mail_to: string;
3274
- subject: string | null;
3275
- text_preview: string | null;
3276
- has_html: boolean;
3277
- attachment_count: number;
3278
- size_bytes: number;
3279
- read_at: string | null;
3280
- received_at: string;
3281
- thread_root: string | null;
3282
- spf_result: string | null;
3283
- dkim_result: string | null;
3284
- dmarc_result: string | null;
3285
- spam_suspect: boolean;
3286
- ownership_status: SomewhereInboxOwnershipStatus;
3287
- }
3288
- interface SomewhereInboxAttachmentMeta {
3289
- filename: string | null;
3290
- content_type: string;
3291
- size_bytes: number;
3292
- r2_key: string;
3293
- }
3294
- interface SomewhereInboxMessage extends SomewhereInboxMessageSummary {
3295
- project_id: string;
3296
- r2_key: string;
3297
- message_id_header: string | null;
3298
- in_reply_to_header: string | null;
3299
- references_header: string | null;
3300
- attachments: SomewhereInboxAttachmentMeta[];
3301
- raw_url: string;
3302
- // Present only with include_html: true.
3303
- html_preview?: string | null;
3304
- }
3305
- interface SomewhereInboxSendPending {
3306
- id: string;
3307
- message_id: string;
3308
- status: 'pending';
3309
- code: 'EMAIL_SEND_PENDING';
3310
- duplicate?: true;
3311
- }
3312
- interface __SomewhereInboxSentBase {
3313
- id: string;
3314
- from: string;
3315
- to: string;
3316
- subject: string;
3317
- thread_root: string;
3318
- status?: never;
3319
- duplicate?: true;
3320
- test_inbox?: { address: string; delivered: false };
3321
- }
3322
- interface SomewhereInboxSent extends __SomewhereInboxSentBase { message_id: string }
3323
- interface SomewhereInboxReplySent extends __SomewhereInboxSentBase { inbox_message_id: string }
3324
- interface SomewhereInboxThreadSummary {
3325
- thread_root: string;
3326
- last_at: string;
3327
- first_at: string;
3328
- message_count: number;
3329
- unread_count: number;
3330
- last_subject: string | null;
3331
- last_counterparty: string;
3332
- last_direction: 'in' | 'out';
3333
- ownership_status: SomewhereInboxOwnershipStatus;
3334
- }
3335
- type SomewhereInboxThreadMessage =
3336
- | {
3337
- direction: 'in'; id: string; address_id: string; mail_from: string; mail_to: string;
3338
- subject: string | null; text_preview: string | null; has_html: boolean;
3339
- attachment_count: number; read_at: string | null; received_at: string;
3340
- spf_result: string | null; dkim_result: string | null; dmarc_result: string | null;
3341
- spam_suspect: boolean; message_id: string | null; ownership_status: SomewhereInboxOwnershipStatus;
3342
- }
3343
- | {
3344
- direction: 'out'; id: string; to: string; from: string; subject: string | null;
3345
- body: string | null; text_preview: string | null; sent_at: string; is_reply: boolean;
3346
- message_id: string | null; inbox_message_id: string | null; ownership_status: SomewhereInboxOwnershipStatus;
3347
- };
3348
- interface SomewhereInboxRule {
3349
- id: string;
3350
- address_id: string | null;
3351
- pattern: string;
3352
- action: 'allow' | 'deny';
3353
- created_at: string;
3354
- }
3355
- interface SomewhereInboxRules {
3356
- list(options?: { address_id?: string } | null): Promise<{ rules: SomewhereInboxRule[] }>;
3357
- // Omit address_id for a project-wide rule (sw.inbox.project only).
3358
- create(rule: { pattern: string; action: 'allow' | 'deny'; address_id?: string }): Promise<SomewhereInboxRule & { project_id: string }>;
3359
- delete(id: string): Promise<{ id: string; deleted: true }>;
3360
- }
3361
- interface SomewhereInboxClient {
3362
- listAddresses(): Promise<{ addresses: SomewhereInboxAddress[] }>;
3363
- createAddress(options: SomewhereInboxAddressCreateOptions): Promise<SomewhereInboxAddressCreated>;
3364
- listAppAddresses(): Promise<{ addresses: SomewhereInboxAddress[] }>;
3365
- deleteAddress(id: string): Promise<{ id: string; deleted: true }>;
3366
- list(options?: SomewhereInboxListOptions | null): Promise<{ messages: SomewhereInboxMessageSummary[]; count: number }>;
3367
- get(id: string, options?: { include_html?: boolean } | null): Promise<SomewhereInboxMessage>;
3368
- // Raw RFC-822 bytes; the Response carries X-Somewhere-Ownership-Status.
3369
- raw(id: string): Promise<Response>;
3370
- attachment(id: string, index: number): Promise<Response>;
3371
- markRead(id: string, read?: boolean): Promise<{ id: string; read: boolean; ownership_status: SomewhereInboxOwnershipStatus; read_at: string | null }>;
3372
- delete(id: string): Promise<{ id: string; deleted: true }>;
3373
- reply(id: string, reply: { subject?: string; idempotency_key?: string } & __SomewhereInboxBody): Promise<SomewhereInboxReplySent | SomewhereInboxSendPending>;
3374
- send(addressId: string, message: { to: string; subject: string; idempotency_key?: string } & __SomewhereInboxBody): Promise<SomewhereInboxSent | SomewhereInboxSendPending>;
3375
- threads(options?: { address_id?: string; limit?: number; include_spam?: boolean } | null): Promise<{ threads: SomewhereInboxThreadSummary[] }>;
3376
- thread(root: string): Promise<{ thread_root: string; messages: SomewhereInboxThreadMessage[] }>;
3377
- readonly rules: SomewhereInboxRules;
3378
- }
3379
- interface SomewhereInboxGrant {
3380
- collaborator_user_id: string;
3381
- role: 'viewer' | 'editor';
3382
- granted_by: string;
3383
- created_at: string;
3384
- }
3385
- // Trusted project-scope inbox: createAddress makes admin mailboxes; owner-only grants/migration.
3386
- interface SomewhereRuntimeProjectInbox extends SomewhereInboxClient {
3387
- assignLegacyOwner(addressId: string, appUserId: string): Promise<{ id: string; ownership_status: 'app_user'; migrated_message_count: number; migration_id: string }>;
3388
- readonly grants: {
3389
- list(addressId: string): Promise<{ address_id: string; ownership_status: SomewhereInboxOwnershipStatus; grants: SomewhereInboxGrant[] }>;
3390
- set(addressId: string, collaboratorUserId: string, role: 'viewer' | 'editor'): Promise<{ address_id: string; collaborator_user_id: string; role: 'viewer' | 'editor'; ownership_status: 'app_user'; created_at: string }>;
3391
- delete(addressId: string, collaboratorUserId: string): Promise<{ address_id: string; collaborator_user_id: string; deleted: true }>;
3392
- };
3393
- }
3394
- // Scoped to the request's verified app user; createAddress makes app mailboxes.
3395
- interface SomewhereRuntimeInbox extends SomewhereInboxClient {
3396
- readonly project: SomewhereRuntimeProjectInbox;
3397
- }
3398
-
3399
3298
  // \u2500\u2500 sw.notifications \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\u2500\u2500
3400
3299
  type SomewhereNotificationsChannel = 'bell' | 'push' | 'email';
3401
3300
  interface SomewhereNotificationsSendOptions {
@@ -3937,7 +3836,6 @@ interface SomewhereRuntimeContext {
3937
3836
  readonly email: SomewhereRuntimeEmail;
3938
3837
  readonly rooms: SomewhereRuntimeRooms;
3939
3838
  readonly contacts: SomewhereRuntimeContacts;
3940
- readonly inbox: SomewhereRuntimeInbox;
3941
3839
  readonly notifications: SomewhereRuntimeNotifications;
3942
3840
  readonly push: SomewhereRuntimePush;
3943
3841
  readonly queue: SomewhereRuntimeQueue;
@@ -4502,8 +4400,8 @@ var require_consumer_contract = __commonJS({
4502
4400
  "worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
4503
4401
  "use strict";
4504
4402
  var CONSUMER_CONTRACT2 = Object.freeze({
4505
- version: 22,
4506
- digest: "da61ee52a81d1b7cb5324c8b88bc0b7f1883d213f8ef7280eddbf8449207c22f"
4403
+ version: 27,
4404
+ digest: "f4ec703b576673b8586f4a0bbeab5c7a3204bc5edceef4751c9d4ccef1ec0022"
4507
4405
  });
4508
4406
  var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
4509
4407
  var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
@@ -5196,6 +5094,7 @@ var ROLE_DOMAIN_MAP_JS = `
5196
5094
 
5197
5095
 
5198
5096
  init_console_privacy();
5097
+ init_d1_session();
5199
5098
 
5200
5099
 
5201
5100
  init_console_privacy();