lua-cli 3.22.0 → 3.23.1
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/api-exports.d.ts +120 -14
- package/dist/api-exports.js +220 -25
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +337 -74
- package/dist/index.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/api/Jobs.md +1 -2
- package/docs/api/LuaJob.md +1 -1
- package/package.json +3 -3
- package/template/examples/jobs/DataMigrationJob.ts +2 -2
- package/template/package.json +1 -1
package/dist/api-exports.js
CHANGED
|
@@ -84,6 +84,31 @@ function isAllowedReviewableExecuteTool(tool) {
|
|
|
84
84
|
function isReviewableMcpSendTool(tool) {
|
|
85
85
|
return tool.length > REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length && tool.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX);
|
|
86
86
|
}
|
|
87
|
+
function mcpActionTokens(action) {
|
|
88
|
+
return action.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
89
|
+
}
|
|
90
|
+
function isReviewableMcpDraftTool(tool) {
|
|
91
|
+
const sep = tool.indexOf("_");
|
|
92
|
+
if (sep <= 0 || sep >= tool.length - 1) return false;
|
|
93
|
+
const action = tool.slice(sep + 1);
|
|
94
|
+
const tokens = mcpActionTokens(action);
|
|
95
|
+
if (!tokens.includes("draft") && !tokens.includes("drafts")) return false;
|
|
96
|
+
return !MCP_TOOL_READ_VERB_RE.test(action);
|
|
97
|
+
}
|
|
98
|
+
function isMcpDraftCreateTool(tool) {
|
|
99
|
+
if (!isReviewableMcpDraftTool(tool)) return false;
|
|
100
|
+
const tokens = mcpActionTokens(tool.slice(tool.indexOf("_") + 1));
|
|
101
|
+
return tokens[0] === "draft" || tokens.some((t) => MCP_DRAFT_CREATE_VERBS.has(t));
|
|
102
|
+
}
|
|
103
|
+
function mcpSendSiblingForDraftTool(tool, availableToolIds) {
|
|
104
|
+
const candidates = [
|
|
105
|
+
...availableToolIds
|
|
106
|
+
].filter((id) => id.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX)).map((id) => ({
|
|
107
|
+
id,
|
|
108
|
+
serverName: id.slice(0, -REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length)
|
|
109
|
+
})).filter(({ serverName }) => tool.startsWith(`${serverName}_`)).sort((a, b) => b.serverName.length - a.serverName.length);
|
|
110
|
+
return candidates[0]?.id;
|
|
111
|
+
}
|
|
87
112
|
function isReviewableExecuteTool(tool) {
|
|
88
113
|
return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool);
|
|
89
114
|
}
|
|
@@ -320,10 +345,40 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
|
|
|
320
345
|
while (next < synthetic.length) combined.push(synthetic[next++].message);
|
|
321
346
|
return mergeRichPartMirrorMessages(combined, sameTurnGroup);
|
|
322
347
|
}
|
|
348
|
+
function isDesktopFileCommandName(value) {
|
|
349
|
+
return typeof value === "string" && DESKTOP_FILE_COMMAND_SET.has(value);
|
|
350
|
+
}
|
|
351
|
+
function isDesktopFileSessionId(value) {
|
|
352
|
+
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
353
|
+
}
|
|
354
|
+
function resolveRequireToolApproval(rules) {
|
|
355
|
+
const raw = rules?.requireToolApproval ?? rules?.requireApproval;
|
|
356
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
357
|
+
const list = Array.isArray(raw) ? raw : [
|
|
358
|
+
raw
|
|
359
|
+
];
|
|
360
|
+
return list.filter((t) => typeof t === "string");
|
|
361
|
+
}
|
|
323
362
|
function buildDefaultPersona(agentName) {
|
|
324
363
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
325
364
|
}
|
|
326
|
-
|
|
365
|
+
function resolveLuaJobTimeoutSeconds(timeout) {
|
|
366
|
+
const resolved = timeout ?? LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
|
|
367
|
+
if (!Number.isInteger(resolved)) {
|
|
368
|
+
throw new TypeError("LuaJob `timeout` must be an integer number of seconds.");
|
|
369
|
+
}
|
|
370
|
+
if (resolved < LUA_JOB_MIN_TIMEOUT_SECONDS || resolved > LUA_JOB_MAX_TIMEOUT_SECONDS) {
|
|
371
|
+
throw new RangeError(`LuaJob \`timeout\` must be between ${LUA_JOB_MIN_TIMEOUT_SECONDS} and ${LUA_JOB_MAX_TIMEOUT_SECONDS} seconds.`);
|
|
372
|
+
}
|
|
373
|
+
return resolved;
|
|
374
|
+
}
|
|
375
|
+
function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
|
|
376
|
+
if (typeof timeout !== "number" || !Number.isFinite(timeout)) {
|
|
377
|
+
return LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
|
|
378
|
+
}
|
|
379
|
+
return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
|
|
380
|
+
}
|
|
381
|
+
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, MCP_TOOL_READ_VERB_RE, MCP_DRAFT_CREATE_VERBS, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, DESKTOP_FILE_COMMANDS, DESKTOP_FILE_COMMAND_SET, REASONING_EFFORT_VALUES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema, LUA_JOB_DEFAULT_TIMEOUT_SECONDS, LUA_JOB_MIN_TIMEOUT_SECONDS, LUA_JOB_MAX_TIMEOUT_SECONDS;
|
|
327
382
|
var init_dist = __esm({
|
|
328
383
|
"../shared-types/dist/index.mjs"() {
|
|
329
384
|
"use strict";
|
|
@@ -366,6 +421,26 @@ var init_dist = __esm({
|
|
|
366
421
|
REVIEWABLE_MCP_SEND_TOOL_SUFFIX = "_create_messaging_message";
|
|
367
422
|
__name(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
368
423
|
__name2(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
424
|
+
MCP_TOOL_READ_VERB_RE = /(?:^|_)(list|get|search|read|fetch|find|query|describe|count|retrieve|lookup|show|view)(_|[A-Z0-9]|$)/;
|
|
425
|
+
__name(mcpActionTokens, "mcpActionTokens");
|
|
426
|
+
__name2(mcpActionTokens, "mcpActionTokens");
|
|
427
|
+
__name(isReviewableMcpDraftTool, "isReviewableMcpDraftTool");
|
|
428
|
+
__name2(isReviewableMcpDraftTool, "isReviewableMcpDraftTool");
|
|
429
|
+
MCP_DRAFT_CREATE_VERBS = /* @__PURE__ */ new Set([
|
|
430
|
+
"create",
|
|
431
|
+
"compose",
|
|
432
|
+
"make",
|
|
433
|
+
"new",
|
|
434
|
+
"save",
|
|
435
|
+
"add",
|
|
436
|
+
"write",
|
|
437
|
+
"stage",
|
|
438
|
+
"prepare"
|
|
439
|
+
]);
|
|
440
|
+
__name(isMcpDraftCreateTool, "isMcpDraftCreateTool");
|
|
441
|
+
__name2(isMcpDraftCreateTool, "isMcpDraftCreateTool");
|
|
442
|
+
__name(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
|
|
443
|
+
__name2(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
|
|
369
444
|
__name(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
370
445
|
__name2(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
371
446
|
NON_INTERACTIVE_CHANNELS = [
|
|
@@ -398,11 +473,11 @@ var init_dist = __esm({
|
|
|
398
473
|
},
|
|
399
474
|
{
|
|
400
475
|
name: "session_open",
|
|
401
|
-
description: "Open/attach a browser session (its own cookies/auth). Args: url?, headed?, profile?, confirmActions?."
|
|
476
|
+
description: "Open/attach a browser session (its own cookies/auth). Args: url?, headed?, profile?, confirmActions?. Only use the browser when the user explicitly asked for it, or said yes when you asked. For reading a page's content use fetchUrl first."
|
|
402
477
|
},
|
|
403
478
|
{
|
|
404
479
|
name: "navigate",
|
|
405
|
-
description: "Navigate the session to a URL. Args: url, waitUntil?."
|
|
480
|
+
description: "Navigate the session to a URL. Args: url, waitUntil?. Only use the browser when the user explicitly asked for it, or said yes when you asked. For reading a page's content use fetchUrl first."
|
|
406
481
|
},
|
|
407
482
|
{
|
|
408
483
|
name: "back",
|
|
@@ -597,6 +672,27 @@ var init_dist = __esm({
|
|
|
597
672
|
}
|
|
598
673
|
];
|
|
599
674
|
BROWSER_COMMAND_NAMES = BROWSER_COMMANDS.map((c) => c.name);
|
|
675
|
+
DESKTOP_FILE_COMMANDS = [
|
|
676
|
+
"files_roots",
|
|
677
|
+
"files_stat",
|
|
678
|
+
"files_list",
|
|
679
|
+
"files_read",
|
|
680
|
+
"files_search",
|
|
681
|
+
"files_write",
|
|
682
|
+
"files_mkdir",
|
|
683
|
+
"files_move",
|
|
684
|
+
"files_delete",
|
|
685
|
+
"files_undo",
|
|
686
|
+
"files_transfer_prepare",
|
|
687
|
+
"files_transfer_upload",
|
|
688
|
+
"files_watch_start",
|
|
689
|
+
"files_watch_cancel"
|
|
690
|
+
];
|
|
691
|
+
DESKTOP_FILE_COMMAND_SET = new Set(DESKTOP_FILE_COMMANDS);
|
|
692
|
+
__name(isDesktopFileCommandName, "isDesktopFileCommandName");
|
|
693
|
+
__name2(isDesktopFileCommandName, "isDesktopFileCommandName");
|
|
694
|
+
__name(isDesktopFileSessionId, "isDesktopFileSessionId");
|
|
695
|
+
__name2(isDesktopFileSessionId, "isDesktopFileSessionId");
|
|
600
696
|
REASONING_EFFORT_VALUES = [
|
|
601
697
|
"off",
|
|
602
698
|
"minimal",
|
|
@@ -605,6 +701,8 @@ var init_dist = __esm({
|
|
|
605
701
|
"high",
|
|
606
702
|
"max"
|
|
607
703
|
];
|
|
704
|
+
__name(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
705
|
+
__name2(resolveRequireToolApproval, "resolveRequireToolApproval");
|
|
608
706
|
AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
609
707
|
DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
610
708
|
|
|
@@ -898,6 +996,13 @@ Feel free to add, remove, or rename sections. Your persona can be a single parag
|
|
|
898
996
|
voiceId: z.string().min(1),
|
|
899
997
|
version: z.string().optional()
|
|
900
998
|
});
|
|
999
|
+
LUA_JOB_DEFAULT_TIMEOUT_SECONDS = 300;
|
|
1000
|
+
LUA_JOB_MIN_TIMEOUT_SECONDS = 1;
|
|
1001
|
+
LUA_JOB_MAX_TIMEOUT_SECONDS = 600;
|
|
1002
|
+
__name(resolveLuaJobTimeoutSeconds, "resolveLuaJobTimeoutSeconds");
|
|
1003
|
+
__name2(resolveLuaJobTimeoutSeconds, "resolveLuaJobTimeoutSeconds");
|
|
1004
|
+
__name(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
|
|
1005
|
+
__name2(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
|
|
901
1006
|
}
|
|
902
1007
|
});
|
|
903
1008
|
|
|
@@ -3798,6 +3903,8 @@ var init_user_instance = __esm({
|
|
|
3798
3903
|
"data",
|
|
3799
3904
|
"userAPI",
|
|
3800
3905
|
"update",
|
|
3906
|
+
"patch",
|
|
3907
|
+
"unset",
|
|
3801
3908
|
"clear",
|
|
3802
3909
|
"toJSON",
|
|
3803
3910
|
"_luaProfile"
|
|
@@ -3876,9 +3983,27 @@ var init_user_instance = __esm({
|
|
|
3876
3983
|
this.data = response;
|
|
3877
3984
|
return this.data;
|
|
3878
3985
|
} catch (error) {
|
|
3879
|
-
throw new Error("Failed to update user data"
|
|
3986
|
+
throw new Error("Failed to update user data", {
|
|
3987
|
+
cause: error
|
|
3988
|
+
});
|
|
3880
3989
|
}
|
|
3881
3990
|
}
|
|
3991
|
+
async patch(mutation) {
|
|
3992
|
+
try {
|
|
3993
|
+
const response = await this.userAPI.patch(mutation);
|
|
3994
|
+
this.data = response;
|
|
3995
|
+
return this.data;
|
|
3996
|
+
} catch (error) {
|
|
3997
|
+
throw new Error("Failed to patch user data", {
|
|
3998
|
+
cause: error
|
|
3999
|
+
});
|
|
4000
|
+
}
|
|
4001
|
+
}
|
|
4002
|
+
async unset(...fields) {
|
|
4003
|
+
return this.patch({
|
|
4004
|
+
unset: fields
|
|
4005
|
+
});
|
|
4006
|
+
}
|
|
3882
4007
|
/**
|
|
3883
4008
|
* Clears all user data for the current user
|
|
3884
4009
|
* @returns Promise resolving to true if clearing was successful
|
|
@@ -3887,9 +4012,12 @@ var init_user_instance = __esm({
|
|
|
3887
4012
|
async clear() {
|
|
3888
4013
|
try {
|
|
3889
4014
|
await this.userAPI.clear();
|
|
4015
|
+
this.data = {};
|
|
3890
4016
|
return true;
|
|
3891
4017
|
} catch (error) {
|
|
3892
|
-
throw new Error("Failed to clear user data"
|
|
4018
|
+
throw new Error("Failed to clear user data", {
|
|
4019
|
+
cause: error
|
|
4020
|
+
});
|
|
3893
4021
|
}
|
|
3894
4022
|
}
|
|
3895
4023
|
/**
|
|
@@ -3902,7 +4030,9 @@ var init_user_instance = __esm({
|
|
|
3902
4030
|
await this.userAPI.update(this.data);
|
|
3903
4031
|
return true;
|
|
3904
4032
|
} catch (error) {
|
|
3905
|
-
throw new Error("Failed to save user data"
|
|
4033
|
+
throw new Error("Failed to save user data", {
|
|
4034
|
+
cause: error
|
|
4035
|
+
});
|
|
3906
4036
|
}
|
|
3907
4037
|
}
|
|
3908
4038
|
/**
|
|
@@ -3916,7 +4046,9 @@ var init_user_instance = __esm({
|
|
|
3916
4046
|
await this.userAPI.sendMessage(messages);
|
|
3917
4047
|
return true;
|
|
3918
4048
|
} catch (error) {
|
|
3919
|
-
throw new Error("Failed to send message"
|
|
4049
|
+
throw new Error("Failed to send message", {
|
|
4050
|
+
cause: error
|
|
4051
|
+
});
|
|
3920
4052
|
}
|
|
3921
4053
|
}
|
|
3922
4054
|
//get chat history
|
|
@@ -3924,7 +4056,9 @@ var init_user_instance = __esm({
|
|
|
3924
4056
|
try {
|
|
3925
4057
|
return await this.userAPI.getChatHistory();
|
|
3926
4058
|
} catch (error) {
|
|
3927
|
-
throw new Error("Failed to get chat history"
|
|
4059
|
+
throw new Error("Failed to get chat history", {
|
|
4060
|
+
cause: error
|
|
4061
|
+
});
|
|
3928
4062
|
}
|
|
3929
4063
|
}
|
|
3930
4064
|
};
|
|
@@ -3939,22 +4073,28 @@ var init_user_data_api_service = __esm({
|
|
|
3939
4073
|
init_http_client();
|
|
3940
4074
|
init_user_instance();
|
|
3941
4075
|
init_lazy_instances();
|
|
3942
|
-
UserDataApi = class extends HttpClient {
|
|
4076
|
+
UserDataApi = class _UserDataApi extends HttpClient {
|
|
3943
4077
|
static {
|
|
3944
4078
|
__name(this, "UserDataApi");
|
|
3945
4079
|
}
|
|
3946
4080
|
apiKey;
|
|
3947
4081
|
agentId;
|
|
4082
|
+
targetUserId;
|
|
3948
4083
|
/**
|
|
3949
4084
|
* Creates an instance of UserDataApi
|
|
3950
4085
|
* @param baseUrl - The base URL for the API
|
|
3951
4086
|
* @param apiKey - The API key for authentication
|
|
3952
4087
|
* @param agentId - The unique identifier of the agent
|
|
3953
4088
|
*/
|
|
3954
|
-
constructor(baseUrl, apiKey, agentId) {
|
|
4089
|
+
constructor(baseUrl, apiKey, agentId, targetUserId) {
|
|
3955
4090
|
super(baseUrl);
|
|
3956
4091
|
this.apiKey = apiKey;
|
|
3957
4092
|
this.agentId = agentId;
|
|
4093
|
+
this.targetUserId = targetUserId;
|
|
4094
|
+
}
|
|
4095
|
+
get dataPath() {
|
|
4096
|
+
const base = `/developer/user/data/agent/${this.agentId}`;
|
|
4097
|
+
return this.targetUserId ? `${base}/user/${encodeURIComponent(this.targetUserId)}` : base;
|
|
3958
4098
|
}
|
|
3959
4099
|
/**
|
|
3960
4100
|
* Retrieves user data by userId, email, or phone.
|
|
@@ -3973,7 +4113,7 @@ var init_user_data_api_service = __esm({
|
|
|
3973
4113
|
}
|
|
3974
4114
|
let url = `/developer/user/data/agent/${this.agentId}`;
|
|
3975
4115
|
if (userId) {
|
|
3976
|
-
url += `/user/${userId}`;
|
|
4116
|
+
url += `/user/${encodeURIComponent(userId)}`;
|
|
3977
4117
|
}
|
|
3978
4118
|
const response = await this.httpGet(url, {
|
|
3979
4119
|
Authorization: `Bearer ${this.apiKey}`
|
|
@@ -3983,7 +4123,8 @@ var init_user_data_api_service = __esm({
|
|
|
3983
4123
|
}
|
|
3984
4124
|
const profile = response.data?._luaProfile;
|
|
3985
4125
|
const { _luaProfile, ...data } = response.data || {};
|
|
3986
|
-
|
|
4126
|
+
const scopedApi = userId ? new _UserDataApi(this.baseUrl, this.apiKey, this.agentId, userId) : this;
|
|
4127
|
+
return new UserDataInstance(scopedApi, data, profile);
|
|
3987
4128
|
}
|
|
3988
4129
|
/**
|
|
3989
4130
|
* Resolves email or phone to user profile via DeveloperApi
|
|
@@ -3994,11 +4135,11 @@ var init_user_data_api_service = __esm({
|
|
|
3994
4135
|
try {
|
|
3995
4136
|
const developerApi = await getDeveloperInstance();
|
|
3996
4137
|
if (options.email) {
|
|
3997
|
-
const response = await developerApi.getUserProfileByEmail(options.email);
|
|
4138
|
+
const response = await developerApi.getUserProfileByEmail(options.email, this.agentId);
|
|
3998
4139
|
return response.success ? response.data ?? null : null;
|
|
3999
4140
|
}
|
|
4000
4141
|
if (options.phone) {
|
|
4001
|
-
const response = await developerApi.getUserProfileByPhone(options.phone);
|
|
4142
|
+
const response = await developerApi.getUserProfileByPhone(options.phone, this.agentId);
|
|
4002
4143
|
return response.success ? response.data ?? null : null;
|
|
4003
4144
|
}
|
|
4004
4145
|
} catch (error) {
|
|
@@ -4016,7 +4157,7 @@ var init_user_data_api_service = __esm({
|
|
|
4016
4157
|
* @throws Error if the update fails or the request is unsuccessful
|
|
4017
4158
|
*/
|
|
4018
4159
|
async update(data) {
|
|
4019
|
-
const response = await this.httpPut(
|
|
4160
|
+
const response = await this.httpPut(this.dataPath, data, {
|
|
4020
4161
|
Authorization: `Bearer ${this.apiKey}`
|
|
4021
4162
|
});
|
|
4022
4163
|
if (!response.success) {
|
|
@@ -4025,13 +4166,23 @@ var init_user_data_api_service = __esm({
|
|
|
4025
4166
|
const { _luaProfile, ...cleanData } = response.data || {};
|
|
4026
4167
|
return cleanData;
|
|
4027
4168
|
}
|
|
4169
|
+
async patch(mutation) {
|
|
4170
|
+
const response = await this.httpPatch(this.dataPath, mutation, {
|
|
4171
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4172
|
+
});
|
|
4173
|
+
if (!response.success) {
|
|
4174
|
+
throw new Error(response.error?.message || "Failed to patch user data");
|
|
4175
|
+
}
|
|
4176
|
+
const { _luaProfile, ...cleanData } = response.data || {};
|
|
4177
|
+
return cleanData;
|
|
4178
|
+
}
|
|
4028
4179
|
/**
|
|
4029
4180
|
* Clears all user data for the current user and specific agent
|
|
4030
4181
|
* @returns Promise resolving to an empty object upon successful deletion
|
|
4031
4182
|
* @throws Error if the clear operation fails or the request is unsuccessful
|
|
4032
4183
|
*/
|
|
4033
4184
|
async clear() {
|
|
4034
|
-
const response = await this.httpDelete(
|
|
4185
|
+
const response = await this.httpDelete(this.dataPath, {
|
|
4035
4186
|
Authorization: `Bearer ${this.apiKey}`
|
|
4036
4187
|
});
|
|
4037
4188
|
if (!response.success) {
|
|
@@ -4145,6 +4296,8 @@ var init_data_entry_instance = __esm({
|
|
|
4145
4296
|
"score",
|
|
4146
4297
|
"customDataAPI",
|
|
4147
4298
|
"update",
|
|
4299
|
+
"patch",
|
|
4300
|
+
"unset",
|
|
4148
4301
|
"delete",
|
|
4149
4302
|
"toJSON"
|
|
4150
4303
|
];
|
|
@@ -4236,9 +4389,33 @@ var init_data_entry_instance = __esm({
|
|
|
4236
4389
|
};
|
|
4237
4390
|
return this.data;
|
|
4238
4391
|
} catch (error) {
|
|
4239
|
-
throw new Error("Failed to update custom data entry"
|
|
4392
|
+
throw new Error("Failed to update custom data entry", {
|
|
4393
|
+
cause: error
|
|
4394
|
+
});
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
async patch(mutation) {
|
|
4398
|
+
try {
|
|
4399
|
+
await this.customDataAPI.patch(this.collectionName, this.id, mutation);
|
|
4400
|
+
this.data = {
|
|
4401
|
+
...this.data,
|
|
4402
|
+
...mutation.set ?? {}
|
|
4403
|
+
};
|
|
4404
|
+
for (const field of mutation.unset ?? []) {
|
|
4405
|
+
delete this.data[field];
|
|
4406
|
+
}
|
|
4407
|
+
return this.data;
|
|
4408
|
+
} catch (error) {
|
|
4409
|
+
throw new Error("Failed to patch custom data entry", {
|
|
4410
|
+
cause: error
|
|
4411
|
+
});
|
|
4240
4412
|
}
|
|
4241
4413
|
}
|
|
4414
|
+
async unset(...fields) {
|
|
4415
|
+
return this.patch({
|
|
4416
|
+
unset: fields
|
|
4417
|
+
});
|
|
4418
|
+
}
|
|
4242
4419
|
/**
|
|
4243
4420
|
* Deletes the custom data entry
|
|
4244
4421
|
* @returns Promise resolving to true if deletion was successful
|
|
@@ -4249,7 +4426,9 @@ var init_data_entry_instance = __esm({
|
|
|
4249
4426
|
await this.customDataAPI.delete(this.collectionName, this.id);
|
|
4250
4427
|
return true;
|
|
4251
4428
|
} catch (error) {
|
|
4252
|
-
throw new Error("Failed to delete custom data entry"
|
|
4429
|
+
throw new Error("Failed to delete custom data entry", {
|
|
4430
|
+
cause: error
|
|
4431
|
+
});
|
|
4253
4432
|
}
|
|
4254
4433
|
}
|
|
4255
4434
|
/**
|
|
@@ -4263,7 +4442,9 @@ var init_data_entry_instance = __esm({
|
|
|
4263
4442
|
await this.customDataAPI.update(this.collectionName, this.id, this.data, searchText);
|
|
4264
4443
|
return true;
|
|
4265
4444
|
} catch (error) {
|
|
4266
|
-
throw new Error("Failed to save data entry"
|
|
4445
|
+
throw new Error("Failed to save data entry", {
|
|
4446
|
+
cause: error
|
|
4447
|
+
});
|
|
4267
4448
|
}
|
|
4268
4449
|
}
|
|
4269
4450
|
};
|
|
@@ -4374,6 +4555,15 @@ var init_custom_data_api_service = __esm({
|
|
|
4374
4555
|
}
|
|
4375
4556
|
throw new Error(response.error?.message || "Failed to update custom data entry");
|
|
4376
4557
|
}
|
|
4558
|
+
async patch(collectionName, entryId, mutation) {
|
|
4559
|
+
const response = await this.httpPatch(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, mutation, {
|
|
4560
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4561
|
+
});
|
|
4562
|
+
if (response.success && response.data) {
|
|
4563
|
+
return response.data;
|
|
4564
|
+
}
|
|
4565
|
+
throw new Error(response.error?.message || "Failed to patch custom data entry");
|
|
4566
|
+
}
|
|
4377
4567
|
/**
|
|
4378
4568
|
* Performs semantic search on custom data entries using text similarity
|
|
4379
4569
|
* @param collectionName - The name of the collection to search within
|
|
@@ -5388,8 +5578,10 @@ var init_developer_api_service = __esm({
|
|
|
5388
5578
|
* @param email - The email address to look up
|
|
5389
5579
|
* @returns Promise resolving to an ApiResponse containing the profile, or null if not found
|
|
5390
5580
|
*/
|
|
5391
|
-
async getUserProfileByEmail(email) {
|
|
5392
|
-
|
|
5581
|
+
async getUserProfileByEmail(email, agentId) {
|
|
5582
|
+
const path3 = `/developer/user/profile/email/${encodeURIComponent(email)}`;
|
|
5583
|
+
const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
|
|
5584
|
+
return this.httpGet(scopedPath, {
|
|
5393
5585
|
Authorization: `Bearer ${this.apiKey}`
|
|
5394
5586
|
});
|
|
5395
5587
|
}
|
|
@@ -5398,9 +5590,11 @@ var init_developer_api_service = __esm({
|
|
|
5398
5590
|
* @param phone - The phone number to look up (with or without + prefix)
|
|
5399
5591
|
* @returns Promise resolving to an ApiResponse containing the profile, or null if not found
|
|
5400
5592
|
*/
|
|
5401
|
-
async getUserProfileByPhone(phone) {
|
|
5593
|
+
async getUserProfileByPhone(phone, agentId) {
|
|
5402
5594
|
const normalizedPhone = phone.replace(/^\+/, "");
|
|
5403
|
-
|
|
5595
|
+
const path3 = `/developer/user/profile/phone/${normalizedPhone}`;
|
|
5596
|
+
const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
|
|
5597
|
+
return this.httpGet(scopedPath, {
|
|
5404
5598
|
Authorization: `Bearer ${this.apiKey}`
|
|
5405
5599
|
});
|
|
5406
5600
|
}
|
|
@@ -5943,6 +6137,7 @@ __name(assertValidToolName, "assertValidToolName");
|
|
|
5943
6137
|
|
|
5944
6138
|
// src/types/skill.ts
|
|
5945
6139
|
init_dist();
|
|
6140
|
+
init_dist();
|
|
5946
6141
|
var env = /* @__PURE__ */ __name((key) => {
|
|
5947
6142
|
if (process.env[key]) {
|
|
5948
6143
|
return process.env[key];
|
|
@@ -6057,7 +6252,7 @@ var LuaJob = class {
|
|
|
6057
6252
|
* @param config.name - Job name (required; non-empty string)
|
|
6058
6253
|
* @param config.description - Short description of what the job does (1-2 sentences)
|
|
6059
6254
|
* @param config.schedule - Schedule configuration (cron, once, or interval)
|
|
6060
|
-
* @param config.timeout - Optional timeout in seconds (default: 300)
|
|
6255
|
+
* @param config.timeout - Optional timeout in seconds (default: 300, supported range: 1-600)
|
|
6061
6256
|
* @param config.retry - Optional retry configuration
|
|
6062
6257
|
* @param config.metadata - Optional metadata for the job
|
|
6063
6258
|
* @param config.execute - Function that processes the job (receives job instance as parameter)
|
|
@@ -6069,7 +6264,7 @@ var LuaJob = class {
|
|
|
6069
6264
|
this.name = config.name;
|
|
6070
6265
|
this.description = config.description;
|
|
6071
6266
|
this.schedule = config.schedule;
|
|
6072
|
-
this.timeout = config.timeout
|
|
6267
|
+
this.timeout = resolveLuaJobTimeoutSeconds(config.timeout);
|
|
6073
6268
|
this.retry = config.retry;
|
|
6074
6269
|
this.metadata = config.metadata;
|
|
6075
6270
|
this.executeFunction = config.execute;
|