@gleanwork/api-client 0.17.2 → 0.17.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.
- package/dist/commonjs/__tests__/messages.test.js +1 -1
- package/dist/commonjs/__tests__/messages.test.js.map +1 -1
- package/dist/commonjs/__tests__/search.test.js +0 -4
- package/dist/commonjs/__tests__/search.test.js.map +1 -1
- package/dist/commonjs/__tests__/summarize.test.js +2 -4
- package/dist/commonjs/__tests__/summarize.test.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/http.d.ts +1 -1
- package/dist/commonjs/lib/http.d.ts.map +1 -1
- package/dist/commonjs/lib/http.js +1 -1
- package/dist/commonjs/lib/http.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts +5 -4
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +6 -7
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/models/components/actionpreview.d.ts +28 -0
- package/dist/commonjs/models/components/actionpreview.d.ts.map +1 -0
- package/dist/commonjs/models/components/actionpreview.js +61 -0
- package/dist/commonjs/models/components/actionpreview.js.map +1 -0
- package/dist/commonjs/models/components/authcontext.d.ts +25 -0
- package/dist/commonjs/models/components/authcontext.d.ts.map +1 -0
- package/dist/commonjs/models/components/authcontext.js +59 -0
- package/dist/commonjs/models/components/authcontext.js.map +1 -0
- package/dist/commonjs/models/components/chatmessagefragment.d.ts +23 -0
- package/dist/commonjs/models/components/chatmessagefragment.d.ts.map +1 -1
- package/dist/commonjs/models/components/chatmessagefragment.js +6 -0
- package/dist/commonjs/models/components/chatmessagefragment.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +4 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +4 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/listentitiesrequest.d.ts +4 -4
- package/dist/commonjs/models/components/listentitiesrequest.d.ts.map +1 -1
- package/dist/commonjs/models/components/listentitiesrequest.js +4 -5
- package/dist/commonjs/models/components/listentitiesrequest.js.map +1 -1
- package/dist/commonjs/models/components/servertoolrequest.d.ts +75 -0
- package/dist/commonjs/models/components/servertoolrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/servertoolrequest.js +92 -0
- package/dist/commonjs/models/components/servertoolrequest.js.map +1 -0
- package/dist/commonjs/models/components/servertoolresponse.d.ts +117 -0
- package/dist/commonjs/models/components/servertoolresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/servertoolresponse.js +113 -0
- package/dist/commonjs/models/components/servertoolresponse.js.map +1 -0
- package/dist/esm/__tests__/messages.test.js +1 -1
- package/dist/esm/__tests__/messages.test.js.map +1 -1
- package/dist/esm/__tests__/search.test.js +0 -4
- package/dist/esm/__tests__/search.test.js.map +1 -1
- package/dist/esm/__tests__/summarize.test.js +2 -4
- package/dist/esm/__tests__/summarize.test.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/http.d.ts +1 -1
- package/dist/esm/lib/http.d.ts.map +1 -1
- package/dist/esm/lib/http.js +1 -1
- package/dist/esm/lib/http.js.map +1 -1
- package/dist/esm/lib/security.d.ts +5 -4
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +4 -5
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/models/components/actionpreview.d.ts +28 -0
- package/dist/esm/models/components/actionpreview.d.ts.map +1 -0
- package/dist/esm/models/components/actionpreview.js +23 -0
- package/dist/esm/models/components/actionpreview.js.map +1 -0
- package/dist/esm/models/components/authcontext.d.ts +25 -0
- package/dist/esm/models/components/authcontext.d.ts.map +1 -0
- package/dist/esm/models/components/authcontext.js +21 -0
- package/dist/esm/models/components/authcontext.js.map +1 -0
- package/dist/esm/models/components/chatmessagefragment.d.ts +23 -0
- package/dist/esm/models/components/chatmessagefragment.d.ts.map +1 -1
- package/dist/esm/models/components/chatmessagefragment.js +6 -0
- package/dist/esm/models/components/chatmessagefragment.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +4 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +4 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/listentitiesrequest.d.ts +4 -4
- package/dist/esm/models/components/listentitiesrequest.d.ts.map +1 -1
- package/dist/esm/models/components/listentitiesrequest.js +3 -4
- package/dist/esm/models/components/listentitiesrequest.js.map +1 -1
- package/dist/esm/models/components/servertoolrequest.d.ts +75 -0
- package/dist/esm/models/components/servertoolrequest.d.ts.map +1 -0
- package/dist/esm/models/components/servertoolrequest.js +54 -0
- package/dist/esm/models/components/servertoolrequest.js.map +1 -0
- package/dist/esm/models/components/servertoolresponse.d.ts +117 -0
- package/dist/esm/models/components/servertoolresponse.d.ts.map +1 -0
- package/dist/esm/models/components/servertoolresponse.js +75 -0
- package/dist/esm/models/components/servertoolresponse.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/messages.test.ts +1 -1
- package/src/__tests__/search.test.ts +0 -4
- package/src/__tests__/summarize.test.ts +2 -4
- package/src/lib/config.ts +3 -3
- package/src/lib/http.ts +3 -1
- package/src/lib/security.ts +10 -5
- package/src/models/components/actionpreview.ts +61 -0
- package/src/models/components/authcontext.ts +56 -0
- package/src/models/components/chatmessagefragment.ts +37 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/listentitiesrequest.ts +11 -6
- package/src/models/components/servertoolrequest.ts +138 -0
- package/src/models/components/servertoolresponse.ts +188 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: cac47cd90cd3
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
9
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
10
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
+
import {
|
|
13
|
+
ActionPreview,
|
|
14
|
+
ActionPreview$inboundSchema,
|
|
15
|
+
ActionPreview$Outbound,
|
|
16
|
+
ActionPreview$outboundSchema,
|
|
17
|
+
} from "./actionpreview.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The type of request made to the user.
|
|
21
|
+
*/
|
|
22
|
+
export const ServerToolRequestRequestType = {
|
|
23
|
+
/**
|
|
24
|
+
* Request for approving execution of the tool.
|
|
25
|
+
*/
|
|
26
|
+
Execution: "EXECUTION",
|
|
27
|
+
/**
|
|
28
|
+
* Request for authenticating to a tool, provided as a (tool) suggestion.
|
|
29
|
+
*/
|
|
30
|
+
AuthenticationSuggestion: "AUTHENTICATION_SUGGESTION",
|
|
31
|
+
/**
|
|
32
|
+
* Suggestion to vote for enabling an available-but-not-enabled tool.
|
|
33
|
+
*/
|
|
34
|
+
VoteSuggestion: "VOTE_SUGGESTION",
|
|
35
|
+
} as const;
|
|
36
|
+
/**
|
|
37
|
+
* The type of request made to the user.
|
|
38
|
+
*/
|
|
39
|
+
export type ServerToolRequestRequestType = OpenEnum<
|
|
40
|
+
typeof ServerToolRequestRequestType
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
export type ServerToolRequest = {
|
|
44
|
+
/**
|
|
45
|
+
* The type of request made to the user.
|
|
46
|
+
*/
|
|
47
|
+
requestType: ServerToolRequestRequestType;
|
|
48
|
+
/**
|
|
49
|
+
* Unique identifier for this request.
|
|
50
|
+
*/
|
|
51
|
+
requestId: string;
|
|
52
|
+
/**
|
|
53
|
+
* Human-readable display name for the tool.
|
|
54
|
+
*/
|
|
55
|
+
toolDisplayName?: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Unique identifier of the tool server. Use with GET /tool-servers/{serverId}/auth
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* to resolve display information and authentication status.
|
|
61
|
+
*/
|
|
62
|
+
serverId?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Custom call-to-action (CTA) verb for the approval button (e.g., "Create", "Update", "Send").
|
|
65
|
+
*/
|
|
66
|
+
toolCta?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Preview information for an action being executed.
|
|
69
|
+
*/
|
|
70
|
+
actionPreview?: ActionPreview | undefined;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/** @internal */
|
|
74
|
+
export const ServerToolRequestRequestType$inboundSchema: z.ZodType<
|
|
75
|
+
ServerToolRequestRequestType,
|
|
76
|
+
z.ZodTypeDef,
|
|
77
|
+
unknown
|
|
78
|
+
> = openEnums.inboundSchema(ServerToolRequestRequestType);
|
|
79
|
+
/** @internal */
|
|
80
|
+
export const ServerToolRequestRequestType$outboundSchema: z.ZodType<
|
|
81
|
+
string,
|
|
82
|
+
z.ZodTypeDef,
|
|
83
|
+
ServerToolRequestRequestType
|
|
84
|
+
> = openEnums.outboundSchema(ServerToolRequestRequestType);
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const ServerToolRequest$inboundSchema: z.ZodType<
|
|
88
|
+
ServerToolRequest,
|
|
89
|
+
z.ZodTypeDef,
|
|
90
|
+
unknown
|
|
91
|
+
> = z.object({
|
|
92
|
+
requestType: ServerToolRequestRequestType$inboundSchema,
|
|
93
|
+
requestId: z.string(),
|
|
94
|
+
toolDisplayName: z.string().optional(),
|
|
95
|
+
serverId: z.string().optional(),
|
|
96
|
+
toolCta: z.string().optional(),
|
|
97
|
+
actionPreview: ActionPreview$inboundSchema.optional(),
|
|
98
|
+
});
|
|
99
|
+
/** @internal */
|
|
100
|
+
export type ServerToolRequest$Outbound = {
|
|
101
|
+
requestType: string;
|
|
102
|
+
requestId: string;
|
|
103
|
+
toolDisplayName?: string | undefined;
|
|
104
|
+
serverId?: string | undefined;
|
|
105
|
+
toolCta?: string | undefined;
|
|
106
|
+
actionPreview?: ActionPreview$Outbound | undefined;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** @internal */
|
|
110
|
+
export const ServerToolRequest$outboundSchema: z.ZodType<
|
|
111
|
+
ServerToolRequest$Outbound,
|
|
112
|
+
z.ZodTypeDef,
|
|
113
|
+
ServerToolRequest
|
|
114
|
+
> = z.object({
|
|
115
|
+
requestType: ServerToolRequestRequestType$outboundSchema,
|
|
116
|
+
requestId: z.string(),
|
|
117
|
+
toolDisplayName: z.string().optional(),
|
|
118
|
+
serverId: z.string().optional(),
|
|
119
|
+
toolCta: z.string().optional(),
|
|
120
|
+
actionPreview: ActionPreview$outboundSchema.optional(),
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export function serverToolRequestToJSON(
|
|
124
|
+
serverToolRequest: ServerToolRequest,
|
|
125
|
+
): string {
|
|
126
|
+
return JSON.stringify(
|
|
127
|
+
ServerToolRequest$outboundSchema.parse(serverToolRequest),
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
export function serverToolRequestFromJSON(
|
|
131
|
+
jsonString: string,
|
|
132
|
+
): SafeParseResult<ServerToolRequest, SDKValidationError> {
|
|
133
|
+
return safeParse(
|
|
134
|
+
jsonString,
|
|
135
|
+
(x) => ServerToolRequest$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
+
`Failed to parse 'ServerToolRequest' from JSON`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9d3c25ee1ce8
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
9
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
10
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
|
+
import {
|
|
13
|
+
AuthContext,
|
|
14
|
+
AuthContext$inboundSchema,
|
|
15
|
+
AuthContext$Outbound,
|
|
16
|
+
AuthContext$outboundSchema,
|
|
17
|
+
} from "./authcontext.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The type of request made to the user.
|
|
21
|
+
*/
|
|
22
|
+
export const ServerToolResponseRequestType = {
|
|
23
|
+
/**
|
|
24
|
+
* Request for approving execution of the tool.
|
|
25
|
+
*/
|
|
26
|
+
Execution: "EXECUTION",
|
|
27
|
+
/**
|
|
28
|
+
* Request for authenticating to a tool, provided as a (tool) suggestion.
|
|
29
|
+
*/
|
|
30
|
+
AuthenticationSuggestion: "AUTHENTICATION_SUGGESTION",
|
|
31
|
+
/**
|
|
32
|
+
* Suggestion to vote for enabling an available-but-not-enabled tool.
|
|
33
|
+
*/
|
|
34
|
+
VoteSuggestion: "VOTE_SUGGESTION",
|
|
35
|
+
} as const;
|
|
36
|
+
/**
|
|
37
|
+
* The type of request made to the user.
|
|
38
|
+
*/
|
|
39
|
+
export type ServerToolResponseRequestType = OpenEnum<
|
|
40
|
+
typeof ServerToolResponseRequestType
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Scope of the approval grant. Only applicable when isGranted is true and requestType is EXECUTION.
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
*/
|
|
48
|
+
export const GrantScope = {
|
|
49
|
+
/**
|
|
50
|
+
* Approve only the current tool request. Future tool execution requests still require approval.
|
|
51
|
+
*/
|
|
52
|
+
CurrentRequest: "CURRENT_REQUEST",
|
|
53
|
+
/**
|
|
54
|
+
* Approve the current tool request and auto-approve all future same tool requests in this chat session.
|
|
55
|
+
*/
|
|
56
|
+
CurrentSession: "CURRENT_SESSION",
|
|
57
|
+
/**
|
|
58
|
+
* Approve the current tool request and auto-approve all future same tool requests across all chat sessions.
|
|
59
|
+
*/
|
|
60
|
+
Always: "ALWAYS",
|
|
61
|
+
} as const;
|
|
62
|
+
/**
|
|
63
|
+
* Scope of the approval grant. Only applicable when isGranted is true and requestType is EXECUTION.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
*/
|
|
67
|
+
export type GrantScope = OpenEnum<typeof GrantScope>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Response to a server tool request. The applicable fields depend on requestType:
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
*
|
|
74
|
+
* For EXECUTION requests:
|
|
75
|
+
* - isGranted: whether tool execution is approved
|
|
76
|
+
* - reason: optional explanation
|
|
77
|
+
*
|
|
78
|
+
* For AUTHENTICATION_SUGGESTION requests:
|
|
79
|
+
* - isGranted: whether auth completed successfully (true=connected, false=skipped)
|
|
80
|
+
* - authContext: contains serverId or actionPackId for identifying the authenticated entity
|
|
81
|
+
* - reason: optional explanation for skip
|
|
82
|
+
*
|
|
83
|
+
* For VOTE_SUGGESTION requests:
|
|
84
|
+
* - voted: whether the user voted for this tool
|
|
85
|
+
*/
|
|
86
|
+
export type ServerToolResponse = {
|
|
87
|
+
/**
|
|
88
|
+
* The type of request made to the user.
|
|
89
|
+
*/
|
|
90
|
+
requestType: ServerToolResponseRequestType;
|
|
91
|
+
/**
|
|
92
|
+
* Unique identifier for this request.
|
|
93
|
+
*/
|
|
94
|
+
requestId: string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether tool request is granted (indicates approval for execution, or completion for auth).
|
|
97
|
+
*/
|
|
98
|
+
isGranted?: boolean | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Scope of the approval grant. Only applicable when isGranted is true and requestType is EXECUTION.
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
*/
|
|
104
|
+
grantScope?: GrantScope | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Context for authentication responses, containing identifiers for the entity being authenticated.
|
|
107
|
+
*
|
|
108
|
+
* @remarks
|
|
109
|
+
*/
|
|
110
|
+
authContext?: AuthContext | undefined;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** @internal */
|
|
114
|
+
export const ServerToolResponseRequestType$inboundSchema: z.ZodType<
|
|
115
|
+
ServerToolResponseRequestType,
|
|
116
|
+
z.ZodTypeDef,
|
|
117
|
+
unknown
|
|
118
|
+
> = openEnums.inboundSchema(ServerToolResponseRequestType);
|
|
119
|
+
/** @internal */
|
|
120
|
+
export const ServerToolResponseRequestType$outboundSchema: z.ZodType<
|
|
121
|
+
string,
|
|
122
|
+
z.ZodTypeDef,
|
|
123
|
+
ServerToolResponseRequestType
|
|
124
|
+
> = openEnums.outboundSchema(ServerToolResponseRequestType);
|
|
125
|
+
|
|
126
|
+
/** @internal */
|
|
127
|
+
export const GrantScope$inboundSchema: z.ZodType<
|
|
128
|
+
GrantScope,
|
|
129
|
+
z.ZodTypeDef,
|
|
130
|
+
unknown
|
|
131
|
+
> = openEnums.inboundSchema(GrantScope);
|
|
132
|
+
/** @internal */
|
|
133
|
+
export const GrantScope$outboundSchema: z.ZodType<
|
|
134
|
+
string,
|
|
135
|
+
z.ZodTypeDef,
|
|
136
|
+
GrantScope
|
|
137
|
+
> = openEnums.outboundSchema(GrantScope);
|
|
138
|
+
|
|
139
|
+
/** @internal */
|
|
140
|
+
export const ServerToolResponse$inboundSchema: z.ZodType<
|
|
141
|
+
ServerToolResponse,
|
|
142
|
+
z.ZodTypeDef,
|
|
143
|
+
unknown
|
|
144
|
+
> = z.object({
|
|
145
|
+
requestType: ServerToolResponseRequestType$inboundSchema,
|
|
146
|
+
requestId: z.string(),
|
|
147
|
+
isGranted: z.boolean().optional(),
|
|
148
|
+
grantScope: GrantScope$inboundSchema.default("CURRENT_REQUEST"),
|
|
149
|
+
authContext: AuthContext$inboundSchema.optional(),
|
|
150
|
+
});
|
|
151
|
+
/** @internal */
|
|
152
|
+
export type ServerToolResponse$Outbound = {
|
|
153
|
+
requestType: string;
|
|
154
|
+
requestId: string;
|
|
155
|
+
isGranted?: boolean | undefined;
|
|
156
|
+
grantScope: string;
|
|
157
|
+
authContext?: AuthContext$Outbound | undefined;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/** @internal */
|
|
161
|
+
export const ServerToolResponse$outboundSchema: z.ZodType<
|
|
162
|
+
ServerToolResponse$Outbound,
|
|
163
|
+
z.ZodTypeDef,
|
|
164
|
+
ServerToolResponse
|
|
165
|
+
> = z.object({
|
|
166
|
+
requestType: ServerToolResponseRequestType$outboundSchema,
|
|
167
|
+
requestId: z.string(),
|
|
168
|
+
isGranted: z.boolean().optional(),
|
|
169
|
+
grantScope: GrantScope$outboundSchema.default("CURRENT_REQUEST"),
|
|
170
|
+
authContext: AuthContext$outboundSchema.optional(),
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
export function serverToolResponseToJSON(
|
|
174
|
+
serverToolResponse: ServerToolResponse,
|
|
175
|
+
): string {
|
|
176
|
+
return JSON.stringify(
|
|
177
|
+
ServerToolResponse$outboundSchema.parse(serverToolResponse),
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
export function serverToolResponseFromJSON(
|
|
181
|
+
jsonString: string,
|
|
182
|
+
): SafeParseResult<ServerToolResponse, SDKValidationError> {
|
|
183
|
+
return safeParse(
|
|
184
|
+
jsonString,
|
|
185
|
+
(x) => ServerToolResponse$inboundSchema.parse(JSON.parse(x)),
|
|
186
|
+
`Failed to parse 'ServerToolResponse' from JSON`,
|
|
187
|
+
);
|
|
188
|
+
}
|