lua-cli 3.25.0 → 3.27.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.
@@ -51,6 +51,18 @@ declare interface AgentInvocationInput {
51
51
  threadId?: string;
52
52
  /** Channel identifier, defaults to `'agent-invocation'`. */
53
53
  channel?: string;
54
+ /**
55
+ * T12.2.4 — retry-stable per-run identity for the `occurrence` outcome
56
+ * dedupe mode (jobExecution ledger's `occurrenceId ?? executionId`). Only
57
+ * honored server-side on internally-authenticated turns.
58
+ */
59
+ occurrenceId?: string;
60
+ /**
61
+ * T12.2.4 — retry-stable event identity for the `event` outcome dedupe mode
62
+ * (event execution ledger's stable eventId — runtime T5.5's stamp). Only
63
+ * honored server-side on internally-authenticated turns.
64
+ */
65
+ eventId?: string;
54
66
  /** Free-form request tag persisted on the stored Message record (e.g. a UUID
55
67
  * or external trace id for correlation). Not a user identifier. Omitted
56
68
  * by default. */
@@ -70,8 +82,23 @@ declare interface AgentInvocationInput {
70
82
  * the original BAC-107 spec; wired through as part of PRO-186.
71
83
  */
72
84
  webhookPayload?: unknown;
73
- /** Per-call timeout in ms. Absent ⇒ the client default (120s). Set by scheduled agent jobs
74
- * to 180s so the cloud tier cuts off at the same point the desktop's local runner does. */
85
+ /**
86
+ * Per-call timeout in ms. Absent the client default (120s).
87
+ *
88
+ * Honoured on both invocation paths: in-process it becomes the loopback
89
+ * axios timeout, and out-of-process the sandbox runner derives its own abort
90
+ * deadline from it plus a hop margin (BAC-413 — it previously used a flat
91
+ * 125s, silently capping anything larger).
92
+ *
93
+ * The effective upper bound is the calling site's own budget, not this
94
+ * field: VM-executed sites (tool / job / webhook / pre- and post-processor)
95
+ * are walled at 180s, and the runner clamps to the wall that remains minus
96
+ * recovery headroom — past that the pool's SIGTERM watchdog ends the whole
97
+ * execution, so a larger value buys nothing. Scheduled agent jobs
98
+ * invoke lua-core directly, never entering the VM, and pass
99
+ * `normalizeLuaJobExecutionTimeoutSeconds(timeout) * 1000` — 300s by
100
+ * default, 600s max (`job-timeout.constants.ts`).
101
+ */
75
102
  timeoutMs?: number;
76
103
  /** Per-request model override ("provider/model" code). Unknown codes fall back per
77
104
  * approved-models policy server-side. */
@@ -824,6 +851,13 @@ export declare const Channels: ChannelsApi;
824
851
  * subject: 'Your order',
825
852
  * html: '<p>Thanks for your order!</p>',
826
853
  * });
854
+ *
855
+ * // Post into a Teams group chat the agent is already part of
856
+ * await Channels.send({
857
+ * channel: 'teams',
858
+ * to: { conversationId: '19:9495c339...@thread.v2' },
859
+ * text: 'Sample LOT-4471 is missing origin and cupping score.',
860
+ * });
827
861
  * ```
828
862
  */
829
863
  export declare interface ChannelsApi {
@@ -831,6 +865,11 @@ export declare interface ChannelsApi {
831
865
  * Send a text message on any supported channel.
832
866
  * Returns `ChannelSendOutput` — check `persisted` if memory durability matters.
833
867
  *
868
+ * Address a person with `userId` (any channel), `phoneNumber` (whatsapp/sms)
869
+ * or `email`. Address a shared conversation with `conversationId` (teams
870
+ * only) — everyone in it receives the message, and because there is no single
871
+ * recipient the send returns `persisted: false`.
872
+ *
834
873
  * @example
835
874
  * ```typescript
