@somewhere-cloud/cli 0.38.159 → 0.38.161

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,6 +1,6 @@
1
1
  import { loadEntry } from "./bundle.js";
2
2
  const entry = loadEntry("lib/declared-data.js");
3
- export const { DATA_DECLARATION_FILE, DATA_MODULE, DATA_VIRTUAL_ID, FILES_DECLARATION_FILE, GENERATED_DATA_HEADER, declaredDataPlugin, prepareDeclaredData } = entry;
3
+ export const { DATA_DECLARATION_FILE, DATA_MODULE, DATA_VIRTUAL_ID, FILES_DECLARATION_FILE, GENERATED_DATA_HEADER, declaredDataPlugin, localFilesContract, prepareDeclaredData } = entry;
4
4
  const SW_ENDPOINT_GLOBAL = `declare const sw: {
5
5
  // docs({ topic: 'sw.endpoint' }). Throw an Error with .status and .code
6
6
  // for a typed error response; anything else is 500 HANDLER_ERROR.
@@ -38,7 +38,9 @@ export interface TestControl {
38
38
  createManagedUser?(): Promise<ManagedUser>;
39
39
  deleteManagedUser?(id: string): Promise<string | null>;
40
40
  }
41
- export declare function productionControl(client: ApiClient, target: TestTarget): TestControl;
41
+ export declare function productionControl(client: ApiClient, target: TestTarget, options?: {
42
+ liveInboxOnly?: boolean;
43
+ }): TestControl;
42
44
  /** The production control the runner and fixtures always used: your sign-in, the live release. */
43
45
  export declare function openProductionControl(projectId: string, target?: TestTarget): Promise<TestControl>;
44
46
  export declare const PREVIEW_CLOSED_MESSAGE = "The preview is closed, promoted or expired, or its credential was revoked. Open or continue one with `somewhere preview`, then run the tests again.";
@@ -0,0 +1,28 @@
1
+ type Scope = Record<string, string | number>;
2
+ export type FilesRequest = {
3
+ operation: 'upload';
4
+ file: Blob;
5
+ name?: string;
6
+ contentType?: string;
7
+ scope?: Scope;
8
+ } | {
9
+ operation: 'list';
10
+ limit?: number;
11
+ cursor?: string;
12
+ scope?: Scope;
13
+ } | {
14
+ operation: 'url' | 'delete';
15
+ id: string;
16
+ } | {
17
+ operation: 'shareLink';
18
+ id: string;
19
+ expiresIn?: number;
20
+ };
21
+ export interface UploadLink {
22
+ id: string;
23
+ name?: string;
24
+ url: string;
25
+ multipart_url: string;
26
+ }
27
+ export declare function transferTestFile(link: UploadLink, file: Blob, type: string, singleRequestMaxBytes: number): Promise<Response>;
28
+ export {};
@@ -125,6 +125,8 @@ export interface InboxMessage {
125
125
  verification_code: string | null;
126
126
  magic_link: string | null;
127
127
  created_at: string;
128
+ text: string | null;
129
+ html: string | null;
128
130
  }
129
131
  /** Messages for exactly `address` created after `since`, newest first. The server's `since` only
130
132
  * drives the long-poll; the list is filtered here so a stale code is never returned. */
@@ -1,5 +1,7 @@
1
+ import { type FilesRequest } from './test-files.js';
1
2
  import { type TestTarget } from './test-target.js';
2
3
  import { type PlaywrightStorageState } from './test-identities.js';
4
+ export declare function managedFileSession(session: UserSession, root: string, userId: string): void;
3
5
  export declare class UserSession {
4
6
  readonly origin: string;
5
7
  private cookies;
@@ -25,6 +27,8 @@ export declare class UserSession {
25
27
  expectRefused(endpoint: `${string} /${string}`, body?: unknown, options?: {
26
28
  allowed?: UserSession;
27
29
  }): Promise<void>;
30
+ /** Exercise the declared file door as a managed test user. */
31
+ files(collection: string, request: FilesRequest): Promise<Response>;
28
32
  /** Use this session's cookies and the linked app's declared data contract. */
29
33
  data(table: string, request: DataRequest): Promise<Response>;
30
34
  data(table: string, contract: string, request: DataRequest): Promise<Response>;
@@ -1,3 +1,4 @@
1
+ import { type InboxMessage } from './test-identities.js';
1
2
  import { type TestJob, type TestJobOptions, type TestJobTarget } from './testing-jobs.js';
2
3
  import { UserSession } from './test-session.js';
3
4
  export interface TestActor {
@@ -5,10 +6,15 @@ export interface TestActor {
5
6
  email: string;
6
7
  session: UserSession;
7
8
  }
9
+ export interface TestInboxMessage extends InboxMessage {
10
+ links: string[];
11
+ }
8
12
  export interface TestApp {
9
13
  origin: string;
10
14
  anonymous: UserSession;
11
15
  users(count: number): Promise<TestActor[]>;
16
+ testInbox(email: string): Promise<TestInboxMessage[]>;
17
+ signInWithLink(url: string): Promise<TestActor>;
12
18
  create(user: TestActor, table: string, values: Record<string, unknown>, key?: string): Promise<string | number>;
13
19
  plantMarker(user: TestActor, table: string, field: string, values?: Record<string, unknown>): Promise<string>;
14
20
  onCleanup(label: string, action: () => Promise<void>): void;
@@ -10,6 +10,7 @@ interface BrowserPage {
10
10
  }
11
11
  export declare function waitForApp(page: BrowserPage, state?: 'ready' | 'signed-in' | 'signed-out'): Promise<void>;
12
12
  export { test, expect, expectRefused, data, ready, type RefusalOptions, type TestUser, type NewUserOptions, type Person, type SignUpOptions, type SignInOptions, type FormSteps, type CodeSteps } from './lib/playwright-fixtures.js';
13
- export { openTestApp, type TestApp, type TestActor } from './lib/testing-app.js';
13
+ export { openTestApp, type TestApp, type TestActor, type TestInboxMessage } from './lib/testing-app.js';
14
14
  export { assertNoLeak, captureResponses } from './lib/test-response-capture.js';
15
15
  export type { TestJob, TestJobOptions, TestJobTarget } from './lib/testing-jobs.js';
16
+ export type { FilesRequest } from './lib/test-files.js';
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.159",
3
+ "version": "0.38.161",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@somewhere-cloud/cli",
9
- "version": "0.38.159",
9
+ "version": "0.38.161",
10
10
  "license": "MIT",
11
11
  "bin": {
12
12
  "somewhere": "bin/somewhere.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@somewhere-cloud/cli",
3
- "version": "0.38.159",
3
+ "version": "0.38.161",
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": "e2a33e7721dd0c8e144456516e322064aa1acac6"
70
+ "gitHead": "e44d906c70477d45fe053834fb9ef529487ee121"
71
71
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "source_commit": "a9b03532309404fb5db700ad613485b1924044dc",
2
+ "source_commit": "c49f40389a7e5789f3fafd2467e0c5e9d55f201b",
3
3
  "esbuild": "0.24.0",
4
4
  "source_files": {
5
5
  "shared/app-model-catalog.ts": "c9a0119366beabb10157fcc9866f4d32b320b680f1c5717d837a5ca99875fa13",
@@ -9,12 +9,12 @@
9
9
  "shared/transient-read.ts": "2f22daebdc74fed6255a29df7deda0db307f9165c1d9988dba3ee872b2584ffd",
10
10
  "shared/types/placeholder-identity.ts": "089a46e2474a21193d3611eddd9c94b6bbe62441b3039ed80fc8499bada447ca",
11
11
  "worker/containers/compile/checker-contract.cjs": "c6d4ebc9ec058b3562655cc4f18dc1cea7e4492eb35b7f0fd0d87e974c26b492",
12
- "worker/containers/compile/consumer-contract.cjs": "d3d1b735edce04defe198fa806141987ca77a780140d22068a7ffbbff879eaa4",
12
+ "worker/containers/compile/consumer-contract.cjs": "d3c526407fa492b41048472fda63343e1e0af14ec9127815af3f58b461f9a96f",
13
13
  "worker/containers/compile/declared-data-contract.cjs": "ebdc7dbc12283a7218c28e0e912e736ac27a8e9d513b82c097ebff6df3c1dd91",
14
14
  "worker/containers/compile/generated-declarations-render.cjs": "7ffdb34645cc9eccac6eba39dc86b646a41c4de8a1a038d2b5b46f42df9f1157",
15
15
  "worker/containers/compile/generated-declarations.cjs": "6e9902e054c5c784fd9b3c3fafc1869e79954100a45014e1132247cd82833ec4",
16
16
  "worker/containers/compile/groups-types.cjs": "7c22b4bb96c9391005d434852600dc02bc8a6bbb99d78d2b8e3eb152f7b72c58",
17
- "worker/containers/compile/runtime-types.cjs": "a74ee2d726c395f2216528e070813293d08ee7340fbca63f94e015ede1ee6df1",
17
+ "worker/containers/compile/runtime-types.cjs": "5866b2cb5e0d95a2f8779f90a9e981ec30070482bf3f595f6ec2f78d8e3ea382",
18
18
  "worker/containers/compile/schema-types.cjs": "806147ad7224356734020c62441123db16b50ef6456db974c573b226d517e6cc",
19
19
  "worker/containers/compile/typed-data.cjs": "1c8bec853fbee4ffd34c651076a4e1f4d8b18c0c2be5e99e31df7c9283207627",
20
20
  "worker/containers/compile/typed-files.cjs": "f2568567a53994575ede91f9a0839965e64f94eb92ae11315650189b6de0f79c",
@@ -74,5 +74,5 @@
74
74
  "worker/src/utils/telegram.ts": "9aaaa2597c366da1eeee9e2252e9b73e611ea97ed9558f7e07e694d9b393f053",
75
75
  "worker/src/utils/workers-ai-comparison.ts": "18b5d5ea96f817387a5ef49733ba611c99cbb14987143c28118b1c90f3b637d4"
76
76
  },
77
- "sha256": "cf2d3dc90521be56b6fac77e5c524f62ce1b3f020b8d3d61a3a3acb8289db279"
77
+ "sha256": "707f1cbb28d25f458c8d6938d00e6a45c8a8838d6e303dde2d326f842bed3320"
78
78
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "sha256": "b772a41a2cff4357ec5ff47dbf6b7d1ec648d043e16b22ecadff31088437ffe5"
2
+ "sha256": "37e114576bc4188cfc2335171afd96d20f497fd24dffee3980bdb15781816a68"
3
3
  }
@@ -2780,6 +2780,7 @@ interface SomewhereAiChatOptions {
2780
2780
  interface SomewhereAiChatResult {
2781
2781
  content: SomewhereAiContentBlock[];
2782
2782
  text: string;
2783
+ // 'refusal' for a model safety stop.
2783
2784
  stop_reason: string | null;
2784
2785
  model: string | null;
2785
2786
  provider: string;
@@ -3140,6 +3141,7 @@ interface SomewhereAgentRunResult extends Omit<SomewhereAiChatResult, 'cost'> {
3140
3141
  tool_calls_made: number;
3141
3142
  total_input_tokens: number;
3142
3143
  total_output_tokens: number;
3144
+ // Includes 'model_refused', alongside the run's other stop conditions.
3143
3145
  completion_reason: string;
3144
3146
  // Non-enumerable: readable directly, dropped by spread / JSON.stringify.
3145
3147
  readonly steps: SomewhereAgentStep[];
@@ -4090,7 +4092,7 @@ var require_typed_files = __commonJS({
4090
4092
  var crypto2 = require("node:crypto");
4091
4093
  var MODULE_NAME = "somewhere:files";
4092
4094
  var CLIENT_FILE2 = "__somewhere_files.d.ts";
4093
- var SINGLE_REQUEST_MAX_BYTES = 90 * 1024 * 1024;
4095
+ var SINGLE_REQUEST_MAX_BYTES2 = 90 * 1024 * 1024;
4094
4096
  function parseDeclaration(canonical) {
4095
4097
  const parsed = JSON.parse(canonical);
4096
4098
  if (!parsed || parsed.v !== 1 || !Array.isArray(parsed.collections)) throw new Error("declared_files is not a file collection declaration");
@@ -4132,7 +4134,7 @@ var require_typed_files = __commonJS({
4132
4134
  }
4133
4135
  return `${JSON.stringify(collection.name)}: { ${ops.join("; ")} }`;
4134
4136
  }
4135
- function describeFilesClient2(canonical, singleRequestMaxBytes = SINGLE_REQUEST_MAX_BYTES) {
4137
+ function describeFilesClient2(canonical, singleRequestMaxBytes = SINGLE_REQUEST_MAX_BYTES2) {
4136
4138
  const collections = parseDeclaration(canonical);
4137
4139
  const contract = crypto2.createHash("sha256").update(canonical).digest("hex");
4138
4140
  const declaration = `declare module ${JSON.stringify(MODULE_NAME)} {
@@ -4250,7 +4252,7 @@ export{files};
4250
4252
  }
