@takeshape/schema 11.102.4 → 11.103.3

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.
Files changed (132) hide show
  1. package/dist/agents.d.ts +18 -2
  2. package/dist/agents.js +159 -38
  3. package/dist/builtin-schema.js +85 -94
  4. package/dist/migration/index.d.ts +1 -0
  5. package/dist/migration/index.js +3 -1
  6. package/dist/migration/to/v3.56.0.d.ts +4 -0
  7. package/dist/migration/to/v3.56.0.js +10 -0
  8. package/dist/models/project-schema.d.ts +1 -0
  9. package/dist/models/project-schema.js +4 -1
  10. package/dist/models/query.js +1 -1
  11. package/dist/models/types.d.ts +1 -0
  12. package/dist/project-schema/index.d.ts +4 -1
  13. package/dist/project-schema/index.js +2 -1
  14. package/dist/project-schema/latest.d.ts +42 -18
  15. package/dist/project-schema/migrate.js +4 -1
  16. package/dist/project-schema/v3.48.0.d.ts +5 -8
  17. package/dist/project-schema/v3.49.0.d.ts +5 -8
  18. package/dist/project-schema/v3.50.0.d.ts +6 -9
  19. package/dist/project-schema/v3.51.0.d.ts +6 -9
  20. package/dist/project-schema/v3.52.0.d.ts +6 -9
  21. package/dist/project-schema/v3.53.0.d.ts +6 -9
  22. package/dist/project-schema/v3.54.0.d.ts +6 -9
  23. package/dist/project-schema/v3.55.0.d.ts +6 -9
  24. package/dist/project-schema/v3.56.0.d.ts +2400 -0
  25. package/dist/project-schema/v3.56.0.js +7 -0
  26. package/dist/resolvers/ai/abort-agent-message-args.d.ts +16 -0
  27. package/dist/resolvers/ai/abort-agent-message-args.js +13 -0
  28. package/dist/resolvers/ai/abort-agent-message-response.d.ts +26 -0
  29. package/dist/resolvers/ai/abort-agent-message-response.js +19 -0
  30. package/dist/resolvers/ai/agent-chat-args.d.ts +17 -0
  31. package/dist/resolvers/ai/agent-chat-args.js +15 -0
  32. package/dist/resolvers/ai/agent-chat-payload.d.ts +35 -0
  33. package/dist/resolvers/ai/agent-chat-payload.js +27 -0
  34. package/dist/resolvers/ai/agent-chat-response.d.ts +136 -0
  35. package/dist/resolvers/ai/agent-chat-response.js +17 -0
  36. package/dist/resolvers/ai/agent-generate-args.d.ts +17 -0
  37. package/dist/resolvers/ai/agent-generate-args.js +15 -0
  38. package/dist/resolvers/ai/agent-message-payload.d.ts +84 -0
  39. package/dist/resolvers/ai/agent-message-payload.js +57 -0
  40. package/dist/resolvers/ai/agent-run-mode.d.ts +7 -0
  41. package/dist/resolvers/ai/agent-run-mode.js +10 -0
  42. package/dist/resolvers/ai/agent-session-payload.d.ts +67 -0
  43. package/dist/resolvers/ai/agent-session-payload.js +71 -0
  44. package/dist/resolvers/ai/constants.d.ts +8 -0
  45. package/dist/resolvers/ai/constants.js +8 -0
  46. package/dist/resolvers/ai/create-agent-session-response.d.ts +75 -0
  47. package/dist/resolvers/ai/create-agent-session-response.js +14 -0
  48. package/dist/resolvers/ai/embedding-search.d.ts +3 -3
  49. package/dist/resolvers/ai/embedding-search.js +2 -2
  50. package/dist/resolvers/ai/get-agent-message-args.d.ts +16 -0
  51. package/dist/resolvers/ai/get-agent-message-args.js +13 -0
  52. package/dist/resolvers/ai/get-agent-message-response.d.ts +125 -0
  53. package/dist/resolvers/ai/get-agent-message-response.js +29 -0
  54. package/dist/resolvers/ai/inspect-agent-args.d.ts +16 -0
  55. package/dist/resolvers/ai/inspect-agent-args.js +13 -0
  56. package/dist/resolvers/ai/inspect-agent-response.d.ts +74 -0
  57. package/dist/resolvers/ai/inspect-agent-response.js +38 -0
  58. package/dist/resolvers/ai/send-agent-message-args.d.ts +39 -0
  59. package/dist/resolvers/ai/send-agent-message-args.js +32 -0
  60. package/dist/resolvers/ai/send-agent-message-response.d.ts +79 -0
  61. package/dist/resolvers/ai/send-agent-message-response.js +21 -0
  62. package/dist/resolvers/takeshape/assets/asset-image-meta.d.ts +2 -0
  63. package/dist/resolvers/takeshape/assets/asset-image-meta.js +3 -0
  64. package/dist/resolvers/takeshape/assets/asset-image-params.d.ts +2 -0
  65. package/dist/resolvers/takeshape/assets/asset-image-params.js +3 -0
  66. package/dist/resolvers/takeshape/assets/asset-image.d.ts +2 -0
  67. package/dist/resolvers/takeshape/assets/asset-image.js +3 -0
  68. package/dist/resolvers/takeshape/assets/asset.d.ts +3 -1
  69. package/dist/resolvers/takeshape/assets/asset.js +3 -1
  70. package/dist/resolvers/takeshape/builtins/constants.d.ts +1 -0
  71. package/dist/resolvers/takeshape/builtins/constants.js +1 -0
  72. package/dist/schema-util.d.ts +2 -2
  73. package/dist/schema-util.js +1 -1
  74. package/dist/schemas/index.d.ts +2 -2
  75. package/dist/schemas/index.js +4 -2
  76. package/dist/schemas/project-schema/experimental.json +73 -13
  77. package/dist/schemas/project-schema/latest.json +14 -2
  78. package/dist/schemas/project-schema/v3.56.0.json +3527 -0
  79. package/dist/schemas/project-schema.json +3 -0
  80. package/dist/util/has-arg.js +2 -2
  81. package/examples/latest/agent-schema.json +13 -5
  82. package/examples/latest/all-fields-shapes-inline.json +1 -1
  83. package/examples/latest/all-fields-shapes.json +1 -1
  84. package/examples/latest/betzino.json +1 -1
  85. package/examples/latest/blog-schema.json +1 -1
  86. package/examples/latest/brewery-schema.json +1 -1
  87. package/examples/latest/clear-cache-schema.json +1 -1
  88. package/examples/latest/complex-project-schema.json +1 -1
  89. package/examples/latest/complex-schema.json +1 -1
  90. package/examples/latest/edit-schema.json +1 -1
  91. package/examples/latest/fabric-ecommerce.json +1 -1
  92. package/examples/latest/frank-and-fred-schema.json +1 -1
  93. package/examples/latest/klirr-schema.json +1 -1
  94. package/examples/latest/layers/rick-and-morty-layer.json +1 -1
  95. package/examples/latest/layers/shopify-layer-2023-01.json +1 -1
  96. package/examples/latest/layers/shopify-storefront-2023-04.json +1 -1
  97. package/examples/latest/layers/wordpress-2024-01.json +1 -1
  98. package/examples/latest/massive-schema.json +1 -1
  99. package/examples/latest/mill-components-schema.json +1 -1
  100. package/examples/latest/nested-shape-arrays.json +1 -1
  101. package/examples/latest/one-earth.json +1 -1
  102. package/examples/latest/pet-oneof-array.json +1 -1
  103. package/examples/latest/post-schema.json +1 -1
  104. package/examples/latest/pruned-shopify-product-schema.json +1 -1
  105. package/examples/latest/rag-example.json +1 -1
  106. package/examples/latest/real-world-schema.json +1 -1
  107. package/examples/latest/recursive-repeater-schema.json +1 -1
  108. package/examples/latest/recursive-schema.json +1 -1
  109. package/examples/latest/rick-and-morty-ast.json +1 -1
  110. package/examples/latest/rick-and-morty-graphql.json +1 -1
  111. package/examples/latest/rick-and-morty-rest.json +1 -1
  112. package/examples/latest/rick-and-morty-user-schema.json +1 -1
  113. package/examples/latest/rick-and-morty-with-indexing.json +1 -1
  114. package/examples/latest/schema-where-filter.json +1 -1
  115. package/examples/latest/schema-with-repeater-draftjs.json +1 -1
  116. package/examples/latest/schema-with-rick-and-morty.json +1 -1
  117. package/examples/latest/shape-books-v3_2_0.json +1 -1
  118. package/examples/latest/shape-books.json +1 -1
  119. package/examples/latest/shape-editor-schema-edited.json +1 -1
  120. package/examples/latest/shape-editor-schema-initial.json +1 -1
  121. package/examples/latest/shapedb-crud-every-prop-type.json +1 -1
  122. package/examples/latest/shopify-lookbook.json +1 -1
  123. package/examples/latest/shopify-product-2022-07.json +1 -1
  124. package/examples/latest/shopify-product-2023-04.json +1 -1
  125. package/examples/latest/shopify-store-with-widget.json +1 -1
  126. package/examples/latest/stripe-product-runtime-schema.json +1 -1
  127. package/examples/latest/stripe-starter-resolved.json +1 -1
  128. package/examples/latest/user-schema-no-required.json +1 -1
  129. package/examples/latest/user-schema-with-defaults.json +1 -1
  130. package/examples/latest/valvoline-ai-demo.json +1 -1
  131. package/examples/latest/vector-search-schema.json +1 -1
  132. package/package.json +6 -5
