Skip to content

Commit

Permalink
update client/openapi/trustd.yaml (#178)
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub <[email protected]>
Co-authored-by: github-merge-queue[bot] <github-merge-queue[bot]@users.noreply.github.com>
  • Loading branch information
carlosthe19916 and github-merge-queue[bot] authored Oct 4, 2024
1 parent a7c5dc2 commit 01acacb
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 0 deletions.
77 changes: 77 additions & 0 deletions client/openapi/trustd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,64 @@ paths:
description: The request was invalid
'404':
description: The AI service is not enabled
/api/v1/ai/flags:
get:
tags:
- ai
operationId: aiFlags
responses:
'200':
description: The resulting Flags
content:
application/json:
schema:
$ref: '#/components/schemas/AiFlags'
'404':
description: The AI service is not enabled
/api/v1/ai/tools:
get:
tags:
- ai
operationId: aiTools
responses:
'200':
description: The resulting list of tools
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/AiTool'
'404':
description: The AI service is not enabled
/api/v1/ai/tools/{name}:
post:
tags:
- ai
operationId: aiToolCall
parameters:
- name: name
in: path
description: Name of the tool to call
required: true
schema:
type: string
requestBody:
content:
application/json:
schema: {}
required: true
responses:
'200':
description: The result of the tool call
content:
text/plain:
schema:
type: string
'400':
description: The tool request was invalid
'404':
description: The tool was not found
/api/v1/analysis/dep:
get:
tags:
Expand Down Expand Up @@ -1974,6 +2032,25 @@ components:
All CVSS3 scores from the advisory for the given vulnerability.
May include several, varying by minor version of the CVSS3 vector.
description: Summary of information from this advisory regarding a single specific vulnerability.
AiFlags:
type: object
required:
- completions
properties:
completions:
type: boolean
AiTool:
type: object
required:
- name
- description
- parameters
properties:
description:
type: string
name:
type: string
parameters: {}
AnalysisStatus:
type: object
required:
Expand Down
24 changes: 24 additions & 0 deletions client/src/app/client/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,30 @@ May include several, varying by minor version of the CVSS3 vector.`,
"Summary of information from this advisory regarding a single specific vulnerability.",
} as const;

export const AiFlagsSchema = {
type: "object",
required: ["completions"],
properties: {
completions: {
type: "boolean",
},
},
} as const;

export const AiToolSchema = {
type: "object",
required: ["name", "description", "parameters"],
properties: {
description: {
type: "string",
},
name: {
type: "string",
},
parameters: {},
},
} as const;

export const AnalysisStatusSchema = {
type: "object",
required: ["sbom_count", "graph_count"],
Expand Down
46 changes: 46 additions & 0 deletions client/src/app/client/services.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ import type {
CompletionsData,
CompletionsError,
CompletionsResponse,
AiFlagsError,
AiFlagsResponse,
AiToolsError,
AiToolsResponse,
AiToolCallData,
AiToolCallError,
AiToolCallResponse,
SearchComponentDepsData,
SearchComponentDepsError,
SearchComponentDepsResponse,
Expand Down Expand Up @@ -319,6 +326,45 @@ export const completions = <ThrowOnError extends boolean = false>(
});
};

export const aiFlags = <ThrowOnError extends boolean = false>(
options?: Options<unknown, ThrowOnError>
) => {
return (options?.client ?? client).get<
AiFlagsResponse,
AiFlagsError,
ThrowOnError
>({
...options,
url: "/api/v1/ai/flags",
});
};

export const aiTools = <ThrowOnError extends boolean = false>(
options?: Options<unknown, ThrowOnError>
) => {
return (options?.client ?? client).get<
AiToolsResponse,
AiToolsError,
ThrowOnError
>({
...options,
url: "/api/v1/ai/tools",
});
};

export const aiToolCall = <ThrowOnError extends boolean = false>(
options: Options<AiToolCallData, ThrowOnError>
) => {
return (options?.client ?? client).post<
AiToolCallResponse,
AiToolCallError,
ThrowOnError
>({
...options,
url: "/api/v1/ai/tools/{name}",
});
};

export const searchComponentDeps = <ThrowOnError extends boolean = false>(
options?: Options<SearchComponentDepsData, ThrowOnError>
) => {
Expand Down
32 changes: 32 additions & 0 deletions client/src/app/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ export type AdvisoryVulnerabilitySummary = AdvisoryVulnerabilityHead & {
cvss3_scores: Array<string>;
};

export type AiFlags = {
completions: boolean;
};

export type AiTool = {
description: string;
name: string;
parameters: unknown;
};

export type AnalysisStatus = {
graph_count: number;
sbom_count: number;
Expand Down Expand Up @@ -1107,6 +1117,28 @@ export type CompletionsResponse = ChatState;

export type CompletionsError = unknown;

export type AiFlagsResponse = AiFlags;

export type AiFlagsError = unknown;

export type AiToolsResponse = Array<AiTool>;

export type AiToolsError = unknown;

export type AiToolCallData = {
body: unknown;
path: {
/**
* Name of the tool to call
*/
name: string;
};
};

export type AiToolCallResponse = string;

export type AiToolCallError = unknown;

export type SearchComponentDepsData = {
query?: {
/**
Expand Down

0 comments on commit 01acacb

Please sign in to comment.