lua-cli 3.22.0 → 3.23.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.
@@ -1,6 +1,7 @@
1
1
  import { CallWarning } from 'ai';
2
2
  import { FinishReason } from 'ai';
3
3
  import { LanguageModelUsage } from 'ai';
4
+ import { ModelMessage } from 'ai';
4
5
  import { ReasoningOutput } from 'ai';
5
6
  import { UserContent } from 'ai';
6
7
  import { z } from 'zod';
@@ -62,6 +63,11 @@ declare interface AgentInvocationInput {
62
63
  /** Per-call timeout in ms. Absent ⇒ the client default (120s). Set by scheduled agent jobs
63
64
  * to 180s so the cloud tier cuts off at the same point the desktop's local runner does. */
64
65
  timeoutMs?: number;
66
+ /** Per-request model override ("provider/model" code). Unknown codes fall back per
67
+ * approved-models policy server-side. */
68
+ model?: string;
69
+ /** Task 14 (tasks-redesign) — per-task connector + skill scoping. See `AgentToolScope`. */
70
+ toolScope?: AgentToolScope;
65
71
  }
66
72
 
67
73
  /**
@@ -175,6 +181,23 @@ export declare interface AgentsApi {
175
181
  invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
176
182
  }
177
183
 
184
+ /**
185
+ * Task 14 (tasks-redesign) — per-task connector + skill scoping for a scheduled
186
+ * agent run. Non-empty `connectionIds` restricts the turn's MCP servers to the
187
+ * listed agent connections; non-empty `skillIds` restricts the turn's skills.
188
+ * Absent field or empty array ⇒ no filtering (the agent's full toolset).
189
+ *
190
+ * SECURITY: only honored on internally-authenticated invocations (the
191
+ * `X-Internal-Auth` agent-invoke path used by the server-side job runner) —
192
+ * lua-core drops it from any client-authenticated `/chat/*` request.
193
+ */
194
+ declare interface AgentToolScope {
195
+ /** Allowlisted agent connection ids (UnifiedTo `unifiedId`s). */
196
+ connectionIds?: string[];
197
+ /** Allowlisted skill ids (from the agent's `subAgent.skills`). */
198
+ skillIds?: string[];
199
+ }
200
+
178
201
  export declare const AI: AiApi;
179
202
 
180
203
  /**
@@ -219,13 +242,13 @@ export declare interface AiApi {
219
242
  /**
220
243
  * Wire-format input for sandbox `AI.generate` / `POST .../generate` (JSON-serializable).
221
244
  * Serializable subset of AI SDK `generateText` parameters.
222
- * `messages` is untyped over HTTP; callers typically send AI SDK `ModelMessage[]`.
223
245
  */