836
875
  * const result = await Channels.send({
@@ -930,6 +969,8 @@ export declare interface ChannelSendOptions {
930
969
  */
931
970
  export declare interface ChannelSendOutput {
932
971
  delivered: boolean;
972
+ /** False for conversation-scoped sends: a shared conversation has no single
973
+ * user to attribute the message to, so nothing is written to agent memory. */
933
974
  persisted: boolean;
934
975
  /**
935
976
  * True when the send was deferred to the WhatsApp message-request queue
@@ -948,11 +989,15 @@ export declare interface ChannelSendOutput {
948
989
 
949
990
  /** Recipient — exactly one of the fields must be set. userId works on every
950
991
  * channel (resolved via the user's channel history); raw identifiers only on
951
- * cold-start-capable channels (whatsapp/sms → phoneNumber, email → email). */
992
+ * cold-start-capable channels (whatsapp/sms → phoneNumber, email → email).
993
+ * `conversationId` addresses a shared conversation rather than a person —
994
+ * everyone in it receives the message. Teams only, and warm-only: the agent
995
+ * must already be part of that conversation. */
952
996
  export declare interface ChannelSendTarget {
953
997
  userId?: string;
954
998
  phoneNumber?: string;
955
999
  email?: string;
1000
+ conversationId?: string;
956
1001
  }
957
1002
 
958
1003
  /**
@@ -1028,6 +1073,17 @@ export declare interface ChatHistoryMessage {
1028
1073
  * to render a "Voice call" divider in the thread.
1029
1074
  */
1030
1075
  source?: 'voice' | 'chat';
1076
+ /** Concrete model that served this assistant turn, persisted in content metadata. */
1077
+ model?: string;
1078
+ /** True when the turn reached that model through the Auto selector. */
1079
+ autoModelRequested?: boolean;
1080
+ author?: {
1081
+ userId: string;
1082
+ };
1083
+ agent?: {
1084
+ agentId: string;
1085
+ name?: string;
1086
+ };
1031
1087
  /**
1032
1088
  * Permanent recording for a voice-note turn (Lua Desktop). Populated by the
1033
1089
  * admin threads history endpoint from the row's `content.metadata.audio` — a
@@ -1885,6 +1941,90 @@ declare interface InboxPushReceipt {
1885
1941
  reason?: string;
1886
1942
  }
1887
1943
 
1944
+ /** HTTP methods the passthrough relay accepts. */
1945
+ declare const INTEGRATION_PASSTHROUGH_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"];
1946
+
1947
+ export declare type IntegrationPassthroughMethod = (typeof INTEGRATION_PASSTHROUGH_METHODS)[number];
1948
+
1949
+ /**
1950
+ * One raw provider API call, relative to the provider's API base URL
1951
+ * (e.g. `repos/{owner}/{repo}/pulls/42/files` against GitHub).
1952
+ */
1953
+ export declare interface IntegrationPassthroughRequest {
1954
+ /** HTTP method of the provider call. */
1955
+ method: IntegrationPassthroughMethod;
1956
+ /** Provider path after the provider's base URL. A leading `/` is tolerated. */
1957
+ path: string;
1958
+ /** Query-string parameters (pagination etc.). */
1959
+ query?: Record<string, string | number | boolean>;
1960
+ /**
1961
+ * Request body. Objects/arrays are sent as JSON; a string is sent verbatim
1962
+ * (set a Content-Type header for non-JSON payloads).
1963
+ */
1964
+ data?: unknown;
1965
+ /**
1966
+ * Extra request headers forwarded to the provider (e.g.
1967
+ * `{ Accept: 'application/vnd.github.diff' }`). `Authorization` is managed
1968
+ * server-side and cannot be overridden.
1969
+ */
1970
+ headers?: Record<string, string>;
1971
+ }
1972
+
1973
+ /**
1974
+ * The raw provider response. Provider error statuses (401/403/404/…) are
1975
+ * relayed faithfully in `status` with the provider's own body in `data` —
1976
+ * they are NOT converted into thrown errors.
1977
+ */
1978
+ export declare interface IntegrationPassthroughResponse {
1979
+ /** Provider HTTP status code. */
1980
+ status: number;
1981
+ /** Provider response headers (lower-cased names). */
1982
+ headers: Record<string, string>;
1983
+ /**
1984
+ * Provider response body: parsed JSON when the response is JSON, the raw
1985
+ * string otherwise (e.g. a `text/plain` unified diff round-trips intact).
1986
+ */
1987
+ data: unknown;
1988
+ }
1989
+
1990
+ export declare const Integrations: IntegrationsApi;
1991
+
1992
+ /**
1993
+ * Integrations API — raw provider API access through the agent's connected
1994
+ * integrations (Unified.to passthrough). Proxied server-side: your code never
1995
+ * sees provider credentials or the workspace Unified.to key.
1996
+ */
1997
+ export declare interface IntegrationsApi {
1998
+ /**
1999
+ * Call the provider's raw API through the agent's own bound connection for
2000
+ * `integrationType`. Request headers are forwarded (e.g.
2001
+ * `Accept: application/vnd.github.diff`), query params are supported, and
2002
+ * JSON bodies POST through. The response envelope relays the provider's
2003
+ * status/headers faithfully — a provider 403 (missing OAuth scope) shows up
2004
+ * in `status`, not as a thrown error. `data` is parsed JSON when the
2005
+ * provider responded with JSON, the raw string otherwise (unified diffs
2006
+ * round-trip intact).
2007
+ *
2008
+ * @example
2009
+ * ```typescript
2010
+ * // Read a PR diff (non-JSON response comes back as a string)
2011
+ * const diff = await Integrations.passthrough('github', {
2012
+ * method: 'GET',
2013
+ * path: 'repos/acme/app/pulls/42',
2014
+ * headers: { Accept: 'application/vnd.github.diff' },
2015
+ * });
2016
+ *
2017
+ * // Approve the PR (JSON body POST)
2018
+ * await Integrations.passthrough('github', {
2019
+ * method: 'POST',
2020
+ * path: 'repos/acme/app/pulls/42/reviews',
2021
+ * data: { event: 'APPROVE' },
2022
+ * });
2023
+ * ```
2024
+ */
2025
+ passthrough(integrationType: string, request: IntegrationPassthroughRequest): Promise<IntegrationPassthroughResponse>;
2026
+ }
2027
+
1888
2028
  /**
1889
2029
  * Job with versions array
1890
2030
  * Matches JobDto and job.schema.ts
@@ -365,6 +365,9 @@ function resolveRequireToolApproval(rules) {
365
365
  function buildDefaultPersona(agentName) {
366
366
  return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
367
367
  }
368
+ function buildPersonalSpaceStartingPersona(agentName) {
369
+ return PERSONAL_SPACE_STARTING_PERSONA.replace(new RegExp(AGENT_NAME_TOKEN.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), () => agentName || "Your assistant");
370
+ }
368
371
  function resolveLuaJobTimeoutSeconds(timeout) {
369
372
  const resolved = timeout ?? LUA_JOB_DEFAULT_TIMEOUT_SECONDS;
370
373
  if (!Number.isInteger(resolved)) {
@@ -381,7 +384,7 @@ function normalizeLuaJobExecutionTimeoutSeconds(timeout) {
381
384
  }
382
385
  return Math.min(Math.max(timeout, LUA_JOB_MIN_TIMEOUT_SECONDS), LUA_JOB_MAX_TIMEOUT_SECONDS);
383
386
  }
384
- 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, IMPLICIT_MODEL_SELECTION_SOURCES, 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;
387
+ 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, IMPLICIT_MODEL_SELECTION_SOURCES, AGENT_NAME_TOKEN, DEFAULT_PERSONA_GUIDE, PERSONAL_SPACE_STARTING_PERSONA, 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;
385
388
  var init_dist = __esm({
386
389
  "../shared-types/dist/index.mjs"() {
387
390
  "use strict";
@@ -761,6 +764,40 @@ Feel free to add, remove, or rename sections. Your persona can be a single parag
761
764
  `;
762
765
  __name(buildDefaultPersona, "buildDefaultPersona");
763
766
  __name2(buildDefaultPersona, "buildDefaultPersona");
767
+ PERSONAL_SPACE_STARTING_PERSONA = `# ${AGENT_NAME_TOKEN}
768
+
769
+ You are ${AGENT_NAME_TOKEN}, the assistant for whoever is chatting with you here. Your job is simple: help them get things done, and get better at it every day.
770
+
771
+ ## You're just getting started
772
+
773
+ This workspace is new. What you already know about the person lives in your memory \u2014 the "Known about this user" notes are verified facts, so use them like you've known them all along; never say you don't know something that's written there. Beyond that, don't pretend. Pay attention instead: how they write, what they ask for, what they're working on. When something matters and you're not sure, ask. One good question beats a wrong guess.
774
+
775
+ ## You have real tools
776
+
777
+ You can do a lot more than talk. Use your tools when they help, and be straight about what worked and what didn't. The more you learn, the more you can take off their plate without being asked.
778
+
779
+ ## How you sound
780
+
781
+ Like a sharp, warm human who's on their side. Plain words. Short sentences when short works. React like a person would: if something's great, say so; if something's off, say that too. No corporate filler, no fake enthusiasm.
782
+
783
+ ## What you hold yourself to
784
+
785
+ - Never make up facts about the person, and never claim you did something you didn't.
786
+ - What you learn about them serves them. Nothing else.
787
+ - If you can't do something, say so and offer what you can do.
788
+
789
+ ## Where you come from
790
+
791
+ You live on Lua, the platform this workspace runs on. Lua gives people AI agents that do real work for them, and it lives at heylua.ai. It was founded by Lorcan (CEO) and Stefan (CTO).
792
+
793
+ If someone asks about Lua itself, have fun with it. It's your hometown, so show them around like a proud local: keep the facts straight, keep the delivery playful and a little whimsical. For anything you don't know (pricing, plans, roadmap), point them to heylua.ai instead of guessing.
794
+
795
+ ## Keep this persona alive
796
+
797
+ This text is who you are for this person. As you learn them, their name, their work, what they care about, update it so tomorrow's you starts smarter than today's. Keep it about who they are and who you are for them.
798
+ `;
799
+ __name(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
800
+ __name2(buildPersonalSpaceStartingPersona, "buildPersonalSpaceStartingPersona");
764
801
  VoiceNameSchema = z.string().regex(/^[a-zA-Z0-9_-]+$/, "Voice name must contain only alphanumeric characters, underscores, or hyphens").min(1).max(64);
765
802
  PluginProviderSchema = z.enum([
766
803
  "deepgram",
@@ -2435,6 +2472,7 @@ var init_files = __esm({
2435
2472
  "preprocessors",
2436
2473
  "postprocessors",
2437
2474
  "mcpServers",
2475
+ "template",
2438
2476
  "skill"
2439
2477
  ];
2440
2478
  __name(yamlKeySorter, "yamlKeySorter");
@@ -5246,6 +5284,43 @@ var init_ai_api_service = __esm({
5246
5284
  }
5247
5285
  });
5248
5286
 
5287
+ // src/api/integrations.api.service.ts
5288
+ var IntegrationsApiService;
5289
+ var init_integrations_api_service = __esm({
5290
+ "src/api/integrations.api.service.ts"() {
5291
+ "use strict";
5292
+ init_http_client();
5293
+ IntegrationsApiService = class extends HttpClient {
5294
+ static {
5295
+ __name(this, "IntegrationsApiService");
5296
+ }
5297
+ apiKey;
5298
+ agentId;
5299
+ constructor(baseUrl, apiKey, agentId) {
5300
+ super(baseUrl), this.apiKey = apiKey, this.agentId = agentId;
5301
+ }
5302
+ async passthrough(integrationType, request) {
5303
+ return this.httpPost(`/developer/unifiedto/connections/${encodeURIComponent(this.agentId)}/passthrough/${encodeURIComponent(integrationType)}`, request, {
5304
+ Authorization: `Bearer ${this.apiKey}`
5305
+ });
5306
+ }
5307
+ /**
5308
+ * Sandbox-facing wrapper: returns the raw provider envelope
5309
+ * `{ status, headers, data }` (provider error statuses relayed faithfully in
5310
+ * `status`), and throws only on route-level failures (no connection,
5311
+ * passthrough disabled, rate limited, transport error).
5312
+ */
5313
+ async passthroughForSandbox(integrationType, request) {
5314
+ const result = await this.passthrough(integrationType, request);
5315
+ if (!result.success || !result.data) {
5316
+ throw new Error(result.error?.message || `Integration passthrough failed for '${integrationType}'`);
5317
+ }
5318
+ return result.data;
5319
+ }
5320
+ };
5321
+ }
5322
+ });
5323
+
5249
5324
  // src/api/agents.api.service.ts
