@copilotkit/runtime-client-gql 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/.turbo/turbo-build.log +82 -0
  2. package/codegen.ts +22 -0
  3. package/dist/chunk-2EWRNIRK.mjs +16 -0
  4. package/dist/chunk-2EWRNIRK.mjs.map +1 -0
  5. package/dist/chunk-4RLWPF2O.mjs +34 -0
  6. package/dist/chunk-4RLWPF2O.mjs.map +1 -0
  7. package/dist/chunk-7ECCT6PK.mjs +1 -0
  8. package/dist/chunk-7ECCT6PK.mjs.map +1 -0
  9. package/dist/chunk-EF6Z5BI6.mjs +55 -0
  10. package/dist/chunk-EF6Z5BI6.mjs.map +1 -0
  11. package/dist/chunk-KK4MQSI3.mjs +24 -0
  12. package/dist/chunk-KK4MQSI3.mjs.map +1 -0
  13. package/dist/chunk-LAQOU7XH.mjs +63 -0
  14. package/dist/chunk-LAQOU7XH.mjs.map +1 -0
  15. package/dist/chunk-QBSZIZYP.mjs +34 -0
  16. package/dist/chunk-QBSZIZYP.mjs.map +1 -0
  17. package/dist/chunk-U2R23IMV.mjs +89 -0
  18. package/dist/chunk-U2R23IMV.mjs.map +1 -0
  19. package/dist/client/CopilotRuntimeClient.d.ts +21 -0
  20. package/dist/client/CopilotRuntimeClient.js +122 -0
  21. package/dist/client/CopilotRuntimeClient.js.map +1 -0
  22. package/dist/client/CopilotRuntimeClient.mjs +10 -0
  23. package/dist/client/CopilotRuntimeClient.mjs.map +1 -0
  24. package/dist/client/conversion.d.ts +8 -0
  25. package/dist/client/conversion.js +162 -0
  26. package/dist/client/conversion.js.map +1 -0
  27. package/dist/client/conversion.mjs +11 -0
  28. package/dist/client/conversion.mjs.map +1 -0
  29. package/dist/client/index.d.ts +7 -0
  30. package/dist/client/index.js +275 -0
  31. package/dist/client/index.js.map +1 -0
  32. package/dist/client/index.mjs +29 -0
  33. package/dist/client/index.mjs.map +1 -0
  34. package/dist/client/types.d.ts +37 -0
  35. package/dist/client/types.js +89 -0
  36. package/dist/client/types.js.map +1 -0
  37. package/dist/client/types.mjs +16 -0
  38. package/dist/client/types.mjs.map +1 -0
  39. package/dist/graphql/@generated/fragment-masking.d.ts +18 -0
  40. package/dist/graphql/@generated/fragment-masking.js +50 -0
  41. package/dist/graphql/@generated/fragment-masking.js.map +1 -0
  42. package/dist/graphql/@generated/fragment-masking.mjs +11 -0
  43. package/dist/graphql/@generated/fragment-masking.mjs.map +1 -0
  44. package/dist/graphql/@generated/gql.d.ts +39 -0
  45. package/dist/graphql/@generated/gql.js +41 -0
  46. package/dist/graphql/@generated/gql.js.map +1 -0
  47. package/dist/graphql/@generated/gql.mjs +8 -0
  48. package/dist/graphql/@generated/gql.mjs.map +1 -0
  49. package/dist/graphql/@generated/graphql.d.ts +293 -0
  50. package/dist/graphql/@generated/graphql.js +62 -0
  51. package/dist/graphql/@generated/graphql.js.map +1 -0
  52. package/dist/graphql/@generated/graphql.mjs +15 -0
  53. package/dist/graphql/@generated/graphql.mjs.map +1 -0
  54. package/dist/graphql/@generated/index.d.ts +4 -0
  55. package/dist/graphql/@generated/index.js +65 -0
  56. package/dist/graphql/@generated/index.js.map +1 -0
  57. package/dist/graphql/@generated/index.mjs +16 -0
  58. package/dist/graphql/@generated/index.mjs.map +1 -0
  59. package/dist/graphql/definitions/mutations.d.ts +9 -0
  60. package/dist/graphql/definitions/mutations.js +96 -0
  61. package/dist/graphql/definitions/mutations.js.map +1 -0
  62. package/dist/graphql/definitions/mutations.mjs +9 -0
  63. package/dist/graphql/definitions/mutations.mjs.map +1 -0
  64. package/dist/index.d.ts +7 -0
  65. package/dist/index.js +302 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/index.mjs +40 -0
  68. package/dist/index.mjs.map +1 -0
  69. package/jest.config.js +5 -0
  70. package/package.json +62 -0
  71. package/src/client/CopilotRuntimeClient.ts +46 -0
  72. package/src/client/conversion.ts +89 -0
  73. package/src/client/index.ts +3 -0
  74. package/src/client/types.ts +88 -0
  75. package/src/graphql/@generated/fragment-masking.ts +67 -0
  76. package/src/graphql/@generated/gql.ts +42 -0
  77. package/src/graphql/@generated/graphql.ts +214 -0
  78. package/src/graphql/@generated/index.ts +2 -0
  79. package/src/graphql/definitions/mutations.ts +52 -0
  80. package/src/index.ts +2 -0
  81. package/tsconfig.json +15 -0
  82. package/tsup.config.ts +16 -0
  83. package/typedoc.json +4 -0
