@gleanwork/api-client 0.4.2 → 0.4.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/README.md +9 -0
- package/dist/commonjs/__tests__/indexing.test-d.d.ts +2 -0
- package/dist/commonjs/__tests__/indexing.test-d.d.ts.map +1 -0
- package/dist/commonjs/__tests__/indexing.test-d.js +39 -0
- package/dist/commonjs/__tests__/indexing.test-d.js.map +1 -0
- package/dist/commonjs/__tests__/policies.test.js +8 -5
- package/dist/commonjs/__tests__/policies.test.js.map +1 -1
- package/dist/commonjs/__tests__/tools.test.d.ts +2 -0
- package/dist/commonjs/__tests__/tools.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/tools.test.js +37 -0
- package/dist/commonjs/__tests__/tools.test.js.map +1 -0
- package/dist/commonjs/funcs/clientGovernanceDataPoliciesList.js +2 -2
- package/dist/commonjs/funcs/clientGovernanceDataPoliciesList.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchQuery.js +2 -4
- package/dist/commonjs/funcs/clientSearchQuery.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.js +2 -4
- package/dist/commonjs/funcs/clientSearchQueryAsAdmin.js.map +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.d.ts +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/commonjs/funcs/clientSearchRecommendations.js +2 -4
- package/dist/commonjs/funcs/clientSearchRecommendations.js.map +1 -1
- package/dist/commonjs/funcs/clientToolsList.d.ts +16 -0
- package/dist/commonjs/funcs/clientToolsList.d.ts.map +1 -0
- package/dist/commonjs/funcs/clientToolsList.js +119 -0
- package/dist/commonjs/funcs/clientToolsList.js.map +1 -0
- package/dist/commonjs/funcs/clientToolsRun.d.ts +16 -0
- package/dist/commonjs/funcs/clientToolsRun.d.ts.map +1 -0
- package/dist/commonjs/funcs/clientToolsRun.js +112 -0
- package/dist/commonjs/funcs/clientToolsRun.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/agentrun.d.ts +6 -26
- package/dist/commonjs/models/components/agentrun.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentrun.js +3 -26
- package/dist/commonjs/models/components/agentrun.js.map +1 -1
- package/dist/commonjs/models/components/agentruncreate.d.ts +6 -26
- package/dist/commonjs/models/components/agentruncreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/agentruncreate.js +3 -26
- package/dist/commonjs/models/components/agentruncreate.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +6 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +6 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/textrange.d.ts +3 -0
- package/dist/commonjs/models/components/textrange.d.ts.map +1 -1
- package/dist/commonjs/models/components/textrange.js +1 -0
- package/dist/commonjs/models/components/textrange.js.map +1 -1
- package/dist/commonjs/models/components/tool.d.ts +89 -0
- package/dist/commonjs/models/components/tool.d.ts.map +1 -0
- package/dist/commonjs/models/components/tool.js +102 -0
- package/dist/commonjs/models/components/tool.js.map +1 -0
- package/dist/commonjs/models/components/toolparameter.d.ts +104 -0
- package/dist/commonjs/models/components/toolparameter.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolparameter.js +106 -0
- package/dist/commonjs/models/components/toolparameter.js.map +1 -0
- package/dist/commonjs/models/components/toolscallparameter.d.ts +51 -0
- package/dist/commonjs/models/components/toolscallparameter.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallparameter.js +77 -0
- package/dist/commonjs/models/components/toolscallparameter.js.map +1 -0
- package/dist/commonjs/models/components/toolscallrequest.d.ts +42 -0
- package/dist/commonjs/models/components/toolscallrequest.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallrequest.js +72 -0
- package/dist/commonjs/models/components/toolscallrequest.js.map +1 -0
- package/dist/commonjs/models/components/toolscallresponse.d.ts +41 -0
- package/dist/commonjs/models/components/toolscallresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolscallresponse.js +71 -0
- package/dist/commonjs/models/components/toolscallresponse.js.map +1 -0
- package/dist/commonjs/models/components/toolslistresponse.d.ts +30 -0
- package/dist/commonjs/models/components/toolslistresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/toolslistresponse.js +70 -0
- package/dist/commonjs/models/components/toolslistresponse.js.map +1 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.d.ts +32 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.js +69 -0
- package/dist/commonjs/models/operations/getrestapiv1toolslist.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -1
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -1
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listpolicies.d.ts +37 -0
- package/dist/commonjs/models/operations/listpolicies.d.ts.map +1 -0
- package/dist/commonjs/models/operations/{getpolicies.js → listpolicies.js} +17 -17
- package/dist/commonjs/models/operations/listpolicies.js.map +1 -0
- package/dist/commonjs/react-query/clientSearchQuery.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchQuery.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientSearchRecommendations.d.ts +1 -1
- package/dist/commonjs/react-query/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/commonjs/react-query/clientToolsList.d.ts +38 -0
- package/dist/commonjs/react-query/clientToolsList.d.ts.map +1 -0
- package/dist/commonjs/react-query/clientToolsList.js +82 -0
- package/dist/commonjs/react-query/clientToolsList.js.map +1 -0
- package/dist/commonjs/react-query/clientToolsRun.d.ts +23 -0
- package/dist/commonjs/react-query/clientToolsRun.d.ts.map +1 -0
- package/dist/commonjs/react-query/clientToolsRun.js +47 -0
- package/dist/commonjs/react-query/clientToolsRun.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/sdk/client.d.ts +3 -0
- package/dist/commonjs/sdk/client.d.ts.map +1 -1
- package/dist/commonjs/sdk/client.js +4 -0
- package/dist/commonjs/sdk/client.js.map +1 -1
- package/dist/commonjs/sdk/search.d.ts +3 -3
- package/dist/commonjs/sdk/search.d.ts.map +1 -1
- package/dist/commonjs/sdk/search.js.map +1 -1
- package/dist/commonjs/sdk/tools.d.ts +19 -0
- package/dist/commonjs/sdk/tools.d.ts.map +1 -0
- package/dist/commonjs/sdk/tools.js +32 -0
- package/dist/commonjs/sdk/tools.js.map +1 -0
- package/dist/esm/__tests__/indexing.test-d.d.ts +2 -0
- package/dist/esm/__tests__/indexing.test-d.d.ts.map +1 -0
- package/dist/esm/__tests__/indexing.test-d.js +37 -0
- package/dist/esm/__tests__/indexing.test-d.js.map +1 -0
- package/dist/esm/__tests__/policies.test.js +8 -5
- package/dist/esm/__tests__/policies.test.js.map +1 -1
- package/dist/esm/__tests__/tools.test.d.ts +2 -0
- package/dist/esm/__tests__/tools.test.d.ts.map +1 -0
- package/dist/esm/__tests__/tools.test.js +35 -0
- package/dist/esm/__tests__/tools.test.js.map +1 -0
- package/dist/esm/funcs/clientGovernanceDataPoliciesList.js +2 -2
- package/dist/esm/funcs/clientGovernanceDataPoliciesList.js.map +1 -1
- package/dist/esm/funcs/clientSearchQuery.d.ts +1 -1
- package/dist/esm/funcs/clientSearchQuery.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchQuery.js +2 -4
- package/dist/esm/funcs/clientSearchQuery.js.map +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchQueryAsAdmin.js +2 -4
- package/dist/esm/funcs/clientSearchQueryAsAdmin.js.map +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.d.ts +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/esm/funcs/clientSearchRecommendations.js +2 -4
- package/dist/esm/funcs/clientSearchRecommendations.js.map +1 -1
- package/dist/esm/funcs/clientToolsList.d.ts +16 -0
- package/dist/esm/funcs/clientToolsList.d.ts.map +1 -0
- package/dist/esm/funcs/clientToolsList.js +83 -0
- package/dist/esm/funcs/clientToolsList.js.map +1 -0
- package/dist/esm/funcs/clientToolsRun.d.ts +16 -0
- package/dist/esm/funcs/clientToolsRun.d.ts.map +1 -0
- package/dist/esm/funcs/clientToolsRun.js +76 -0
- package/dist/esm/funcs/clientToolsRun.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/agentrun.d.ts +6 -26
- package/dist/esm/models/components/agentrun.d.ts.map +1 -1
- package/dist/esm/models/components/agentrun.js +2 -23
- package/dist/esm/models/components/agentrun.js.map +1 -1
- package/dist/esm/models/components/agentruncreate.d.ts +6 -26
- package/dist/esm/models/components/agentruncreate.d.ts.map +1 -1
- package/dist/esm/models/components/agentruncreate.js +2 -23
- package/dist/esm/models/components/agentruncreate.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +6 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +6 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/textrange.d.ts +3 -0
- package/dist/esm/models/components/textrange.d.ts.map +1 -1
- package/dist/esm/models/components/textrange.js +1 -0
- package/dist/esm/models/components/textrange.js.map +1 -1
- package/dist/esm/models/components/tool.d.ts +89 -0
- package/dist/esm/models/components/tool.d.ts.map +1 -0
- package/dist/esm/models/components/tool.js +64 -0
- package/dist/esm/models/components/tool.js.map +1 -0
- package/dist/esm/models/components/toolparameter.d.ts +104 -0
- package/dist/esm/models/components/toolparameter.d.ts.map +1 -0
- package/dist/esm/models/components/toolparameter.js +68 -0
- package/dist/esm/models/components/toolparameter.js.map +1 -0
- package/dist/esm/models/components/toolscallparameter.d.ts +51 -0
- package/dist/esm/models/components/toolscallparameter.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallparameter.js +39 -0
- package/dist/esm/models/components/toolscallparameter.js.map +1 -0
- package/dist/esm/models/components/toolscallrequest.d.ts +42 -0
- package/dist/esm/models/components/toolscallrequest.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallrequest.js +34 -0
- package/dist/esm/models/components/toolscallrequest.js.map +1 -0
- package/dist/esm/models/components/toolscallresponse.d.ts +41 -0
- package/dist/esm/models/components/toolscallresponse.d.ts.map +1 -0
- package/dist/esm/models/components/toolscallresponse.js +33 -0
- package/dist/esm/models/components/toolscallresponse.js.map +1 -0
- package/dist/esm/models/components/toolslistresponse.d.ts +30 -0
- package/dist/esm/models/components/toolslistresponse.d.ts.map +1 -0
- package/dist/esm/models/components/toolslistresponse.js +32 -0
- package/dist/esm/models/components/toolslistresponse.js.map +1 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.d.ts +32 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.d.ts.map +1 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.js +31 -0
- package/dist/esm/models/operations/getrestapiv1toolslist.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -1
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -1
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listpolicies.d.ts +37 -0
- package/dist/esm/models/operations/listpolicies.d.ts.map +1 -0
- package/dist/esm/models/operations/listpolicies.js +33 -0
- package/dist/esm/models/operations/listpolicies.js.map +1 -0
- package/dist/esm/react-query/clientSearchQuery.d.ts +1 -1
- package/dist/esm/react-query/clientSearchQuery.d.ts.map +1 -1
- package/dist/esm/react-query/clientSearchQueryAsAdmin.d.ts +1 -1
- package/dist/esm/react-query/clientSearchQueryAsAdmin.d.ts.map +1 -1
- package/dist/esm/react-query/clientSearchRecommendations.d.ts +1 -1
- package/dist/esm/react-query/clientSearchRecommendations.d.ts.map +1 -1
- package/dist/esm/react-query/clientToolsList.d.ts +38 -0
- package/dist/esm/react-query/clientToolsList.d.ts.map +1 -0
- package/dist/esm/react-query/clientToolsList.js +72 -0
- package/dist/esm/react-query/clientToolsList.js.map +1 -0
- package/dist/esm/react-query/clientToolsRun.d.ts +23 -0
- package/dist/esm/react-query/clientToolsRun.d.ts.map +1 -0
- package/dist/esm/react-query/clientToolsRun.js +42 -0
- package/dist/esm/react-query/clientToolsRun.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/sdk/client.d.ts +3 -0
- package/dist/esm/sdk/client.d.ts.map +1 -1
- package/dist/esm/sdk/client.js +4 -0
- package/dist/esm/sdk/client.js.map +1 -1
- package/dist/esm/sdk/search.d.ts +3 -3
- package/dist/esm/sdk/search.d.ts.map +1 -1
- package/dist/esm/sdk/search.js.map +1 -1
- package/dist/esm/sdk/tools.d.ts +19 -0
- package/dist/esm/sdk/tools.d.ts.map +1 -0
- package/dist/esm/sdk/tools.js +28 -0
- package/dist/esm/sdk/tools.js.map +1 -0
- package/docs/sdks/search/README.md +310 -22882
- package/docs/sdks/tools/README.md +214 -0
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/__tests__/indexing.test-d.ts +40 -0
- package/src/__tests__/policies.test.ts +14 -8
- package/src/__tests__/tools.test.ts +41 -0
- package/src/funcs/clientGovernanceDataPoliciesList.ts +3 -3
- package/src/funcs/clientSearchQuery.ts +4 -6
- package/src/funcs/clientSearchQueryAsAdmin.ts +4 -6
- package/src/funcs/clientSearchRecommendations.ts +4 -7
- package/src/funcs/clientToolsList.ts +164 -0
- package/src/funcs/clientToolsRun.ts +154 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/agentrun.ts +4 -53
- package/src/models/components/agentruncreate.ts +4 -57
- package/src/models/components/index.ts +6 -0
- package/src/models/components/textrange.ts +1 -0
- package/src/models/components/tool.ts +125 -0
- package/src/models/components/toolparameter.ts +141 -0
- package/src/models/components/toolscallparameter.ts +92 -0
- package/src/models/components/toolscallrequest.ts +82 -0
- package/src/models/components/toolscallresponse.ts +76 -0
- package/src/models/components/toolslistresponse.ts +72 -0
- package/src/models/operations/getrestapiv1toolslist.ts +71 -0
- package/src/models/operations/index.ts +2 -1
- package/src/models/operations/{getpolicies.ts → listpolicies.ts} +21 -21
- package/src/react-query/clientSearchQuery.ts +1 -1
- package/src/react-query/clientSearchQueryAsAdmin.ts +1 -1
- package/src/react-query/clientSearchRecommendations.ts +1 -1
- package/src/react-query/clientToolsList.ts +150 -0
- package/src/react-query/clientToolsRun.ts +88 -0
- package/src/react-query/index.ts +2 -0
- package/src/sdk/client.ts +6 -0
- package/src/sdk/search.ts +3 -3
- package/src/sdk/tools.ts +45 -0
- package/dist/commonjs/models/operations/getpolicies.d.ts +0 -37
- package/dist/commonjs/models/operations/getpolicies.d.ts.map +0 -1
- package/dist/commonjs/models/operations/getpolicies.js.map +0 -1
- package/dist/esm/models/operations/getpolicies.d.ts +0 -37
- package/dist/esm/models/operations/getpolicies.d.ts.map +0 -1
- package/dist/esm/models/operations/getpolicies.js +0 -33
- package/dist/esm/models/operations/getpolicies.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GleanCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { GleanError } from "../models/errors/gleanerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Execute the specified tool
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Execute the specified tool with provided parameters
|
|
31
|
+
*/
|
|
32
|
+
export function clientToolsRun(
|
|
33
|
+
client: GleanCore,
|
|
34
|
+
request: components.ToolsCallRequest,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): APIPromise<
|
|
37
|
+
Result<
|
|
38
|
+
components.ToolsCallResponse,
|
|
39
|
+
| GleanError
|
|
40
|
+
| SDKValidationError
|
|
41
|
+
| UnexpectedClientError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
request,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function $do(
|
|
56
|
+
client: GleanCore,
|
|
57
|
+
request: components.ToolsCallRequest,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
components.ToolsCallResponse,
|
|
63
|
+
| GleanError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| RequestAbortedError
|
|
68
|
+
| RequestTimeoutError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
73
|
+
> {
|
|
74
|
+
const parsed = safeParse(
|
|
75
|
+
request,
|
|
76
|
+
(value) => components.ToolsCallRequest$outboundSchema.parse(value),
|
|
77
|
+
"Input validation failed",
|
|
78
|
+
);
|
|
79
|
+
if (!parsed.ok) {
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
81
|
+
}
|
|
82
|
+
const payload = parsed.value;
|
|
83
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
84
|
+
|
|
85
|
+
const path = pathToFunc("/rest/api/v1/tools/call")();
|
|
86
|
+
|
|
87
|
+
const headers = new Headers(compactMap({
|
|
88
|
+
"Content-Type": "application/json",
|
|
89
|
+
Accept: "application/json",
|
|
90
|
+
}));
|
|
91
|
+
|
|
92
|
+
const secConfig = await extractSecurity(client._options.apiToken);
|
|
93
|
+
const securityInput = secConfig == null ? {} : { apiToken: secConfig };
|
|
94
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
95
|
+
|
|
96
|
+
const context = {
|
|
97
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
98
|
+
operationID: "post_/rest/api/v1/tools/call",
|
|
99
|
+
oAuth2Scopes: [],
|
|
100
|
+
|
|
101
|
+
resolvedSecurity: requestSecurity,
|
|
102
|
+
|
|
103
|
+
securitySource: client._options.apiToken,
|
|
104
|
+
retryConfig: options?.retries
|
|
105
|
+
|| client._options.retryConfig
|
|
106
|
+
|| { strategy: "none" },
|
|
107
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const requestRes = client._createRequest(context, {
|
|
111
|
+
security: requestSecurity,
|
|
112
|
+
method: "POST",
|
|
113
|
+
baseURL: options?.serverURL,
|
|
114
|
+
path: path,
|
|
115
|
+
headers: headers,
|
|
116
|
+
body: body,
|
|
117
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
118
|
+
}, options);
|
|
119
|
+
if (!requestRes.ok) {
|
|
120
|
+
return [requestRes, { status: "invalid" }];
|
|
121
|
+
}
|
|
122
|
+
const req = requestRes.value;
|
|
123
|
+
|
|
124
|
+
const doResult = await client._do(req, {
|
|
125
|
+
context,
|
|
126
|
+
errorCodes: ["400", "401", "404", "429", "4XX", "5XX"],
|
|
127
|
+
retryConfig: context.retryConfig,
|
|
128
|
+
retryCodes: context.retryCodes,
|
|
129
|
+
});
|
|
130
|
+
if (!doResult.ok) {
|
|
131
|
+
return [doResult, { status: "request-error", request: req }];
|
|
132
|
+
}
|
|
133
|
+
const response = doResult.value;
|
|
134
|
+
|
|
135
|
+
const [result] = await M.match<
|
|
136
|
+
components.ToolsCallResponse,
|
|
137
|
+
| GleanError
|
|
138
|
+
| SDKValidationError
|
|
139
|
+
| UnexpectedClientError
|
|
140
|
+
| InvalidRequestError
|
|
141
|
+
| RequestAbortedError
|
|
142
|
+
| RequestTimeoutError
|
|
143
|
+
| ConnectionError
|
|
144
|
+
>(
|
|
145
|
+
M.json(200, components.ToolsCallResponse$inboundSchema),
|
|
146
|
+
M.fail([400, 401, 404, 429, "4XX"]),
|
|
147
|
+
M.fail("5XX"),
|
|
148
|
+
)(response);
|
|
149
|
+
if (!result.ok) {
|
|
150
|
+
return [result, { status: "complete", request: req, response }];
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return [result, { status: "complete", request: req, response }];
|
|
154
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -64,8 +64,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
64
64
|
export const SDK_METADATA = {
|
|
65
65
|
language: "typescript",
|
|
66
66
|
openapiDocVersion: "0.9.0",
|
|
67
|
-
sdkVersion: "0.4.
|
|
68
|
-
genVersion: "2.
|
|
67
|
+
sdkVersion: "0.4.4",
|
|
68
|
+
genVersion: "2.610.0",
|
|
69
69
|
userAgent:
|
|
70
|
-
"speakeasy-sdk/typescript 0.4.
|
|
70
|
+
"speakeasy-sdk/typescript 0.4.4 2.610.0 0.9.0 @gleanwork/api-client",
|
|
71
71
|
} as const;
|
|
@@ -19,11 +19,6 @@ import {
|
|
|
19
19
|
Message$outboundSchema,
|
|
20
20
|
} from "./message.js";
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* The input to the agent.
|
|
24
|
-
*/
|
|
25
|
-
export type AgentRunInput = {};
|
|
26
|
-
|
|
27
22
|
/**
|
|
28
23
|
* Payload for creating a run.
|
|
29
24
|
*/
|
|
@@ -35,7 +30,7 @@ export type AgentRun = {
|
|
|
35
30
|
/**
|
|
36
31
|
* The input to the agent.
|
|
37
32
|
*/
|
|
38
|
-
input?:
|
|
33
|
+
input?: { [k: string]: any } | undefined;
|
|
39
34
|
/**
|
|
40
35
|
* The messages to pass an input to the agent.
|
|
41
36
|
*/
|
|
@@ -46,50 +41,6 @@ export type AgentRun = {
|
|
|
46
41
|
status?: AgentExecutionStatus | undefined;
|
|
47
42
|
};
|
|
48
43
|
|
|
49
|
-
/** @internal */
|
|
50
|
-
export const AgentRunInput$inboundSchema: z.ZodType<
|
|
51
|
-
AgentRunInput,
|
|
52
|
-
z.ZodTypeDef,
|
|
53
|
-
unknown
|
|
54
|
-
> = z.object({});
|
|
55
|
-
|
|
56
|
-
/** @internal */
|
|
57
|
-
export type AgentRunInput$Outbound = {};
|
|
58
|
-
|
|
59
|
-
/** @internal */
|
|
60
|
-
export const AgentRunInput$outboundSchema: z.ZodType<
|
|
61
|
-
AgentRunInput$Outbound,
|
|
62
|
-
z.ZodTypeDef,
|
|
63
|
-
AgentRunInput
|
|
64
|
-
> = z.object({});
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
69
|
-
*/
|
|
70
|
-
export namespace AgentRunInput$ {
|
|
71
|
-
/** @deprecated use `AgentRunInput$inboundSchema` instead. */
|
|
72
|
-
export const inboundSchema = AgentRunInput$inboundSchema;
|
|
73
|
-
/** @deprecated use `AgentRunInput$outboundSchema` instead. */
|
|
74
|
-
export const outboundSchema = AgentRunInput$outboundSchema;
|
|
75
|
-
/** @deprecated use `AgentRunInput$Outbound` instead. */
|
|
76
|
-
export type Outbound = AgentRunInput$Outbound;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function agentRunInputToJSON(agentRunInput: AgentRunInput): string {
|
|
80
|
-
return JSON.stringify(AgentRunInput$outboundSchema.parse(agentRunInput));
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function agentRunInputFromJSON(
|
|
84
|
-
jsonString: string,
|
|
85
|
-
): SafeParseResult<AgentRunInput, SDKValidationError> {
|
|
86
|
-
return safeParse(
|
|
87
|
-
jsonString,
|
|
88
|
-
(x) => AgentRunInput$inboundSchema.parse(JSON.parse(x)),
|
|
89
|
-
`Failed to parse 'AgentRunInput' from JSON`,
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
44
|
/** @internal */
|
|
94
45
|
export const AgentRun$inboundSchema: z.ZodType<
|
|
95
46
|
AgentRun,
|
|
@@ -97,7 +48,7 @@ export const AgentRun$inboundSchema: z.ZodType<
|
|
|
97
48
|
unknown
|
|
98
49
|
> = z.object({
|
|
99
50
|
agent_id: z.string().optional(),
|
|
100
|
-
input: z.
|
|
51
|
+
input: z.record(z.any()).optional(),
|
|
101
52
|
messages: z.array(Message$inboundSchema).optional(),
|
|
102
53
|
status: AgentExecutionStatus$inboundSchema.optional(),
|
|
103
54
|
}).transform((v) => {
|
|
@@ -109,7 +60,7 @@ export const AgentRun$inboundSchema: z.ZodType<
|
|
|
109
60
|
/** @internal */
|
|
110
61
|
export type AgentRun$Outbound = {
|
|
111
62
|
agent_id?: string | undefined;
|
|
112
|
-
input?:
|
|
63
|
+
input?: { [k: string]: any } | undefined;
|
|
113
64
|
messages?: Array<Message$Outbound> | undefined;
|
|
114
65
|
status?: string | undefined;
|
|
115
66
|
};
|
|
@@ -121,7 +72,7 @@ export const AgentRun$outboundSchema: z.ZodType<
|
|
|
121
72
|
AgentRun
|
|
122
73
|
> = z.object({
|
|
123
74
|
agentId: z.string().optional(),
|
|
124
|
-
input: z.
|
|
75
|
+
input: z.record(z.any()).optional(),
|
|
125
76
|
messages: z.array(Message$outboundSchema).optional(),
|
|
126
77
|
status: AgentExecutionStatus$outboundSchema.optional(),
|
|
127
78
|
}).transform((v) => {
|
|
@@ -14,11 +14,6 @@ import {
|
|
|
14
14
|
Message$outboundSchema,
|
|
15
15
|
} from "./message.js";
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* The input to the agent.
|
|
19
|
-
*/
|
|
20
|
-
export type AgentRunCreateInput = {};
|
|
21
|
-
|
|
22
17
|
/**
|
|
23
18
|
* Payload for creating a run.
|
|
24
19
|
*/
|
|
@@ -30,61 +25,13 @@ export type AgentRunCreate = {
|
|
|
30
25
|
/**
|
|
31
26
|
* The input to the agent.
|
|
32
27
|
*/
|
|
33
|
-
input?:
|
|
28
|
+
input?: { [k: string]: any } | undefined;
|
|
34
29
|
/**
|
|
35
30
|
* The messages to pass an input to the agent.
|
|
36
31
|
*/
|
|
37
32
|
messages?: Array<Message> | undefined;
|
|
38
33
|
};
|
|
39
34
|
|
|
40
|
-
/** @internal */
|
|
41
|
-
export const AgentRunCreateInput$inboundSchema: z.ZodType<
|
|
42
|
-
AgentRunCreateInput,
|
|
43
|
-
z.ZodTypeDef,
|
|
44
|
-
unknown
|
|
45
|
-
> = z.object({});
|
|
46
|
-
|
|
47
|
-
/** @internal */
|
|
48
|
-
export type AgentRunCreateInput$Outbound = {};
|
|
49
|
-
|
|
50
|
-
/** @internal */
|
|
51
|
-
export const AgentRunCreateInput$outboundSchema: z.ZodType<
|
|
52
|
-
AgentRunCreateInput$Outbound,
|
|
53
|
-
z.ZodTypeDef,
|
|
54
|
-
AgentRunCreateInput
|
|
55
|
-
> = z.object({});
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @internal
|
|
59
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
60
|
-
*/
|
|
61
|
-
export namespace AgentRunCreateInput$ {
|
|
62
|
-
/** @deprecated use `AgentRunCreateInput$inboundSchema` instead. */
|
|
63
|
-
export const inboundSchema = AgentRunCreateInput$inboundSchema;
|
|
64
|
-
/** @deprecated use `AgentRunCreateInput$outboundSchema` instead. */
|
|
65
|
-
export const outboundSchema = AgentRunCreateInput$outboundSchema;
|
|
66
|
-
/** @deprecated use `AgentRunCreateInput$Outbound` instead. */
|
|
67
|
-
export type Outbound = AgentRunCreateInput$Outbound;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function agentRunCreateInputToJSON(
|
|
71
|
-
agentRunCreateInput: AgentRunCreateInput,
|
|
72
|
-
): string {
|
|
73
|
-
return JSON.stringify(
|
|
74
|
-
AgentRunCreateInput$outboundSchema.parse(agentRunCreateInput),
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function agentRunCreateInputFromJSON(
|
|
79
|
-
jsonString: string,
|
|
80
|
-
): SafeParseResult<AgentRunCreateInput, SDKValidationError> {
|
|
81
|
-
return safeParse(
|
|
82
|
-
jsonString,
|
|
83
|
-
(x) => AgentRunCreateInput$inboundSchema.parse(JSON.parse(x)),
|
|
84
|
-
`Failed to parse 'AgentRunCreateInput' from JSON`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
35
|
/** @internal */
|
|
89
36
|
export const AgentRunCreate$inboundSchema: z.ZodType<
|
|
90
37
|
AgentRunCreate,
|
|
@@ -92,7 +39,7 @@ export const AgentRunCreate$inboundSchema: z.ZodType<
|
|
|
92
39
|
unknown
|
|
93
40
|
> = z.object({
|
|
94
41
|
agent_id: z.string().optional(),
|
|
95
|
-
input: z.
|
|
42
|
+
input: z.record(z.any()).optional(),
|
|
96
43
|
messages: z.array(Message$inboundSchema).optional(),
|
|
97
44
|
}).transform((v) => {
|
|
98
45
|
return remap$(v, {
|
|
@@ -103,7 +50,7 @@ export const AgentRunCreate$inboundSchema: z.ZodType<
|
|
|
103
50
|
/** @internal */
|
|
104
51
|
export type AgentRunCreate$Outbound = {
|
|
105
52
|
agent_id?: string | undefined;
|
|
106
|
-
input?:
|
|
53
|
+
input?: { [k: string]: any } | undefined;
|
|
107
54
|
messages?: Array<Message$Outbound> | undefined;
|
|
108
55
|
};
|
|
109
56
|
|
|
@@ -114,7 +61,7 @@ export const AgentRunCreate$outboundSchema: z.ZodType<
|
|
|
114
61
|
AgentRunCreate
|
|
115
62
|
> = z.object({
|
|
116
63
|
agentId: z.string().optional(),
|
|
117
|
-
input: z.
|
|
64
|
+
input: z.record(z.any()).optional(),
|
|
118
65
|
messages: z.array(Message$outboundSchema).optional(),
|
|
119
66
|
}).transform((v) => {
|
|
120
67
|
return remap$(v, {
|
|
@@ -366,8 +366,14 @@ export * from "./thumbnail.js";
|
|
|
366
366
|
export * from "./timeinterval.js";
|
|
367
367
|
export * from "./timepoint.js";
|
|
368
368
|
export * from "./timerange.js";
|
|
369
|
+
export * from "./tool.js";
|
|
369
370
|
export * from "./toolinfo.js";
|
|
370
371
|
export * from "./toolmetadata.js";
|
|
372
|
+
export * from "./toolparameter.js";
|
|
373
|
+
export * from "./toolscallparameter.js";
|
|
374
|
+
export * from "./toolscallrequest.js";
|
|
375
|
+
export * from "./toolscallresponse.js";
|
|
376
|
+
export * from "./toolslistresponse.js";
|
|
371
377
|
export * from "./ugctype.js";
|
|
372
378
|
export * from "./unpin.js";
|
|
373
379
|
export * from "./updateannouncementrequest.js";
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ToolParameter,
|
|
12
|
+
ToolParameter$inboundSchema,
|
|
13
|
+
ToolParameter$Outbound,
|
|
14
|
+
ToolParameter$outboundSchema,
|
|
15
|
+
} from "./toolparameter.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Type of tool (READ, WRITE)
|
|
19
|
+
*/
|
|
20
|
+
export const ToolType = {
|
|
21
|
+
Read: "READ",
|
|
22
|
+
Write: "WRITE",
|
|
23
|
+
} as const;
|
|
24
|
+
/**
|
|
25
|
+
* Type of tool (READ, WRITE)
|
|
26
|
+
*/
|
|
27
|
+
export type ToolType = ClosedEnum<typeof ToolType>;
|
|
28
|
+
|
|
29
|
+
export type Tool = {
|
|
30
|
+
/**
|
|
31
|
+
* Type of tool (READ, WRITE)
|
|
32
|
+
*/
|
|
33
|
+
type?: ToolType | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Unique identifier for the tool
|
|
36
|
+
*/
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Human-readable name
|
|
40
|
+
*/
|
|
41
|
+
displayName?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* LLM friendly description of the tool
|
|
44
|
+
*/
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* The parameters for the tool. Each key is the name of the parameter and the value is the parameter object.
|
|
48
|
+
*/
|
|
49
|
+
parameters?: { [k: string]: ToolParameter } | undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const ToolType$inboundSchema: z.ZodNativeEnum<typeof ToolType> = z
|
|
54
|
+
.nativeEnum(ToolType);
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const ToolType$outboundSchema: z.ZodNativeEnum<typeof ToolType> =
|
|
58
|
+
ToolType$inboundSchema;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
63
|
+
*/
|
|
64
|
+
export namespace ToolType$ {
|
|
65
|
+
/** @deprecated use `ToolType$inboundSchema` instead. */
|
|
66
|
+
export const inboundSchema = ToolType$inboundSchema;
|
|
67
|
+
/** @deprecated use `ToolType$outboundSchema` instead. */
|
|
68
|
+
export const outboundSchema = ToolType$outboundSchema;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const Tool$inboundSchema: z.ZodType<Tool, z.ZodTypeDef, unknown> = z
|
|
73
|
+
.object({
|
|
74
|
+
type: ToolType$inboundSchema.optional(),
|
|
75
|
+
name: z.string().optional(),
|
|
76
|
+
displayName: z.string().optional(),
|
|
77
|
+
description: z.string().optional(),
|
|
78
|
+
parameters: z.record(ToolParameter$inboundSchema).optional(),
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export type Tool$Outbound = {
|
|
83
|
+
type?: string | undefined;
|
|
84
|
+
name?: string | undefined;
|
|
85
|
+
displayName?: string | undefined;
|
|
86
|
+
description?: string | undefined;
|
|
87
|
+
parameters?: { [k: string]: ToolParameter$Outbound } | undefined;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
export const Tool$outboundSchema: z.ZodType<Tool$Outbound, z.ZodTypeDef, Tool> =
|
|
92
|
+
z.object({
|
|
93
|
+
type: ToolType$outboundSchema.optional(),
|
|
94
|
+
name: z.string().optional(),
|
|
95
|
+
displayName: z.string().optional(),
|
|
96
|
+
description: z.string().optional(),
|
|
97
|
+
parameters: z.record(ToolParameter$outboundSchema).optional(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @internal
|
|
102
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
103
|
+
*/
|
|
104
|
+
export namespace Tool$ {
|
|
105
|
+
/** @deprecated use `Tool$inboundSchema` instead. */
|
|
106
|
+
export const inboundSchema = Tool$inboundSchema;
|
|
107
|
+
/** @deprecated use `Tool$outboundSchema` instead. */
|
|
108
|
+
export const outboundSchema = Tool$outboundSchema;
|
|
109
|
+
/** @deprecated use `Tool$Outbound` instead. */
|
|
110
|
+
export type Outbound = Tool$Outbound;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function toolToJSON(tool: Tool): string {
|
|
114
|
+
return JSON.stringify(Tool$outboundSchema.parse(tool));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function toolFromJSON(
|
|
118
|
+
jsonString: string,
|
|
119
|
+
): SafeParseResult<Tool, SDKValidationError> {
|
|
120
|
+
return safeParse(
|
|
121
|
+
jsonString,
|
|
122
|
+
(x) => Tool$inboundSchema.parse(JSON.parse(x)),
|
|
123
|
+
`Failed to parse 'Tool' from JSON`,
|
|
124
|
+
);
|
|
125
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Parameter type (string, number, boolean, object, array)
|
|
13
|
+
*/
|
|
14
|
+
export const ToolParameterType = {
|
|
15
|
+
String: "string",
|
|
16
|
+
Number: "number",
|
|
17
|
+
Boolean: "boolean",
|
|
18
|
+
Object: "object",
|
|
19
|
+
Array: "array",
|
|
20
|
+
} as const;
|
|
21
|
+
/**
|
|
22
|
+
* Parameter type (string, number, boolean, object, array)
|
|
23
|
+
*/
|
|
24
|
+
export type ToolParameterType = ClosedEnum<typeof ToolParameterType>;
|
|
25
|
+
|
|
26
|
+
export type ToolParameter = {
|
|
27
|
+
/**
|
|
28
|
+
* Parameter type (string, number, boolean, object, array)
|
|
29
|
+
*/
|
|
30
|
+
type?: ToolParameterType | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The name of the parameter
|
|
33
|
+
*/
|
|
34
|
+
name?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* The description of the parameter
|
|
37
|
+
*/
|
|
38
|
+
description?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the parameter is required
|
|
41
|
+
*/
|
|
42
|
+
isRequired?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* The possible values for the parameter. Can contain only primitive values or arrays of primitive values.
|
|
45
|
+
*/
|
|
46
|
+
possibleValues?: Array<string> | undefined;
|
|
47
|
+
items?: ToolParameter | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* When type is 'object', this describes the structure of the object.
|
|
50
|
+
*/
|
|
51
|
+
properties?: { [k: string]: ToolParameter } | undefined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export const ToolParameterType$inboundSchema: z.ZodNativeEnum<
|
|
56
|
+
typeof ToolParameterType
|
|
57
|
+
> = z.nativeEnum(ToolParameterType);
|
|
58
|
+
|
|
59
|
+
/** @internal */
|
|
60
|
+
export const ToolParameterType$outboundSchema: z.ZodNativeEnum<
|
|
61
|
+
typeof ToolParameterType
|
|
62
|
+
> = ToolParameterType$inboundSchema;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
67
|
+
*/
|
|
68
|
+
export namespace ToolParameterType$ {
|
|
69
|
+
/** @deprecated use `ToolParameterType$inboundSchema` instead. */
|
|
70
|
+
export const inboundSchema = ToolParameterType$inboundSchema;
|
|
71
|
+
/** @deprecated use `ToolParameterType$outboundSchema` instead. */
|
|
72
|
+
export const outboundSchema = ToolParameterType$outboundSchema;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const ToolParameter$inboundSchema: z.ZodType<
|
|
77
|
+
ToolParameter,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
unknown
|
|
80
|
+
> = z.object({
|
|
81
|
+
type: ToolParameterType$inboundSchema.optional(),
|
|
82
|
+
name: z.string().optional(),
|
|
83
|
+
description: z.string().optional(),
|
|
84
|
+
isRequired: z.boolean().optional(),
|
|
85
|
+
possibleValues: z.array(z.string()).optional(),
|
|
86
|
+
items: z.lazy(() => ToolParameter$inboundSchema).optional(),
|
|
87
|
+
properties: z.record(z.lazy(() => ToolParameter$inboundSchema)).optional(),
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/** @internal */
|
|
91
|
+
export type ToolParameter$Outbound = {
|
|
92
|
+
type?: string | undefined;
|
|
93
|
+
name?: string | undefined;
|
|
94
|
+
description?: string | undefined;
|
|
95
|
+
isRequired?: boolean | undefined;
|
|
96
|
+
possibleValues?: Array<string> | undefined;
|
|
97
|
+
items?: ToolParameter$Outbound | undefined;
|
|
98
|
+
properties?: { [k: string]: ToolParameter$Outbound } | undefined;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** @internal */
|
|
102
|
+
export const ToolParameter$outboundSchema: z.ZodType<
|
|
103
|
+
ToolParameter$Outbound,
|
|
104
|
+
z.ZodTypeDef,
|
|
105
|
+
ToolParameter
|
|
106
|
+
> = z.object({
|
|
107
|
+
type: ToolParameterType$outboundSchema.optional(),
|
|
108
|
+
name: z.string().optional(),
|
|
109
|
+
description: z.string().optional(),
|
|
110
|
+
isRequired: z.boolean().optional(),
|
|
111
|
+
possibleValues: z.array(z.string()).optional(),
|
|
112
|
+
items: z.lazy(() => ToolParameter$outboundSchema).optional(),
|
|
113
|
+
properties: z.record(z.lazy(() => ToolParameter$outboundSchema)).optional(),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @internal
|
|
118
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
119
|
+
*/
|
|
120
|
+
export namespace ToolParameter$ {
|
|
121
|
+
/** @deprecated use `ToolParameter$inboundSchema` instead. */
|
|
122
|
+
export const inboundSchema = ToolParameter$inboundSchema;
|
|
123
|
+
/** @deprecated use `ToolParameter$outboundSchema` instead. */
|
|
124
|
+
export const outboundSchema = ToolParameter$outboundSchema;
|
|
125
|
+
/** @deprecated use `ToolParameter$Outbound` instead. */
|
|
126
|
+
export type Outbound = ToolParameter$Outbound;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function toolParameterToJSON(toolParameter: ToolParameter): string {
|
|
130
|
+
return JSON.stringify(ToolParameter$outboundSchema.parse(toolParameter));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function toolParameterFromJSON(
|
|
134
|
+
jsonString: string,
|
|
135
|
+
): SafeParseResult<ToolParameter, SDKValidationError> {
|
|
136
|
+
return safeParse(
|
|
137
|
+
jsonString,
|
|
138
|
+
(x) => ToolParameter$inboundSchema.parse(JSON.parse(x)),
|
|
139
|
+
`Failed to parse 'ToolParameter' from JSON`,
|
|
140
|
+
);
|
|
141
|
+
}
|