@flashbacktech/flashbackclient 0.2.20 → 0.2.21

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.
@@ -17,7 +17,7 @@ import { SystemEventQueryRequest, SystemEventQueryResponse } from './types/platf
17
17
  import { UserUpdateRequest, UserUpdateResponse } from './types/platform/user';
18
18
  import { CreateRepoAiApiKeyRequest, CreateRepoAiApiKeyResponse, DeleteRepoAiApiKeyResponse, GetRepoAiApiKeysResponse, UpdateRepoAiApiKeyRequest, UpdateRepoAiApiKeyResponse } from './types/ai/aiapikey';
19
19
  import { AiLlmStatsResponse, CreateAiLlmRequest, CreateAiLlmResponse, DeleteAiLlmResponse, GetAiLlmsResponse, UpdateAiLlmRequest, UpdateAiLlmResponse, ValidateAiLlmResponse } from './types/ai/aillm';
20
- import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest } from './types/ai/policy';
20
+ import { CreatePolicyRequest, GetPoliciesQuery, GetPolicyViolationsQuery, GetPolicyViolationsResponse, PolicyDTO, UpdatePolicyRequest, PolicyValidationRequest, PolicyValidationResponse, PolicyRecommendationRequest, PolicyRecommendationResponse } from './types/ai/policy';
21
21
  import { CreateConversationRequest, CreateConversationResponse, SendPromptRequest, SendPromptResponse, GetConversationsRequest, GetConversationsResponse, GetConversationMessagesResponse, GetConversationMessagesRequest } from './types/ai/conversation';
22
22
  interface ErrorResponse {
23
23
  message?: string;
@@ -254,5 +254,7 @@ export declare class ApiClient implements IApiClient {
254
254
  deletePolicy: (policyId: string) => Promise<ActionResponse>;
255
255
  getPolicyViolations: (query: GetPolicyViolationsQuery) => Promise<GetPolicyViolationsResponse>;
256
256
  getPolicyViolationsByPolicyId: (policyId: string, query: Omit<GetPolicyViolationsQuery, "policyId">) => Promise<GetPolicyViolationsResponse>;
257
+ validatePolicies: (data: PolicyValidationRequest) => Promise<PolicyValidationResponse>;
258
+ recommendPolicies: (data: PolicyRecommendationRequest) => Promise<PolicyRecommendationResponse>;
257
259
  }
258
260
  export {};
@@ -652,6 +652,12 @@ class ApiClient {
652
652
  }
653
653
  return this.makeRequest(`policy/${policyId}/violations${queryParams.toString() ? `?${queryParams.toString()}` : ''}`, 'GET', null);
654
654
  };
655
+ this.validatePolicies = async (data) => {
656
+ return this.makeRequest('policy/validate', 'POST', data);
657
+ };
658
+ this.recommendPolicies = async (data) => {
659
+ return this.makeRequest('policy/recommend', 'POST', data);
660
+ };
655
661
  this.baseURL = baseURL;
656
662
  this.headers = {};
657
663
  this.debug = false;
@@ -85,3 +85,42 @@ export interface GetPolicyViolationsResponse {
85
85
  skip: number;
86
86
  take: number;
87
87
  }
88
+ export interface PolicyToValidate {
89
+ policy_uuid: string;
90
+ content: string;
91
+ }
92
+ export interface PolicyValidationRequest {
93
+ policies: PolicyToValidate[];
94
+ }
95
+ export interface Issue {
96
+ type: string;
97
+ description: string;
98
+ suggestion: string;
99
+ }
100
+ export interface PolicyValidationResult {
101
+ policy_uuid: string;
102
+ score: number;
103
+ advice: string;
104
+ issues: Issue[];
105
+ severity: "none" | "low" | "medium" | "high";
106
+ }
107
+ export interface PolicyValidationResponse {
108
+ results: PolicyValidationResult[];
109
+ }
110
+ export interface PolicyRecommendationRequest {
111
+ level: 0 | 1 | 2;
112
+ uuid?: string;
113
+ prompt: string;
114
+ }
115
+ export interface PolicyRecommendation {
116
+ content: string;
117
+ riskType: "low" | "medium" | "high";
118
+ alertType: "log" | "alert" | "block";
119
+ }
120
+ export interface PolicyRecommendationResponse {
121
+ level: 0 | 1 | 2;
122
+ uuid: string;
123
+ tokens_in: number;
124
+ tokens_out: number;
125
+ recommended_policies: PolicyRecommendation[];
126
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"