cloudcruise 0.0.2 → 0.0.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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/webhook/WebhookClient.d.ts +11 -2
- package/dist/webhook/WebhookClient.js +9 -5
- package/dist/webhook/types.d.ts +108 -6
- package/dist/webhook/types.js +13 -0
- package/dist/webhook/utils.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { WebhookClient } from './webhook/WebhookClient.js';
|
|
|
11
11
|
export type { VaultEntry, GetVaultEntriesFilters, ProxyConfig, VaultPostPutHeadersInBody } from './vault/types.js';
|
|
12
12
|
export type { Workflow, WorkflowInputSchema, WorkflowMetadata } from './workflows/types.js';
|
|
13
13
|
export type { EventType, DryRun, Metadata, RunSpecificWebhook, PayloadWebhook, StartRunRequest, StartRunResponse, UserInteractionData, VideoUrl, SignedFileUrl, SignedScreenshotUrl, RunError, WorkflowError, RunResult, GetRunResult, WebhookEvent, WebhookReplayResponse, RunHandle, RunStreamOptions, SseEventName, SseMessage, RunEventEnvelope } from './runs/types.js';
|
|
14
|
+
export { WebhookEventType } from './webhook/types.js';
|
|
14
15
|
export type { WebhookPayload, WebhookVerificationOptions } from './webhook/types.js';
|
|
15
16
|
export { VerificationError } from './webhook/types.js';
|
|
16
17
|
export { InputValidationError } from './workflows/types.js';
|
package/dist/index.js
CHANGED
|
@@ -7,5 +7,6 @@ export { VaultClient } from './vault/VaultClient.js';
|
|
|
7
7
|
export { WorkflowsClient } from './workflows/WorkflowsClient.js';
|
|
8
8
|
export { RunsClient } from './runs/RunsClient.js';
|
|
9
9
|
export { WebhookClient } from './webhook/WebhookClient.js';
|
|
10
|
+
export { WebhookEventType } from './webhook/types.js';
|
|
10
11
|
export { VerificationError } from './webhook/types.js';
|
|
11
12
|
export { InputValidationError } from './workflows/types.js';
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type { WebhookPayload, WebhookVerificationOptions } from './types.js';
|
|
1
|
+
import type { WebhookEventType, WebhookPayload, WebhookVerificationOptions } from './types.js';
|
|
2
2
|
export declare class WebhookClient {
|
|
3
3
|
constructor();
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Verifies the signature of an incoming webhook payload.
|
|
6
|
+
*
|
|
7
|
+
* @param receivedData - Raw request body supplied by the webhook sender.
|
|
8
|
+
* @param receivedSignature - Value from the `x-hmac-signature` request header. e.g req.headers["x-hmac-signature"]
|
|
9
|
+
* @param secretKey - Webhook secret configured in the CloudCruise portal.
|
|
10
|
+
* @param options - Optional overrides controlling signature verification behavior.
|
|
11
|
+
* @returns Verified webhook payload when the signature matches.
|
|
12
|
+
*/
|
|
13
|
+
verifySignature<E extends WebhookEventType = WebhookEventType>(receivedData: any, receivedSignature: string, secretKey: string, options?: WebhookVerificationOptions): WebhookPayload<E>;
|
|
5
14
|
}
|
|
@@ -3,11 +3,15 @@ export class WebhookClient {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
// No makeRequest needed for webhook verification
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Verifies the signature of an incoming webhook payload.
|
|
8
|
+
*
|
|
9
|
+
* @param receivedData - Raw request body supplied by the webhook sender.
|
|
10
|
+
* @param receivedSignature - Value from the `x-hmac-signature` request header. e.g req.headers["x-hmac-signature"]
|
|
11
|
+
* @param secretKey - Webhook secret configured in the CloudCruise portal.
|
|
12
|
+
* @param options - Optional overrides controlling signature verification behavior.
|
|
13
|
+
* @returns Verified webhook payload when the signature matches.
|
|
14
|
+
*/
|
|
11
15
|
verifySignature(receivedData, receivedSignature, secretKey, options) {
|
|
12
16
|
return verifyMessage(receivedData, receivedSignature, secretKey, options);
|
|
13
17
|
}
|
package/dist/webhook/types.d.ts
CHANGED
|
@@ -1,13 +1,115 @@
|
|
|
1
|
-
import { EventType } from "../runs/types";
|
|
2
1
|
export declare class VerificationError extends Error {
|
|
3
2
|
readonly statusCode: number;
|
|
4
3
|
constructor(message?: string, statusCode?: number);
|
|
5
4
|
}
|
|
6
|
-
export interface WebhookPayload {
|
|
7
|
-
event: EventType;
|
|
8
|
-
expires_at: number;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
5
|
export interface WebhookVerificationOptions {
|
|
12
6
|
allowExpired?: boolean;
|
|
13
7
|
}
|
|
8
|
+
export declare enum WebhookEventType {
|
|
9
|
+
ExecutionQueued = "execution.queued",
|
|
10
|
+
ExecutionStart = "execution.start",
|
|
11
|
+
ExecutionStep = "execution.step",
|
|
12
|
+
InteractionWaiting = "interaction.waiting",
|
|
13
|
+
InteractionFinished = "interaction.finished",
|
|
14
|
+
AgentErrorAnalysis = "agent.error_analysis",
|
|
15
|
+
ExecutionRequeued = "execution.requeued",
|
|
16
|
+
ExecutionSuccess = "execution.success",
|
|
17
|
+
ExecutionFailed = "execution.failed",
|
|
18
|
+
ExecutionStopped = "execution.stopped"
|
|
19
|
+
}
|
|
20
|
+
export interface ExecutionQueuedPayload {
|
|
21
|
+
session_id: string;
|
|
22
|
+
workflow_id: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ExecutionStartPayload {
|
|
25
|
+
session_id: string;
|
|
26
|
+
workflow_id: string;
|
|
27
|
+
live_view_url?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ExecutionStepPayload {
|
|
30
|
+
session_id: string;
|
|
31
|
+
workflow_id: string;
|
|
32
|
+
current_step: string;
|
|
33
|
+
next_step: string;
|
|
34
|
+
}
|
|
35
|
+
export interface InteractionWaitingPayload {
|
|
36
|
+
session_id: string;
|
|
37
|
+
workflow_id: string;
|
|
38
|
+
current_step: string;
|
|
39
|
+
missing_properties: string[];
|
|
40
|
+
expected_json_schema_datamodel: Record<string, any>;
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
export type InteractionFinishedPayload = {
|
|
44
|
+
session_id: string;
|
|
45
|
+
workflow_id: string;
|
|
46
|
+
current_step: string;
|
|
47
|
+
missing_properties: [];
|
|
48
|
+
expected_json_schema_datamodel: Record<string, any>;
|
|
49
|
+
message: string;
|
|
50
|
+
} | {
|
|
51
|
+
session_id: string;
|
|
52
|
+
workflow_id: string;
|
|
53
|
+
provided_input: any;
|
|
54
|
+
message?: string;
|
|
55
|
+
expected_json_schema_datamodel: Record<string, any>;
|
|
56
|
+
};
|
|
57
|
+
export interface AgentErrorAnalysisPayload {
|
|
58
|
+
analysis_step_name: string;
|
|
59
|
+
ai_analysis?: string;
|
|
60
|
+
root_cause_analysis?: string;
|
|
61
|
+
error_category?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ExecutionRequeuedPayload {
|
|
64
|
+
session_id: string;
|
|
65
|
+
workflow_id: string;
|
|
66
|
+
retry_attempt: number;
|
|
67
|
+
max_retries?: number;
|
|
68
|
+
next_execution_time: string;
|
|
69
|
+
delay_ms: number;
|
|
70
|
+
}
|
|
71
|
+
export interface EndRunError {
|
|
72
|
+
message: string;
|
|
73
|
+
error_id: string;
|
|
74
|
+
full_url?: string;
|
|
75
|
+
created_at: string;
|
|
76
|
+
error_code?: string;
|
|
77
|
+
action_type?: string;
|
|
78
|
+
action_display_name?: string;
|
|
79
|
+
llm_error_category?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface EndRunPayload {
|
|
82
|
+
session_id: string;
|
|
83
|
+
workflow_id: string;
|
|
84
|
+
data: any;
|
|
85
|
+
input_variables: Record<string, any>;
|
|
86
|
+
errors: EndRunError[];
|
|
87
|
+
status: "execution.success" | "execution.failed" | "execution.stopped";
|
|
88
|
+
encrypted_variables: string[] | null;
|
|
89
|
+
file_urls: any[] | null;
|
|
90
|
+
}
|
|
91
|
+
export interface ExecutionStoppedEarlyPayload {
|
|
92
|
+
message: string;
|
|
93
|
+
error_code: string;
|
|
94
|
+
session_id: string;
|
|
95
|
+
}
|
|
96
|
+
export interface WebhookEnvelope<E extends WebhookEventType, P> {
|
|
97
|
+
event: E;
|
|
98
|
+
timestamp: number;
|
|
99
|
+
expires_at: number;
|
|
100
|
+
payload: P;
|
|
101
|
+
metadata?: Record<string, any>;
|
|
102
|
+
}
|
|
103
|
+
export type WebhookPayloadMap = {
|
|
104
|
+
[WebhookEventType.ExecutionQueued]: ExecutionQueuedPayload;
|
|
105
|
+
[WebhookEventType.ExecutionStart]: ExecutionStartPayload;
|
|
106
|
+
[WebhookEventType.ExecutionStep]: ExecutionStepPayload;
|
|
107
|
+
[WebhookEventType.InteractionWaiting]: InteractionWaitingPayload;
|
|
108
|
+
[WebhookEventType.InteractionFinished]: InteractionFinishedPayload;
|
|
109
|
+
[WebhookEventType.AgentErrorAnalysis]: AgentErrorAnalysisPayload;
|
|
110
|
+
[WebhookEventType.ExecutionRequeued]: ExecutionRequeuedPayload;
|
|
111
|
+
[WebhookEventType.ExecutionSuccess]: EndRunPayload;
|
|
112
|
+
[WebhookEventType.ExecutionFailed]: EndRunPayload;
|
|
113
|
+
[WebhookEventType.ExecutionStopped]: EndRunPayload | ExecutionStoppedEarlyPayload;
|
|
114
|
+
};
|
|
115
|
+
export type WebhookPayload<E extends WebhookEventType = WebhookEventType> = E extends WebhookEventType ? WebhookEnvelope<E, WebhookPayloadMap[E]> : never;
|
package/dist/webhook/types.js
CHANGED
|
@@ -6,3 +6,16 @@ export class VerificationError extends Error {
|
|
|
6
6
|
this.name = "VerificationError";
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
export var WebhookEventType;
|
|
10
|
+
(function (WebhookEventType) {
|
|
11
|
+
WebhookEventType["ExecutionQueued"] = "execution.queued";
|
|
12
|
+
WebhookEventType["ExecutionStart"] = "execution.start";
|
|
13
|
+
WebhookEventType["ExecutionStep"] = "execution.step";
|
|
14
|
+
WebhookEventType["InteractionWaiting"] = "interaction.waiting";
|
|
15
|
+
WebhookEventType["InteractionFinished"] = "interaction.finished";
|
|
16
|
+
WebhookEventType["AgentErrorAnalysis"] = "agent.error_analysis";
|
|
17
|
+
WebhookEventType["ExecutionRequeued"] = "execution.requeued";
|
|
18
|
+
WebhookEventType["ExecutionSuccess"] = "execution.success";
|
|
19
|
+
WebhookEventType["ExecutionFailed"] = "execution.failed";
|
|
20
|
+
WebhookEventType["ExecutionStopped"] = "execution.stopped";
|
|
21
|
+
})(WebhookEventType || (WebhookEventType = {}));
|
package/dist/webhook/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type WebhookPayload, type WebhookVerificationOptions } from './types.js';
|
|
2
|
-
export declare function verifyMessage(receivedData: any, receivedSignature: string, secretKey: string, options?: WebhookVerificationOptions): WebhookPayload
|
|
1
|
+
import { WebhookEventType, type WebhookPayload, type WebhookVerificationOptions } from './types.js';
|
|
2
|
+
export declare function verifyMessage<E extends WebhookEventType = WebhookEventType>(receivedData: any, receivedSignature: string, secretKey: string, options?: WebhookVerificationOptions): WebhookPayload<E>;
|