lua-cli 3.18.0 → 3.20.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/dist/api-exports.d.ts +291 -41
- package/dist/api-exports.js +519 -3
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +837 -19
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +30 -30
- package/docs/README.md +2 -2
- package/package.json +3 -3
- package/template/package.json +1 -1
package/dist/api-exports.js
CHANGED
|
@@ -73,6 +73,15 @@ function aiGenerateInputFromSimplified(prompt, content) {
|
|
|
73
73
|
]
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
+
function isAllowedReviewableExecuteTool(tool) {
|
|
77
|
+
return REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST.includes(tool);
|
|
78
|
+
}
|
|
79
|
+
function isReviewableMcpSendTool(tool) {
|
|
80
|
+
return tool.length > REVIEWABLE_MCP_SEND_TOOL_SUFFIX.length && tool.endsWith(REVIEWABLE_MCP_SEND_TOOL_SUFFIX);
|
|
81
|
+
}
|
|
82
|
+
function isReviewableExecuteTool(tool) {
|
|
83
|
+
return isAllowedReviewableExecuteTool(tool) || isReviewableMcpSendTool(tool);
|
|
84
|
+
}
|
|
76
85
|
function isInteractiveChannel(channel) {
|
|
77
86
|
if (!channel) return true;
|
|
78
87
|
return !NON_INTERACTIVE_CHANNELS.includes(channel);
|
|
@@ -88,6 +97,85 @@ function transformChatHistoryContentParts(parts) {
|
|
|
88
97
|
const content = [];
|
|
89
98
|
for (const rawPart of parts ?? []) {
|
|
90
99
|
const part = rawPart;
|
|
100
|
+
if (part?.type === "reasoning") {
|
|
101
|
+
const detailsText = Array.isArray(part.details) ? part.details.filter((d) => d?.type === "text" && typeof d.text === "string").map((d) => d.text).join("") : "";
|
|
102
|
+
const reasoningText = [
|
|
103
|
+
part.reasoning,
|
|
104
|
+
detailsText,
|
|
105
|
+
part.text
|
|
106
|
+
].find((v) => typeof v === "string" && v.trim().length > 0) ?? "";
|
|
107
|
+
if (reasoningText) content.push({
|
|
108
|
+
type: "reasoning",
|
|
109
|
+
text: reasoningText
|
|
110
|
+
});
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (part?.type === "tool-invocation") {
|
|
114
|
+
const inv = part.toolInvocation;
|
|
115
|
+
if (typeof inv?.toolName === "string" && inv.toolName.length > 0) {
|
|
116
|
+
content.push({
|
|
117
|
+
type: "tool",
|
|
118
|
+
toolName: inv.toolName,
|
|
119
|
+
toolCallId: inv.toolCallId,
|
|
120
|
+
input: inv.args,
|
|
121
|
+
output: inv.result,
|
|
122
|
+
toolState: inv.state
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (part?.type === "source") {
|
|
128
|
+
const src = part.source;
|
|
129
|
+
if (src?.sourceType === "document") {
|
|
130
|
+
content.push({
|
|
131
|
+
type: "source-document",
|
|
132
|
+
sourceId: src.id,
|
|
133
|
+
mediaType: src.mediaType,
|
|
134
|
+
title: src.title,
|
|
135
|
+
filename: src.filename,
|
|
136
|
+
providerMetadata: src.providerMetadata
|
|
137
|
+
});
|
|
138
|
+
} else if (typeof src?.url === "string" && src.url.length > 0) {
|
|
139
|
+
content.push({
|
|
140
|
+
type: "source-url",
|
|
141
|
+
sourceId: src.id,
|
|
142
|
+
url: src.url,
|
|
143
|
+
title: src.title,
|
|
144
|
+
providerMetadata: src.providerMetadata
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (part?.type === "source-url") {
|
|
150
|
+
if (typeof part.url === "string" && part.url.length > 0) {
|
|
151
|
+
content.push({
|
|
152
|
+
type: "source-url",
|
|
153
|
+
sourceId: part.sourceId,
|
|
154
|
+
url: part.url,
|
|
155
|
+
title: part.title,
|
|
156
|
+
providerMetadata: part.providerMetadata
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (part?.type === "source-document") {
|
|
162
|
+
content.push({
|
|
163
|
+
type: "source-document",
|
|
164
|
+
sourceId: part.sourceId,
|
|
165
|
+
mediaType: part.mediaType,
|
|
166
|
+
title: part.title,
|
|
167
|
+
filename: part.filename,
|
|
168
|
+
providerMetadata: part.providerMetadata
|
|
169
|
+
});
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (typeof part?.type === "string" && part.type.startsWith("data-lua-")) {
|
|
173
|
+
content.push({
|
|
174
|
+
type: part.type,
|
|
175
|
+
payload: rawPart.data
|
|
176
|
+
});
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
91
179
|
if (part?.type !== "text" && part?.type !== "file") continue;
|
|
92
180
|
if (part.type === "text" && typeof part.text === "string") {
|
|
93
181
|
const rawText = part.text || "";
|
|
@@ -145,10 +233,92 @@ function transformChatHistoryContentParts(parts) {
|
|
|
145
233
|
}
|
|
146
234
|
return content;
|
|
147
235
|
}
|
|
236
|
+
function isSyntheticSideRow(id) {
|
|
237
|
+
return id.startsWith(SCREENSHOT_MESSAGE_ID_PREFIX) || id.startsWith(RICH_PARTS_MESSAGE_ID_PREFIX);
|
|
238
|
+
}
|
|
239
|
+
function mergeRichPartMirrorMessages(messages, sameTurnGroup) {
|
|
240
|
+
const merged = [];
|
|
241
|
+
for (const message of messages) {
|
|
242
|
+
if (message.role === "assistant" && message.id.startsWith(RICH_PARTS_MESSAGE_ID_PREFIX)) {
|
|
243
|
+
let folded = false;
|
|
244
|
+
for (let i = merged.length - 1; i >= 0; i--) {
|
|
245
|
+
const target = merged[i];
|
|
246
|
+
if (sameTurnGroup && !sameTurnGroup(target, message)) continue;
|
|
247
|
+
if (isSyntheticSideRow(target.id)) continue;
|
|
248
|
+
if (target.role !== "assistant") break;
|
|
249
|
+
const seen = /* @__PURE__ */ new Set();
|
|
250
|
+
for (const part of target.content) {
|
|
251
|
+
for (const key of citationDedupeKeys(part)) seen.add(key);
|
|
252
|
+
}
|
|
253
|
+
const incoming = [];
|
|
254
|
+
for (const part of message.content) {
|
|
255
|
+
const keys = citationDedupeKeys(part);
|
|
256
|
+
if (keys.length > 0 && keys.some((k) => seen.has(k))) continue;
|
|
257
|
+
for (const key of keys) seen.add(key);
|
|
258
|
+
incoming.push(part);
|
|
259
|
+
}
|
|
260
|
+
merged[i] = {
|
|
261
|
+
...target,
|
|
262
|
+
content: [
|
|
263
|
+
...target.content,
|
|
264
|
+
...incoming
|
|
265
|
+
]
|
|
266
|
+
};
|
|
267
|
+
folded = true;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
if (folded) continue;
|
|
271
|
+
}
|
|
272
|
+
merged.push(message);
|
|
273
|
+
}
|
|
274
|
+
return merged;
|
|
275
|
+
}
|
|
276
|
+
function citationDedupeKeys(part) {
|
|
277
|
+
if (part.type !== "source-url" && part.type !== "source-document") return [];
|
|
278
|
+
const keys = [];
|
|
279
|
+
if (typeof part.sourceId === "string" && part.sourceId.length > 0) keys.push(`id:${part.sourceId}`);
|
|
280
|
+
if (typeof part.url === "string" && part.url.length > 0) keys.push(`url:${part.url}`);
|
|
281
|
+
return keys;
|
|
282
|
+
}
|
|
283
|
+
function foldRichPartsIntoMessages(messages, records, makeMessage, sameTurnGroup) {
|
|
284
|
+
if (messages.length === 0 || records.length === 0) return messages;
|
|
285
|
+
const messageTime = /* @__PURE__ */ __name2((m) => m.createdAt ? new Date(m.createdAt).getTime() : Number.NEGATIVE_INFINITY, "messageTime");
|
|
286
|
+
const finiteTimes = messages.map(messageTime).filter(Number.isFinite);
|
|
287
|
+
const oldest = finiteTimes.length > 0 ? Math.min(...finiteTimes) : Number.NEGATIVE_INFINITY;
|
|
288
|
+
const synthetic = [];
|
|
289
|
+
for (const record of records) {
|
|
290
|
+
const time = new Date(record.createdAt).getTime();
|
|
291
|
+
if (!Number.isFinite(time) || time < oldest) continue;
|
|
292
|
+
const content = transformChatHistoryContentParts(record.parts);
|
|
293
|
+
if (content.length === 0) continue;
|
|
294
|
+
synthetic.push({
|
|
295
|
+
time,
|
|
296
|
+
message: makeMessage({
|
|
297
|
+
id: `${RICH_PARTS_MESSAGE_ID_PREFIX}${record.threadId}:${record.messageId}`,
|
|
298
|
+
role: "assistant",
|
|
299
|
+
createdAt: new Date(time).toISOString(),
|
|
300
|
+
content
|
|
301
|
+
}, record)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
if (synthetic.length === 0) return messages;
|
|
305
|
+
synthetic.sort((a, b) => a.time - b.time);
|
|
306
|
+
const combined = [];
|
|
307
|
+
let next = 0;
|
|
308
|
+
for (const message of messages) {
|
|
309
|
+
const time = messageTime(message);
|
|
310
|
+
while (next < synthetic.length && synthetic[next].time < time) {
|
|
311
|
+
combined.push(synthetic[next++].message);
|
|
312
|
+
}
|
|
313
|
+
combined.push(message);
|
|
314
|
+
}
|
|
315
|
+
while (next < synthetic.length) combined.push(synthetic[next++].message);
|
|
316
|
+
return mergeRichPartMirrorMessages(combined, sameTurnGroup);
|
|
317
|
+
}
|
|
148
318
|
function buildDefaultPersona(agentName) {
|
|
149
319
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
150
320
|
}
|
|
151
|
-
var __defProp2, __name2, CHANNEL_SEND_CHANNELS, NON_INTERACTIVE_CHANNELS, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, VoiceNameSchema, PluginProviderSchema, RealtimeProviderSchema, PluginClassSchema, ModelDescriptorSchema, InferenceModelSchema, PluginModelSchema, RealtimeModelSchema, LuaVoiceModelSchema, TurnDetectionSchema, InterruptionSchema, BuiltinAudioClipSchema, AudioConfigSchema, BackgroundAudioEntrySchema, BackgroundAudioSchema, LuaVoiceConfigInnerSchema, LuaVoiceConfigSchema, LuaVoiceRefSchema;
|
|
321
|
+
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;
|
|
152
322
|
var init_dist = __esm({
|
|
153
323
|
"../shared-types/dist/index.mjs"() {
|
|
154
324
|
"use strict";
|
|
@@ -175,6 +345,24 @@ var init_dist = __esm({
|
|
|
175
345
|
"instagram",
|
|
176
346
|
"messenger"
|
|
177
347
|
];
|
|
348
|
+
REVIEWABLE_ACTION_EXECUTE_TOOL_ALLOWLIST = [
|
|
349
|
+
"sendChannelMessage",
|
|
350
|
+
"sendWhatsappTemplate",
|
|
351
|
+
"sendEmail",
|
|
352
|
+
"sendWhatsappMessage",
|
|
353
|
+
"sendSms",
|
|
354
|
+
"sendWebchatMessage",
|
|
355
|
+
"sendTeamsMessage",
|
|
356
|
+
"sendInstagramMessage",
|
|
357
|
+
"sendMessengerMessage"
|
|
358
|
+
];
|
|
359
|
+
__name(isAllowedReviewableExecuteTool, "isAllowedReviewableExecuteTool");
|
|
360
|
+
__name2(isAllowedReviewableExecuteTool, "isAllowedReviewableExecuteTool");
|
|
361
|
+
REVIEWABLE_MCP_SEND_TOOL_SUFFIX = "_create_messaging_message";
|
|
362
|
+
__name(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
363
|
+
__name2(isReviewableMcpSendTool, "isReviewableMcpSendTool");
|
|
364
|
+
__name(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
365
|
+
__name2(isReviewableExecuteTool, "isReviewableExecuteTool");
|
|
178
366
|
NON_INTERACTIVE_CHANNELS = [
|
|
179
367
|
"trigger",
|
|
180
368
|
"agent-invocation"
|
|
@@ -187,6 +375,231 @@ var init_dist = __esm({
|
|
|
187
375
|
__name2(removeNavigateBlock, "removeNavigateBlock");
|
|
188
376
|
__name(transformChatHistoryContentParts, "transformChatHistoryContentParts");
|
|
189
377
|
__name2(transformChatHistoryContentParts, "transformChatHistoryContentParts");
|
|
378
|
+
RICH_PARTS_MESSAGE_ID_PREFIX = "rich-parts:";
|
|
379
|
+
SCREENSHOT_MESSAGE_ID_PREFIX = "screenshot:";
|
|
380
|
+
__name(isSyntheticSideRow, "isSyntheticSideRow");
|
|
381
|
+
__name2(isSyntheticSideRow, "isSyntheticSideRow");
|
|
382
|
+
__name(mergeRichPartMirrorMessages, "mergeRichPartMirrorMessages");
|
|
383
|
+
__name2(mergeRichPartMirrorMessages, "mergeRichPartMirrorMessages");
|
|
384
|
+
__name(citationDedupeKeys, "citationDedupeKeys");
|
|
385
|
+
__name2(citationDedupeKeys, "citationDedupeKeys");
|
|
386
|
+
__name(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
|
|
387
|
+
__name2(foldRichPartsIntoMessages, "foldRichPartsIntoMessages");
|
|
388
|
+
BROWSER_COMMANDS = [
|
|
389
|
+
// health + lifecycle / navigation
|
|
390
|
+
{
|
|
391
|
+
name: "health",
|
|
392
|
+
description: "Check the local browser engine is installed and responsive."
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: "session_open",
|
|
396
|
+
description: "Open/attach a browser session (its own cookies/auth). Args: url?, headed?, profile?, confirmActions?."
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
name: "navigate",
|
|
400
|
+
description: "Navigate the session to a URL. Args: url, waitUntil?."
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
name: "back",
|
|
404
|
+
description: "Go back in history."
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "forward",
|
|
408
|
+
description: "Go forward in history."
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
name: "reload",
|
|
412
|
+
description: "Reload the current page."
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: "pushstate",
|
|
416
|
+
description: "SPA client-side navigation. Args: url."
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
name: "close",
|
|
420
|
+
description: "Close the session\u2019s browser."
|
|
421
|
+
},
|
|
422
|
+
// perception
|
|
423
|
+
{
|
|
424
|
+
name: "snapshot",
|
|
425
|
+
description: "Accessibility-tree snapshot with element refs (@e1\u2026) \u2014 see what to click/fill. Args: interactiveOnly?, selector?, urls?, compact?, depth?."
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
name: "get",
|
|
429
|
+
description: "Read from the page. Args: what(text|html|value|attr|title|url|count|box|styles), selector?, attr?."
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "is",
|
|
433
|
+
description: "Check element state. Args: check(visible|enabled|checked), selector."
|
|
434
|
+
},
|
|
435
|
+
// interaction
|
|
436
|
+
{
|
|
437
|
+
name: "click",
|
|
438
|
+
description: "Click an element. Args: selector(@eN or CSS), newTab?."
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
name: "dblclick",
|
|
442
|
+
description: "Double-click an element. Args: selector."
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
name: "fill",
|
|
446
|
+
description: "Clear and fill a field. Args: selector, text."
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: "type",
|
|
450
|
+
description: "Type into an element. Args: selector, text."
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: "press",
|
|
454
|
+
description: "Press a key/chord (Enter, Control+a). Args: key."
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
name: "hover",
|
|
458
|
+
description: "Hover an element. Args: selector."
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: "focus",
|
|
462
|
+
description: "Focus an element. Args: selector."
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: "select",
|
|
466
|
+
description: "Select a dropdown option. Args: selector, value."
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: "check",
|
|
470
|
+
description: "Check a checkbox. Args: selector."
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "uncheck",
|
|
474
|
+
description: "Uncheck a checkbox. Args: selector."
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: "scroll",
|
|
478
|
+
description: "Scroll. Args: direction(up|down|left|right), px?, selector?."
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "scrollintoview",
|
|
482
|
+
description: "Scroll an element into view. Args: selector."
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "drag",
|
|
486
|
+
description: "Drag and drop. Args: source, target."
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: "upload",
|
|
490
|
+
description: "Upload local file(s) to a file input. Args: selector, files[]."
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "find",
|
|
494
|
+
description: "Act by semantic locator. Args: by(role|text|label|placeholder|alt|title|testid), query, action(click|fill|type|hover|focus|check|uncheck|text), value?, name?, exact?."
|
|
495
|
+
},
|
|
496
|
+
// AI fallbacks
|
|
497
|
+
{
|
|
498
|
+
name: "act",
|
|
499
|
+
description: "Act on the page: ref+action (deterministic) or natural-language instruction (engine AI). Args: ref?, action?, value?, instruction?."
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: "extract",
|
|
503
|
+
description: "Extract data by natural-language instruction (engine AI). Args: instruction."
|
|
504
|
+
},
|
|
505
|
+
// wait
|
|
506
|
+
{
|
|
507
|
+
name: "wait",
|
|
508
|
+
description: "Wait for a condition. Provide one of: selector(+state), ms, text, url, load, fn."
|
|
509
|
+
},
|
|
510
|
+
// tabs / frames
|
|
511
|
+
{
|
|
512
|
+
name: "tab",
|
|
513
|
+
description: "Manage tabs. Args: action(list|new|switch|close), target?, url?, label?."
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: "window_new",
|
|
517
|
+
description: "Open a new browser window. Args: url?."
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
name: "frame",
|
|
521
|
+
description: 'Switch frame context. Args: target(@eN | CSS | "main").'
|
|
522
|
+
},
|
|
523
|
+
// capture
|
|
524
|
+
{
|
|
525
|
+
name: "screenshot",
|
|
526
|
+
description: "Screenshot the page. Args: fullPage?, path?."
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
name: "pdf",
|
|
530
|
+
description: "Save the page as PDF. Args: path."
|
|
531
|
+
},
|
|
532
|
+
// state
|
|
533
|
+
{
|
|
534
|
+
name: "cookies",
|
|
535
|
+
description: "Manage cookies. Args: action(get|set|clear), name?, value?."
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: "storage",
|
|
539
|
+
description: "Manage web storage. Args: area(local|session), action(get|set|clear), key?, value?."
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
name: "set",
|
|
543
|
+
description: "Configure the browser. Args: setting(viewport|device|geo|headers|credentials|media), args[]."
|
|
544
|
+
},
|
|
545
|
+
// files / clipboard
|
|
546
|
+
{
|
|
547
|
+
name: "download",
|
|
548
|
+
description: "Download a file (click a selector to trigger, or wait for one). Args: selector?, path?."
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "clipboard",
|
|
552
|
+
description: "Clipboard. Args: action(read|write|copy|paste), text?."
|
|
553
|
+
},
|
|
554
|
+
// auth (use-only)
|
|
555
|
+
{
|
|
556
|
+
name: "auth",
|
|
557
|
+
description: "Use a saved login profile. Args: action(login|list|show), name?. (Credentials are saved via the desktop, never the agent.)"
|
|
558
|
+
},
|
|
559
|
+
// confirmation gate
|
|
560
|
+
{
|
|
561
|
+
name: "confirm",
|
|
562
|
+
description: "Approve a pending confirmation_required action. Args: id."
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: "deny",
|
|
566
|
+
description: "Reject a pending confirmation_required action. Args: id."
|
|
567
|
+
},
|
|
568
|
+
// network / debug / input / state-files
|
|
569
|
+
{
|
|
570
|
+
name: "network",
|
|
571
|
+
description: "Inspect/control network. Args: action(route|unroute|requests|har) + relevant fields."
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "console",
|
|
575
|
+
description: "View browser console messages. Args: clear?."
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "errors",
|
|
579
|
+
description: "View uncaught page JS errors. Args: clear?."
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "mouse",
|
|
583
|
+
description: "Low-level mouse. Args: action(move|down|up|wheel), x?, y?, button?, dy?, dx?."
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "keyboard",
|
|
587
|
+
description: "Low-level keyboard at focus. Args: action(type|inserttext|keydown|keyup), text?, key?."
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: "state",
|
|
591
|
+
description: "Persist/restore storage+auth state to a file. Args: action(save|load|list|clear), path?."
|
|
592
|
+
}
|
|
593
|
+
];
|
|
594
|
+
BROWSER_COMMAND_NAMES = BROWSER_COMMANDS.map((c) => c.name);
|
|
595
|
+
REASONING_EFFORT_VALUES = [
|
|
596
|
+
"off",
|
|
597
|
+
"minimal",
|
|
598
|
+
"low",
|
|
599
|
+
"medium",
|
|
600
|
+
"high",
|
|
601
|
+
"max"
|
|
602
|
+
];
|
|
190
603
|
AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
191
604
|
DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
192
605
|
|
|
@@ -1764,7 +2177,8 @@ var init_skill_handler = __esm({
|
|
|
1764
2177
|
const response = await api.publishSkillVersion(entityId, version);
|
|
1765
2178
|
return {
|
|
1766
2179
|
success: response.success,
|
|
1767
|
-
error: response.error?.message
|
|
2180
|
+
error: response.error?.message,
|
|
2181
|
+
agentVersion: response.data?.agentVersion
|
|
1768
2182
|
};
|
|
1769
2183
|
}
|
|
1770
2184
|
prepareForPush(manifest, name, projectPath = process.cwd(), bundleAccumulator) {
|
|
@@ -4644,6 +5058,9 @@ var init_agents_api_service = __esm({
|
|
|
4644
5058
|
} : {},
|
|
4645
5059
|
...body.webhookPayload !== void 0 ? {
|
|
4646
5060
|
webhookPayload: body.webhookPayload
|
|
5061
|
+
} : {},
|
|
5062
|
+
...body.clientContext !== void 0 ? {
|
|
5063
|
+
clientContext: body.clientContext
|
|
4647
5064
|
} : {}
|
|
4648
5065
|
};
|
|
4649
5066
|
}
|
|
@@ -5095,6 +5512,12 @@ var init_channels_send_api_service = __esm({
|
|
|
5095
5512
|
Authorization: `Bearer ${this.apiKey}`
|
|
5096
5513
|
});
|
|
5097
5514
|
}
|
|
5515
|
+
/** POST /developer/agents/:agentId/channels/whatsapp/reaction */
|
|
5516
|
+
async sendWhatsAppReaction(input) {
|
|
5517
|
+
return this.httpPost(`/developer/agents/${this.agentId}/channels/whatsapp/reaction`, input, {
|
|
5518
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
5519
|
+
});
|
|
5520
|
+
}
|
|
5098
5521
|
/** POST /developer/agents/:agentId/channels/email/send */
|
|
5099
5522
|
async sendEmail(input) {
|
|
5100
5523
|
return this.httpPost(`/developer/agents/${this.agentId}/channels/email/send`, input, {
|
|
@@ -5126,6 +5549,17 @@ var init_channels_send_api_service = __esm({
|
|
|
5126
5549
|
}
|
|
5127
5550
|
return result.data;
|
|
5128
5551
|
}
|
|
5552
|
+
/** Sandbox helper for WhatsApp reaction sends. */
|
|
5553
|
+
async sendWhatsAppReactionForSandbox(input) {
|
|
5554
|
+
const result = await this.sendWhatsAppReaction(input);
|
|
5555
|
+
if (!result.success) {
|
|
5556
|
+
throw new Error(result.error?.message || "WhatsApp reaction send failed");
|
|
5557
|
+
}
|
|
5558
|
+
if (!result.data) {
|
|
5559
|
+
throw new Error("WhatsApp reaction send failed: empty response");
|
|
5560
|
+
}
|
|
5561
|
+
return result.data;
|
|
5562
|
+
}
|
|
5129
5563
|
/** Sandbox helper for email sends. */
|
|
5130
5564
|
async sendEmailForSandbox(input) {
|
|
5131
5565
|
const result = await this.sendEmail(input);
|
|
@@ -5141,6 +5575,44 @@ var init_channels_send_api_service = __esm({
|
|
|
5141
5575
|
}
|
|
5142
5576
|
});
|
|
5143
5577
|
|
|
5578
|
+
// src/api/directory.api.service.ts
|
|
5579
|
+
var DirectoryApiService;
|
|
5580
|
+
var init_directory_api_service = __esm({
|
|
5581
|
+
"src/api/directory.api.service.ts"() {
|
|
5582
|
+
"use strict";
|
|
5583
|
+
init_http_client();
|
|
5584
|
+
DirectoryApiService = class extends HttpClient {
|
|
5585
|
+
static {
|
|
5586
|
+
__name(this, "DirectoryApiService");
|
|
5587
|
+
}
|
|
5588
|
+
apiKey;
|
|
5589
|
+
agentId;
|
|
5590
|
+
constructor(baseUrl, apiKey, agentId) {
|
|
5591
|
+
super(baseUrl), this.apiKey = apiKey, this.agentId = agentId;
|
|
5592
|
+
}
|
|
5593
|
+
/** POST /developer/agents/:agentId/directory/resolve */
|
|
5594
|
+
async resolve(name) {
|
|
5595
|
+
return this.httpPost(`/developer/agents/${this.agentId}/directory/resolve`, {
|
|
5596
|
+
name
|
|
5597
|
+
}, {
|
|
5598
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
5599
|
+
});
|
|
5600
|
+
}
|
|
5601
|
+
/** Sandbox helper: throws on non-success, returns unwrapped result. */
|
|
5602
|
+
async resolveForSandbox(name) {
|
|
5603
|
+
const result = await this.resolve(name);
|
|
5604
|
+
if (!result.success) {
|
|
5605
|
+
throw new Error(result.error?.message || "Directory resolve failed");
|
|
5606
|
+
}
|
|
5607
|
+
if (!result.data) {
|
|
5608
|
+
throw new Error("Directory resolve failed: empty response");
|
|
5609
|
+
}
|
|
5610
|
+
return result.data;
|
|
5611
|
+
}
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
});
|
|
5615
|
+
|
|
5144
5616
|
// src/api/device.api.service.ts
|
|
5145
5617
|
var device_api_service_exports = {};
|
|
5146
5618
|
__export(device_api_service_exports, {
|
|
@@ -5237,6 +5709,7 @@ __export(lazy_instances_exports, {
|
|
|
5237
5709
|
getDataInstance: () => getDataInstance,
|
|
5238
5710
|
getDeveloperInstance: () => getDeveloperInstance,
|
|
5239
5711
|
getDeviceInstance: () => getDeviceInstance,
|
|
5712
|
+
getDirectoryInstance: () => getDirectoryInstance,
|
|
5240
5713
|
getJobInstance: () => getJobInstance,
|
|
5241
5714
|
getOrderInstance: () => getOrderInstance,
|
|
5242
5715
|
getProductsInstance: () => getProductsInstance,
|
|
@@ -5351,6 +5824,13 @@ async function getChannelsSendInstance() {
|
|
|
5351
5824
|
}
|
|
5352
5825
|
return _channelsSendInstance;
|
|
5353
5826
|
}
|
|
5827
|
+
async function getDirectoryInstance() {
|
|
5828
|
+
if (!_directoryInstance) {
|
|
5829
|
+
const creds = await getCredentials();
|
|
5830
|
+
_directoryInstance = new DirectoryApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
|
|
5831
|
+
}
|
|
5832
|
+
return _directoryInstance;
|
|
5833
|
+
}
|
|
5354
5834
|
function clearAllInstances() {
|
|
5355
5835
|
_userInstance = null;
|
|
5356
5836
|
_dataInstance = null;
|
|
@@ -5366,8 +5846,9 @@ function clearAllInstances() {
|
|
|
5366
5846
|
_developerInstance = null;
|
|
5367
5847
|
_voiceInstance = null;
|
|
5368
5848
|
_channelsSendInstance = null;
|
|
5849
|
+
_directoryInstance = null;
|
|
5369
5850
|
}
|
|
5370
|
-
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _deviceInstance;
|
|
5851
|
+
var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance;
|
|
5371
5852
|
var init_lazy_instances = __esm({
|
|
5372
5853
|
"src/api/lazy-instances.ts"() {
|
|
5373
5854
|
"use strict";
|
|
@@ -5387,6 +5868,7 @@ var init_lazy_instances = __esm({
|
|
|
5387
5868
|
init_developer_api_service();
|
|
5388
5869
|
init_voice_api_service();
|
|
5389
5870
|
init_channels_send_api_service();
|
|
5871
|
+
init_directory_api_service();
|
|
5390
5872
|
_userInstance = null;
|
|
5391
5873
|
_dataInstance = null;
|
|
5392
5874
|
_productsInstance = null;
|
|
@@ -5401,6 +5883,7 @@ var init_lazy_instances = __esm({
|
|
|
5401
5883
|
_developerInstance = null;
|
|
5402
5884
|
_voiceInstance = null;
|
|
5403
5885
|
_channelsSendInstance = null;
|
|
5886
|
+
_directoryInstance = null;
|
|
5404
5887
|
__name(getUserInstance, "getUserInstance");
|
|
5405
5888
|
__name(getDataInstance, "getDataInstance");
|
|
5406
5889
|
__name(getProductsInstance, "getProductsInstance");
|
|
@@ -5417,6 +5900,7 @@ var init_lazy_instances = __esm({
|
|
|
5417
5900
|
__name(getDeveloperInstance, "getDeveloperInstance");
|
|
5418
5901
|
__name(getVoiceInstance, "getVoiceInstance");
|
|
5419
5902
|
__name(getChannelsSendInstance, "getChannelsSendInstance");
|
|
5903
|
+
__name(getDirectoryInstance, "getDirectoryInstance");
|
|
5420
5904
|
__name(clearAllInstances, "clearAllInstances");
|
|
5421
5905
|
}
|
|
5422
5906
|
});
|
|
@@ -5435,6 +5919,7 @@ function assertValidToolName(name) {
|
|
|
5435
5919
|
__name(assertValidToolName, "assertValidToolName");
|
|
5436
5920
|
|
|
5437
5921
|
// src/types/skill.ts
|
|
5922
|
+
init_dist();
|
|
5438
5923
|
var env = /* @__PURE__ */ __name((key) => {
|
|
5439
5924
|
if (process.env[key]) {
|
|
5440
5925
|
return process.env[key];
|
|
@@ -5879,6 +6364,18 @@ function validateModelSettings(settings) {
|
|
|
5879
6364
|
throw new Error("Agent modelSettings.stopSequences must be a string array");
|
|
5880
6365
|
}
|
|
5881
6366
|
}
|
|
6367
|
+
if (settings.reasoning !== void 0) {
|
|
6368
|
+
if (typeof settings.reasoning !== "object" || settings.reasoning === null || Array.isArray(settings.reasoning)) {
|
|
6369
|
+
throw new Error("Agent modelSettings.reasoning must be an object");
|
|
6370
|
+
}
|
|
6371
|
+
const { effort, show } = settings.reasoning;
|
|
6372
|
+
if (effort !== void 0 && !REASONING_EFFORT_VALUES.includes(effort)) {
|
|
6373
|
+
throw new Error(`Agent modelSettings.reasoning.effort must be one of: ${REASONING_EFFORT_VALUES.join(", ")}`);
|
|
6374
|
+
}
|
|
6375
|
+
if (show !== void 0 && typeof show !== "boolean") {
|
|
6376
|
+
throw new Error("Agent modelSettings.reasoning.show must be a boolean");
|
|
6377
|
+
}
|
|
6378
|
+
}
|
|
5882
6379
|
}
|
|
5883
6380
|
__name(validateModelSettings, "validateModelSettings");
|
|
5884
6381
|
var LuaAgent = class {
|
|
@@ -5901,6 +6398,7 @@ var LuaAgent = class {
|
|
|
5901
6398
|
voices;
|
|
5902
6399
|
batching;
|
|
5903
6400
|
governance;
|
|
6401
|
+
browser;
|
|
5904
6402
|
/**
|
|
5905
6403
|
* Creates a new LuaAgent instance.
|
|
5906
6404
|
*
|
|
@@ -5942,10 +6440,15 @@ var LuaAgent = class {
|
|
|
5942
6440
|
this.voices = config.voices;
|
|
5943
6441
|
this.batching = config.batching;
|
|
5944
6442
|
this.governance = config.governance;
|
|
6443
|
+
this.browser = config.browser;
|
|
5945
6444
|
}
|
|
5946
6445
|
getName() {
|
|
5947
6446
|
return this.name;
|
|
5948
6447
|
}
|
|
6448
|
+
/** Browser switch (LuaBrowser) — `true`/config when the agent can browse. */
|
|
6449
|
+
getBrowser() {
|
|
6450
|
+
return this.browser;
|
|
6451
|
+
}
|
|
5949
6452
|
getPersona() {
|
|
5950
6453
|
return this.persona;
|
|
5951
6454
|
}
|
|
@@ -6603,6 +7106,11 @@ var Channels = {
|
|
|
6603
7106
|
const { getChannelsSendInstance: getChannelsSendInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
|
|
6604
7107
|
const channels = await getChannelsSendInstance2();
|
|
6605
7108
|
return channels.sendWhatsAppTemplateForSandbox(input);
|
|
7109
|
+
},
|
|
7110
|
+
async sendReaction(input) {
|
|
7111
|
+
const { getChannelsSendInstance: getChannelsSendInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
|
|
7112
|
+
const channels = await getChannelsSendInstance2();
|
|
7113
|
+
return channels.sendWhatsAppReactionForSandbox(input);
|
|
6606
7114
|
}
|
|
6607
7115
|
},
|
|
6608
7116
|
email: {
|
|
@@ -6613,6 +7121,13 @@ var Channels = {
|
|
|
6613
7121
|
}
|
|
6614
7122
|
}
|
|
6615
7123
|
};
|
|
7124
|
+
var Team = {
|
|
7125
|
+
async findMember(name) {
|
|
7126
|
+
const { getDirectoryInstance: getDirectoryInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
|
|
7127
|
+
const directory = await getDirectoryInstance2();
|
|
7128
|
+
return directory.resolveForSandbox(name);
|
|
7129
|
+
}
|
|
7130
|
+
};
|
|
6616
7131
|
var Templates = {
|
|
6617
7132
|
/**
|
|
6618
7133
|
* WhatsApp Templates
|
|
@@ -6781,6 +7296,7 @@ export {
|
|
|
6781
7296
|
PreProcessor,
|
|
6782
7297
|
ProductInstance,
|
|
6783
7298
|
Products,
|
|
7299
|
+
Team,
|
|
6784
7300
|
Templates,
|
|
6785
7301
|
ToolFlag,
|
|
6786
7302
|
User,
|