agentstack-sdk 0.6.0-rc4 → 0.6.1
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 +158 -34
- package/dist/client/a2a/extensions/common/form/schemas.d.ts +30 -26
- package/dist/client/a2a/extensions/common/form/types.d.ts +2 -1
- package/dist/client/a2a/extensions/services/form/schemas.d.ts +11 -11
- package/dist/client/core/handle-agent-card.d.ts +7 -7
- package/dist/client/core/index.d.ts +1 -0
- package/dist/client/core/utils/get-agent-card-path.d.ts +5 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/extensions.cjs +1 -1
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.js +1 -1
- package/dist/extensions.js.map +1 -1
- package/dist/extensions.umd.js +1 -1
- package/dist/extensions.umd.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
- package/src/client/a2a/extensions/common/form/schemas.ts +10 -19
- package/src/client/a2a/extensions/common/form/types.ts +2 -0
- package/src/client/core/index.ts +1 -0
- package/src/client/core/utils/get-agent-card-path.ts +8 -0
package/README.md
CHANGED
|
@@ -8,65 +8,189 @@ TypeScript/JavaScript client SDK for building applications that interact with Ag
|
|
|
8
8
|
|
|
9
9
|
## Overview
|
|
10
10
|
|
|
11
|
-
The `agentstack-sdk` provides TypeScript
|
|
11
|
+
The `agentstack-sdk` provides TypeScript and JavaScript tools for building client applications that communicate with agents deployed on Agent Stack. It includes utilities for handling the A2A (Agent2Agent) protocol, working with extensions, and calling the Agent Stack platform API.
|
|
12
12
|
|
|
13
13
|
## Key Features
|
|
14
14
|
|
|
15
|
-
- **A2A Protocol Support** -
|
|
16
|
-
- **Extension System** -
|
|
17
|
-
- **Platform API Client** -
|
|
18
|
-
- **
|
|
15
|
+
- **A2A Protocol Support** - Parse agent cards and task status updates with typed utilities
|
|
16
|
+
- **Extension System** - Resolve service demands and UI metadata with typed helpers
|
|
17
|
+
- **Platform API Client** - Typed access to core platform resources
|
|
18
|
+
- **Type Safe Responses** - Zod validated payloads with structured API error helpers
|
|
19
19
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npm install agentstack-sdk
|
|
23
|
+
npm install agentstack-sdk @a2a-js/sdk
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Quickstart
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
import {
|
|
30
|
+
buildApiClient,
|
|
31
|
+
createAuthenticatedFetch,
|
|
32
|
+
unwrapResult,
|
|
33
|
+
getAgentCardPath,
|
|
34
|
+
handleAgentCard,
|
|
35
|
+
handleTaskStatusUpdate,
|
|
36
|
+
resolveUserMetadata,
|
|
37
|
+
type TaskStatusUpdateType,
|
|
38
|
+
type Fulfillments,
|
|
39
|
+
} from "agentstack-sdk";
|
|
40
|
+
import {
|
|
41
|
+
ClientFactory,
|
|
42
|
+
ClientFactoryOptions,
|
|
43
|
+
DefaultAgentCardResolver,
|
|
44
|
+
JsonRpcTransportFactory,
|
|
45
|
+
} from "@a2a-js/sdk/client";
|
|
46
|
+
|
|
47
|
+
const baseUrl = "https://your-agentstack-instance.com";
|
|
48
|
+
const accessToken = "<user-access-token>";
|
|
49
|
+
|
|
50
|
+
const api = buildApiClient({
|
|
51
|
+
baseUrl,
|
|
52
|
+
fetch: createAuthenticatedFetch(accessToken),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const providers = unwrapResult(await api.listProviders());
|
|
56
|
+
const providerId = providers[0]?.id;
|
|
57
|
+
|
|
58
|
+
const context = unwrapResult(await api.createContext({ provider_id: providerId }));
|
|
59
|
+
const contextToken = unwrapResult(
|
|
60
|
+
await api.createContextToken({
|
|
61
|
+
context_id: context.id,
|
|
62
|
+
grant_global_permissions: {
|
|
63
|
+
llm: ["*"],
|
|
64
|
+
embeddings: ["*"],
|
|
65
|
+
a2a_proxy: ["*"],
|
|
66
|
+
},
|
|
67
|
+
grant_context_permissions: {
|
|
68
|
+
files: ["*"],
|
|
69
|
+
vector_stores: ["*"],
|
|
70
|
+
context_data: ["*"],
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
const fetchImpl = createAuthenticatedFetch(contextToken.token);
|
|
76
|
+
const factory = new ClientFactory(
|
|
77
|
+
ClientFactoryOptions.createFrom(ClientFactoryOptions.default, {
|
|
78
|
+
transports: [new JsonRpcTransportFactory({ fetchImpl })],
|
|
79
|
+
cardResolver: new DefaultAgentCardResolver({ fetchImpl }),
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const agentCardPath = getAgentCardPath(providerId);
|
|
84
|
+
const client = await factory.createFromUrl(baseUrl, agentCardPath);
|
|
85
|
+
|
|
86
|
+
const card = await client.getAgentCard();
|
|
87
|
+
const { resolveMetadata, demands } = handleAgentCard(card);
|
|
88
|
+
|
|
89
|
+
const selectedLlmModels: Record<string, string> = { default: "gpt-4o" };
|
|
90
|
+
|
|
91
|
+
const fulfillments: Fulfillments = {
|
|
92
|
+
llm: demands.llmDemands
|
|
93
|
+
? async ({ llm_demands }) => ({
|
|
94
|
+
llm_fulfillments: Object.fromEntries(
|
|
95
|
+
Object.keys(llm_demands).map((key) => [
|
|
96
|
+
key,
|
|
97
|
+
{
|
|
98
|
+
identifier: "llm_proxy",
|
|
99
|
+
api_base: `${baseUrl}/api/v1/openai/`,
|
|
100
|
+
api_key: contextToken.token,
|
|
101
|
+
api_model: selectedLlmModels[key],
|
|
102
|
+
},
|
|
103
|
+
]),
|
|
104
|
+
),
|
|
105
|
+
})
|
|
106
|
+
: undefined,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const agentMetadata = await resolveMetadata(fulfillments);
|
|
110
|
+
|
|
111
|
+
const stream = client.sendMessageStream({
|
|
112
|
+
message: {
|
|
113
|
+
kind: "message",
|
|
114
|
+
role: "user",
|
|
115
|
+
messageId: crypto.randomUUID(),
|
|
116
|
+
contextId: context.id,
|
|
117
|
+
parts: [{ kind: "text", text: "Hello" }],
|
|
118
|
+
metadata: agentMetadata,
|
|
119
|
+
}
|
|
120
|
+
});
|
|
33
121
|
|
|
34
|
-
|
|
35
|
-
const stream = client.sendMessage(message);
|
|
122
|
+
let taskId: string | undefined;
|
|
36
123
|
|
|
37
124
|
for await (const event of stream) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
case
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
125
|
+
switch (event.kind) {
|
|
126
|
+
case "task":
|
|
127
|
+
taskId = event.id;
|
|
128
|
+
case "status-update":
|
|
129
|
+
taskId = event.taskId;
|
|
130
|
+
|
|
131
|
+
for (const update of handleTaskStatusUpdate(event)) {
|
|
132
|
+
switch (update.type) {
|
|
133
|
+
case TaskStatusUpdateType.FormRequired:
|
|
134
|
+
// Render form
|
|
135
|
+
case TaskStatusUpdateType.OAuthRequired:
|
|
136
|
+
// Redirect to update.url
|
|
137
|
+
case TaskStatusUpdateType.SecretRequired:
|
|
138
|
+
// Prompt for secrets
|
|
139
|
+
case TaskStatusUpdateType.ApprovalRequired:
|
|
140
|
+
// Request approval
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
case "message":
|
|
144
|
+
// Render message parts and metadata
|
|
145
|
+
case "artifact-update":
|
|
146
|
+
// Render artifacts
|
|
47
147
|
}
|
|
48
148
|
}
|
|
49
149
|
```
|
|
50
150
|
|
|
51
|
-
##
|
|
151
|
+
## Core APIs
|
|
52
152
|
|
|
53
|
-
|
|
153
|
+
- `buildApiClient` returns a typed API client for platform endpoints.
|
|
154
|
+
- `handleAgentCard` extracts extension demands and returns `resolveMetadata`.
|
|
155
|
+
- `handleTaskStatusUpdate` parses A2A status updates into UI actions.
|
|
156
|
+
- `resolveUserMetadata` builds metadata when the user submits forms, canvas edits, or approvals.
|
|
157
|
+
- `createAuthenticatedFetch` helps add bearer auth headers to API calls.
|
|
158
|
+
- `buildLLMExtensionFulfillmentResolver` matches LLM providers and returns fulfillments.
|
|
159
|
+
- `unwrapResult` returns the response data on success, throws an `ApiErrorException` on error
|
|
54
160
|
|
|
55
|
-
|
|
56
|
-
- **OAuth** - Authentication flows (`OAuthExtensionClient`, `OAuthExtensionSpec`)
|
|
57
|
-
- **LLM Services** - Model access and credentials (`LLMServiceExtensionClient`, `buildLLMExtensionFulfillmentResolver`)
|
|
58
|
-
- **Platform API** - Context and resource access (`PlatformApiExtensionClient`, `buildApiClient`)
|
|
59
|
-
- **MCP** - Model Context Protocol integration (`MCPServiceExtensionClient`)
|
|
60
|
-
- **Embeddings** - Vector embedding services (`EmbeddingServiceExtensionClient`)
|
|
61
|
-
- **Secrets** - Secure credential management (`SecretsExtensionClient`)
|
|
62
|
-
- **Citations** - Source attribution (`citationExtension`)
|
|
63
|
-
- **Agent Details** - Metadata and UI enhancements (`AgentDetailExtensionSpec`)
|
|
161
|
+
## Extensions
|
|
64
162
|
|
|
65
|
-
|
|
163
|
+
Service extensions (client fulfillments):
|
|
66
164
|
|
|
67
|
-
|
|
165
|
+
- **Embedding** - Provide embedding access (`api_base`, `api_key`, `api_model`) for RAG or search.
|
|
166
|
+
- **Form** - Request structured user input via forms.
|
|
167
|
+
- **LLM** - Resolve model access and credentials for text generation.
|
|
168
|
+
- **MCP** - Connect Model Context Protocol services and tools.
|
|
169
|
+
- **OAuth** - Provide OAuth credentials or redirect URIs.
|
|
170
|
+
- **Platform API** - Inject context token metadata for platform access.
|
|
171
|
+
- **Secrets** - Supply or request secret values securely.
|
|
172
|
+
|
|
173
|
+
UI extensions (message metadata your UI can render):
|
|
174
|
+
|
|
175
|
+
- **Agent Detail** - Show agent specific metadata and context.
|
|
176
|
+
- **Approval** - Ask the user to approve actions or tool calls.
|
|
177
|
+
- **Canvas** - Provide canvas edit requests and updates.
|
|
178
|
+
- **Citation** - Display inline source references.
|
|
179
|
+
- **Error** - Render structured error messages.
|
|
180
|
+
- **Form Request** - Render interactive forms in the UI.
|
|
181
|
+
- **Settings** - Read or update runtime configuration values.
|
|
182
|
+
- **Trajectory** - Render execution traces or reasoning steps.
|
|
183
|
+
|
|
184
|
+
## Documentation
|
|
68
185
|
|
|
69
186
|
- [Agent Stack Documentation](https://agentstack.beeai.dev)
|
|
187
|
+
- [Getting Started](https://agentstack.beeai.dev/stable/custom-ui/getting-started)
|
|
188
|
+
- [A2A Client Integration](https://agentstack.beeai.dev/stable/custom-ui/a2a-client)
|
|
189
|
+
- [Agent Requirements](https://agentstack.beeai.dev/stable/custom-ui/agent-requirements)
|
|
190
|
+
- [Platform API Client](https://agentstack.beeai.dev/stable/custom-ui/platform-api-client)
|
|
191
|
+
|
|
192
|
+
## Resources
|
|
193
|
+
|
|
70
194
|
- [GitHub Repository](https://github.com/i-am-bee/agentstack)
|
|
71
195
|
- [npm Package](https://www.npmjs.com/package/agentstack-sdk)
|
|
72
196
|
|
|
@@ -6,13 +6,13 @@ import z from 'zod';
|
|
|
6
6
|
export declare const baseFieldSchema: z.ZodObject<{
|
|
7
7
|
id: z.ZodString;
|
|
8
8
|
label: z.ZodString;
|
|
9
|
-
required: z.ZodBoolean
|
|
9
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
10
10
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export declare const textFieldSchema: z.ZodObject<{
|
|
13
13
|
id: z.ZodString;
|
|
14
14
|
label: z.ZodString;
|
|
15
|
-
required: z.ZodBoolean
|
|
15
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
16
16
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
17
17
|
type: z.ZodLiteral<"text">;
|
|
18
18
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -22,7 +22,7 @@ export declare const textFieldSchema: z.ZodObject<{
|
|
|
22
22
|
export declare const dateFieldSchema: z.ZodObject<{
|
|
23
23
|
id: z.ZodString;
|
|
24
24
|
label: z.ZodString;
|
|
25
|
-
required: z.ZodBoolean
|
|
25
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
26
26
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
27
27
|
type: z.ZodLiteral<"date">;
|
|
28
28
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -31,15 +31,19 @@ export declare const dateFieldSchema: z.ZodObject<{
|
|
|
31
31
|
export declare const fileFieldSchema: z.ZodObject<{
|
|
32
32
|
id: z.ZodString;
|
|
33
33
|
label: z.ZodString;
|
|
34
|
-
required: z.ZodBoolean
|
|
34
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
35
35
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
36
36
|
type: z.ZodLiteral<"file">;
|
|
37
37
|
accept: z.ZodArray<z.ZodString>;
|
|
38
38
|
}, z.core.$strip>;
|
|
39
|
+
export declare const selectFieldOptionSchema: z.ZodObject<{
|
|
40
|
+
id: z.ZodString;
|
|
41
|
+
label: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
39
43
|
export declare const singleSelectFieldSchema: z.ZodObject<{
|
|
40
44
|
id: z.ZodString;
|
|
41
45
|
label: z.ZodString;
|
|
42
|
-
required: z.ZodBoolean
|
|
46
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
43
47
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
44
48
|
type: z.ZodLiteral<"singleselect">;
|
|
45
49
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -51,7 +55,7 @@ export declare const singleSelectFieldSchema: z.ZodObject<{
|
|
|
51
55
|
export declare const multiSelectFieldSchema: z.ZodObject<{
|
|
52
56
|
id: z.ZodString;
|
|
53
57
|
label: z.ZodString;
|
|
54
|
-
required: z.ZodBoolean
|
|
58
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
55
59
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
56
60
|
type: z.ZodLiteral<"multiselect">;
|
|
57
61
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -63,16 +67,16 @@ export declare const multiSelectFieldSchema: z.ZodObject<{
|
|
|
63
67
|
export declare const checkboxFieldSchema: z.ZodObject<{
|
|
64
68
|
id: z.ZodString;
|
|
65
69
|
label: z.ZodString;
|
|
66
|
-
required: z.ZodBoolean
|
|
70
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
67
71
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
68
72
|
type: z.ZodLiteral<"checkbox">;
|
|
69
73
|
content: z.ZodString;
|
|
70
|
-
default_value: z.ZodBoolean
|
|
74
|
+
default_value: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
71
75
|
}, z.core.$strip>;
|
|
72
76
|
export declare const formFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
73
77
|
id: z.ZodString;
|
|
74
78
|
label: z.ZodString;
|
|
75
|
-
required: z.ZodBoolean
|
|
79
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
76
80
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
77
81
|
type: z.ZodLiteral<"text">;
|
|
78
82
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -81,7 +85,7 @@ export declare const formFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
81
85
|
}, z.core.$strip>, z.ZodObject<{
|
|
82
86
|
id: z.ZodString;
|
|
83
87
|
label: z.ZodString;
|
|
84
|
-
required: z.ZodBoolean
|
|
88
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
85
89
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
86
90
|
type: z.ZodLiteral<"date">;
|
|
87
91
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -89,14 +93,14 @@ export declare const formFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
89
93
|
}, z.core.$strip>, z.ZodObject<{
|
|
90
94
|
id: z.ZodString;
|
|
91
95
|
label: z.ZodString;
|
|
92
|
-
required: z.ZodBoolean
|
|
96
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
93
97
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
94
98
|
type: z.ZodLiteral<"file">;
|
|
95
99
|
accept: z.ZodArray<z.ZodString>;
|
|
96
100
|
}, z.core.$strip>, z.ZodObject<{
|
|
97
101
|
id: z.ZodString;
|
|
98
102
|
label: z.ZodString;
|
|
99
|
-
required: z.ZodBoolean
|
|
103
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
100
104
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
101
105
|
type: z.ZodLiteral<"singleselect">;
|
|
102
106
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -107,7 +111,7 @@ export declare const formFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
107
111
|
}, z.core.$strip>, z.ZodObject<{
|
|
108
112
|
id: z.ZodString;
|
|
109
113
|
label: z.ZodString;
|
|
110
|
-
required: z.ZodBoolean
|
|
114
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
111
115
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
112
116
|
type: z.ZodLiteral<"multiselect">;
|
|
113
117
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -118,11 +122,11 @@ export declare const formFieldSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
118
122
|
}, z.core.$strip>, z.ZodObject<{
|
|
119
123
|
id: z.ZodString;
|
|
120
124
|
label: z.ZodString;
|
|
121
|
-
required: z.ZodBoolean
|
|
125
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
122
126
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
123
127
|
type: z.ZodLiteral<"checkbox">;
|
|
124
128
|
content: z.ZodString;
|
|
125
|
-
default_value: z.ZodBoolean
|
|
129
|
+
default_value: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
126
130
|
}, z.core.$strip>], "type">;
|
|
127
131
|
export declare const textFieldValueSchema: z.ZodObject<{
|
|
128
132
|
type: z.ZodLiteral<"text">;
|
|
@@ -176,14 +180,10 @@ export declare const formFieldValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
176
180
|
value: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
177
181
|
}, z.core.$strip>], "type">;
|
|
178
182
|
export declare const formRenderSchema: z.ZodObject<{
|
|
179
|
-
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
-
columns: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
182
|
-
submit_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
183
|
fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
184
184
|
id: z.ZodString;
|
|
185
185
|
label: z.ZodString;
|
|
186
|
-
required: z.ZodBoolean
|
|
186
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
187
187
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
188
188
|
type: z.ZodLiteral<"text">;
|
|
189
189
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -192,7 +192,7 @@ export declare const formRenderSchema: z.ZodObject<{
|
|
|
192
192
|
}, z.core.$strip>, z.ZodObject<{
|
|
193
193
|
id: z.ZodString;
|
|
194
194
|
label: z.ZodString;
|
|
195
|
-
required: z.ZodBoolean
|
|
195
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
196
196
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
197
197
|
type: z.ZodLiteral<"date">;
|
|
198
198
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -200,14 +200,14 @@ export declare const formRenderSchema: z.ZodObject<{
|
|
|
200
200
|
}, z.core.$strip>, z.ZodObject<{
|
|
201
201
|
id: z.ZodString;
|
|
202
202
|
label: z.ZodString;
|
|
203
|
-
required: z.ZodBoolean
|
|
203
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
204
204
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
205
205
|
type: z.ZodLiteral<"file">;
|
|
206
206
|
accept: z.ZodArray<z.ZodString>;
|
|
207
207
|
}, z.core.$strip>, z.ZodObject<{
|
|
208
208
|
id: z.ZodString;
|
|
209
209
|
label: z.ZodString;
|
|
210
|
-
required: z.ZodBoolean
|
|
210
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
211
211
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
212
212
|
type: z.ZodLiteral<"singleselect">;
|
|
213
213
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -218,7 +218,7 @@ export declare const formRenderSchema: z.ZodObject<{
|
|
|
218
218
|
}, z.core.$strip>, z.ZodObject<{
|
|
219
219
|
id: z.ZodString;
|
|
220
220
|
label: z.ZodString;
|
|
221
|
-
required: z.ZodBoolean
|
|
221
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
222
222
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
223
223
|
type: z.ZodLiteral<"multiselect">;
|
|
224
224
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -229,12 +229,16 @@ export declare const formRenderSchema: z.ZodObject<{
|
|
|
229
229
|
}, z.core.$strip>, z.ZodObject<{
|
|
230
230
|
id: z.ZodString;
|
|
231
231
|
label: z.ZodString;
|
|
232
|
-
required: z.ZodBoolean
|
|
232
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
233
233
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
234
234
|
type: z.ZodLiteral<"checkbox">;
|
|
235
235
|
content: z.ZodString;
|
|
236
|
-
default_value: z.ZodBoolean
|
|
236
|
+
default_value: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
237
237
|
}, z.core.$strip>], "type">>;
|
|
238
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
240
|
+
columns: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
241
|
+
submit_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
238
242
|
}, z.core.$strip>;
|
|
239
243
|
export declare const formValuesSchema: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
240
244
|
type: z.ZodLiteral<"text">;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import type z from 'zod';
|
|
6
|
-
import type { checkboxFieldSchema, checkboxFieldValueSchema, dateFieldSchema, dateFieldValueSchema, fileFieldSchema, fileFieldValueSchema, formFieldSchema, formFieldValueSchema, formRenderSchema, formResponseSchema, formValuesSchema, multiSelectFieldSchema, multiSelectFieldValueSchema, singleSelectFieldSchema, singleSelectFieldValueSchema, textFieldSchema, textFieldValueSchema } from './schemas';
|
|
6
|
+
import type { checkboxFieldSchema, checkboxFieldValueSchema, dateFieldSchema, dateFieldValueSchema, fileFieldSchema, fileFieldValueSchema, formFieldSchema, formFieldValueSchema, formRenderSchema, formResponseSchema, formValuesSchema, multiSelectFieldSchema, multiSelectFieldValueSchema, selectFieldOptionSchema, singleSelectFieldSchema, singleSelectFieldValueSchema, textFieldSchema, textFieldValueSchema } from './schemas';
|
|
7
7
|
export type TextField = z.infer<typeof textFieldSchema>;
|
|
8
8
|
export type DateField = z.infer<typeof dateFieldSchema>;
|
|
9
9
|
export type FileField = z.infer<typeof fileFieldSchema>;
|
|
10
|
+
export type SelectFieldOption = z.infer<typeof selectFieldOptionSchema>;
|
|
10
11
|
export type SingleSelectField = z.infer<typeof singleSelectFieldSchema>;
|
|
11
12
|
export type MultiSelectField = z.infer<typeof multiSelectFieldSchema>;
|
|
12
13
|
export type CheckboxField = z.infer<typeof checkboxFieldSchema>;
|
|
@@ -6,14 +6,10 @@ import z from 'zod';
|
|
|
6
6
|
export declare const formDemandsSchema: z.ZodObject<{
|
|
7
7
|
form_demands: z.ZodObject<{
|
|
8
8
|
initial_form: z.ZodOptional<z.ZodObject<{
|
|
9
|
-
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
-
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
-
columns: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
12
|
-
submit_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
9
|
fields: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
10
|
id: z.ZodString;
|
|
15
11
|
label: z.ZodString;
|
|
16
|
-
required: z.ZodBoolean
|
|
12
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
17
13
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
18
14
|
type: z.ZodLiteral<"text">;
|
|
19
15
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -22,7 +18,7 @@ export declare const formDemandsSchema: z.ZodObject<{
|
|
|
22
18
|
}, z.core.$strip>, z.ZodObject<{
|
|
23
19
|
id: z.ZodString;
|
|
24
20
|
label: z.ZodString;
|
|
25
|
-
required: z.ZodBoolean
|
|
21
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
26
22
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
27
23
|
type: z.ZodLiteral<"date">;
|
|
28
24
|
placeholder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -30,14 +26,14 @@ export declare const formDemandsSchema: z.ZodObject<{
|
|
|
30
26
|
}, z.core.$strip>, z.ZodObject<{
|
|
31
27
|
id: z.ZodString;
|
|
32
28
|
label: z.ZodString;
|
|
33
|
-
required: z.ZodBoolean
|
|
29
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
34
30
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
35
31
|
type: z.ZodLiteral<"file">;
|
|
36
32
|
accept: z.ZodArray<z.ZodString>;
|
|
37
33
|
}, z.core.$strip>, z.ZodObject<{
|
|
38
34
|
id: z.ZodString;
|
|
39
35
|
label: z.ZodString;
|
|
40
|
-
required: z.ZodBoolean
|
|
36
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
41
37
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
42
38
|
type: z.ZodLiteral<"singleselect">;
|
|
43
39
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -48,7 +44,7 @@ export declare const formDemandsSchema: z.ZodObject<{
|
|
|
48
44
|
}, z.core.$strip>, z.ZodObject<{
|
|
49
45
|
id: z.ZodString;
|
|
50
46
|
label: z.ZodString;
|
|
51
|
-
required: z.ZodBoolean
|
|
47
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
52
48
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
53
49
|
type: z.ZodLiteral<"multiselect">;
|
|
54
50
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -59,12 +55,16 @@ export declare const formDemandsSchema: z.ZodObject<{
|
|
|
59
55
|
}, z.core.$strip>, z.ZodObject<{
|
|
60
56
|
id: z.ZodString;
|
|
61
57
|
label: z.ZodString;
|
|
62
|
-
required: z.ZodBoolean
|
|
58
|
+
required: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
63
59
|
col_span: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
64
60
|
type: z.ZodLiteral<"checkbox">;
|
|
65
61
|
content: z.ZodString;
|
|
66
|
-
default_value: z.ZodBoolean
|
|
62
|
+
default_value: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
67
63
|
}, z.core.$strip>], "type">>;
|
|
64
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
66
|
+
columns: z.ZodOptional<z.ZodNullable<z.ZodInt>>;
|
|
67
|
+
submit_label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
68
|
}, z.core.$strip>>;
|
|
69
69
|
}, z.core.$strip>;
|
|
70
70
|
}, z.core.$strip>;
|
|
@@ -65,8 +65,8 @@ export declare const handleAgentCard: (agentCard: {
|
|
|
65
65
|
fields: ({
|
|
66
66
|
id: string;
|
|
67
67
|
label: string;
|
|
68
|
-
required: boolean;
|
|
69
68
|
type: "text";
|
|
69
|
+
required?: boolean | null | undefined;
|
|
70
70
|
col_span?: number | null | undefined;
|
|
71
71
|
placeholder?: string | null | undefined;
|
|
72
72
|
default_value?: string | null | undefined;
|
|
@@ -74,48 +74,48 @@ export declare const handleAgentCard: (agentCard: {
|
|
|
74
74
|
} | {
|
|
75
75
|
id: string;
|
|
76
76
|
label: string;
|
|
77
|
-
required: boolean;
|
|
78
77
|
type: "date";
|
|
78
|
+
required?: boolean | null | undefined;
|
|
79
79
|
col_span?: number | null | undefined;
|
|
80
80
|
placeholder?: string | null | undefined;
|
|
81
81
|
default_value?: string | null | undefined;
|
|
82
82
|
} | {
|
|
83
83
|
id: string;
|
|
84
84
|
label: string;
|
|
85
|
-
required: boolean;
|
|
86
85
|
type: "file";
|
|
87
86
|
accept: string[];
|
|
87
|
+
required?: boolean | null | undefined;
|
|
88
88
|
col_span?: number | null | undefined;
|
|
89
89
|
} | {
|
|
90
90
|
id: string;
|
|
91
91
|
label: string;
|
|
92
|
-
required: boolean;
|
|
93
92
|
type: "singleselect";
|
|
94
93
|
options: {
|
|
95
94
|
id: string;
|
|
96
95
|
label: string;
|
|
97
96
|
}[];
|
|
97
|
+
required?: boolean | null | undefined;
|
|
98
98
|
col_span?: number | null | undefined;
|
|
99
99
|
default_value?: string | null | undefined;
|
|
100
100
|
} | {
|
|
101
101
|
id: string;
|
|
102
102
|
label: string;
|
|
103
|
-
required: boolean;
|
|
104
103
|
type: "multiselect";
|
|
105
104
|
options: {
|
|
106
105
|
id: string;
|
|
107
106
|
label: string;
|
|
108
107
|
}[];
|
|
108
|
+
required?: boolean | null | undefined;
|
|
109
109
|
col_span?: number | null | undefined;
|
|
110
110
|
default_value?: string[] | null | undefined;
|
|
111
111
|
} | {
|
|
112
112
|
id: string;
|
|
113
113
|
label: string;
|
|
114
|
-
required: boolean;
|
|
115
114
|
type: "checkbox";
|
|
116
115
|
content: string;
|
|
117
|
-
|
|
116
|
+
required?: boolean | null | undefined;
|
|
118
117
|
col_span?: number | null | undefined;
|
|
118
|
+
default_value?: boolean | null | undefined;
|
|
119
119
|
})[];
|
|
120
120
|
title?: string | null | undefined;
|
|
121
121
|
description?: string | null | undefined;
|