package/dist/agents.d.ts CHANGED
@@ -1,4 +1,11 @@
1
1
  import type { AgentJSON, AgentMap, GuardJSON, GuardMap, ProjectSchemaJSON, QueryJSON } from './project-schema/index.ts';
2
+ /**
3
+ * Special transition destination ID for a newly created, never started session.
4
+ */
5
+ export declare const AGENT_SESSION_CREATED = "SESSION_CREATED";
6
+ /**
7
+ * Special transition destination ID for a started session.
8
+ */
2
9
  export declare const START_AGENT_EXECUTION = "START";
3
10
  /**
4
11
  * Special transition destination ID for agent transitions that end the agent execution.
@@ -8,9 +15,18 @@ export declare const END_AGENT_EXECUTION = "END";
8
15
  * Special history strategy ID that indicates the history should be cleared.
9
16
  */
10
17
  export declare const CLEAR_HISTORY_STRATEGY_ID = "clearHistory";
18
+ export declare const EXECUTION_TYPE_CHAT = "chat";
19
+ export declare const EXECUTION_TYPE_GENERATE = "generate";
20
+ export declare const EXECUTION_TYPE_GRAPHQL = "graphql";
11
21
  export declare function getAgentEndStates(agent: AgentJSON, includeSuspend?: boolean): Set<string>;
12
- export declare const getInspectAgentSessionQueryName: (agentName: string) => string;
13
- export declare function getAgentQueries(agents: AgentMap): Pick<ProjectSchemaJSON, 'queries' | 'mutations'>;
22
+ export declare const getSendAgentMessageShapeName: (agentName: string) => string;
23
+ export declare const getAgentMessageShapeName: (inputName: string) => string;
24
+ export declare const getCreateAgentSessionMutationName: (agentName: string) => string;
25
+ export declare const getInspectAgentQueryName: (agentName: string) => string;
26
+ export declare const getSendAgentMessageMutationName: (inputName: string) => string;
27
+ export declare const getGetAgentMessageQueryName: (inputName: string) => string;
28
+ export declare const getAbortAgentMessageMutationName: (inputName: string) => string;
29
+ export declare function getAgentFeatures(agents: AgentMap): Pick<ProjectSchemaJSON, 'queries' | 'mutations' | 'shapes'>;
14
30
  export declare function isValidAgentMutation(projectSchema: ProjectSchemaJSON, name: string): boolean;
15
31
  export declare function addAiQueries(projectSchema: ProjectSchemaJSON): ProjectSchemaJSON;
