@takeshape/schema 11.120.1 → 11.121.4

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/index.d.ts CHANGED
@@ -21,6 +21,8 @@ export * from './project-schema/index.ts';
21
21
  export * from './project-schema/migrate.ts';
22
22
  export * from './refs.ts';
23
23
  export * from './relationships.ts';
24
+ export * from './resolvers/ai/agent-message-payload.ts';
25
+ export type { AgentSessionPayload } from './resolvers/ai/agent-session-payload.ts';
24
26
  export * from './resolvers/takeshape/assets/constants.ts';
25
27
  export * from './runtime-schema.ts';
26
28
  export * from './scalars.ts';
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ export * from "./project-schema/index.js";
19
19
  export * from "./project-schema/migrate.js";
20
20
  export * from "./refs.js";
21
21
  export * from "./relationships.js";
22
+ export * from "./resolvers/ai/agent-message-payload.js";
22
23
  export * from "./resolvers/takeshape/assets/constants.js";
23
24
  export * from "./runtime-schema.js";
24
25
  export * from "./scalars.js";
@@ -98,6 +98,10 @@ export declare const schema: {
98
98
  readonly type: "boolean";
99
99
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
100
100
  };
101
+ readonly hasFeedback: {
102
+ readonly type: "boolean";
103
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
104
+ };
101
105
  };
102
106
  readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId", "schemaHash"];
103
107
  readonly additionalProperties: false;
@@ -131,12 +135,13 @@ export declare const validate: import("ajv").ValidateFunction<{
131
135
  [x: string]: unknown;
132
136
  } | undefined;
133
137
  hasAgentHistory?: boolean | undefined;
134
- id: string;
135
- createdAt: string;
136
- updatedAt: string;
137
- agentName: string;
138
+ hasFeedback?: boolean | undefined;
138
139
  projectId: string;
139
140
  schemaId: string;
141
+ agentName: string;
142
+ createdAt: string;
143
+ id: string;
144
+ updatedAt: string;
140
145
  schemaHash: string;
141
146
  done: boolean;
142
147
  currentStateId: string;
@@ -1,4 +1,69 @@
1
+ import type { AiUsage } from '@takeshape/util';
2
+ import type { CoreMessage } from 'ai';
1
3
  import type { FromSchema } from 'json-schema-to-ts';
