@salsita-ai/contracts 0.50.0-develop.9feae4851f → 0.50.0-develop.a3e5495063

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/README.md CHANGED
@@ -15,7 +15,7 @@ There is no package-root export. Import from the path that owns the boundary; th
15
15
 
16
16
  | Entry point | Boundary it defines |
17
17
  | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
18
- | `api` | API access levels, session roles, and access and session token payloads. |
18
+ | `api` | API access levels, session roles, access/session token payloads, and Studio browser-session response schema. |
19
19
  | `clerk` | Clerk backend client and services and the shared user, invitation, role, and token schemas. |
20
20
  | `domain` | Branded deployment, customer, project, environment, configuration, and revision data: types, schemas, constructors, and the state values clients compare against. |
21
21
  | `chat` | Chat completion and stream chunks, tool definitions, validation, speech, and embeddings. |
@@ -2,3 +2,4 @@ export { AccessLevel } from './access-level.js';
2
2
  export { SessionRole } from './session-role.js';
3
3
  export { type SessionTokenPayload } from './session-token.js';
4
4
  export { type AccessTokenPayload } from './access-token.js';
5
+ export { StudioSession } from './studio-session.js';
package/dist/api/index.js CHANGED
@@ -1 +1 @@
1
- export{AccessLevel}from"./access-level.js";export{SessionRole}from"./session-role.js";
1
+ export{AccessLevel}from"./access-level.js";export{SessionRole}from"./session-role.js";export{StudioSession}from"./studio-session.js";
@@ -0,0 +1,54 @@
1
+ import { z } from 'zod';
2
+ /** Account and current memberships of a fixed-lifetime Studio browser session; grants no workspace API access. */
3
+ export declare const StudioSession: z.ZodObject<{
4
+ userId: z.ZodString;
5
+ expiresAt: z.ZodNumber;
6
+ workspaces: z.ZodArray<z.ZodObject<{
7
+ customerId: z.ZodString;
8
+ slug: z.ZodString;
9
+ name: z.ZodString;
10
+ type: z.ZodNativeEnum<{
11
+ readonly Standard: 'standard';
12
+ readonly SdkBuilder: 'sdk_builder';
13
+ }>;
14
+ role: z.ZodEnum<["user", "admin", "superadmin"]>;
15
+ tags: z.ZodArray<z.ZodString, "many">;
16
+ }, "strip", z.ZodTypeAny, {
17
+ customerId: string;
18
+ slug: string;
19
+ name: string;
20
+ type: "sdk_builder" | "standard";
21
+ role: "admin" | "superadmin" | "user";
22
+ tags: string[];
23
+ }, {
24
+ customerId: string;
25
+ slug: string;
26
+ name: string;
27
+ type: "sdk_builder" | "standard";
28
+ role: "admin" | "superadmin" | "user";
29
+ tags: string[];
30
+ }>, "many">;
31
+ }, "strip", z.ZodTypeAny, {
32
+ userId: string;
33
+ expiresAt: number;
34
+ workspaces: {
35
+ customerId: string;
36
+ slug: string;
37
+ name: string;
38
+ type: "sdk_builder" | "standard";
39
+ role: "admin" | "superadmin" | "user";
40
+ tags: string[];
41
+ }[];
42
+ }, {
43
+ userId: string;
44
+ expiresAt: number;
45
+ workspaces: {
46
+ customerId: string;
47
+ slug: string;
48
+ name: string;
49
+ type: "sdk_builder" | "standard";
50
+ role: "admin" | "superadmin" | "user";
51
+ tags: string[];
52
+ }[];
53
+ }>;
54
+ export type StudioSession = z.infer<typeof StudioSession>;
@@ -0,0 +1 @@
1
+ import{z as r}from"zod";import{CustomerTypeSchema as s}from"../domain/index.js";export const StudioSession=r.object({userId:r.string().uuid(),expiresAt:r.number(),workspaces:r.array(r.object({customerId:r.string().uuid(),slug:r.string(),name:r.string(),type:s,role:r.enum(["user","admin","superadmin"]),tags:r.array(r.string())}))});
@@ -20,19 +20,27 @@ export interface AssistantAiSettings {
20
20
  readonly provider: AssistantAiProvider;
21
21
  readonly model: AssistantModelTier;
22
22
  readonly reasoning: AssistantReasoningLevel;
23
+ /**
24
+ * How many input tokens a model call of a thread may reach before the thread is compacted on the
25
+ * user's next message. Defaults to the server's limit; the server also caps it.
26
+ */
27
+ readonly maxThreadSize?: number | undefined;
23
28
  }