224
246
  export declare interface AiGenerateInput {
225
247
  model?: string;
226
248
  system?: string;
227
249
  prompt?: string;
228
- messages?: unknown[];
250
+ /** AI SDK `ModelMessage[]`. Server-validated; malformed messages are rejected with 400. */
251
+ messages?: ModelMessage[];
229
252
  temperature?: number;
230
253
  maxOutputTokens?: number;
231
254
  /**
@@ -1081,6 +1104,12 @@ declare interface CustomDataAPI {
1081
1104
  * @returns Promise resolving to update response
1082
1105
  */
1083
1106
  update(collectionName: string, entryId: string, data: Record<string, any>, searchText?: string): Promise<UpdateCustomDataResponse>;
1107
+ /** Atomically sets and removes top-level entry fields and optionally changes search text. */
1108
+ patch(collectionName: string, entryId: string, mutation: {
1109
+ set?: Record<string, any>;
1110
+ unset?: string[];
1111
+ searchText?: string | null;
1112
+ }): Promise<UpdateCustomDataResponse>;
1084
1113
  /**
1085
1114
  * Performs vector search on a collection.
1086
1115
  * @param collectionName - Collection name
@@ -1211,6 +1240,12 @@ export declare class DataEntryInstance {
1211
1240
  * @throws Error if the update fails
1212
1241
  */
1213
1242
  update(data: Record<string, any>, searchText?: string): Promise<Record<string, any>>;
1243
+ patch(mutation: {
1244
+ set?: Record<string, any>;
1245
+ unset?: string[];
1246
+ searchText?: string | null;
1247
+ }): Promise<Record<string, any>>;
1248
+ unset(...fields: string[]): Promise<Record<string, any>>;
1214
1249
  /**
1215
1250
  * Deletes the custom data entry
1216
1251
  * @returns Promise resolving to true if deletion was successful
@@ -2546,7 +2581,7 @@ export declare class LuaJob {
2546
2581
  * @param config.name - Job name (required; non-empty string)
2547
2582
  * @param config.description - Short description of what the job does (1-2 sentences)
2548
2583
  * @param config.schedule - Schedule configuration (cron, once, or interval)
2549
- * @param config.timeout - Optional timeout in seconds (default: 300)
2584
+ * @param config.timeout - Optional timeout in seconds (default: 300, supported range: 1-600)
2550
2585
  * @param config.retry - Optional retry configuration
2551
2586
  * @param config.metadata - Optional metadata for the job
2552
2587
  * @param config.execute - Function that processes the job (receives job instance as parameter)
@@ -2603,7 +2638,7 @@ export declare interface LuaJobConfig {
2603
2638
  * Receives metadata as parameter for accessing job configuration.
2604
2639
  */
2605
2640
  execute: (job: JobInstance) => Promise<any>;
2606
- /** Optional timeout in seconds (default: 300) */
2641
+ /** Optional timeout in seconds (default: 300, supported range: 1-600) */
2607
2642
  timeout?: number;
2608
2643
  /** Optional retry configuration */
2609
2644
  retry?: {
@@ -5402,6 +5437,11 @@ declare interface UserDataAPI {
5402
5437
  * @returns Promise resolving to updated user data
5403
5438
  */
5404
5439
  update(data: Record<string, any>): Promise<any>;
5440
+ /** Atomically sets and removes top-level user data fields. */
5441
+ patch(mutation: {
5442
+ set?: Record<string, any>;
5443
+ unset?: string[];
5444
+ }): Promise<any>;
5405
5445
  /**
5406
5446
  * Clears user data.
5407
5447
  * @returns Promise resolving when data is cleared
@@ -5452,6 +5492,11 @@ export declare class UserDataInstance {
5452
5492
  * @throws Error if the update fails
5453
5493
  */
5454
5494
  update(data: Record<string, any>): Promise<any>;
5495
+ patch(mutation: {
5496
+ set?: Record<string, any>;
5497
+ unset?: string[];
5498
+ }): Promise<any>;
5499
+ unset(...fields: string[]): Promise<any>;
5455
5500
  /**
5456
5501
  * Clears all user data for the current user
5457
5502
  * @returns Promise resolving to true if clearing was successful
@@ -84,6 +84,27 @@ 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 sibling = `${tool.split("_")[0]}${REVIEWABLE_MCP_SEND_TOOL_SUFFIX}`;
105
+ for (const id of availableToolIds) if (id === sibling) return sibling;
106
+ return void 0;
107
+ }
87
108
  function isReviewableExecuteTool(tool) {
88
109
  return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool);
89
110
  }
@@ -323,7 +344,23 @@ function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup
323
344
  function buildDefaultPersona(agentName) {
324
345
  return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
325
346
  }
326
- var __defProp2, __name2, CHANNEL_SEND_CHANNELS, REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST, REVIEWABLE_MCP_SEND_TOOL_SUFFIX, NON_INTERACTIVE_CHANNELS, RICH_PARTS_MESSAGE_ID_PREFIX, SCREENSHOT_MESSAGE_ID_PREFIX, BROWSER_COMMANDS, BROWSER_COMMAND_NAMES, 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;
347
+ function resolveLuaJobTimeoutSeconds(timeout) {
348
+ const resolved = timeout ?? LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
349
+ if (!Number.isInteger(resolved)) {
350
+ throw new TypeError("LuaJob `timeout` must be an integer number of seconds.");
351
+ }
352
+ if (resolved < LUA_JOB_MIN_TIMEOUT_SECONDS || resolved > LUA_JOB_MAX_TIMEOUT_SECONDS) {
353
+ throw new RangeError(`LuaJob \`timeout\` must be between ${LUA_JOB_MIN_TIMEOUT_SECONDS} and ${LUA_JOB_MAX_TIMEOUT_SECONDS} seconds.`);
354
+ }
355
+ return resolved;
356
+ }
357
+ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
358
+ if (typeof timeout !== "number" || !Number.isFinite(timeout)) {
359
+ return LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
360
+ }
361
+ return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
362
+ }
363
+ 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, 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
364
  var init_dist = __esm({
328
365
  "../shared-types/dist/index.mjs"() {
329
366
  "use strict";
@@ -366,6 +403,26 @@ var init_dist = __esm({
366
403
  REVIEWABLE_MCP_SEND_TOOL_SUFFIX = "_create_messaging_message";
367
404
  __name(isReviewableMcpSendTool, "isReviewableMcpSendTool");
368
405
  __name2(isReviewableMcpSendTool, "isReviewableMcpSendTool");
406
+ MCP_TOOL_READ_VERB_RE = /^(list|get|search|read|fetch|find|query|describe|count|retrieve|lookup|show|view)(_|[A-Z0-9]|$)/;
407
+ __name(mcpActionTokens, "mcpActionTokens");
408
+ __name2(mcpActionTokens, "mcpActionTokens");
409
+ __name(isReviewableMcpDraftTool, "isReviewableMcpDraftTool");
410
+ __name2(isReviewableMcpDraftTool, "isReviewableMcpDraftTool");
411
+ MCP_DRAFT_CREATE_VERBS = /* @__PURE__ */ new Set([
412
+ "create",
413
+ "compose",
414
+ "make",
415
+ "new",
416
+ "save",
417
+ "add",
418
+ "write",
419
+ "stage",
420
+ "prepare"
421
+ ]);
422
+ __name(isMcpDraftCreateTool, "isMcpDraftCreateTool");
423
+ __name2(isMcpDraftCreateTool, "isMcpDraftCreateTool");
424
+ __name(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
425
+ __name2(mcpSendSiblingForDraftTool, "mcpSendSiblingForDraftTool");
369
426
  __name(isReviewableExecuteTool, "isReviewableExecuteTool");
370
427
  __name2(isReviewableExecuteTool, "isReviewableExecuteTool");
371
428
  NON_INTERACTIVE_CHANNELS = [
@@ -398,11 +455,11 @@ var init_dist = __esm({
398
455
  },
399
456
  {
400
457
  name: "session_open",
401
- description: "Open/attach a browser session (its own cookies/auth). Args: url?, headed?, profile?, confirmActions?."
458
+ 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
459
  },
403
460
  {
404
461
  name: "navigate",
405
- description: "Navigate the session to a URL. Args: url, waitUntil?."
462
+ 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
463
  },
407
464
  {
408
465
  name: "back",
@@ -898,6 +955,13 @@ Feel free to add, remove, or rename sections. Your persona can be a single parag
898
955
  voiceId: z.string().min(1),
899
956
  version: z.string().optional()
900
957
  });
958
+ LUA_JOB_DEFAULT_TIMEOUT_SECONDS = 300;
959
+ LUA_JOB_MIN_TIMEOUT_SECONDS = 1;
960
+ LUA_JOB_MAX_TIMEOUT_SECONDS = 600;
961
+ __name(resolveLuaJobTimeoutSeconds, "resolveLuaJobTimeoutSeconds");
962
+ __name2(resolveLuaJobTimeoutSeconds, "resolveLuaJobTimeoutSeconds");
963
+ __name(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
964
+ __name2(normalizeLuaJobExecutionTimeoutSeconds, "normalizeLuaJobExecutionTimeoutSeconds");
901
965
  }
902
966
  });
903
967
 
@@ -3798,6 +3862,8 @@ var init_user_instance = __esm({
3798
3862
  "data",
3799
3863
  "userAPI",
3800
3864
  "update",
3865
+ "patch",
3866
+ "unset",
3801
3867
  "clear",
3802
3868
  "toJSON",
3803
3869
  "_luaProfile"
@@ -3876,9 +3942,27 @@ var init_user_instance = __esm({
3876
3942
  this.data = response;
3877
3943
  return this.data;
3878
3944
  } catch (error) {
3879
- throw new Error("Failed to update user data");
3945
+ throw new Error("Failed to update user data", {
3946
+ cause: error
3947
+ });
3880
3948
  }
3881
3949
  }
3950
+ async patch(mutation) {
3951
+ try {
3952
+ const response = await this.userAPI.patch(mutation);
3953
+ this.data = response;
3954
+ return this.data;
3955
+ } catch (error) {
3956
+ throw new Error("Failed to patch user data", {
3957
+ cause: error
3958
+ });
3959
+ }
3960
+ }
3961
+ async unset(...fields) {
3962
+ return this.patch({
3963
+ unset: fields
3964
+ });
3965
+ }
3882
3966
  /**
3883
3967
  * Clears all user data for the current user
3884
3968
  * @returns Promise resolving to true if clearing was successful
@@ -3887,9 +3971,12 @@ var init_user_instance = __esm({
3887
3971
  async clear() {
3888
3972
  try {
3889
3973
  await this.userAPI.clear();
3974
+ this.data = {};
3890
3975
  return true;
3891
3976
  } catch (error) {
3892
- throw new Error("Failed to clear user data");
3977
+ throw new Error("Failed to clear user data", {
3978
+ cause: error
3979
+ });
3893
3980
  }
3894
3981
  }
3895
3982
  /**
@@ -3902,7 +3989,9 @@ var init_user_instance = __esm({
3902
3989
  await this.userAPI.update(this.data);
3903
3990
  return true;
3904
3991
  } catch (error) {
3905
- throw new Error("Failed to save user data");
3992
+ throw new Error("Failed to save user data", {
3993
+ cause: error
3994
+ });
3906
3995
  }
3907
3996
  }
3908
3997
  /**
@@ -3916,7 +4005,9 @@ var init_user_instance = __esm({
3916
4005
  await this.userAPI.sendMessage(messages);
3917
4006
  return true;
3918
4007
  } catch (error) {
3919
- throw new Error("Failed to send message");
4008
+ throw new Error("Failed to send message", {
4009
+ cause: error
4010
+ });
3920
4011
  }
3921
4012
  }
3922
4013
  //get chat history
@@ -3924,7 +4015,9 @@ var init_user_instance = __esm({
3924
4015
  try {
3925
4016
  return await this.userAPI.getChatHistory();
3926
4017
  } catch (error) {
3927
- throw new Error("Failed to get chat history");
4018
+ throw new Error("Failed to get chat history", {
4019
+ cause: error
4020
+ });
3928
4021
  }
3929
4022
  }
3930
4023
  };
@@ -3939,22 +4032,28 @@ var init_user_data_api_service = __esm({
3939
4032
  init_http_client();
3940
4033
  init_user_instance();
3941
4034
  init_lazy_instances();
3942
- UserDataApi = class extends HttpClient {
4035
+ UserDataApi = class _UserDataApi extends HttpClient {
3943
4036
  static {
3944
4037
  __name(this, "UserDataApi");
3945
4038
  }
3946
4039
  apiKey;
3947
4040
  agentId;
4041
+ targetUserId;
3948
4042
  /**
3949
4043
  * Creates an instance of UserDataApi
3950
4044
  * @param baseUrl - The base URL for the API
3951
4045
  * @param apiKey - The API key for authentication
3952
4046
  * @param agentId - The unique identifier of the agent
3953
4047
  */
3954
- constructor(baseUrl, apiKey, agentId) {
4048
+ constructor(baseUrl, apiKey, agentId, targetUserId) {
3955
4049
  super(baseUrl);
3956
4050
  this.apiKey = apiKey;
3957
4051
  this.agentId = agentId;
4052
+ this.targetUserId = targetUserId;
4053
+ }
4054
+ get dataPath() {
4055
+ const base = `/developer/user/data/agent/${this.agentId}`;
4056
+ return this.targetUserId ? `${base}/user/${encodeURIComponent(this.targetUserId)}` : base;
3958
4057
  }
3959
4058
  /**
3960
4059
  * Retrieves user data by userId, email, or phone.
@@ -3973,7 +4072,7 @@ var init_user_data_api_service = __esm({
3973
4072
  }
3974
4073
  let url = `/developer/user/data/agent/${this.agentId}`;
3975
4074
  if (userId) {
3976
- url += `/user/${userId}`;
4075
+ url += `/user/${encodeURIComponent(userId)}`;
3977
4076
  }
3978
4077
  const response = await this.httpGet(url, {
3979
4078
  Authorization: `Bearer ${this.apiKey}`
@@ -3983,7 +4082,8 @@ var init_user_data_api_service = __esm({
3983
4082
  }
3984
4083
  const profile = response.data?._luaProfile;
3985
4084
  const { _luaProfile, ...data } = response.data || {};
3986
- return new UserDataInstance(this, data, profile);
4085
+ const scopedApi = userId ? new _UserDataApi(this.baseUrl, this.apiKey, this.agentId, userId) : this;
4086
+ return new UserDataInstance(scopedApi, data, profile);
3987
4087
  }
3988
4088
  /**
3989
4089
  * Resolves email or phone to user profile via DeveloperApi
@@ -3994,11 +4094,11 @@ var init_user_data_api_service = __esm({
3994
4094
  try {
3995
4095
  const developerApi = await getDeveloperInstance();
3996
4096
  if (options.email) {
3997
- const response = await developerApi.getUserProfileByEmail(options.email);
4097
+ const response = await developerApi.getUserProfileByEmail(options.email, this.agentId);
3998
4098
  return response.success ? response.data ?? null : null;
3999
4099
  }
4000
4100
  if (options.phone) {
4001
- const response = await developerApi.getUserProfileByPhone(options.phone);
4101
+ const response = await developerApi.getUserProfileByPhone(options.phone, this.agentId);
4002
4102
  return response.success ? response.data ?? null : null;
4003
4103
  }
4004
4104
  } catch (error) {
@@ -4016,7 +4116,7 @@ var init_user_data_api_service = __esm({
4016
4116
  * @throws Error if the update fails or the request is unsuccessful
4017
4117
  */
4018
4118
  async update(data) {
4019
- const response = await this.httpPut(`/developer/user/data/agent/${this.agentId}`, data, {
4119
+ const response = await this.httpPut(this.dataPath, data, {
4020
4120
  Authorization: `Bearer ${this.apiKey}`
4021
4121
  });
4022
4122
  if (!response.success) {
@@ -4025,13 +4125,23 @@ var init_user_data_api_service = __esm({
4025
4125
  const { _luaProfile, ...cleanData } = response.data || {};
4026
4126
  return cleanData;
4027
4127
  }
4128
+ async patch(mutation) {
4129
+ const response = await this.httpPatch(this.dataPath, mutation, {
4130
+ Authorization: `Bearer ${this.apiKey}`
4131
+ });
4132
+ if (!response.success) {
4133
+ throw new Error(response.error?.message || "Failed to patch user data");
4134
+ }
4135
+ const { _luaProfile, ...cleanData } = response.data || {};
4136
+ return cleanData;
4137
+ }
4028
4138
  /**
4029
4139
  * Clears all user data for the current user and specific agent
4030
4140
  * @returns Promise resolving to an empty object upon successful deletion
4031
4141
  * @throws Error if the clear operation fails or the request is unsuccessful
4032
4142
  */
4033
4143
  async clear() {
4034
- const response = await this.httpDelete(`/developer/user/data/agent/${this.agentId}`, {
4144
+ const response = await this.httpDelete(this.dataPath, {
4035
4145
  Authorization: `Bearer ${this.apiKey}`
4036
4146
  });
4037
4147
  if (!response.success) {
@@ -4145,6 +4255,8 @@ var init_data_entry_instance = __esm({
4145
4255
  "score",
4146
4256
  "customDataAPI",
4147
4257
  "update",
4258
+ "patch",
4259
+ "unset",
4148
4260
  "delete",
4149
4261
  "toJSON"
4150
4262
  ];
@@ -4236,9 +4348,33 @@ var init_data_entry_instance = __esm({
4236
4348
  };
4237
4349
  return this.data;
4238
4350
  } catch (error) {
4239
- throw new Error("Failed to update custom data entry");
4351
+ throw new Error("Failed to update custom data entry", {
4352
+ cause: error
4353
+ });
4354
+ }
4355
+ }
4356
+ async patch(mutation) {
4357
+ try {
4358
+ await this.customDataAPI.patch(this.collectionName, this.id, mutation);
4359
+ this.data = {
4360
+ ...this.data,
4361
+ ...mutation.set ?? {}
4362
+ };
4363
+ for (const field of mutation.unset ?? []) {
4364
+ delete this.data[field];
4365
+ }
4366
+ return this.data;
4367
+ } catch (error) {
4368
+ throw new Error("Failed to patch custom data entry", {
4369
+ cause: error
4370
+ });
4240
4371
  }
4241
4372
  }
4373
+ async unset(...fields) {
4374
+ return this.patch({
4375
+ unset: fields
4376
+ });
4377
+ }
4242
4378
  /**
4243
4379
  * Deletes the custom data entry
4244
4380
  * @returns Promise resolving to true if deletion was successful
@@ -4249,7 +4385,9 @@ var init_data_entry_instance = __esm({
4249
4385
  await this.customDataAPI.delete(this.collectionName, this.id);
4250
4386
  return true;
4251
4387
  } catch (error) {
4252
- throw new Error("Failed to delete custom data entry");
4388
+ throw new Error("Failed to delete custom data entry", {
4389
+ cause: error
4390
+ });
4253
4391
  }
4254
4392
  }
4255
4393
  /**
@@ -4263,7 +4401,9 @@ var init_data_entry_instance = __esm({
4263
4401
  await this.customDataAPI.update(this.collectionName, this.id, this.data, searchText);
4264
4402
  return true;
4265
4403
  } catch (error) {
4266
- throw new Error("Failed to save data entry");
4404
+ throw new Error("Failed to save data entry", {
4405
+ cause: error
4406
+ });
4267
4407
  }
4268
4408
  }
4269
4409
  };
@@ -4374,6 +4514,15 @@ var init_custom_data_api_service = __esm({
4374
4514
  }
4375
4515
  throw new Error(response.error?.message || "Failed to update custom data entry");
4376
4516
  }
4517
+ async patch(collectionName, entryId, mutation) {
4518
+ const response = await this.httpPatch(`/developer/agents/${this.agentId}/custom-data/${collectionName}/${entryId}`, mutation, {
4519
+ Authorization: `Bearer ${this.apiKey}`
4520
+ });
4521
+ if (response.success && response.data) {
4522
+ return response.data;
4523
+ }
4524
+ throw new Error(response.error?.message || "Failed to patch custom data entry");
4525
+ }
4377
4526
  /**
4378
4527
  * Performs semantic search on custom data entries using text similarity
4379
4528
  * @param collectionName - The name of the collection to search within
@@ -5388,8 +5537,10 @@ var init_developer_api_service = __esm({
5388
5537
  * @param email - The email address to look up
5389
5538
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
5390
5539
  */
5391
- async getUserProfileByEmail(email) {
5392
- return this.httpGet(`/developer/user/profile/email/${encodeURIComponent(email)}`, {
5540
+ async getUserProfileByEmail(email, agentId) {
5541
+ const path3 = `/developer/user/profile/email/${encodeURIComponent(email)}`;
5542
+ const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
5543
+ return this.httpGet(scopedPath, {
5393
5544
  Authorization: `Bearer ${this.apiKey}`
5394
5545
  });
5395
5546
  }
@@ -5398,9 +5549,11 @@ var init_developer_api_service = __esm({
5398
5549
  * @param phone - The phone number to look up (with or without + prefix)
5399
5550
  * @returns Promise resolving to an ApiResponse containing the profile, or null if not found
5400
5551
  */
5401
- async getUserProfileByPhone(phone) {
5552
+ async getUserProfileByPhone(phone, agentId) {
5402
5553
  const normalizedPhone = phone.replace(/^\+/, "");
5403
- return this.httpGet(`/developer/user/profile/phone/${normalizedPhone}`, {
5554
+ const path3 = `/developer/user/profile/phone/${normalizedPhone}`;
5555
+ const scopedPath = agentId ? `${path3}?agentId=${encodeURIComponent(agentId)}` : path3;
5556
+ return this.httpGet(scopedPath, {
5404
5557
  Authorization: `Bearer ${this.apiKey}`
5405
5558
  });
5406
5559
  }
@@ -5943,6 +6096,7 @@ __name(assertValidToolName, "assertValidToolName");
5943
6096
 
5944
6097
  // src/types/skill.ts
5945
6098
  init_dist();
6099
+ init_dist();
5946
6100
  var env = /* @__PURE__ */ __name((key) => {
5947
6101
  if (process.env[key]) {
5948
6102
  return process.env[key];
@@ -6057,7 +6211,7 @@ var LuaJob = class {
6057
6211
  * @param config.name - Job name (required; non-empty string)
6058
6212
  * @param config.description - Short description of what the job does (1-2 sentences)
6059
6213
  * @param config.schedule - Schedule configuration (cron, once, or interval)
6060
- * @param config.timeout - Optional timeout in seconds (default: 300)
6214
+ * @param config.timeout - Optional timeout in seconds (default: 300, supported range: 1-600)
6061
6215
  * @param config.retry - Optional retry configuration
6062
6216
  * @param config.metadata - Optional metadata for the job
6063
6217
  * @param config.execute - Function that processes the job (receives job instance as parameter)
@@ -6069,7 +6223,7 @@ var LuaJob = class {
6069
6223
  this.name = config.name;
6070
6224
  this.description = config.description;
6071
6225
  this.schedule = config.schedule;
6072
- this.timeout = config.timeout || 300;
6226
+ this.timeout = resolveLuaJobTimeoutSeconds(config.timeout);
6073
6227
  this.retry = config.retry;
6074
6228
  this.metadata = config.metadata;
6075
6229
  this.executeFunction = config.execute;