lua-cli 3.14.1 → 3.15.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.
Files changed (164) hide show
  1. package/dist/api/agent.api.service.d.ts +12 -0
  2. package/dist/api/agent.api.service.d.ts.map +1 -1
  3. package/dist/api/agent.api.service.js +13 -0
  4. package/dist/api/agent.api.service.js.map +1 -1
  5. package/dist/api/http.client.d.ts.map +1 -1
  6. package/dist/api/http.client.js +31 -4
  7. package/dist/api/http.client.js.map +1 -1
  8. package/dist/api/persona.api.service.d.ts +3 -2
  9. package/dist/api/persona.api.service.d.ts.map +1 -1
  10. package/dist/api/persona.api.service.js +1 -1
  11. package/dist/api/persona.api.service.js.map +1 -1
  12. package/dist/api/postprocessor.api.service.d.ts +3 -0
  13. package/dist/api/postprocessor.api.service.d.ts.map +1 -1
  14. package/dist/api/postprocessor.api.service.js.map +1 -1
  15. package/dist/api/preprocessor.api.service.d.ts +4 -0
  16. package/dist/api/preprocessor.api.service.d.ts.map +1 -1
  17. package/dist/api/preprocessor.api.service.js +1 -0
  18. package/dist/api/preprocessor.api.service.js.map +1 -1
  19. package/dist/api-exports.d.ts +2 -1
  20. package/dist/api-exports.d.ts.map +1 -1
  21. package/dist/api-exports.js.map +1 -1
  22. package/dist/cli/command-definitions.d.ts.map +1 -1
  23. package/dist/cli/command-definitions.js +56 -0
  24. package/dist/cli/command-definitions.js.map +1 -1
  25. package/dist/commands/chat.d.ts.map +1 -1
  26. package/dist/commands/chat.js.map +1 -1
  27. package/dist/commands/init.d.ts +6 -0
  28. package/dist/commands/init.d.ts.map +1 -1
  29. package/dist/commands/init.js +325 -85
  30. package/dist/commands/init.js.map +1 -1
  31. package/dist/commands/persona.d.ts.map +1 -1
  32. package/dist/commands/persona.js +3 -2
  33. package/dist/commands/persona.js.map +1 -1
  34. package/dist/commands/production.d.ts.map +1 -1
  35. package/dist/commands/production.js +8 -2
  36. package/dist/commands/production.js.map +1 -1
  37. package/dist/commands/push.d.ts.map +1 -1
  38. package/dist/commands/push.js +94 -14
  39. package/dist/commands/push.js.map +1 -1
  40. package/dist/commands/pushBackup.d.ts +58 -4
  41. package/dist/commands/pushBackup.d.ts.map +1 -1
  42. package/dist/commands/pushBackup.js +202 -125
  43. package/dist/commands/pushBackup.js.map +1 -1
  44. package/dist/commands/source.d.ts +72 -0
  45. package/dist/commands/source.d.ts.map +1 -0
  46. package/dist/commands/source.js +124 -0
  47. package/dist/commands/source.js.map +1 -0
  48. package/dist/commands/sync.d.ts.map +1 -1
  49. package/dist/commands/sync.js +3 -2
  50. package/dist/commands/sync.js.map +1 -1
  51. package/dist/compiler/plugins/agent.plugin.d.ts.map +1 -1
  52. package/dist/compiler/plugins/agent.plugin.js +10 -5
  53. package/dist/compiler/plugins/agent.plugin.js.map +1 -1
  54. package/dist/compiler/plugins/postprocessor.plugin.d.ts.map +1 -1
  55. package/dist/compiler/plugins/postprocessor.plugin.js +8 -2
  56. package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -1
  57. package/dist/compiler/plugins/preprocessor.plugin.d.ts.map +1 -1
  58. package/dist/compiler/plugins/preprocessor.plugin.js +6 -3
  59. package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -1
  60. package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
  61. package/dist/compiler/plugins/skill.plugin.js +6 -2
  62. package/dist/compiler/plugins/skill.plugin.js.map +1 -1
  63. package/dist/compiler/source-writer.d.ts +13 -8
  64. package/dist/compiler/source-writer.d.ts.map +1 -1
  65. package/dist/compiler/source-writer.js +24 -12
  66. package/dist/compiler/source-writer.js.map +1 -1
  67. package/dist/compiler/types.d.ts +11 -5
  68. package/dist/compiler/types.d.ts.map +1 -1
  69. package/dist/compiler/types.js.map +1 -1
  70. package/dist/compiler/utils/ast-helpers.d.ts +11 -0
  71. package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
  72. package/dist/compiler/utils/ast-helpers.js +27 -0
  73. package/dist/compiler/utils/ast-helpers.js.map +1 -1
  74. package/dist/errors/auth.error.d.ts +19 -1
  75. package/dist/errors/auth.error.d.ts.map +1 -1
  76. package/dist/errors/auth.error.js +4 -1
  77. package/dist/errors/auth.error.js.map +1 -1
  78. package/dist/instances/user.instance.d.ts +2 -1
  79. package/dist/instances/user.instance.d.ts.map +1 -1
  80. package/dist/instances/user.instance.js.map +1 -1
  81. package/dist/interfaces/agent.d.ts +34 -4
  82. package/dist/interfaces/agent.d.ts.map +1 -1
  83. package/dist/interfaces/backup.d.ts +24 -0
  84. package/dist/interfaces/backup.d.ts.map +1 -1
  85. package/dist/interfaces/chat.d.ts +3 -22
  86. package/dist/interfaces/chat.d.ts.map +1 -1
  87. package/dist/interfaces/init.d.ts +3 -2
  88. package/dist/interfaces/init.d.ts.map +1 -1
  89. package/dist/interfaces/persona.d.ts +2 -1
  90. package/dist/interfaces/persona.d.ts.map +1 -1
  91. package/dist/interfaces/skills.d.ts +4 -3
  92. package/dist/interfaces/skills.d.ts.map +1 -1
  93. package/dist/primitives/agent.handler.d.ts +3 -3
  94. package/dist/primitives/agent.handler.d.ts.map +1 -1
  95. package/dist/primitives/agent.handler.js +15 -1
  96. package/dist/primitives/agent.handler.js.map +1 -1
  97. package/dist/primitives/postprocessor.handler.d.ts +5 -0
  98. package/dist/primitives/postprocessor.handler.d.ts.map +1 -1
  99. package/dist/primitives/postprocessor.handler.js +13 -0
  100. package/dist/primitives/postprocessor.handler.js.map +1 -1
  101. package/dist/primitives/preprocessor.handler.d.ts +2 -2
  102. package/dist/primitives/preprocessor.handler.d.ts.map +1 -1
  103. package/dist/primitives/preprocessor.handler.js +3 -2
  104. package/dist/primitives/preprocessor.handler.js.map +1 -1
  105. package/dist/primitives/skill.handler.d.ts.map +1 -1
  106. package/dist/primitives/skill.handler.js +8 -2
  107. package/dist/primitives/skill.handler.js.map +1 -1
  108. package/dist/services/auth.d.ts.map +1 -1
  109. package/dist/services/auth.js +4 -1
  110. package/dist/services/auth.js.map +1 -1
  111. package/dist/services/sandbox.service.d.ts +2 -1
  112. package/dist/services/sandbox.service.d.ts.map +1 -1
  113. package/dist/services/sandbox.service.js.map +1 -1
  114. package/dist/types/api-contracts.d.ts +4 -3
  115. package/dist/types/api-contracts.d.ts.map +1 -1
  116. package/dist/types/skill.d.ts +12 -3
  117. package/dist/types/skill.d.ts.map +1 -1
  118. package/dist/types/skill.js +17 -0
  119. package/dist/types/skill.js.map +1 -1
  120. package/dist/types/yaml.types.d.ts +6 -0
  121. package/dist/types/yaml.types.d.ts.map +1 -1
  122. package/dist/utils/artifact-loader.d.ts +2 -1
  123. package/dist/utils/artifact-loader.d.ts.map +1 -1
  124. package/dist/utils/artifact-loader.js.map +1 -1
  125. package/dist/utils/backup-helpers.d.ts.map +1 -1
  126. package/dist/utils/backup-helpers.js +12 -2
  127. package/dist/utils/backup-helpers.js.map +1 -1
  128. package/dist/utils/build-manifest-from-disk.d.ts +17 -0
  129. package/dist/utils/build-manifest-from-disk.d.ts.map +1 -0
  130. package/dist/utils/build-manifest-from-disk.js +111 -0
  131. package/dist/utils/build-manifest-from-disk.js.map +1 -0
  132. package/dist/utils/cli.d.ts.map +1 -1
  133. package/dist/utils/cli.js +34 -1
  134. package/dist/utils/cli.js.map +1 -1
  135. package/dist/utils/init-agent.d.ts +2 -1
  136. package/dist/utils/init-agent.d.ts.map +1 -1
  137. package/dist/utils/init-agent.js.map +1 -1
  138. package/dist/utils/init-helpers.d.ts +2 -1
  139. package/dist/utils/init-helpers.d.ts.map +1 -1
  140. package/dist/utils/init-helpers.js +3 -1
  141. package/dist/utils/init-helpers.js.map +1 -1
  142. package/dist/utils/init-prompts.d.ts +20 -1
  143. package/dist/utils/init-prompts.d.ts.map +1 -1
  144. package/dist/utils/init-prompts.js +88 -0
  145. package/dist/utils/init-prompts.js.map +1 -1
  146. package/dist/utils/sync-display.d.ts +2 -1
  147. package/dist/utils/sync-display.d.ts.map +1 -1
  148. package/dist/utils/sync-display.js +5 -1
  149. package/dist/utils/sync-display.js.map +1 -1
  150. package/dist/utils/sync-fetch.d.ts +6 -4
  151. package/dist/utils/sync-fetch.d.ts.map +1 -1
  152. package/dist/utils/sync-fetch.js +31 -1
  153. package/dist/utils/sync-fetch.js.map +1 -1
  154. package/docs/api/LuaAgent.md +21 -3
  155. package/docs/api/LuaSkill.md +22 -4
  156. package/node_modules/@lua/shared-types/dist/index.d.mts +120 -1
  157. package/node_modules/@lua/shared-types/dist/index.d.ts +120 -1
  158. package/node_modules/@lua/shared-types/dist/index.js +137 -2
  159. package/node_modules/@lua/shared-types/dist/index.mjs +129 -1
  160. package/node_modules/@lua/shared-types/src/chat-history.types.ts +112 -0
  161. package/node_modules/@lua/shared-types/src/index.ts +2 -0
  162. package/node_modules/@lua/shared-types/src/persona-text.type.ts +92 -0
  163. package/package.json +1 -1
  164. package/template/package.json +1 -1