24
29
  export declare const AssistantAiSettings: z.ZodObject<{
25
30
  provider: z.ZodEnum<["openai"]>;
26
31
  model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
27
32
  reasoning: z.ZodEnum<["low", "medium", "high"]>;
33
+ maxThreadSize: z.ZodOptional<z.ZodNumber>;
28
34
  }, "strict", z.ZodTypeAny, {
29
35
  provider: "openai";
30
36
  model: "advanced" | "balanced" | "fast" | "frontier";
31
37
  reasoning: "high" | "low" | "medium";
38
+ maxThreadSize?: number | undefined;
32
39
  }, {
33
40
  provider: "openai";
34
41
  model: "advanced" | "balanced" | "fast" | "frontier";
35
42
  reasoning: "high" | "low" | "medium";
43
+ maxThreadSize?: number | undefined;
36
44
  }>;
37
45
  /**
38
46
  * The setup returned by a deployment webhook: GraphQL SDL, SDK-generated prompt, integrator
@@ -53,14 +61,17 @@ export declare const DeploymentAssistant: z.ZodObject<{
53
61
  provider: z.ZodEnum<["openai"]>;
54
62
  model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
55
63
  reasoning: z.ZodEnum<["low", "medium", "high"]>;
64
+ maxThreadSize: z.ZodOptional<z.ZodNumber>;
56
65
  }, "strict", z.ZodTypeAny, {
57
66
  provider: "openai";
58
67
  model: "advanced" | "balanced" | "fast" | "frontier";
59
68
  reasoning: "high" | "low" | "medium";
69
+ maxThreadSize?: number | undefined;
60
70
  }, {
61
71
  provider: "openai";
62
72
  model: "advanced" | "balanced" | "fast" | "frontier";
63
73
  reasoning: "high" | "low" | "medium";
74
+ maxThreadSize?: number | undefined;
64
75
  }>;
65
76
  }, "strict", z.ZodTypeAny, {
66
77
  sdl: string;
@@ -70,6 +81,7 @@ export declare const DeploymentAssistant: z.ZodObject<{
70
81
  provider: "openai";
71
82
  model: "advanced" | "balanced" | "fast" | "frontier";
72
83
  reasoning: "high" | "low" | "medium";
84
+ maxThreadSize?: number | undefined;
73
85
  };
74
86
  }, {
75
87
  sdl: string;
@@ -79,5 +91,6 @@ export declare const DeploymentAssistant: z.ZodObject<{
79
91
  provider: "openai";
80
92
  model: "advanced" | "balanced" | "fast" | "frontier";
81
93
  reasoning: "high" | "low" | "medium";
94
+ maxThreadSize?: number | undefined;
82
95
  };
83
96
  }>;
@@ -1 +1 @@
1
- import{z as t}from"zod";export const ASSISTANT_AI_PROVIDERS=["openai"];export const ASSISTANT_MODEL_TIERS=["frontier","advanced","balanced","fast"];export const ASSISTANT_REASONING_LEVELS=["low","medium","high"];export const AssistantAiSettings=t.object({provider:t.enum(ASSISTANT_AI_PROVIDERS),model:t.enum(ASSISTANT_MODEL_TIERS),reasoning:t.enum(ASSISTANT_REASONING_LEVELS)}).strict();export const DeploymentAssistant=t.object({sdl:t.string().min(1),prompt:t.string().min(1),instructions:t.string().min(1).optional(),ai:AssistantAiSettings}).strict();
1
+ import{z as t}from"zod";export const ASSISTANT_AI_PROVIDERS=["openai"];export const ASSISTANT_MODEL_TIERS=["frontier","advanced","balanced","fast"];export const ASSISTANT_REASONING_LEVELS=["low","medium","high"];export const AssistantAiSettings=t.object({provider:t.enum(ASSISTANT_AI_PROVIDERS),model:t.enum(ASSISTANT_MODEL_TIERS),reasoning:t.enum(ASSISTANT_REASONING_LEVELS),maxThreadSize:t.number().int().positive().optional()}).strict();export const DeploymentAssistant=t.object({sdl:t.string().min(1),prompt:t.string().min(1),instructions:t.string().min(1).optional(),ai:AssistantAiSettings}).strict();
@@ -49,7 +49,7 @@ export declare const AssistantGraphQLToolInput: z.ZodObject<{
49
49
  * Client-side tool of the assistant chat that reads the configuration: the browser runs the
50
50
  * operations against the configurator's GraphQL schema from the committed state and discards every
51
51
  * change, so mutations in the list answer "what if" questions. The result is the list of standard
52
- * GraphQL results with `committed: false`.
52
+ * GraphQL results with `committed: false`, followed by the pictures of the screenshots they took.
53
53
  *
54
54
  * The server passes the definition to the model without an implementation, so every call becomes a
55
55
  * client-tool interrupt; the SDK registers the browser implementation via `.client()`.
@@ -1 +1 @@
1
- import{toolDefinition as e}from"@tanstack/ai";import{z as t}from"zod";export const AssistantGraphQLToolInput=t.object({operations:t.array(t.object({query:t.string(),variables:t.record(t.unknown()).nullish(),operationName:t.string().nullish()})).min(1)});let o={type:"object",properties:{operations:{type:"array",minItems:1,description:"The operations to run, in order. Each one sees the changes of the ones before it.",items:{type:"object",properties:{query:{type:"string",description:"A GraphQL document with exactly one operation, a query or a mutation."},variables:{type:"object",description:"Values of the variables the document declares. Prefer literals written into the document."},operationName:{type:"string",description:"The name of the operation, when the document names it."}},required:["query"]}}},required:["operations"]};export const queryTool=e({name:"query",description:"Reads the open configuration: runs GraphQL operations and returns their results. Changes nothing; mutations run on a copy discarded after the call.",inputSchema:o});export const applyTool=e({name:"apply",description:"Changes the open configuration: runs GraphQL operations and keeps their changes as one undo step. All or nothing: when any operation fails, nothing changes. `committed` says whether the changes were kept.",inputSchema:o});
1
+ import{toolDefinition as e}from"@tanstack/ai";import{z as t}from"zod";export const AssistantGraphQLToolInput=t.object({operations:t.array(t.object({query:t.string(),variables:t.record(t.unknown()).nullish(),operationName:t.string().nullish()})).min(1)});let o={type:"object",properties:{operations:{type:"array",minItems:1,description:"The operations to run, in order. Each one sees the changes of the ones before it.",items:{type:"object",properties:{query:{type:"string",description:"A GraphQL document with exactly one operation, a query or a mutation."},variables:{type:"object",description:"Values of the variables the document declares. Prefer literals written into the document."},operationName:{type:"string",description:"The name of the operation, when the document names it."}},required:["query"]}}},required:["operations"]};export const queryTool=e({name:"query",description:"Reads the open configuration: runs GraphQL operations and returns their results. Changes nothing; mutations run on a copy discarded after the call. Screenshots the operations take follow the results as images, each after its label.",inputSchema:o});export const applyTool=e({name:"apply",description:"Changes the open configuration: runs GraphQL operations and keeps their changes as one undo step. All or nothing: when any operation fails, nothing changes. `committed` says whether the changes were kept. Screenshots the operations take follow the results as images, each after its label.",inputSchema:o});
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The URL an image part of an assistant tool result carries for a screenshot the browser uploaded:
3
+ * `assistant-image:<imageId>`, the id the server's image upload answered with. The thread stores
4
+ * the reference; the server swaps it for the image only in the copy of the thread sent to the model,
5
+ * and the panel fetches the image by its id.
6
+ */
7
+ export declare const assistantImageReference: (imageId: string) => string;
8
+ /** The image id of an `assistant-image:` reference; `null` for any other URL. */
9
+ export declare const readAssistantImageReference: (url: string) => string | null;
@@ -0,0 +1 @@
1
+ let e="assistant-image:",t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;export const assistantImageReference=t=>`${e}${t}`;export const readAssistantImageReference=a=>{if(!a.startsWith(e))return null;let s=a.slice(e.length);return t.test(s)?s:null};
@@ -3,6 +3,7 @@ export { ASSISTANT_AI_PROVIDERS, ASSISTANT_MODEL_TIERS, ASSISTANT_REASONING_LEVE
3
3
  export { AssistantGraphQLToolInput, applyTool, queryTool } from './graphql-tools.js';
4
4
  export type { AssistantGraphQLOperation } from './graphql-tools.js';
5
5
  export type { AssistantAiProvider, AssistantModelTier, AssistantReasoningLevel } from './deployment-assistant.js';
6
+ export { assistantImageReference, readAssistantImageReference } from './image-reference.js';
6
7
  export { AssistantMessageMetadata } from './message-metadata.js';
7
8
  export { ASSISTANT_TOOL_ERROR_CODES, AssistantToolError } from './tool-error.js';
8
9
  export type { AssistantToolErrorCode } from './tool-error.js';
@@ -1 +1 @@
1
- export{browserDetailsTool}from"./browser-details-tool.js";export{ASSISTANT_AI_PROVIDERS,ASSISTANT_MODEL_TIERS,ASSISTANT_REASONING_LEVELS,AssistantAiSettings,DeploymentAssistant}from"./deployment-assistant.js";export{AssistantGraphQLToolInput,applyTool,queryTool}from"./graphql-tools.js";export{AssistantMessageMetadata}from"./message-metadata.js";export{ASSISTANT_TOOL_ERROR_CODES,AssistantToolError}from"./tool-error.js";
1
+ export{browserDetailsTool}from"./browser-details-tool.js";export{ASSISTANT_AI_PROVIDERS,ASSISTANT_MODEL_TIERS,ASSISTANT_REASONING_LEVELS,AssistantAiSettings,DeploymentAssistant}from"./deployment-assistant.js";export{AssistantGraphQLToolInput,applyTool,queryTool}from"./graphql-tools.js";export{assistantImageReference,readAssistantImageReference}from"./image-reference.js";export{AssistantMessageMetadata}from"./message-metadata.js";export{ASSISTANT_TOOL_ERROR_CODES,AssistantToolError}from"./tool-error.js";
@@ -1,4 +1,5 @@
1
1
  import { Branded, type ValueOf } from '@salsita-ai/common/utils';
2
+ import type { ApiTokenId } from './api-token-domain.js';
2
3
  import type { DeploymentId } from './deployment-domain.js';
3
4
  import type { EnvironmentId } from './environment-domain.js';
4
5
  export type DeploymentBuildId = Branded<'DeploymentBuildId', string>;
@@ -53,11 +54,20 @@ export declare const DeploymentBuildStatus: ((value: string) => DeploymentBuildS
53
54
  export interface DeploymentBuild {
54
55
  readonly id: DeploymentBuildId;
55
56
  readonly environmentId: EnvironmentId;
57
+ readonly number: number | null;
56
58
  readonly mode: DeploymentBuildMode;
57
59
  readonly status: DeploymentBuildStatus;
58
60
  readonly sourceKey: DeploymentBuildSourceKey | null;
59
61
  readonly sdkVersion: string | null;
62
+ readonly rebuiltFrom: {
63
+ readonly buildId: DeploymentBuildId;
64
+ readonly number: number | null;
65
+ } | null;
60
66
  readonly createdByUserId: string | null;
67
+ readonly apiToken: {
68
+ readonly id: ApiTokenId;
69
+ readonly name: string;
70
+ } | null;
61
71
  readonly deploymentId: DeploymentId | null;
62
72
  readonly error: string | null;
63
73
  readonly createdAt: Date;
@@ -344,14 +344,17 @@ export declare const AssistantSetupResponse: z.ZodObject<{
344
344
  provider: z.ZodEnum<["openai"]>;
345
345
  model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
346
346
  reasoning: z.ZodEnum<["low", "medium", "high"]>;
347
+ maxThreadSize: z.ZodOptional<z.ZodNumber>;
347
348
  }, "strict", z.ZodTypeAny, {
348
349
  provider: "openai";
349
350
  model: "advanced" | "balanced" | "fast" | "frontier";
350
351
  reasoning: "high" | "low" | "medium";
352
+ maxThreadSize?: number | undefined;
351
353
  }, {
352
354
  provider: "openai";
353
355
  model: "advanced" | "balanced" | "fast" | "frontier";
354
356
  reasoning: "high" | "low" | "medium";
357
+ maxThreadSize?: number | undefined;
355
358
  }>;
356
359
  }, "strict", z.ZodTypeAny, {
357
360
  sdl: string;
@@ -361,6 +364,7 @@ export declare const AssistantSetupResponse: z.ZodObject<{
361
364
  provider: "openai";
362
365
  model: "advanced" | "balanced" | "fast" | "frontier";
363
366
  reasoning: "high" | "low" | "medium";
367
+ maxThreadSize?: number | undefined;
364
368
  };
365
369
  }, {
366
370
  sdl: string;
@@ -370,6 +374,7 @@ export declare const AssistantSetupResponse: z.ZodObject<{
370
374
  provider: "openai";
371
375
  model: "advanced" | "balanced" | "fast" | "frontier";
372
376
  reasoning: "high" | "low" | "medium";
377
+ maxThreadSize?: number | undefined;
373
378
  };
374
379
  }>>;
375
380
  threadLock: z.ZodOptional<z.ZodLiteral<"strict">>;
@@ -382,6 +387,7 @@ export declare const AssistantSetupResponse: z.ZodObject<{
382
387
  provider: "openai";
383
388
  model: "advanced" | "balanced" | "fast" | "frontier";
384
389
  reasoning: "high" | "low" | "medium";
390
+ maxThreadSize?: number | undefined;
385
391
  };
386
392
  } | null;
387
393
  threadLock?: "strict" | undefined;
@@ -394,6 +400,7 @@ export declare const AssistantSetupResponse: z.ZodObject<{
394
400
  provider: "openai";
395
401
  model: "advanced" | "balanced" | "fast" | "frontier";
396
402
  reasoning: "high" | "low" | "medium";
403
+ maxThreadSize?: number | undefined;
397
404
  };
398
405
  } | null;