@@ -0,0 +1,88 @@
1
+ import { nanoid } from "nanoid";
2
+ import {
3
+ ActionExecutionMessageInput,
4
+ MessageRole,
5
+ MessageStatus,
6
+ ResultMessageInput,
7
+ TextMessageInput,
8
+ BaseMessageOutput,
9
+ MessageStatusCode,
10
+ } from "../graphql/@generated/graphql";
11
+
12
+ export class Message {
13
+ id: BaseMessageOutput["id"];
14
+ createdAt: BaseMessageOutput["createdAt"];
15
+ status: MessageStatus;
16
+
17
+ constructor(props: any) {
18
+ props.id ??= nanoid();
19
+ props.status ??= { code: MessageStatusCode.Success };
20
+ props.createdAt ??= new Date();
21
+ Object.assign(this, props);
22
+ }
23
+ }
24
+
25
+ // alias Role to MessageRole
26
+ export const Role = MessageRole;
27
+
28
+ // when constructing any message, the base fields are optional
29
+ type MessageConstructorOptions = Partial<Message>;
30
+
31
+ type TextMessageConstructorOptions = MessageConstructorOptions & TextMessageInput;
32
+
33
+ export class TextMessage extends Message implements TextMessageConstructorOptions {
34
+ role: TextMessageInput["role"];
35
+ content: TextMessageInput["content"];
36
+
37
+ constructor(props: TextMessageConstructorOptions) {
38
+ super(props);
39
+ }
40
+ }
41
+
42
+ type ActionExecutionMessageConstructorOptions = MessageConstructorOptions &
43
+ Omit<ActionExecutionMessageInput, "arguments"> & {
44
+ arguments: Record<string, any>;
45
+ };
46
+
47
+ export class ActionExecutionMessage
48
+ extends Message
49
+ implements Omit<ActionExecutionMessageInput, "arguments">
50
+ {
51
+ name: ActionExecutionMessageInput["name"];
52
+ arguments: Record<string, any>;
53
+ scope: ActionExecutionMessageInput["scope"];
54
+
55
+ constructor(props: ActionExecutionMessageConstructorOptions) {
56
+ super(props);
57
+ }
58
+ }
59
+
60
+ type ResultMessageConstructorOptions = MessageConstructorOptions & ResultMessageInput;
61
+
62
+ export class ResultMessage extends Message implements ResultMessageConstructorOptions {
63
+ actionExecutionId: ResultMessageInput["actionExecutionId"];
64
+ actionName: ResultMessageInput["actionName"];
65
+ result: ResultMessageInput["result"];
66
+
67
+ constructor(props: ResultMessageConstructorOptions) {
68
+ super(props);
69
+ }
70
+
71
+ static decodeResult(result: string): any {
72
+ try {
73
+ return JSON.parse(result);
74
+ } catch (e) {
75
+ return result;
76
+ }
77
+ }
78
+
79
+ static encodeResult(result: any): string {
80
+ if (result === undefined) {
81
+ return "";
82
+ } else if (typeof result === "string") {
83
+ return result;
84
+ } else {
85
+ return JSON.stringify(result);
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,67 @@
1
+ /* eslint-disable */
2
+ import type { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
3
+ import type { FragmentDefinitionNode } from 'graphql';
4
+ import type { Incremental } from './graphql';
5
+
6
+
7
+ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<
8
+ infer TType,
9
+ any
10
+ >
11
+ ? [TType] extends [{ ' $fragmentName'?: infer TKey }]
12
+ ? TKey extends string
13
+ ? { ' $fragmentRefs'?: { [key in TKey]: TType } }
14
+ : never
15
+ : never
16
+ : never;
17
+
18
+ // return non-nullable if `fragmentType` is non-nullable
19
+ export function useFragment<TType>(
20
+ _documentNode: DocumentTypeDecoration<TType, any>,
21
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
22
+ ): TType;
23
+ // return nullable if `fragmentType` is nullable
24
+ export function useFragment<TType>(
25
+ _documentNode: DocumentTypeDecoration<TType, any>,
26
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
27
+ ): TType | null | undefined;
28
+ // return array of non-nullable if `fragmentType` is array of non-nullable
29
+ export function useFragment<TType>(
30
+ _documentNode: DocumentTypeDecoration<TType, any>,
31
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
32
+ ): ReadonlyArray<TType>;
33
+ // return array of nullable if `fragmentType` is array of nullable
34
+ export function useFragment<TType>(
35
+ _documentNode: DocumentTypeDecoration<TType, any>,
36
+ fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
37
+ ): ReadonlyArray<TType> | null | undefined;
38
+ export function useFragment<TType>(
39
+ _documentNode: DocumentTypeDecoration<TType, any>,
40
+ fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
41
+ ): TType | ReadonlyArray<TType> | null | undefined {
42
+ return fragmentType as any;
43
+ }
44
+
45
+
46
+ export function makeFragmentData<
47
+ F extends DocumentTypeDecoration<any, any>,
48
+ FT extends ResultOf<F>
49
+ >(data: FT, _fragment: F): FragmentType<F> {
50
+ return data as FragmentType<F>;
51
+ }
52
+ export function isFragmentReady<TQuery, TFrag>(
53
+ queryNode: DocumentTypeDecoration<TQuery, any>,
54
+ fragmentNode: TypedDocumentNode<TFrag>,
55
+ data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined
56
+ ): data is FragmentType<typeof fragmentNode> {
57
+ const deferredFields = (queryNode as { __meta__?: { deferredFields: Record<string, (keyof TFrag)[]> } }).__meta__
58
+ ?.deferredFields;
59
+
60
+ if (!deferredFields) return true;
61
+
62
+ const fragDef = fragmentNode.definitions[0] as FragmentDefinitionNode | undefined;
63
+ const fragName = fragDef?.name?.value;
64
+
65
+ const fields = (fragName && deferredFields[fragName]) || [];
66
+ return fields.length > 0 && fields.every(field => data && field in data);
67
+ }
@@ -0,0 +1,42 @@
1
+ /* eslint-disable */
2
+ import * as types from './graphql';
3
+ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
4
+
5
+ /**
6
+ * Map of all GraphQL operations in the project.
7
+ *
8
+ * This map has several performance disadvantages:
9
+ * 1. It is not tree-shakeable, so it will include all operations in the project.
10
+ * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
11
+ * 3. It does not support dead code elimination, so it will add unused operations.
12
+ *
13
+ * Therefore it is highly recommended to use the babel or swc plugin for production.
14
+ */
15
+ const documents = {
16
+ "\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\n ... on CopilotResponse @defer {\n status {\n ... on BaseResponseStatus {\n code\n }\n }\n }\n messages @stream {\n __typename\n ... on BaseMessageOutput {\n id\n createdAt\n }\n ... on BaseMessageOutput @defer {\n status {\n ... on SuccessMessageStatus {\n code\n }\n ... on FailedMessageStatus {\n code\n reason\n }\n ... on PendingMessageStatus {\n code\n }\n }\n }\n ... on TextMessageOutput {\n content @stream\n role\n }\n ... on ActionExecutionMessageOutput {\n name\n scope\n arguments @stream\n }\n ... on ResultMessageOutput {\n result\n actionExecutionId\n actionName\n }\n }\n }\n }\n": types.GenerateCopilotResponseDocument,
17
+ };
18
+
19
+ /**
20
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
21
+ *
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
26
+ * ```
27
+ *
28
+ * The query argument is unknown!
29
+ * Please regenerate the types.
30
+ */
31
+ export function graphql(source: string): unknown;
32
+
33
+ /**
34
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
35
+ */
36
+ export function graphql(source: "\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\n ... on CopilotResponse @defer {\n status {\n ... on BaseResponseStatus {\n code\n }\n }\n }\n messages @stream {\n __typename\n ... on BaseMessageOutput {\n id\n createdAt\n }\n ... on BaseMessageOutput @defer {\n status {\n ... on SuccessMessageStatus {\n code\n }\n ... on FailedMessageStatus {\n code\n reason\n }\n ... on PendingMessageStatus {\n code\n }\n }\n }\n ... on TextMessageOutput {\n content @stream\n role\n }\n ... on ActionExecutionMessageOutput {\n name\n scope\n arguments @stream\n }\n ... on ResultMessageOutput {\n result\n actionExecutionId\n actionName\n }\n }\n }\n }\n"): (typeof documents)["\n mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {\n generateCopilotResponse(data: $data, properties: $properties) {\n threadId\n runId\n ... on CopilotResponse @defer {\n status {\n ... on BaseResponseStatus {\n code\n }\n }\n }\n messages @stream {\n __typename\n ... on BaseMessageOutput {\n id\n createdAt\n }\n ... on BaseMessageOutput @defer {\n status {\n ... on SuccessMessageStatus {\n code\n }\n ... on FailedMessageStatus {\n code\n reason\n }\n ... on PendingMessageStatus {\n code\n }\n }\n }\n ... on TextMessageOutput {\n content @stream\n role\n }\n ... on ActionExecutionMessageOutput {\n name\n scope\n arguments @stream\n }\n ... on ResultMessageOutput {\n result\n actionExecutionId\n actionName\n }\n }\n }\n }\n"];
37
+
38
+ export function graphql(source: string) {
39
+ return (documents as any)[source] ?? {};
40
+ }
41
+
42
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode< infer TType, any> ? TType : never;
@@ -0,0 +1,214 @@
1
+ /* eslint-disable */
2
+ import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
+ export type Maybe<T> = T | null;
4
+ export type InputMaybe<T> = Maybe<T>;
5
+ export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
6
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
7
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
8
+ export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
9
+ export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
10
+ /** All built-in and custom scalars, mapped to their actual values */
11
+ export type Scalars = {
12
+ ID: { input: string; output: string; }
13
+ String: { input: string; output: string; }
14
+ Boolean: { input: boolean; output: boolean; }
15
+ Int: { input: number; output: number; }
16
+ Float: { input: number; output: number; }
17
+ /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.This scalar is serialized to a string in ISO 8601 format and parsed from a string in ISO 8601 format. */
18
+ DateTimeISO: { input: any; output: any; }
19
+ /** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
20
+ JSONObject: { input: any; output: any; }
21
+ };
22
+
23
+ export type ActionExecutionMessageInput = {
24
+ arguments: Scalars['String']['input'];
25
+ name: Scalars['String']['input'];
26
+ scope: ActionExecutionScope;
27
+ };
28
+
29
+ export type ActionExecutionMessageOutput = BaseMessageOutput & {
30
+ __typename?: 'ActionExecutionMessageOutput';
31
+ arguments: Array<Scalars['String']['output']>;
32
+ createdAt: Scalars['DateTimeISO']['output'];
33
+ id: Scalars['String']['output'];
34
+ name: Scalars['String']['output'];
35
+ scope: ActionExecutionScope;
36
+ status: MessageStatus;
37
+ };
38
+
39
+ /** The scope of the action */
40
+ export enum ActionExecutionScope {
41
+ Client = 'client',
42
+ Server = 'server'
43
+ }
44
+
45
+ export type ActionInput = {
46
+ description: Scalars['String']['input'];
47
+ jsonSchema: Scalars['String']['input'];
48
+ name: Scalars['String']['input'];
49
+ };
50
+
51
+ export type BaseMessageOutput = {
52
+ createdAt: Scalars['DateTimeISO']['output'];
53
+ id: Scalars['String']['output'];
54
+ status: MessageStatus;
55
+ };
56
+
57
+ export type BaseResponseStatus = {
58
+ code: ResponseStatusCode;
59
+ };
60
+
61
+ export type CloudInput = {
62
+ guardrails: GuardrailsInput;
63
+ };
64
+
65
+ export type CopilotResponse = {
66
+ __typename?: 'CopilotResponse';
67
+ messages: Array<BaseMessageOutput>;
68
+ runId?: Maybe<Scalars['String']['output']>;
69
+ status: ResponseStatus;
70
+ threadId: Scalars['String']['output'];
71
+ };
72
+
73
+ export type FailedMessageStatus = {
74
+ __typename?: 'FailedMessageStatus';
75
+ code: MessageStatusCode;
76
+ reason: Scalars['String']['output'];
77
+ };
78
+
79
+ export type FailedResponseStatus = BaseResponseStatus & {
80
+ __typename?: 'FailedResponseStatus';
81
+ code: ResponseStatusCode;
82
+ reason: Scalars['String']['output'];
83
+ };
84
+
85
+ export type FrontendInput = {
86
+ actions: Array<ActionInput>;
87
+ toDeprecate_fullContext?: InputMaybe<Scalars['String']['input']>;
88
+ };
89
+
90
+ export type GenerateCopilotResponseInput = {
91
+ cloud?: InputMaybe<CloudInput>;
92
+ frontend: FrontendInput;
93
+ messages: Array<MessageInput>;
94
+ runId?: InputMaybe<Scalars['String']['input']>;
95
+ threadId?: InputMaybe<Scalars['String']['input']>;
96
+ };
97
+
98
+ export type GuardrailsInput = {
99
+ inputValidationRules?: InputMaybe<Array<GuardrailsRuleInput>>;
100
+ };
101
+
102
+ export type GuardrailsRuleInput = {
103
+ allowList?: InputMaybe<Array<Scalars['String']['input']>>;
104
+ denyList?: InputMaybe<Array<Scalars['String']['input']>>;
105
+ id: Scalars['String']['input'];
106
+ };
107
+
108
+ export type MessageInput = {
109
+ actionExecutionMessage?: InputMaybe<ActionExecutionMessageInput>;
110
+ createdAt: Scalars['DateTimeISO']['input'];
111
+ id: Scalars['String']['input'];
112
+ resultMessage?: InputMaybe<ResultMessageInput>;
113
+ textMessage?: InputMaybe<TextMessageInput>;
114
+ };
115
+
116
+ /** The role of the message */
117
+ export enum MessageRole {
118
+ Assistant = 'assistant',
119
+ System = 'system',
120
+ User = 'user'
121
+ }
122
+
123
+ export type MessageStatus = FailedMessageStatus | PendingMessageStatus | SuccessMessageStatus;
124
+
125
+ export enum MessageStatusCode {
126
+ Failed = 'Failed',
127
+ Pending = 'Pending',
128
+ Success = 'Success'
129
+ }
130
+
131
+ export type Mutation = {
132
+ __typename?: 'Mutation';
133
+ generateCopilotResponse: CopilotResponse;
134
+ };
135
+
136
+
137
+ export type MutationGenerateCopilotResponseArgs = {
138
+ data: GenerateCopilotResponseInput;
139
+ properties?: InputMaybe<Scalars['JSONObject']['input']>;
140
+ };
141
+
142
+ export type PendingMessageStatus = {
143
+ __typename?: 'PendingMessageStatus';
144
+ code: MessageStatusCode;
145
+ };
146
+
147
+ export type PendingResponseStatus = BaseResponseStatus & {
148
+ __typename?: 'PendingResponseStatus';
149
+ code: ResponseStatusCode;
150
+ };
151
+
152
+ export type Query = {
153
+ __typename?: 'Query';
154
+ hello: Scalars['String']['output'];
155
+ };
156
+
157
+ export type ResponseStatus = FailedResponseStatus | PendingResponseStatus | SuccessResponseStatus;
158
+
159
+ export enum ResponseStatusCode {
160
+ Failed = 'Failed',
161
+ Pending = 'Pending',
162
+ Success = 'Success'
163
+ }
164
+
165
+ export type ResultMessageInput = {
166
+ actionExecutionId: Scalars['String']['input'];
167
+ actionName: Scalars['String']['input'];
168
+ result: Scalars['String']['input'];
169
+ };
170
+
171
+ export type ResultMessageOutput = BaseMessageOutput & {
172
+ __typename?: 'ResultMessageOutput';
173
+ actionExecutionId: Scalars['String']['output'];
174
+ actionName: Scalars['String']['output'];
175
+ createdAt: Scalars['DateTimeISO']['output'];
176
+ id: Scalars['String']['output'];
177
+ result: Scalars['String']['output'];
178
+ status: MessageStatus;
179
+ };
180
+
181
+ export type SuccessMessageStatus = {
182
+ __typename?: 'SuccessMessageStatus';
183
+ code: MessageStatusCode;
184
+ };
185
+
186
+ export type SuccessResponseStatus = BaseResponseStatus & {
187
+ __typename?: 'SuccessResponseStatus';
188
+ code: ResponseStatusCode;
189
+ };
190
+
191
+ export type TextMessageInput = {
192
+ content: Scalars['String']['input'];
193
+ role: MessageRole;
194
+ };
195
+
196
+ export type TextMessageOutput = BaseMessageOutput & {
197
+ __typename?: 'TextMessageOutput';
198
+ content: Array<Scalars['String']['output']>;
199
+ createdAt: Scalars['DateTimeISO']['output'];
200
+ id: Scalars['String']['output'];
201
+ role: MessageRole;
202
+ status: MessageStatus;
203
+ };
204
+
205
+ export type GenerateCopilotResponseMutationVariables = Exact<{
206
+ data: GenerateCopilotResponseInput;
207
+ properties?: InputMaybe<Scalars['JSONObject']['input']>;
208
+ }>;
209
+
210
+
211
+ export type GenerateCopilotResponseMutation = { __typename?: 'Mutation', generateCopilotResponse: { __typename?: 'CopilotResponse', threadId: string, runId?: string | null, messages: Array<{ __typename: 'ActionExecutionMessageOutput', id: string, createdAt: any, name: string, scope: ActionExecutionScope, arguments: Array<string>, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'ResultMessageOutput', id: string, createdAt: any, result: string, actionExecutionId: string, actionName: string, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } } | { __typename: 'TextMessageOutput', id: string, createdAt: any, content: Array<string>, role: MessageRole, status: { __typename?: 'FailedMessageStatus', code: MessageStatusCode, reason: string } | { __typename?: 'PendingMessageStatus', code: MessageStatusCode } | { __typename?: 'SuccessMessageStatus', code: MessageStatusCode } }> } & ({ __typename?: 'CopilotResponse', status: { __typename?: 'FailedResponseStatus', code: ResponseStatusCode } | { __typename?: 'PendingResponseStatus', code: ResponseStatusCode } | { __typename?: 'SuccessResponseStatus', code: ResponseStatusCode } } | { __typename?: 'CopilotResponse', status?: never }) };
212
+
213
+
214
+ export const GenerateCopilotResponseDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"generateCopilotResponse"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"data"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"GenerateCopilotResponseInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"properties"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSONObject"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"generateCopilotResponse"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"data"}}},{"kind":"Argument","name":{"kind":"Name","value":"properties"},"value":{"kind":"Variable","name":{"kind":"Name","value":"properties"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"runId"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CopilotResponse"}},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BaseResponseStatus"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"stream"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BaseMessageOutput"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"BaseMessageOutput"}},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"defer"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SuccessMessageStatus"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FailedMessageStatus"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PendingMessageStatus"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TextMessageOutput"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"content"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"stream"}}]},{"kind":"Field","name":{"kind":"Name","value":"role"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ActionExecutionMessageOutput"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}},{"kind":"Field","name":{"kind":"Name","value":"arguments"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"stream"}}]}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ResultMessageOutput"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"actionExecutionId"}},{"kind":"Field","name":{"kind":"Name","value":"actionName"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GenerateCopilotResponseMutation, GenerateCopilotResponseMutationVariables>;
@@ -0,0 +1,2 @@
1
+ export * from "./fragment-masking";
2
+ export * from "./gql";
@@ -0,0 +1,52 @@
1
+ import { graphql } from "../@generated/gql";
2
+
3
+ export const generateCopilotResponseMutation = graphql(/** GraphQL **/ `
4
+ mutation generateCopilotResponse($data: GenerateCopilotResponseInput!, $properties: JSONObject) {
5
+ generateCopilotResponse(data: $data, properties: $properties) {
6
+ threadId
7
+ runId
8
+ ... on CopilotResponse @defer {
9
+ status {
10
+ ... on BaseResponseStatus {
11
+ code
12
+ }
13
+ }
14
+ }
15
+ messages @stream {
16
+ __typename
17
+ ... on BaseMessageOutput {
18
+ id
19
+ createdAt
20
+ }
21
+ ... on BaseMessageOutput @defer {
22
+ status {
23
+ ... on SuccessMessageStatus {
24
+ code
25
+ }
26
+ ... on FailedMessageStatus {
27
+ code
28
+ reason
29
+ }
30
+ ... on PendingMessageStatus {
31
+ code
32
+ }
33
+ }
34
+ }
35
+ ... on TextMessageOutput {
36
+ content @stream
37
+ role
38
+ }
39
+ ... on ActionExecutionMessageOutput {
40
+ name
41
+ scope
42
+ arguments @stream
43
+ }
44
+ ... on ResultMessageOutput {
45
+ result
46
+ actionExecutionId
47
+ actionName
48
+ }
49
+ }
50
+ }
51
+ }
52
+ `);
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./client";
2
+ export * from "./graphql/@generated/graphql";
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "../tsconfig/base.json",
3
+ "compilerOptions": {
4
+ "strictPropertyInitialization": false
5
+ },
6
+ "include": ["."],
7
+ "exclude": [
8
+ "dist",
9
+ "build",
10
+ "node_modules",
11
+ "**/*.test.ts",
12
+ "**/*.test.tsx",
13
+ "**/__tests__/*"
14
+ ]
15
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { defineConfig, Options } from "tsup";
2
+
3
+ export default defineConfig((options: Options) => ({
4
+ entry: ["src/**/*.{ts,tsx}"],
5
+ format: ["esm", "cjs"],
6
+ dts: true,
7
+ minify: false,
8
+ external: ["react"],
9
+ sourcemap: true,
10
+ exclude: [
11
+ "**/*.test.ts", // Exclude TypeScript test files
12
+ "**/*.test.tsx", // Exclude TypeScript React test files
13
+ "**/__tests__/*", // Exclude any files inside a __tests__ directory
14
+ ],
15
+ ...options,
16
+ }));
package/typedoc.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": ["../../typedoc.base.json"],
3
+ "entryPoints": ["src/index.tsx"]
4
+ }