@salsita-ai/contracts 0.50.0-develop.eb204e0da4 → 0.50.0-develop.ecda3c6152
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 +8 -4
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -1
- package/dist/api/studio-session.d.ts +54 -0
- package/dist/api/studio-session.js +1 -0
- package/dist/assistant/browser-details-tool.js +1 -1
- package/dist/assistant/deployment-assistant.d.ts +18 -6
- package/dist/assistant/deployment-assistant.js +1 -1
- package/dist/assistant/graphql-tools.d.ts +14 -1
- package/dist/assistant/graphql-tools.js +1 -1
- package/dist/assistant/image-reference.d.ts +10 -0
- package/dist/assistant/image-reference.js +1 -0
- package/dist/assistant/index.d.ts +3 -0
- package/dist/assistant/index.js +1 -1
- package/dist/assistant/message-metadata.d.ts +16 -7
- package/dist/assistant/message-metadata.js +1 -1
- package/dist/assistant/tool-error.d.ts +30 -0
- package/dist/assistant/tool-error.js +1 -0
- package/dist/chat/api.d.ts +0 -41
- package/dist/chat/api.js +1 -1
- package/dist/chat/completions/types.d.ts +0 -3
- package/dist/chat/completions/types.js +1 -1
- package/dist/chat/functions/process.d.ts +1 -2
- package/dist/chat/functions/process.js +1 -1
- package/dist/chat/index.d.ts +3 -6
- package/dist/chat/index.js +1 -1
- package/dist/domain/deployments/api-token-domain.d.ts +5 -0
- package/dist/domain/deployments/api-token-domain.js +1 -1
- package/dist/domain/deployments/deployment-build-domain.d.ts +10 -0
- package/dist/domain/deployments/deployment-domain.d.ts +2 -0
- package/dist/domain/deployments/index.d.ts +2 -2
- package/dist/domain/deployments/index.js +1 -1
- package/dist/domain/deployments/oauth-connection-domain.d.ts +0 -7
- package/dist/domain/deployments/oauth-connection-domain.js +1 -1
- package/dist/domain/feedback/feedback-domain.d.ts +4 -3
- package/dist/domain/feedback/feedback-domain.js +1 -1
- package/dist/domain/product-configurations/configurations-domain.d.ts +2 -7
- package/dist/domain/product-configurations/configurations-domain.js +1 -1
- package/dist/domain/product-configurations/index.d.ts +1 -1
- package/dist/domain/product-configurations/index.js +1 -1
- package/dist/webhook/implementation/backend-data-response.d.ts +3 -0
- package/dist/webhook/implementation/backend-data-response.js +1 -0
- package/dist/webhook/implementation/index.d.ts +1 -2
- package/dist/webhook/implementation/index.js +1 -1
- package/dist/webhook/implementation/webhook-api-types.d.ts +106 -0
- package/dist/webhook/implementation/webhook-api-types.js +1 -1
- package/dist/webhook/implementation/webhook-routing.d.ts +2 -6
- package/dist/webhook/implementation/webhook-routing.js +1 -1
- package/dist/webhook/implementation/webhook-tunnel-types.d.ts +9 -0
- package/dist/webhook/implementation/webhook-tunnel-types.js +1 -1
- package/package.json +2 -6
- package/dist/chat/completions/messages.d.ts +0 -3
- package/dist/chat/completions/messages.js +0 -1
- package/dist/chat/functions/augmentations.d.ts +0 -3
- package/dist/chat/functions/augmentations.js +0 -1
- package/dist/chat/functions/create.d.ts +0 -5
- package/dist/chat/functions/create.js +0 -1
- package/dist/webhook/implementation/webhook-client.d.ts +0 -85
- package/dist/webhook/implementation/webhook-client.js +0 -1
package/README.md
CHANGED
|
@@ -15,15 +15,19 @@ 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,
|
|
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
|
-
| `chat` | Chat
|
|
22
|
-
| `assistant` | Experimental assistant: shared client-tool definitions
|
|
23
|
-
| `webhook` | Webhook
|
|
21
|
+
| `chat` | Chat stream chunks, tool definitions and processing, validation, and embeddings. |
|
|
22
|
+
| `assistant` | Experimental assistant: shared client-tool definitions, user-message metadata, server-recorded tool errors and the deployment webhook setup shape. |
|
|
23
|
+
| `webhook` | Webhook payloads, responses and routing, finalization tasks and resources, spreadsheet adapters. |
|
|
24
|
+
|
|
25
|
+
The gzip and development-tunnel wire contracts are defined in [Webhook transports](../../../docs/architecture/background-jobs.md#webhook-transports).
|
|
24
26
|
|
|
25
27
|
Runtime schemas and TypeScript types are kept aligned, so a value that passes the schema has the declared type.
|
|
26
28
|
|
|
29
|
+
The chat declarations reference OpenAI types in `createEmbedding`, `processToolCalls`, and the shared tool and stream types. `openai` remains a dependency so consumers can resolve those declarations. Completion, speech and message-construction helpers belong to the private backend.
|
|
30
|
+
|
|
27
31
|
## Licence
|
|
28
32
|
|
|
29
33
|
Proprietary software of Salsita s.r.o., published under the Salsita SDK License (the `LICENSE` file in this package) and the terms at https://salsita.ai/terms. The published package contains minified code without source maps.
|
package/dist/api/index.d.ts
CHANGED
|
@@ -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())}))});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toolDefinition as e}from"@tanstack/ai";export const browserDetailsTool=e({name:"getBrowserDetails",description:"
|
|
1
|
+
import{toolDefinition as e}from"@tanstack/ai";export const browserDetailsTool=e({name:"getBrowserDetails",description:"Call when the user asks about their browser, screen or device. Returns their browser details as an image.",inputSchema:{type:"object",properties:{},required:[]}});
|
|
@@ -13,32 +13,39 @@ export type AssistantModelTier = (typeof ASSISTANT_MODEL_TIERS)[number];
|
|
|
13
13
|
export type AssistantReasoningLevel = (typeof ASSISTANT_REASONING_LEVELS)[number];
|
|
14
14
|
/**
|
|
15
15
|
* The `ai` block of the assistant manifest: which provider, model tier and reasoning level the
|
|
16
|
-
* deployment's assistant runs with. Authored in the application spec
|
|
17
|
-
*
|
|
16
|
+
* deployment's assistant runs with. Authored in the application spec and resolved through its deployment webhook;
|
|
17
|
+
* the server has no defaults for any of the three.
|
|
18
18
|
*/
|
|
19
19
|
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
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* deployment that registers none has no assistant.
|
|
46
|
+
* The setup returned by a deployment webhook: GraphQL SDL, SDK-generated prompt, integrator
|
|
47
|
+
* instructions and AI settings. The server caches validated answers and builds run prompts from
|
|
48
|
+
* them; a null setup means the assistant is unavailable for that session.
|
|
42
49
|
*/
|
|
43
50
|
export interface DeploymentAssistant {
|
|
44
51
|
readonly sdl: string;
|
|
@@ -54,14 +61,17 @@ export declare const DeploymentAssistant: z.ZodObject<{
|
|
|
54
61
|
provider: z.ZodEnum<["openai"]>;
|
|
55
62
|
model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
|
|
56
63
|
reasoning: z.ZodEnum<["low", "medium", "high"]>;
|
|
64
|
+
maxThreadSize: z.ZodOptional<z.ZodNumber>;
|
|
57
65
|
}, "strict", z.ZodTypeAny, {
|
|
58
66
|
provider: "openai";
|
|
59
67
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
60
68
|
reasoning: "high" | "low" | "medium";
|
|
69
|
+
maxThreadSize?: number | undefined;
|
|
61
70
|
}, {
|
|
62
71
|
provider: "openai";
|
|
63
72
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
64
73
|
reasoning: "high" | "low" | "medium";
|
|
74
|
+
maxThreadSize?: number | undefined;
|
|
65
75
|
}>;
|
|
66
76
|
}, "strict", z.ZodTypeAny, {
|
|
67
77
|
sdl: string;
|
|
@@ -71,6 +81,7 @@ export declare const DeploymentAssistant: z.ZodObject<{
|
|
|
71
81
|
provider: "openai";
|
|
72
82
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
73
83
|
reasoning: "high" | "low" | "medium";
|
|
84
|
+
maxThreadSize?: number | undefined;
|
|
74
85
|
};
|
|
75
86
|
}, {
|
|
76
87
|
sdl: string;
|
|
@@ -80,5 +91,6 @@ export declare const DeploymentAssistant: z.ZodObject<{
|
|
|
80
91
|
provider: "openai";
|
|
81
92
|
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
82
93
|
reasoning: "high" | "low" | "medium";
|
|
94
|
+
maxThreadSize?: number | undefined;
|
|
83
95
|
};
|
|
84
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();
|
|
@@ -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:"
|
|
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,4 +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';
|
|
8
|
+
export { ASSISTANT_TOOL_ERROR_CODES, AssistantToolError } from './tool-error.js';
|
|
9
|
+
export type { AssistantToolErrorCode } from './tool-error.js';
|
package/dist/assistant/index.js
CHANGED
|
@@ -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";
|
|
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,17 +1,26 @@
|
|
|
1
1
|
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
|
-
* persisted with the message, and the server shows `
|
|
5
|
-
* model knows
|
|
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. 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
|
-
readonly
|
|
9
|
+
/** The change record since the agent's previous action: a marker or a diff, as the assistant prompt describes it. */
|
|
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({
|
|
1
|
+
import{z as t}from"zod";export const AssistantMessageMetadata=t.object({changes:t.string(),locale:t.string().optional()});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Why the server recorded an error in place of the result of an assistant tool call:
|
|
4
|
+
* - `cancelled`: the user stopped the reply while the call was waiting for its result
|
|
5
|
+
* - `no_result`: the thread stopped waiting for the call when the user wrote a new message
|
|
6
|
+
* - `tool_budget`: the reply had used its tool calls for one user message, so the call was not run
|
|
7
|
+
*/
|
|
8
|
+
export declare const ASSISTANT_TOOL_ERROR_CODES: readonly ['cancelled', 'no_result', 'tool_budget'];
|
|
9
|
+
export type AssistantToolErrorCode = (typeof ASSISTANT_TOOL_ERROR_CODES)[number];
|
|
10
|
+
/**
|
|
11
|
+
* An error in place of the result of an assistant tool call. `error` is text for the model, in the
|
|
12
|
+
* `{ error }` form TanStack AI itself records for a tool that threw or was cancelled. `code` is set
|
|
13
|
+
* on the errors the server records and tells the assistant panel what to say to the user; it is
|
|
14
|
+
* read as any string, so a panel older than the server shows a code it does not know as a general
|
|
15
|
+
* failure.
|
|
16
|
+
*/
|
|
17
|
+
export interface AssistantToolError {
|
|
18
|
+
readonly error: string;
|
|
19
|
+
readonly code?: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare const AssistantToolError: z.ZodObject<{
|
|
22
|
+
error: z.ZodString;
|
|
23
|
+
code: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
error: string;
|
|
26
|
+
code?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
error: string;
|
|
29
|
+
code?: string | undefined;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"zod";export const ASSISTANT_TOOL_ERROR_CODES=["cancelled","no_result","tool_budget"];export const AssistantToolError=o.object({error:o.string(),code:o.string().optional()});
|
package/dist/chat/api.d.ts
CHANGED
|
@@ -1,45 +1,4 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
|
-
import type { Uploadable } from 'openai/core/uploads';
|
|
3
|
-
/**
|
|
4
|
-
* Generate a completion from a prompt and message history
|
|
5
|
-
* @param openai OpenAI instance
|
|
6
|
-
* @param params completion options
|
|
7
|
-
* @param prompt base prompt
|
|
8
|
-
* @param messages message history- last message should be user message
|
|
9
|
-
* @param tools available functions to call
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
export declare const createCompletion: (openai: OpenAI, params: Omit<OpenAI.Chat.Completions.ChatCompletionCreateParams, 'stream' | 'messages'>, prompt: string, messages: OpenAI.ChatCompletionMessageParam[], tools?: OpenAI.ChatCompletionTool[]) => Promise<import("openai/core/streaming.mjs").Stream<OpenAI.ChatCompletionChunk> & {
|
|
13
|
-
_request_id?: string | null;
|
|
14
|
-
}>;
|
|
15
|
-
/**
|
|
16
|
-
* Generate a text transcription from an audio file
|
|
17
|
-
* @param openai OpenAI instance
|
|
18
|
-
* @param params transcription options
|
|
19
|
-
* @param file audio file
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
export declare const createTranscription: (openai: OpenAI, params: Omit<OpenAI.Audio.Transcriptions.TranscriptionCreateParamsNonStreaming, 'file' | 'model'>, file: Uploadable) => Promise<OpenAI.Audio.Transcription & {
|
|
23
|
-
_request_id?: string | null;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Generate a speech audio file from a text message
|
|
27
|
-
* @param openai OpenAI instance
|
|
28
|
-
* @param params speech options
|
|
29
|
-
* @param message text message
|
|
30
|
-
* @returns
|
|
31
|
-
*/
|
|
32
|
-
export declare const createSpeech: (openai: OpenAI, params: Omit<OpenAI.Audio.Speech.SpeechCreateParams, 'input' | 'model' | 'voice'>, message: string) => Promise<Response>;
|
|
33
|
-
/**
|
|
34
|
-
* Generate a function call completion from a prompt and message
|
|
35
|
-
* @param openai OpenAI instance
|
|
36
|
-
* @param params completion options
|
|
37
|
-
* @param prompt base prompt
|
|
38
|
-
* @param message input message
|
|
39
|
-
* @param tools available functions to call
|
|
40
|
-
* @returns
|
|
41
|
-
*/
|
|
42
|
-
export declare const createFunctionCallCompletion: (openai: OpenAI, params: Omit<OpenAI.Chat.Completions.ChatCompletionCreateParams, 'stream' | 'messages'>, prompt: string, message: string, tools: OpenAI.ChatCompletionTool[]) => Promise<OpenAI.ChatCompletionMessageFunctionToolCall.Function[]>;
|
|
43
2
|
/**
|
|
44
3
|
* Generate an embedding from a text input
|
|
45
4
|
* @param openai OpenAI instance
|
package/dist/chat/api.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const createEmbedding=async(e,d,t)=>{let a=await e.embeddings.create({model:"text-embedding-3-small",...d,input:t});return a.data[0]?.embedding};
|
|
@@ -22,7 +22,4 @@ export interface ChatMessageAugmentation {
|
|
|
22
22
|
augmentation: Record<string, unknown>;
|
|
23
23
|
}
|
|
24
24
|
export type ChatStreamChunk = ChatMessageContentChunk | ChatToolCalls | ChatErrorChunk | ChatMessageAugmentation;
|
|
25
|
-
export declare const isChatMessageContentChunk: (chunk: ChatStreamChunk) => chunk is ChatMessageContentChunk;
|
|
26
|
-
export declare const isChatMessageAugmentation: (chunk: ChatStreamChunk) => chunk is ChatMessageAugmentation;
|
|
27
|
-
export declare const isChatToolCalls: (chunk: ChatStreamChunk) => chunk is ChatToolCalls;
|
|
28
25
|
export declare const isChatError: (chunk: ChatStreamChunk) => chunk is ChatErrorChunk;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ChunkType={content:"content",calls:"calls",error:"error",augment:"augment"};export const
|
|
1
|
+
export const ChunkType={content:"content",calls:"calls",error:"error",augment:"augment"};export const isChatError=r=>r.type===ChunkType.error;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type OpenAI from 'openai';
|
|
2
2
|
import type { Empty } from '../utils/types.js';
|
|
3
|
-
import type { ChatExecutableFunction,
|
|
4
|
-
export declare const createCompletionTool: <C extends Empty = Empty, R extends Empty = Empty>({ name, description, parameters, }: OpenAI.FunctionDefinition | ChatFunctionDefinition<C, R, any>) => OpenAI.ChatCompletionFunctionTool;
|
|
3
|
+
import type { ChatExecutableFunction, ChatFunctionResult } from './types.js';
|
|
5
4
|
/**
|
|
6
5
|
* Processes tool calls and generates array of return messages.
|
|
7
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const processToolCalls=async(t,n,e,o)=>{let l=[];for(let r of t){let{id:t}=r,c={tool_call_id:t,role:"tool"};if("function"!==r.type){l.push({...c,content:`Tool call type '${r.type}' is not supported — only function tool calls can be processed by this handler.`});continue}let{function:s}=r;try{let t=n?.find(t=>t.name===s.name);if(!t){l.push({...c,content:`Function \`${s.name}\` not found`});continue}let a=JSON.parse(s.arguments??"{}"),i=t.validate(a);if(i){l.push({...c,content:i});continue}let u=await t.function(a,e);o?.(u,r),l.push({...c,content:u.result})}catch(e){let n=e instanceof Error?e.message:String(e);throw Error(`Call ${t} of function \`${s.name}\` resulted in error: ${n}`)}}return l};
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export { ChunkType, isChatMessageContentChunk, isChatMessageAugmentation, isChatToolCalls, isChatError, } from './completions/types.js';
|
|
1
|
+
export { createEmbedding } from './api.js';
|
|
2
|
+
export { ChunkType, isChatError } from './completions/types.js';
|
|
4
3
|
export type { ChatMessageContentChunk, ChatToolCalls, ChatErrorChunk, ChatStreamChunk, ChatMessageAugmentation, } from './completions/types.js';
|
|
5
4
|
export { createValidator } from './functions/validate.js';
|
|
6
|
-
export {
|
|
7
|
-
export { simpleAugmentationHandler } from './functions/augmentations.js';
|
|
8
|
-
export { processToolCalls, createCompletionTool } from './functions/process.js';
|
|
5
|
+
export { processToolCalls } from './functions/process.js';
|
|
9
6
|
export type { ChatFunction, ChatExecutableFunction, ChatFunctionDefinition, ChatFunctionResult, } from './functions/types.js';
|
|
10
7
|
export type { Empty } from './utils/types.js';
|
package/dist/chat/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{createEmbedding}from"./api.js";export{ChunkType,isChatError}from"./completions/types.js";export{createValidator}from"./functions/validate.js";export{processToolCalls}from"./functions/process.js";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
+
/**
|
|
3
|
+
* How long the name of an API token may be. A builder gives the name when approving `phoenix login` in Studio, and
|
|
4
|
+
* the CLI sends it back with `POST /auth/token`, so Studio and both server inputs apply this one limit.
|
|
5
|
+
*/
|
|
6
|
+
export declare const API_TOKEN_NAME_MAX_LENGTH = 100;
|
|
2
7
|
/**
|
|
3
8
|
* Identifies one API token: a long-lived, revocable credential that authenticates calls to the Phoenix API on
|
|
4
9
|
* behalf of the user who approved it. The id names the token in revocation and in the request session; it is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{validate as o}from"uuid";import{Branded as
|
|
1
|
+
import{validate as o}from"uuid";import{Branded as t}from"@salsita-ai/common/utils";export const API_TOKEN_NAME_MAX_LENGTH=100;export const ApiTokenId=r=>{if(!o(r))throw Error(`Invalid API token id: ${r}. It must be a valid UUID.`);return t(r)};
|
|
@@ -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;
|
|
@@ -86,6 +86,7 @@ export interface Deployment {
|
|
|
86
86
|
readonly id: DeploymentId;
|
|
87
87
|
readonly environmentId: EnvironmentId;
|
|
88
88
|
readonly isActive: boolean;
|
|
89
|
+
readonly assistantEnabled: boolean;
|
|
89
90
|
readonly resourcesUrl: ResourceUrl;
|
|
90
91
|
readonly useAuthHook: boolean;
|
|
91
92
|
readonly lambdaWebhookUrl: LambdaWebhookUrl | null;
|
|
@@ -107,6 +108,7 @@ export interface NewDeployment {
|
|
|
107
108
|
readonly id: DeploymentId;
|
|
108
109
|
readonly environmentId: EnvironmentId;
|
|
109
110
|
readonly isActive: boolean;
|
|
111
|
+
readonly assistantEnabled: boolean;
|
|
110
112
|
readonly resourcesUrl: ResourceUrl;
|
|
111
113
|
readonly useAuthHook: boolean;
|
|
112
114
|
readonly lambdaWebhookUrl: LambdaWebhookUrl | null;
|
|
@@ -5,9 +5,9 @@ export { DEFAULT_PROJECT_ALIAS, ProjectId, ProjectName, ProjectSlug, ProjectCust
|
|
|
5
5
|
export { OAuthProviderId, OAuthClientId, OAuthClientSecret, OAuthBaseUrl, type OAuthProvider, OAuthProviderName, OAuthScopes, } from './oauth-provider-domain.js';
|
|
6
6
|
export { DeploymentBuild, DeploymentBuildId, DeploymentBuildMode, DeploymentBuildSourceKey, DeploymentBuildStatus, } from './deployment-build-domain.js';
|
|
7
7
|
export { SdkBuilderSetupState } from './sdk-builder-setup-domain.js';
|
|
8
|
-
export { ApiTokenId } from './api-token-domain.js';
|
|
8
|
+
export { API_TOKEN_NAME_MAX_LENGTH, ApiTokenId } from './api-token-domain.js';
|
|
9
9
|
export { CustomerId, CustomerName, type Customer, CustomerClerkPublishableKey, CustomerClerkSecretKey, CustomerClerkJwtSecret, CustomerClerkOAuthBaseUrl, CustomerClerkOAuthClientId, CustomerClerkOAuthClientSecret, type CustomerClerkSettings, CustomerSlug, CustomerType, CustomerTypeSchema, } from './customer-domain.js';
|
|
10
|
-
export { OAuthConnectionId, type OAuthConnectionProvider, OAuthRefreshToken, OAuthGrantedScopes, SHAREPOINT_MISSING_TENANT_DOMAIN,
|
|
10
|
+
export { OAuthConnectionId, type OAuthConnectionProvider, OAuthRefreshToken, OAuthGrantedScopes, SHAREPOINT_MISSING_TENANT_DOMAIN, type NewOAuthConnection, type OAuthConnection, type SharePointProjectSite, OAUTH_STALE_CONNECTION_CODE, parseSharePointTenantDomain, } from './oauth-connection-domain.js';
|
|
11
11
|
export { type Embeddings } from './embedding-domain.js';
|
|
12
12
|
export { BucketTimestamp, SessionCount, type SessionBucket, type NewSessionBucket } from './session-domain.js';
|
|
13
13
|
export { AiImageCount, type NewAiImageBucket } from './ai-image-domain.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{EnvironmentId,EnvironmentName,EnvironmentSlug,EnvironmentType,FrontendUrl,DevelopmentKey,DEFAULT_SESSION_LIMIT,PRODUCTION_ENVIRONMENT_SLUG,SessionLimit,ServerKey,BaseDomain,ServiceName,FrontendBucketName,LambdaFunctionName,TfStateKeyPrefix,DdServiceName}from"./environment-domain.js";export{ConfigurationSchemaId,ConfigurationSchemaJsonSchema,ConfigurationSchemaVersion}from"./configuration-schema-domain.js";export{ApplicationType,AllowedOrigin,ChatConfiguration,DeploymentId,ResourceUrl,LambdaWebhookUrl,PrivateS3Bucket,PrivateDeploymentResourcesPath,PublicS3Bucket,PublicDeploymentResourcesPath,DeploymentApplicationId,OAuthProviderRegistration}from"./deployment-domain.js";export{DEFAULT_PROJECT_ALIAS,ProjectId,ProjectName,ProjectSlug,ProjectCustomDomain,ParamStorePath}from"./project-domain.js";export{OAuthProviderId,OAuthClientId,OAuthClientSecret,OAuthBaseUrl,OAuthProviderName,OAuthScopes}from"./oauth-provider-domain.js";export{DeploymentBuild,DeploymentBuildId,DeploymentBuildMode,DeploymentBuildSourceKey,DeploymentBuildStatus}from"./deployment-build-domain.js";export{SdkBuilderSetupState}from"./sdk-builder-setup-domain.js";export{ApiTokenId}from"./api-token-domain.js";export{CustomerId,CustomerName,CustomerClerkPublishableKey,CustomerClerkSecretKey,CustomerClerkJwtSecret,CustomerClerkOAuthBaseUrl,CustomerClerkOAuthClientId,CustomerClerkOAuthClientSecret,CustomerSlug,CustomerType,CustomerTypeSchema}from"./customer-domain.js";export{OAuthConnectionId,OAuthRefreshToken,OAuthGrantedScopes,SHAREPOINT_MISSING_TENANT_DOMAIN,
|
|
1
|
+
export{EnvironmentId,EnvironmentName,EnvironmentSlug,EnvironmentType,FrontendUrl,DevelopmentKey,DEFAULT_SESSION_LIMIT,PRODUCTION_ENVIRONMENT_SLUG,SessionLimit,ServerKey,BaseDomain,ServiceName,FrontendBucketName,LambdaFunctionName,TfStateKeyPrefix,DdServiceName}from"./environment-domain.js";export{ConfigurationSchemaId,ConfigurationSchemaJsonSchema,ConfigurationSchemaVersion}from"./configuration-schema-domain.js";export{ApplicationType,AllowedOrigin,ChatConfiguration,DeploymentId,ResourceUrl,LambdaWebhookUrl,PrivateS3Bucket,PrivateDeploymentResourcesPath,PublicS3Bucket,PublicDeploymentResourcesPath,DeploymentApplicationId,OAuthProviderRegistration}from"./deployment-domain.js";export{DEFAULT_PROJECT_ALIAS,ProjectId,ProjectName,ProjectSlug,ProjectCustomDomain,ParamStorePath}from"./project-domain.js";export{OAuthProviderId,OAuthClientId,OAuthClientSecret,OAuthBaseUrl,OAuthProviderName,OAuthScopes}from"./oauth-provider-domain.js";export{DeploymentBuild,DeploymentBuildId,DeploymentBuildMode,DeploymentBuildSourceKey,DeploymentBuildStatus}from"./deployment-build-domain.js";export{SdkBuilderSetupState}from"./sdk-builder-setup-domain.js";export{API_TOKEN_NAME_MAX_LENGTH,ApiTokenId}from"./api-token-domain.js";export{CustomerId,CustomerName,CustomerClerkPublishableKey,CustomerClerkSecretKey,CustomerClerkJwtSecret,CustomerClerkOAuthBaseUrl,CustomerClerkOAuthClientId,CustomerClerkOAuthClientSecret,CustomerSlug,CustomerType,CustomerTypeSchema}from"./customer-domain.js";export{OAuthConnectionId,OAuthRefreshToken,OAuthGrantedScopes,SHAREPOINT_MISSING_TENANT_DOMAIN,OAUTH_STALE_CONNECTION_CODE,parseSharePointTenantDomain}from"./oauth-connection-domain.js";export{BucketTimestamp,SessionCount}from"./session-domain.js";export{AiImageCount}from"./ai-image-domain.js";export{ImageRenderCount,ImageRenderLimit,DEFAULT_IMAGE_RENDER_LIMIT}from"./image-render-domain.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
3
2
|
import { type ProjectId } from './project-domain.js';
|
|
4
3
|
export type OAuthConnectionId = Branded<'OAuthConnectionId', string>;
|
|
@@ -16,13 +15,7 @@ export type OAuthGrantedScopes = Branded<'OAuthGrantedScopes', readonly string[]
|
|
|
16
15
|
export declare const OAuthGrantedScopes: (scopes: readonly string[]) => OAuthGrantedScopes;
|
|
17
16
|
export declare const OAUTH_STALE_CONNECTION_CODE: 'STALE_CONNECTION';
|
|
18
17
|
export declare const SHAREPOINT_MISSING_TENANT_DOMAIN: 'fill-in-tenant-domain.invalid';
|
|
19
|
-
export declare class SharePointTenantDomainInvalidError extends Error {
|
|
20
|
-
readonly code: 'tenant_domain_invalid';
|
|
21
|
-
constructor(tenantDomain: string, reason: string);
|
|
22
|
-
}
|
|
23
18
|
export declare const parseSharePointTenantDomain: (rawDomain: string) => string | null;
|
|
24
|
-
export declare const parseRequiredSharePointTenantDomain: (rawDomain: string) => string;
|
|
25
|
-
export declare const SharePointTenantDomainSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
26
19
|
/**
|
|
27
20
|
* Per-project SharePoint site binding, independent of the user OAuth
|
|
28
21
|
* connection model used by Google — Microsoft uses app-only auth
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{validate as
|
|
1
|
+
import{validate as t}from"uuid";import{Branded as o}from"@salsita-ai/common/utils";export const OAuthConnectionId=n=>{if(!t(n))throw Error(`Invalid OAuthConnection id: ${n}. It must be a valid UUID.`);return o(n)};export const OAuthRefreshToken=t=>o(t);export const OAuthGrantedScopes=t=>o(t);export const OAUTH_STALE_CONNECTION_CODE="STALE_CONNECTION";export const SHAREPOINT_MISSING_TENANT_DOMAIN="fill-in-tenant-domain.invalid";let n=/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/i;export const parseSharePointTenantDomain=t=>{let o=t.trim().toLowerCase();return o&&n.test(o)?o:null};
|
|
@@ -44,10 +44,11 @@ export declare const FeedbackSource: ((value: string) => FeedbackSource) & {
|
|
|
44
44
|
readonly Cli: 'cli';
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
|
-
* Longest feedback message the server stores.
|
|
48
|
-
* the
|
|
47
|
+
* Longest feedback message the server stores. It leaves room for a full report: the error output and a condensed
|
|
48
|
+
* conversation log of the coding agent that wrote it. Studio and the CLI check it before sending, so a sender learns
|
|
49
|
+
* about the limit without a round trip.
|
|
49
50
|
*/
|
|
50
|
-
export declare const FEEDBACK_MESSAGE_MAX_LENGTH =
|
|
51
|
+
export declare const FEEDBACK_MESSAGE_MAX_LENGTH = 100000;
|
|
51
52
|
/**
|
|
52
53
|
* Longest contact detail a sender may leave with CLI feedback when they want a reply.
|
|
53
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{validate as e}from"uuid";import{z as t}from"zod";import{Branded as o}from"@salsita-ai/common/utils";export const FeedbackId=t=>{if(!e(t))throw Error(`Invalid feedback id: ${t}. It must be a valid UUID.`);return o(t)};let r={Bug:"bug",Idea:"idea",Other:"other"};export const FeedbackTypeSchema=t.nativeEnum(r);export const FeedbackType=Object.assign(e=>{let t=FeedbackTypeSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback type: ${e}. It must be one of ${Object.values(r).join(", ")}.`);return t.data},r);let a={Studio:"studio",Cli:"cli"};export const FeedbackSourceSchema=t.nativeEnum(a);export const FeedbackSource=Object.assign(e=>{let t=FeedbackSourceSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback source: ${e}. It must be one of ${Object.values(a).join(", ")}.`);return t.data},a);export const FEEDBACK_MESSAGE_MAX_LENGTH=
|
|
1
|
+
import{validate as e}from"uuid";import{z as t}from"zod";import{Branded as o}from"@salsita-ai/common/utils";export const FeedbackId=t=>{if(!e(t))throw Error(`Invalid feedback id: ${t}. It must be a valid UUID.`);return o(t)};let r={Bug:"bug",Idea:"idea",Other:"other"};export const FeedbackTypeSchema=t.nativeEnum(r);export const FeedbackType=Object.assign(e=>{let t=FeedbackTypeSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback type: ${e}. It must be one of ${Object.values(r).join(", ")}.`);return t.data},r);let a={Studio:"studio",Cli:"cli"};export const FeedbackSourceSchema=t.nativeEnum(a);export const FeedbackSource=Object.assign(e=>{let t=FeedbackSourceSchema.safeParse(e);if(!t.success)throw Error(`Invalid feedback source: ${e}. It must be one of ${Object.values(a).join(", ")}.`);return t.data},a);export const FEEDBACK_MESSAGE_MAX_LENGTH=1e5;export const FEEDBACK_CONTACT_MAX_LENGTH=200;
|
|
@@ -50,13 +50,8 @@ export interface Revision {
|
|
|
50
50
|
configurationId: ConfigurationId;
|
|
51
51
|
configurationSchemaId: ConfigurationSchemaId;
|
|
52
52
|
}
|
|
53
|
-
export declare const PublishedDataRevisionKind: {
|
|
54
|
-
readonly Regular: 'regular';
|
|
55
|
-
readonly Chunked: 'chunked';
|
|
56
|
-
};
|
|
57
|
-
export type PublishedDataRevisionKind = (typeof PublishedDataRevisionKind)[keyof typeof PublishedDataRevisionKind];
|
|
58
53
|
export interface PublishedDataRevision {
|
|
59
|
-
readonly kind:
|
|
54
|
+
readonly kind: 'regular';
|
|
60
55
|
readonly id: PublishedDataRevisionId;
|
|
61
56
|
readonly finalizationUuid: FinalizationUuid;
|
|
62
57
|
readonly uploadPath: PublishedDataRevisionUploadPath;
|
|
@@ -64,7 +59,7 @@ export interface PublishedDataRevision {
|
|
|
64
59
|
readonly data: unknown;
|
|
65
60
|
}
|
|
66
61
|
export interface ChunkedPublishedDataRevision {
|
|
67
|
-
readonly kind:
|
|
62
|
+
readonly kind: 'chunked';
|
|
68
63
|
readonly id: PublishedDataRevisionId;
|
|
69
64
|
readonly finalizationUuid: FinalizationUuid;
|
|
70
65
|
readonly publishedDataHash: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{validate as t}from"uuid";import{Branded as i}from"@salsita-ai/common/utils";export const ConfigurationId=r=>{if(!t(r))throw Error(`Invalid configuration id: ${r}. It must be a valid UUID.`);return i(r)};export const ConfigurationRootEntityType=t=>i(t);export const RevisionId=r=>{if(!t(r))throw Error(`Invalid revision id: ${r}. It must be a valid UUID.`);return i(r)};export const FinalizationUuid=r=>{if(!t(r))throw Error(`Invalid finalization id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionId=r=>{if(!t(r))throw Error(`Invalid published data revision id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionUploadPath=t=>i(t);export const PublishedDataRevisionVersion=t=>i(t);export const PublishedDataChunkId=r=>{if(!t(r))throw Error(`Invalid published data chunk id: ${r}. It must be a valid UUID.`);return i(r)};export const ChunkScope=t=>i(t);let r=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;export const ChunkKey=t=>{if(!r.test(t))throw Error(`Invalid chunk key '${t}'. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.`);return i(t)};export const FinalizationJobId=t=>i(t);export const ShareId=r=>{if(!t(r))throw Error(`Invalid share id: ${r}. It must be a valid UUID.`);return i(r)};
|
|
1
|
+
import{validate as t}from"uuid";import{Branded as i}from"@salsita-ai/common/utils";export const ConfigurationId=r=>{if(!t(r))throw Error(`Invalid configuration id: ${r}. It must be a valid UUID.`);return i(r)};export const ConfigurationRootEntityType=t=>i(t);export const RevisionId=r=>{if(!t(r))throw Error(`Invalid revision id: ${r}. It must be a valid UUID.`);return i(r)};export const FinalizationUuid=r=>{if(!t(r))throw Error(`Invalid finalization id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionId=r=>{if(!t(r))throw Error(`Invalid published data revision id: ${r}. It must be a valid UUID.`);return i(r)};export const PublishedDataRevisionUploadPath=t=>i(t);export const PublishedDataRevisionVersion=t=>i(t);export const PublishedDataChunkId=r=>{if(!t(r))throw Error(`Invalid published data chunk id: ${r}. It must be a valid UUID.`);return i(r)};export const ChunkScope=t=>i(t);let r=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;export const ChunkKey=t=>{if(!r.test(t))throw Error(`Invalid chunk key '${t}'. Must be lowercase, start with a letter, and contain only letters, numbers, and hyphens.`);return i(t)};export const FinalizationJobId=t=>i(t);export const ShareId=r=>{if(!t(r))throw Error(`Invalid share id: ${r}. It must be a valid UUID.`);return i(r)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ConfigurationId, ConfigurationRootEntityType, RevisionId, type Revision, type NewRevision,
|
|
1
|
+
export { ConfigurationId, ConfigurationRootEntityType, RevisionId, type Revision, type NewRevision, type PublishedDataRevision, type ChunkedPublishedDataRevision, type AnyPublishedDataRevision, type Configuration, type NewConfiguration, type Entity, FinalizationUuid, type Finalization, type NewFinalization, FinalizationJobId, PublishedDataRevisionId, PublishedDataRevisionUploadPath, PublishedDataRevisionVersion, PublishedDataChunkId, ChunkScope, ChunkKey, type PublishedDataChunk, type NewShare, type Share, ShareId, } from './configurations-domain.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ConfigurationId,ConfigurationRootEntityType,RevisionId,
|
|
1
|
+
export{ConfigurationId,ConfigurationRootEntityType,RevisionId,FinalizationUuid,FinalizationJobId,PublishedDataRevisionId,PublishedDataRevisionUploadPath,PublishedDataRevisionVersion,PublishedDataChunkId,ChunkScope,ChunkKey,ShareId}from"./configurations-domain.js";
|
|
@@ -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,4 +1,3 @@
|
|
|
1
1
|
export { routeWebhookRequests } from './webhook-routing.js';
|
|
2
2
|
export { TunneledWebhookRequest, TunneledWebhookResponse, WebhookTunnelPollRequest, WebhookTunnelPollResponse, WebhookTunnelRespondRequest, } from './webhook-tunnel-types.js';
|
|
3
|
-
export {
|
|
4
|
-
export { AuthHandlerResponse, AuthUserIdSource, RefreshPayload, CodePayload, AuthPayload, AnonymousPayload, FinalizeWebhookPayload, CallbackPayload, CallbackResponse, FetchBackendDataPayload, FetchBackendDataHandlerResponse, } from './webhook-api-types.js';
|
|
3
|
+
export { AssistantSetupPayload, AssistantSetupResponse, AuthHandlerResponse, AuthUserIdSource, RefreshPayload, CodePayload, AuthPayload, AnonymousPayload, FinalizeWebhookPayload, CallbackPayload, CallbackResponse, FetchBackendDataPayload, FetchBackendDataHandlerResponse, } from './webhook-api-types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{routeWebhookRequests}from"./webhook-routing.js";export{TunneledWebhookRequest,TunneledWebhookResponse,WebhookTunnelPollRequest,WebhookTunnelPollResponse,WebhookTunnelRespondRequest}from"./webhook-tunnel-types.js";export{
|
|
1
|
+
export{routeWebhookRequests}from"./webhook-routing.js";export{TunneledWebhookRequest,TunneledWebhookResponse,WebhookTunnelPollRequest,WebhookTunnelPollResponse,WebhookTunnelRespondRequest}from"./webhook-tunnel-types.js";export{AssistantSetupPayload,AssistantSetupResponse,AuthHandlerResponse,AuthUserIdSource,RefreshPayload,CodePayload,AuthPayload,AnonymousPayload,FinalizeWebhookPayload,CallbackPayload,CallbackResponse,FetchBackendDataPayload,FetchBackendDataHandlerResponse}from"./webhook-api-types.js";
|
|
@@ -300,3 +300,109 @@ export declare const FetchBackendDataHandlerResponse: z.ZodObject<{
|
|
|
300
300
|
}, {
|
|
301
301
|
backendData: Record<string, unknown>;
|
|
302
302
|
}>;
|
|
303
|
+
/** Session inputs used by the lambda to resolve the assistant setup. */
|
|
304
|
+
export declare const AssistantSetupPayload: z.ZodObject<{
|
|
305
|
+
deploymentId: z.ZodEffects<z.ZodString, DeploymentId, string>;
|
|
306
|
+
sessionRole: z.ZodNativeEnum<{
|
|
307
|
+
readonly Anonymous: 'anonymous';
|
|
308
|
+
readonly User: 'user';
|
|
309
|
+
readonly Admin: 'admin';
|
|
310
|
+
readonly SuperAdmin: 'superadmin';
|
|
311
|
+
}>;
|
|
312
|
+
sessionPayload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
313
|
+
sub: z.ZodOptional<z.ZodString>;
|
|
314
|
+
access: z.ZodNativeEnum<{
|
|
315
|
+
readonly Owner: 'o';
|
|
316
|
+
readonly ReadRevision: 'rr';
|
|
317
|
+
readonly Read: 'r';
|
|
318
|
+
}>;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
deploymentId: string & import("@salsita-ai/common/utils").Brand<"DeploymentId">;
|
|
321
|
+
sessionRole: "admin" | "anonymous" | "superadmin" | "user";
|
|
322
|
+
sessionPayload: Record<string, unknown>;
|
|
323
|
+
sub?: string | undefined;
|
|
324
|
+
access: "o" | "r" | "rr";
|
|
325
|
+
}, {
|
|
326
|
+
deploymentId: string;
|
|
327
|
+
sessionRole: "admin" | "anonymous" | "superadmin" | "user";
|
|
328
|
+
sessionPayload: Record<string, unknown>;
|
|
329
|
+
sub?: string | undefined;
|
|
330
|
+
access: "o" | "r" | "rr";
|
|
331
|
+
}>;
|
|
332
|
+
export type AssistantSetupPayload = z.infer<typeof AssistantSetupPayload>;
|
|
333
|
+
/**
|
|
334
|
+
* A deployment's assistant setup, or a session for which no assistant is available. `threadLock`
|
|
335
|
+
* is outside the setup a thread is bound to: `'strict'` asks a development environment to lock a
|
|
336
|
+
* thread when the setup changes, as every other environment always does.
|
|
337
|
+
*/
|
|
338
|
+
export declare const AssistantSetupResponse: z.ZodObject<{
|
|
339
|
+
setup: z.ZodNullable<z.ZodObject<{
|
|
340
|
+
sdl: z.ZodString;
|
|
341
|
+
prompt: z.ZodString;
|
|
342
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
343
|
+
ai: z.ZodObject<{
|
|
344
|
+
provider: z.ZodEnum<["openai"]>;
|
|
345
|
+
model: z.ZodEnum<["frontier", "advanced", "balanced", "fast"]>;
|
|
346
|
+
reasoning: z.ZodEnum<["low", "medium", "high"]>;
|
|
347
|
+
maxThreadSize: z.ZodOptional<z.ZodNumber>;
|
|
348
|
+
}, "strict", z.ZodTypeAny, {
|
|
349
|
+
provider: "openai";
|
|
350
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
351
|
+
reasoning: "high" | "low" | "medium";
|
|
352
|
+
maxThreadSize?: number | undefined;
|
|
353
|
+
}, {
|
|
354
|
+
provider: "openai";
|
|
355
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
356
|
+
reasoning: "high" | "low" | "medium";
|
|
357
|
+
maxThreadSize?: number | undefined;
|
|
358
|
+
}>;
|
|
359
|
+
}, "strict", z.ZodTypeAny, {
|
|
360
|
+
sdl: string;
|
|
361
|
+
prompt: string;
|
|
362
|
+
instructions?: string | undefined;
|
|
363
|
+
ai: {
|
|
364
|
+
provider: "openai";
|
|
365
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
366
|
+
reasoning: "high" | "low" | "medium";
|
|
367
|
+
maxThreadSize?: number | undefined;
|
|
368
|
+
};
|
|
369
|
+
}, {
|
|
370
|
+
sdl: string;
|
|
371
|
+
prompt: string;
|
|
372
|
+
instructions?: string | undefined;
|
|
373
|
+
ai: {
|
|
374
|
+
provider: "openai";
|
|
375
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
376
|
+
reasoning: "high" | "low" | "medium";
|
|
377
|
+
maxThreadSize?: number | undefined;
|
|
378
|
+
};
|
|
379
|
+
}>>;
|
|
380
|
+
threadLock: z.ZodOptional<z.ZodLiteral<"strict">>;
|
|
381
|
+
}, "strict", z.ZodTypeAny, {
|
|
382
|
+
setup: {
|
|
383
|
+
sdl: string;
|
|
384
|
+
prompt: string;
|
|
385
|
+
instructions?: string | undefined;
|
|
386
|
+
ai: {
|
|
387
|
+
provider: "openai";
|
|
388
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
389
|
+
reasoning: "high" | "low" | "medium";
|
|
390
|
+
maxThreadSize?: number | undefined;
|
|
391
|
+
};
|
|
392
|
+
} | null;
|
|
393
|
+
threadLock?: "strict" | undefined;
|
|
394
|
+
}, {
|
|
395
|
+
setup: {
|
|
396
|
+
sdl: string;
|
|
397
|
+
prompt: string;
|
|
398
|
+
instructions?: string | undefined;
|
|
399
|
+
ai: {
|
|
400
|
+
provider: "openai";
|
|
401
|
+
model: "advanced" | "balanced" | "fast" | "frontier";
|
|
402
|
+
reasoning: "high" | "low" | "medium";
|
|
403
|
+
maxThreadSize?: number | undefined;
|
|
404
|
+
};
|
|
405
|
+
} | null;
|
|
406
|
+
threadLock?: "strict" | undefined;
|
|
407
|
+
}>;
|
|
408
|
+
export type AssistantSetupResponse = z.infer<typeof AssistantSetupResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";import{usingType as n}from"@salsita-ai/common/utils";import{SessionRole as
|
|
1
|
+
import{z as o}from"zod";import{usingType as n}from"@salsita-ai/common/utils";import{AccessLevel as e,SessionRole as t}from"../../api/index.js";import{DeploymentAssistant as r}from"../../assistant/index.js";import{ConfigurationId as s,DeploymentId as a,FrontendUrl as i,RevisionId as l}from"../../domain/index.js";import{CallLambdaBackResourceType as c}from"../tasks/index.js";export const CallbackPayload=o.object({replayData:o.record(o.unknown()),resources:o.record(o.object({type:o.literal(c.Link),link:o.string()}))});export const CallbackResponse=o.object({result:o.record(o.unknown()).optional()});export const AuthUserIdSource=o.enum(["clerk","custom"]);export const AuthHandlerResponse=o.discriminatedUnion("success",[o.object({success:o.literal(!0),data:o.record(o.unknown()),role:o.nativeEnum(t),refreshToken:o.string().optional(),expirationTime:o.number().optional(),scopes:o.array(o.string()).optional(),userId:o.string().optional(),userIdSource:AuthUserIdSource.optional()}),o.object({success:o.literal(!1)})]);export const RefreshPayload=o.object({type:o.literal("refresh"),refreshToken:o.string()});export const CodePayload=o.object({type:o.literal("code"),accessToken:o.string(),refreshToken:o.string().optional(),idToken:o.string().optional()});export const AnonymousPayload=o.object({type:o.literal("anonymous")});export const AuthPayload=o.union([RefreshPayload,CodePayload,AnonymousPayload]);export const FinalizeWebhookPayload=o.object({configurationId:o.string().transform(n(s)),revisionId:o.string().transform(n(l)),deploymentId:o.string().transform(n(a)),frontendUrl:o.string().transform(n(i)),rootEntityType:o.string(),entities:o.array(o.object({type:o.string(),id:o.string()}).and(o.record(o.unknown()))),modelVersion:o.number().positive(),data:o.record(o.unknown()),frontendData:o.record(o.unknown()).optional(),locale:o.string(),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),publishedAdminRevisionPath:o.string().optional(),publishedChunkUrls:o.record(o.string()).optional(),chunksUploadUrl:o.string().optional(),connectedProviderAccessTokens:o.record(o.string()).optional()});export const FetchBackendDataPayload=o.object({deploymentId:o.string().transform(n(a)),frontendUrl:o.string().transform(n(i)),frontendData:o.record(o.unknown()).optional(),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),publishedAdminRevisionPath:o.string().optional(),publishedChunkUrls:o.record(o.string()).optional()});export const FetchBackendDataHandlerResponse=o.object({backendData:o.record(o.unknown())});export const AssistantSetupPayload=o.object({deploymentId:o.string().transform(n(a)),sessionRole:o.nativeEnum(t),sessionPayload:o.record(o.unknown()),sub:o.string().optional(),access:o.nativeEnum(e)});export const AssistantSetupResponse=o.object({setup:r.nullable(),threadLock:o.literal("strict").optional()}).strict();
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import type { APIGatewayProxyEventV2, LambdaFunctionURLResult } from 'aws-lambda';
|
|
2
2
|
import type { Logger } from '@salsita-ai/common/utils';
|
|
3
|
-
import { ApplicationType } from '../../domain/index.js';
|
|
4
3
|
import { type WebhookFinalizeTaskConfiguration } from '../tasks/index.js';
|
|
5
4
|
import type { AuthHandlerResponse, CallbackResponse, FetchBackendDataHandlerResponse } from './webhook-api-types.js';
|
|
6
|
-
import { AuthPayload, CallbackPayload, FetchBackendDataPayload, FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
7
|
-
export declare const getAuthRoute: () => string;
|
|
8
|
-
export declare const getFinalizeRoute: (applicationType: ApplicationType) => string;
|
|
9
|
-
export declare const getCallbackRoute: () => string;
|
|
10
|
-
export declare const getFetchBackendDataRoute: () => string;
|
|
5
|
+
import { AssistantSetupPayload, AssistantSetupResponse, AuthPayload, CallbackPayload, FetchBackendDataPayload, FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
11
6
|
export declare const handleWebhookSafely: (handler: (e: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>, logger: Logger) => (event: APIGatewayProxyEventV2) => Promise<LambdaFunctionURLResult>;
|
|
12
7
|
type CallbackHandler = (body: CallbackPayload<Record<string, unknown>, string>, e: APIGatewayProxyEventV2) => Promise<CallbackResponse<Record<string, unknown>>>;
|
|
13
8
|
type FinalizeHandler = (body: FinalizeWebhookPayload<Record<string, unknown>, {
|
|
@@ -18,6 +13,7 @@ type AuthHandler = (body: AuthPayload, e: APIGatewayProxyEventV2) => Promise<Aut
|
|
|
18
13
|
type FetchBackendDataHandler = (body: FetchBackendDataPayload<Record<string, unknown>, Record<string, unknown>>, e: APIGatewayProxyEventV2) => Promise<FetchBackendDataHandlerResponse>;
|
|
19
14
|
export declare const routeWebhookRequests: (handlers: {
|
|
20
15
|
configurator?: {
|
|
16
|
+
onAssistantSetup?: (body: AssistantSetupPayload, e: APIGatewayProxyEventV2) => Promise<AssistantSetupResponse>;
|
|
21
17
|
onFetchBackendData?: FetchBackendDataHandler;
|
|
22
18
|
onCallback?: CallbackHandler;
|
|
23
19
|
onFinalize?: FinalizeHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as o,match as
|
|
1
|
+
import{P as o,match as r}from"ts-pattern";import{ApplicationType as t}from"../../domain/index.js";import{validateTaskConfiguration as n}from"../tasks/index.js";import{createBackendDataResponse as e}from"./backend-data-response.js";import{AssistantSetupPayload as i,AssistantSetupResponse as a,AuthPayload as s,CallbackPayload as f,FetchBackendDataPayload as d,FinalizeWebhookPayload as c}from"./webhook-api-types.js";export const handleWebhookSafely=(o,r)=>async t=>{try{return await o(t)}catch(n){let o=`Webhook failed: ${n instanceof Error?n.message:"Unknown error"}`,t="object"==typeof n&&n instanceof Error?n:Error(o);return r.error(o,{},t),{statusCode:500,body:JSON.stringify({message:o})}}};export const routeWebhookRequests=(h,u)=>handleWebhookSafely(async p=>{if(!p.body)throw Error("No body found in the webhook event!");let w=JSON.parse(p.isBase64Encoded?Buffer.from(p.body,"base64").toString():p.body);return r(p.queryStringParameters?.o).with("assistantSetup",async()=>{if(!h.configurator?.onAssistantSetup)throw Error("Assistant setup operation is not configured for this webhook!");let o=await h.configurator.onAssistantSetup(i.parse(w),p);return{statusCode:200,body:JSON.stringify(a.parse(o))}}).with("auth",async()=>{if(u.info("Handling auth operation."),!h.onAuth)throw Error("Auth operation is not configured for this webhook!");let o=s.parse(w);return{statusCode:200,body:JSON.stringify(await h.onAuth(o,p))}}).with("callback",async()=>{if(u.info("Handling configurator callback operation."),!h.configurator?.onCallback)throw Error("Auth operation is not configured for this webhook!");let o=f.parse(w);return{statusCode:200,body:JSON.stringify(await h.configurator.onCallback(o,p))}}).with(o.union(void 0,"finalize"),()=>r(p.queryStringParameters?.t).with(t.Admin,async()=>{if(u.info("Handling admin finalize operation."),!h.admin?.onFinalize)throw Error("Admin finalize operation is not configured for this webhook!");let o=c.parse(w),r=await h.admin.onFinalize(o,p);return n(r),{statusCode:200,body:JSON.stringify(r)}}).with(o.union(void 0,t.Configurator),async()=>{if(u.info("Handling configurator finalize operation."),!h.configurator?.onFinalize)throw Error("Configurator finalize operation is not configured for this webhook!");let o=c.parse(w),r=await h.configurator.onFinalize(o,p);return n(r),{statusCode:200,body:JSON.stringify(r)}}).otherwise(o=>{throw Error(`Can not parse application type - unknown type: ${o}!`)})).with("fetchBackendData",async()=>{if(u.info("Handling fetch backend data operation."),!h.configurator?.onFetchBackendData)throw Error("Fetch backend data operation is not configured for this webhook!");let o=d.parse(w);return e(await h.configurator.onFetchBackendData(o,p),Object.entries(p.headers).find(([o])=>"accept-encoding"===o.toLowerCase())?.[1])}).otherwise(o=>{throw Error(`Can not parse webhook operation - unknown operation: ${o}!`)})},u);
|
|
@@ -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.
|
|
3
|
+
"version": "0.50.0-develop.ecda3c6152",
|
|
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.
|
|
57
|
+
"@salsita-ai/common": "0.50.0-develop.ecda3c6152"
|
|
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",
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type OpenAI from 'openai';
|
|
2
|
-
export declare const createAssistantMessage: (content?: string, toolCalls?: OpenAI.Chat.Completions.ChatCompletionMessageToolCall[]) => OpenAI.ChatCompletionAssistantMessageParam;
|
|
3
|
-
export declare const createToolCallResultMessage: (content: string, toolCallId: string) => OpenAI.Chat.Completions.ChatCompletionToolMessageParam;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const createAssistantMessage=(t,o)=>({role:"assistant",...t?{content:t}:void 0,...o?{tool_calls:o.filter(t=>"function"===t.type).map(t=>({id:t.id,function:t.function,type:"function"}))}:void 0});export const createToolCallResultMessage=(t,o)=>({role:"tool",content:t,tool_call_id:o});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const simpleAugmentationHandler=t=>e=>({result:e[t]?JSON.stringify(e):""});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JSONSchemaType } from 'ajv';
|
|
2
|
-
import type { Empty } from '../utils/types.js';
|
|
3
|
-
import type { ChatExecutableFunction, ChatFunction, ChatFunctionDefinition } from './types.js';
|
|
4
|
-
export declare const createChatExecutableFunction: <C extends Empty = Empty, R extends Empty = Empty, P = undefined>(name: string, parameters: JSONSchemaType<P> | undefined, func: ChatFunction<C, R, P>) => ChatExecutableFunction<C, R, P>;
|
|
5
|
-
export declare const createChatFunctionDefinition: <C extends Empty = Empty, R extends Empty = Empty, P = undefined>(name: string, description: string, parameters: JSONSchemaType<P> | undefined, func: ChatFunction<C, R, P>) => ChatFunctionDefinition<C, R, P>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createValidator as t}from"./validate.js";export const createChatExecutableFunction=(e,a,n)=>({name:e,function:n,validate:t(a)});export const createChatFunctionDefinition=(t,e,a,n)=>({description:e,parameters:a,...createChatExecutableFunction(t,a,n)});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { ApplicationType } from '../../domain/index.js';
|
|
2
|
-
import { type CallbackPayload, CallbackResponse, type FetchBackendDataPayload, type FinalizeWebhookPayload } from './webhook-api-types.js';
|
|
3
|
-
export type WebhookHttpClient = (url: string, init: RequestInit) => Promise<Response>;
|
|
4
|
-
export declare const fetchWebhookHttpClient: WebhookHttpClient;
|
|
5
|
-
export declare const createUrlWebhookHttpClient: (baseUrl: string, httpClient?: WebhookHttpClient) => WebhookHttpClient;
|
|
6
|
-
export declare class WebhookClient {
|
|
7
|
-
private readonly _httpClient;
|
|
8
|
-
constructor(httpClient: WebhookHttpClient);
|
|
9
|
-
/** @deprecated Pass createUrlWebhookHttpClient(baseUrl, httpClient) instead. This overload will be removed in a future version. */
|
|
10
|
-
constructor(baseUrl: string, httpClient?: WebhookHttpClient);
|
|
11
|
-
handleRefreshFlow: (refreshToken: string) => Promise<{
|
|
12
|
-
success: true;
|
|
13
|
-
data: Record<string, unknown>;
|
|
14
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
15
|
-
refreshToken?: string | undefined;
|
|
16
|
-
expirationTime?: number | undefined;
|
|
17
|
-
scopes?: string[] | undefined;
|
|
18
|
-
userId?: string | undefined;
|
|
19
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
20
|
-
} | {
|
|
21
|
-
success: false;
|
|
22
|
-
}>;
|
|
23
|
-
handleCodeFlow: (accessToken: string, refreshToken: string | undefined, idToken: string | undefined) => Promise<{
|
|
24
|
-
success: true;
|
|
25
|
-
data: Record<string, unknown>;
|
|
26
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
27
|
-
refreshToken?: string | undefined;
|
|
28
|
-
expirationTime?: number | undefined;
|
|
29
|
-
scopes?: string[] | undefined;
|
|
30
|
-
userId?: string | undefined;
|
|
31
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
32
|
-
} | {
|
|
33
|
-
success: false;
|
|
34
|
-
}>;
|
|
35
|
-
handleAnonymousFlow: () => Promise<{
|
|
36
|
-
success: true;
|
|
37
|
-
data: Record<string, unknown>;
|
|
38
|
-
role: "admin" | "anonymous" | "superadmin" | "user";
|
|
39
|
-
refreshToken?: string | undefined;
|
|
40
|
-
expirationTime?: number | undefined;
|
|
41
|
-
scopes?: string[] | undefined;
|
|
42
|
-
userId?: string | undefined;
|
|
43
|
-
userIdSource?: "clerk" | "custom" | undefined;
|
|
44
|
-
} | {
|
|
45
|
-
success: false;
|
|
46
|
-
}>;
|
|
47
|
-
finalize: (data: FinalizeWebhookPayload<Record<string, unknown>, {
|
|
48
|
-
id: string;
|
|
49
|
-
type: string;
|
|
50
|
-
}, Record<string, unknown>, Record<string, unknown>>, applicationType: ApplicationType) => Promise<{
|
|
51
|
-
dataVersion: 1;
|
|
52
|
-
tasks: (import("../tasks/call-lambda-back-task.js").CallLambdaBackTask<Record<string, unknown>, string> | import("../tasks/edit-google-spreadsheet-task.js").EditGoogleSpreadsheetTask | import("../tasks/generate-csv-task.js").GenerateCsvTask | import("../tasks/generate-images-task.js").GenerateImagesTask | import("../tasks/generate-pdf-task.js").GeneratePdfTask | import("../tasks/generate-pdf-task.js").GenerateStaticPdfTask | import("../tasks/send-email-task.js").SendEmailTask | import("../tasks/send-http-task.js").SendHttpRequestTask | import("../tasks/send-email-task.js").SendStaticEmailTask | import("../tasks/woocommerce-add-to-cart-task.js").WooCommerceAddToCartTask | {
|
|
53
|
-
type: "GenerateConfigurationLink";
|
|
54
|
-
name: string;
|
|
55
|
-
frontendUrl: string & import("@salsita-ai/common/utils").Brand<"FrontendUrl">;
|
|
56
|
-
expiration?: number | undefined;
|
|
57
|
-
access: "o" | "r" | "rr";
|
|
58
|
-
configurationId: string & import("@salsita-ai/common/utils").Brand<"ConfigurationId">;
|
|
59
|
-
revisionId?: import("../../domain/index.js").RevisionId | undefined;
|
|
60
|
-
} | {
|
|
61
|
-
type: "PublishRevision";
|
|
62
|
-
version: number & import("@salsita-ai/common/utils").Brand<"PublishedDataRevisionVersion">;
|
|
63
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
64
|
-
data: Record<string, unknown>;
|
|
65
|
-
} | {
|
|
66
|
-
type: "PublishRevisionChunks";
|
|
67
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
68
|
-
chunks: {
|
|
69
|
-
key: string & import("@salsita-ai/common/utils").Brand<"ChunkKey">;
|
|
70
|
-
scope: string & import("@salsita-ai/common/utils").Brand<"ChunkScope">;
|
|
71
|
-
data: Record<string, unknown>;
|
|
72
|
-
}[];
|
|
73
|
-
publishedDataHash: string;
|
|
74
|
-
} | {
|
|
75
|
-
type: "PublishRevisionChunksStaged";
|
|
76
|
-
revisionId: string & import("@salsita-ai/common/utils").Brand<"RevisionId">;
|
|
77
|
-
publishedDataHash: string;
|
|
78
|
-
})[];
|
|
79
|
-
resources: import("../index.js").FinalizeTaskResource<string>[];
|
|
80
|
-
}>;
|
|
81
|
-
callback: (payload: CallbackPayload<Record<string, unknown>, string>) => Promise<CallbackResponse<Record<string, unknown>>>;
|
|
82
|
-
fetchBackendData: (payload: FetchBackendDataPayload<Record<string, unknown>, Record<string, unknown>>) => Promise<{
|
|
83
|
-
backendData: Record<string, unknown>;
|
|
84
|
-
}>;
|
|
85
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{WebhookFinalizeTaskConfiguration as t}from"../tasks/index.js";import{AuthHandlerResponse as e,CallbackResponse as o,FetchBackendDataHandlerResponse as a}from"./webhook-api-types.js";import{getAuthRoute as i,getCallbackRoute as n,getFetchBackendDataRoute as r,getFinalizeRoute as s}from"./webhook-routing.js";export const fetchWebhookHttpClient=(t,e)=>fetch(t,e);export const createUrlWebhookHttpClient=(t,e=fetchWebhookHttpClient)=>(o,a)=>e(`${t}${o}`,a);export class WebhookClient{_httpClient;constructor(t,e=fetchWebhookHttpClient){this._httpClient="string"==typeof t?createUrlWebhookHttpClient(t,e):t}handleRefreshFlow=async t=>{let o=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"refresh",refreshToken:t})});if(!o.ok)throw Error(`Refresh webhook call failed: ${await o.text()}`);return e.parse(await o.json())};handleCodeFlow=async(t,o,a)=>{let n=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"code",accessToken:t,refreshToken:o,idToken:a})});if(!n.ok)throw Error(`Refresh webhook call failed: ${await n.text()}`);return e.parse(await n.json())};handleAnonymousFlow=async()=>{let t=await this._httpClient(i(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"anonymous"})});if(!t.ok)throw Error(`Refresh webhook call failed: ${await t.text()}`);return e.parse(await t.json())};finalize=async(e,o)=>{let a=await this._httpClient(s(o),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.ok)throw Error("Lambda call failed: "+await a.text());let i=await a.json();return t.parse(i)};callback=async t=>{let e=await this._httpClient(n(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw Error("Lambda call failed: "+await e.text());let a=await e.json();return o.parse(a)};fetchBackendData=async t=>{let e=await this._httpClient(r(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!e.ok)throw Error("Lambda call failed: "+await e.text());return a.parse(await e.json())}}
|