399
406
  threadLock?: "strict" | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salsita-ai/contracts",
3
- "version": "0.50.0-develop.9feae4851f",
3
+ "version": "0.50.0-develop.a3e5495063",
4
4
  "description": "Shared API, authentication, domain, chat, and webhook contracts for Phoenix.",
5
5
  "keywords": [
6
6
  "salsita",
@@ -48,23 +48,19 @@
48
48
  "@tanstack/ai": "0.64.0",
49
49
  "@types/aws-lambda": "8.10.133",
50
50
  "ajv": "8.20.0",
51
- "http-errors": "2.0.1",
52
51
  "jose": "6.2.3",
53
- "lodash-es": "4.18.1",
54
52
  "openai": "7.23.0",
55
53
  "ts-pattern": "5.9.0",
56
54
  "uuid": "14.0.0",
57
55
  "valid-url": "1.0.9",
58
56
  "zod": "3.25.76",
59
- "@salsita-ai/common": "0.50.0-develop.9feae4851f"
57
+ "@salsita-ai/common": "0.50.0-develop.a3e5495063"
60
58
  },
61
59
  "devDependencies": {
62
60
  "@lingui/core": "5.9.5",
63
61
  "@swc/cli": "0.8.1",
64
62
  "@swc/core": "1.15.40",
65
- "@types/http-errors": "2.0.5",
66
63
  "@types/json-schema": "7.0.15",
67
- "@types/lodash-es": "4.17.12",
68
64
  "@types/valid-url": "1.0.7",
69
65
  "eslint": "9.39.4",
70
66
  "prettier": "3.8.3",