4251
4253
  };
4252
4254
  }
4253
- module2.exports = { MODULE_NAME, CLIENT_FILE: CLIENT_FILE2, SINGLE_REQUEST_MAX_BYTES, describeFilesClient: describeFilesClient2, generateFilesClient, virtualFilesPlugin };
4255
+ module2.exports = { MODULE_NAME, CLIENT_FILE: CLIENT_FILE2, SINGLE_REQUEST_MAX_BYTES: SINGLE_REQUEST_MAX_BYTES2, describeFilesClient: describeFilesClient2, generateFilesClient, virtualFilesPlugin };
4254
4256
  }
4255
4257
  });
4256
4258
 
@@ -4523,8 +4525,8 @@ var require_consumer_contract = __commonJS({
4523
4525
  "worker/containers/compile/consumer-contract.cjs"(exports2, module2) {
4524
4526
  "use strict";
4525
4527
  var CONSUMER_CONTRACT2 = Object.freeze({
4526
- version: 42,
4527
- digest: "a2e64aea9f363bd48107929ab7896d5be267a0e998010222913001f7fe47056c"
4528
+ version: 43,
4529
+ digest: "0d081302e1723dadf797a11876f1aeed00e95e1daf55a4bc647ca1a99b21e1e5"
4528
4530
  });
4529
4531
  var MEMBERSHIPS = "memberships: table({ id: id(), team_id: text(), member_id: text() }, { scope: owner(), client: { read: true } }),";
4530
4532
  var SHARES = "shares: table({ id: id(), grantee_id: text() }, { scope: owner(), client: { read: true, create: ['grantee_id'], delete: true }, unique: [['user_id', 'grantee_id']] }),";
@@ -4634,11 +4636,13 @@ __export(declared_data_vendor_entry_exports, {
4634
4636
  FILES_DECLARATION_FILE: () => import_typed_files2.CLIENT_FILE,
4635
4637
  RUNTIME_CONTEXT_DECLARATION: () => import_runtime_types3.RUNTIME_CONTEXT_DECLARATION,
4636
4638
  SCHEMA_DECLARATION: () => import_schema_types.SCHEMA_DECLARATION,
4639
+ SINGLE_REQUEST_MAX_BYTES: () => import_typed_files2.SINGLE_REQUEST_MAX_BYTES,
4637
4640
  checkerContract: () => checkerContract,
4638
4641
  consumerContractComponents: () => import_consumer_contract.consumerContractComponents,
4639
4642
  consumerContractFingerprint: () => import_consumer_contract.consumerContractFingerprint,
4640
4643
  consumerContractVerdict: () => import_consumer_contract.consumerContractVerdict,
4641
4644
  declaredTablesFromFiles: () => declaredTablesFromFiles,
4645
+ filesContractFromFiles: () => filesContractFromFiles,
4642
4646
  filesDeclarationFromFiles: () => filesDeclarationFromFiles,
4643
4647
  generateFromFiles: () => generateFromFiles,
4644
4648
  isPlainPageScript: () => isPlainPageScript,
@@ -8705,6 +8709,10 @@ function runtimeDeclarationFromFiles(files) {
8705
8709
  function declaredTablesFromFiles(files) {
8706
8710
  return (0, import_runtime_types2.declaredTablesDeclaration)(schemaAuthorityFromSource(files));
8707
8711
  }
8712
+ function filesContractFromFiles(files) {
8713
+ const canonical = declaredFilesFromSource(files);
8714
+ return canonical ? (0, import_typed_files.describeFilesClient)(canonical).contract_digest : void 0;
8715
+ }
8708
8716
  function filesDeclarationFromFiles(files) {
8709
8717
  const canonical = declaredFilesFromSource(files);
8710
8718
  return canonical ? (0, import_typed_files.describeFilesClient)(canonical).declaration : void 0;
@@ -8716,11 +8724,13 @@ function filesDeclarationFromFiles(files) {
8716
8724
  FILES_DECLARATION_FILE,
8717
8725
  RUNTIME_CONTEXT_DECLARATION,
8718
8726
  SCHEMA_DECLARATION,
8727
+ SINGLE_REQUEST_MAX_BYTES,
8719
8728
  checkerContract,
8720
8729
  consumerContractComponents,
8721
8730
  consumerContractFingerprint,
8722
8731
  consumerContractVerdict,
8723
8732
  declaredTablesFromFiles,
8733
+ filesContractFromFiles,
8724
8734
  filesDeclarationFromFiles,
8725
8735
  generateFromFiles,
8726
8736
  isPlainPageScript,
package/src/testing.ts CHANGED
@@ -16,6 +16,7 @@ export function waitForApp(page: BrowserPage, state: 'ready' | 'signed-in' | 'si
16
16
  // Lazy project-local Playwright resolution keeps UserSession dependency-free.
17
17
  export { test, expect, expectRefused, data, ready, type RefusalOptions, type TestUser, type NewUserOptions, type Person, type SignUpOptions, type SignInOptions, type FormSteps, type CodeSteps } from './lib/playwright-fixtures.js';
18
18
 
19
- export { openTestApp, type TestApp, type TestActor } from './lib/testing-app.js';
19
+ export { openTestApp, type TestApp, type TestActor, type TestInboxMessage } from './lib/testing-app.js';
20
20
  export { assertNoLeak, captureResponses } from './lib/test-response-capture.js';
21
21
  export type { TestJob, TestJobOptions, TestJobTarget } from './lib/testing-jobs.js';
22
+ export type { FilesRequest } from './lib/test-files.js';