4
+ export declare const agentGenerateStateOutputSchema: {
5
+ readonly title: "AgentGenerateStateOutput";
6
+ readonly type: "object";
7
+ readonly properties: {
8
+ readonly type: {
9
+ readonly const: "generate";
10
+ };
11
+ readonly data: {};
12
+ };
13
+ readonly required: ["type", "data"];
14
+ readonly additionalProperties: false;
15
+ };
16
+ export declare const agentGraphQLStateOutputSchema: {
17
+ readonly title: "AgentGraphQLStateOutput";
18
+ readonly type: "object";
19
+ readonly properties: {
20
+ readonly type: {
21
+ readonly const: "graphql";
22
+ };
23
+ readonly data: {};
24
+ };
25
+ readonly required: ["type", "data"];
26
+ readonly additionalProperties: false;
27
+ };
28
+ export declare const agentChatStateOutputSchema: {
29
+ readonly title: "AgentChatStateOutput";
30
+ readonly type: "object";
31
+ readonly properties: {
32
+ readonly type: {
33
+ readonly const: "chat";
34
+ };
35
+ readonly data: {
36
+ readonly title: "AgentChatStateOutputData";
37
+ readonly type: "object";
38
+ readonly properties: {
39
+ readonly content: {
40
+ readonly type: "string";
41
+ };
42
+ readonly artifact: {
43
+ readonly type: "object";
44
+ };
45
+ readonly references: {
46
+ readonly type: "array";
47
+ readonly items: {
48
+ readonly title: "AgentChatStateOutputReference";
49
+ readonly type: "object";
50
+ readonly properties: {
51
+ readonly _tid: {
52
+ readonly type: "string";
53
+ };
54
+ };
55
+ readonly required: ["_tid"];
56
+ readonly additionalProperties: false;
57
+ };
58
+ };
59
+ };
60
+ readonly required: ["content", "references"];
61
+ readonly additionalProperties: false;
62
+ };
63
+ };
64
+ readonly required: ["type", "data"];
65
+ readonly additionalProperties: false;
66
+ };
2
67
  export declare const schema: {
3
68
  readonly $id: "https://takeshape.io/schema/agent-message-payload";
4
69
  readonly type: "object";
@@ -23,11 +88,89 @@ export declare const schema: {
23
88
  readonly type: "string";
24
89
  readonly description: "Name of the agent this message was created by";
25
90
  };
26
- readonly input: {
91
+ readonly args: {
27
92
  readonly type: "object";
28
93
  };
94
+ readonly input: {
95
+ readonly type: "string";
96
+ };
29
97
  readonly output: {
30
- readonly type: "object";
98
+ readonly discriminator: {
99
+ readonly propertyName: "type";
100
+ };
101
+ readonly oneOf: [{
102
+ readonly title: "AgentGenerateStateOutput";
103
+ readonly type: "object";
104
+ readonly properties: {
105
+ readonly type: {
106
+ readonly const: "generate";
107
+ };
108
+ readonly data: {};
109
+ };
110
+ readonly required: ["type", "data"];
111
+ readonly additionalProperties: false;
112
+ }, {
113
+ readonly title: "AgentGraphQLStateOutput";
114
+ readonly type: "object";
115
+ readonly properties: {
116
+ readonly type: {
117
+ readonly const: "graphql";
118
+ };
119
+ readonly data: {};
120
+ };
121
+ readonly required: ["type", "data"];
122
+ readonly additionalProperties: false;
123
+ }, {
124
+ readonly title: "AgentChatStateOutput";
125
+ readonly type: "object";
126
+ readonly properties: {
127
+ readonly type: {
128
+ readonly const: "chat";
129
+ };
130
+ readonly data: {
131
+ readonly title: "AgentChatStateOutputData";
132
+ readonly type: "object";
133
+ readonly properties: {
134
+ readonly content: {
135
+ readonly type: "string";
136
+ };
137
+ readonly artifact: {
138
+ readonly type: "object";
139
+ };
140
+ readonly references: {
141
+ readonly type: "array";
142
+ readonly items: {
143
+ readonly title: "AgentChatStateOutputReference";
144
+ readonly type: "object";
145
+ readonly properties: {
146
+ readonly _tid: {
147
+ readonly type: "string";
148
+ };
149
+ };
150
+ readonly required: ["_tid"];
151
+ readonly additionalProperties: false;
152
+ };
153
+ };
154
+ };
155
+ readonly required: ["content", "references"];
156
+ readonly additionalProperties: false;
157
+ };
158
+ };
159
+ readonly required: ["type", "data"];
160
+ readonly additionalProperties: false;
161
+ }, {
162
+ readonly title: "AgentUnknownStateOutput";
163
+ readonly type: "object";
164
+ readonly properties: {
165
+ readonly type: {
166
+ readonly const: "unknown";
167
+ };
168
+ readonly data: {};
169
+ };
170
+ readonly required: ["type", "data"];
171
+ readonly additionalProperties: false;
172
+ }];
173
+ readonly required: ["type"];
31
174
  };
32
175
  readonly error: {
33
176
  readonly type: "object";
@@ -147,12 +290,44 @@ export declare const schema: {
147
290
  readonly additionalProperties: false;
148
291
  };
149
292
  export type AgentMessagePayload = FromSchema<typeof schema>;
293
+ export type AgentStateOutput = NonNullable<AgentMessagePayload['output']>;
294
+ export type AgentGenerateStateOutput = Extract<AgentMessagePayload['output'], {
295
+ type: 'generate';
296
+ }>;
297
+ export type AgentGraphQLStateOutput = Extract<AgentMessagePayload['output'], {
298
+ type: 'graphql';
299
+ }>;
300
+ export type AgentChatStateOutput = Extract<AgentMessagePayload['output'], {
301
+ type: 'chat';
302
+ }>;
303
+ export type AgentUnknownStateOutput = Extract<AgentMessagePayload['output'], {
304
+ type: 'unknown';
305
+ }>;
150
306
  export declare const validate: import("ajv").ValidateFunction<{
151
- input?: {
307
+ args?: {
152
308
  [x: string]: unknown;
153
309
  } | undefined;
310
+ input?: string | undefined;
154
311
  output?: {
155
- [x: string]: unknown;
312
+ type: "generate";
313
+ data: unknown;
314
+ } | {
315
+ type: "graphql";
316
+ data: unknown;
317
+ } | {
318
+ type: "chat";
319
+ data: {
320
+ artifact?: {
321
+ [x: string]: unknown;
322
+ } | undefined;
323
+ content: string;
324
+ references: {
325
+ _tid: string;
326
+ }[];
327
+ };
328
+ } | {
329
+ type: "unknown";
330
+ data: unknown;
156
331
  } | undefined;
157
332
  error?: {
158
333
  message?: string | undefined;
@@ -163,10 +338,10 @@ export declare const validate: import("ajv").ValidateFunction<{
163
338
  startedAt?: number | undefined;
164
339
  finishedAt?: number | undefined;
165
340
  span?: {
166
- createdAt: number;
167
341
  name: string;
168
342
  traceId: string;
169
343
  spanId: string;
344
+ createdAt: number;
170
345
  } | undefined;
171
346
  feedback?: {
172
347
  createdAt?: number | undefined;
@@ -185,10 +360,31 @@ export declare const validate: import("ajv").ValidateFunction<{
185
360
  guardrailUnits?: number | undefined;
186
361
  } | undefined;
187
362
  messageId: string;
188
- agentName: string;
363
+ sessionId: string;
189
364
  projectId: string;
190
365
  schemaId: string;
191
- sessionId: string;
366
+ agentName: string;
192
367
  runMode: "BACKGROUND" | "IMMEDIATE";
193
368
  sentAt: number;
194
369
  }>;
370
+ export type AgentChatStateExecuteResult = {
371
+ input: string;
372
+ output: AgentChatStateOutput;
373
+ metadata: {
374
+ agentHistoryUpdate: CoreMessage[] | null;
375
+ usage: AiUsage;
376
+ blocked: boolean;
377
+ };
378
+ };
379
+ export type AgentGenerateStateExecuteResult = {
380
+ input: string;
381
+ output: AgentGenerateStateOutput;
382
+ metadata: {
383
+ usage: AiUsage;
384
+ blocked: boolean;
385
+ };
386
+ };
387
+ export type AgentGraphQLStateExecuteResult = {
388
+ output: AgentGraphQLStateOutput;
389
+ };
390
+ export type AgentStateExecuteResult = AgentChatStateExecuteResult | AgentGenerateStateExecuteResult | AgentGraphQLStateExecuteResult;
@@ -1,4 +1,65 @@
1
1
  import { createTypedValidator } from '@takeshape/json-schema';
2
+ export const agentGenerateStateOutputSchema = {
3
+ title: 'AgentGenerateStateOutput',
4
+ type: 'object',
5
+ properties: {
6
+ type: { const: 'generate' },
7
+ data: {}
8
+ },
9
+ required: ['type', 'data'],
10
+ additionalProperties: false
11
+ };
12
+ export const agentGraphQLStateOutputSchema = {
13
+ title: 'AgentGraphQLStateOutput',
14
+ type: 'object',
15
+ properties: {
16
+ type: { const: 'graphql' },
17
+ data: {}
18
+ },
19
+ required: ['type', 'data'],
20
+ additionalProperties: false
21
+ };
22
+ export const agentChatStateOutputSchema = {
23
+ title: 'AgentChatStateOutput',
24
+ type: 'object',
25
+ properties: {
26
+ type: { const: 'chat' },
27
+ data: {
28
+ title: 'AgentChatStateOutputData',
29
+ type: 'object',
30
+ properties: {
31
+ content: { type: 'string' },
32
+ artifact: { type: 'object' },
33
+ references: {
34
+ type: 'array',
35
+ items: {
36
+ title: 'AgentChatStateOutputReference',
37
+ type: 'object',
38
+ properties: {
39
+ _tid: { type: 'string' }
40
+ },
41
+ required: ['_tid'],
42
+ additionalProperties: false
43
+ }
44
+ }
45
+ },
46
+ required: ['content', 'references'],
47
+ additionalProperties: false
48
+ }
49
+ },
50
+ required: ['type', 'data'],
51
+ additionalProperties: false
52
+ };
53
+ const agentUnknownStateOutputSchema = {
54
+ title: 'AgentUnknownStateOutput',
55
+ type: 'object',
56
+ properties: {
57
+ type: { const: 'unknown' },
58
+ data: {}
59
+ },
60
+ required: ['type', 'data'],
61
+ additionalProperties: false
62
+ };
2
63
  export const schema = {
3
64
  $id: 'https://takeshape.io/schema/agent-message-payload',
4
65
  type: 'object',
@@ -23,11 +84,23 @@ export const schema = {
23
84
  type: 'string',
24
85
  description: 'Name of the agent this message was created by'
25
86
  },
26
- input: {
87
+ args: {
27
88
  type: 'object'
28
89
  },
90
+ input: {
91
+ type: 'string'
92
+ },
29
93
  output: {
30
- type: 'object'
94
+ discriminator: {
95
+ propertyName: 'type'
96
+ },
97
+ oneOf: [
98
+ agentGenerateStateOutputSchema,
99
+ agentGraphQLStateOutputSchema,
100
+ agentChatStateOutputSchema,
101
+ agentUnknownStateOutputSchema
102
+ ],
103
+ required: ['type']
31
104
  },
32
105
  error: {
33
106
  type: 'object',
@@ -1,5 +1,5 @@
1
- import type { AgentExecutionOutputValue, AgentExecutionResultValue } from '@takeshape/util';
2
1
  import type { FromSchema } from 'json-schema-to-ts';
2
+ import type { AgentStateExecuteResult, AgentStateOutput } from './agent-message-payload.ts';
3
3
  export declare const schema: {
4
4
  readonly type: "object";
5
5
  readonly properties: {
@@ -69,13 +69,17 @@ export declare const schema: {
69
69
  readonly type: "boolean";
70
70
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
71
71
  };
72
+ readonly hasFeedback: {
73
+ readonly type: "boolean";
74
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
75
+ };
72
76
  };
73
77
  readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId", "schemaHash"];
74
78
  readonly additionalProperties: false;
75
79
  };
76
80
  export type AgentSessionPayload = FromSchema<typeof schema> & {
77
- stateOutputs: Record<string, AgentExecutionOutputValue | undefined>;
81
+ stateOutputs: Record<string, AgentStateOutput | undefined>;
78
82
  suspended?: boolean;
79
- currentValue?: AgentExecutionResultValue;
83
+ currentValue?: Omit<AgentStateExecuteResult, 'metadata'>;
80
84
  };
81
85
  export declare const validate: import("ajv").ValidateFunction<AgentSessionPayload>;
@@ -67,6 +67,10 @@ export const schema = {
67
67
  hasAgentHistory: {
68
68
  type: 'boolean',
69
69
  description: 'Indicates whether the agent session has an associated history of agent responses.'
70
+ },
71
+ hasFeedback: {
72
+ type: 'boolean',
73
+ description: 'Indicates whether the agent session has any messages with feedback.'
70
74
  }
71
75
  },
72
76
  required: [
@@ -2,24 +2,24 @@ import type { FromSchema } from 'json-schema-to-ts';
2
2
  export declare const shapeName = "TSCreateAgentSessionResponse";
3
3
  export declare const schema: {
4
4
  readonly properties: {
5
- readonly id: {
5
+ readonly agentName: {
6
6
  readonly type: "string";
7
- readonly description: "The unique identifier for the agent session.";
7
+ readonly description: "The name of the agent associated with this session.";
8
8
  };
9
9
  readonly createdAt: {
10
10
  readonly type: "string";
11
11
  readonly description: "ISO8601 timestamp when the agent session was created";
12
12
  readonly format: "date-time";
13
13
  };
14
+ readonly id: {
15
+ readonly type: "string";
16
+ readonly description: "The unique identifier for the agent session.";
17
+ };
14
18
  readonly updatedAt: {
15
19
  readonly type: "string";
16
20
  readonly description: "ISO8601 timestamp when the agent session was updated";
17
21
  readonly format: "date-time";
18
22
  };
19
- readonly agentName: {
20
- readonly type: "string";
21
- readonly description: "The name of the agent associated with this session.";
22
- };
23
23
  readonly schemaHash: {
24
24
  readonly type: "string";
25
25
  readonly description: "The hash of the schema version associated with the agent session.";
@@ -60,6 +60,10 @@ export declare const schema: {
60
60
  readonly type: "boolean";
61
61
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
62
62
  };
63
+ readonly hasFeedback: {
64
+ readonly type: "boolean";
65
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
66
+ };
63
67
  };
64
68
  readonly required: ["id", "agentName", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs"];
65
69
  readonly additionalProperties: false;
@@ -76,8 +80,9 @@ export declare const validate: import("ajv").ValidateFunction<{
76
80
  [x: string]: unknown;
77
81
  } | undefined;
78
82
  hasAgentHistory?: boolean | undefined;
79
- id: string;
83
+ hasFeedback?: boolean | undefined;
80
84
  agentName: string;
85
+ id: string;
81
86
  done: boolean;
82
87
  currentStateId: string;
83
88
  chatSessionIds: {
@@ -83,6 +83,10 @@ export declare const schema: {
83
83
  readonly type: "boolean";
84
84
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
85
85
  };
86
+ readonly hasFeedback: {
87
+ readonly type: "boolean";
88
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
89
+ };
86
90
  };
87
91
  readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId", "schemaHash"];
88
92
  readonly additionalProperties: false;
@@ -95,9 +99,12 @@ export declare const schema: {
95
99
  readonly type: "string";
96
100
  readonly description: "Name of the agent this message was created by";
97
101
  };
98
- readonly input: {
102
+ readonly args: {
99
103
  readonly type: "object";
100
104
  };
105
+ readonly input: {
106
+ readonly type: "string";
107
+ };
101
108
  readonly error: {
102
109
  readonly type: "object";
103
110
  readonly properties: {
@@ -18,24 +18,24 @@ export declare const schema: {
18
18
  };
19
19
  readonly description: "A list of messages exchanged in the agent session, which may include user inputs and agent responses.";
20
20
  };
21
- readonly id: {
21
+ readonly agentName: {
22
22
  readonly type: "string";
23
- readonly description: "The unique identifier for the agent session.";
23
+ readonly description: "The name of the agent associated with this session.";
24
24
  };
25
25
  readonly createdAt: {
26
26
  readonly type: "string";
27
27
  readonly description: "ISO8601 timestamp when the agent session was created";
28
28
  readonly format: "date-time";
29
29
  };
30
+ readonly id: {
31
+ readonly type: "string";
32
+ readonly description: "The unique identifier for the agent session.";
33
+ };
30
34
  readonly updatedAt: {
31
35
  readonly type: "string";
32
36
  readonly description: "ISO8601 timestamp when the agent session was updated";
33
37
  readonly format: "date-time";
34
38
  };
35
- readonly agentName: {
36
- readonly type: "string";
37
- readonly description: "The name of the agent associated with this session.";
38
- };
39
39
  readonly schemaHash: {
40
40
  readonly type: "string";
41
41
  readonly description: "The hash of the schema version associated with the agent session.";
@@ -76,6 +76,10 @@ export declare const schema: {
76
76
  readonly type: "boolean";
77
77
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
78
78
  };
79
+ readonly hasFeedback: {
80
+ readonly type: "boolean";
81
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
82
+ };
79
83
  };
80
84
  readonly required: ["id", "agentName", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "agentHistory", "messages"];
81
85
  readonly additionalProperties: false;
@@ -75,6 +75,10 @@ export declare const schema: {
75
75
  readonly type: "boolean";
76
76
  readonly description: "Indicates whether the agent session has an associated history of agent responses.";
77
77
  };
78
+ readonly hasFeedback: {
79
+ readonly type: "boolean";
80
+ readonly description: "Indicates whether the agent session has any messages with feedback.";
81
+ };
78
82
  };
79
83
  readonly required: ["id", "agentName", "createdAt", "updatedAt", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId", "schemaHash"];
80
84
  readonly additionalProperties: false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takeshape/schema",
3
- "version": "11.120.1",
3
+ "version": "11.121.4",
4
4
  "description": "TakeShape Schema",
5
5
  "homepage": "https://www.takeshape.io",
6
6
  "repository": {
@@ -56,9 +56,9 @@
56
56
  "p-reduce": "2.1.0",
57
57
  "semver": "7.7.2",
58
58
  "tiny-invariant": "1.3.3",
59
- "@takeshape/errors": "11.120.1",
60
- "@takeshape/json-schema": "11.120.1",
61
- "@takeshape/util": "11.120.1"
59
+ "@takeshape/json-schema": "11.121.4",
60
+ "@takeshape/errors": "11.121.4",
61
+ "@takeshape/util": "11.121.4"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@takeshape/json-schema-to-typescript": "11.0.0",
@@ -75,8 +75,8 @@
75
75
  "glob": "7.2.3",
76
76
  "json-schema-to-ts": "3.1.1",
77
77
  "shortid": "2.2.16",
78
- "@takeshape/infra": "11.120.1",
79
- "@takeshape/logger": "11.120.1"
78
+ "@takeshape/logger": "11.121.4",
79
+ "@takeshape/infra": "11.121.4"
80
80
  },
81
81
  "engines": {
82
82
  "node": ">=22"