@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
@@ -0,0 +1,7 @@
1
+ /* tslint:disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const schema: {
3
+ readonly type: "object";
4
+ readonly properties: {
5
+ readonly messageId: {
6
+ readonly type: "string";
7
+ readonly description: "Message ID to send an abort signal for";
8
+ };
9
+ };
10
+ readonly required: ["messageId"];
11
+ readonly additionalProperties: false;
12
+ };
13
+ export type AbortAgentMessageArgs = FromSchema<typeof schema>;
14
+ export declare const validate: import("ajv").ValidateFunction<{
15
+ messageId: string;
16
+ }>;
@@ -0,0 +1,13 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ export const schema = {
3
+ type: 'object',
4
+ properties: {
5
+ messageId: {
6
+ type: 'string',
7
+ description: 'Message ID to send an abort signal for'
8
+ }
9
+ },
10
+ required: ['messageId'],
11
+ additionalProperties: false
12
+ };
13
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,26 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSAbortAgentMessageResponse";
3
+ export declare const schema: {
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly aborted: {
7
+ readonly type: "object";
8
+ readonly properties: {
9
+ readonly messageId: {
10
+ readonly type: "string";
11
+ readonly description: "The ID of the aborted deferred message";
12
+ };
13
+ };
14
+ readonly required: ["messageId"];
15
+ readonly additionalProperties: false;
16
+ };
17
+ };
18
+ readonly required: [];
19
+ readonly additionalProperties: false;
20
+ };
21
+ export type AbortAgentMessageResponse = FromSchema<typeof schema>;
22
+ export declare const validate: import("ajv").ValidateFunction<{
23
+ aborted?: {
24
+ messageId: string;
25
+ } | undefined;
26
+ }>;
@@ -0,0 +1,19 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
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;
4
+ export const schema = {
5
+ type: 'object',
6
+ properties: {
7
+ aborted: {
8
+ type: 'object',
9
+ properties: {
10
+ messageId: { type: 'string', description: 'The ID of the aborted deferred message' }
11
+ },
12
+ required: ['messageId'],
13
+ additionalProperties: false
14
+ }
15
+ },
16
+ required: [],
17
+ additionalProperties: false
18
+ };
19
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,17 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSChatArgs";
3
+ export declare const schema: {
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly input: {
7
+ readonly type: "string";
8
+ readonly description: "The chat message input from the user.";
9
+ };
10
+ };
11
+ readonly required: ["input"];
12
+ readonly additionalProperties: false;
13
+ };
14
+ export type AgentChatArgs = FromSchema<typeof schema>;
15
+ export declare const validate: import("ajv").ValidateFunction<{
16
+ input: string;
17
+ }>;
@@ -0,0 +1,15 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import { AI_AGENT_CHAT_ARGS_SHAPE_NAME } from "./constants.js";
3
+ export const shapeName = AI_AGENT_CHAT_ARGS_SHAPE_NAME;
4
+ export const schema = {
5
+ type: 'object',
6
+ properties: {
7
+ input: {
8
+ type: 'string',
9
+ description: 'The chat message input from the user.'
10
+ }
11
+ },
12
+ required: ['input'],
13
+ additionalProperties: false
14
+ };
15
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,35 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSChatPayload";
3
+ export declare const schema: {
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly content: {
7
+ readonly type: "string";
8
+ readonly description: "The string content of the chat message.";
9
+ };
10
+ readonly references: {
11
+ readonly type: "array";
12
+ readonly items: {
13
+ readonly type: "object";
14
+ readonly '@ref': "TSReference";
15
+ };
16
+ readonly description: "A list of references associated with the chat message.";
17
+ };
18
+ readonly artifact: {
19
+ readonly type: "object";
20
+ readonly description: "An optional artifact associated with the chat message.";
21
+ };
22
+ };
23
+ readonly required: ["content", "references"];
24
+ readonly additionalProperties: false;
25
+ };
26
+ export type AgentChatPayload = FromSchema<typeof schema>;
27
+ export declare const validate: import("ajv").ValidateFunction<{
28
+ artifact?: {
29
+ [x: string]: unknown;
30
+ } | undefined;
31
+ content: string;
32
+ references: {
33
+ [x: string]: unknown;
34
+ }[];
35
+ }>;
@@ -0,0 +1,27 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import { AI_AGENT_CHAT_PAYLOAD_SHAPE_NAME } from "./constants.js";
3
+ export const shapeName = AI_AGENT_CHAT_PAYLOAD_SHAPE_NAME;
4
+ export const schema = {
5
+ type: 'object',
6
+ properties: {
7
+ content: {
8
+ type: 'string',
9
+ description: 'The string content of the chat message.'
10
+ },
11
+ references: {
12
+ type: 'array',
13
+ items: {
14
+ type: 'object',
15
+ '@ref': 'TSReference'
16
+ },
17
+ description: 'A list of references associated with the chat message.'
18
+ },
19
+ artifact: {
20
+ type: 'object',
21
+ description: 'An optional artifact associated with the chat message.'
22
+ }
23
+ },
24
+ required: ['content', 'references'],
25
+ additionalProperties: false
26
+ };
27
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,136 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSChatResponse";
3
+ export declare const schema: {
4
+ readonly properties: {
5
+ readonly output: {
6
+ readonly type: "object";
7
+ readonly properties: {
8
+ readonly content: {
9
+ readonly type: "string";
10
+ readonly description: "The string content of the chat message.";
11
+ };
12
+ readonly references: {
13
+ readonly type: "array";
14
+ readonly items: {
15
+ readonly type: "object";
16
+ readonly '@ref': "TSReference";
17
+ };
18
+ readonly description: "A list of references associated with the chat message.";
19
+ };
20
+ readonly artifact: {
21
+ readonly type: "object";
22
+ readonly description: "An optional artifact associated with the chat message.";
23
+ };
24
+ };
25
+ readonly required: ["content", "references"];
26
+ readonly additionalProperties: false;
27
+ };
28
+ readonly messageId: {
29
+ readonly type: "string";
30
+ readonly description: "The unique identifier for the agent run response message.";
31
+ };
32
+ readonly session: {
33
+ readonly type: "object";
34
+ readonly properties: {
35
+ readonly id: {
36
+ readonly type: "string";
37
+ readonly description: "The unique identifier for the agent session.";
38
+ };
39
+ readonly agentName: {
40
+ readonly type: "string";
41
+ readonly description: "The name of the agent associated with this session.";
42
+ };
43
+ readonly projectId: {
44
+ readonly type: "string";
45
+ readonly description: "The ID of the project to which this agent session belongs.";
46
+ };
47
+ readonly schemaId: {
48
+ readonly type: "string";
49
+ readonly description: "The schema ID associated with the agent session, typically in the format \"production~projectId\".";
50
+ };
51
+ readonly done: {
52
+ readonly type: "boolean";
53
+ readonly description: "Indicates whether the agent session is completed.";
54
+ };
55
+ readonly suspended: {
56
+ readonly type: "boolean";
57
+ readonly description: "Indicates whether the agent session is suspended.";
58
+ };
59
+ readonly previousStateId: {
60
+ readonly type: "string";
61
+ readonly description: "The ID of the previous state in the agent session, if any.";
62
+ };
63
+ readonly currentStateId: {
64
+ readonly type: "string";
65
+ readonly description: "The ID of the current state in the agent session.";
66
+ };
67
+ readonly chatSessionIds: {
68
+ readonly type: "object";
69
+ readonly description: "A mapping of chat session IDs to their corresponding state IDs.";
70
+ };
71
+ readonly sessionMemory: {
72
+ readonly type: "object";
73
+ readonly description: "Memory associated with the agent session, which can be used to store stateful information.";
74
+ };
75
+ readonly stateOutputs: {
76
+ readonly type: "object";
77
+ readonly description: "Outputs from the states in the agent session, keyed by state ID.";
78
+ };
79
+ readonly currentValue: {
80
+ readonly type: "object";
81
+ readonly description: "The current value of the agent session, which may be updated as the session progresses.";
82
+ };
83
+ readonly hasAgentHistory: {
84
+ readonly type: "boolean";
85
+ readonly description: "Indicates whether the agent session has an associated history of agent responses.";
86
+ };
87
+ };
88
+ readonly required: ["id", "agentName", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId"];
89
+ readonly additionalProperties: false;
90
+ };
91
+ readonly runMode: {
92
+ readonly enum: ["BACKGROUND", "IMMEDIATE"];
93
+ readonly description: "Indicates how the agent message was run";
94
+ };
95
+ };
96
+ readonly additionalProperties: false;
97
+ readonly required: ["messageId", "session", "runMode", "output"];
98
+ readonly type: "object";
99
+ };
100
+ export type AgentChatResponse = FromSchema<typeof schema>;
101
+ export declare const validate: import("ajv").ValidateFunction<{
102
+ messageId: string;
103
+ output: {
104
+ artifact?: {
105
+ [x: string]: unknown;
106
+ } | undefined;
107
+ content: string;
108
+ references: {
109
+ [x: string]: unknown;
110
+ }[];
111
+ };
112
+ runMode: "BACKGROUND" | "IMMEDIATE";
113
+ session: {
114
+ suspended?: boolean | undefined;
115
+ previousStateId?: string | undefined;
116
+ currentValue?: {
117
+ [x: string]: unknown;
118
+ } | undefined;
119
+ hasAgentHistory?: boolean | undefined;
120
+ id: string;
121
+ agentName: string;
122
+ projectId: string;
123
+ schemaId: string;
124
+ done: boolean;
125
+ currentStateId: string;
126
+ chatSessionIds: {
127
+ [x: string]: unknown;
128
+ };
129
+ sessionMemory: {
130
+ [x: string]: unknown;
131
+ };
132
+ stateOutputs: {
133
+ [x: string]: unknown;
134
+ };
135
+ };
136
+ }>;
@@ -0,0 +1,17 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import * as agentChatPayload from "./agent-chat-payload.js";
3
+ import { AI_AGENT_CHAT_RESPONSE_SHAPE_NAME } from "./constants.js";
4
+ import * as sendAgentMessageResponse from "./send-agent-message-response.js";
5
+ export const shapeName = AI_AGENT_CHAT_RESPONSE_SHAPE_NAME;
6
+ export const schema = {
7
+ ...sendAgentMessageResponse.schema,
8
+ properties: {
9
+ ...sendAgentMessageResponse.schema.properties,
10
+ output: {
11
+ ...agentChatPayload.schema
12
+ }
13
+ },
14
+ additionalProperties: false,
15
+ required: [...sendAgentMessageResponse.schema.required, 'output']
16
+ };
17
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,17 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSGenerateArgs";
3
+ export declare const schema: {
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly input: {
7
+ readonly type: "string";
8
+ readonly description: "The generate message input from the user.";
9
+ };
10
+ };
11
+ readonly required: ["input"];
12
+ readonly additionalProperties: false;
13
+ };
14
+ export type AgentGenerateArgs = FromSchema<typeof schema>;
15
+ export declare const validate: import("ajv").ValidateFunction<{
16
+ input: string;
17
+ }>;
@@ -0,0 +1,15 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import { AI_AGENT_GENERATE_ARGS_SHAPE_NAME } from "./constants.js";
3
+ export const shapeName = AI_AGENT_GENERATE_ARGS_SHAPE_NAME;
4
+ export const schema = {
5
+ type: 'object',
6
+ properties: {
7
+ input: {
8
+ type: 'string',
9
+ description: 'The generate message input from the user.'
10
+ }
11
+ },
12
+ required: ['input'],
13
+ additionalProperties: false
14
+ };
15
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,84 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const schema: {
3
+ readonly $id: "https://takeshape.io/schema/agent-message-payload";
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly messageId: {
7
+ readonly type: "string";
8
+ readonly description: "ID of the message that was deferred";
9
+ };
10
+ readonly sessionId: {
11
+ readonly type: "string";
12
+ readonly description: "ID of the session this message belongs to";
13
+ };
14
+ readonly projectId: {
15
+ readonly type: "string";
16
+ readonly description: "Project ID of the project this message belongs to";
17
+ };
18
+ readonly input: {
19
+ readonly type: "object";
20
+ };
21
+ readonly output: {
22
+ readonly type: "object";
23
+ };
24
+ readonly error: {
25
+ readonly type: "object";
26
+ readonly properties: {
27
+ readonly message: {
28
+ readonly type: "string";
29
+ };
30
+ readonly name: {
31
+ readonly type: "string";
32
+ };
33
+ readonly code: {
34
+ readonly type: "string";
35
+ };
36
+ };
37
+ readonly additionalProperties: false;
38
+ };
39
+ readonly runMode: {
40
+ readonly enum: ["BACKGROUND", "IMMEDIATE"];
41
+ readonly description: "Indicates how the agent message was run";
42
+ };
43
+ readonly abortedAt: {
44
+ readonly type: "number";
45
+ readonly description: "Timestamp when the message was aborted";
46
+ };
47
+ readonly sentAt: {
48
+ readonly type: "number";
49
+ readonly description: "Timestamp when the message was sent";
50
+ };
51
+ readonly startedAt: {
52
+ readonly type: "number";
53
+ readonly description: "Timestamp when the message started processing";
54
+ };
55
+ readonly finishedAt: {
56
+ readonly type: "number";
57
+ readonly description: "Timestamp when the message finished processing";
58
+ };
59
+ };
60
+ readonly required: ["messageId", "sessionId", "projectId", "runMode"];
61
+ readonly additionalProperties: false;
62
+ };
63
+ export type AgentMessagePayload = FromSchema<typeof schema>;
64
+ export declare const validate: import("ajv").ValidateFunction<{
65
+ input?: {
66
+ [x: string]: unknown;
67
+ } | undefined;
68
+ output?: {
69
+ [x: string]: unknown;
70
+ } | undefined;
71
+ error?: {
72
+ message?: string | undefined;
73
+ name?: string | undefined;
74
+ code?: string | undefined;
75
+ } | undefined;
76
+ abortedAt?: number | undefined;
77
+ sentAt?: number | undefined;
78
+ startedAt?: number | undefined;
79
+ finishedAt?: number | undefined;
80
+ messageId: string;
81
+ projectId: string;
82
+ sessionId: string;
83
+ runMode: "BACKGROUND" | "IMMEDIATE";
84
+ }>;
@@ -0,0 +1,57 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ export const schema = {
3
+ $id: 'https://takeshape.io/schema/agent-message-payload',
4
+ type: 'object',
5
+ properties: {
6
+ messageId: {
7
+ type: 'string',
8
+ description: 'ID of the message that was deferred'
9
+ },
10
+ sessionId: {
11
+ type: 'string',
12
+ description: 'ID of the session this message belongs to'
13
+ },
14
+ projectId: {
15
+ type: 'string',
16
+ description: 'Project ID of the project this message belongs to'
17
+ },
18
+ input: {
19
+ type: 'object'
20
+ },
21
+ output: {
22
+ type: 'object'
23
+ },
24
+ error: {
25
+ type: 'object',
26
+ properties: {
27
+ message: { type: 'string' },
28
+ name: { type: 'string' },
29
+ code: { type: 'string' }
30
+ },
31
+ additionalProperties: false
32
+ },
33
+ runMode: {
34
+ enum: ['BACKGROUND', 'IMMEDIATE'],
35
+ description: 'Indicates how the agent message was run'
36
+ },
37
+ abortedAt: {
38
+ type: 'number',
39
+ description: 'Timestamp when the message was aborted'
40
+ },
41
+ sentAt: {
42
+ type: 'number',
43
+ description: 'Timestamp when the message was sent'
44
+ },
45
+ startedAt: {
46
+ type: 'number',
47
+ description: 'Timestamp when the message started processing'
48
+ },
49
+ finishedAt: {
50
+ type: 'number',
51
+ description: 'Timestamp when the message finished processing'
52
+ }
53
+ },
54
+ required: ['messageId', 'sessionId', 'projectId', 'runMode'],
55
+ additionalProperties: false
56
+ };
57
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,7 @@
1
+ import type { FromSchema } from 'json-schema-to-ts';
2
+ export declare const shapeName = "TSAgentRunMode";
3
+ export declare const schema: {
4
+ readonly enum: ["ALLOW_BACKGROUND", "BACKGROUND", "IMMEDIATE"];
5
+ };
6
+ export type AgentRunMode = FromSchema<typeof schema>;
7
+ export declare const validate: import("ajv").ValidateFunction<"BACKGROUND" | "IMMEDIATE" | "ALLOW_BACKGROUND">;
@@ -0,0 +1,10 @@
1
+ import { createTypedValidator } from '@takeshape/json-schema';
2
+ import { AI_AGENT_RUN_MODE_SHAPE_NAME } from "./constants.js";
3
+ const runModes = ['ALLOW_BACKGROUND', 'BACKGROUND', 'IMMEDIATE'];
4
+ export const shapeName = AI_AGENT_RUN_MODE_SHAPE_NAME;
5
+ export const schema = {
6
+ enum: [...runModes]
7
+ // description:
8
+ // 'The mode in which the agent should run. "ALLOW_BACKGROUND" allows runs that would timeout to run longer in the background, "BACKGROUND" only runs in the background and results will need to be polled for. "IMMEDIATE" runs immediately and will timeout if it takes too long.'
9
+ };
10
+ export const validate = createTypedValidator(schema);
@@ -0,0 +1,67 @@
1
+ import type { AgentSessionValue, AgentSessionValueOutput } from '@takeshape/util';
2
+ import type { FromSchema } from 'json-schema-to-ts';
3
+ export declare const schema: {
4
+ readonly type: "object";
5
+ readonly properties: {
6
+ readonly id: {
7
+ readonly type: "string";
8
+ readonly description: "The unique identifier for the agent session.";
9
+ };
10
+ readonly agentName: {
11
+ readonly type: "string";
12
+ readonly description: "The name of the agent associated with this session.";
13
+ };
14
+ readonly projectId: {
15
+ readonly type: "string";
16
+ readonly description: "The ID of the project to which this agent session belongs.";
17
+ };
18
+ readonly schemaId: {
19
+ readonly type: "string";
20
+ readonly description: "The schema ID associated with the agent session, typically in the format \"production~projectId\".";
21
+ };
22
+ readonly done: {
23
+ readonly type: "boolean";
24
+ readonly description: "Indicates whether the agent session is completed.";
25
+ };
26
+ readonly suspended: {
27
+ readonly type: "boolean";
28
+ readonly description: "Indicates whether the agent session is suspended.";
29
+ };
30
+ readonly previousStateId: {
31
+ readonly type: "string";
32
+ readonly description: "The ID of the previous state in the agent session, if any.";
33
+ };
34
+ readonly currentStateId: {
35
+ readonly type: "string";
36
+ readonly description: "The ID of the current state in the agent session.";
37
+ };
38
+ readonly chatSessionIds: {
39
+ readonly type: "object";
40
+ readonly description: "A mapping of chat session IDs to their corresponding state IDs.";
41
+ };
42
+ readonly sessionMemory: {
43
+ readonly type: "object";
44
+ readonly description: "Memory associated with the agent session, which can be used to store stateful information.";
45
+ };
46
+ readonly stateOutputs: {
47
+ readonly type: "object";
48
+ readonly description: "Outputs from the states in the agent session, keyed by state ID.";
49
+ };
50
+ readonly currentValue: {
51
+ readonly type: "object";
52
+ readonly description: "The current value of the agent session, which may be updated as the session progresses.";
53
+ };
54
+ readonly hasAgentHistory: {
55
+ readonly type: "boolean";
56
+ readonly description: "Indicates whether the agent session has an associated history of agent responses.";
57
+ };
58
+ };
59
+ readonly required: ["id", "agentName", "done", "currentStateId", "chatSessionIds", "sessionMemory", "stateOutputs", "projectId", "schemaId"];
60
+ readonly additionalProperties: false;
61
+ };
62
+ export type AgentSessionPayload = FromSchema<typeof schema> & {
63
+ stateOutputs: Record<string, AgentSessionValueOutput | undefined>;
64
+ suspended?: boolean;
65
+ currentValue?: AgentSessionValue;
66
+ };
67
+ export declare const validate: import("ajv").ValidateFunction<AgentSessionPayload>;