@@ -23,10 +23,40 @@ function normalizeForComparison(str) {
23
23
  .replace(/\r\n/g, '\n')
24
24
  .replace(/\r/g, '\n');
25
25
  }
26
+ function canonicalizeForm(value) {
27
+ if (value === null)
28
+ return 'null';
29
+ // Normalize strings the same way on both branches so the canonical form
30
+ // stays internally consistent — a server string with CRLF endings vs. a
31
+ // local string with LF endings should canonicalize identically.
32
+ if (typeof value === 'string')
33
+ return normalizeForComparison(value);
34
+ const keys = Object.keys(value).sort();
35
+ return JSON.stringify(keys.reduce((obj, key) => {
36
+ const k = key;
37
+ obj[k] = typeof value[k] === 'string' ? normalizeForComparison(value[k]) : value[k];
38
+ return obj;
39
+ }, {}));
40
+ }
26
41
  export function comparePersona(serverPersona, localPersona) {
27
42
  if (serverPersona === null)
28
43
  return false;
29
- return normalizeForComparison(serverPersona) !== normalizeForComparison(localPersona);
44
+ const serverCanonical = canonicalizeForm(serverPersona);
45
+ const localCanonical = canonicalizeForm(localPersona);
46
+ if (typeof serverPersona === 'string' && typeof localPersona === 'string') {
47
+ return normalizeForComparison(serverPersona) !== normalizeForComparison(localPersona);
48
+ }
49
+ return serverCanonical !== localCanonical;
50
+ }
51
+ export function compareSkillContext(serverContext, localContext) {
52
+ if (serverContext === null)
53
+ return false;
54
+ const serverCanonical = canonicalizeForm(serverContext);
55
+ const localCanonical = canonicalizeForm(localContext);
56
+ if (typeof serverContext === 'string' && typeof localContext === 'string') {
57
+ return normalizeForComparison(serverContext) !== normalizeForComparison(localContext);
58
+ }
59
+ return serverCanonical !== localCanonical;
30
60
  }
