@salsita-ai/contracts 0.50.0-develop.c28cfb7ded → 0.50.0-develop.c402728d10

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,13 +15,15 @@ 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. |
22
22
  | `assistant` | Experimental assistant: shared client-tool definitions, user-message metadata, server-recorded tool errors and the deployment webhook setup shape. |
23
23
  | `webhook` | Webhook clients and building blocks, finalization tasks and resources, spreadsheet adapters. |
24
24
 
25
+ The gzip and development-tunnel wire contracts are defined in [Webhook transports](../../../docs/architecture/background-jobs.md#webhook-transports).
26
+
25
27
  Runtime schemas and TypeScript types are kept aligned, so a value that passes the schema has the declared type.
26
28
 
27
29
  ## Licence
@@ -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())}))});
@@ -11,6 +11,8 @@ export interface AssistantGraphQLOperation {
11
11
  * against the configurator's GraphQL schema, each one seeing the changes of the ones before it.
12
12
  */
13
13
  export interface AssistantGraphQLToolInput {
14
+ /** A short name of the call for the user, in their language; the panel shows it on the call's chip. */
15
+ readonly title?: string | null;
14
16
  readonly operations: ReadonlyArray<AssistantGraphQLOperation>;
15
17
  }
16
18
  /**
@@ -19,6 +21,7 @@ export interface AssistantGraphQLToolInput {
19
21
  * out; the tools are not sent as strict schemas, because `variables` is a free-form map.
20
22
  */
21
23
  export declare const AssistantGraphQLToolInput: z.ZodObject<{
24
+ title: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
22
25
  operations: z.ZodArray<z.ZodObject<{
23
26
  query: z.ZodString;
24
27
  variables: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
@@ -33,12 +36,14 @@ export declare const AssistantGraphQLToolInput: z.ZodObject<{
33
36
  operationName?: string | null | undefined;
34
37
  }>, "many">;
35
38
  }, "strip", z.ZodTypeAny, {
39
+ title?: string | null | undefined;
36
40
  operations: {
37
41
  query: string;
38
42
  variables?: Record<string, unknown> | null | undefined;
39
43
  operationName?: string | null | undefined;
40
44
  }[];
41
45
  }, {
46
+ title?: unknown;
42
47
  operations: {
43
48
  query: string;
44
49
  variables?: Record<string, unknown> | null | undefined;
@@ -49,7 +54,7 @@ export declare const AssistantGraphQLToolInput: z.ZodObject<{
49
54
  * Client-side tool of the assistant chat that reads the configuration: the browser runs the
50
55
  * operations against the configurator's GraphQL schema from the committed state and discards every
51
56
  * change, so mutations in the list answer "what if" questions. The result is the list of standard
52
- * GraphQL results with `committed: false`.
57
+ * GraphQL results with `committed: false`, followed by the pictures of the screenshots they took.
53
58
  *
54
59
  * The server passes the definition to the model without an implementation, so every call becomes a
55
60
  * client-tool interrupt; the SDK registers the browser implementation via `.client()`.
@@ -57,6 +62,10 @@ export declare const AssistantGraphQLToolInput: z.ZodObject<{
57
62
  export declare const queryTool: import("@tanstack/ai").ToolDefinition<{
58
63
  type: string;
59
64
  properties: {
65
+ title: {
66
+ type: string;
67
+ description: string;
68
+ };
60
69
  operations: {
61
70
  type: string;
62
71
  minItems: number;
@@ -92,6 +101,10 @@ export declare const queryTool: import("@tanstack/ai").ToolDefinition<{
92
101
  export declare const applyTool: import("@tanstack/ai").ToolDefinition<{
93
102
  type: string;
94
103
  properties: {
104
+ title: {
105
+ type: string;
106
+ description: string;
107
+ };
95
108
  operations: {
96
109
  type: string;
97
110
  minItems: number;
@@ -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({title:t.string().nullish().catch(void 0),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:{title:{type:"string",description:"A short name of this call for the user, two to five words in their language, saying what it does."},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. `errors` say why an operation failed; `warnings` are what its changes would newly cause, and do not make it fail. 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. `errors` say why an operation failed; `warnings` are what the changes newly cause, and do not stop them. Screenshots the operations take follow the results as images, each after its label.",inputSchema:o});
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The URL an image part carries for an image the browser uploaded, a screenshot in an assistant tool
3
+ * result or an image the user attached to their message: `assistant-image:<imageId>`, the id the
4
+ * server's image upload answered with. The thread stores
5
+ * the reference; the server swaps it for the image only in the copy of the thread sent to the model,
6
+ * and the panel fetches the image by its id.
7
+ */
8
+ export declare const assistantImageReference: (imageId: string) => string;
9
+ /** The image id of an `assistant-image:` reference; `null` for any other URL. */
10
+ 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";
@@ -2,16 +2,25 @@ import { z } from 'zod';
2
2
  /**
3
3
  * Metadata the assistant chat client attaches to each user message (AG-UI message `metadata`). It is
4
4
  * persisted with the message, and the server shows `changes` to the model in front of the message, so
5
- * the model knows what the user did in the configurator since it last acted.
5
+ * the model knows what the user did in the configurator since it last acted. It also tells the model
6
+ * which language to reply in, on a thread's first user message and wherever `locale` changed.
6
7
  */
7
8
  export interface AssistantMessageMetadata {
8
9
  /** The change record since the agent's previous action: a marker or a diff, as the assistant prompt describes it. */
9
10
  readonly changes: string;
11
+ /**
12
+ * The locale the configurator showed when the user sent the message, as its i18n code (e.g. `de` or
13
+ * `de-AT`). Absent on messages from clients and versions that do not send it.
14
+ */
15
+ readonly locale?: string;
10
16
  }
11
17
  export declare const AssistantMessageMetadata: z.ZodObject<{
12
18
  changes: z.ZodString;
19
+ locale: z.ZodOptional<z.ZodString>;
13
20
  }, "strip", z.ZodTypeAny, {
14
21
  changes: string;
22
+ locale?: string | undefined;
15
23
  }, {
16
24
  changes: string;
25
+ locale?: string | undefined;
17
26
  }>;
@@ -1 +1 @@
1
- import{z as t}from"zod";export const AssistantMessageMetadata=t.object({changes:t.string()});
1
+ import{z as t}from"zod";export const AssistantMessageMetadata=t.object({changes:t.string(),locale:t.string().optional()});
@@ -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;
@@ -0,0 +1,3 @@
1
+ import type { APIGatewayProxyStructuredResultV2 } from 'aws-lambda';
2
+ import type { FetchBackendDataHandlerResponse } from './webhook-api-types.js';
3
+ export declare const createBackendDataResponse: (result: FetchBackendDataHandlerResponse, acceptEncoding: string | undefined) => Promise<APIGatewayProxyStructuredResultV2>;
@@ -0,0 +1 @@
1
+ export const createBackendDataResponse=async(e,t)=>{let n,r,i,s=JSON.stringify(e),o={"content-type":"application/json",vary:"Accept-Encoding"};if(32768>Buffer.byteLength(s,"utf8")||!((i=(r=(n=(t??"").split(",").map(e=>{let[t,...n]=e.trim().toLowerCase().split(";"),r=n.map(e=>e.trim()).find(e=>e.startsWith("q=")),i=void 0===r?"1":r.slice(2).trim();return{encoding:t?.trim(),quality:/^(?:0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/.test(i)?Number(i):0}})).filter(e=>"gzip"===e.encoding)).length>0?r:n.filter(e=>"*"===e.encoding)).length>0&&i.every(e=>e.quality>0)))return{statusCode:200,headers:o,body:s};let a=await new Response(new Blob([s]).stream().pipeThrough(new CompressionStream("gzip"))).arrayBuffer(),p=Buffer.from(a).toString("base64");return p.length>=Buffer.byteLength(s,"utf8")?{statusCode:200,headers:o,body:s}:{statusCode:200,headers:{...o,"content-encoding":"gzip"},body:p,isBase64Encoded:!0}};
@@ -1 +1 @@
1
- import{P as o,match as t}from"ts-pattern";import{ApplicationType as r}from"../../domain/index.js";import{validateTaskConfiguration as n}from"../tasks/index.js";import{AssistantSetupPayload as e,AssistantSetupResponse as i,AuthPayload as a,CallbackPayload as s,FetchBackendDataPayload as f,FinalizeWebhookPayload as u}from"./webhook-api-types.js";let c="assistantSetup",h="auth",d="finalize",p="callback",l="fetchBackendData";export const getAssistantSetupRoute=()=>`?o=${c}`;export const getAuthRoute=()=>`?o=${h}`;export const getFinalizeRoute=o=>`?o=${d}&t=${o}`;export const getCallbackRoute=()=>`?o=${p}`;export const getFetchBackendDataRoute=()=>`?o=${l}`;export const handleWebhookSafely=(o,t)=>async r=>{try{return await o(r)}catch(n){let o=`Webhook failed: ${n instanceof Error?n.message:"Unknown error"}`,r="object"==typeof n&&n instanceof Error?n:Error(o);return t.error(o,{},r),{statusCode:500,body:JSON.stringify({message:o})}}};export const routeWebhookRequests=(g,w)=>handleWebhookSafely(async y=>{if(!y.body)throw Error("No body found in the webhook event!");let b=JSON.parse(y.isBase64Encoded?Buffer.from(y.body,"base64").toString():y.body);return t(y.queryStringParameters?.o).with(c,async()=>{if(!g.configurator?.onAssistantSetup)throw Error("Assistant setup operation is not configured for this webhook!");let o=await g.configurator.onAssistantSetup(e.parse(b),y);return{statusCode:200,body:JSON.stringify(i.parse(o))}}).with(h,async()=>{if(w.info("Handling auth operation."),!g.onAuth)throw Error("Auth operation is not configured for this webhook!");let o=a.parse(b);return{statusCode:200,body:JSON.stringify(await g.onAuth(o,y))}}).with(p,async()=>{if(w.info("Handling configurator callback operation."),!g.configurator?.onCallback)throw Error("Auth operation is not configured for this webhook!");let o=s.parse(b);return{statusCode:200,body:JSON.stringify(await g.configurator.onCallback(o,y))}}).with(o.union(void 0,d),()=>t(y.queryStringParameters?.t).with(r.Admin,async()=>{if(w.info("Handling admin finalize operation."),!g.admin?.onFinalize)throw Error("Admin finalize operation is not configured for this webhook!");let o=u.parse(b),t=await g.admin.onFinalize(o,y);return n(t),{statusCode:200,body:JSON.stringify(t)}}).with(o.union(void 0,r.Configurator),async()=>{if(w.info("Handling configurator finalize operation."),!g.configurator?.onFinalize)throw Error("Configurator finalize operation is not configured for this webhook!");let o=u.parse(b),t=await g.configurator.onFinalize(o,y);return n(t),{statusCode:200,body:JSON.stringify(t)}}).otherwise(o=>{throw Error(`Can not parse application type - unknown type: ${o}!`)})).with(l,async()=>{if(w.info("Handling fetch backend data operation."),!g.configurator?.onFetchBackendData)throw Error("Fetch backend data operation is not configured for this webhook!");let o=f.parse(b);return{statusCode:200,body:JSON.stringify(await g.configurator.onFetchBackendData(o,y))}}).otherwise(o=>{throw Error(`Can not parse webhook operation - unknown operation: ${o}!`)})},w);
1
+ import{P as o,match as t}from"ts-pattern";import{ApplicationType as r}from"../../domain/index.js";import{validateTaskConfiguration as e}from"../tasks/index.js";import{createBackendDataResponse as n}from"./backend-data-response.js";import{AssistantSetupPayload as a,AssistantSetupResponse as i,AuthPayload as s,CallbackPayload as f,FetchBackendDataPayload as c,FinalizeWebhookPayload as u}from"./webhook-api-types.js";let d="assistantSetup",h="auth",p="finalize",l="callback",g="fetchBackendData";export const getAssistantSetupRoute=()=>`?o=${d}`;export const getAuthRoute=()=>`?o=${h}`;export const getFinalizeRoute=o=>`?o=${p}&t=${o}`;export const getCallbackRoute=()=>`?o=${l}`;export const getFetchBackendDataRoute=()=>`?o=${g}`;export const handleWebhookSafely=(o,t)=>async r=>{try{return await o(r)}catch(e){let o=`Webhook failed: ${e instanceof Error?e.message:"Unknown error"}`,r="object"==typeof e&&e instanceof Error?e:Error(o);return t.error(o,{},r),{statusCode:500,body:JSON.stringify({message:o})}}};export const routeWebhookRequests=(w,b)=>handleWebhookSafely(async y=>{if(!y.body)throw Error("No body found in the webhook event!");let k=JSON.parse(y.isBase64Encoded?Buffer.from(y.body,"base64").toString():y.body);return t(y.queryStringParameters?.o).with(d,async()=>{if(!w.configurator?.onAssistantSetup)throw Error("Assistant setup operation is not configured for this webhook!");let o=await w.configurator.onAssistantSetup(a.parse(k),y);return{statusCode:200,body:JSON.stringify(i.parse(o))}}).with(h,async()=>{if(b.info("Handling auth operation."),!w.onAuth)throw Error("Auth operation is not configured for this webhook!");let o=s.parse(k);return{statusCode:200,body:JSON.stringify(await w.onAuth(o,y))}}).with(l,async()=>{if(b.info("Handling configurator callback operation."),!w.configurator?.onCallback)throw Error("Auth operation is not configured for this webhook!");let o=f.parse(k);return{statusCode:200,body:JSON.stringify(await w.configurator.onCallback(o,y))}}).with(o.union(void 0,p),()=>t(y.queryStringParameters?.t).with(r.Admin,async()=>{if(b.info("Handling admin finalize operation."),!w.admin?.onFinalize)throw Error("Admin finalize operation is not configured for this webhook!");let o=u.parse(k),t=await w.admin.onFinalize(o,y);return e(t),{statusCode:200,body:JSON.stringify(t)}}).with(o.union(void 0,r.Configurator),async()=>{if(b.info("Handling configurator finalize operation."),!w.configurator?.onFinalize)throw Error("Configurator finalize operation is not configured for this webhook!");let o=u.parse(k),t=await w.configurator.onFinalize(o,y);return e(t),{statusCode:200,body:JSON.stringify(t)}}).otherwise(o=>{throw Error(`Can not parse application type - unknown type: ${o}!`)})).with(g,async()=>{if(b.info("Handling fetch backend data operation."),!w.configurator?.onFetchBackendData)throw Error("Fetch backend data operation is not configured for this webhook!");let o=c.parse(k);return n(await w.configurator.onFetchBackendData(o,y),Object.entries(y.headers).find(([o])=>"accept-encoding"===o.toLowerCase())?.[1])}).otherwise(o=>{throw Error(`Can not parse webhook operation - unknown operation: ${o}!`)})},b);
@@ -28,23 +28,29 @@ export declare const TunneledWebhookResponse: z.ZodObject<{
28
28
  status: z.ZodNumber;
29
29
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
30
30
  body: z.ZodString;
31
+ isBase64Encoded: z.ZodOptional<z.ZodBoolean>;
31
32
  }, "strip", z.ZodTypeAny, {
32
33
  status: number;
33
34
  headers?: Record<string, string> | undefined;
34
35
  body: string;
36
+ isBase64Encoded?: boolean | undefined;
35
37
  }, {
36
38
  status: number;
37
39
  headers?: Record<string, string> | undefined;
38
40
  body: string;
41
+ isBase64Encoded?: boolean | undefined;
39
42
  }>;
40
43
  export type TunneledWebhookResponse = z.infer<typeof TunneledWebhookResponse>;
41
44
  /** Payload used to claim a development deployment and wait for its next webhook request. */
42
45
  export declare const WebhookTunnelPollRequest: z.ZodObject<{
43
46
  sessionId: z.ZodString;
47
+ acceptResponseEncoding: z.ZodOptional<z.ZodLiteral<"gzip">>;
44
48
  }, "strip", z.ZodTypeAny, {
45
49
  sessionId: string;
50
+ acceptResponseEncoding?: "gzip" | undefined;
46
51
  }, {
47
52
  sessionId: string;
53
+ acceptResponseEncoding?: "gzip" | undefined;
48
54
  }>;
49
55
  export type WebhookTunnelPollRequest = z.infer<typeof WebhookTunnelPollRequest>;
50
56
  /** Result of waiting for the next tunneled webhook request. */
@@ -98,17 +104,20 @@ export declare const WebhookTunnelRespondRequest: z.ZodObject<{
98
104
  status: z.ZodNumber;
99
105
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
100
106
  body: z.ZodString;
107
+ isBase64Encoded: z.ZodOptional<z.ZodBoolean>;
101
108
  }, "strip", z.ZodTypeAny, {
102
109
  sessionId: string;
103
110
  requestId: string;
104
111
  status: number;
105
112
  headers?: Record<string, string> | undefined;
106
113
  body: string;
114
+ isBase64Encoded?: boolean | undefined;
107
115
  }, {
108
116
  sessionId: string;
109
117
  requestId: string;
110
118
  status: number;
111
119
  headers?: Record<string, string> | undefined;
112
120
  body: string;
121
+ isBase64Encoded?: boolean | undefined;
113
122
  }>;
114
123
  export type WebhookTunnelRespondRequest = z.infer<typeof WebhookTunnelRespondRequest>;
@@ -1 +1 @@
1
- import{z as e}from"zod";export const TunneledWebhookRequest=e.object({requestId:e.string(),url:e.string(),method:e.string(),headers:e.record(e.string()),body:e.string().nullable(),deadline:e.number()});export const TunneledWebhookResponse=e.object({status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string()});export const WebhookTunnelPollRequest=e.object({sessionId:e.string()});export const WebhookTunnelPollResponse=e.object({request:TunneledWebhookRequest.nullable()});export const WebhookTunnelRespondRequest=e.object({sessionId:e.string(),requestId:e.string(),status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string()});
1
+ import{z as e}from"zod";export const TunneledWebhookRequest=e.object({requestId:e.string(),url:e.string(),method:e.string(),headers:e.record(e.string()),body:e.string().nullable(),deadline:e.number()});export const TunneledWebhookResponse=e.object({status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string(),isBase64Encoded:e.boolean().optional()});export const WebhookTunnelPollRequest=e.object({sessionId:e.string(),acceptResponseEncoding:e.literal("gzip").optional()});export const WebhookTunnelPollResponse=e.object({request:TunneledWebhookRequest.nullable()});export const WebhookTunnelRespondRequest=e.object({sessionId:e.string(),requestId:e.string(),status:e.number().int(),headers:e.record(e.string()).optional(),body:e.string(),isBase64Encoded:e.boolean().optional()});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salsita-ai/contracts",
3
- "version": "0.50.0-develop.c28cfb7ded",
3
+ "version": "0.50.0-develop.c402728d10",
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.c28cfb7ded"
57
+ "@salsita-ai/common": "0.50.0-develop.c402728d10"
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",