@takeshape/schema 11.133.4 → 11.142.5
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/dist/agents.d.ts +2 -4
- package/dist/agents.js +99 -98
- package/dist/builtin-schema.js +66 -16
- package/dist/layers/refs.d.ts +1 -1
- package/dist/models/project-schema.d.ts +2 -2
- package/dist/models/project-schema.js +7 -3
- package/dist/models/types.d.ts +4 -1
- package/dist/project-schema/latest.d.ts +6 -0
- package/dist/project-schema/v3.59.0.d.ts +6 -0
- package/dist/refs.d.ts +1 -1
- package/dist/resolvers/ai/abort-agent-message-response.d.ts +18 -5
- package/dist/resolvers/ai/abort-agent-message-response.js +4 -4
- package/dist/resolvers/ai/agent-chat-args.js +1 -2
- package/dist/resolvers/ai/agent-chat-payload.js +1 -2
- package/dist/resolvers/ai/agent-chat-response.d.ts +169 -37
- package/dist/resolvers/ai/agent-chat-response.js +11 -7
- package/dist/resolvers/ai/agent-generate-args.js +1 -2
- package/dist/resolvers/ai/agent-message-input.d.ts +73 -0
- package/dist/resolvers/ai/agent-message-input.js +39 -0
- package/dist/resolvers/ai/agent-message-output.d.ts +169 -0
- package/dist/resolvers/ai/agent-message-output.js +77 -0
- package/dist/resolvers/ai/agent-message-payload.d.ts +187 -73
- package/dist/resolvers/ai/agent-message-payload.js +20 -72
- package/dist/resolvers/ai/agent-run-mode.js +1 -2
- package/dist/resolvers/ai/agent-session-payload.d.ts +415 -5
- package/dist/resolvers/ai/agent-session-payload.js +83 -2
- package/dist/resolvers/ai/create-agent-session-response.d.ts +126 -23
- package/dist/resolvers/ai/create-agent-session-response.js +6 -11
- package/dist/resolvers/ai/get-agent-message-response.d.ts +592 -18
- package/dist/resolvers/ai/get-agent-message-response.js +43 -9
- package/dist/resolvers/ai/inspect-agent-response.d.ts +479 -70
- package/dist/resolvers/ai/inspect-agent-response.js +30 -19
- package/dist/resolvers/ai/send-agent-feedback-args.js +1 -2
- package/dist/resolvers/ai/send-agent-message-args.d.ts +8 -8
- package/dist/resolvers/ai/send-agent-message-args.js +2 -2
- package/dist/resolvers/ai/send-agent-message-response.d.ts +257 -4
- package/dist/resolvers/ai/send-agent-message-response.js +32 -2
- package/dist/resolvers/ai/types.d.ts +6 -0
- package/dist/resolvers/ai/types.js +1 -0
- package/dist/resolvers/takeshape/assets/asset.d.ts +1 -1
- package/dist/schemas/project-schema/latest.json +15 -0
- package/dist/schemas/project-schema/v3.59.0.json +15 -0
- package/package.json +12 -8
- package/dist/resolvers/ai/constants.d.ts +0 -9
- package/dist/resolvers/ai/constants.js +0 -9
package/dist/agents.d.ts
CHANGED
|
@@ -19,14 +19,12 @@ export declare const EXECUTION_TYPE_CHAT = "chat";
|
|
|
19
19
|
export declare const EXECUTION_TYPE_GENERATE = "generate";
|
|
20
20
|
export declare const EXECUTION_TYPE_GRAPHQL = "graphql";
|
|
21
21
|
export declare function getAgentEndStates(agent: AgentJSON, includeSuspend?: boolean): Set<string>;
|
|
22
|
-
export declare const getSendAgentMessageShapeName: (agentName: string) => string;
|
|
23
|
-
export declare const getAgentMessageShapeName: (inputName: string) => string;
|
|
24
22
|
export declare const getCreateAgentSessionMutationName: (agentName: string) => string;
|
|
25
23
|
export declare const getInspectAgentQueryName: (agentName: string) => string;
|
|
26
24
|
export declare const getSendAgentFeedbackMutationName: (agentName: string) => string;
|
|
25
|
+
export declare const getGetAgentMessageQueryName: (agentName: string) => string;
|
|
26
|
+
export declare const getAbortAgentMessageMutationName: (agentName: string) => string;
|
|
27
27
|
export declare const getSendAgentMessageMutationName: (inputName: string) => string;
|
|
28
|
-
export declare const getGetAgentMessageQueryName: (inputName: string) => string;
|
|
29
|
-
export declare const getAbortAgentMessageMutationName: (inputName: string) => string;
|
|
30
28
|
export declare function getAgentFeatures(agents: AgentMap): Pick<ProjectSchemaJSON, 'queries' | 'mutations' | 'shapes'>;
|
|
31
29
|
export declare function isValidAgentMutation(projectSchema: ProjectSchemaJSON, name: string): boolean;
|
|
32
30
|
export declare function addAiQueries(projectSchema: ProjectSchemaJSON): ProjectSchemaJSON;
|
package/dist/agents.js
CHANGED
|
@@ -5,7 +5,7 @@ import uniq from 'lodash/uniq.js';
|
|
|
5
5
|
import upperFirst from 'lodash/upperFirst.js';
|
|
6
6
|
import * as abortAgentMessageResponse from "./resolvers/ai/abort-agent-message-response.js";
|
|
7
7
|
import * as agentChatPayload from "./resolvers/ai/agent-chat-payload.js";
|
|
8
|
-
import * as
|
|
8
|
+
import * as agentSessionPayload from "./resolvers/ai/agent-session-payload.js";
|
|
9
9
|
import * as getAgentMessageArgs from "./resolvers/ai/get-agent-message-args.js";
|
|
10
10
|
import * as getAgentMessageResponse from "./resolvers/ai/get-agent-message-response.js";
|
|
11
11
|
import * as inspectAgentArgs from "./resolvers/ai/inspect-agent-args.js";
|
|
@@ -60,12 +60,7 @@ export function getAgentEndStates(agent, includeSuspend = false) {
|
|
|
60
60
|
}
|
|
61
61
|
return endStates;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
return `${upperFirst(agentName)}SendAgentMessageResponse`;
|
|
65
|
-
};
|
|
66
|
-
export const getAgentMessageShapeName = (inputName) => {
|
|
67
|
-
return `${upperFirst(inputName)}AgentMessage`;
|
|
68
|
-
};
|
|
63
|
+
// Agent Scoped Names
|
|
69
64
|
export const getCreateAgentSessionMutationName = (agentName) => {
|
|
70
65
|
return `create${upperFirst(agentName)}Session`;
|
|
71
66
|
};
|
|
@@ -75,21 +70,31 @@ export const getInspectAgentQueryName = (agentName) => {
|
|
|
75
70
|
export const getSendAgentFeedbackMutationName = (agentName) => {
|
|
76
71
|
return `send${upperFirst(agentName)}Feedback`;
|
|
77
72
|
};
|
|
78
|
-
export const
|
|
79
|
-
return `
|
|
73
|
+
export const getGetAgentMessageQueryName = (agentName) => {
|
|
74
|
+
return `get${upperFirst(agentName)}Message`;
|
|
80
75
|
};
|
|
81
|
-
export const
|
|
82
|
-
return `
|
|
76
|
+
export const getAbortAgentMessageMutationName = (agentName) => {
|
|
77
|
+
return `abort${upperFirst(agentName)}Message`;
|
|
83
78
|
};
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
// Agent Input Scopes Names
|
|
80
|
+
export const getSendAgentMessageMutationName = (inputName) => {
|
|
81
|
+
return `send${upperFirst(inputName)}Message`;
|
|
86
82
|
};
|
|
83
|
+
function createAssertValidName(key, result) {
|
|
84
|
+
const singular = key === 'shapes' ? 'shape' : key === 'mutations' ? 'mutation' : 'query';
|
|
85
|
+
return (name) => {
|
|
86
|
+
assert(result[key][name] === undefined, `Schema already has a ${singular} with the name "${name}"`);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
87
89
|
export function getAgentFeatures(agents) {
|
|
88
90
|
const result = {
|
|
89
91
|
queries: {},
|
|
90
92
|
mutations: {},
|
|
91
93
|
shapes: {}
|
|
92
94
|
};
|
|
95
|
+
const assertValidShapeName = createAssertValidName('shapes', result);
|
|
96
|
+
const assertValidQueryName = createAssertValidName('queries', result);
|
|
97
|
+
const assertValidMutationName = createAssertValidName('mutations', result);
|
|
93
98
|
for (const [agentName, agent] of Object.entries(agents)) {
|
|
94
99
|
// Get valid return types based on states that could possibly be the end state
|
|
95
100
|
// TODO In the future the agent will have a return type defined and we will instead validate
|
|
@@ -105,50 +110,113 @@ export function getAgentFeatures(agents) {
|
|
|
105
110
|
}
|
|
106
111
|
return JSON_SHAPE_NAME;
|
|
107
112
|
}));
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
113
|
+
const agentOutput = returnTypes.length === 0 ? 'string' : returnTypes.length === 1 ? returnTypes[0] : JSON_SHAPE_NAME;
|
|
114
|
+
const agentOutputSchema = agentOutput === 'string' ? { type: 'string' } : { '@ref': agentOutput };
|
|
115
|
+
const agentSessionShapeName = agentSessionPayload.shapeName;
|
|
116
|
+
const agentMessageShapeName = getAgentMessageResponse.createUserShapeName(agentName);
|
|
117
|
+
assertValidShapeName(agentMessageShapeName);
|
|
118
|
+
result.shapes[agentMessageShapeName] = {
|
|
119
|
+
id: agentMessageShapeName,
|
|
120
|
+
name: agentMessageShapeName,
|
|
121
|
+
title: agentMessageShapeName,
|
|
122
|
+
schema: getAgentMessageResponse.createUserShapeSchema({
|
|
123
|
+
properties: {
|
|
124
|
+
output: agentOutputSchema
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
};
|
|
128
|
+
const sendAgentMessageResponseShapeName = sendAgentMessageResponse.createUserShapeName(agentName);
|
|
129
|
+
assertValidShapeName(sendAgentMessageResponseShapeName);
|
|
111
130
|
result.shapes[sendAgentMessageResponseShapeName] = {
|
|
112
131
|
id: sendAgentMessageResponseShapeName,
|
|
113
132
|
name: sendAgentMessageResponseShapeName,
|
|
114
133
|
title: sendAgentMessageResponseShapeName,
|
|
115
|
-
schema: {
|
|
116
|
-
type: 'object',
|
|
134
|
+
schema: sendAgentMessageResponse.createUserShapeSchema({
|
|
117
135
|
properties: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
output: agentOutputSchema
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
};
|
|
140
|
+
const inspectAgentResponseShapeName = inspectAgentResponse.createUserShapeName(agentName);
|
|
141
|
+
assertValidShapeName(inspectAgentResponseShapeName);
|
|
142
|
+
result.shapes[inspectAgentResponseShapeName] = {
|
|
143
|
+
id: inspectAgentResponseShapeName,
|
|
144
|
+
name: inspectAgentResponseShapeName,
|
|
145
|
+
title: inspectAgentResponseShapeName,
|
|
146
|
+
schema: inspectAgentResponse.createUserShapeSchema()
|
|
147
|
+
};
|
|
148
|
+
const getAgentMessageQueryName = getGetAgentMessageQueryName(agentName);
|
|
149
|
+
assertValidQueryName(getAgentMessageQueryName);
|
|
150
|
+
result.queries[getAgentMessageQueryName] = {
|
|
151
|
+
description: `Get a message for the ${agentName} agent`,
|
|
152
|
+
shape: agentMessageShapeName,
|
|
153
|
+
resolver: {
|
|
154
|
+
name: 'ai:getAgentMessage',
|
|
155
|
+
agentName
|
|
156
|
+
},
|
|
157
|
+
args: {
|
|
158
|
+
...getAgentMessageArgs.schema
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const abortAgentMessageMutationName = getAbortAgentMessageMutationName(agentName);
|
|
162
|
+
assertValidMutationName(abortAgentMessageMutationName);
|
|
163
|
+
result.mutations[abortAgentMessageMutationName] = {
|
|
164
|
+
description: `Abort a message for the ${agentName} agent`,
|
|
165
|
+
shape: abortAgentMessageResponse.shapeName,
|
|
166
|
+
resolver: {
|
|
167
|
+
name: 'ai:abortAgentMessage',
|
|
168
|
+
agentName
|
|
169
|
+
},
|
|
170
|
+
args: {
|
|
171
|
+
...getAgentMessageArgs.schema
|
|
125
172
|
}
|
|
126
173
|
};
|
|
127
174
|
const createAgentSessionMutationName = getCreateAgentSessionMutationName(agentName);
|
|
128
|
-
|
|
175
|
+
assertValidMutationName(createAgentSessionMutationName);
|
|
129
176
|
result.mutations[createAgentSessionMutationName] = {
|
|
130
177
|
description: `Create a session for the ${agentName} agent`,
|
|
131
|
-
shape:
|
|
178
|
+
shape: agentSessionShapeName,
|
|
132
179
|
resolver: {
|
|
133
180
|
name: 'ai:createAgentSession',
|
|
134
181
|
agentName
|
|
135
182
|
}
|
|
136
183
|
};
|
|
184
|
+
const inspectAgentQueryName = getInspectAgentQueryName(agentName);
|
|
185
|
+
assertValidQueryName(inspectAgentQueryName);
|
|
186
|
+
result.queries[inspectAgentQueryName] = {
|
|
187
|
+
description: `Inspect the ${agentName} agent`,
|
|
188
|
+
args: inspectAgentArgs.schema,
|
|
189
|
+
shape: inspectAgentResponseShapeName,
|
|
190
|
+
resolver: {
|
|
191
|
+
name: 'ai:inspectAgent',
|
|
192
|
+
agentName
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
result.mutations[getSendAgentFeedbackMutationName(agentName)] ||= {
|
|
196
|
+
description: `Send feedback for the ${agentName} agent`,
|
|
197
|
+
args: sendAgentFeedbackArgs.shapeName,
|
|
198
|
+
shape: 'boolean',
|
|
199
|
+
resolver: {
|
|
200
|
+
name: 'ai:sendAgentFeedback',
|
|
201
|
+
agentName
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
// This mutation can vary depending on the inputs defined, everything else is stable for the whole agent (for now)
|
|
137
205
|
for (const inputConfig of agent.api.inputs) {
|
|
138
206
|
if (inputConfig.type === 'mutation') {
|
|
139
207
|
const inputName = inputConfig.name;
|
|
140
208
|
const sendAgentMessageMutationName = getSendAgentMessageMutationName(inputName);
|
|
141
|
-
|
|
209
|
+
assertValidMutationName(sendAgentMessageMutationName);
|
|
142
210
|
result.mutations[sendAgentMessageMutationName] = {
|
|
143
211
|
description: agent.description,
|
|
144
212
|
args: {
|
|
145
213
|
type: 'object',
|
|
146
214
|
extends: [
|
|
147
215
|
{
|
|
148
|
-
...sendAgentMessageArgs.
|
|
216
|
+
...sendAgentMessageArgs.shapeSchema,
|
|
149
217
|
required: agent.protection?.enabled
|
|
150
|
-
? [...sendAgentMessageArgs.
|
|
151
|
-
: sendAgentMessageArgs.
|
|
218
|
+
? [...sendAgentMessageArgs.shapeSchema.required, 'token']
|
|
219
|
+
: sendAgentMessageArgs.shapeSchema.required
|
|
152
220
|
},
|
|
153
221
|
{
|
|
154
222
|
'@ref': inputConfig.args
|
|
@@ -162,75 +230,8 @@ export function getAgentFeatures(agents) {
|
|
|
162
230
|
inputName
|
|
163
231
|
}
|
|
164
232
|
};
|
|
165
|
-
const agentMessageShapeName = getAgentMessageShapeName(inputName);
|
|
166
|
-
assert(result.shapes[agentMessageShapeName] === undefined, `Schema already has a shape with the name "${agentMessageShapeName}"`);
|
|
167
|
-
result.shapes[agentMessageShapeName] = {
|
|
168
|
-
id: agentMessageShapeName,
|
|
169
|
-
name: agentMessageShapeName,
|
|
170
|
-
title: agentMessageShapeName,
|
|
171
|
-
schema: {
|
|
172
|
-
type: 'object',
|
|
173
|
-
properties: {
|
|
174
|
-
...getAgentMessageResponse.schema.properties,
|
|
175
|
-
output: {
|
|
176
|
-
'@ref': shape
|
|
177
|
-
},
|
|
178
|
-
input: {
|
|
179
|
-
'@ref': inputConfig.args
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
required: [...getAgentMessageResponse.schema.required],
|
|
183
|
-
additionalProperties: false
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
const getAgentMessageQueryName = getGetAgentMessageQueryName(inputName);
|
|
187
|
-
assert(result.queries[getAgentMessageQueryName] === undefined, `Schema already has a query with the name ${getAgentMessageQueryName}`);
|
|
188
|
-
result.queries[getAgentMessageQueryName] = {
|
|
189
|
-
description: `Get a message for the ${agentName} agent`,
|
|
190
|
-
shape: agentMessageShapeName,
|
|
191
|
-
resolver: {
|
|
192
|
-
name: 'ai:getAgentMessage',
|
|
193
|
-
agentName
|
|
194
|
-
},
|
|
195
|
-
args: {
|
|
196
|
-
...getAgentMessageArgs.schema
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
const abortAgentMessageMutationName = getAbortAgentMessageMutationName(inputName);
|
|
200
|
-
assert(result.mutations[abortAgentMessageMutationName] === undefined, `Schema already has a mutation with the name ${abortAgentMessageMutationName}`);
|
|
201
|
-
result.mutations[abortAgentMessageMutationName] = {
|
|
202
|
-
description: `Abort a message for the ${agentName} agent`,
|
|
203
|
-
shape: abortAgentMessageResponse.shapeName,
|
|
204
|
-
resolver: {
|
|
205
|
-
name: 'ai:abortAgentMessage',
|
|
206
|
-
agentName
|
|
207
|
-
},
|
|
208
|
-
args: {
|
|
209
|
-
...getAgentMessageArgs.schema
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
233
|
}
|
|
213
234
|
}
|
|
214
|
-
result.queries[getInspectAgentQueryName(agentName)] ||= {
|
|
215
|
-
description: `Inspect the ${agentName} agent`,
|
|
216
|
-
args: {
|
|
217
|
-
...inspectAgentArgs.schema
|
|
218
|
-
},
|
|
219
|
-
shape: inspectAgentResponse.shapeName,
|
|
220
|
-
resolver: {
|
|
221
|
-
name: 'ai:inspectAgent',
|
|
222
|
-
agentName
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
result.mutations[getSendAgentFeedbackMutationName(agentName)] ||= {
|
|
226
|
-
description: `Send feedback for the ${agentName} agent`,
|
|
227
|
-
args: sendAgentFeedbackArgs.shapeName,
|
|
228
|
-
shape: 'boolean',
|
|
229
|
-
resolver: {
|
|
230
|
-
name: 'ai:sendAgentFeedback',
|
|
231
|
-
agentName
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
235
|
}
|
|
235
236
|
return result;
|
|
236
237
|
}
|
package/dist/builtin-schema.js
CHANGED
|
@@ -3,10 +3,12 @@ import * as agentChatArgs from "./resolvers/ai/agent-chat-args.js";
|
|
|
3
3
|
import * as agentChatPayload from "./resolvers/ai/agent-chat-payload.js";
|
|
4
4
|
import * as agentChatResponse from "./resolvers/ai/agent-chat-response.js";
|
|
5
5
|
import * as agentGenerateArgs from "./resolvers/ai/agent-generate-args.js";
|
|
6
|
+
import * as agentMessageInput from "./resolvers/ai/agent-message-input.js";
|
|
7
|
+
import * as agentMessageOutput from "./resolvers/ai/agent-message-output.js";
|
|
8
|
+
import * as agentMessagePayload from "./resolvers/ai/agent-message-payload.js";
|
|
6
9
|
import * as agentRunMode from "./resolvers/ai/agent-run-mode.js";
|
|
7
|
-
import * as
|
|
10
|
+
import * as agentSessionPayload from "./resolvers/ai/agent-session-payload.js";
|
|
8
11
|
import * as embeddingSearchArgs from "./resolvers/ai/embedding-search.js";
|
|
9
|
-
import * as inspectAgentResponse from "./resolvers/ai/inspect-agent-response.js";
|
|
10
12
|
import * as sendAgentFeedbackArgs from "./resolvers/ai/send-agent-feedback-args.js";
|
|
11
13
|
import * as asset from "./resolvers/takeshape/assets/asset.js";
|
|
12
14
|
import * as assetImage from "./resolvers/takeshape/assets/asset-image.js";
|
|
@@ -222,7 +224,7 @@ const builtInShapes = {
|
|
|
222
224
|
title: 'Chat Agent Response',
|
|
223
225
|
id: agentChatResponse.shapeName,
|
|
224
226
|
name: agentChatResponse.shapeName,
|
|
225
|
-
schema: agentChatResponse.
|
|
227
|
+
schema: agentChatResponse.createUserShapeSchema()
|
|
226
228
|
},
|
|
227
229
|
[agentChatPayload.shapeName]: {
|
|
228
230
|
title: 'Chat Agent Payload',
|
|
@@ -230,29 +232,77 @@ const builtInShapes = {
|
|
|
230
232
|
name: agentChatPayload.shapeName,
|
|
231
233
|
schema: agentChatPayload.schema
|
|
232
234
|
},
|
|
233
|
-
[inspectAgentResponse.shapeName]: {
|
|
234
|
-
title: 'Inspect Agent Response',
|
|
235
|
-
id: inspectAgentResponse.shapeName,
|
|
236
|
-
name: inspectAgentResponse.shapeName,
|
|
237
|
-
schema: inspectAgentResponse.schema
|
|
238
|
-
},
|
|
239
|
-
[createAgentSessionResponse.shapeName]: {
|
|
240
|
-
title: 'Create Agent Session Response',
|
|
241
|
-
id: createAgentSessionResponse.shapeName,
|
|
242
|
-
name: createAgentSessionResponse.shapeName,
|
|
243
|
-
schema: createAgentSessionResponse.schema
|
|
244
|
-
},
|
|
245
235
|
[abortAgentMessageResponse.shapeName]: {
|
|
246
236
|
title: 'Abort Agent Message Response',
|
|
247
237
|
id: abortAgentMessageResponse.shapeName,
|
|
248
238
|
name: abortAgentMessageResponse.shapeName,
|
|
249
|
-
schema: abortAgentMessageResponse.
|
|
239
|
+
schema: abortAgentMessageResponse.shapeSchema
|
|
250
240
|
},
|
|
251
241
|
[sendAgentFeedbackArgs.shapeName]: {
|
|
252
242
|
title: 'Send Agent Feedback Args',
|
|
253
243
|
id: sendAgentFeedbackArgs.shapeName,
|
|
254
244
|
name: sendAgentFeedbackArgs.shapeName,
|
|
255
245
|
schema: sendAgentFeedbackArgs.schema
|
|
246
|
+
},
|
|
247
|
+
[agentMessageInput.stringInputSchema.title]: {
|
|
248
|
+
title: agentMessageInput.stringInputSchema.title,
|
|
249
|
+
id: agentMessageInput.stringInputSchema.title,
|
|
250
|
+
name: agentMessageInput.stringInputSchema.title,
|
|
251
|
+
schema: agentMessageInput.stringInputSchema
|
|
252
|
+
},
|
|
253
|
+
[agentMessageInput.unknownInputSchema.title]: {
|
|
254
|
+
title: agentMessageInput.unknownInputSchema.title,
|
|
255
|
+
id: agentMessageInput.unknownInputSchema.title,
|
|
256
|
+
name: agentMessageInput.unknownInputSchema.title,
|
|
257
|
+
schema: agentMessageInput.unknownInputSchema
|
|
258
|
+
},
|
|
259
|
+
[agentMessageInput.shapeName]: {
|
|
260
|
+
title: agentMessageInput.shapeSchema.title,
|
|
261
|
+
id: agentMessageInput.shapeSchema.title,
|
|
262
|
+
name: agentMessageInput.shapeSchema.title,
|
|
263
|
+
schema: agentMessageInput.shapeSchema
|
|
264
|
+
},
|
|
265
|
+
[agentMessageOutput.generateStateOutputSchema.title]: {
|
|
266
|
+
title: agentMessageOutput.generateStateOutputSchema.title,
|
|
267
|
+
id: agentMessageOutput.generateStateOutputSchema.title,
|
|
268
|
+
name: agentMessageOutput.generateStateOutputSchema.title,
|
|
269
|
+
schema: agentMessageOutput.generateStateOutputSchema
|
|
270
|
+
},
|
|
271
|
+
[agentMessageOutput.graphQLStateOutputSchema.title]: {
|
|
272
|
+
title: agentMessageOutput.graphQLStateOutputSchema.title,
|
|
273
|
+
id: agentMessageOutput.graphQLStateOutputSchema.title,
|
|
274
|
+
name: agentMessageOutput.graphQLStateOutputSchema.title,
|
|
275
|
+
schema: agentMessageOutput.graphQLStateOutputSchema
|
|
276
|
+
},
|
|
277
|
+
[agentMessageOutput.chatStateOutputSchema.title]: {
|
|
278
|
+
title: agentMessageOutput.chatStateOutputSchema.title,
|
|
279
|
+
id: agentMessageOutput.chatStateOutputSchema.title,
|
|
280
|
+
name: agentMessageOutput.chatStateOutputSchema.title,
|
|
281
|
+
schema: agentMessageOutput.chatStateOutputSchema
|
|
282
|
+
},
|
|
283
|
+
[agentMessageOutput.unknownStateOutputSchema.title]: {
|
|
284
|
+
title: agentMessageOutput.unknownStateOutputSchema.title,
|
|
285
|
+
id: agentMessageOutput.unknownStateOutputSchema.title,
|
|
286
|
+
name: agentMessageOutput.unknownStateOutputSchema.title,
|
|
287
|
+
schema: agentMessageOutput.unknownStateOutputSchema
|
|
288
|
+
},
|
|
289
|
+
[agentMessageOutput.shapeName]: {
|
|
290
|
+
title: agentMessageOutput.shapeSchema.title,
|
|
291
|
+
id: agentMessageOutput.shapeSchema.title,
|
|
292
|
+
name: agentMessageOutput.shapeSchema.title,
|
|
293
|
+
schema: agentMessageOutput.shapeSchema
|
|
294
|
+
},
|
|
295
|
+
[agentSessionPayload.shapeName]: {
|
|
296
|
+
title: agentSessionPayload.shapeSchema.title,
|
|
297
|
+
id: agentSessionPayload.shapeSchema.title,
|
|
298
|
+
name: agentSessionPayload.shapeSchema.title,
|
|
299
|
+
schema: agentSessionPayload.shapeSchema
|
|
300
|
+
},
|
|
301
|
+
[agentMessagePayload.shapeName]: {
|
|
302
|
+
title: agentMessagePayload.shapeSchema.title,
|
|
303
|
+
id: agentMessagePayload.shapeSchema.title,
|
|
304
|
+
name: agentMessagePayload.shapeSchema.title,
|
|
305
|
+
schema: agentMessagePayload.shapeSchema
|
|
256
306
|
}
|
|
257
307
|
};
|
|
258
308
|
const staticSiteShapes = {
|
package/dist/layers/refs.d.ts
CHANGED
|
@@ -77,7 +77,7 @@ export declare function refItemToShape(shapes: ShapeMapV4_0_0, refItem: RefItem)
|
|
|
77
77
|
/**
|
|
78
78
|
* Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
|
|
79
79
|
*/
|
|
80
|
-
export declare const omitRefAndExtend: (targetSchema: PropertySchemaV4_0_0, sourceSchema: PropertySchemaV4_0_0) => import("lodash").Omit<PropertySchemaV4_0_0, "
|
|
80
|
+
export declare const omitRefAndExtend: (targetSchema: PropertySchemaV4_0_0, sourceSchema: PropertySchemaV4_0_0) => import("lodash").Omit<PropertySchemaV4_0_0, "@ref" | "$ref"> & PropertySchemaV4_0_0;
|
|
81
81
|
/**
|
|
82
82
|
* If there is a $ref, this will insert a content schema from the top level
|
|
83
83
|
* in place of the reference.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ProjectSchemaJSON, PropertySchema } from '../project-schema/index.ts';
|
|
2
2
|
import type { ServiceLayers } from '../types/types.ts';
|
|
3
|
-
import type { Agent, ProjectSchema, Query, Shape } from './types.ts';
|
|
3
|
+
import type { Agent, GetShapeOptions, ProjectSchema, Query, Shape } from './types.ts';
|
|
4
4
|
export declare class ProjectSchemaImpl implements ProjectSchema {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(projectSchemaJson: ProjectSchemaJSON, layers: ServiceLayers);
|
|
7
|
-
getShape(rawShapeRef: string): Shape | undefined;
|
|
7
|
+
getShape(rawShapeRef: string, options?: GetShapeOptions): Shape | undefined;
|
|
8
8
|
getQuery(rawQueryRef: string): Query | undefined;
|
|
9
9
|
ensureQuery(ref: string): Query;
|
|
10
10
|
getLocalQueries(): Query[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getAgent, getAgentMap } from "../agents.js";
|
|
2
|
+
import { allBuiltInShapes } from '../builtin-schema.js';
|
|
2
3
|
import { dereferenceObjectSchema, dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, parseRef, refItemToNamespacedShapeName } from "../refs.js";
|
|
3
4
|
import { getShape } from "../util/shapes.js";
|
|
4
5
|
import { createAgent } from "./agent.js";
|
|
@@ -17,14 +18,17 @@ export class ProjectSchemaImpl {
|
|
|
17
18
|
this.#queryCache = new Map();
|
|
18
19
|
this.#agentCache = new Map();
|
|
19
20
|
}
|
|
20
|
-
getShape(rawShapeRef) {
|
|
21
|
+
getShape(rawShapeRef, options) {
|
|
21
22
|
const shapeRef = normalizeRefExpression(this.#projectSchemaJson, rawShapeRef);
|
|
22
23
|
let shape = this.#shapeCache.get(shapeRef);
|
|
23
24
|
if (!shape) {
|
|
24
25
|
const refItem = parseRef(this.#projectSchemaJson, rawShapeRef);
|
|
25
26
|
if (refItem) {
|
|
26
27
|
const namespacedName = refItemToNamespacedShapeName(this.#projectSchemaJson, refItem);
|
|
27
|
-
|
|
28
|
+
let shapeJson = getShape(this.#projectSchemaJson, namespacedName);
|
|
29
|
+
if (!shapeJson && options?.includeAllBuiltIns) {
|
|
30
|
+
shapeJson = getShape({ shapes: allBuiltInShapes }, namespacedName);
|
|
31
|
+
}
|
|
28
32
|
if (shapeJson) {
|
|
29
33
|
shape = createShape(this, refItem, shapeJson);
|
|
30
34
|
this.#shapeCache.set(shapeRef, shape);
|
|
@@ -32,7 +36,7 @@ export class ProjectSchemaImpl {
|
|
|
32
36
|
else if (refItem.layerId !== 'local') {
|
|
33
37
|
const layerSchema = this.#layers[refItem.layerId]?.schema;
|
|
34
38
|
if (layerSchema) {
|
|
35
|
-
|
|
39
|
+
shapeJson = getShape(layerSchema, namespacedName);
|
|
36
40
|
if (shapeJson) {
|
|
37
41
|
shape = createShape(this, refItem, shapeJson);
|
|
38
42
|
this.#shapeCache.set(shapeRef, shape);
|
package/dist/models/types.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { AgentJSON, ObjectSchema, ProjectSchemaJSON, PropertySchema, QueryJSON, ShapeJSON } from '../project-schema/index.ts';
|
|
2
2
|
import type { RefItem } from '../refs.ts';
|
|
3
|
+
export interface GetShapeOptions {
|
|
4
|
+
includeAllBuiltIns?: boolean;
|
|
5
|
+
}
|
|
3
6
|
export interface ProjectSchema {
|
|
4
|
-
getShape(shapeRef: string): Shape | undefined;
|
|
7
|
+
getShape(shapeRef: string, options?: GetShapeOptions): Shape | undefined;
|
|
5
8
|
getQuery(queryRef: string): Query | undefined;
|
|
6
9
|
getLocalQueries(): Query[];
|
|
7
10
|
getLocalMutations(): Query[];
|
|
@@ -1843,6 +1843,12 @@ export interface ShapeSchemaExtends {
|
|
|
1843
1843
|
* via the `definition` "shapeSchemaOneOf".
|
|
1844
1844
|
*/
|
|
1845
1845
|
export interface ShapeSchemaOneOf {
|
|
1846
|
+
title?: string;
|
|
1847
|
+
description?: string;
|
|
1848
|
+
discriminator?: {
|
|
1849
|
+
propertyName: string;
|
|
1850
|
+
[k: string]: any;
|
|
1851
|
+
};
|
|
1846
1852
|
oneOf: ObjectOrRefArray;
|
|
1847
1853
|
}
|
|
1848
1854
|
/**
|
|
@@ -1843,6 +1843,12 @@ export interface ShapeSchemaExtendsV3_59_0 {
|
|
|
1843
1843
|
* via the `definition` "shapeSchemaOneOf".
|
|
1844
1844
|
*/
|
|
1845
1845
|
export interface ShapeSchemaOneOfV3_59_0 {
|
|
1846
|
+
title?: string;
|
|
1847
|
+
description?: string;
|
|
1848
|
+
discriminator?: {
|
|
1849
|
+
propertyName: string;
|
|
1850
|
+
[k: string]: any;
|
|
1851
|
+
};
|
|
1846
1852
|
oneOf: ObjectOrRefArrayV3_59_0;
|
|
1847
1853
|
}
|
|
1848
1854
|
/**
|
package/dist/refs.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export declare function refSchemaToShapeSchemaPath(context: ServicesContext, ref
|
|
|
153
153
|
/**
|
|
154
154
|
* Helper fn to omit `ref` props from the target schema, and then extend it with the source schema.
|
|
155
155
|
*/
|
|
156
|
-
export declare const omitRefAndExtend: (targetSchema: PropertySchema, sourceSchema: PropertySchema) => import("lodash").Omit<PropertySchema, "
|
|
156
|
+
export declare const omitRefAndExtend: (targetSchema: PropertySchema, sourceSchema: PropertySchema) => import("lodash").Omit<PropertySchema, "@ref" | "$ref"> & PropertySchema;
|
|
157
157
|
/**
|
|
158
158
|
* If there is a $ref, this will insert a property schema from the top level
|
|
159
159
|
* in place of the reference.
|
|
@@ -19,8 +19,21 @@ export declare const schema: {
|
|
|
19
19
|
readonly additionalProperties: false;
|
|
20
20
|
};
|
|
21
21
|
export type AbortAgentMessageResponse = FromSchema<typeof schema>;
|
|
22
|
-
export declare const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
export declare const shapeSchema: {
|
|
23
|
+
readonly type: "object";
|
|
24
|
+
readonly properties: {
|
|
25
|
+
readonly aborted: {
|
|
26
|
+
readonly type: "object";
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly messageId: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "The ID of the aborted deferred message";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly required: ["messageId"];
|
|
34
|
+
readonly additionalProperties: false;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
readonly required: [];
|
|
38
|
+
readonly additionalProperties: false;
|
|
39
|
+
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { AI_AGENT_ABORT_AGENT_MESSAGE_RESPONSE_SHAPE_NAME } from "./constants.js";
|
|
3
|
-
export const shapeName = AI_AGENT_ABORT_AGENT_MESSAGE_RESPONSE_SHAPE_NAME;
|
|
1
|
+
export const shapeName = 'TSAbortAgentMessageResponse';
|
|
4
2
|
export const schema = {
|
|
5
3
|
type: 'object',
|
|
6
4
|
properties: {
|
|
@@ -16,4 +14,6 @@ export const schema = {
|
|
|
16
14
|
required: [],
|
|
17
15
|
additionalProperties: false
|
|
18
16
|
};
|
|
19
|
-
export const
|
|
17
|
+
export const shapeSchema = {
|
|
18
|
+
...schema
|
|
19
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createTypedValidator } from '@takeshape/json-schema';
|
|
2
|
-
|
|
3
|
-
export const shapeName = AI_AGENT_CHAT_ARGS_SHAPE_NAME;
|
|
2
|
+
export const shapeName = 'TSChatArgs';
|
|
4
3
|
export const schema = {
|
|
5
4
|
type: 'object',
|
|
6
5
|
properties: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createTypedValidator } from '@takeshape/json-schema';
|
|
2
|
-
|
|
3
|
-
export const shapeName = AI_AGENT_CHAT_PAYLOAD_SHAPE_NAME;
|
|
2
|
+
export const shapeName = 'TSChatPayload';
|
|
4
3
|
export const schema = {
|
|
5
4
|
type: 'object',
|
|
6
5
|
properties: {
|