31
61
  export async function fetchServerPersona(apiKey, agentId) {
32
62
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"sync-fetch.js","sourceRoot":"","sources":["../../src/utils/sync-fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,UAAU,MAAM,+BAA+B,CAAC;AACvD,OAAO,QAAQ,MAAM,6BAA6B,CAAC;AACnD,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AACpD,OAAO,UAAU,MAAM,+BAA+B,CAAC;AACvD,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAC/C,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,gBAAgB,MAAM,qCAAqC,CAAC;AACnE,OAAO,YAAY,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAgBvE,SAAS,sBAAsB,CAAC,GAAW;IACzC,OAAO,GAAG;SACP,IAAI,EAAE;SACN,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,C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BAAoB,CACxC,MAAc,EACd,OAAe,EACf,eAA4C;IAE5C,MAAM,eAAe,GAAG,kBAAkB,EAAE,IAAI,IAAI,CAAC;IACrD,MAAM,KAAK,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxG,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,CAAC,cAAc;IAE/C,MAAM,gBAAgB,GAAG,KAAK,CAAC,UAAU,IAAI,IAAI,CAAC;IAClD,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC1E,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAE3B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAC/D,CAAC"}
@@ -24,7 +24,7 @@ interface LuaAgentConfig {
24
24
  name: string;
25
25
 
26
26
  /** Agent persona - defines behavior and personality */
27
- persona: string;
27
+ persona: string | { base?: string; voice?: string; text?: string };
28
28
 
29
29
  /** AI model to use - static string or dynamic resolver function (v3.6.0+) */
30
30
  model?: string | ((request: LuaRequest) => string | Promise<string>);
@@ -58,8 +58,8 @@ class LuaAgent {
58
58
  - **Example:** `'customer-support-agent'`, `'sales-assistant'`
59
59
 
60
60
  ### `persona` (required)
61
- - **Type:** `string`
62
- - **Description:** Defines the agent's personality, behavior, tone, and capabilities
61
+ - **Type:** `string | { base?: string; voice?: string; text?: string }`
62
+ - **Description:** Defines the agent's personality, behavior, tone, and capabilities. Can be a simple string (applies everywhere) or an object with channel-specific instructions.
63
63
  - **Should Include:**
64
64
  - Who the agent is
65
65
  - What role they play
@@ -67,6 +67,24 @@ class LuaAgent {
67
67
  - What they can and cannot do
68
68
  - Any specific behaviors or rules
69
69
 
70
+ **Channel-aware persona (advanced):** You can pass an object with `base`, `voice`, and `text` keys to give the agent different instructions on different channels. `base` is always rendered. `voice` is appended on voice calls; `text` is appended on text channels (web, WhatsApp, SMS). Both are optional. By default a single string works on every channel — only reach for the object form when you have a measurably different persona need on voice vs text.
71
+
72
+ **Examples:**
73
+
74
+ Simple string (applies everywhere):
75
+ ```typescript
76
+ persona: 'You are a friendly customer support agent. Be patient and professional.'
77
+ ```
78
+
79
+ Channel-aware object (recommended for multi-channel agents):
80
+ ```typescript
81
+ persona: {
82
+ base: 'You are a helpful customer support agent.',
83
+ voice: 'Keep responses concise and conversational for voice calls.',
84
+ text: 'You can use longer explanations and formatting in text channels.'
85
+ }
86
+ ```
87
+
70
88
  ### `model` (optional, v3.6.0+)
71
89
  - **Type:** `string | ((request: LuaRequest) => string | Promise<string>)`
72
90
  - **Description:** AI model to use for this agent. Can be a static string (`'provider/model'`) or a resolver function that dynamically selects the model per request.
@@ -30,7 +30,7 @@ interface LuaSkillConfig {
30
30
  description: string;
31
31
 
32
32
  /** Detailed context for when to use these tools */
33
- context: string;
33
+ context: string | { base?: string; voice?: string; text?: string };
34
34
 
35
35
  /** Array of tools to include */
36
36
  tools?: LuaTool[];
@@ -51,9 +51,27 @@ interface LuaSkillConfig {
51
51
  - **Best Practice:** 1-2 sentences, clear and concise
52
52
 
53
53
  ### `context` (required)
54
- - **Type:** `string`
55
- - **Description:** Detailed guidance for the AI on when/how to use these tools
56
- - **Best Practice:** Include use cases, examples, and boundaries
54
+ - **Type:** `string | { base?: string; voice?: string; text?: string }`
55
+ - **Description:** Detailed guidance for the AI on when/how to use these tools. Can be a simple string (applies everywhere) or an object with channel-specific instructions.
56
+ - **Best Practice:** Include use cases, examples, and boundaries. Start with a simple string; only use the object form if you need different tool guidance on voice vs text.
57
+
58
+ **Channel-aware context (advanced):** You can pass an object with `base`, `voice`, and `text` keys to guide tool usage differently by channel. `base` is always rendered. `voice` is appended on voice calls; `text` is appended on text channels (web, WhatsApp, SMS). Both are optional.
59
+
60
+ **Examples:**
61
+
62
+ Simple string (applies everywhere):
63
+ ```typescript
64
+ context: 'Use these payment tools to help customers complete transactions. Always confirm amounts before processing.'
65
+ ```
66
+
67
+ Channel-aware object (for channel-specific tool guidance):
68
+ ```typescript
69
+ context: {
70
+ base: 'Use these payment tools to help customers complete transactions.',
71
+ voice: 'Keep payment guidance brief and conversational. Ask verbally to confirm amounts.',
72
+ text: 'Provide detailed payment instructions with step-by-step guidance. Display amounts clearly.'
73
+ }
74
+ ```
57
75
 
58
76
  ### `tools` (optional)
59
77
  - **Type:** `LuaTool[]`
@@ -7,6 +7,62 @@ import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserCon
7
7
  */
8
8
  type Channel = 'web' | 'meeting' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
9
9
 
10
+ /**
11
+ * Polymorphic shape used by `LuaAgent.persona`. String form is the legacy
12
+ * single-channel persona; object form lets the customer split prose per
13
+ * channel (`base` always rendered; `voice` appended on voice; `text`
14
+ * appended on text channels).
15
+ */
16
+ type PersonaText = string | {
17
+ base?: string;
18
+ voice?: string;
19
+ text?: string;
20
+ };
21
+ /**
22
+ * Same shape as `PersonaText`, exported separately because skill `context`
23
+ * and agent `persona` play different semantic roles. Sharing the structural
24
+ * shape today keeps the runtime lean; future divergence is a one-line change.
25
+ */
26
+ type SkillContextText = string | {
27
+ base?: string;
28
+ voice?: string;
29
+ text?: string;
30
+ };
31
+ declare function isPersonaTextObject(value: unknown): value is {
32
+ base?: string;
33
+ voice?: string;
34
+ text?: string;
35
+ };
36
+ /**
37
+ * Flatten `PersonaText` or `SkillContextText` to a plain string suitable for
38
+ * LLM prompt injection. `base` is always emitted; `voice` is appended on
39
+ * voice channels and `text` on text channels. Strict — missing channel keys
40
+ * render nothing (no cross-channel fallback).
41
+ */
42
+ declare function flattenPersonaText(input: PersonaText | SkillContextText | null | undefined, isVoice?: boolean): string;
43
+ /**
44
+ * Channel-agnostic flatten — concatenates every non-empty channel's content
45
+ * (base + voice + text) for paths that aren't a render-time prompt injection,
46
+ * e.g. AI persona enhancement (storytelling, instructions, website-derived).
47
+ * Use this whenever the call has no channel context but still wants the full
48
+ * persona content — `flattenPersonaText` would silently drop voice or text
49
+ * branches because it defaults to text-channel rendering.
50
+ */
51
+ declare function flattenPersonaTextAll(input: PersonaText | SkillContextText | null | undefined): string;
52
+ /**
53
+ * True when the persona has ANY non-empty content on any channel. Used at
54
+ * push/skip boundaries where channel context is not yet known.
55
+ */
56
+ declare function hasPersonaTextContent(input: PersonaText | SkillContextText | null | undefined): boolean;
57
+ /**
58
+ * Convert a PersonaText into a TypeScript source-code literal suitable
59
+ * for ts-morph setInitializer or template rendering.
60
+ *
61
+ * - String form → `"..."` (double-quoted) or template literal (when newlines present)
62
+ * - Object form → `{ base: ..., voice: ..., text: ... }` with same per-key rule
63
+ */
64
+ declare function personaToLiteral(persona: PersonaText): string;
65
+
10
66
  /**
11
67
  * MIME types supported by Unstructured.io for document text extraction.
12
68
  * Source: https://docs.unstructured.io/api-reference/supported-file-types
@@ -160,6 +216,69 @@ interface AgentInvocationOutput {
160
216
  threadId?: string;
161
217
  }
162
218
 
219
+ /**
220
+ * Wire-format types for `GET /chat/history/:agentId` and the VM-sandbox
221
+ * `User.getChatHistory()` API. Both paths return the same shape.
222
+ *
223
+ * Shared between lua-core (HTTP controller + VM devtools) and lua-cli
224
+ * (HTTP client typing for `lua test`). Also shared with lua-api's
225
+ * `thread.service.ts` (admin org-thread listing) so the parser never
226
+ * diverges across services.
227
+ */
228
+ /**
229
+ * One content part of a chat-history message.
230
+ *
231
+ * `text` parts carry plain text. Media parts (`image` / `video` / `audio`
232
+ * / `file`) carry a URL or base64 payload in `data` (or `image` / `video`
233
+ * for legacy reasons) plus a `mediaType` MIME string.
234
+ */
235
+ interface ChatHistoryContent {
236
+ type: 'text' | 'image' | 'video' | 'audio' | 'file';
237
+ text?: string;
238
+ image?: string;
239
+ video?: string;
240
+ data?: string;
241
+ mediaType?: string;
242
+ latitude?: number;
243
+ longitude?: number;
244
+ }
245
+ /**
246
+ * One message returned by chat-history endpoints.
247
+ *
248
+ * Only `user` and `assistant` roles surface — system / tool messages are
249
+ * filtered out before transport.
250
+ */
251
+ interface ChatHistoryMessage {
252
+ id: string;
253
+ role: 'user' | 'assistant';
254
+ /** ISO-8601 timestamp string. */
255
+ createdAt: string;
256
+ content: ChatHistoryContent[];
257
+ }
258
+ /**
259
+ * Strip `::: navigate …:::` blocks from a text string.
260
+ *
261
+ * Exposed because both lua-core's chat-history transform and any future
262
+ * external transform may need it independently.
263
+ */
264
+ declare function removeNavigateBlock(input: string): string;
265
+ /**
266
+ * Transform raw Mastra `MastraMessageContentV2.parts[]` into the
267
+ * `ChatHistoryContent[]` wire shape.
268
+ *
269
+ * Single source of truth for the conversion: used by lua-core's
270
+ * `toChatHistoryMessage` (HTTP + VM sandbox paths) and lua-api's
271
+ * `thread.service.ts` admin org-thread listing. Any future divergence
272
+ * starts here.
273
+ *
274
+ * Parts are deliberately typed `unknown` because callers may either pass
275
+ * Mastra v5 `MastraMessagePart` instances (lua-core, via `@mastra/core`)
276
+ * or raw JSON parsed from a SQL row (lua-api, reading `mastra_messages`
277
+ * directly). The function only inspects `.type`, `.text`, `.data`, and
278
+ * `.mimeType` via property access, so both shapes work.
279
+ */
280
+ declare function transformChatHistoryContentParts(parts: unknown[] | undefined | null): ChatHistoryContent[];
281
+
163
282
  /**
164
283
  * Sandbox contract: defines what every sandbox MUST expose.
165
284
  * Both lua-cli and lua-core test against this contract.
@@ -470,4 +589,4 @@ interface ChatErrorChunk {
470
589
  timestamp: number;
471
590
  }
472
591
 
473
- export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ChatErrorChunk, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona };
592
+ export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ChatErrorChunk, type ChatHistoryContent, type ChatHistoryMessage, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, type PersonaText, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type SkillContextText, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona, flattenPersonaText, flattenPersonaTextAll, hasPersonaTextContent, isPersonaTextObject, personaToLiteral, removeNavigateBlock, transformChatHistoryContentParts };
@@ -7,6 +7,62 @@ import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserCon
7
7
  */
8
8
  type Channel = 'web' | 'meeting' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
9
9
 
10
+ /**
11
+ * Polymorphic shape used by `LuaAgent.persona`. String form is the legacy
12
+ * single-channel persona; object form lets the customer split prose per
13
+ * channel (`base` always rendered; `voice` appended on voice; `text`
14
+ * appended on text channels).
15
+ */
16
+ type PersonaText = string | {
17
+ base?: string;
18
+ voice?: string;
19
+ text?: string;
20
+ };
21
+ /**
22
+ * Same shape as `PersonaText`, exported separately because skill `context`
23
+ * and agent `persona` play different semantic roles. Sharing the structural
24
+ * shape today keeps the runtime lean; future divergence is a one-line change.
25
+ */
26
+ type SkillContextText = string | {
27
+ base?: string;
28
+ voice?: string;
29
+ text?: string;
30
+ };
31
+ declare function isPersonaTextObject(value: unknown): value is {
32
+ base?: string;
33
+ voice?: string;
34
+ text?: string;
35
+ };
36
+ /**
37
+ * Flatten `PersonaText` or `SkillContextText` to a plain string suitable for
38
+ * LLM prompt injection. `base` is always emitted; `voice` is appended on
39
+ * voice channels and `text` on text channels. Strict — missing channel keys
40
+ * render nothing (no cross-channel fallback).
41
+ */
42
+ declare function flattenPersonaText(input: PersonaText | SkillContextText | null | undefined, isVoice?: boolean): string;
43
+ /**
44
+ * Channel-agnostic flatten — concatenates every non-empty channel's content
45
+ * (base + voice + text) for paths that aren't a render-time prompt injection,
46
+ * e.g. AI persona enhancement (storytelling, instructions, website-derived).
47
+ * Use this whenever the call has no channel context but still wants the full
48
+ * persona content — `flattenPersonaText` would silently drop voice or text
49
+ * branches because it defaults to text-channel rendering.
50
+ */
51
+ declare function flattenPersonaTextAll(input: PersonaText | SkillContextText | null | undefined): string;
52
+ /**
53
+ * True when the persona has ANY non-empty content on any channel. Used at
54
+ * push/skip boundaries where channel context is not yet known.
55
+ */
56
+ declare function hasPersonaTextContent(input: PersonaText | SkillContextText | null | undefined): boolean;
57
+ /**
58
+ * Convert a PersonaText into a TypeScript source-code literal suitable
59
+ * for ts-morph setInitializer or template rendering.
60
+ *
61
+ * - String form → `"..."` (double-quoted) or template literal (when newlines present)
62
+ * - Object form → `{ base: ..., voice: ..., text: ... }` with same per-key rule
63
+ */
64
+ declare function personaToLiteral(persona: PersonaText): string;
65
+
10
66
  /**
11
67
  * MIME types supported by Unstructured.io for document text extraction.
12
68
  * Source: https://docs.unstructured.io/api-reference/supported-file-types
@@ -160,6 +216,69 @@ interface AgentInvocationOutput {
160
216
  threadId?: string;
161
217
  }
162
218
 
219
+ /**
220
+ * Wire-format types for `GET /chat/history/:agentId` and the VM-sandbox
221
+ * `User.getChatHistory()` API. Both paths return the same shape.
222
+ *
223
+ * Shared between lua-core (HTTP controller + VM devtools) and lua-cli
224
+ * (HTTP client typing for `lua test`). Also shared with lua-api's
225
+ * `thread.service.ts` (admin org-thread listing) so the parser never
226
+ * diverges across services.
227
+ */
228
+ /**
229
+ * One content part of a chat-history message.
230
+ *
231
+ * `text` parts carry plain text. Media parts (`image` / `video` / `audio`
232
+ * / `file`) carry a URL or base64 payload in `data` (or `image` / `video`
233
+ * for legacy reasons) plus a `mediaType` MIME string.
234
+ */
235
+ interface ChatHistoryContent {
236
+ type: 'text' | 'image' | 'video' | 'audio' | 'file';
237
+ text?: string;
238
+ image?: string;
239
+ video?: string;
240
+ data?: string;
241
+ mediaType?: string;
242
+ latitude?: number;
243
+ longitude?: number;
244
+ }
245
+ /**
246
+ * One message returned by chat-history endpoints.
247
+ *
248
+ * Only `user` and `assistant` roles surface — system / tool messages are
249
+ * filtered out before transport.
250
+ */
251
+ interface ChatHistoryMessage {
252
+ id: string;
253
+ role: 'user' | 'assistant';
254
+ /** ISO-8601 timestamp string. */
255
+ createdAt: string;
256
+ content: ChatHistoryContent[];
257
+ }
258
+ /**
259
+ * Strip `::: navigate …:::` blocks from a text string.
260
+ *
261
+ * Exposed because both lua-core's chat-history transform and any future
262
+ * external transform may need it independently.
263
+ */
264
+ declare function removeNavigateBlock(input: string): string;
265
+ /**
266
+ * Transform raw Mastra `MastraMessageContentV2.parts[]` into the
267
+ * `ChatHistoryContent[]` wire shape.
268
+ *
269
+ * Single source of truth for the conversion: used by lua-core's
270
+ * `toChatHistoryMessage` (HTTP + VM sandbox paths) and lua-api's
271
+ * `thread.service.ts` admin org-thread listing. Any future divergence
272
+ * starts here.
273
+ *
274
+ * Parts are deliberately typed `unknown` because callers may either pass
275
+ * Mastra v5 `MastraMessagePart` instances (lua-core, via `@mastra/core`)
276
+ * or raw JSON parsed from a SQL row (lua-api, reading `mastra_messages`
277
+ * directly). The function only inspects `.type`, `.text`, `.data`, and
278
+ * `.mimeType` via property access, so both shapes work.
279
+ */
280
+ declare function transformChatHistoryContentParts(parts: unknown[] | undefined | null): ChatHistoryContent[];
281
+
163
282
  /**
164
283
  * Sandbox contract: defines what every sandbox MUST expose.
165
284
  * Both lua-cli and lua-core test against this contract.
@@ -470,4 +589,4 @@ interface ChatErrorChunk {
470
589
  timestamp: number;
471
590
  }
472
591
 
473
- export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ChatErrorChunk, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona };
592
+ export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ChatErrorChunk, type ChatHistoryContent, type ChatHistoryMessage, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, type PersonaText, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type SkillContextText, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona, flattenPersonaText, flattenPersonaTextAll, hasPersonaTextContent, isPersonaTextObject, personaToLiteral, removeNavigateBlock, transformChatHistoryContentParts };
@@ -30,10 +30,70 @@ __export(index_exports, {
30
30
  REQUIRED_UTILITIES: () => REQUIRED_UTILITIES,
31
31
  UNSTRUCTURED_SUPPORTED_MEDIA_TYPES: () => UNSTRUCTURED_SUPPORTED_MEDIA_TYPES,
32
32
  aiGenerateInputFromSimplified: () => aiGenerateInputFromSimplified,
33
- buildDefaultPersona: () => buildDefaultPersona
33
+ buildDefaultPersona: () => buildDefaultPersona,
34
+ flattenPersonaText: () => flattenPersonaText,
35
+ flattenPersonaTextAll: () => flattenPersonaTextAll,
36
+ hasPersonaTextContent: () => hasPersonaTextContent,
37
+ isPersonaTextObject: () => isPersonaTextObject,
38
+ personaToLiteral: () => personaToLiteral,
39
+ removeNavigateBlock: () => removeNavigateBlock,
40
+ transformChatHistoryContentParts: () => transformChatHistoryContentParts
34
41
  });
35
42
  module.exports = __toCommonJS(index_exports);
36
43
 
44
+ // src/persona-text.type.ts
45
+ function isPersonaTextObject(value) {
46
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
47
+ const obj = value;
48
+ for (const k of Object.keys(obj)) {
49
+ if (k !== "base" && k !== "voice" && k !== "text") return false;
50
+ if (obj[k] !== void 0 && typeof obj[k] !== "string") return false;
51
+ }
52
+ return true;
53
+ }
54
+ __name(isPersonaTextObject, "isPersonaTextObject");
55
+ function flattenPersonaText(input, isVoice = false) {
56
+ if (input == null) return "";
57
+ if (typeof input === "string") return input;
58
+ const parts = [];
59
+ if (input.base) parts.push(input.base);
60
+ const channelText = isVoice ? input.voice : input.text;
61
+ if (channelText) parts.push(channelText);
62
+ return parts.join("\n\n");
63
+ }
64
+ __name(flattenPersonaText, "flattenPersonaText");
65
+ function flattenPersonaTextAll(input) {
66
+ if (input == null) return "";
67
+ if (typeof input === "string") return input;
68
+ const parts = [];
69
+ if (input.base) parts.push(input.base);
70
+ if (input.voice) parts.push(input.voice);
71
+ if (input.text) parts.push(input.text);
72
+ return parts.join("\n\n");
73
+ }
74
+ __name(flattenPersonaTextAll, "flattenPersonaTextAll");
75
+ function hasPersonaTextContent(input) {
76
+ if (input == null) return false;
77
+ if (typeof input === "string") return input.trim().length > 0;
78
+ return Boolean(input.base?.trim() || input.voice?.trim() || input.text?.trim());
79
+ }
80
+ __name(hasPersonaTextContent, "hasPersonaTextContent");
81
+ function personaToLiteral(persona) {
82
+ const formatValue = /* @__PURE__ */ __name((v) => {
83
+ if (v.includes("\n")) {
84
+ return "`" + v.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$") + "`";
85
+ }
86
+ return '"' + v.replace(/\\/g, "\\\\").replace(/"/g, '\\"') + '"';
87
+ }, "formatValue");
88
+ if (typeof persona === "string") return formatValue(persona);
89
+ const parts = [];
90
+ if (persona.base !== void 0) parts.push(`base: ${formatValue(persona.base)}`);
91
+ if (persona.voice !== void 0) parts.push(`voice: ${formatValue(persona.voice)}`);
92
+ if (persona.text !== void 0) parts.push(`text: ${formatValue(persona.text)}`);
93
+ return `{ ${parts.join(", ")} }`;
94
+ }
95
+ __name(personaToLiteral, "personaToLiteral");
96
+
37
97
  // src/unstructured-types.ts
38
98
  var UNSTRUCTURED_SUPPORTED_MEDIA_TYPES = /* @__PURE__ */ new Set([
39
99
  // PDF
@@ -107,6 +167,74 @@ function aiGenerateInputFromSimplified(prompt, content) {
107
167
  }
108
168
  __name(aiGenerateInputFromSimplified, "aiGenerateInputFromSimplified");
109
169
 
170
+ // src/chat-history.types.ts
171
+ function removeNavigateBlock(input) {
172
+ return input.replace(/::: navigate[\s\S]*?:::/g, "").trim();
173
+ }
174
+ __name(removeNavigateBlock, "removeNavigateBlock");
175
+ function transformChatHistoryContentParts(parts) {
176
+ const content = [];
177
+ for (const rawPart of parts ?? []) {
178
+ const part = rawPart;
179
+ if (part?.type !== "text" && part?.type !== "file") continue;
180
+ if (part.type === "text" && typeof part.text === "string") {
181
+ const rawText = part.text || "";
182
+ if (rawText.includes("::: hide")) continue;
183
+ const audioMatch = rawText.match(/::: audio\s*!\[(.*?)\]\((.*?)\)\s*:::/);
184
+ const videoMatch = rawText.match(/::: video\s*!\[(.*?)\]\((.*?)\)\s*:::/);
185
+ if (audioMatch) {
186
+ content.push({
187
+ type: "audio",
188
+ data: audioMatch[2],
189
+ mediaType: audioMatch[1]
190
+ });
191
+ } else if (videoMatch) {
192
+ content.push({
193
+ type: "video",
194
+ video: videoMatch[2],
195
+ mediaType: videoMatch[1]
196
+ });
197
+ } else {
198
+ let text = rawText.replace(/\\\\\\n/g, "\n");
199
+ text = removeNavigateBlock(text);
200
+ content.push({
201
+ type: "text",
202
+ text
203
+ });
204
+ }
205
+ } else if (part.type === "file") {
206
+ const mediaType = part.mimeType || "";
207
+ if (mediaType.startsWith("image/")) {
208
+ content.push({
209
+ type: "image",
210
+ image: part.data,
211
+ mediaType
212
+ });
213
+ } else if (mediaType.startsWith("video/")) {
214
+ content.push({
215
+ type: "video",
216
+ video: part.data,
217
+ mediaType
218
+ });
219
+ } else if (mediaType.startsWith("audio/")) {
220
+ content.push({
221
+ type: "audio",
222
+ data: part.data,
223
+ mediaType
224
+ });
225
+ } else {
226
+ content.push({
227
+ type: "file",
228
+ data: part.data,
229
+ mediaType
230
+ });
231
+ }
232
+ }
233
+ }
234
+ return content;
235
+ }
236
+ __name(transformChatHistoryContentParts, "transformChatHistoryContentParts");
237
+
110
238
  // src/sandbox-contract.ts
111
239
  var REQUIRED_PRIMITIVE_SHIMS = [
112
240
  // Class-based
@@ -296,5 +424,12 @@ var AGENT_LOG_SOURCES = [
296
424
  REQUIRED_UTILITIES,
297
425
  UNSTRUCTURED_SUPPORTED_MEDIA_TYPES,
298
426
  aiGenerateInputFromSimplified,
299
- buildDefaultPersona
427
+ buildDefaultPersona,
428
+ flattenPersonaText,
429
+ flattenPersonaTextAll,
430
+ hasPersonaTextContent,
431
+ isPersonaTextObject,
432
+ personaToLiteral,
433
+ removeNavigateBlock,
434
+ transformChatHistoryContentParts
300
435
  });