adspower-browser 2.1.5 → 2.1.6-beta.0
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/cli/index.js +1384 -8
- package/package.json +1 -1
package/cli/index.js
CHANGED
|
@@ -477,6 +477,7 @@ function parseArgs() {
|
|
|
477
477
|
const args = process.argv;
|
|
478
478
|
let port;
|
|
479
479
|
let apiKey;
|
|
480
|
+
let rpaPort;
|
|
480
481
|
for (let i = 0; i < args.length; i++) {
|
|
481
482
|
if (args[i] === "--port" && i + 1 < args.length) {
|
|
482
483
|
port = args[i + 1];
|
|
@@ -484,22 +485,30 @@ function parseArgs() {
|
|
|
484
485
|
if (args[i] === "--api-key" && i + 1 < args.length) {
|
|
485
486
|
apiKey = args[i + 1];
|
|
486
487
|
}
|
|
488
|
+
if ((args[i] === "--rpa-port" || args[i] === "-rp") && i + 1 < args.length) {
|
|
489
|
+
rpaPort = args[i + 1];
|
|
490
|
+
}
|
|
487
491
|
}
|
|
488
492
|
return {
|
|
489
493
|
port: port || process.env.PORT || "50325",
|
|
490
|
-
apiKey: apiKey || process.env.API_KEY
|
|
494
|
+
apiKey: apiKey || process.env.API_KEY,
|
|
495
|
+
rpaPort: rpaPort || process.env.RPA_PORT || "20409"
|
|
491
496
|
};
|
|
492
497
|
}
|
|
493
498
|
var config = parseArgs();
|
|
494
|
-
var updateConfig = (apiKey, port) => {
|
|
499
|
+
var updateConfig = (apiKey, port, rpaPort) => {
|
|
495
500
|
if (apiKey) {
|
|
496
501
|
config.apiKey = apiKey;
|
|
497
502
|
}
|
|
498
503
|
if (port) {
|
|
499
504
|
config.port = port;
|
|
500
505
|
}
|
|
506
|
+
if (rpaPort) {
|
|
507
|
+
config.rpaPort = rpaPort;
|
|
508
|
+
}
|
|
501
509
|
};
|
|
502
510
|
var PORT = config.port;
|
|
511
|
+
var RPA_PORT = config.rpaPort;
|
|
503
512
|
var API_KEY = config.apiKey;
|
|
504
513
|
var CONFIG = config;
|
|
505
514
|
|
|
@@ -2830,10 +2839,1346 @@ var schemas = {
|
|
|
2830
2839
|
}).strict()
|
|
2831
2840
|
};
|
|
2832
2841
|
|
|
2833
|
-
// src/
|
|
2834
|
-
var
|
|
2842
|
+
// ../core/src/rpa/local/handlers.ts
|
|
2843
|
+
var import_axios3 = __toESM(require("axios"));
|
|
2835
2844
|
|
|
2836
|
-
// src/
|
|
2845
|
+
// ../core/src/rpa/local/fileTransport.ts
|
|
2846
|
+
var import_promises = require("fs/promises");
|
|
2847
|
+
var import_node_path = require("path");
|
|
2848
|
+
var import_node_zlib = require("zlib");
|
|
2849
|
+
var MAX_FLOW_BYTES = 32 * 1024 * 1024;
|
|
2850
|
+
async function readDebugProcess(filePath) {
|
|
2851
|
+
if (!(0, import_node_path.isAbsolute)(filePath)) throw new Error("process_file must be an absolute local path");
|
|
2852
|
+
const file = await (0, import_promises.open)(filePath, "r");
|
|
2853
|
+
let bytes;
|
|
2854
|
+
try {
|
|
2855
|
+
const stat = await file.stat();
|
|
2856
|
+
if (!stat.isFile() || stat.size > MAX_FLOW_BYTES) throw new Error("process_file must be a regular file no larger than 32 MiB");
|
|
2857
|
+
bytes = await file.readFile();
|
|
2858
|
+
} finally {
|
|
2859
|
+
await file.close();
|
|
2860
|
+
}
|
|
2861
|
+
if (filePath.endsWith(".gz")) bytes = (0, import_node_zlib.gunzipSync)(bytes, { maxOutputLength: MAX_FLOW_BYTES });
|
|
2862
|
+
const process2 = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
2863
|
+
let flow;
|
|
2864
|
+
try {
|
|
2865
|
+
flow = JSON.parse(process2);
|
|
2866
|
+
} catch {
|
|
2867
|
+
throw new Error("process_file must contain valid flow JSON");
|
|
2868
|
+
}
|
|
2869
|
+
if (!flow || typeof flow !== "object" || !("nodes" in flow) || !Array.isArray(flow.nodes) || !("edges" in flow) || !Array.isArray(flow.edges)) throw new Error("process_file must contain nodes and edges arrays");
|
|
2870
|
+
return process2;
|
|
2871
|
+
}
|
|
2872
|
+
async function writeRpaLogResult(data, outputFile) {
|
|
2873
|
+
if (!outputFile) return JSON.stringify(data, null, 2);
|
|
2874
|
+
if (!(0, import_node_path.isAbsolute)(outputFile)) throw new Error("output_file must be an absolute local path");
|
|
2875
|
+
await (0, import_promises.writeFile)(outputFile, JSON.stringify(data), { flag: "wx", mode: 384 });
|
|
2876
|
+
const result = Array.isArray(data) ? { total_items: data.length, items: data.slice(0, 10).map(summarizeLog), next_offset: data.length > 10 ? 10 : null } : summarizeLog(data);
|
|
2877
|
+
return JSON.stringify({ output_file: outputFile, ...result }, null, 2);
|
|
2878
|
+
}
|
|
2879
|
+
function summarizeLog(data) {
|
|
2880
|
+
const summary = {};
|
|
2881
|
+
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
2882
|
+
for (const key of ["id", "status", "task_id", "process_id", "acc_id", "fbcc_id", "start_time", "end_time", "update_time", "reason"]) {
|
|
2883
|
+
const value = Reflect.get(data, key);
|
|
2884
|
+
if (typeof value === "string") summary[key] = value.slice(0, 500);
|
|
2885
|
+
else if (typeof value === "number" || value === null) summary[key] = value;
|
|
2886
|
+
}
|
|
2887
|
+
const logs = Reflect.get(data, "logs");
|
|
2888
|
+
if (typeof logs === "string") summary.log_characters = logs.length;
|
|
2889
|
+
else if (Array.isArray(logs)) summary.log_entries = logs.length;
|
|
2890
|
+
}
|
|
2891
|
+
return summary;
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
// ../core/src/rpa/local/api.ts
|
|
2895
|
+
function getRpaApiBase() {
|
|
2896
|
+
const { rpaPort } = CONFIG;
|
|
2897
|
+
if (!rpaPort || !/^\d+$/.test(rpaPort) || Number(rpaPort) < 1 || Number(rpaPort) > 65535) {
|
|
2898
|
+
throw new Error("Please specify a valid RPA Plus port (1-65535) using -rp or --rpa-port");
|
|
2899
|
+
}
|
|
2900
|
+
return `http://127.0.0.1:${rpaPort}`;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
// ../core/src/rpa/local/schemas.ts
|
|
2904
|
+
var import_zod5 = require("zod");
|
|
2905
|
+
|
|
2906
|
+
// ../core/src/rpa/pagination.ts
|
|
2907
|
+
var import_zod2 = require("zod");
|
|
2908
|
+
var rpaPageSizeSchema = import_zod2.z.union([import_zod2.z.literal(10), import_zod2.z.literal(20), import_zod2.z.literal(50), import_zod2.z.literal(100)]).default(10).describe("Items per page; allowed values: 10, 20, 50, 100. Defaults to 10.");
|
|
2909
|
+
|
|
2910
|
+
// ../core/src/rpa/flowSchemas.ts
|
|
2911
|
+
var import_zod3 = require("zod");
|
|
2912
|
+
var RefType = /* @__PURE__ */ ((RefType2) => {
|
|
2913
|
+
RefType2["CREATE"] = "0";
|
|
2914
|
+
RefType2["SHARE"] = "1";
|
|
2915
|
+
RefType2["COPY"] = "2";
|
|
2916
|
+
RefType2["MARKETPLACE"] = "3";
|
|
2917
|
+
RefType2["OLD_RPA"] = "4";
|
|
2918
|
+
RefType2["PAY_MARKETPLACE"] = "5";
|
|
2919
|
+
RefType2["GET_COPY"] = "6";
|
|
2920
|
+
RefType2["NEW_MARKETPLACE"] = "7";
|
|
2921
|
+
RefType2["AI_AGENT"] = "8";
|
|
2922
|
+
return RefType2;
|
|
2923
|
+
})(RefType || {});
|
|
2924
|
+
var flowRefTypeSchema = import_zod3.z.union([import_zod3.z.enum(RefType), import_zod3.z.number().int().min(0).max(8)]).describe("Process source: 0 creation, 1 share, 2 copy, 3 legacy Template Store, 4 legacy RPA migration, 5 paid Template Store template, 6 received copy, 7 new Template Store, 8 AI Agent Local API. Accepts a numeric value or its string representation.");
|
|
2925
|
+
var flowNameSchema = import_zod3.z.string().min(1).max(100).describe("Process name, up to 100 characters.");
|
|
2926
|
+
var flowVariablesSchema = import_zod3.z.string().refine((value) => {
|
|
2927
|
+
if (Buffer.byteLength(value, "utf8") > 1048576) return false;
|
|
2928
|
+
try {
|
|
2929
|
+
const variables = JSON.parse(value);
|
|
2930
|
+
return Array.isArray(variables) && variables.length <= 1e3 && variables.every((item) => item && typeof item.key === "string" && item.key.length <= 32 && typeof (item.val ?? item.value) === "string" && (item.val ?? item.value).length <= 1e3);
|
|
2931
|
+
} catch {
|
|
2932
|
+
return false;
|
|
2933
|
+
}
|
|
2934
|
+
}, "variable must be a JSON array of at most 1000 variables, up to 1MB UTF-8, with key <=32 and val/value <=1000 characters.").optional().describe("Global variables encoded as JSON, up to 1MB UTF-8 and 1000 variables.");
|
|
2935
|
+
|
|
2936
|
+
// ../core/src/rpa/settings.ts
|
|
2937
|
+
var import_zod4 = require("zod");
|
|
2938
|
+
var DEFAULT_RPA_SETTINGS = Object.freeze({
|
|
2939
|
+
exceptHandle: "skip",
|
|
2940
|
+
close_browser: "auto",
|
|
2941
|
+
save_tab: "0",
|
|
2942
|
+
use_headless: "false",
|
|
2943
|
+
disable_password_filling: "false",
|
|
2944
|
+
clear_cache_after_closing: "false",
|
|
2945
|
+
enable_password_saving: "false",
|
|
2946
|
+
launch_args: "",
|
|
2947
|
+
task_timeout: 0,
|
|
2948
|
+
delay_exec: 0
|
|
2949
|
+
});
|
|
2950
|
+
var rpaSettingsObjectSchema = import_zod4.z.object({
|
|
2951
|
+
exceptHandle: import_zod4.z.enum(["skip", "interrupt"]).optional().describe("Error handling: skip continues after an error; interrupt stops the process. Defaults to skip."),
|
|
2952
|
+
close_browser: import_zod4.z.enum(["auto", "manual"]).optional().describe("Browser closure after completion: auto closes automatically; manual keeps the browser open. Defaults to auto."),
|
|
2953
|
+
save_tab: import_zod4.z.enum(["0", "1"]).optional().describe("Tabs after completion: string 0 clears tabs; string 1 preserves them. Defaults to 0."),
|
|
2954
|
+
use_headless: import_zod4.z.enum(["true", "false"]).optional().describe("Use a browser without a graphical interface. String true or false; defaults to false."),
|
|
2955
|
+
disable_password_filling: import_zod4.z.enum(["true", "false"]).optional().describe("Disable autofill of saved accounts and passwords. String true or false; defaults to false."),
|
|
2956
|
+
clear_cache_after_closing: import_zod4.z.enum(["true", "false"]).optional().describe("Clear browser cache when closing. String true or false; defaults to false."),
|
|
2957
|
+
enable_password_saving: import_zod4.z.enum(["true", "false"]).optional().describe("Allow the browser to save login passwords. String true or false; defaults to false."),
|
|
2958
|
+
launch_args: import_zod4.z.string().max(300).optional().describe("Browser launch arguments, one per line, up to 300 characters. Defaults to an empty string."),
|
|
2959
|
+
task_timeout: import_zod4.z.number().int().min(0).max(864e3).optional().describe("Task timeout in whole seconds, from 0 to 864000. Defaults to 0 (no timeout)."),
|
|
2960
|
+
delay_exec: import_zod4.z.number().int().min(0).max(1440).optional().describe("Execution delay in whole minutes, from 0 to 1440. Defaults to 0 (no delay).")
|
|
2961
|
+
}).strict();
|
|
2962
|
+
var rpaSettingsJsonSchema = import_zod4.z.string().superRefine((value, ctx) => {
|
|
2963
|
+
let parsed;
|
|
2964
|
+
try {
|
|
2965
|
+
parsed = JSON.parse(value);
|
|
2966
|
+
} catch {
|
|
2967
|
+
ctx.addIssue({ code: "custom", message: "setting must be a valid JSON string." });
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2970
|
+
const result = rpaSettingsObjectSchema.safeParse(parsed);
|
|
2971
|
+
if (!result.success) {
|
|
2972
|
+
for (const issue of result.error.issues) {
|
|
2973
|
+
ctx.addIssue({ code: "custom", message: `setting.${issue.path.join(".")}: ${issue.message}` });
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}).describe("Process settings encoded as JSON. Allowed fields: exceptHandle (skip/interrupt), close_browser (auto/manual), save_tab (string 0/1), use_headless/disable_password_filling/clear_cache_after_closing/enable_password_saving (string true/false), launch_args (up to 300 characters), task_timeout (integer seconds, 0-864000), delay_exec (integer minutes, 0-1440). Unknown fields are rejected.");
|
|
2977
|
+
var rpaCreateSettingsJsonSchema = rpaSettingsJsonSchema.default(JSON.stringify(DEFAULT_RPA_SETTINGS)).describe(`${rpaSettingsJsonSchema.description} Omit setting on creation to use the complete default configuration; explicitly supplied settings are not filled with defaults.`);
|
|
2978
|
+
|
|
2979
|
+
// ../core/src/rpa/local/schemas.ts
|
|
2980
|
+
var historyPagination = {
|
|
2981
|
+
page: import_zod5.z.number().int().positive().optional().describe("Page number, starting at 1; defaults to 1 on the service."),
|
|
2982
|
+
page_size: rpaPageSizeSchema
|
|
2983
|
+
};
|
|
2984
|
+
var taskOrProcessShape = {
|
|
2985
|
+
task_id: import_zod5.z.string().trim().min(1).optional().describe("Task ID. Provide task_id or process_id; the service uses task_id if both are supplied."),
|
|
2986
|
+
process_id: import_zod5.z.string().trim().min(1).optional().describe("Process ID used to query profile execution items across tasks for this process.")
|
|
2987
|
+
};
|
|
2988
|
+
function historyFilterSchema(fields) {
|
|
2989
|
+
const condition = import_zod5.z.object({
|
|
2990
|
+
field: import_zod5.z.enum(fields),
|
|
2991
|
+
op: import_zod5.z.enum(["like", "eq", "=", "ne", "!=", "gt", ">", "gte", ">=", "lt", "<", "lte", "<=", "in", "not_in", "is_null", "is_not_null"]),
|
|
2992
|
+
val: import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number(), import_zod5.z.boolean(), import_zod5.z.null(), import_zod5.z.array(import_zod5.z.union([import_zod5.z.string(), import_zod5.z.number()]))])
|
|
2993
|
+
}).strict();
|
|
2994
|
+
const filter = import_zod5.z.object({ and: import_zod5.z.array(condition).optional(), or: import_zod5.z.array(condition).optional() }).strict();
|
|
2995
|
+
return import_zod5.z.string().refine((value) => {
|
|
2996
|
+
try {
|
|
2997
|
+
return filter.safeParse(JSON.parse(value)).success;
|
|
2998
|
+
} catch {
|
|
2999
|
+
return false;
|
|
3000
|
+
}
|
|
3001
|
+
}, "filter must be a valid JSON string with and/or condition arrays and allowed fields.").describe(
|
|
3002
|
+
`Filter encoded as JSON, for example {"and":[{"field":"status","op":"eq","val":"COMPLETE"}]}; allowed fields: ${fields.join(", ")}`
|
|
3003
|
+
);
|
|
3004
|
+
}
|
|
3005
|
+
var recordFilterSchema = historyFilterSchema([
|
|
3006
|
+
"id",
|
|
3007
|
+
"task_id",
|
|
3008
|
+
"task_name",
|
|
3009
|
+
"process_id",
|
|
3010
|
+
"process_name",
|
|
3011
|
+
"task_type",
|
|
3012
|
+
"profile_count",
|
|
3013
|
+
"status",
|
|
3014
|
+
"start_time",
|
|
3015
|
+
"end_time",
|
|
3016
|
+
"create_time",
|
|
3017
|
+
"update_time"
|
|
3018
|
+
]);
|
|
3019
|
+
var itemFilterSchema = historyFilterSchema([
|
|
3020
|
+
"id",
|
|
3021
|
+
"record_id",
|
|
3022
|
+
"task_id",
|
|
3023
|
+
"process_id",
|
|
3024
|
+
"process_name",
|
|
3025
|
+
"fbcc_id",
|
|
3026
|
+
"acc_id",
|
|
3027
|
+
"status",
|
|
3028
|
+
"start_time",
|
|
3029
|
+
"end_time",
|
|
3030
|
+
"create_time",
|
|
3031
|
+
"update_time"
|
|
3032
|
+
]);
|
|
3033
|
+
var rpaSchemas = {
|
|
3034
|
+
readExcelFieldsSchema: import_zod5.z.object({
|
|
3035
|
+
file_path: import_zod5.z.string().min(1).describe("Excel file path accessible to the computer running RPA.")
|
|
3036
|
+
}).strict(),
|
|
3037
|
+
readTextListSchema: import_zod5.z.object({
|
|
3038
|
+
file_path: import_zod5.z.string().min(1).describe("Local text file path.")
|
|
3039
|
+
}).strict(),
|
|
3040
|
+
checkEmailSchema: import_zod5.z.object({
|
|
3041
|
+
user: import_zod5.z.string().min(1).describe("Email login account."),
|
|
3042
|
+
password: import_zod5.z.string().min(1).describe("Password or app password; required even when OAuth parameters are supplied."),
|
|
3043
|
+
imapHost: import_zod5.z.string().min(1).describe("IMAP server address."),
|
|
3044
|
+
port: import_zod5.z.string().optional().describe("IMAP port as a string; the mail service defaults to 993."),
|
|
3045
|
+
status: import_zod5.z.string().optional().describe("IMAP status filter, converted to uppercase; defaults to UNSEEN."),
|
|
3046
|
+
subject: import_zod5.z.string().optional().describe("Email subject filter."),
|
|
3047
|
+
from: import_zod5.z.string().optional().describe("Sender filter."),
|
|
3048
|
+
mailTo: import_zod5.z.string().optional().describe("Recipient filter."),
|
|
3049
|
+
dateType: import_zod5.z.enum(["today", "yestoday", "7days", "30days"]).optional().describe("Date filter: today, yesterday, last 7 days, or last 30 days. The service uses the spelling yestoday."),
|
|
3050
|
+
keyword: import_zod5.z.string().optional().describe("Email TEXT search keyword."),
|
|
3051
|
+
reg: import_zod5.z.string().optional().describe("Regular expression for extracting message content."),
|
|
3052
|
+
timeout: import_zod5.z.string().optional().describe("IMAP connection timeout in milliseconds, supplied as a string; defaults to 30000 (30 seconds) on the service."),
|
|
3053
|
+
tls: import_zod5.z.enum(["0", "1"]).optional().describe("Set to 1 to enable TLS; enabled by default."),
|
|
3054
|
+
seen: import_zod5.z.enum(["0", "1"]).optional().describe("Set to 1 to mark fetched messages as read; disabled by default."),
|
|
3055
|
+
isJunk: import_zod5.z.enum(["0", "1"]).optional().describe("Set to 1 to query junk folders; disabled by default."),
|
|
3056
|
+
clientId: import_zod5.z.string().optional().describe("OAuth client ID."),
|
|
3057
|
+
clientSecret: import_zod5.z.string().optional().describe("OAuth client secret."),
|
|
3058
|
+
refreshToken: import_zod5.z.string().optional().describe("OAuth refresh token.")
|
|
3059
|
+
}).strict(),
|
|
3060
|
+
getTwoFaSchema: import_zod5.z.object({
|
|
3061
|
+
secret: import_zod5.z.string().min(1).describe("TOTP secret; do not include it in logs.")
|
|
3062
|
+
}).strict(),
|
|
3063
|
+
googleSheetsSchema: import_zod5.z.object({
|
|
3064
|
+
sheetId: import_zod5.z.string().min(1).describe("Spreadsheet ID"),
|
|
3065
|
+
sheetName: import_zod5.z.string().min(1).describe("Worksheet name."),
|
|
3066
|
+
type: import_zod5.z.enum(["read", "write", "clear"]).default("read").describe("Operation to perform; defaults to read."),
|
|
3067
|
+
apiKey: import_zod5.z.string().optional().describe("Service-account configuration as a JSON string containing private_key, client_email, and client_id; not a plain API key."),
|
|
3068
|
+
isKey: import_zod5.z.enum(["0", "1"]).default("1").describe("For read, 0 returns a two-dimensional array; 1 uses the first row as object keys. Defaults to 1."),
|
|
3069
|
+
range: import_zod5.z.string().optional().describe("A1 range, such as A1:C10; omission uses the worksheet range."),
|
|
3070
|
+
template: import_zod5.z.string().refine((value) => {
|
|
3071
|
+
try {
|
|
3072
|
+
const rows = JSON.parse(value);
|
|
3073
|
+
return Array.isArray(rows) && rows.every(Array.isArray);
|
|
3074
|
+
} catch {
|
|
3075
|
+
return false;
|
|
3076
|
+
}
|
|
3077
|
+
}, "template must be a two-dimensional array encoded as JSON.").optional().describe("Required for write: a two-dimensional array encoded as JSON."),
|
|
3078
|
+
rangeType: import_zod5.z.enum(["append", "custom"]).default("append").describe("For write, append adds rows to the worksheet; custom writes to range. Defaults to append.")
|
|
3079
|
+
}).strict().refine((value) => value.type !== "write" || Boolean(value.template), "template is required for write."),
|
|
3080
|
+
startDebugSchema: import_zod5.z.object({
|
|
3081
|
+
start_node_id: import_zod5.z.string().min(1).describe("Starting node ID."),
|
|
3082
|
+
process: import_zod5.z.string().optional().describe("Legacy inline flow JSON. Prefer process_file to avoid repeating full workflows in context."),
|
|
3083
|
+
process_file: import_zod5.z.string().trim().min(1).optional().describe("Absolute local path to full flow JSON or gzip JSON, at most 32 MiB expanded. Provide exactly one of process_file/process; the tool reads it only when sending the RPA request."),
|
|
3084
|
+
process_name: flowNameSchema.optional(),
|
|
3085
|
+
variable: flowVariablesSchema,
|
|
3086
|
+
setting: rpaCreateSettingsJsonSchema,
|
|
3087
|
+
fbcc_id: import_zod5.z.string().min(1).describe("Profile ID."),
|
|
3088
|
+
acc_id: import_zod5.z.string().min(1).describe("Profile number, distinct from fbcc_id.")
|
|
3089
|
+
}).strict().refine((value) => value.process !== void 0 !== (value.process_file !== void 0), "Provide exactly one of process_file/process."),
|
|
3090
|
+
getDebugLogSchema: import_zod5.z.object({
|
|
3091
|
+
id: import_zod5.z.string().min(1).describe("Debug ID, not a task ID or execution record ID."),
|
|
3092
|
+
output_file: import_zod5.z.string().trim().min(1).optional().describe("Write the complete response to a new absolute local file and return only status metadata and its path. Omit for legacy full output.")
|
|
3093
|
+
}).strict(),
|
|
3094
|
+
cancelDebugSchema: import_zod5.z.object({
|
|
3095
|
+
id: import_zod5.z.string().min(1).describe("debug_id")
|
|
3096
|
+
}).strict(),
|
|
3097
|
+
addTaskSchema: import_zod5.z.object({
|
|
3098
|
+
task_id: import_zod5.z.string().trim().min(1).describe("Existing RPA task ID.")
|
|
3099
|
+
}).strict(),
|
|
3100
|
+
cancelTaskSchema: import_zod5.z.object({
|
|
3101
|
+
task_id: import_zod5.z.string().trim().min(1).optional().describe("RPA task ID. Cancels all active runs of this task; provide either task_id or record_id."),
|
|
3102
|
+
record_id: import_zod5.z.string().regex(/^[1-9]\d*$/).optional().describe("Execution ID returned by add-task. Cancels only this run; provide either record_id or task_id.")
|
|
3103
|
+
}).strict().refine((value) => Boolean(value.task_id) !== Boolean(value.record_id), "Provide exactly one of task_id or record_id."),
|
|
3104
|
+
addPlanSchema: import_zod5.z.object({
|
|
3105
|
+
task_id: import_zod5.z.string().min(1).describe("RPA task ID with a schedule already configured.")
|
|
3106
|
+
}).strict(),
|
|
3107
|
+
getPlanSwitchSchema: import_zod5.z.object({
|
|
3108
|
+
task_ids: import_zod5.z.string().regex(/^[^,\s]+(?:,[^,\s]+)*$/).describe("Comma-separated RPA task IDs, such as 123,456.")
|
|
3109
|
+
}).strict(),
|
|
3110
|
+
cancelPlanSchema: import_zod5.z.object({
|
|
3111
|
+
task_id: import_zod5.z.string().min(1).describe("Scheduled RPA task ID.")
|
|
3112
|
+
}).strict(),
|
|
3113
|
+
getRpaConfigSchema: import_zod5.z.object({
|
|
3114
|
+
keys: import_zod5.z.literal("thread").default("thread").describe("Configuration key; only thread is supported and is used by default.")
|
|
3115
|
+
}).strict(),
|
|
3116
|
+
updateRpaConfigSchema: import_zod5.z.object({
|
|
3117
|
+
thread: import_zod5.z.string().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).describe("RPA thread concurrency as an integer string from 1 to 100.")
|
|
3118
|
+
}).strict(),
|
|
3119
|
+
getLatestExecutionSchema: import_zod5.z.object({
|
|
3120
|
+
task_ids: import_zod5.z.string().regex(/^[^,\s]+(?:,[^,\s]+)*$/).describe("Comma-separated remote task IDs, such as 123,456.")
|
|
3121
|
+
}).strict(),
|
|
3122
|
+
getRecordListSchema: import_zod5.z.object({
|
|
3123
|
+
filter: recordFilterSchema.optional(),
|
|
3124
|
+
...historyPagination
|
|
3125
|
+
}).strict(),
|
|
3126
|
+
getRecordCountSchema: import_zod5.z.object({
|
|
3127
|
+
filter: recordFilterSchema.optional()
|
|
3128
|
+
}).strict(),
|
|
3129
|
+
getRecordDetailSchema: import_zod5.z.object({
|
|
3130
|
+
id: import_zod5.z.string().trim().min(1).describe("Local execution record ID (record_id), not a task ID."),
|
|
3131
|
+
output_file: import_zod5.z.string().trim().min(1).optional().describe("Write the complete response to a new absolute local file and return only status metadata and its path. Omit for legacy full output.")
|
|
3132
|
+
}).strict(),
|
|
3133
|
+
getRecordItemsSchema: import_zod5.z.object({
|
|
3134
|
+
id: import_zod5.z.string().trim().min(1).describe("Local execution record ID (record_id)."),
|
|
3135
|
+
filter: itemFilterSchema.optional(),
|
|
3136
|
+
...historyPagination,
|
|
3137
|
+
output_file: import_zod5.z.string().trim().min(1).optional().describe("Write complete response including embedded logs to a new absolute file and return metadata only.")
|
|
3138
|
+
}).strict(),
|
|
3139
|
+
getRecordItemsCountSchema: import_zod5.z.object({
|
|
3140
|
+
id: import_zod5.z.string().trim().min(1).describe("Local execution record ID (record_id)."),
|
|
3141
|
+
filter: itemFilterSchema.optional()
|
|
3142
|
+
}).strict(),
|
|
3143
|
+
getTaskExecuteItemsSchema: import_zod5.z.object({
|
|
3144
|
+
...taskOrProcessShape,
|
|
3145
|
+
...historyPagination,
|
|
3146
|
+
output_file: import_zod5.z.string().trim().min(1).optional().describe("Write complete response including embedded logs to a new absolute file and return metadata only.")
|
|
3147
|
+
}).strict().refine((value) => Boolean(value.task_id || value.process_id), "At least one of task_id/process_id must be provided."),
|
|
3148
|
+
getTaskExecuteItemsCountSchema: import_zod5.z.object({
|
|
3149
|
+
...taskOrProcessShape
|
|
3150
|
+
}).strict().refine((value) => Boolean(value.task_id || value.process_id), "At least one of task_id/process_id must be provided."),
|
|
3151
|
+
getTaskLogSchema: import_zod5.z.object({
|
|
3152
|
+
id: import_zod5.z.string().trim().min(1).describe("Profile execution item ID (item_id), not a task ID or execution record ID."),
|
|
3153
|
+
output_file: import_zod5.z.string().trim().min(1).optional().describe("Write the complete response to a new absolute local file and return only status metadata and its path. Omit for legacy full output.")
|
|
3154
|
+
}).strict(),
|
|
3155
|
+
cancelTaskItemsSchema: import_zod5.z.object({
|
|
3156
|
+
ids: import_zod5.z.string().regex(/^[^,\s]+(?:,[^,\s]+)*$/).describe("Comma-separated profile execution item IDs (item_id), such as 99,100; not task IDs or execution record IDs.")
|
|
3157
|
+
}).strict(),
|
|
3158
|
+
deleteRecordSchema: import_zod5.z.object({
|
|
3159
|
+
id: import_zod5.z.string().trim().min(1).describe("Local execution record ID (record_id), not a task ID or profile execution item ID.")
|
|
3160
|
+
}).strict()
|
|
3161
|
+
};
|
|
3162
|
+
var taskSubmissionResultSchema = import_zod5.z.object({
|
|
3163
|
+
record_id: import_zod5.z.string().min(1)
|
|
3164
|
+
}).strict();
|
|
3165
|
+
|
|
3166
|
+
// ../core/src/rpa/local/handlers.ts
|
|
3167
|
+
var rpaHandlers = {
|
|
3168
|
+
async readExcelFields(params) {
|
|
3169
|
+
const body = rpaSchemas.readExcelFieldsSchema.parse(params);
|
|
3170
|
+
const response = await import_axios3.default.post(
|
|
3171
|
+
`${getRpaApiBase()}/api/rpav2/tool/getExcelContent`,
|
|
3172
|
+
body,
|
|
3173
|
+
{ timeout: 3e4, proxy: false }
|
|
3174
|
+
);
|
|
3175
|
+
if (response.data.code === 0) {
|
|
3176
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3177
|
+
}
|
|
3178
|
+
throw new Error(response.data.msg || "Failed to read Excel fields");
|
|
3179
|
+
},
|
|
3180
|
+
async readTextList(params) {
|
|
3181
|
+
const body = rpaSchemas.readTextListSchema.parse(params);
|
|
3182
|
+
const response = await import_axios3.default.post(
|
|
3183
|
+
`${getRpaApiBase()}/api/rpav2/tool/getTxtContent`,
|
|
3184
|
+
body,
|
|
3185
|
+
{ timeout: 3e4, proxy: false }
|
|
3186
|
+
);
|
|
3187
|
+
if (response.data.code === 0) {
|
|
3188
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3189
|
+
}
|
|
3190
|
+
throw new Error(response.data.msg || "RPA readTextList failed");
|
|
3191
|
+
},
|
|
3192
|
+
async checkEmail(params) {
|
|
3193
|
+
const body = rpaSchemas.checkEmailSchema.parse(params);
|
|
3194
|
+
const response = await import_axios3.default.post(
|
|
3195
|
+
`${getRpaApiBase()}/api/rpav2/tool/getCheckEmail`,
|
|
3196
|
+
body,
|
|
3197
|
+
{ timeout: 3e4, proxy: false }
|
|
3198
|
+
);
|
|
3199
|
+
if (response.data.code === 0) {
|
|
3200
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3201
|
+
}
|
|
3202
|
+
throw new Error(response.data.msg || "RPA checkEmail failed");
|
|
3203
|
+
},
|
|
3204
|
+
async getTwoFa(params) {
|
|
3205
|
+
const body = rpaSchemas.getTwoFaSchema.parse(params);
|
|
3206
|
+
const response = await import_axios3.default.post(
|
|
3207
|
+
`${getRpaApiBase()}/api/rpav2/tool/getCheckTwoFa`,
|
|
3208
|
+
body,
|
|
3209
|
+
{ timeout: 3e4, proxy: false }
|
|
3210
|
+
);
|
|
3211
|
+
if (response.data.code === 0) {
|
|
3212
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3213
|
+
}
|
|
3214
|
+
throw new Error(response.data.msg || "RPA getTwoFa failed");
|
|
3215
|
+
},
|
|
3216
|
+
async googleSheets(params) {
|
|
3217
|
+
const query = rpaSchemas.googleSheetsSchema.parse(params);
|
|
3218
|
+
const response = await import_axios3.default.get(
|
|
3219
|
+
`${getRpaApiBase()}/api/rpav2/tool/googleSheet/test`,
|
|
3220
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3221
|
+
);
|
|
3222
|
+
if (response.data.code === 0) {
|
|
3223
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3224
|
+
}
|
|
3225
|
+
throw new Error(response.data.msg || "RPA googleSheets failed");
|
|
3226
|
+
},
|
|
3227
|
+
async startDebug(params) {
|
|
3228
|
+
const { process_file, ...body } = rpaSchemas.startDebugSchema.parse(params);
|
|
3229
|
+
if (process_file) body.process = await readDebugProcess(process_file);
|
|
3230
|
+
const response = await import_axios3.default.post(
|
|
3231
|
+
`${getRpaApiBase()}/api/rpav2/debug`,
|
|
3232
|
+
body,
|
|
3233
|
+
{ timeout: 3e4, proxy: false }
|
|
3234
|
+
);
|
|
3235
|
+
if (response.data.code === 0) {
|
|
3236
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3237
|
+
}
|
|
3238
|
+
throw new Error(response.data.msg || "RPA startDebug failed");
|
|
3239
|
+
},
|
|
3240
|
+
async getDebugLog(params) {
|
|
3241
|
+
const { output_file, ...query } = rpaSchemas.getDebugLogSchema.parse(params);
|
|
3242
|
+
const response = await import_axios3.default.get(
|
|
3243
|
+
`${getRpaApiBase()}/api/rpav2/debug/getLog`,
|
|
3244
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3245
|
+
);
|
|
3246
|
+
if (response.data.code === 0) {
|
|
3247
|
+
return writeRpaLogResult(response.data.data, output_file);
|
|
3248
|
+
}
|
|
3249
|
+
throw new Error(response.data.msg || "RPA getDebugLog failed");
|
|
3250
|
+
},
|
|
3251
|
+
async cancelDebug(params) {
|
|
3252
|
+
const query = rpaSchemas.cancelDebugSchema.parse(params);
|
|
3253
|
+
const response = await import_axios3.default.get(
|
|
3254
|
+
`${getRpaApiBase()}/api/rpav2/debug/cancel`,
|
|
3255
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3256
|
+
);
|
|
3257
|
+
if (response.data.code === 0) {
|
|
3258
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3259
|
+
}
|
|
3260
|
+
throw new Error(response.data.msg || "RPA cancelDebug failed");
|
|
3261
|
+
},
|
|
3262
|
+
async addTask(params) {
|
|
3263
|
+
const body = rpaSchemas.addTaskSchema.parse(params);
|
|
3264
|
+
const response = await import_axios3.default.post(
|
|
3265
|
+
`${getRpaApiBase()}/api/rpav2/task/add`,
|
|
3266
|
+
body,
|
|
3267
|
+
{ timeout: 3e4, proxy: false }
|
|
3268
|
+
);
|
|
3269
|
+
if (response.data.code === 0) {
|
|
3270
|
+
return JSON.stringify(taskSubmissionResultSchema.parse(response.data.data), null, 2);
|
|
3271
|
+
}
|
|
3272
|
+
throw new Error(response.data.msg || "RPA addTask failed");
|
|
3273
|
+
},
|
|
3274
|
+
async cancelTask(params) {
|
|
3275
|
+
const body = rpaSchemas.cancelTaskSchema.parse(params);
|
|
3276
|
+
const response = await import_axios3.default.post(
|
|
3277
|
+
`${getRpaApiBase()}/api/rpav2/task/cancel`,
|
|
3278
|
+
body,
|
|
3279
|
+
{ timeout: 3e4, proxy: false }
|
|
3280
|
+
);
|
|
3281
|
+
if (response.data.code === 0) {
|
|
3282
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3283
|
+
}
|
|
3284
|
+
throw new Error(response.data.msg || "RPA cancelTask failed");
|
|
3285
|
+
},
|
|
3286
|
+
async addPlan(params) {
|
|
3287
|
+
const body = rpaSchemas.addPlanSchema.parse(params);
|
|
3288
|
+
const response = await import_axios3.default.post(
|
|
3289
|
+
`${getRpaApiBase()}/api/rpav2/plan/add`,
|
|
3290
|
+
body,
|
|
3291
|
+
{ timeout: 3e4, proxy: false }
|
|
3292
|
+
);
|
|
3293
|
+
if (response.data.code === 0) {
|
|
3294
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3295
|
+
}
|
|
3296
|
+
throw new Error(response.data.msg || "RPA addPlan failed");
|
|
3297
|
+
},
|
|
3298
|
+
async getPlanSwitch(params) {
|
|
3299
|
+
const query = rpaSchemas.getPlanSwitchSchema.parse(params);
|
|
3300
|
+
const response = await import_axios3.default.get(
|
|
3301
|
+
`${getRpaApiBase()}/api/rpav2/plan/switch`,
|
|
3302
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3303
|
+
);
|
|
3304
|
+
if (response.data.code === 0) {
|
|
3305
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3306
|
+
}
|
|
3307
|
+
throw new Error(response.data.msg || "RPA getPlanSwitch failed");
|
|
3308
|
+
},
|
|
3309
|
+
async cancelPlan(params) {
|
|
3310
|
+
const body = rpaSchemas.cancelPlanSchema.parse(params);
|
|
3311
|
+
const response = await import_axios3.default.post(
|
|
3312
|
+
`${getRpaApiBase()}/api/rpav2/plan/cancel`,
|
|
3313
|
+
body,
|
|
3314
|
+
{ timeout: 3e4, proxy: false }
|
|
3315
|
+
);
|
|
3316
|
+
if (response.data.code === 0) {
|
|
3317
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3318
|
+
}
|
|
3319
|
+
throw new Error(response.data.msg || "RPA cancelPlan failed");
|
|
3320
|
+
},
|
|
3321
|
+
async getRpaConfig(params) {
|
|
3322
|
+
const query = rpaSchemas.getRpaConfigSchema.parse(params);
|
|
3323
|
+
const response = await import_axios3.default.get(
|
|
3324
|
+
`${getRpaApiBase()}/api/rpav2/getConfig`,
|
|
3325
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3326
|
+
);
|
|
3327
|
+
if (response.data.code === 0) {
|
|
3328
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3329
|
+
}
|
|
3330
|
+
throw new Error(response.data.msg || "RPA getRpaConfig failed");
|
|
3331
|
+
},
|
|
3332
|
+
async updateRpaConfig(params) {
|
|
3333
|
+
const body = rpaSchemas.updateRpaConfigSchema.parse(params);
|
|
3334
|
+
const response = await import_axios3.default.post(
|
|
3335
|
+
`${getRpaApiBase()}/api/rpav2/updateConfig`,
|
|
3336
|
+
body,
|
|
3337
|
+
{ timeout: 3e4, proxy: false }
|
|
3338
|
+
);
|
|
3339
|
+
if (response.data.code === 0) {
|
|
3340
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3341
|
+
}
|
|
3342
|
+
throw new Error(response.data.msg || "RPA updateRpaConfig failed");
|
|
3343
|
+
},
|
|
3344
|
+
async getLatestExecution(params) {
|
|
3345
|
+
const query = rpaSchemas.getLatestExecutionSchema.parse(params);
|
|
3346
|
+
const response = await import_axios3.default.get(
|
|
3347
|
+
`${getRpaApiBase()}/api/rpav2/task/getLatestExecution`,
|
|
3348
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3349
|
+
);
|
|
3350
|
+
if (response.data.code === 0) {
|
|
3351
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3352
|
+
}
|
|
3353
|
+
throw new Error(response.data.msg || "RPA getLatestExecution failed");
|
|
3354
|
+
},
|
|
3355
|
+
async getRecordList(params) {
|
|
3356
|
+
const query = rpaSchemas.getRecordListSchema.parse(params);
|
|
3357
|
+
const response = await import_axios3.default.get(
|
|
3358
|
+
`${getRpaApiBase()}/api/rpav2/task/getRecordList`,
|
|
3359
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3360
|
+
);
|
|
3361
|
+
if (response.data.code === 0) {
|
|
3362
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3363
|
+
}
|
|
3364
|
+
throw new Error(response.data.msg || "RPA getRecordList failed");
|
|
3365
|
+
},
|
|
3366
|
+
async getRecordCount(params) {
|
|
3367
|
+
const query = rpaSchemas.getRecordCountSchema.parse(params);
|
|
3368
|
+
const response = await import_axios3.default.get(
|
|
3369
|
+
`${getRpaApiBase()}/api/rpav2/task/getRecordCount`,
|
|
3370
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3371
|
+
);
|
|
3372
|
+
if (response.data.code === 0) {
|
|
3373
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3374
|
+
}
|
|
3375
|
+
throw new Error(response.data.msg || "RPA getRecordCount failed");
|
|
3376
|
+
},
|
|
3377
|
+
async getRecordDetail(params) {
|
|
3378
|
+
const { output_file, ...query } = rpaSchemas.getRecordDetailSchema.parse(params);
|
|
3379
|
+
const response = await import_axios3.default.get(
|
|
3380
|
+
`${getRpaApiBase()}/api/rpav2/task/getRecordDetail`,
|
|
3381
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3382
|
+
);
|
|
3383
|
+
if (response.data.code === 0) {
|
|
3384
|
+
return writeRpaLogResult(response.data.data, output_file);
|
|
3385
|
+
}
|
|
3386
|
+
throw new Error(response.data.msg || "RPA getRecordDetail failed");
|
|
3387
|
+
},
|
|
3388
|
+
async getRecordItems(params) {
|
|
3389
|
+
const { output_file, ...query } = rpaSchemas.getRecordItemsSchema.parse(params);
|
|
3390
|
+
const response = await import_axios3.default.get(
|
|
3391
|
+
`${getRpaApiBase()}/api/rpav2/task/getRecordItems`,
|
|
3392
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3393
|
+
);
|
|
3394
|
+
if (response.data.code === 0) {
|
|
3395
|
+
return writeRpaLogResult(response.data.data, output_file);
|
|
3396
|
+
}
|
|
3397
|
+
throw new Error(response.data.msg || "RPA getRecordItems failed");
|
|
3398
|
+
},
|
|
3399
|
+
async getRecordItemsCount(params) {
|
|
3400
|
+
const query = rpaSchemas.getRecordItemsCountSchema.parse(params);
|
|
3401
|
+
const response = await import_axios3.default.get(
|
|
3402
|
+
`${getRpaApiBase()}/api/rpav2/task/getRecordItemsCount`,
|
|
3403
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3404
|
+
);
|
|
3405
|
+
if (response.data.code === 0) {
|
|
3406
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3407
|
+
}
|
|
3408
|
+
throw new Error(response.data.msg || "RPA getRecordItemsCount failed");
|
|
3409
|
+
},
|
|
3410
|
+
async getTaskExecuteItems(params) {
|
|
3411
|
+
const { output_file, ...query } = rpaSchemas.getTaskExecuteItemsSchema.parse(params);
|
|
3412
|
+
const response = await import_axios3.default.get(
|
|
3413
|
+
`${getRpaApiBase()}/api/rpav2/task/getTaskExecuteItems`,
|
|
3414
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3415
|
+
);
|
|
3416
|
+
if (response.data.code === 0) {
|
|
3417
|
+
return writeRpaLogResult(response.data.data, output_file);
|
|
3418
|
+
}
|
|
3419
|
+
throw new Error(response.data.msg || "RPA getTaskExecuteItems failed");
|
|
3420
|
+
},
|
|
3421
|
+
async getTaskExecuteItemsCount(params) {
|
|
3422
|
+
const query = rpaSchemas.getTaskExecuteItemsCountSchema.parse(params);
|
|
3423
|
+
const response = await import_axios3.default.get(
|
|
3424
|
+
`${getRpaApiBase()}/api/rpav2/task/getTaskExecuteItemsCount`,
|
|
3425
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3426
|
+
);
|
|
3427
|
+
if (response.data.code === 0) {
|
|
3428
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3429
|
+
}
|
|
3430
|
+
throw new Error(response.data.msg || "RPA getTaskExecuteItemsCount failed");
|
|
3431
|
+
},
|
|
3432
|
+
async getTaskLog(params) {
|
|
3433
|
+
const { output_file, ...query } = rpaSchemas.getTaskLogSchema.parse(params);
|
|
3434
|
+
const response = await import_axios3.default.get(
|
|
3435
|
+
`${getRpaApiBase()}/api/rpav2/task/getLog`,
|
|
3436
|
+
{ params: query, timeout: 3e4, proxy: false }
|
|
3437
|
+
);
|
|
3438
|
+
if (response.data.code === 0) {
|
|
3439
|
+
return writeRpaLogResult(response.data.data, output_file);
|
|
3440
|
+
}
|
|
3441
|
+
throw new Error(response.data.msg || "RPA getTaskLog failed");
|
|
3442
|
+
},
|
|
3443
|
+
async cancelTaskItems(params) {
|
|
3444
|
+
const body = rpaSchemas.cancelTaskItemsSchema.parse(params);
|
|
3445
|
+
const response = await import_axios3.default.post(
|
|
3446
|
+
`${getRpaApiBase()}/api/rpav2/task/cancelItems`,
|
|
3447
|
+
body,
|
|
3448
|
+
{ timeout: 3e4, proxy: false }
|
|
3449
|
+
);
|
|
3450
|
+
if (response.data.code === 0) {
|
|
3451
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3452
|
+
}
|
|
3453
|
+
throw new Error(response.data.msg || "RPA cancelTaskItems failed");
|
|
3454
|
+
},
|
|
3455
|
+
async deleteRecord(params) {
|
|
3456
|
+
const body = rpaSchemas.deleteRecordSchema.parse(params);
|
|
3457
|
+
const response = await import_axios3.default.post(
|
|
3458
|
+
`${getRpaApiBase()}/api/rpav2/task/deleteRecord`,
|
|
3459
|
+
body,
|
|
3460
|
+
{ timeout: 3e4, proxy: false }
|
|
3461
|
+
);
|
|
3462
|
+
if (response.data.code === 0) {
|
|
3463
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3464
|
+
}
|
|
3465
|
+
throw new Error(response.data.msg || "RPA deleteRecord failed");
|
|
3466
|
+
}
|
|
3467
|
+
};
|
|
3468
|
+
|
|
3469
|
+
// ../core/src/rpa/local/tools.ts
|
|
3470
|
+
var rpaLocalTools = [
|
|
3471
|
+
{
|
|
3472
|
+
name: "read-excel-fields",
|
|
3473
|
+
description: "Parse Excel fields and return valid variable names from the first row (variable_list).",
|
|
3474
|
+
schema: rpaSchemas.readExcelFieldsSchema,
|
|
3475
|
+
handler: rpaHandlers.readExcelFields,
|
|
3476
|
+
readOnly: true
|
|
3477
|
+
},
|
|
3478
|
+
{
|
|
3479
|
+
name: "read-text-list",
|
|
3480
|
+
description: "Read a text file line by line and return the list.",
|
|
3481
|
+
schema: rpaSchemas.readTextListSchema,
|
|
3482
|
+
handler: rpaHandlers.readTextList,
|
|
3483
|
+
readOnly: true
|
|
3484
|
+
},
|
|
3485
|
+
{
|
|
3486
|
+
name: "check-email",
|
|
3487
|
+
description: "Read and filter email messages. Setting seen=1 marks fetched messages as read.",
|
|
3488
|
+
schema: rpaSchemas.checkEmailSchema,
|
|
3489
|
+
handler: rpaHandlers.checkEmail,
|
|
3490
|
+
readOnly: false
|
|
3491
|
+
},
|
|
3492
|
+
{
|
|
3493
|
+
name: "get-two-fa",
|
|
3494
|
+
description: "Generate a two-factor authentication (TOTP) verification code.",
|
|
3495
|
+
schema: rpaSchemas.getTwoFaSchema,
|
|
3496
|
+
handler: rpaHandlers.getTwoFa,
|
|
3497
|
+
readOnly: true
|
|
3498
|
+
},
|
|
3499
|
+
{
|
|
3500
|
+
name: "google-sheets",
|
|
3501
|
+
description: "Read, write, or clear Google Sheets. Write and clear modify data.",
|
|
3502
|
+
schema: rpaSchemas.googleSheetsSchema,
|
|
3503
|
+
handler: rpaHandlers.googleSheets,
|
|
3504
|
+
readOnly: false
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
name: "start-debug",
|
|
3508
|
+
description: "Debug a flow from process_file (preferred) or legacy inline process; return only its debug ID.",
|
|
3509
|
+
schema: rpaSchemas.startDebugSchema,
|
|
3510
|
+
handler: rpaHandlers.startDebug,
|
|
3511
|
+
readOnly: false
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
name: "get-debug-log",
|
|
3515
|
+
description: "Get debug status and logs. Supply output_file to keep complete logs on disk and return only metadata.",
|
|
3516
|
+
schema: rpaSchemas.getDebugLogSchema,
|
|
3517
|
+
handler: rpaHandlers.getDebugLog,
|
|
3518
|
+
readOnly: true
|
|
3519
|
+
},
|
|
3520
|
+
{
|
|
3521
|
+
name: "cancel-debug",
|
|
3522
|
+
description: "Cancel a debug run by debug ID.",
|
|
3523
|
+
schema: rpaSchemas.cancelDebugSchema,
|
|
3524
|
+
handler: rpaHandlers.cancelDebug,
|
|
3525
|
+
readOnly: false
|
|
3526
|
+
},
|
|
3527
|
+
{
|
|
3528
|
+
name: "add-task",
|
|
3529
|
+
description: "Submit an existing RPA task and return its execution ID (record_id). If the task already has an active run, return that run ID without submitting again.",
|
|
3530
|
+
schema: rpaSchemas.addTaskSchema,
|
|
3531
|
+
handler: rpaHandlers.addTask,
|
|
3532
|
+
readOnly: false
|
|
3533
|
+
},
|
|
3534
|
+
{
|
|
3535
|
+
name: "cancel-task",
|
|
3536
|
+
description: "Cancel a single execution by record_id, or all active executions of a task by task_id.",
|
|
3537
|
+
schema: rpaSchemas.cancelTaskSchema,
|
|
3538
|
+
handler: rpaHandlers.cancelTask,
|
|
3539
|
+
readOnly: false
|
|
3540
|
+
},
|
|
3541
|
+
{
|
|
3542
|
+
name: "add-plan",
|
|
3543
|
+
description: "Register and enable an existing scheduled RPA task.",
|
|
3544
|
+
schema: rpaSchemas.addPlanSchema,
|
|
3545
|
+
handler: rpaHandlers.addPlan,
|
|
3546
|
+
readOnly: false
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
name: "get-plan-switch",
|
|
3550
|
+
description: "Query enabled scheduled tasks and return open_tasks.",
|
|
3551
|
+
schema: rpaSchemas.getPlanSwitchSchema,
|
|
3552
|
+
handler: rpaHandlers.getPlanSwitch,
|
|
3553
|
+
readOnly: true
|
|
3554
|
+
},
|
|
3555
|
+
{
|
|
3556
|
+
name: "cancel-plan",
|
|
3557
|
+
description: "Disable a scheduled task and cancel its active executions.",
|
|
3558
|
+
schema: rpaSchemas.cancelPlanSchema,
|
|
3559
|
+
handler: rpaHandlers.cancelPlan,
|
|
3560
|
+
readOnly: false
|
|
3561
|
+
},
|
|
3562
|
+
{
|
|
3563
|
+
name: "get-rpa-config",
|
|
3564
|
+
description: "Get the thread concurrency for RPA task execution.",
|
|
3565
|
+
schema: rpaSchemas.getRpaConfigSchema,
|
|
3566
|
+
handler: rpaHandlers.getRpaConfig,
|
|
3567
|
+
readOnly: true
|
|
3568
|
+
},
|
|
3569
|
+
{
|
|
3570
|
+
name: "update-rpa-config",
|
|
3571
|
+
description: "Update the thread concurrency for RPA task execution (1-100).",
|
|
3572
|
+
schema: rpaSchemas.updateRpaConfigSchema,
|
|
3573
|
+
handler: rpaHandlers.updateRpaConfig,
|
|
3574
|
+
readOnly: false
|
|
3575
|
+
},
|
|
3576
|
+
{
|
|
3577
|
+
name: "get-latest-execution",
|
|
3578
|
+
description: "Get the latest execution status for each task (task_id/latest_status), not a specific run.",
|
|
3579
|
+
schema: rpaSchemas.getLatestExecutionSchema,
|
|
3580
|
+
handler: rpaHandlers.getLatestExecution,
|
|
3581
|
+
readOnly: true
|
|
3582
|
+
},
|
|
3583
|
+
{
|
|
3584
|
+
name: "get-record-list",
|
|
3585
|
+
description: "Get the list of execution records with optional pagination and filters.",
|
|
3586
|
+
schema: rpaSchemas.getRecordListSchema,
|
|
3587
|
+
handler: rpaHandlers.getRecordList,
|
|
3588
|
+
readOnly: true
|
|
3589
|
+
},
|
|
3590
|
+
{
|
|
3591
|
+
name: "get-record-count",
|
|
3592
|
+
description: "Get the number of execution records. Returns {count}.",
|
|
3593
|
+
schema: rpaSchemas.getRecordCountSchema,
|
|
3594
|
+
handler: rpaHandlers.getRecordCount,
|
|
3595
|
+
readOnly: true
|
|
3596
|
+
},
|
|
3597
|
+
{
|
|
3598
|
+
name: "get-record-detail",
|
|
3599
|
+
description: "Get the status and success, failure, and cancellation counts for a execution record.",
|
|
3600
|
+
schema: rpaSchemas.getRecordDetailSchema,
|
|
3601
|
+
handler: rpaHandlers.getRecordDetail,
|
|
3602
|
+
readOnly: true
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
name: "get-record-items",
|
|
3606
|
+
description: "Get the profile execution items and logs for a execution record.",
|
|
3607
|
+
schema: rpaSchemas.getRecordItemsSchema,
|
|
3608
|
+
handler: rpaHandlers.getRecordItems,
|
|
3609
|
+
readOnly: true
|
|
3610
|
+
},
|
|
3611
|
+
{
|
|
3612
|
+
name: "get-record-items-count",
|
|
3613
|
+
description: "Get the number of profile execution items for a execution record. Returns a number.",
|
|
3614
|
+
schema: rpaSchemas.getRecordItemsCountSchema,
|
|
3615
|
+
handler: rpaHandlers.getRecordItemsCount,
|
|
3616
|
+
readOnly: true
|
|
3617
|
+
},
|
|
3618
|
+
{
|
|
3619
|
+
name: "get-task-execute-items",
|
|
3620
|
+
description: "Get profile execution items across runs by task ID or process ID.",
|
|
3621
|
+
schema: rpaSchemas.getTaskExecuteItemsSchema,
|
|
3622
|
+
handler: rpaHandlers.getTaskExecuteItems,
|
|
3623
|
+
readOnly: true
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
name: "get-task-execute-items-count",
|
|
3627
|
+
description: "Get the number of profile execution items across runs by task ID or process ID. Returns {count}.",
|
|
3628
|
+
schema: rpaSchemas.getTaskExecuteItemsCountSchema,
|
|
3629
|
+
handler: rpaHandlers.getTaskExecuteItemsCount,
|
|
3630
|
+
readOnly: true
|
|
3631
|
+
},
|
|
3632
|
+
{
|
|
3633
|
+
name: "get-task-log",
|
|
3634
|
+
description: "Get the status and full logs for a profile execution item.",
|
|
3635
|
+
schema: rpaSchemas.getTaskLogSchema,
|
|
3636
|
+
handler: rpaHandlers.getTaskLog,
|
|
3637
|
+
readOnly: true
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
name: "cancel-task-items",
|
|
3641
|
+
description: "Cancel profile execution items using comma-separated item IDs.",
|
|
3642
|
+
schema: rpaSchemas.cancelTaskItemsSchema,
|
|
3643
|
+
handler: rpaHandlers.cancelTaskItems,
|
|
3644
|
+
readOnly: false
|
|
3645
|
+
},
|
|
3646
|
+
{
|
|
3647
|
+
name: "delete-record",
|
|
3648
|
+
description: "Delete a execution record and its associated profile execution items and logs.",
|
|
3649
|
+
schema: rpaSchemas.deleteRecordSchema,
|
|
3650
|
+
handler: rpaHandlers.deleteRecord,
|
|
3651
|
+
readOnly: false
|
|
3652
|
+
}
|
|
3653
|
+
];
|
|
3654
|
+
|
|
3655
|
+
// ../core/src/rpa/remote/api.ts
|
|
3656
|
+
var RPA_REMOTE_ENDPOINTS = {
|
|
3657
|
+
updateProcess: "/rpav2/local-api/update-process-by-api",
|
|
3658
|
+
getTemplateSubscriptionInfo: "/rpav2/local-api/get-template-subscription-info-by-api",
|
|
3659
|
+
createProcess: "/rpav2/local-api/create-process-by-api",
|
|
3660
|
+
createTask: "/rpav2/local-api/create-task-by-api",
|
|
3661
|
+
getProcessList: "/rpav2/local-api/get-process-list-by-api",
|
|
3662
|
+
getProcessListCount: "/rpav2/local-api/get-process-list-count-by-api",
|
|
3663
|
+
getTaskList: "/rpav2/local-api/get-task-list-by-api",
|
|
3664
|
+
getTaskListCount: "/rpav2/local-api/get-task-list-count-by-api",
|
|
3665
|
+
getTaskDetail: "/rpav2/local-api/get-task-detail-by-api",
|
|
3666
|
+
deleteTask: "/rpav2/local-api/delete-task-by-api",
|
|
3667
|
+
updateTask: "/rpav2/local-api/update-task-by-api",
|
|
3668
|
+
getTaskRuntimeList: "/rpav2/local-api/get-task-runtime-list-by-api",
|
|
3669
|
+
getTaskRuntimeListCount: "/rpav2/local-api/get-task-runtime-list-count-by-api",
|
|
3670
|
+
addTaskRuntime: "/rpav2/local-api/add-task-runtime-by-api",
|
|
3671
|
+
deleteTaskRuntime: "/rpav2/local-api/delete-task-runtime-by-api",
|
|
3672
|
+
updateProcessEditableFields: "/rpav2/local-api/update-process-editable-fields-by-api",
|
|
3673
|
+
deleteProcess: "/rpav2/local-api/delete-process-by-api",
|
|
3674
|
+
copyProcess: "/rpav2/local-api/copy-process-by-api",
|
|
3675
|
+
moveProcess: "/rpav2/local-api/move-process-by-api",
|
|
3676
|
+
topProcess: "/rpav2/local-api/top-process-by-api",
|
|
3677
|
+
getBatchList: "/rpav2/local-api/get-batch-list-by-api",
|
|
3678
|
+
createBatch: "/rpav2/local-api/create-batch-by-api",
|
|
3679
|
+
updateBatch: "/rpav2/local-api/update-batch-by-api",
|
|
3680
|
+
deleteBatch: "/rpav2/local-api/delete-batch-by-api",
|
|
3681
|
+
createShare: "/rpav2/local-api/create-share-by-api",
|
|
3682
|
+
receiveShare: "/rpav2/local-api/receive-share-by-api"
|
|
3683
|
+
};
|
|
3684
|
+
async function requestRpaRemote(method, endpoint, params) {
|
|
3685
|
+
const client = getApiClient();
|
|
3686
|
+
client.defaults.timeout = 3e4;
|
|
3687
|
+
const url = `${getLocalApiBase()}${endpoint}`;
|
|
3688
|
+
const response = method === "GET" ? await client.get(url, { params }) : await client.post(url, params);
|
|
3689
|
+
if (response.data.code === 0) {
|
|
3690
|
+
return JSON.stringify(response.data.data, null, 2);
|
|
3691
|
+
}
|
|
3692
|
+
throw new Error(response.data.msg || "Remote RPA request failed");
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
// ../core/src/rpa/remote/schemas.ts
|
|
3696
|
+
var import_zod7 = require("zod");
|
|
3697
|
+
|
|
3698
|
+
// ../core/src/rpa/schedule.ts
|
|
3699
|
+
var import_zod6 = require("zod");
|
|
3700
|
+
var timestamp = import_zod6.z.number().int().nonnegative();
|
|
3701
|
+
var recurring = { start_time: timestamp, end_time: timestamp.optional() };
|
|
3702
|
+
var execTime = import_zod6.z.number().int().min(0).max(86340).multipleOf(60);
|
|
3703
|
+
var rpaScheduleRuleSchema = import_zod6.z.discriminatedUnion("freq", [
|
|
3704
|
+
import_zod6.z.object({ freq: import_zod6.z.literal("once"), start_time: timestamp }).strict(),
|
|
3705
|
+
import_zod6.z.object({ freq: import_zod6.z.literal("interval"), ...recurring, gap_time: import_zod6.z.number().int().min(10).max(1440) }).strict(),
|
|
3706
|
+
import_zod6.z.object({ freq: import_zod6.z.literal("day"), ...recurring, exec_time: execTime }).strict(),
|
|
3707
|
+
import_zod6.z.object({
|
|
3708
|
+
freq: import_zod6.z.literal("week"),
|
|
3709
|
+
...recurring,
|
|
3710
|
+
exec_time: execTime,
|
|
3711
|
+
weekday: import_zod6.z.enum(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"])
|
|
3712
|
+
}).strict(),
|
|
3713
|
+
import_zod6.z.object({
|
|
3714
|
+
freq: import_zod6.z.literal("month"),
|
|
3715
|
+
...recurring,
|
|
3716
|
+
exec_time: execTime,
|
|
3717
|
+
monthday: import_zod6.z.number().int().min(1).max(30)
|
|
3718
|
+
}).strict()
|
|
3719
|
+
]);
|
|
3720
|
+
var rpaScheduleJsonSchema = import_zod6.z.string().superRefine((value, ctx) => {
|
|
3721
|
+
let parsed;
|
|
3722
|
+
try {
|
|
3723
|
+
parsed = JSON.parse(value);
|
|
3724
|
+
} catch {
|
|
3725
|
+
ctx.addIssue({ code: "custom", message: "schedule_rule must be a valid JSON string." });
|
|
3726
|
+
return;
|
|
3727
|
+
}
|
|
3728
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed) && Object.keys(parsed).length === 0) return;
|
|
3729
|
+
const result = rpaScheduleRuleSchema.safeParse(parsed);
|
|
3730
|
+
if (!result.success) {
|
|
3731
|
+
for (const issue of result.error.issues) {
|
|
3732
|
+
ctx.addIssue({ code: "custom", message: `schedule_rule.${issue.path.join(".")}: ${issue.message}` });
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
}).describe("Schedule encoded as JSON. Regular tasks use {}. Scheduled tasks require freq (once/interval/day/week/month) and start_time (Unix seconds). Recurring rules allow end_time (Unix seconds). interval requires gap_time (10-1440 whole minutes); day/week/month require exec_time (seconds since midnight, 0-86340, multiples of 60); week requires weekday (Monday-Sunday); month requires monthday (1-30). Unknown fields are rejected.");
|
|
3736
|
+
function validateTaskSchedule(value, ctx, isCreate) {
|
|
3737
|
+
let rule;
|
|
3738
|
+
try {
|
|
3739
|
+
rule = JSON.parse(value.schedule_rule ?? "{}");
|
|
3740
|
+
} catch {
|
|
3741
|
+
return;
|
|
3742
|
+
}
|
|
3743
|
+
if (value.exec_type === 1) {
|
|
3744
|
+
if (!rule || typeof rule !== "object" || Array.isArray(rule) || Object.keys(rule).length !== 0) {
|
|
3745
|
+
ctx.addIssue({ code: "custom", path: ["schedule_rule"], message: "Regular tasks require an empty schedule object." });
|
|
3746
|
+
}
|
|
3747
|
+
return;
|
|
3748
|
+
}
|
|
3749
|
+
const result = rpaScheduleRuleSchema.safeParse(rule);
|
|
3750
|
+
if (!result.success) {
|
|
3751
|
+
ctx.addIssue({ code: "custom", path: ["schedule_rule"], message: "Scheduled tasks require a complete frequency-specific schedule." });
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
const schedule = result.data;
|
|
3755
|
+
if (isCreate && schedule.start_time * 1e3 - Date.now() <= 6e5) {
|
|
3756
|
+
ctx.addIssue({ code: "custom", path: ["schedule_rule"], message: "start_time must be more than 10 minutes in the future." });
|
|
3757
|
+
}
|
|
3758
|
+
if ("end_time" in schedule && schedule.end_time !== void 0 && schedule.end_time - schedule.start_time <= 600) {
|
|
3759
|
+
ctx.addIssue({ code: "custom", path: ["schedule_rule"], message: "end_time must be more than 10 minutes after start_time." });
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
|
|
3763
|
+
// ../core/src/rpa/remote/schemas.ts
|
|
3764
|
+
var id = import_zod7.z.string().trim().min(1);
|
|
3765
|
+
var flowFilePath = import_zod7.z.string().regex(/\.json\.gz$/, "Must be a .json.gz process file path.");
|
|
3766
|
+
var csvIds = import_zod7.z.string().regex(/^[^,\s]+(?:,[^,\s]+)*$/);
|
|
3767
|
+
var pagination = {
|
|
3768
|
+
page: import_zod7.z.number().int().positive().optional().describe("Page number, starting at 1."),
|
|
3769
|
+
page_size: rpaPageSizeSchema
|
|
3770
|
+
};
|
|
3771
|
+
var taskWriteShape = {
|
|
3772
|
+
name: import_zod7.z.string().min(1).max(64).describe("Task name, up to 64 characters."),
|
|
3773
|
+
fbcc_user_ids: csvIds.optional().describe("Comma-separated profile IDs."),
|
|
3774
|
+
process_id: import_zod7.z.number().int().positive().describe("Process ID."),
|
|
3775
|
+
exec_type: import_zod7.z.union([import_zod7.z.literal(1), import_zod7.z.literal(2)]).describe("Execution type: 1 for regular tasks, 2 for scheduled tasks."),
|
|
3776
|
+
exec_sort: import_zod7.z.union([import_zod7.z.literal(1), import_zod7.z.literal(2)]).describe("Profile order: 1 for ordered, 2 for random. This is not concurrency."),
|
|
3777
|
+
exec_priority: import_zod7.z.union([import_zod7.z.literal(0), import_zod7.z.literal(1)]).describe("Priority: 0 for normal, 1 for priority execution."),
|
|
3778
|
+
schedule_rule: rpaScheduleJsonSchema.optional()
|
|
3779
|
+
};
|
|
3780
|
+
var taskQueryShape = {
|
|
3781
|
+
exec_type: import_zod7.z.union([import_zod7.z.literal(1), import_zod7.z.literal(2)]).optional().describe("Filter by execution type: 1 regular, 2 scheduled; omit to query all tasks."),
|
|
3782
|
+
name: import_zod7.z.string().optional().describe("Task name filter."),
|
|
3783
|
+
fbcc_user_ids: csvIds.optional().describe("Comma-separated profile IDs."),
|
|
3784
|
+
fbcc_user_acc_id: import_zod7.z.string().regex(/^[0-9]+(?:,[0-9]+)*$/).optional().describe("Comma-separated numeric profile numbers, such as 123,456; no whitespace or empty entries."),
|
|
3785
|
+
process_name: import_zod7.z.string().optional().describe("Process name filter."),
|
|
3786
|
+
...pagination
|
|
3787
|
+
};
|
|
3788
|
+
var FLOW_RESPONSE_FIELDS = ["id", "name", "batch_id", "remark", "uri", "top_time", "setting", "variable", "file_size"];
|
|
3789
|
+
var flowQueryShape = {
|
|
3790
|
+
ids: csvIds.optional().describe("Comma-separated process IDs. Use one ID to query a process detail."),
|
|
3791
|
+
keyword: import_zod7.z.string().optional().describe("Process search keyword."),
|
|
3792
|
+
fields: import_zod7.z.string().refine((value) => value.split(",").every((field) => FLOW_RESPONSE_FIELDS.includes(field)), "fields must contain only allowed response fields.").optional().describe("Comma-separated response fields: id, name, batch_id, remark, uri, top_time, setting, variable, file_size. No empty entries or whitespace."),
|
|
3793
|
+
batch_id: id.optional().describe("Process group ID."),
|
|
3794
|
+
...pagination,
|
|
3795
|
+
access_link: import_zod7.z.union([import_zod7.z.literal(0), import_zod7.z.literal(1)]).default(0).describe("Defaults to 0; set to 1 only when a process file download link is needed."),
|
|
3796
|
+
origin: import_zod7.z.literal("0").default("0").describe("Process origin; fixed to string 0."),
|
|
3797
|
+
block_expired_paid_template_process: import_zod7.z.literal(1).default(1).describe("Expired paid-template filtering option; fixed to 1.")
|
|
3798
|
+
};
|
|
3799
|
+
var rpaRemoteSchemas = {
|
|
3800
|
+
updateProcessSchema: import_zod7.z.object({
|
|
3801
|
+
id: id.describe("Process ID to update."),
|
|
3802
|
+
batch_id: import_zod7.z.union([import_zod7.z.number().int().nonnegative(), id]).describe("Process group ID, or 0. Supply the existing value unless changing it."),
|
|
3803
|
+
name: flowNameSchema,
|
|
3804
|
+
variable: flowVariablesSchema.unwrap().describe("Process variables encoded as JSON. Required; supply the existing variables unless changing them."),
|
|
3805
|
+
setting: rpaSettingsJsonSchema.describe(`${rpaSettingsJsonSchema.description} Required; supply the existing settings unless changing them.`),
|
|
3806
|
+
remark: import_zod7.z.string().max(200).describe("Process remark, up to 200 characters. Required; preserve the existing remark unless explicitly changing or clearing it."),
|
|
3807
|
+
process_file: flowFilePath.describe("Required replacement .json.gz process file path readable by the runtime, at most 4MB (4194304 bytes). Use the editable-fields endpoint for metadata-only changes.")
|
|
3808
|
+
}).strict(),
|
|
3809
|
+
getTemplateSubscriptionInfoSchema: import_zod7.z.object({ id: id.describe("Process ID used to query paid-template subscription information.") }).strict(),
|
|
3810
|
+
createProcessSchema: import_zod7.z.object({
|
|
3811
|
+
batch_id: import_zod7.z.union([import_zod7.z.number().int().nonnegative(), import_zod7.z.string().trim().min(1)]).default(0).describe("Process group ID; defaults to 0 for ungrouped processes."),
|
|
3812
|
+
ref_type: flowRefTypeSchema,
|
|
3813
|
+
ref_id: import_zod7.z.string().optional().describe("Template ID identifying the source Template Store template."),
|
|
3814
|
+
name: flowNameSchema,
|
|
3815
|
+
variable: flowVariablesSchema,
|
|
3816
|
+
setting: rpaCreateSettingsJsonSchema,
|
|
3817
|
+
remark: import_zod7.z.string().max(200).default("").describe("Process remark, up to 200 characters. Always sent; defaults to an empty string."),
|
|
3818
|
+
allow_random_name: import_zod7.z.number().int().default(1).describe("Whether random names are allowed: 0 rejects conflicting names; nonzero allows a random name. Defaults to 1."),
|
|
3819
|
+
process_file: flowFilePath.describe(".json.gz process file path accessible to the AdsPower runtime; uploaded as multipart process_file.")
|
|
3820
|
+
}).strict(),
|
|
3821
|
+
createTaskSchema: import_zod7.z.object({
|
|
3822
|
+
...taskWriteShape,
|
|
3823
|
+
name: taskWriteShape.name.default(() => `RPA_TASK_${Date.now()}`).describe("Task name, up to 64 characters; defaults to RPA_TASK_<current Unix timestamp in milliseconds>."),
|
|
3824
|
+
fbcc_user_ids: csvIds.describe("Required comma-separated profile IDs."),
|
|
3825
|
+
exec_type: taskWriteShape.exec_type.default(1).describe("Execution type: 1 regular (default), 2 scheduled."),
|
|
3826
|
+
exec_sort: taskWriteShape.exec_sort.default(1).describe("Profile order: 1 ordered (default), 2 random; not concurrency."),
|
|
3827
|
+
exec_priority: taskWriteShape.exec_priority.default(0).describe("Priority: 0 normal (default), 1 priority execution."),
|
|
3828
|
+
schedule_rule: rpaScheduleJsonSchema.default("{}")
|
|
3829
|
+
}).strict().superRefine((value, ctx) => validateTaskSchedule(value, ctx, true)),
|
|
3830
|
+
getProcessListSchema: import_zod7.z.object(flowQueryShape).strict(),
|
|
3831
|
+
getProcessListCountSchema: import_zod7.z.object(flowQueryShape).omit({ fields: true }).strict(),
|
|
3832
|
+
getTaskListSchema: import_zod7.z.object(taskQueryShape).strict(),
|
|
3833
|
+
getTaskListCountSchema: import_zod7.z.object(taskQueryShape).strict(),
|
|
3834
|
+
getTaskDetailSchema: import_zod7.z.object({
|
|
3835
|
+
ids: csvIds.describe("Comma-separated task IDs, not local execution IDs.")
|
|
3836
|
+
}).strict(),
|
|
3837
|
+
deleteTaskSchema: import_zod7.z.object({ ids: csvIds.describe("Comma-separated task IDs to delete.") }).strict(),
|
|
3838
|
+
updateTaskSchema: import_zod7.z.object({ ...taskWriteShape, id: id.describe("Task ID to update.") }).strict().superRefine((value, ctx) => validateTaskSchedule(value, ctx, false)),
|
|
3839
|
+
getTaskRuntimeListSchema: import_zod7.z.object({
|
|
3840
|
+
task_id: id.describe("Task ID."),
|
|
3841
|
+
fbcc_user_ids: csvIds.optional().describe("Comma-separated profile IDs."),
|
|
3842
|
+
fbcc_user_name: import_zod7.z.string().optional().describe("Profile name filter."),
|
|
3843
|
+
fbcc_user_batch_id: id.optional().describe("Browser profile group ID, not a process group ID."),
|
|
3844
|
+
fbcc_user_acc_id: import_zod7.z.string().regex(/^[0-9]+(?:,[0-9]+)*$/).optional().describe("Comma-separated numeric profile numbers, such as 123,456; no whitespace or empty entries."),
|
|
3845
|
+
...pagination
|
|
3846
|
+
}).strict(),
|
|
3847
|
+
getTaskRuntimeListCountSchema: import_zod7.z.object({ task_id: id.describe("Task ID.") }).strict(),
|
|
3848
|
+
addTaskRuntimeSchema: import_zod7.z.object({
|
|
3849
|
+
task_id: id.describe("Task ID."),
|
|
3850
|
+
fbcc_user_ids: csvIds.describe("Comma-separated profile IDs to bind.")
|
|
3851
|
+
}).strict(),
|
|
3852
|
+
deleteTaskRuntimeSchema: import_zod7.z.object({
|
|
3853
|
+
task_id: id.describe("Task ID."),
|
|
3854
|
+
ids: csvIds.describe("Comma-separated binding record IDs, not profile IDs or local execution item IDs.")
|
|
3855
|
+
}).strict(),
|
|
3856
|
+
updateProcessEditableFieldsSchema: import_zod7.z.object({
|
|
3857
|
+
id: id.describe("Process ID."),
|
|
3858
|
+
variable: flowVariablesSchema,
|
|
3859
|
+
setting: rpaSettingsJsonSchema.optional(),
|
|
3860
|
+
remark: import_zod7.z.string().max(200).optional().describe("Process remark, up to 200 characters."),
|
|
3861
|
+
name: import_zod7.z.string().max(100).optional().describe("Process name, up to 100 characters."),
|
|
3862
|
+
batch_id: id.optional().describe("Target process group ID.")
|
|
3863
|
+
}).strict(),
|
|
3864
|
+
deleteProcessSchema: import_zod7.z.object({ ids: csvIds.describe("Comma-separated process IDs to delete.") }).strict(),
|
|
3865
|
+
copyProcessSchema: import_zod7.z.object({ id: id.describe("Process ID to copy."), batch_id: id.describe("Target process group ID.") }).strict(),
|
|
3866
|
+
moveProcessSchema: import_zod7.z.object({ ids: csvIds.describe("Comma-separated process IDs to move."), batch_id: id.describe("Target process group ID.") }).strict(),
|
|
3867
|
+
topProcessSchema: import_zod7.z.object({ id: id.describe("Process ID whose pinned state will be toggled. A positive top_time means it is currently pinned; calling this endpoint again unpins it.") }).strict(),
|
|
3868
|
+
getBatchListSchema: import_zod7.z.object({
|
|
3869
|
+
page: import_zod7.z.number().int().positive().describe("Page number, starting at 1."),
|
|
3870
|
+
page_size: rpaPageSizeSchema
|
|
3871
|
+
}).strict(),
|
|
3872
|
+
createBatchSchema: import_zod7.z.object({ name: import_zod7.z.string().max(30).describe("New process group name, up to 30 characters.") }).strict(),
|
|
3873
|
+
updateBatchSchema: import_zod7.z.object({ id: id.describe("Process group ID."), name: import_zod7.z.string().max(30).describe("New process group name, up to 30 characters.") }).strict(),
|
|
3874
|
+
deleteBatchSchema: import_zod7.z.object({ ids: csvIds.describe("Comma-separated process group IDs to delete.") }).strict(),
|
|
3875
|
+
createShareSchema: import_zod7.z.object({
|
|
3876
|
+
process_ids: csvIds.describe("Comma-separated process IDs to share."),
|
|
3877
|
+
quota: import_zod7.z.number().max(1e3).default(10).describe("Share usage quota, at most 1000; defaults to 10."),
|
|
3878
|
+
expired_time: import_zod7.z.union([import_zod7.z.literal(1), import_zod7.z.literal(7), import_zod7.z.literal(30)]).default(7).describe("Share validity in days: 1, 7 or 30; defaults to 7 days."),
|
|
3879
|
+
share_config: import_zod7.z.enum(["", "remark"]).default("").describe("Optional shared content: empty string shares no remark; remark includes the process remark. Defaults to an empty string.")
|
|
3880
|
+
}).strict(),
|
|
3881
|
+
receiveShareSchema: import_zod7.z.object({
|
|
3882
|
+
share_code: import_zod7.z.string().describe("Process share code."),
|
|
3883
|
+
batch_id: id.optional().describe("Target process group ID. Omit for the all-groups view; do not pass all.")
|
|
3884
|
+
}).strict()
|
|
3885
|
+
};
|
|
3886
|
+
|
|
3887
|
+
// ../core/src/rpa/remote/handlers.ts
|
|
3888
|
+
var rpaRemoteHandlers = {
|
|
3889
|
+
async updateProcess(params) {
|
|
3890
|
+
const input = rpaRemoteSchemas.updateProcessSchema.parse(params);
|
|
3891
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.updateProcess, input);
|
|
3892
|
+
},
|
|
3893
|
+
async getTemplateSubscriptionInfo(params) {
|
|
3894
|
+
const input = rpaRemoteSchemas.getTemplateSubscriptionInfoSchema.parse(params);
|
|
3895
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTemplateSubscriptionInfo, input);
|
|
3896
|
+
},
|
|
3897
|
+
async createProcess(params) {
|
|
3898
|
+
const input = rpaRemoteSchemas.createProcessSchema.parse(params);
|
|
3899
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.createProcess, input);
|
|
3900
|
+
},
|
|
3901
|
+
async createTask(params) {
|
|
3902
|
+
const input = rpaRemoteSchemas.createTaskSchema.parse(params);
|
|
3903
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.createTask, input);
|
|
3904
|
+
},
|
|
3905
|
+
async getProcessList(params) {
|
|
3906
|
+
const input = rpaRemoteSchemas.getProcessListSchema.parse(params);
|
|
3907
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getProcessList, input);
|
|
3908
|
+
},
|
|
3909
|
+
async getProcessListCount(params) {
|
|
3910
|
+
const input = rpaRemoteSchemas.getProcessListCountSchema.parse(params);
|
|
3911
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getProcessListCount, input);
|
|
3912
|
+
},
|
|
3913
|
+
async getTaskList(params) {
|
|
3914
|
+
const input = rpaRemoteSchemas.getTaskListSchema.parse(params);
|
|
3915
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTaskList, input);
|
|
3916
|
+
},
|
|
3917
|
+
async getTaskListCount(params) {
|
|
3918
|
+
const input = rpaRemoteSchemas.getTaskListCountSchema.parse(params);
|
|
3919
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTaskListCount, input);
|
|
3920
|
+
},
|
|
3921
|
+
async getTaskDetail(params) {
|
|
3922
|
+
const input = rpaRemoteSchemas.getTaskDetailSchema.parse(params);
|
|
3923
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTaskDetail, input);
|
|
3924
|
+
},
|
|
3925
|
+
async deleteTask(params) {
|
|
3926
|
+
const input = rpaRemoteSchemas.deleteTaskSchema.parse(params);
|
|
3927
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.deleteTask, input);
|
|
3928
|
+
},
|
|
3929
|
+
async updateTask(params) {
|
|
3930
|
+
const input = rpaRemoteSchemas.updateTaskSchema.parse(params);
|
|
3931
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.updateTask, input);
|
|
3932
|
+
},
|
|
3933
|
+
async getTaskRuntimeList(params) {
|
|
3934
|
+
const input = rpaRemoteSchemas.getTaskRuntimeListSchema.parse(params);
|
|
3935
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTaskRuntimeList, input);
|
|
3936
|
+
},
|
|
3937
|
+
async getTaskRuntimeListCount(params) {
|
|
3938
|
+
const input = rpaRemoteSchemas.getTaskRuntimeListCountSchema.parse(params);
|
|
3939
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getTaskRuntimeListCount, input);
|
|
3940
|
+
},
|
|
3941
|
+
async addTaskRuntime(params) {
|
|
3942
|
+
const input = rpaRemoteSchemas.addTaskRuntimeSchema.parse(params);
|
|
3943
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.addTaskRuntime, input);
|
|
3944
|
+
},
|
|
3945
|
+
async deleteTaskRuntime(params) {
|
|
3946
|
+
const input = rpaRemoteSchemas.deleteTaskRuntimeSchema.parse(params);
|
|
3947
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.deleteTaskRuntime, input);
|
|
3948
|
+
},
|
|
3949
|
+
async updateProcessEditableFields(params) {
|
|
3950
|
+
const input = rpaRemoteSchemas.updateProcessEditableFieldsSchema.parse(params);
|
|
3951
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.updateProcessEditableFields, input);
|
|
3952
|
+
},
|
|
3953
|
+
async deleteProcess(params) {
|
|
3954
|
+
const input = rpaRemoteSchemas.deleteProcessSchema.parse(params);
|
|
3955
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.deleteProcess, input);
|
|
3956
|
+
},
|
|
3957
|
+
async copyProcess(params) {
|
|
3958
|
+
const input = rpaRemoteSchemas.copyProcessSchema.parse(params);
|
|
3959
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.copyProcess, input);
|
|
3960
|
+
},
|
|
3961
|
+
async moveProcess(params) {
|
|
3962
|
+
const input = rpaRemoteSchemas.moveProcessSchema.parse(params);
|
|
3963
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.moveProcess, input);
|
|
3964
|
+
},
|
|
3965
|
+
async topProcess(params) {
|
|
3966
|
+
const input = rpaRemoteSchemas.topProcessSchema.parse(params);
|
|
3967
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.topProcess, input);
|
|
3968
|
+
},
|
|
3969
|
+
async getBatchList(params) {
|
|
3970
|
+
const input = rpaRemoteSchemas.getBatchListSchema.parse(params);
|
|
3971
|
+
return requestRpaRemote("GET", RPA_REMOTE_ENDPOINTS.getBatchList, input);
|
|
3972
|
+
},
|
|
3973
|
+
async createBatch(params) {
|
|
3974
|
+
const input = rpaRemoteSchemas.createBatchSchema.parse(params);
|
|
3975
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.createBatch, input);
|
|
3976
|
+
},
|
|
3977
|
+
async updateBatch(params) {
|
|
3978
|
+
const input = rpaRemoteSchemas.updateBatchSchema.parse(params);
|
|
3979
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.updateBatch, input);
|
|
3980
|
+
},
|
|
3981
|
+
async deleteBatch(params) {
|
|
3982
|
+
const input = rpaRemoteSchemas.deleteBatchSchema.parse(params);
|
|
3983
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.deleteBatch, input);
|
|
3984
|
+
},
|
|
3985
|
+
async createShare(params) {
|
|
3986
|
+
const input = rpaRemoteSchemas.createShareSchema.parse(params);
|
|
3987
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.createShare, input);
|
|
3988
|
+
},
|
|
3989
|
+
async receiveShare(params) {
|
|
3990
|
+
const input = rpaRemoteSchemas.receiveShareSchema.parse(params);
|
|
3991
|
+
return requestRpaRemote("POST", RPA_REMOTE_ENDPOINTS.receiveShare, input);
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3994
|
+
|
|
3995
|
+
// ../core/src/rpa/remote/tools.ts
|
|
3996
|
+
var rpaRemoteTools = [
|
|
3997
|
+
{
|
|
3998
|
+
name: "update-process",
|
|
3999
|
+
description: "Use for process content changes. Supply complete existing metadata (group, name, variables, settings and remark), merging only requested changes. A replacement .json.gz file is required (maximum 4MB). For metadata-only changes, use rpa-update-process-editable-fields.",
|
|
4000
|
+
schema: rpaRemoteSchemas.updateProcessSchema,
|
|
4001
|
+
handler: rpaRemoteHandlers.updateProcess,
|
|
4002
|
+
readOnly: false
|
|
4003
|
+
},
|
|
4004
|
+
{
|
|
4005
|
+
name: "get-template-subscription-info",
|
|
4006
|
+
description: "Get paid-template subscription information by process ID.",
|
|
4007
|
+
schema: rpaRemoteSchemas.getTemplateSubscriptionInfoSchema,
|
|
4008
|
+
handler: rpaRemoteHandlers.getTemplateSubscriptionInfo,
|
|
4009
|
+
readOnly: true
|
|
4010
|
+
},
|
|
4011
|
+
{
|
|
4012
|
+
name: "create-process",
|
|
4013
|
+
description: "Create an RPA process in one backend upload request using a .json.gz process file accessible to the runtime.",
|
|
4014
|
+
schema: rpaRemoteSchemas.createProcessSchema,
|
|
4015
|
+
handler: rpaRemoteHandlers.createProcess,
|
|
4016
|
+
readOnly: false
|
|
4017
|
+
},
|
|
4018
|
+
{
|
|
4019
|
+
name: "create-task",
|
|
4020
|
+
description: "Create an regular or scheduled RPA task configuration. Default regular-task workflow: follow success with rpa-add-task unless the user requests creation only; use rpa-add-plan to enable a schedule. The creation endpoint itself does not execute or enable tasks.",
|
|
4021
|
+
schema: rpaRemoteSchemas.createTaskSchema,
|
|
4022
|
+
handler: rpaRemoteHandlers.createTask,
|
|
4023
|
+
readOnly: false
|
|
4024
|
+
},
|
|
4025
|
+
{
|
|
4026
|
+
name: "get-process-list",
|
|
4027
|
+
description: "Get the list of RPA processes with optional filters and pagination.",
|
|
4028
|
+
schema: rpaRemoteSchemas.getProcessListSchema,
|
|
4029
|
+
handler: rpaRemoteHandlers.getProcessList,
|
|
4030
|
+
readOnly: true
|
|
4031
|
+
},
|
|
4032
|
+
{
|
|
4033
|
+
name: "get-process-list-count",
|
|
4034
|
+
description: "Get the number of RPA processes matching the filters.",
|
|
4035
|
+
schema: rpaRemoteSchemas.getProcessListCountSchema,
|
|
4036
|
+
handler: rpaRemoteHandlers.getProcessListCount,
|
|
4037
|
+
readOnly: true
|
|
4038
|
+
},
|
|
4039
|
+
{
|
|
4040
|
+
name: "get-task-list",
|
|
4041
|
+
description: "Get the list of RPA task configurations with optional filters and pagination.",
|
|
4042
|
+
schema: rpaRemoteSchemas.getTaskListSchema,
|
|
4043
|
+
handler: rpaRemoteHandlers.getTaskList,
|
|
4044
|
+
readOnly: true
|
|
4045
|
+
},
|
|
4046
|
+
{
|
|
4047
|
+
name: "get-task-list-count",
|
|
4048
|
+
description: "Get the number of RPA task configurations matching the filters.",
|
|
4049
|
+
schema: rpaRemoteSchemas.getTaskListCountSchema,
|
|
4050
|
+
handler: rpaRemoteHandlers.getTaskListCount,
|
|
4051
|
+
readOnly: true
|
|
4052
|
+
},
|
|
4053
|
+
{
|
|
4054
|
+
name: "get-task-detail",
|
|
4055
|
+
description: "Get RPA task configuration details by task IDs.",
|
|
4056
|
+
schema: rpaRemoteSchemas.getTaskDetailSchema,
|
|
4057
|
+
handler: rpaRemoteHandlers.getTaskDetail,
|
|
4058
|
+
readOnly: true
|
|
4059
|
+
},
|
|
4060
|
+
{
|
|
4061
|
+
name: "delete-task",
|
|
4062
|
+
description: "Delete RPA task configurations by task IDs.",
|
|
4063
|
+
schema: rpaRemoteSchemas.deleteTaskSchema,
|
|
4064
|
+
handler: rpaRemoteHandlers.deleteTask,
|
|
4065
|
+
readOnly: false
|
|
4066
|
+
},
|
|
4067
|
+
{
|
|
4068
|
+
name: "update-task",
|
|
4069
|
+
description: "Update an RPA task configuration using the complete task write fields.",
|
|
4070
|
+
schema: rpaRemoteSchemas.updateTaskSchema,
|
|
4071
|
+
handler: rpaRemoteHandlers.updateTask,
|
|
4072
|
+
readOnly: false
|
|
4073
|
+
},
|
|
4074
|
+
{
|
|
4075
|
+
name: "get-task-runtime-list",
|
|
4076
|
+
description: "Get profiles bound to an RPA task, not local execution items.",
|
|
4077
|
+
schema: rpaRemoteSchemas.getTaskRuntimeListSchema,
|
|
4078
|
+
handler: rpaRemoteHandlers.getTaskRuntimeList,
|
|
4079
|
+
readOnly: true
|
|
4080
|
+
},
|
|
4081
|
+
{
|
|
4082
|
+
name: "get-task-runtime-list-count",
|
|
4083
|
+
description: "Get the number of profiles bound to an RPA task.",
|
|
4084
|
+
schema: rpaRemoteSchemas.getTaskRuntimeListCountSchema,
|
|
4085
|
+
handler: rpaRemoteHandlers.getTaskRuntimeListCount,
|
|
4086
|
+
readOnly: true
|
|
4087
|
+
},
|
|
4088
|
+
{
|
|
4089
|
+
name: "add-task-runtime",
|
|
4090
|
+
description: "Bind profiles to an RPA task using profile IDs.",
|
|
4091
|
+
schema: rpaRemoteSchemas.addTaskRuntimeSchema,
|
|
4092
|
+
handler: rpaRemoteHandlers.addTaskRuntime,
|
|
4093
|
+
readOnly: false
|
|
4094
|
+
},
|
|
4095
|
+
{
|
|
4096
|
+
name: "delete-task-runtime",
|
|
4097
|
+
description: "Remove profile bindings from an RPA task using binding record IDs.",
|
|
4098
|
+
schema: rpaRemoteSchemas.deleteTaskRuntimeSchema,
|
|
4099
|
+
handler: rpaRemoteHandlers.deleteTaskRuntime,
|
|
4100
|
+
readOnly: false
|
|
4101
|
+
},
|
|
4102
|
+
{
|
|
4103
|
+
name: "update-process-editable-fields",
|
|
4104
|
+
description: "Use for metadata-only updates to process name, variables, settings, remark or group when process content is unchanged. Does not replace process nodes.",
|
|
4105
|
+
schema: rpaRemoteSchemas.updateProcessEditableFieldsSchema,
|
|
4106
|
+
handler: rpaRemoteHandlers.updateProcessEditableFields,
|
|
4107
|
+
readOnly: false
|
|
4108
|
+
},
|
|
4109
|
+
{
|
|
4110
|
+
name: "delete-process",
|
|
4111
|
+
description: "Delete RPA processes by process IDs.",
|
|
4112
|
+
schema: rpaRemoteSchemas.deleteProcessSchema,
|
|
4113
|
+
handler: rpaRemoteHandlers.deleteProcess,
|
|
4114
|
+
readOnly: false
|
|
4115
|
+
},
|
|
4116
|
+
{
|
|
4117
|
+
name: "copy-process",
|
|
4118
|
+
description: "Copy an RPA process to a specified process group.",
|
|
4119
|
+
schema: rpaRemoteSchemas.copyProcessSchema,
|
|
4120
|
+
handler: rpaRemoteHandlers.copyProcess,
|
|
4121
|
+
readOnly: false
|
|
4122
|
+
},
|
|
4123
|
+
{
|
|
4124
|
+
name: "move-process",
|
|
4125
|
+
description: "Move RPA processes to a specified process group.",
|
|
4126
|
+
schema: rpaRemoteSchemas.moveProcessSchema,
|
|
4127
|
+
handler: rpaRemoteHandlers.moveProcess,
|
|
4128
|
+
readOnly: false
|
|
4129
|
+
},
|
|
4130
|
+
{
|
|
4131
|
+
name: "top-process",
|
|
4132
|
+
description: "Toggle an RPA process between pinned and unpinned. Query its top_time first: a positive value means pinned. Call only when the current state differs from the requested state. Do not automatically retry this toggle.",
|
|
4133
|
+
schema: rpaRemoteSchemas.topProcessSchema,
|
|
4134
|
+
handler: rpaRemoteHandlers.topProcess,
|
|
4135
|
+
readOnly: false
|
|
4136
|
+
},
|
|
4137
|
+
{
|
|
4138
|
+
name: "get-batch-list",
|
|
4139
|
+
description: "Get the list of RPA process groups with pagination.",
|
|
4140
|
+
schema: rpaRemoteSchemas.getBatchListSchema,
|
|
4141
|
+
handler: rpaRemoteHandlers.getBatchList,
|
|
4142
|
+
readOnly: true
|
|
4143
|
+
},
|
|
4144
|
+
{
|
|
4145
|
+
name: "create-batch",
|
|
4146
|
+
description: "Create an RPA process group.",
|
|
4147
|
+
schema: rpaRemoteSchemas.createBatchSchema,
|
|
4148
|
+
handler: rpaRemoteHandlers.createBatch,
|
|
4149
|
+
readOnly: false
|
|
4150
|
+
},
|
|
4151
|
+
{
|
|
4152
|
+
name: "update-batch",
|
|
4153
|
+
description: "Rename an RPA process group.",
|
|
4154
|
+
schema: rpaRemoteSchemas.updateBatchSchema,
|
|
4155
|
+
handler: rpaRemoteHandlers.updateBatch,
|
|
4156
|
+
readOnly: false
|
|
4157
|
+
},
|
|
4158
|
+
{
|
|
4159
|
+
name: "delete-batch",
|
|
4160
|
+
description: "Delete RPA process groups by group IDs.",
|
|
4161
|
+
schema: rpaRemoteSchemas.deleteBatchSchema,
|
|
4162
|
+
handler: rpaRemoteHandlers.deleteBatch,
|
|
4163
|
+
readOnly: false
|
|
4164
|
+
},
|
|
4165
|
+
{
|
|
4166
|
+
name: "create-share",
|
|
4167
|
+
description: "Create a process share code.",
|
|
4168
|
+
schema: rpaRemoteSchemas.createShareSchema,
|
|
4169
|
+
handler: rpaRemoteHandlers.createShare,
|
|
4170
|
+
readOnly: false
|
|
4171
|
+
},
|
|
4172
|
+
{
|
|
4173
|
+
name: "receive-share",
|
|
4174
|
+
description: "Receive RPA processes using a share code, optionally into a process group.",
|
|
4175
|
+
schema: rpaRemoteSchemas.receiveShareSchema,
|
|
4176
|
+
handler: rpaRemoteHandlers.receiveShare,
|
|
4177
|
+
readOnly: false
|
|
4178
|
+
}
|
|
4179
|
+
];
|
|
4180
|
+
|
|
4181
|
+
// src/cliShared.ts
|
|
2837
4182
|
function formatJsonValueForHelp(value, indent) {
|
|
2838
4183
|
const pad = " ".repeat(indent);
|
|
2839
4184
|
const childPad = " ".repeat(indent + 1);
|
|
@@ -2866,6 +4211,32 @@ ${pad}}`;
|
|
|
2866
4211
|
function formatSchemaPropertiesForHelp(properties) {
|
|
2867
4212
|
return formatJsonValueForHelp(properties, 0);
|
|
2868
4213
|
}
|
|
4214
|
+
|
|
4215
|
+
// src/rpa/local.ts
|
|
4216
|
+
var RPA_LOCAL_HANDLERS = Object.fromEntries(
|
|
4217
|
+
rpaLocalTools.map((tool) => [`rpa-${tool.name}`, {
|
|
4218
|
+
fn: tool.handler,
|
|
4219
|
+
description: tool.description,
|
|
4220
|
+
paramsDescription: formatSchemaPropertiesForHelp(tool.schema.toJSONSchema({ io: "input" }).properties)
|
|
4221
|
+
}])
|
|
4222
|
+
);
|
|
4223
|
+
|
|
4224
|
+
// src/rpa/remote.ts
|
|
4225
|
+
var RPA_REMOTE_HANDLERS = Object.fromEntries(
|
|
4226
|
+
rpaRemoteTools.map((tool) => [`rpa-${tool.name}`, {
|
|
4227
|
+
fn: tool.handler,
|
|
4228
|
+
description: tool.description,
|
|
4229
|
+
paramsDescription: formatSchemaPropertiesForHelp(tool.schema.toJSONSchema({ io: "input" }).properties)
|
|
4230
|
+
}])
|
|
4231
|
+
);
|
|
4232
|
+
|
|
4233
|
+
// src/cliRpa.ts
|
|
4234
|
+
var RPA_HANDLERS = { ...RPA_LOCAL_HANDLERS, ...RPA_REMOTE_HANDLERS };
|
|
4235
|
+
|
|
4236
|
+
// src/handleAction.ts
|
|
4237
|
+
var import_colors2 = require("colors");
|
|
4238
|
+
|
|
4239
|
+
// src/cli.ts
|
|
2869
4240
|
function schemaParamsDescription(schema, type) {
|
|
2870
4241
|
let paramStr = "view help: https://documenter.getpostman.com/view/45822952/2sB2x5JDXn\n";
|
|
2871
4242
|
switch (type) {
|
|
@@ -2894,6 +4265,7 @@ or use params: "ads get-browser-active '{"profile_id":"..."}' "
|
|
|
2894
4265
|
return paramStr + _str;
|
|
2895
4266
|
}
|
|
2896
4267
|
var STATELESS_HANDLERS = {
|
|
4268
|
+
...RPA_HANDLERS,
|
|
2897
4269
|
"open-browser": {
|
|
2898
4270
|
fn: browserHandlers.openBrowser,
|
|
2899
4271
|
description: buildCliCommandDescription(
|
|
@@ -3224,15 +4596,16 @@ var handleAction = async (params, options, command, fnc) => {
|
|
|
3224
4596
|
return;
|
|
3225
4597
|
}
|
|
3226
4598
|
const { apiKey, port } = getApiKeyAndPort(options);
|
|
3227
|
-
updateConfig(apiKey, port);
|
|
4599
|
+
updateConfig(apiKey, port, options.rpaPort);
|
|
3228
4600
|
const commandName = command.name();
|
|
4601
|
+
const isRpaCommand = Object.prototype.hasOwnProperty.call(RPA_HANDLERS, commandName);
|
|
3229
4602
|
const resolved = resolveStatelessCommandArgs(commandName, params);
|
|
3230
4603
|
if (!resolved.ok) {
|
|
3231
4604
|
logError(resolved.error);
|
|
3232
4605
|
return;
|
|
3233
4606
|
}
|
|
3234
4607
|
const args = resolved.args;
|
|
3235
|
-
logSuccess(`Executing command: ${commandName}, params: ${JSON.stringify(args)}`);
|
|
4608
|
+
logSuccess(isRpaCommand ? `Executing command: ${commandName}` : `Executing command: ${commandName}, params: ${JSON.stringify(args)}`);
|
|
3236
4609
|
const loading = createLoading(`Executing ${commandName}...`);
|
|
3237
4610
|
try {
|
|
3238
4611
|
if (commandName === "download-kernel") {
|
|
@@ -3694,7 +5067,10 @@ program.command("status").description("Get the status of the adspower runtime").
|
|
|
3694
5067
|
});
|
|
3695
5068
|
for (const cmd of Object.keys(STATELESS_HANDLERS)) {
|
|
3696
5069
|
const fnc = STATELESS_HANDLERS[cmd].fn;
|
|
3697
|
-
program.command(`${cmd}`).description(STATELESS_HANDLERS[cmd].description).option("-k, --api-key <apiKey>", "Set the API key for the adspower runtime").option("-p, --port <port>", "Set the port for the adspower runtime").
|
|
5070
|
+
program.command(`${cmd}`).description(STATELESS_HANDLERS[cmd].description).option("-k, --api-key <apiKey>", "Set the API key for the adspower runtime").option("-p, --port <port>", "Set the port for the adspower runtime").addOption(Object.assign(new import_commander2.Option("--rpa-port <port>", "Set the port for the local RPA Plus service"), {
|
|
5071
|
+
short: "-rp",
|
|
5072
|
+
flags: "-rp, --rpa-port <port>"
|
|
5073
|
+
})).argument("[params]", STATELESS_HANDLERS[cmd].paramsDescription).action(async (params, options, command) => {
|
|
3698
5074
|
await handleAction(params, options, command, fnc);
|
|
3699
5075
|
});
|
|
3700
5076
|
}
|