@deepbounty/sdk 1.1.5 → 1.1.7
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 +13 -3
- package/dist/index.js +1 -1
- package/dist/types/tasks.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -90,16 +90,26 @@ export interface ServerAPI {
|
|
|
90
90
|
* @param description Task description
|
|
91
91
|
* @param taskContent The task content including commands and tools
|
|
92
92
|
* @param interval Interval in seconds between task executions
|
|
93
|
+
* @param schedulingType How to schedule tasks: "TARGET_BASED" (one per target), "GLOBAL" (single instance), or "CUSTOM" (manual control)
|
|
93
94
|
* @param onComplete Optional callback executed when the task completes
|
|
94
95
|
* @returns The ID of the registered task template
|
|
95
96
|
*/
|
|
96
|
-
registerTaskTemplate(uniqueKey: string, name: string, description: string, taskContent: TaskContent, interval: number, onComplete?: (result: TaskResult) => void): Promise<number>;
|
|
97
|
+
registerTaskTemplate(uniqueKey: string, name: string, description: string, taskContent: TaskContent, interval: number, schedulingType?: "TARGET_BASED" | "GLOBAL" | "CUSTOM", onComplete?: (result: TaskResult) => void): Promise<number>;
|
|
97
98
|
/**
|
|
98
99
|
* Unregister a task template
|
|
99
100
|
* @param templateId The ID of the task template to unregister
|
|
100
101
|
* @returns true if the template was unregistered, false if it didn't exist
|
|
101
102
|
*/
|
|
102
103
|
unregisterTaskTemplate(templateId: number): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* Create a task instance manually (for CUSTOM scheduling type)
|
|
106
|
+
* @param templateId The ID of the task template
|
|
107
|
+
* @param targetId Optional target ID for this instance
|
|
108
|
+
* @param customData Optional custom data to attach to this instance (accessible via {{KEY}} placeholders)
|
|
109
|
+
* @param oneTime If true, delete the scheduled task after execution (default: false)
|
|
110
|
+
* @returns The scheduled task ID
|
|
111
|
+
*/
|
|
112
|
+
createTaskInstance(templateId: number, targetId?: number, customData?: Record<string, any>, oneTime?: boolean): Promise<number>;
|
|
103
113
|
/** Register a tool
|
|
104
114
|
* @param tool The tool to register
|
|
105
115
|
*/
|
|
@@ -117,11 +127,11 @@ export interface ServerAPI {
|
|
|
117
127
|
*/
|
|
118
128
|
createAlert(targetId: number, name: string, subdomain: string, score: number, description: string, endpoint: string, confirmed?: boolean): Promise<Alert>;
|
|
119
129
|
}
|
|
120
|
-
export interface
|
|
130
|
+
export interface ModuleLifecycle {
|
|
121
131
|
run?(api: ServerAPI): Promise<void> | void;
|
|
122
132
|
stop?(): Promise<void> | void;
|
|
123
133
|
}
|
|
124
|
-
export type
|
|
134
|
+
export type ModuleFactory = (api: ServerAPI) => ModuleLifecycle | Promise<ModuleLifecycle>;
|
|
125
135
|
export { IEventBus, EventSubscription, CoreEvents, EventHandler, } from "./events";
|
|
126
136
|
declare const _default: any;
|
|
127
137
|
export default _default;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default {}; // Type-only module for
|
|
1
|
+
export default {}; // Type-only module for modules to import types during compile
|
package/dist/types/tasks.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Tool } from "./tools";
|
|
2
|
+
export type SchedulingType = "TARGET_BASED" | "GLOBAL" | "CUSTOM";
|
|
2
3
|
export interface TaskContent {
|
|
3
4
|
commands: string[];
|
|
4
5
|
requiredTools?: Tool[];
|
|
@@ -12,6 +13,7 @@ export interface TaskTemplate {
|
|
|
12
13
|
description?: string;
|
|
13
14
|
content: TaskContent;
|
|
14
15
|
interval: number;
|
|
16
|
+
schedulingType: SchedulingType;
|
|
15
17
|
active: boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface ScheduledTask {
|
|
@@ -24,6 +26,8 @@ export interface ScheduledTask {
|
|
|
24
26
|
lastExecutedAt?: Date;
|
|
25
27
|
nextExecutionAt: Date;
|
|
26
28
|
active: boolean;
|
|
29
|
+
customData?: Record<string, any>;
|
|
30
|
+
oneTime?: boolean;
|
|
27
31
|
}
|
|
28
32
|
export interface TaskExecution {
|
|
29
33
|
executionId: number;
|
|
@@ -33,6 +37,7 @@ export interface TaskExecution {
|
|
|
33
37
|
createdAt: Date;
|
|
34
38
|
content: TaskContent;
|
|
35
39
|
targetId?: number;
|
|
40
|
+
customData?: Record<string, any>;
|
|
36
41
|
}
|
|
37
42
|
export interface TaskResult {
|
|
38
43
|
executionId: number;
|
|
@@ -41,6 +46,7 @@ export interface TaskResult {
|
|
|
41
46
|
output?: any;
|
|
42
47
|
error?: string;
|
|
43
48
|
targetId?: number;
|
|
49
|
+
customData?: Record<string, any>;
|
|
44
50
|
}
|
|
45
51
|
export interface TargetTaskOverride {
|
|
46
52
|
id: number;
|