Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Class | Method | HTTP request | Description
*FunctionsAIDecompilationApi* | [**patchAiDecompilationInlineComment**](docs/FunctionsAIDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment
*FunctionsAIDecompilationApi* | [**regenerateAiDecompilationInlineComments**](docs/FunctionsAIDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments
*FunctionsAIDecompilationApi* | [**regenerateAiDecompilationSummary**](docs/FunctionsAIDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary
*FunctionsAIDecompilationApi* | [**streamAiDecompilation**](docs/FunctionsAIDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE)
*FunctionsAIDecompilationApi* | [**updateAiDecompilationComment**](docs/FunctionsAIDecompilationApi.md#updateAiDecompilationComment) | **PATCH** /v2/functions/{function_id}/ai-decompilation/comments/{comment_id} | Update a comment
*FunctionsAIDecompilationApi* | [**upsertAiDecompilationOverrides**](docs/FunctionsAIDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides
*FunctionsAIDecompilationApi* | [**upsertAiDecompilationRating**](docs/FunctionsAIDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation
Expand Down Expand Up @@ -217,6 +218,8 @@ Class | Method | HTTP request | Description
- [AppApiRestV2FunctionsTypesFunction](AppApiRestV2FunctionsTypesFunction.md)
- [AppApiRestV2InfoTypesCapability](AppApiRestV2InfoTypesCapability.md)
- [Argument](Argument.md)
- [AttemptFailedEvent](AttemptFailedEvent.md)
- [AttemptStartedEvent](AttemptStartedEvent.md)
- [AutoRunAgents](AutoRunAgents.md)
- [AutoUnstripRequest](AutoUnstripRequest.md)
- [AutoUnstripResponse](AutoUnstripResponse.md)
Expand Down Expand Up @@ -337,6 +340,9 @@ Class | Method | HTTP request | Description
- [CreateAIDecompOutputBody](CreateAIDecompOutputBody.md)
- [CreateConversationRequest](CreateConversationRequest.md)
- [Created](Created.md)
- [DebugPromptEvent](DebugPromptEvent.md)
- [DecompFailedEvent](DecompFailedEvent.md)
- [DecompFinishedEvent](DecompFinishedEvent.md)
- [DecompilationCommentContext](DecompilationCommentContext.md)
- [DecompilationData](DecompilationData.md)
- [DieMatch](DieMatch.md)
Expand All @@ -357,13 +363,22 @@ Class | Method | HTTP request | Description
- [ErrorBody](ErrorBody.md)
- [ErrorModel](ErrorModel.md)
- [Event](Event.md)
- [EventAttemptFailed](EventAttemptFailed.md)
- [EventAttemptStarted](EventAttemptStarted.md)
- [EventCONTEXTCOMPACTED](EventCONTEXTCOMPACTED.md)
- [EventDebugPrompt](EventDebugPrompt.md)
- [EventDecompFailed](EventDecompFailed.md)
- [EventDecompFinished](EventDecompFinished.md)
- [EventProse](EventProse.md)
- [EventRUNCANCELLED](EventRUNCANCELLED.md)
- [EventRUNERROR](EventRUNERROR.md)
- [EventRUNFINISHED](EventRUNFINISHED.md)
- [EventRUNSTARTED](EventRUNSTARTED.md)
- [EventRenameApplied](EventRenameApplied.md)
- [EventSTEPFINISHED](EventSTEPFINISHED.md)
- [EventSTEPSTARTED](EventSTEPSTARTED.md)
- [EventSourceDelta](EventSourceDelta.md)
- [EventSourceReset](EventSourceReset.md)
- [EventTEXTMESSAGECONTENT](EventTEXTMESSAGECONTENT.md)
- [EventTEXTMESSAGEEND](EventTEXTMESSAGEEND.md)
- [EventTEXTMESSAGESTART](EventTEXTMESSAGESTART.md)
Expand All @@ -373,6 +388,7 @@ Class | Method | HTTP request | Description
- [EventTOOLCALLRESULT](EventTOOLCALLRESULT.md)
- [EventTOOLCALLSTART](EventTOOLCALLSTART.md)
- [EventTOOLCONFIRMATIONREQUIRED](EventTOOLCONFIRMATIONREQUIRED.md)
- [EventWarning](EventWarning.md)
- [ExportModel](ExportModel.md)
- [ExternalResponse](ExternalResponse.md)
- [ExtractedURL](ExtractedURL.md)
Expand Down Expand Up @@ -465,6 +481,7 @@ Class | Method | HTTP request | Description
- [ProcessNode](ProcessNode.md)
- [ProcessTree](ProcessTree.md)
- [ProgressMessage](ProgressMessage.md)
- [ProseEvent](ProseEvent.md)
- [PutAnalysisStringsRequest](PutAnalysisStringsRequest.md)
- [QueuePositionResponse](QueuePositionResponse.md)
- [QueuedWorkflowTaskResponse](QueuedWorkflowTaskResponse.md)
Expand All @@ -474,6 +491,7 @@ Class | Method | HTTP request | Description
- [RegenerateTarget](RegenerateTarget.md)
- [RegistryOperation](RegistryOperation.md)
- [RelativeBinaryResponse](RelativeBinaryResponse.md)
- [RenameAppliedEvent](RenameAppliedEvent.md)
- [RenameInputBody](RenameInputBody.md)
- [RenameOutputBody](RenameOutputBody.md)
- [ReplacementValue](ReplacementValue.md)
Expand All @@ -497,6 +515,8 @@ Class | Method | HTTP request | Description
- [SingleCodeSignatureModel](SingleCodeSignatureModel.md)
- [SinglePDBEntryModel](SinglePDBEntryModel.md)
- [SingleSectionModel](SingleSectionModel.md)
- [SourceDeltaEvent](SourceDeltaEvent.md)
- [SourceResetEvent](SourceResetEvent.md)
- [SseEventContextCompactedData](SseEventContextCompactedData.md)
- [SseEventRunCancelledData](SseEventRunCancelledData.md)
- [SseEventRunErrorData](SseEventRunErrorData.md)
Expand All @@ -518,6 +538,7 @@ Class | Method | HTTP request | Description
- [StatusInput](StatusInput.md)
- [StatusOutput](StatusOutput.md)
- [StatusResponse](StatusResponse.md)
- [StreamAiDecompilation200ResponseInner](StreamAiDecompilation200ResponseInner.md)
- [StreamEvents200ResponseInner](StreamEvents200ResponseInner.md)
- [StringFunctions](StringFunctions.md)
- [StringSource](StringSource.md)
Expand Down Expand Up @@ -549,6 +570,7 @@ Class | Method | HTTP request | Description
- [UserActivityResponse](UserActivityResponse.md)
- [Vulnerabilities](Vulnerabilities.md)
- [Vulnerability](Vulnerability.md)
- [WarningEvent](WarningEvent.md)
- [WorkflowProgress](WorkflowProgress.md)
- [Workspace](Workspace.md)
- [XrefFromResponse](XrefFromResponse.md)
Expand Down
75 changes: 75 additions & 0 deletions apis/FunctionsAIDecompilationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { FunctionCommentCreateRequest } from '../models/FunctionCommentCreateReq
import { PatchCommentBody } from '../models/PatchCommentBody';
import { RegenerateOutputBody } from '../models/RegenerateOutputBody';
import { RegenerateTarget } from '../models/RegenerateTarget';
import { StreamAiDecompilation200ResponseInner } from '../models/StreamAiDecompilation200ResponseInner';
import { SummaryData } from '../models/SummaryData';
import { TokenisedData } from '../models/TokenisedData';
import { UpsertAiDecomplationRatingRequest } from '../models/UpsertAiDecomplationRatingRequest';
Expand Down Expand Up @@ -852,6 +853,44 @@ export class FunctionsAIDecompilationApiRequestFactory extends BaseAPIRequestFac
return requestContext;
}

/**
* Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal β€” Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported β€” clients fall back to polling the standard GET endpoint after the stream ends.
* Stream live AI decompilation output (SSE)
* @param functionId Function ID
*/
public async streamAiDecompilation(functionId: number, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'functionId' is not null or undefined
if (functionId === null || functionId === undefined) {
throw new RequiredError("FunctionsAIDecompilationApi", "streamAiDecompilation", "functionId");
}


// Path Params
const localVarPath = '/v3/functions/{function_id}/ai-decompilation/events'
.replace('{' + 'function_id' + '}', encodeURIComponent(String(functionId)));

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["APIKey"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _config?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Updates the content of an existing comment. Users can only update their own comments.
* Update a comment
Expand Down Expand Up @@ -2037,6 +2076,42 @@ export class FunctionsAIDecompilationApiResponseProcessor {
throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to streamAiDecompilation
* @throws ApiException if the response code was not in [200, 299]
*/
public async streamAiDecompilationWithHttpInfo(response: ResponseContext): Promise<HttpInfo<Array<StreamAiDecompilation200ResponseInner> >> {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Array<StreamAiDecompilation200ResponseInner> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<StreamAiDecompilation200ResponseInner>", ""
) as Array<StreamAiDecompilation200ResponseInner>;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (isCodeInRange("0", response.httpStatusCode)) {
const body: APIError = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"APIError", ""
) as APIError;
throw new ApiException<APIError>(response.httpStatusCode, "Error", body, response.headers);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: Array<StreamAiDecompilation200ResponseInner> = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Array<StreamAiDecompilation200ResponseInner>", ""
) as Array<StreamAiDecompilation200ResponseInner>;
return new HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}

throw new ApiException<string | Blob | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down
55 changes: 55 additions & 0 deletions docs/FunctionsAIDecompilationApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Method | HTTP request | Description
[**patchAiDecompilationInlineComment**](FunctionsAIDecompilationApi.md#patchAiDecompilationInlineComment) | **PATCH** /v3/functions/{function_id}/ai-decompilation/inline-comments | Update a single inline comment
[**regenerateAiDecompilationInlineComments**](FunctionsAIDecompilationApi.md#regenerateAiDecompilationInlineComments) | **POST** /v3/functions/{function_id}/ai-decompilation/inline-comments | Regenerate AI decompilation inline comments
[**regenerateAiDecompilationSummary**](FunctionsAIDecompilationApi.md#regenerateAiDecompilationSummary) | **POST** /v3/functions/{function_id}/ai-decompilation/summary | Regenerate AI decompilation summary
[**streamAiDecompilation**](FunctionsAIDecompilationApi.md#streamAiDecompilation) | **GET** /v3/functions/{function_id}/ai-decompilation/events | Stream live AI decompilation output (SSE)
[**updateAiDecompilationComment**](FunctionsAIDecompilationApi.md#updateAiDecompilationComment) | **PATCH** /v2/functions/{function_id}/ai-decompilation/comments/{comment_id} | Update a comment
[**upsertAiDecompilationOverrides**](FunctionsAIDecompilationApi.md#upsertAiDecompilationOverrides) | **PATCH** /v3/functions/{function_id}/ai-decompilation/overrides | Upsert variable/function name overrides
[**upsertAiDecompilationRating**](FunctionsAIDecompilationApi.md#upsertAiDecompilationRating) | **PATCH** /v2/functions/{function_id}/ai-decompilation/rating | Upsert rating for AI decompilation
Expand Down Expand Up @@ -1133,6 +1134,60 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

# **streamAiDecompilation**
> Array<StreamAiDecompilation200ResponseInner> streamAiDecompilation()

Opens a Server-Sent Events stream of incremental decompilation events for the given function. Each event has a `type` discriminator (also used as the SSE `event:` line) and a per-attempt monotonic `seq`. Terminal events: `decomp_finished` (success) or `decomp_failed` (all retries exhausted). `attempt_failed` is per-attempt and non-terminal β€” Temporal may retry the activity. Clients should treat `attempt` changes as a reset signal. `last_event_id` is not supported β€” clients fall back to polling the standard GET endpoint after the stream ends.

### Example


```typescript
import { createConfiguration, FunctionsAIDecompilationApi } from '@revengai/sdk';
import type { FunctionsAIDecompilationApiStreamAiDecompilationRequest } from '@revengai/sdk';

const configuration = createConfiguration();
const apiInstance = new FunctionsAIDecompilationApi(configuration);

const request: FunctionsAIDecompilationApiStreamAiDecompilationRequest = {
// Function ID
functionId: 1,
};

const data = await apiInstance.streamAiDecompilation(request);
console.log('API called successfully. Returned data:', data);
```


### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**functionId** | [**number**] | Function ID | defaults to undefined


### Return type

**Array<StreamAiDecompilation200ResponseInner>**

### Authorization

[APIKey](README.md#APIKey)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: text/event-stream, application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | OK | - |
**0** | Error | - |

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

# **updateAiDecompilationComment**
> BaseResponseCommentResponse updateAiDecompilationComment(commentUpdateRequest)

Expand Down
56 changes: 56 additions & 0 deletions models/AttemptFailedEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* RevEng.AI API
* RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal.
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';

export class AttemptFailedEvent {
'attempt': number;
'error': string;
'seq': number;
'type': string;

static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "attempt",
"baseName": "attempt",
"type": "number",
"format": "int32"
},
{
"name": "error",
"baseName": "error",
"type": "string",
"format": ""
},
{
"name": "seq",
"baseName": "seq",
"type": "number",
"format": "int32"
},
{
"name": "type",
"baseName": "type",
"type": "string",
"format": ""
} ];

static getAttributeTypeMap() {
return AttemptFailedEvent.attributeTypeMap;
}

public constructor() {
}
}
49 changes: 49 additions & 0 deletions models/AttemptStartedEvent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* RevEng.AI API
* RevEng.AI is an AI-powered binary analysis platform for reverse engineering and malware analysis. It provides similarity search across executable binaries and functions, AI-driven decompilation, dynamic execution analysis, firmware unpacking, and integration with external threat intelligence sources like VirusTotal.
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';

export class AttemptStartedEvent {
'attempt': number;
'seq': number;
'type': string;

static readonly discriminator: string | undefined = undefined;

static readonly mapping: {[index: string]: string} | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "attempt",
"baseName": "attempt",
"type": "number",
"format": "int32"
},
{
"name": "seq",
"baseName": "seq",
"type": "number",
"format": "int32"
},
{
"name": "type",
"baseName": "type",
"type": "string",
"format": ""
} ];

static getAttributeTypeMap() {
return AttemptStartedEvent.attributeTypeMap;
}

public constructor() {
}
}
Loading