@blazingagents/sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +366 -0
- package/dist/chat-transport.d.ts +17 -0
- package/dist/chat-transport.js +58 -0
- package/dist/client.d.ts +38 -0
- package/dist/client.js +86 -0
- package/dist/contracts/api.d.ts +256 -0
- package/dist/contracts/api.js +189 -0
- package/dist/contracts/entities/agent-tools.d.ts +26 -0
- package/dist/contracts/entities/agent-tools.js +52 -0
- package/dist/contracts/entities/agents.d.ts +183 -0
- package/dist/contracts/entities/agents.js +153 -0
- package/dist/contracts/entities/artifacts.d.ts +71 -0
- package/dist/contracts/entities/artifacts.js +71 -0
- package/dist/contracts/entities/attribution.d.ts +27 -0
- package/dist/contracts/entities/attribution.js +27 -0
- package/dist/contracts/entities/chat.d.ts +269 -0
- package/dist/contracts/entities/chat.js +198 -0
- package/dist/contracts/entities/mcp-connections.d.ts +421 -0
- package/dist/contracts/entities/mcp-connections.js +473 -0
- package/dist/contracts/entities/memories.d.ts +56 -0
- package/dist/contracts/entities/memories.js +62 -0
- package/dist/contracts/entities/prompts.d.ts +61 -0
- package/dist/contracts/entities/prompts.js +96 -0
- package/dist/contracts/entities/providers.d.ts +123 -0
- package/dist/contracts/entities/providers.js +111 -0
- package/dist/contracts/entities/sessions.d.ts +156 -0
- package/dist/contracts/entities/sessions.js +120 -0
- package/dist/contracts/entities/skills.d.ts +167 -0
- package/dist/contracts/entities/skills.js +153 -0
- package/dist/contracts/entities/tasks.d.ts +457 -0
- package/dist/contracts/entities/tasks.js +252 -0
- package/dist/contracts/entities/tenants.d.ts +69 -0
- package/dist/contracts/entities/tenants.js +54 -0
- package/dist/contracts/entities/usage.d.ts +95 -0
- package/dist/contracts/entities/usage.js +117 -0
- package/dist/contracts/entities/workspaces.d.ts +89 -0
- package/dist/contracts/entities/workspaces.js +71 -0
- package/dist/contracts/ids.d.ts +57 -0
- package/dist/contracts/ids.js +79 -0
- package/dist/contracts/index.d.ts +15 -0
- package/dist/contracts/index.js +16 -0
- package/dist/contracts/limitations.d.ts +138 -0
- package/dist/contracts/limitations.js +140 -0
- package/dist/contracts/utils.d.ts +3 -0
- package/dist/contracts/utils.js +7 -0
- package/dist/errors.d.ts +33 -0
- package/dist/errors.js +48 -0
- package/dist/generation.d.ts +5 -0
- package/dist/generation.js +422 -0
- package/dist/http.d.ts +21 -0
- package/dist/http.js +307 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +13 -0
- package/dist/relay.d.ts +20 -0
- package/dist/relay.js +113 -0
- package/dist/resources/agents.d.ts +8 -0
- package/dist/resources/agents.js +82 -0
- package/dist/resources/artifacts.d.ts +5 -0
- package/dist/resources/artifacts.js +29 -0
- package/dist/resources/mcp-connections.d.ts +2 -0
- package/dist/resources/mcp-connections.js +40 -0
- package/dist/resources/memories.d.ts +7 -0
- package/dist/resources/memories.js +33 -0
- package/dist/resources/prompts.d.ts +6 -0
- package/dist/resources/prompts.js +36 -0
- package/dist/resources/providers.d.ts +5 -0
- package/dist/resources/providers.js +38 -0
- package/dist/resources/sessions.d.ts +8 -0
- package/dist/resources/sessions.js +49 -0
- package/dist/resources/skills.d.ts +2 -0
- package/dist/resources/skills.js +49 -0
- package/dist/resources/tasks.d.ts +7 -0
- package/dist/resources/tasks.js +63 -0
- package/dist/resources/tenant.d.ts +6 -0
- package/dist/resources/tenant.js +19 -0
- package/dist/resources/usage.d.ts +7 -0
- package/dist/resources/usage.js +19 -0
- package/dist/resources/workspaces.d.ts +2 -0
- package/dist/resources/workspaces.js +31 -0
- package/dist/types.d.ts +381 -0
- package/dist/types.js +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const agentInstructionsSchema: z.ZodString;
|
|
3
|
+
/** Provider-native model id, passed through without interpretation. */
|
|
4
|
+
export declare const agentModelIdSchema: z.ZodString;
|
|
5
|
+
export declare const agentToolsSchema: z.ZodArray<z.ZodEnum<{
|
|
6
|
+
memory: "memory";
|
|
7
|
+
workspace: "workspace";
|
|
8
|
+
write_todos: "write_todos";
|
|
9
|
+
}>>;
|
|
10
|
+
export declare const agentMcpConnectionIdsSchema: z.ZodArray<z.ZodString>;
|
|
11
|
+
export declare const agentVersionNumberSchema: z.ZodNumber;
|
|
12
|
+
export declare const agentStatusSchema: z.ZodEnum<{
|
|
13
|
+
active: "active";
|
|
14
|
+
disabled: "disabled";
|
|
15
|
+
}>;
|
|
16
|
+
export declare const agentSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
tenantId: z.ZodString;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
model: z.ZodNullable<z.ZodString>;
|
|
21
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
22
|
+
workspaceId: z.ZodString;
|
|
23
|
+
memoryInjectionEnabled: z.ZodBoolean;
|
|
24
|
+
tools: z.ZodArray<z.ZodEnum<{
|
|
25
|
+
memory: "memory";
|
|
26
|
+
workspace: "workspace";
|
|
27
|
+
write_todos: "write_todos";
|
|
28
|
+
}>>;
|
|
29
|
+
instructions: z.ZodString;
|
|
30
|
+
userId: z.ZodString;
|
|
31
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
+
mcpConnectionIds: z.ZodArray<z.ZodString>;
|
|
33
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
34
|
+
createdAt: z.ZodISODateTime;
|
|
35
|
+
updatedAt: z.ZodISODateTime;
|
|
36
|
+
version: z.ZodNumber;
|
|
37
|
+
status: z.ZodEnum<{
|
|
38
|
+
active: "active";
|
|
39
|
+
disabled: "disabled";
|
|
40
|
+
}>;
|
|
41
|
+
}, z.core.$strict>;
|
|
42
|
+
export declare const agentsResponseSchema: z.ZodObject<{
|
|
43
|
+
agents: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
tenantId: z.ZodString;
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
model: z.ZodNullable<z.ZodString>;
|
|
48
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
49
|
+
workspaceId: z.ZodString;
|
|
50
|
+
memoryInjectionEnabled: z.ZodBoolean;
|
|
51
|
+
tools: z.ZodArray<z.ZodEnum<{
|
|
52
|
+
memory: "memory";
|
|
53
|
+
workspace: "workspace";
|
|
54
|
+
write_todos: "write_todos";
|
|
55
|
+
}>>;
|
|
56
|
+
instructions: z.ZodString;
|
|
57
|
+
userId: z.ZodString;
|
|
58
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
59
|
+
mcpConnectionIds: z.ZodArray<z.ZodString>;
|
|
60
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
61
|
+
createdAt: z.ZodISODateTime;
|
|
62
|
+
updatedAt: z.ZodISODateTime;
|
|
63
|
+
version: z.ZodNumber;
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
active: "active";
|
|
66
|
+
disabled: "disabled";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export declare const agentResponseSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
tenantId: z.ZodString;
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
model: z.ZodNullable<z.ZodString>;
|
|
75
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
76
|
+
workspaceId: z.ZodString;
|
|
77
|
+
memoryInjectionEnabled: z.ZodBoolean;
|
|
78
|
+
tools: z.ZodArray<z.ZodEnum<{
|
|
79
|
+
memory: "memory";
|
|
80
|
+
workspace: "workspace";
|
|
81
|
+
write_todos: "write_todos";
|
|
82
|
+
}>>;
|
|
83
|
+
instructions: z.ZodString;
|
|
84
|
+
userId: z.ZodString;
|
|
85
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
86
|
+
mcpConnectionIds: z.ZodArray<z.ZodString>;
|
|
87
|
+
avatarUrl: z.ZodNullable<z.ZodURL>;
|
|
88
|
+
createdAt: z.ZodISODateTime;
|
|
89
|
+
updatedAt: z.ZodISODateTime;
|
|
90
|
+
version: z.ZodNumber;
|
|
91
|
+
status: z.ZodEnum<{
|
|
92
|
+
active: "active";
|
|
93
|
+
disabled: "disabled";
|
|
94
|
+
}>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export declare const agentsListQuerySchema: z.ZodObject<{
|
|
97
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
98
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
export declare const agentVersionSchema: z.ZodObject<{
|
|
101
|
+
agentId: z.ZodString;
|
|
102
|
+
tenantId: z.ZodString;
|
|
103
|
+
version: z.ZodNumber;
|
|
104
|
+
name: z.ZodString;
|
|
105
|
+
model: z.ZodNullable<z.ZodString>;
|
|
106
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
107
|
+
memoryInjectionEnabled: z.ZodBoolean;
|
|
108
|
+
tools: z.ZodArray<z.ZodEnum<{
|
|
109
|
+
memory: "memory";
|
|
110
|
+
workspace: "workspace";
|
|
111
|
+
write_todos: "write_todos";
|
|
112
|
+
}>>;
|
|
113
|
+
instructions: z.ZodString;
|
|
114
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
115
|
+
mcpConnectionIds: z.ZodArray<z.ZodString>;
|
|
116
|
+
createdAt: z.ZodISODateTime;
|
|
117
|
+
}, z.core.$strict>;
|
|
118
|
+
export declare const agentVersionsListQuerySchema: z.ZodObject<{
|
|
119
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
120
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
export declare const agentVersionsResponseSchema: z.ZodObject<{
|
|
123
|
+
data: z.ZodArray<z.ZodObject<{
|
|
124
|
+
agentId: z.ZodString;
|
|
125
|
+
tenantId: z.ZodString;
|
|
126
|
+
version: z.ZodNumber;
|
|
127
|
+
name: z.ZodString;
|
|
128
|
+
model: z.ZodNullable<z.ZodString>;
|
|
129
|
+
providerId: z.ZodNullable<z.ZodString>;
|
|
130
|
+
memoryInjectionEnabled: z.ZodBoolean;
|
|
131
|
+
tools: z.ZodArray<z.ZodEnum<{
|
|
132
|
+
memory: "memory";
|
|
133
|
+
workspace: "workspace";
|
|
134
|
+
write_todos: "write_todos";
|
|
135
|
+
}>>;
|
|
136
|
+
instructions: z.ZodString;
|
|
137
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
138
|
+
mcpConnectionIds: z.ZodArray<z.ZodString>;
|
|
139
|
+
createdAt: z.ZodISODateTime;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
export declare const createAgentBodySchema: z.ZodObject<{
|
|
144
|
+
name: z.ZodString;
|
|
145
|
+
model: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
146
|
+
providerId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
147
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
memoryInjectionEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
149
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
150
|
+
memory: "memory";
|
|
151
|
+
workspace: "workspace";
|
|
152
|
+
write_todos: "write_todos";
|
|
153
|
+
}>>>;
|
|
154
|
+
instructions: z.ZodDefault<z.ZodString>;
|
|
155
|
+
userId: z.ZodDefault<z.ZodString>;
|
|
156
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
157
|
+
mcpConnectionIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
export declare const updateAgentBodySchema: z.ZodObject<{
|
|
160
|
+
name: z.ZodOptional<z.ZodString>;
|
|
161
|
+
model: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
162
|
+
providerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
163
|
+
workspaceId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
memoryInjectionEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
165
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
166
|
+
memory: "memory";
|
|
167
|
+
workspace: "workspace";
|
|
168
|
+
write_todos: "write_todos";
|
|
169
|
+
}>>>;
|
|
170
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
171
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
172
|
+
mcpConnectionIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
173
|
+
}, z.core.$strict>;
|
|
174
|
+
export type Agent = z.infer<typeof agentSchema>;
|
|
175
|
+
export type AgentsResponse = z.infer<typeof agentsResponseSchema>;
|
|
176
|
+
export type AgentResponse = z.infer<typeof agentResponseSchema>;
|
|
177
|
+
export type AgentsListQuery = z.infer<typeof agentsListQuerySchema>;
|
|
178
|
+
export type AgentVersion = z.infer<typeof agentVersionSchema>;
|
|
179
|
+
export type AgentStatus = z.infer<typeof agentStatusSchema>;
|
|
180
|
+
export type AgentVersionsListQuery = z.infer<typeof agentVersionsListQuerySchema>;
|
|
181
|
+
export type AgentVersionsResponse = z.infer<typeof agentVersionsResponseSchema>;
|
|
182
|
+
export type CreateAgentBody = z.input<typeof createAgentBodySchema>;
|
|
183
|
+
export type UpdateAgentBody = z.infer<typeof updateAgentBodySchema>;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { cursorSchema, paginatedResponseSchema } from "../api.js";
|
|
3
|
+
import { agentIdSchema, mcpConnectionIdSchema, providerIdSchema, tenantIdSchema, workspaceIdSchema, } from "../ids.js";
|
|
4
|
+
import { DEFAULT_AGENT_VERSIONS_LIST_LIMIT, MAX_AGENT_INSTRUCTIONS_LENGTH, MAX_AGENT_NAME_LENGTH, MAX_AGENT_VERSIONS_LIST_LIMIT, MAX_MCP_CONNECTIONS_PER_AGENT, } from "../limitations.js";
|
|
5
|
+
import { atLeastOneFieldMessage, hasObjectKeys, hasUniqueValues, } from "../utils.js";
|
|
6
|
+
import { agentToolGroupIds } from "./agent-tools.js";
|
|
7
|
+
import { metadataSchema, userIdSchema } from "./attribution.js";
|
|
8
|
+
const agentNameSchema = z.string().trim().min(1).max(MAX_AGENT_NAME_LENGTH);
|
|
9
|
+
export const agentInstructionsSchema = z
|
|
10
|
+
.string()
|
|
11
|
+
.max(MAX_AGENT_INSTRUCTIONS_LENGTH);
|
|
12
|
+
/** Provider-native model id, passed through without interpretation. */
|
|
13
|
+
export const agentModelIdSchema = z.string().trim().min(1);
|
|
14
|
+
export const agentToolsSchema = z
|
|
15
|
+
.array(z.enum(agentToolGroupIds))
|
|
16
|
+
.refine(hasUniqueValues, {
|
|
17
|
+
message: "Tool group ids must be unique.",
|
|
18
|
+
});
|
|
19
|
+
export const agentMcpConnectionIdsSchema = z
|
|
20
|
+
.array(mcpConnectionIdSchema)
|
|
21
|
+
.max(MAX_MCP_CONNECTIONS_PER_AGENT)
|
|
22
|
+
.refine(hasUniqueValues, {
|
|
23
|
+
message: "MCP connection ids must be unique.",
|
|
24
|
+
});
|
|
25
|
+
export const agentVersionNumberSchema = z
|
|
26
|
+
.number()
|
|
27
|
+
.int()
|
|
28
|
+
.min(1)
|
|
29
|
+
.max(2_147_483_647);
|
|
30
|
+
export const agentStatusSchema = z.enum(["active", "disabled"]);
|
|
31
|
+
const providerModelPairMessage = "Provider and model must either both be set or both be null.";
|
|
32
|
+
function hasProviderModelPair(input) {
|
|
33
|
+
return (input.model === null) === (input.providerId === null);
|
|
34
|
+
}
|
|
35
|
+
export const agentSchema = z
|
|
36
|
+
.object({
|
|
37
|
+
id: agentIdSchema,
|
|
38
|
+
tenantId: tenantIdSchema,
|
|
39
|
+
name: agentNameSchema,
|
|
40
|
+
model: agentModelIdSchema.nullable(),
|
|
41
|
+
providerId: providerIdSchema.nullable(),
|
|
42
|
+
workspaceId: workspaceIdSchema,
|
|
43
|
+
memoryInjectionEnabled: z.boolean(),
|
|
44
|
+
tools: agentToolsSchema,
|
|
45
|
+
instructions: agentInstructionsSchema,
|
|
46
|
+
userId: userIdSchema,
|
|
47
|
+
metadata: metadataSchema,
|
|
48
|
+
mcpConnectionIds: agentMcpConnectionIdsSchema,
|
|
49
|
+
/** A short-lived signed URL for the private, platform-owned avatar. */
|
|
50
|
+
avatarUrl: z.url().nullable(),
|
|
51
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
52
|
+
updatedAt: z.iso.datetime({ offset: true }),
|
|
53
|
+
version: agentVersionNumberSchema,
|
|
54
|
+
status: agentStatusSchema,
|
|
55
|
+
})
|
|
56
|
+
.strict()
|
|
57
|
+
.refine(hasProviderModelPair, {
|
|
58
|
+
message: providerModelPairMessage,
|
|
59
|
+
path: ["providerId"],
|
|
60
|
+
});
|
|
61
|
+
export const agentsResponseSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
agents: z.array(agentSchema),
|
|
64
|
+
})
|
|
65
|
+
.strict();
|
|
66
|
+
export const agentResponseSchema = agentSchema;
|
|
67
|
+
export const agentsListQuerySchema = z
|
|
68
|
+
.object({
|
|
69
|
+
userId: userIdSchema.optional(),
|
|
70
|
+
workspaceId: workspaceIdSchema.optional(),
|
|
71
|
+
})
|
|
72
|
+
.strict();
|
|
73
|
+
export const agentVersionSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
agentId: agentIdSchema,
|
|
76
|
+
tenantId: tenantIdSchema,
|
|
77
|
+
version: agentVersionNumberSchema,
|
|
78
|
+
name: agentSchema.shape.name,
|
|
79
|
+
model: agentSchema.shape.model,
|
|
80
|
+
providerId: agentSchema.shape.providerId,
|
|
81
|
+
memoryInjectionEnabled: agentSchema.shape.memoryInjectionEnabled,
|
|
82
|
+
tools: agentSchema.shape.tools,
|
|
83
|
+
instructions: agentSchema.shape.instructions,
|
|
84
|
+
metadata: agentSchema.shape.metadata,
|
|
85
|
+
mcpConnectionIds: agentSchema.shape.mcpConnectionIds,
|
|
86
|
+
createdAt: agentSchema.shape.createdAt,
|
|
87
|
+
})
|
|
88
|
+
.strict()
|
|
89
|
+
.refine(hasProviderModelPair, {
|
|
90
|
+
message: providerModelPairMessage,
|
|
91
|
+
path: ["providerId"],
|
|
92
|
+
});
|
|
93
|
+
export const agentVersionsListQuerySchema = z
|
|
94
|
+
.object({
|
|
95
|
+
cursor: cursorSchema.optional(),
|
|
96
|
+
limit: z.coerce
|
|
97
|
+
.number()
|
|
98
|
+
.int()
|
|
99
|
+
.min(1)
|
|
100
|
+
.max(MAX_AGENT_VERSIONS_LIST_LIMIT)
|
|
101
|
+
.default(DEFAULT_AGENT_VERSIONS_LIST_LIMIT),
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
export const agentVersionsResponseSchema = paginatedResponseSchema(agentVersionSchema);
|
|
105
|
+
export const createAgentBodySchema = z
|
|
106
|
+
.object({
|
|
107
|
+
name: agentNameSchema,
|
|
108
|
+
model: agentModelIdSchema.nullable().default(null),
|
|
109
|
+
providerId: providerIdSchema.nullable().default(null),
|
|
110
|
+
workspaceId: workspaceIdSchema.optional(),
|
|
111
|
+
memoryInjectionEnabled: z.boolean().default(false),
|
|
112
|
+
tools: agentToolsSchema.default([]),
|
|
113
|
+
instructions: agentInstructionsSchema.default(""),
|
|
114
|
+
userId: userIdSchema.default(""),
|
|
115
|
+
metadata: metadataSchema.default({}),
|
|
116
|
+
mcpConnectionIds: agentMcpConnectionIdsSchema.default([]),
|
|
117
|
+
})
|
|
118
|
+
.strict()
|
|
119
|
+
.refine(hasProviderModelPair, {
|
|
120
|
+
message: providerModelPairMessage,
|
|
121
|
+
path: ["providerId"],
|
|
122
|
+
});
|
|
123
|
+
export const updateAgentBodySchema = z
|
|
124
|
+
.object({
|
|
125
|
+
name: agentNameSchema.optional(),
|
|
126
|
+
model: agentModelIdSchema.nullable().optional(),
|
|
127
|
+
providerId: providerIdSchema.nullable().optional(),
|
|
128
|
+
workspaceId: workspaceIdSchema.optional(),
|
|
129
|
+
memoryInjectionEnabled: z.boolean().optional(),
|
|
130
|
+
tools: agentToolsSchema.optional(),
|
|
131
|
+
instructions: agentInstructionsSchema.optional(),
|
|
132
|
+
metadata: metadataSchema.optional(),
|
|
133
|
+
mcpConnectionIds: agentMcpConnectionIdsSchema.optional(),
|
|
134
|
+
})
|
|
135
|
+
.strict()
|
|
136
|
+
.refine(hasObjectKeys, {
|
|
137
|
+
message: atLeastOneFieldMessage,
|
|
138
|
+
})
|
|
139
|
+
.refine((input) => {
|
|
140
|
+
if (input.model === undefined && input.providerId === undefined) {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
if (input.providerId === undefined) {
|
|
144
|
+
return input.model !== null;
|
|
145
|
+
}
|
|
146
|
+
if (input.model === undefined) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return (input.model === null) === (input.providerId === null);
|
|
150
|
+
}, {
|
|
151
|
+
message: providerModelPairMessage,
|
|
152
|
+
path: ["providerId"],
|
|
153
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const artifactFilenameSchema: z.ZodString;
|
|
3
|
+
/**
|
|
4
|
+
* Public metadata returned by Tenant-level Artifact resources.
|
|
5
|
+
*/
|
|
6
|
+
export declare const artifactListItemSchema: z.ZodObject<{
|
|
7
|
+
artifactId: z.ZodString;
|
|
8
|
+
agentId: z.ZodString;
|
|
9
|
+
tenantId: z.ZodString;
|
|
10
|
+
sessionId: z.ZodString;
|
|
11
|
+
filename: z.ZodString;
|
|
12
|
+
mediaType: z.ZodString;
|
|
13
|
+
sizeBytes: z.ZodNumber;
|
|
14
|
+
userId: z.ZodString;
|
|
15
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
16
|
+
createdAt: z.ZodISODateTime;
|
|
17
|
+
updatedAt: z.ZodISODateTime;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export declare const artifactsListResponseSchema: z.ZodObject<{
|
|
20
|
+
data: z.ZodArray<z.ZodObject<{
|
|
21
|
+
artifactId: z.ZodString;
|
|
22
|
+
agentId: z.ZodString;
|
|
23
|
+
tenantId: z.ZodString;
|
|
24
|
+
sessionId: z.ZodString;
|
|
25
|
+
filename: z.ZodString;
|
|
26
|
+
mediaType: z.ZodString;
|
|
27
|
+
sizeBytes: z.ZodNumber;
|
|
28
|
+
userId: z.ZodString;
|
|
29
|
+
metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
30
|
+
createdAt: z.ZodISODateTime;
|
|
31
|
+
updatedAt: z.ZodISODateTime;
|
|
32
|
+
}, z.core.$strict>>;
|
|
33
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
export declare const artifactsListQuerySchema: z.ZodObject<{
|
|
36
|
+
agentId: z.ZodOptional<z.ZodString>;
|
|
37
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
38
|
+
cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export declare const publishArtifactsInputSchema: z.ZodObject<{
|
|
41
|
+
paths: z.ZodArray<z.ZodString>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export declare const publishArtifactResultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
44
|
+
artifactId: z.ZodString;
|
|
45
|
+
path: z.ZodString;
|
|
46
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
47
|
+
error: z.ZodLiteral<true>;
|
|
48
|
+
message: z.ZodString;
|
|
49
|
+
path: z.ZodString;
|
|
50
|
+
}, z.core.$strict>]>;
|
|
51
|
+
export declare const publishArtifactsOutputSchema: z.ZodObject<{
|
|
52
|
+
results: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
53
|
+
artifactId: z.ZodString;
|
|
54
|
+
path: z.ZodString;
|
|
55
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
+
error: z.ZodLiteral<true>;
|
|
57
|
+
message: z.ZodString;
|
|
58
|
+
path: z.ZodString;
|
|
59
|
+
}, z.core.$strict>]>>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
export declare const artifactDownloadUrlResponseSchema: z.ZodObject<{
|
|
62
|
+
url: z.ZodURL;
|
|
63
|
+
expiresAt: z.ZodISODateTime;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type ArtifactListItem = z.infer<typeof artifactListItemSchema>;
|
|
66
|
+
export type ArtifactsListResponse = z.infer<typeof artifactsListResponseSchema>;
|
|
67
|
+
export type ArtifactsListQuery = z.infer<typeof artifactsListQuerySchema>;
|
|
68
|
+
export type PublishArtifactsInput = z.infer<typeof publishArtifactsInputSchema>;
|
|
69
|
+
export type PublishArtifactResult = z.infer<typeof publishArtifactResultSchema>;
|
|
70
|
+
export type PublishArtifactsOutput = z.infer<typeof publishArtifactsOutputSchema>;
|
|
71
|
+
export type ArtifactDownloadUrlResponse = z.infer<typeof artifactDownloadUrlResponseSchema>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { paginatedResponseSchema } from "../api.js";
|
|
3
|
+
import { agentIdSchema, artifactIdSchema, sessionIdSchema, tenantIdSchema, } from "../ids.js";
|
|
4
|
+
import { MAX_ARTIFACT_BYTES, MAX_ARTIFACT_PUBLICATIONS_PER_CALL, } from "../limitations.js";
|
|
5
|
+
import { metadataSchema, userIdSchema } from "./attribution.js";
|
|
6
|
+
export const artifactFilenameSchema = z
|
|
7
|
+
.string()
|
|
8
|
+
.min(1)
|
|
9
|
+
.refine((filename) => filename.trim().length > 0)
|
|
10
|
+
.refine((filename) => filename !== "." && filename !== "..")
|
|
11
|
+
.refine((filename) => !(filename.includes("/") || filename.includes("\\")));
|
|
12
|
+
/**
|
|
13
|
+
* Public metadata returned by Tenant-level Artifact resources.
|
|
14
|
+
*/
|
|
15
|
+
export const artifactListItemSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
artifactId: artifactIdSchema,
|
|
18
|
+
agentId: agentIdSchema,
|
|
19
|
+
tenantId: tenantIdSchema,
|
|
20
|
+
sessionId: sessionIdSchema,
|
|
21
|
+
filename: artifactFilenameSchema,
|
|
22
|
+
mediaType: z.string().trim().min(1),
|
|
23
|
+
sizeBytes: z.number().int().nonnegative().max(MAX_ARTIFACT_BYTES),
|
|
24
|
+
userId: userIdSchema,
|
|
25
|
+
metadata: metadataSchema,
|
|
26
|
+
createdAt: z.iso.datetime({ offset: true }),
|
|
27
|
+
updatedAt: z.iso.datetime({ offset: true }),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
export const artifactsListResponseSchema = paginatedResponseSchema(artifactListItemSchema);
|
|
31
|
+
export const artifactsListQuerySchema = z
|
|
32
|
+
.object({
|
|
33
|
+
agentId: agentIdSchema.optional(),
|
|
34
|
+
sessionId: sessionIdSchema.optional(),
|
|
35
|
+
cursor: z.string().nullable().optional(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export const publishArtifactsInputSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
paths: z
|
|
41
|
+
.array(z.string().trim().min(1))
|
|
42
|
+
.min(1)
|
|
43
|
+
.max(MAX_ARTIFACT_PUBLICATIONS_PER_CALL),
|
|
44
|
+
})
|
|
45
|
+
.strict();
|
|
46
|
+
export const publishArtifactResultSchema = z.union([
|
|
47
|
+
z
|
|
48
|
+
.object({
|
|
49
|
+
artifactId: artifactIdSchema,
|
|
50
|
+
path: z.string().trim().min(1),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
z
|
|
54
|
+
.object({
|
|
55
|
+
error: z.literal(true),
|
|
56
|
+
message: z.string().trim().min(1),
|
|
57
|
+
path: z.string().trim().min(1),
|
|
58
|
+
})
|
|
59
|
+
.strict(),
|
|
60
|
+
]);
|
|
61
|
+
export const publishArtifactsOutputSchema = z
|
|
62
|
+
.object({
|
|
63
|
+
results: z.array(publishArtifactResultSchema).min(1),
|
|
64
|
+
})
|
|
65
|
+
.strict();
|
|
66
|
+
export const artifactDownloadUrlResponseSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
url: z.url(),
|
|
69
|
+
expiresAt: z.iso.datetime({ offset: true }),
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* End-user attribution — the uniform ownership dimension on every
|
|
4
|
+
* tenant-owned product resource (ADR-0001). `userId` is an opaque
|
|
5
|
+
* tenant-chosen string (`''` = tenant-level, immutable after creation);
|
|
6
|
+
* `metadata` is a mutable jsonb object. Neither is ever on tenant config
|
|
7
|
+
* (apikeys, providers, quotas).
|
|
8
|
+
*
|
|
9
|
+
* These are the shared zod primitives every attributed entity reuses so the
|
|
10
|
+
* two fields stay shape-identical across agents, Workspaces, prompts,
|
|
11
|
+
* sessions, tasks, task runs, artifacts, and usage rows.
|
|
12
|
+
*/
|
|
13
|
+
export declare const userIdSchema: z.ZodString;
|
|
14
|
+
export declare const metadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
/**
|
|
16
|
+
* The create-body shape for an attributed resource: both fields optional
|
|
17
|
+
* with tenant-level defaults (`userId: ''`, `metadata: {}`). `userId` is
|
|
18
|
+
* set at creation and immutable — update bodies accept `metadata` only
|
|
19
|
+
* (they do not include `userId`, so a `userId` in a PUT body is rejected
|
|
20
|
+
* by the update body's `.strict()`).
|
|
21
|
+
*/
|
|
22
|
+
export declare const attributionCreateInputSchema: z.ZodObject<{
|
|
23
|
+
userId: z.ZodDefault<z.ZodString>;
|
|
24
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type UserId = z.infer<typeof userIdSchema>;
|
|
27
|
+
export type Metadata = z.infer<typeof metadataSchema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* End-user attribution — the uniform ownership dimension on every
|
|
4
|
+
* tenant-owned product resource (ADR-0001). `userId` is an opaque
|
|
5
|
+
* tenant-chosen string (`''` = tenant-level, immutable after creation);
|
|
6
|
+
* `metadata` is a mutable jsonb object. Neither is ever on tenant config
|
|
7
|
+
* (apikeys, providers, quotas).
|
|
8
|
+
*
|
|
9
|
+
* These are the shared zod primitives every attributed entity reuses so the
|
|
10
|
+
* two fields stay shape-identical across agents, Workspaces, prompts,
|
|
11
|
+
* sessions, tasks, task runs, artifacts, and usage rows.
|
|
12
|
+
*/
|
|
13
|
+
export const userIdSchema = z.string();
|
|
14
|
+
export const metadataSchema = z.record(z.string(), z.unknown());
|
|
15
|
+
/**
|
|
16
|
+
* The create-body shape for an attributed resource: both fields optional
|
|
17
|
+
* with tenant-level defaults (`userId: ''`, `metadata: {}`). `userId` is
|
|
18
|
+
* set at creation and immutable — update bodies accept `metadata` only
|
|
19
|
+
* (they do not include `userId`, so a `userId` in a PUT body is rejected
|
|
20
|
+
* by the update body's `.strict()`).
|
|
21
|
+
*/
|
|
22
|
+
export const attributionCreateInputSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
userId: userIdSchema.default(""),
|
|
25
|
+
metadata: metadataSchema.default({}),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|