lua-cli 3.14.0 → 3.15.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.
Files changed (143) 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 +10 -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 +255 -2
  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 +7 -3
  39. package/dist/commands/push.js.map +1 -1
  40. package/dist/commands/sync.d.ts.map +1 -1
  41. package/dist/commands/sync.js +3 -2
  42. package/dist/commands/sync.js.map +1 -1
  43. package/dist/compiler/plugins/agent.plugin.d.ts.map +1 -1
  44. package/dist/compiler/plugins/agent.plugin.js +10 -5
  45. package/dist/compiler/plugins/agent.plugin.js.map +1 -1
  46. package/dist/compiler/plugins/postprocessor.plugin.d.ts.map +1 -1
  47. package/dist/compiler/plugins/postprocessor.plugin.js +8 -2
  48. package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -1
  49. package/dist/compiler/plugins/preprocessor.plugin.d.ts.map +1 -1
  50. package/dist/compiler/plugins/preprocessor.plugin.js +6 -3
  51. package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -1
  52. package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
  53. package/dist/compiler/plugins/skill.plugin.js +6 -2
  54. package/dist/compiler/plugins/skill.plugin.js.map +1 -1
  55. package/dist/compiler/source-writer.d.ts +13 -8
  56. package/dist/compiler/source-writer.d.ts.map +1 -1
  57. package/dist/compiler/source-writer.js +24 -12
  58. package/dist/compiler/source-writer.js.map +1 -1
  59. package/dist/compiler/types.d.ts +11 -5
  60. package/dist/compiler/types.d.ts.map +1 -1
  61. package/dist/compiler/types.js.map +1 -1
  62. package/dist/compiler/utils/ast-helpers.d.ts +11 -0
  63. package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
  64. package/dist/compiler/utils/ast-helpers.js +27 -0
  65. package/dist/compiler/utils/ast-helpers.js.map +1 -1
  66. package/dist/errors/auth.error.d.ts +19 -1
  67. package/dist/errors/auth.error.d.ts.map +1 -1
  68. package/dist/errors/auth.error.js +4 -1
  69. package/dist/errors/auth.error.js.map +1 -1
  70. package/dist/interfaces/agent.d.ts +34 -4
  71. package/dist/interfaces/agent.d.ts.map +1 -1
  72. package/dist/interfaces/chat.d.ts +2 -1
  73. package/dist/interfaces/chat.d.ts.map +1 -1
  74. package/dist/interfaces/init.d.ts +3 -2
  75. package/dist/interfaces/init.d.ts.map +1 -1
  76. package/dist/interfaces/persona.d.ts +2 -1
  77. package/dist/interfaces/persona.d.ts.map +1 -1
  78. package/dist/interfaces/skills.d.ts +22 -3
  79. package/dist/interfaces/skills.d.ts.map +1 -1
  80. package/dist/primitives/agent.handler.d.ts +3 -3
  81. package/dist/primitives/agent.handler.d.ts.map +1 -1
  82. package/dist/primitives/agent.handler.js +15 -1
  83. package/dist/primitives/agent.handler.js.map +1 -1
  84. package/dist/primitives/postprocessor.handler.d.ts +5 -0
  85. package/dist/primitives/postprocessor.handler.d.ts.map +1 -1
  86. package/dist/primitives/postprocessor.handler.js +13 -0
  87. package/dist/primitives/postprocessor.handler.js.map +1 -1
  88. package/dist/primitives/preprocessor.handler.d.ts +2 -2
  89. package/dist/primitives/preprocessor.handler.d.ts.map +1 -1
  90. package/dist/primitives/preprocessor.handler.js +3 -2
  91. package/dist/primitives/preprocessor.handler.js.map +1 -1
  92. package/dist/primitives/skill.handler.d.ts.map +1 -1
  93. package/dist/primitives/skill.handler.js +49 -14
  94. package/dist/primitives/skill.handler.js.map +1 -1
  95. package/dist/services/auth.d.ts.map +1 -1
  96. package/dist/services/auth.js +4 -1
  97. package/dist/services/auth.js.map +1 -1
  98. package/dist/services/sandbox.service.d.ts +2 -1
  99. package/dist/services/sandbox.service.d.ts.map +1 -1
  100. package/dist/services/sandbox.service.js.map +1 -1
  101. package/dist/types/skill.d.ts +12 -3
  102. package/dist/types/skill.d.ts.map +1 -1
  103. package/dist/types/skill.js +17 -0
  104. package/dist/types/skill.js.map +1 -1
  105. package/dist/utils/artifact-loader.d.ts +40 -1
  106. package/dist/utils/artifact-loader.d.ts.map +1 -1
  107. package/dist/utils/artifact-loader.js +82 -0
  108. package/dist/utils/artifact-loader.js.map +1 -1
  109. package/dist/utils/backup-helpers.d.ts.map +1 -1
  110. package/dist/utils/backup-helpers.js +12 -2
  111. package/dist/utils/backup-helpers.js.map +1 -1
  112. package/dist/utils/cli.d.ts.map +1 -1
  113. package/dist/utils/cli.js +34 -1
  114. package/dist/utils/cli.js.map +1 -1
  115. package/dist/utils/init-agent.d.ts +2 -1
  116. package/dist/utils/init-agent.d.ts.map +1 -1
  117. package/dist/utils/init-agent.js.map +1 -1
  118. package/dist/utils/init-helpers.d.ts +2 -1
  119. package/dist/utils/init-helpers.d.ts.map +1 -1
  120. package/dist/utils/init-helpers.js +3 -1
  121. package/dist/utils/init-helpers.js.map +1 -1
  122. package/dist/utils/init-prompts.d.ts +20 -1
  123. package/dist/utils/init-prompts.d.ts.map +1 -1
  124. package/dist/utils/init-prompts.js +88 -0
  125. package/dist/utils/init-prompts.js.map +1 -1
  126. package/dist/utils/sync-display.d.ts +2 -1
  127. package/dist/utils/sync-display.d.ts.map +1 -1
  128. package/dist/utils/sync-display.js +5 -1
  129. package/dist/utils/sync-display.js.map +1 -1
  130. package/dist/utils/sync-fetch.d.ts +6 -4
  131. package/dist/utils/sync-fetch.d.ts.map +1 -1
  132. package/dist/utils/sync-fetch.js +31 -1
  133. package/dist/utils/sync-fetch.js.map +1 -1
  134. package/docs/api/LuaAgent.md +21 -3
  135. package/docs/api/LuaSkill.md +22 -4
  136. package/node_modules/@lua/shared-types/dist/index.d.mts +57 -1
  137. package/node_modules/@lua/shared-types/dist/index.d.ts +57 -1
  138. package/node_modules/@lua/shared-types/dist/index.js +65 -2
  139. package/node_modules/@lua/shared-types/dist/index.mjs +59 -1
  140. package/node_modules/@lua/shared-types/src/index.ts +1 -0
  141. package/node_modules/@lua/shared-types/src/persona-text.type.ts +92 -0
  142. package/package.json +1 -1
  143. package/template/package.json +1 -1
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Polymorphic shape used by `LuaAgent.persona`. String form is the legacy
3
+ * single-channel persona; object form lets the customer split prose per
4
+ * channel (`base` always rendered; `voice` appended on voice; `text`
5
+ * appended on text channels).
6
+ */
7
+ export type PersonaText = string | { base?: string; voice?: string; text?: string };
8
+
9
+ /**
10
+ * Same shape as `PersonaText`, exported separately because skill `context`
11
+ * and agent `persona` play different semantic roles. Sharing the structural
12
+ * shape today keeps the runtime lean; future divergence is a one-line change.
13
+ */
14
+ export type SkillContextText = string | { base?: string; voice?: string; text?: string };
15
+
16
+ export function isPersonaTextObject(value: unknown): value is { base?: string; voice?: string; text?: string } {
17
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;
18
+ const obj = value as Record<string, unknown>;
19
+ for (const k of Object.keys(obj)) {
20
+ if (k !== 'base' && k !== 'voice' && k !== 'text') return false;
21
+ if (obj[k] !== undefined && typeof obj[k] !== 'string') return false;
22
+ }
23
+ return true;
24
+ }
25
+
26
+ /**
27
+ * Flatten `PersonaText` or `SkillContextText` to a plain string suitable for
28
+ * LLM prompt injection. `base` is always emitted; `voice` is appended on
29
+ * voice channels and `text` on text channels. Strict — missing channel keys
30
+ * render nothing (no cross-channel fallback).
31
+ */
32
+ export function flattenPersonaText(input: PersonaText | SkillContextText | null | undefined, isVoice = false): string {
33
+ if (input == null) return '';
34
+ if (typeof input === 'string') return input;
35
+ const parts: string[] = [];
36
+ if (input.base) parts.push(input.base);
37
+ const channelText = isVoice ? input.voice : input.text;
38
+ if (channelText) parts.push(channelText);
39
+ return parts.join('\n\n');
40
+ }
41
+
42
+ /**
43
+ * Channel-agnostic flatten — concatenates every non-empty channel's content
44
+ * (base + voice + text) for paths that aren't a render-time prompt injection,
45
+ * e.g. AI persona enhancement (storytelling, instructions, website-derived).
46
+ * Use this whenever the call has no channel context but still wants the full
47
+ * persona content — `flattenPersonaText` would silently drop voice or text
48
+ * branches because it defaults to text-channel rendering.
49
+ */
50
+ export function flattenPersonaTextAll(input: PersonaText | SkillContextText | null | undefined): string {
51
+ if (input == null) return '';
52
+ if (typeof input === 'string') return input;
53
+ const parts: string[] = [];
54
+ if (input.base) parts.push(input.base);
55
+ if (input.voice) parts.push(input.voice);
56
+ if (input.text) parts.push(input.text);
57
+ return parts.join('\n\n');
58
+ }
59
+
60
+ /**
61
+ * True when the persona has ANY non-empty content on any channel. Used at
62
+ * push/skip boundaries where channel context is not yet known.
63
+ */
64
+ export function hasPersonaTextContent(input: PersonaText | SkillContextText | null | undefined): boolean {
65
+ if (input == null) return false;
66
+ if (typeof input === 'string') return input.trim().length > 0;
67
+ return Boolean(input.base?.trim() || input.voice?.trim() || input.text?.trim());
68
+ }
69
+
70
+ /**
71
+ * Convert a PersonaText into a TypeScript source-code literal suitable
72
+ * for ts-morph setInitializer or template rendering.
73
+ *
74
+ * - String form → `"..."` (double-quoted) or template literal (when newlines present)
75
+ * - Object form → `{ base: ..., voice: ..., text: ... }` with same per-key rule
76
+ */
77
+ export function personaToLiteral(persona: PersonaText): string {
78
+ const formatValue = (v: string): string => {
79
+ if (v.includes('\n')) {
80
+ return '`' + v.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$/g, '\\$') + '`';
81
+ }
82
+ return '"' + v.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
83
+ };
84
+
85
+ if (typeof persona === 'string') return formatValue(persona);
86
+
87
+ const parts: string[] = [];
88
+ if (persona.base !== undefined) parts.push(`base: ${formatValue(persona.base)}`);
89
+ if (persona.voice !== undefined) parts.push(`voice: ${formatValue(persona.voice)}`);
90
+ if (persona.text !== undefined) parts.push(`text: ${formatValue(persona.text)}`);
91
+ return `{ ${parts.join(', ')} }`;
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "3.14.0",
3
+ "version": "3.15.0",
4
4
  "description": "Build, test, and deploy AI agents with custom tools, webhooks, and scheduled jobs. Features LuaAgent unified configuration, streaming chat, and batch deployment.",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "dist/api-exports.js",
@@ -20,7 +20,7 @@
20
20
  "inquirer": "^12.9.6",
21
21
  "stripe": "^17.5.0",
22
22
  "js-yaml": "^4.1.0",
23
- "lua-cli": "^3.14.0",
23
+ "lua-cli": "^3.15.0",
24
24
  "openai": "^5.23.0",
25
25
  "uuid": "^13.0.0",
26
26
  "zod": "^3.24.1"