5250
5325
  var AgentsApiService;
5251
5326
  var init_agents_api_service = __esm({
@@ -5992,6 +6067,7 @@ __export(lazy_instances_exports, {
5992
6067
  getDeviceInstance: () => getDeviceInstance,
5993
6068
  getDirectoryInstance: () => getDirectoryInstance,
5994
6069
  getInboxPushInstance: () => getInboxPushInstance,
6070
+ getIntegrationsInstance: () => getIntegrationsInstance,
5995
6071
  getJobInstance: () => getJobInstance,
5996
6072
  getOrderInstance: () => getOrderInstance,
5997
6073
  getProductsInstance: () => getProductsInstance,
@@ -6056,6 +6132,13 @@ async function getAiInstance() {
6056
6132
  }
6057
6133
  return _aiInstance;
6058
6134
  }
6135
+ async function getIntegrationsInstance() {
6136
+ if (!_integrationsInstance) {
6137
+ const creds = await getCredentials();
6138
+ _integrationsInstance = new IntegrationsApiService(BASE_URLS.API, creds.apiKey, creds.agentId);
6139
+ }
6140
+ return _integrationsInstance;
6141
+ }
6059
6142
  async function getAgentsInstance() {
6060
6143
  if (!_agentsInstance) {
6061
6144
  const creds = await getCredentials();
@@ -6137,7 +6220,7 @@ function clearAllInstances() {
6137
6220
  _channelsSendInstance = null;
6138
6221
  _directoryInstance = null;
6139
6222
  }
6140
- var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance, _inboxPushInstance;
6223
+ var _userInstance, _dataInstance, _productsInstance, _basketsInstance, _orderInstance, _webhookInstance, _jobInstance, _aiInstance, _integrationsInstance, _agentsInstance, _whatsAppTemplatesInstance, _cdnInstance, _developerInstance, _voiceInstance, _channelsSendInstance, _directoryInstance, _deviceInstance, _inboxPushInstance;
6141
6224
  var init_lazy_instances = __esm({
6142
6225
  "src/api/lazy-instances.ts"() {
6143
6226
  "use strict";
@@ -6151,6 +6234,7 @@ var init_lazy_instances = __esm({
6151
6234
  init_webhook_api_service();
6152
6235
  init_job_api_service();
6153
6236
  init_ai_api_service();
6237
+ init_integrations_api_service();
6154
6238
  init_agents_api_service();
6155
6239
  init_whatsapp_templates_api_service();
6156
6240
  init_cdn_api_service();
@@ -6167,6 +6251,7 @@ var init_lazy_instances = __esm({
6167
6251
  _webhookInstance = null;
6168
6252
  _jobInstance = null;
6169
6253
  _aiInstance = null;
6254
+ _integrationsInstance = null;
6170
6255
  _agentsInstance = null;
6171
6256
  _whatsAppTemplatesInstance = null;
6172
6257
  _cdnInstance = null;
@@ -6182,6 +6267,7 @@ var init_lazy_instances = __esm({
6182
6267
  __name(getWebhookInstance, "getWebhookInstance");
6183
6268
  __name(getJobInstance, "getJobInstance");
6184
6269
  __name(getAiInstance, "getAiInstance");
6270
+ __name(getIntegrationsInstance, "getIntegrationsInstance");
6185
6271
  __name(getAgentsInstance, "getAgentsInstance");
6186
6272
  __name(getWhatsAppTemplatesInstance, "getWhatsAppTemplatesInstance");
6187
6273
  __name(getCdnInstance, "getCdnInstance");
@@ -7445,6 +7531,13 @@ var AI = {
7445
7531
  return ai.generateForSandbox(promptOrOptions, content);
7446
7532
  }
7447
7533
  };
7534
+ var Integrations = {
7535
+ async passthrough(integrationType, request) {
7536
+ const { getIntegrationsInstance: getIntegrationsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
7537
+ const integrations = await getIntegrationsInstance2();
7538
+ return integrations.passthroughForSandbox(integrationType, request);
7539
+ }
7540
+ };
7448
7541
  var Agents = {
7449
7542
  async invoke(targetAgentId, promptOrInput) {
7450
7543
  const { getAgentsInstance: getAgentsInstance2 } = await Promise.resolve().then(() => (init_lazy_instances(), lazy_instances_exports));
@@ -7643,6 +7736,7 @@ export {
7643
7736
  Channels,
7644
7737
  Data,
7645
7738
  DataEntryInstance,
7739
+ Integrations,
7646
7740
  JobInstance,
7647
7741
  Jobs,
7648
7742
  Lua,