16
32
  /**
package/dist/agents.js CHANGED
@@ -1,7 +1,25 @@
1
+ import { assert } from '@takeshape/util';
1
2
  import set from 'lodash/fp/set.js';
2
3
  import get from 'lodash/get.js';
3
4
  import uniq from 'lodash/uniq.js';
4
5
  import upperFirst from 'lodash/upperFirst.js';
6
+ import * as abortAgentMessageResponse from "./resolvers/ai/abort-agent-message-response.js";
7
+ import * as agentChatPayload from "./resolvers/ai/agent-chat-payload.js";
8
+ import * as createAgentSessionResponse from "./resolvers/ai/create-agent-session-response.js";
9
+ import * as getAgentMessageArgs from "./resolvers/ai/get-agent-message-args.js";
10
+ import * as getAgentMessageResponse from "./resolvers/ai/get-agent-message-response.js";
11
+ import * as inspectAgentArgs from "./resolvers/ai/inspect-agent-args.js";
12
+ import * as inspectAgentResponse from "./resolvers/ai/inspect-agent-response.js";
13
+ import * as sendAgentMessageArgs from "./resolvers/ai/send-agent-message-args.js";
14
+ import * as sendAgentMessageResponse from "./resolvers/ai/send-agent-message-response.js";
15
+ import { JSON_SHAPE_NAME } from "./resolvers/takeshape/builtins/constants.js";
16
+ /**
17
+ * Special transition destination ID for a newly created, never started session.
18
+ */
19
+ export const AGENT_SESSION_CREATED = 'SESSION_CREATED';
20
+ /**
21
+ * Special transition destination ID for a started session.
22
+ */
5
23
  export const START_AGENT_EXECUTION = 'START';
6
24
  /**
7
25
  * Special transition destination ID for agent transitions that end the agent execution.
@@ -11,6 +29,9 @@ export const END_AGENT_EXECUTION = 'END';
11
29
  * Special history strategy ID that indicates the history should be cleared.
12
30
  */
13
31
  export const CLEAR_HISTORY_STRATEGY_ID = 'clearHistory';
32
+ export const EXECUTION_TYPE_CHAT = 'chat';
33
+ export const EXECUTION_TYPE_GENERATE = 'generate';
34
+ export const EXECUTION_TYPE_GRAPHQL = 'graphql';
14
35
  function canEndOnState(state, includeSuspend = false) {
15
36
  const { transitions } = state;
16
37
  if (!transitions?.length) {
@@ -38,13 +59,32 @@ export function getAgentEndStates(agent, includeSuspend = false) {
38
59
  }
39
60
  return endStates;
40
61
  }
41
- export const getInspectAgentSessionQueryName = (agentName) => {
62
+ export const getSendAgentMessageShapeName = (agentName) => {
63
+ return `${upperFirst(agentName)}SendAgentMessageResponse`;
64
+ };
65
+ export const getAgentMessageShapeName = (inputName) => {
66
+ return `${upperFirst(inputName)}AgentMessage`;
67
+ };
68
+ export const getCreateAgentSessionMutationName = (agentName) => {
69
+ return `create${upperFirst(agentName)}Session`;
70
+ };
71
+ export const getInspectAgentQueryName = (agentName) => {
42
72
  return `inspect${upperFirst(agentName)}`;
43
73
  };
44
- export function getAgentQueries(agents) {
74
+ export const getSendAgentMessageMutationName = (inputName) => {
75
+ return `send${upperFirst(inputName)}Message`;
76
+ };
77
+ export const getGetAgentMessageQueryName = (inputName) => {
78
+ return `get${upperFirst(inputName)}Message`;
79
+ };
80
+ export const getAbortAgentMessageMutationName = (inputName) => {
81
+ return `abort${upperFirst(inputName)}Message`;
82
+ };
83
+ export function getAgentFeatures(agents) {
45
84
  const result = {
46
85
  queries: {},
47
- mutations: {}
86
+ mutations: {},
87
+ shapes: {}
48
88
  };
49
89
  for (const [agentName, agent] of Object.entries(agents)) {
50
90
  // Get valid return types based on states that could possibly be the end state
@@ -53,51 +93,128 @@ export function getAgentQueries(agents) {
53
93
  const returnStates = [...getAgentEndStates(agent, true)];
54
94
  const returnTypes = uniq(returnStates.map((stateId) => {
55
95
  const { execution } = agent.states[stateId];
56
- if (execution.type === 'chat') {
57
- return 'TSChatResponse';
96
+ if (execution.type === EXECUTION_TYPE_CHAT) {
97
+ return agentChatPayload.shapeName;
58
98
  }
59
- if (execution.type === 'generate') {
99
+ if (execution.type === EXECUTION_TYPE_GENERATE) {
60
100
  return execution.outputShape ? execution.outputShape : 'string';
61
101
  }
62
- return 'JSON';
102
+ return JSON_SHAPE_NAME;
63
103
  }));
64
- const shape = returnTypes.length === 0 ? 'string' : returnTypes.length === 1 ? returnTypes[0] : 'JSON';
104
+ const shape = returnTypes.length === 0 ? 'string' : returnTypes.length === 1 ? returnTypes[0] : JSON_SHAPE_NAME;
105
+ const sendAgentMessageResponseShapeName = getSendAgentMessageShapeName(agentName);
106
+ assert(result.shapes[sendAgentMessageResponseShapeName] === undefined, `Schema already has a shape with the name "${sendAgentMessageResponseShapeName}"`);
107
+ result.shapes[sendAgentMessageResponseShapeName] = {
108
+ id: sendAgentMessageResponseShapeName,
109
+ name: sendAgentMessageResponseShapeName,
110
+ title: sendAgentMessageResponseShapeName,
111
+ schema: {
112
+ type: 'object',
113
+ properties: {
114
+ ...sendAgentMessageResponse.schema.properties,
115
+ output: {
116
+ '@ref': shape
117
+ }
118
+ },
119
+ required: [...sendAgentMessageResponse.schema.required],
120
+ additionalProperties: false
121
+ }
122
+ };
123
+ const createAgentSessionMutationName = getCreateAgentSessionMutationName(agentName);
124
+ assert(result.mutations[createAgentSessionMutationName] === undefined, `Schema already has a mutation with the name "${createAgentSessionMutationName}"`);
125
+ result.mutations[createAgentSessionMutationName] = {
126
+ description: `Create a session for the ${agentName} agent`,
127
+ shape: createAgentSessionResponse.shapeName,
128
+ resolver: {
129
+ name: 'ai:createAgentSession',
130
+ agentName
131
+ }
132
+ };
65
133
  for (const inputConfig of agent.api.inputs) {
66
134
  if (inputConfig.type === 'mutation') {
67
- const mutationName = inputConfig.name;
68
- if (result.mutations[mutationName] !== undefined) {
69
- throw new Error(`Schema already has a mutation with the name "${mutationName}"`);
70
- }
71
- result.mutations[mutationName] = {
135
+ const inputName = inputConfig.name;
136
+ const sendAgentMessageMutationName = getSendAgentMessageMutationName(inputName);
137
+ assert(result.mutations[sendAgentMessageMutationName] === undefined, `Schema already has a mutation with the name "${sendAgentMessageMutationName}"`);
138
+ result.mutations[sendAgentMessageMutationName] = {
72
139
  description: agent.description,
73
- args: inputConfig.args,
74
- shape,
140
+ args: {
141
+ type: 'object',
142
+ extends: [
143
+ {
144
+ ...sendAgentMessageArgs.propertySchema
145
+ },
146
+ {
147
+ '@ref': inputConfig.args
148
+ }
149
+ ]
150
+ },
151
+ shape: sendAgentMessageResponseShapeName,
75
152
  resolver: {
76
- name: 'ai:runAgent',
153
+ name: 'ai:sendAgentMessage',
154
+ agentName,
155
+ inputName
156
+ }
157
+ };
158
+ const agentMessageShapeName = getAgentMessageShapeName(inputName);
159
+ assert(result.shapes[agentMessageShapeName] === undefined, `Schema already has a shape with the name "${agentMessageShapeName}"`);
160
+ result.shapes[agentMessageShapeName] = {
161
+ id: agentMessageShapeName,
162
+ name: agentMessageShapeName,
163
+ title: agentMessageShapeName,
164
+ schema: {
165
+ type: 'object',
166
+ properties: {
167
+ ...getAgentMessageResponse.schema.properties,
168
+ output: {
169
+ '@ref': shape
170
+ },
171
+ input: {
172
+ '@ref': inputConfig.args
173
+ }
174
+ },
175
+ required: [...getAgentMessageResponse.schema.required],
176
+ additionalProperties: false
177
+ }
178
+ };
179
+ const getAgentMessageQueryName = getGetAgentMessageQueryName(inputName);
180
+ assert(result.queries[getAgentMessageQueryName] === undefined, `Schema already has a query with the name ${getAgentMessageQueryName}`);
181
+ result.queries[getAgentMessageQueryName] = {
182
+ description: `Get a message for the ${agentName} agent`,
183
+ shape: agentMessageShapeName,
184
+ resolver: {
185
+ name: 'ai:getAgentMessage',
77
186
  agentName
187
+ },
188
+ args: {
189
+ ...getAgentMessageArgs.schema
78
190
  }
79
191
  };
80
- }
81
- }
82
- if (shape === 'TSChatResponse') {
83
- result.queries[getInspectAgentSessionQueryName(agentName)] ||= {
84
- description: `Inspect a session for the ${agentName} agent`,
85
- args: {
86
- type: 'object',
87
- properties: {
88
- sessionId: {
89
- type: 'string'
90
- }
192
+ const abortAgentMessageMutationName = getAbortAgentMessageMutationName(inputName);
193
+ assert(result.mutations[abortAgentMessageMutationName] === undefined, `Schema already has a mutation with the name ${abortAgentMessageMutationName}`);
194
+ result.mutations[abortAgentMessageMutationName] = {
195
+ description: `Abort a message for the ${agentName} agent`,
196
+ shape: abortAgentMessageResponse.shapeName,
197
+ resolver: {
198
+ name: 'ai:abortAgentMessage',
199
+ agentName
91
200
  },
92
- required: ['sessionId']
93
- },
94
- shape: 'TSAgentSession',
95
- resolver: {
96
- name: 'ai:inspectAgentSession',
97
- agentName
98
- }
99
- };
201
+ args: {
202
+ ...getAgentMessageArgs.schema
203
+ }
204
+ };
205
+ }
100
206
  }
207
+ result.queries[getInspectAgentQueryName(agentName)] ||= {
208
+ description: `Inspect the ${agentName} agent`,
209
+ args: {
210
+ ...inspectAgentArgs.schema
211
+ },
212
+ shape: inspectAgentResponse.shapeName,
213
+ resolver: {
214
+ name: 'ai:inspectAgent',
215
+ agentName
216
+ }
217
+ };
101
218
  }
102
219
  return result;
103
220
  }
@@ -116,16 +233,20 @@ export function addAiQueries(projectSchema) {
116
233
  if (!agents) {
117
234
  return projectSchema;
118
235
  }
119
- const aiQueries = getAgentQueries(agents);
236
+ const aiFeatures = getAgentFeatures(agents);
120
237
  return {
121
238
  ...projectSchema,
122
239
  queries: {
123
240
  ...projectSchema.queries,
124
- ...aiQueries.queries
241
+ ...aiFeatures.queries
125
242
  },
126
243
  mutations: {
127
244
  ...projectSchema.mutations,
128
- ...aiQueries.mutations
245
+ ...aiFeatures.mutations
246
+ },
247
+ shapes: {
248
+ ...projectSchema.shapes,
249
+ ...aiFeatures.shapes
129
250
  }
130
251
  };
131
252
  }
@@ -1,11 +1,19 @@
1
- import { embeddingSearchArgsSchema } from "./resolvers/ai/embedding-search.js";
2
- import { schema as assetSchema } from "./resolvers/takeshape/assets/asset.js";
3
- import { schema as assetImageSchema } from "./resolvers/takeshape/assets/asset-image.js";
4
- import { schema as assetImageMetaSchema } from "./resolvers/takeshape/assets/asset-image-meta.js";
5
- import { schema as assetImageParamsSchema } from "./resolvers/takeshape/assets/asset-image-params.js";
6
- import { ASSET_IMAGE_META_SHAPE_ID, ASSET_IMAGE_META_SHAPE_NAME, ASSET_IMAGE_PARAMS_SHAPE_ID, ASSET_IMAGE_PARAMS_SHAPE_NAME, ASSET_IMAGE_SHAPE_ID, ASSET_IMAGE_SHAPE_NAME, ASSET_SHAPE_ID, ASSET_SHAPE_NAME } from "./resolvers/takeshape/assets/constants.js";
1
+ import * as abortAgentMessageResponse from "./resolvers/ai/abort-agent-message-response.js";
2
+ import * as agentChatArgs from "./resolvers/ai/agent-chat-args.js";
3
+ import * as agentChatPayload from "./resolvers/ai/agent-chat-payload.js";
4
+ import * as agentChatResponse from "./resolvers/ai/agent-chat-response.js";
5
+ import * as agentGenerateArgs from "./resolvers/ai/agent-generate-args.js";
6
+ import * as agentRunMode from "./resolvers/ai/agent-run-mode.js";
7
+ import * as createAgentSessionResponse from "./resolvers/ai/create-agent-session-response.js";
8
+ import * as embeddingSearchArgs from "./resolvers/ai/embedding-search.js";
9
+ import * as inspectAgentResponse from "./resolvers/ai/inspect-agent-response.js";
10
+ import * as asset from "./resolvers/takeshape/assets/asset.js";
11
+ import * as assetImage from "./resolvers/takeshape/assets/asset-image.js";
12
+ import * as assetImageMeta from "./resolvers/takeshape/assets/asset-image-meta.js";
13
+ import * as assetImageParams from "./resolvers/takeshape/assets/asset-image-params.js";
14
+ import { JSON_SHAPE_NAME } from "./resolvers/takeshape/builtins/constants.js";
7
15
  export function isAsset(content) {
8
- return content._contentTypeId === ASSET_SHAPE_ID || content._shapeId === ASSET_SHAPE_ID;
16
+ return content._contentTypeId === asset.shapeId || content._shapeId === asset.shapeId;
9
17
  }
10
18
  const ASSET_PATH = 'Hk6FQuz5';
11
19
  export function getAssetS3Path(content) {
@@ -15,13 +23,13 @@ export function setAssetS3Path(content, path) {
15
23
  content[ASSET_PATH] = path;
16
24
  }
17
25
  export const jsonShape = {
18
- id: 'JSON',
19
- name: 'JSON',
20
- title: 'JSON',
26
+ id: JSON_SHAPE_NAME,
27
+ name: JSON_SHAPE_NAME,
28
+ title: JSON_SHAPE_NAME,
21
29
  schema: {}
22
30
  };
23
31
  export const builtInShapes = {
24
- JSON: jsonShape,
32
+ [JSON_SHAPE_NAME]: jsonShape,
25
33
  TSRelationship: {
26
34
  id: 'TSRelationship',
27
35
  name: 'TSRelationship',
@@ -132,33 +140,33 @@ export const builtInShapes = {
132
140
  required: ['id', 'email', 'fullName']
133
141
  }
134
142
  },
135
- [ASSET_SHAPE_NAME]: {
136
- id: ASSET_SHAPE_ID,
137
- name: ASSET_SHAPE_NAME,
143
+ [asset.shapeName]: {
144
+ id: asset.shapeId,
145
+ name: asset.shapeName,
138
146
  title: 'Asset',
139
147
  model: {
140
148
  type: 'multiple'
141
149
  },
142
- schema: assetSchema
150
+ schema: asset.schema
143
151
  },
144
- [ASSET_IMAGE_PARAMS_SHAPE_NAME]: {
145
- id: ASSET_IMAGE_PARAMS_SHAPE_ID,
146
- name: ASSET_IMAGE_PARAMS_SHAPE_NAME,
152
+ [assetImageParams.shapeName]: {
153
+ id: assetImageParams.shapeId,
154
+ name: assetImageParams.shapeName,
147
155
  title: 'Asset Image Params',
148
156
  type: 'input',
149
- schema: assetImageParamsSchema
157
+ schema: assetImageParams.schema
150
158
  },
151
- [ASSET_IMAGE_SHAPE_NAME]: {
152
- id: ASSET_IMAGE_SHAPE_ID,
153
- name: ASSET_IMAGE_SHAPE_NAME,
159
+ [assetImage.shapeName]: {
160
+ id: assetImage.shapeId,
161
+ name: assetImage.shapeName,
154
162
  title: 'Asset Image',
155
- schema: assetImageSchema
163
+ schema: assetImage.schema
156
164
  },
157
- [ASSET_IMAGE_META_SHAPE_NAME]: {
158
- id: ASSET_IMAGE_META_SHAPE_ID,
159
- name: ASSET_IMAGE_META_SHAPE_NAME,
165
+ [assetImageMeta.shapeName]: {
166
+ id: assetImageMeta.shapeId,
167
+ name: assetImageMeta.shapeName,
160
168
  title: 'Asset Image Meta',
161
- schema: assetImageMetaSchema
169
+ schema: assetImageMeta.schema
162
170
  },
163
171
  TSStaticSite: {
164
172
  id: 'SITE',
@@ -310,31 +318,6 @@ export const builtInShapes = {
310
318
  }
311
319
  }
312
320
  },
313
- TSGenerateArgs: {
314
- id: 'TSGenerateArgs',
315
- name: 'TSGenerateArgs',
316
- title: 'Generate Args',
317
- schema: {
318
- type: 'object',
319
- properties: {
320
- input: { type: 'string' }
321
- },
322
- required: ['input']
323
- }
324
- },
325
- TSChatArgs: {
326
- id: 'TSChatArgs',
327
- name: 'TSChatArgs',
328
- title: 'Chat Args',
329
- schema: {
330
- type: 'object',
331
- properties: {
332
- input: { type: 'string' },
333
- sessionId: { type: 'string' }
334
- },
335
- required: ['input']
336
- }
337
- },
338
321
  TSReference: {
339
322
  id: 'TSReference',
340
323
  name: 'TSReference',
@@ -359,52 +342,60 @@ export const builtInShapes = {
359
342
  required: ['_tid']
360
343
  }
361
344
  },
362
- TSChatResponse: {
363
- id: 'TSChatResponse',
364
- name: 'TSChatResponse',
365
- title: 'Chat Response',
366
- schema: {
367
- type: 'object',
368
- properties: {
369
- content: { type: 'string' },
370
- sessionId: { type: 'string' },
371
- done: { type: 'boolean' },
372
- artifact: { type: 'object' },
373
- references: {
374
- type: 'array',
375
- items: {
376
- '@ref': 'TSReference'
377
- }
378
- }
379
- },
380
- required: ['content', 'references']
381
- }
382
- },
383
- TSAgentSession: {
384
- id: 'TSAgentSession',
385
- name: 'TSAgentSession',
386
- title: 'Agent Session',
387
- schema: {
388
- type: 'object',
389
- properties: {
390
- id: { type: 'string' },
391
- agentName: { type: 'string' },
392
- done: { type: 'boolean' },
393
- currentStateId: { type: 'string' },
394
- chatSessionIds: { type: 'object' },
395
- sessionMemory: { type: 'object' },
396
- stateOutputs: { type: 'object' },
397
- currentValue: { type: 'object' },
398
- userHistory: { type: 'array', items: { type: 'object' } },
399
- agentHistory: { type: 'array', items: { type: 'object' } }
400
- }
401
- }
402
- },
403
345
  TSEmbeddingSearchArgs: {
404
346
  id: 'TSEmbeddingSearchArgs',
405
347
  name: 'TSEmbeddingSearchArgs',
406
348
  title: 'Embedding Search Args',
407
- schema: embeddingSearchArgsSchema
349
+ schema: embeddingSearchArgs.schema
350
+ },
351
+ [agentRunMode.shapeName]: {
352
+ title: 'Agent Run Mode',
353
+ id: agentRunMode.shapeName,
354
+ name: agentRunMode.shapeName,
355
+ schema: agentRunMode.schema
356
+ },
357
+ [agentGenerateArgs.shapeName]: {
358
+ title: 'Generate Args',
359
+ id: agentGenerateArgs.shapeName,
360
+ name: agentGenerateArgs.shapeName,
361
+ schema: agentGenerateArgs.schema
362
+ },
363
+ [agentChatArgs.shapeName]: {
364
+ title: 'Chat Args',
365
+ id: agentChatArgs.shapeName,
366
+ name: agentChatArgs.shapeName,
367
+ schema: agentChatArgs.schema
368
+ },
369
+ // Preserved for backward compatibility
370
+ [agentChatResponse.shapeName]: {
371
+ title: 'Chat Agent Response',
372
+ id: agentChatResponse.shapeName,
373
+ name: agentChatResponse.shapeName,
374
+ schema: agentChatResponse.schema
375
+ },
376
+ [agentChatPayload.shapeName]: {
377
+ title: 'Chat Agent Payload',
378
+ id: agentChatPayload.shapeName,
379
+ name: agentChatPayload.shapeName,
380
+ schema: agentChatPayload.schema
381
+ },
382
+ [inspectAgentResponse.shapeName]: {
383
+ title: 'Inspect Agent Response',
384
+ id: inspectAgentResponse.shapeName,
385
+ name: inspectAgentResponse.shapeName,
386
+ schema: inspectAgentResponse.schema
387
+ },
388
+ [createAgentSessionResponse.shapeName]: {
389
+ title: 'Create Agent Session Response',
390
+ id: createAgentSessionResponse.shapeName,
391
+ name: createAgentSessionResponse.shapeName,
392
+ schema: createAgentSessionResponse.schema
393
+ },
394
+ [abortAgentMessageResponse.shapeName]: {
395
+ title: 'Abort Agent Message Response',
396
+ id: abortAgentMessageResponse.shapeName,
397
+ name: abortAgentMessageResponse.shapeName,
398
+ schema: abortAgentMessageResponse.schema
408
399
  }
409
400
  };
410
401
  export const builtInForms = {
@@ -62,6 +62,7 @@ export declare const migrateTo: {
62
62
  'v3.53.0': import("./types.ts").MigrateFunction<import("../index.ts").ProjectSchemaJSONV3_52_0, import("../index.ts").ProjectSchemaJSONV3_53_0>;
63
63
  'v3.54.0': import("./types.ts").MigrateFunction<import("../index.ts").ProjectSchemaJSONV3_53_0, import("../index.ts").ProjectSchemaJSONV3_54_0>;
64
64
  'v3.55.0': import("./types.ts").MigrateFunction<import("../index.ts").ProjectSchemaJSONV3_54_0, import("../index.ts").ProjectSchemaJSONV3_55_0>;
65
+ 'v3.56.0': import("./types.ts").MigrateFunction<import("../index.ts").ProjectSchemaJSONV3_55_0, import("../index.ts").ProjectSchemaJSONV3_56_0>;
65
66
  };
66
67
  export * from './utils.ts';
67
68
  export declare const listTypePrefix = "PaginatedList";
@@ -61,6 +61,7 @@ import migrateToV3_52_0 from "./to/v3.52.0.js";
61
61
  import migrateToV3_53_0 from "./to/v3.53.0.js";
62
62
  import migrateToV3_54_0 from "./to/v3.54.0.js";
63
63
  import migrateToV3_55_0 from "./to/v3.55.0.js";
64
+ import migrateToV3_56_0 from "./to/v3.56.0.js";
64
65
  export const migrateTo = {
65
66
  'v3.0.0': migrateToV3_0_0,
66
67
  'v3.1.0': migrateToV3_1_0,
@@ -124,7 +125,8 @@ export const migrateTo = {
124
125
  'v3.52.0': migrateToV3_52_0,
125
126
  'v3.53.0': migrateToV3_53_0,
126
127
  'v3.54.0': migrateToV3_54_0,
127
- 'v3.55.0': migrateToV3_55_0
128
+ 'v3.55.0': migrateToV3_55_0,
129
+ 'v3.56.0': migrateToV3_56_0
128
130
  };
129
131
  export * from "./utils.js";
130
132
  export const listTypePrefix = 'PaginatedList';
@@ -0,0 +1,4 @@
1
+ import type { ProjectSchemaJSONV3_55_0, ProjectSchemaJSONV3_56_0 } from '../../project-schema/index.ts';
2
+ import type { MigrateFunction } from '../types.ts';
3
+ declare const migrate: MigrateFunction<ProjectSchemaJSONV3_55_0, ProjectSchemaJSONV3_56_0>;
4
+ export default migrate;
@@ -0,0 +1,10 @@
1
+ const migrate = async (_, projectSchema) => {
2
+ /**
3
+ * No migration needed all changes are backwards compatible.
4
+ */
5
+ return {
6
+ ...projectSchema,
7
+ schemaVersion: '3.56.0'
8
+ };
9
+ };
10
+ export default migrate;
@@ -13,5 +13,6 @@ export declare class ProjectSchemaImpl implements ProjectSchema {
13
13
  ensureAgent(name: string): Agent;
14
14
  getAgent(name: string): Agent | undefined;
15
15
  dereferenceSchema(propertySchema: PropertySchema): PropertySchema;
16
+ dereferenceObjectSchema(propertySchema: PropertySchema): import("../project-schema/latest.ts").ObjectSchema;
16
17
  get json(): ProjectSchemaJSON;
17
18
  }
@@ -1,5 +1,5 @@
1
1
  import { getAgent, getAgentMap } from "../agents.js";
2
- import { dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, parseRef, refItemToNamespacedShapeName } from "../refs.js";
2
+ import { dereferenceObjectSchema, dereferenceSchema, getQuery, normalizePropertyRef, normalizeRefExpression, parsePropertyRef, parseRef, refItemToNamespacedShapeName } from "../refs.js";
3
3
  import { getShape } from "../util/shapes.js";
4
4
  import { createAgent } from "./agent.js";
5
5
  import { createQuery } from './query.js';
@@ -106,6 +106,9 @@ export class ProjectSchemaImpl {
106
106
  dereferenceSchema(propertySchema) {
107
107
  return dereferenceSchema(this.#projectSchemaJson, propertySchema);
108
108
  }
109
+ dereferenceObjectSchema(propertySchema) {
110
+ return dereferenceObjectSchema(this.#projectSchemaJson, propertySchema);
111
+ }
109
112
  get json() {
110
113
  return this.#projectSchemaJson;
111
114
  }
@@ -17,7 +17,7 @@ class QueryImpl {
17
17
  const args = this.#query.args;
18
18
  if (args) {
19
19
  if (typeof args === 'object') {
20
- return args;
20
+ return this.#schema.dereferenceObjectSchema(args);
21
21
  }
22
22
  return this.#schema.getShape(args)?.getObjectSchema();
23
23
  }
@@ -6,6 +6,7 @@ export interface ProjectSchema {
6
6
  getLocalQueries(): Query[];
7
7
  getLocalMutations(): Query[];
8
8
  dereferenceSchema(propertySchema: PropertySchema): PropertySchema;
9
+ dereferenceObjectSchema(propertySchema: PropertySchema): ObjectSchema;
9
10
  getAgent(name: string): Agent | undefined;
10
11
  getAgents(): Agent[];
11
12
  json: ProjectSchemaJSON;
@@ -63,6 +63,7 @@ export type * from './v3.52.0.ts';
63
63
  export type * from './v3.53.0.ts';
64
64
  export type * from './v3.54.0.ts';
65
65
  export type * from './v3.55.0.ts';
66
+ export type * from './v3.56.0.ts';
66
67
  export type * from './v4.0.0.ts';
67
68
  import { ProjectSchemaJSONV1_0_0 } from './v1.0.0.ts';
68
69
  import { ProjectSchemaJSONV3_0_0 } from './v3.0.0.ts';
@@ -128,9 +129,10 @@ import { ProjectSchemaJSONV3_52_0 } from './v3.52.0.ts';
128
129
  import { ProjectSchemaJSONV3_53_0 } from './v3.53.0.ts';
129
130
  import { ProjectSchemaJSONV3_54_0 } from './v3.54.0.ts';
130
131
  import { ProjectSchemaJSONV3_55_0 } from './v3.55.0.ts';
132
+ import { ProjectSchemaJSONV3_56_0 } from './v3.56.0.ts';
131
133
  import { ProjectSchemaJSONV4_0_0 } from './v4.0.0.ts';
132
134
  import { ProjectSchemaJSON } from './latest.ts';
133
- export type AnyProjectSchemaJSON = ProjectSchemaJSONV1_0_0 | ProjectSchemaJSONV3_0_0 | ProjectSchemaJSONV3_1_0 | ProjectSchemaJSONV3_2_0 | ProjectSchemaJSONV3_3_0 | ProjectSchemaJSONV3_4_0 | ProjectSchemaJSONV3_5_0 | ProjectSchemaJSONV3_5_1 | ProjectSchemaJSONV3_6_0 | ProjectSchemaJSONV3_7_0 | ProjectSchemaJSONV3_8_0 | ProjectSchemaJSONV3_9_0 | ProjectSchemaJSONV3_10_0 | ProjectSchemaJSONV3_11_0 | ProjectSchemaJSONV3_12_0 | ProjectSchemaJSONV3_12_1 | ProjectSchemaJSONV3_12_2 | ProjectSchemaJSONV3_12_3 | ProjectSchemaJSONV3_13_0 | ProjectSchemaJSONV3_14_0 | ProjectSchemaJSONV3_15_0 | ProjectSchemaJSONV3_16_0 | ProjectSchemaJSONV3_17_0 | ProjectSchemaJSONV3_17_1 | ProjectSchemaJSONV3_18_0 | ProjectSchemaJSONV3_18_1 | ProjectSchemaJSONV3_18_2 | ProjectSchemaJSONV3_19_0 | ProjectSchemaJSONV3_20_0 | ProjectSchemaJSONV3_21_0 | ProjectSchemaJSONV3_22_0 | ProjectSchemaJSONV3_23_0 | ProjectSchemaJSONV3_24_0 | ProjectSchemaJSONV3_25_0 | ProjectSchemaJSONV3_26_0 | ProjectSchemaJSONV3_27_0 | ProjectSchemaJSONV3_28_0 | ProjectSchemaJSONV3_29_0 | ProjectSchemaJSONV3_30_0 | ProjectSchemaJSONV3_31_0 | ProjectSchemaJSONV3_32_0 | ProjectSchemaJSONV3_33_0 | ProjectSchemaJSONV3_34_0 | ProjectSchemaJSONV3_35_0 | ProjectSchemaJSONV3_36_0 | ProjectSchemaJSONV3_37_0 | ProjectSchemaJSONV3_38_0 | ProjectSchemaJSONV3_39_0 | ProjectSchemaJSONV3_40_0 | ProjectSchemaJSONV3_41_0 | ProjectSchemaJSONV3_42_0 | ProjectSchemaJSONV3_43_0 | ProjectSchemaJSONV3_44_0 | ProjectSchemaJSONV3_45_0 | ProjectSchemaJSONV3_46_0 | ProjectSchemaJSONV3_47_0 | ProjectSchemaJSONV3_48_0 | ProjectSchemaJSONV3_49_0 | ProjectSchemaJSONV3_50_0 | ProjectSchemaJSONV3_51_0 | ProjectSchemaJSONV3_52_0 | ProjectSchemaJSONV3_53_0 | ProjectSchemaJSONV3_54_0 | ProjectSchemaJSONV3_55_0 | ProjectSchemaJSONV4_0_0 | ProjectSchemaJSON;
135
+ export type AnyProjectSchemaJSON = ProjectSchemaJSONV1_0_0 | ProjectSchemaJSONV3_0_0 | ProjectSchemaJSONV3_1_0 | ProjectSchemaJSONV3_2_0 | ProjectSchemaJSONV3_3_0 | ProjectSchemaJSONV3_4_0 | ProjectSchemaJSONV3_5_0 | ProjectSchemaJSONV3_5_1 | ProjectSchemaJSONV3_6_0 | ProjectSchemaJSONV3_7_0 | ProjectSchemaJSONV3_8_0 | ProjectSchemaJSONV3_9_0 | ProjectSchemaJSONV3_10_0 | ProjectSchemaJSONV3_11_0 | ProjectSchemaJSONV3_12_0 | ProjectSchemaJSONV3_12_1 | ProjectSchemaJSONV3_12_2 | ProjectSchemaJSONV3_12_3 | ProjectSchemaJSONV3_13_0 | ProjectSchemaJSONV3_14_0 | ProjectSchemaJSONV3_15_0 | ProjectSchemaJSONV3_16_0 | ProjectSchemaJSONV3_17_0 | ProjectSchemaJSONV3_17_1 | ProjectSchemaJSONV3_18_0 | ProjectSchemaJSONV3_18_1 | ProjectSchemaJSONV3_18_2 | ProjectSchemaJSONV3_19_0 | ProjectSchemaJSONV3_20_0 | ProjectSchemaJSONV3_21_0 | ProjectSchemaJSONV3_22_0 | ProjectSchemaJSONV3_23_0 | ProjectSchemaJSONV3_24_0 | ProjectSchemaJSONV3_25_0 | ProjectSchemaJSONV3_26_0 | ProjectSchemaJSONV3_27_0 | ProjectSchemaJSONV3_28_0 | ProjectSchemaJSONV3_29_0 | ProjectSchemaJSONV3_30_0 | ProjectSchemaJSONV3_31_0 | ProjectSchemaJSONV3_32_0 | ProjectSchemaJSONV3_33_0 | ProjectSchemaJSONV3_34_0 | ProjectSchemaJSONV3_35_0 | ProjectSchemaJSONV3_36_0 | ProjectSchemaJSONV3_37_0 | ProjectSchemaJSONV3_38_0 | ProjectSchemaJSONV3_39_0 | ProjectSchemaJSONV3_40_0 | ProjectSchemaJSONV3_41_0 | ProjectSchemaJSONV3_42_0 | ProjectSchemaJSONV3_43_0 | ProjectSchemaJSONV3_44_0 | ProjectSchemaJSONV3_45_0 | ProjectSchemaJSONV3_46_0 | ProjectSchemaJSONV3_47_0 | ProjectSchemaJSONV3_48_0 | ProjectSchemaJSONV3_49_0 | ProjectSchemaJSONV3_50_0 | ProjectSchemaJSONV3_51_0 | ProjectSchemaJSONV3_52_0 | ProjectSchemaJSONV3_53_0 | ProjectSchemaJSONV3_54_0 | ProjectSchemaJSONV3_55_0 | ProjectSchemaJSONV3_56_0 | ProjectSchemaJSONV4_0_0 | ProjectSchemaJSON;
134
136
  export declare const isProjectSchemaJSONV1_0_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV1_0_0;
135
137
  export declare const isProjectSchemaJSONV3_0_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_0_0;
136
138
  export declare const isProjectSchemaJSONV3_1_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_1_0;
@@ -195,5 +197,6 @@ export declare const isProjectSchemaJSONV3_52_0: (projectSchema: AnyProjectSchem
195
197
  export declare const isProjectSchemaJSONV3_53_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_53_0;
196
198
  export declare const isProjectSchemaJSONV3_54_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_54_0;
197
199
  export declare const isProjectSchemaJSONV3_55_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_55_0;
200
+ export declare const isProjectSchemaJSONV3_56_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV3_56_0;
198
201
  export declare const isLatestProjectSchemaJSON: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSON;
199
202
  export declare const isProjectSchemaJSONV4_0_0: (projectSchema: AnyProjectSchemaJSON) => projectSchema is ProjectSchemaJSONV4_0_0;
@@ -75,5 +75,6 @@ export const isProjectSchemaJSONV3_52_0 = createVersionPredicate('3.52.0');
75
75
  export const isProjectSchemaJSONV3_53_0 = createVersionPredicate('3.53.0');
76
76
  export const isProjectSchemaJSONV3_54_0 = createVersionPredicate('3.54.0');
77
77
  export const isProjectSchemaJSONV3_55_0 = createVersionPredicate('3.55.0');
78
- export const isLatestProjectSchemaJSON = createVersionPredicate('3.55.0');
78
+ export const isProjectSchemaJSONV3_56_0 = createVersionPredicate('3.56.0');
79
+ export const isLatestProjectSchemaJSON = createVersionPredicate('3.56.0');
79
80
  export const isProjectSchemaJSONV4_0_0 = createVersionPredicate('4.0.0');