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.
- package/dist/api/agent.api.service.d.ts +12 -0
- package/dist/api/agent.api.service.d.ts.map +1 -1
- package/dist/api/agent.api.service.js +13 -0
- package/dist/api/agent.api.service.js.map +1 -1
- package/dist/api/http.client.d.ts.map +1 -1
- package/dist/api/http.client.js +31 -4
- package/dist/api/http.client.js.map +1 -1
- package/dist/api/persona.api.service.d.ts +3 -2
- package/dist/api/persona.api.service.d.ts.map +1 -1
- package/dist/api/persona.api.service.js +1 -1
- package/dist/api/persona.api.service.js.map +1 -1
- package/dist/api/postprocessor.api.service.d.ts +3 -0
- package/dist/api/postprocessor.api.service.d.ts.map +1 -1
- package/dist/api/postprocessor.api.service.js.map +1 -1
- package/dist/api/preprocessor.api.service.d.ts +4 -0
- package/dist/api/preprocessor.api.service.d.ts.map +1 -1
- package/dist/api/preprocessor.api.service.js +1 -0
- package/dist/api/preprocessor.api.service.js.map +1 -1
- package/dist/api-exports.d.ts +2 -1
- package/dist/api-exports.d.ts.map +1 -1
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +10 -0
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +255 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +3 -2
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/production.d.ts.map +1 -1
- package/dist/commands/production.js +8 -2
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +7 -3
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +3 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/compiler/plugins/agent.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/agent.plugin.js +10 -5
- package/dist/compiler/plugins/agent.plugin.js.map +1 -1
- package/dist/compiler/plugins/postprocessor.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/postprocessor.plugin.js +8 -2
- package/dist/compiler/plugins/postprocessor.plugin.js.map +1 -1
- package/dist/compiler/plugins/preprocessor.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/preprocessor.plugin.js +6 -3
- package/dist/compiler/plugins/preprocessor.plugin.js.map +1 -1
- package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/skill.plugin.js +6 -2
- package/dist/compiler/plugins/skill.plugin.js.map +1 -1
- package/dist/compiler/source-writer.d.ts +13 -8
- package/dist/compiler/source-writer.d.ts.map +1 -1
- package/dist/compiler/source-writer.js +24 -12
- package/dist/compiler/source-writer.js.map +1 -1
- package/dist/compiler/types.d.ts +11 -5
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/compiler/utils/ast-helpers.d.ts +11 -0
- package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
- package/dist/compiler/utils/ast-helpers.js +27 -0
- package/dist/compiler/utils/ast-helpers.js.map +1 -1
- package/dist/errors/auth.error.d.ts +19 -1
- package/dist/errors/auth.error.d.ts.map +1 -1
- package/dist/errors/auth.error.js +4 -1
- package/dist/errors/auth.error.js.map +1 -1
- package/dist/interfaces/agent.d.ts +34 -4
- package/dist/interfaces/agent.d.ts.map +1 -1
- package/dist/interfaces/chat.d.ts +2 -1
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/interfaces/init.d.ts +3 -2
- package/dist/interfaces/init.d.ts.map +1 -1
- package/dist/interfaces/persona.d.ts +2 -1
- package/dist/interfaces/persona.d.ts.map +1 -1
- package/dist/interfaces/skills.d.ts +22 -3
- package/dist/interfaces/skills.d.ts.map +1 -1
- package/dist/primitives/agent.handler.d.ts +3 -3
- package/dist/primitives/agent.handler.d.ts.map +1 -1
- package/dist/primitives/agent.handler.js +15 -1
- package/dist/primitives/agent.handler.js.map +1 -1
- package/dist/primitives/postprocessor.handler.d.ts +5 -0
- package/dist/primitives/postprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/postprocessor.handler.js +13 -0
- package/dist/primitives/postprocessor.handler.js.map +1 -1
- package/dist/primitives/preprocessor.handler.d.ts +2 -2
- package/dist/primitives/preprocessor.handler.d.ts.map +1 -1
- package/dist/primitives/preprocessor.handler.js +3 -2
- package/dist/primitives/preprocessor.handler.js.map +1 -1
- package/dist/primitives/skill.handler.d.ts.map +1 -1
- package/dist/primitives/skill.handler.js +49 -14
- package/dist/primitives/skill.handler.js.map +1 -1
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +4 -1
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts +2 -1
- package/dist/services/sandbox.service.d.ts.map +1 -1
- package/dist/services/sandbox.service.js.map +1 -1
- package/dist/types/skill.d.ts +12 -3
- package/dist/types/skill.d.ts.map +1 -1
- package/dist/types/skill.js +17 -0
- package/dist/types/skill.js.map +1 -1
- package/dist/utils/artifact-loader.d.ts +40 -1
- package/dist/utils/artifact-loader.d.ts.map +1 -1
- package/dist/utils/artifact-loader.js +82 -0
- package/dist/utils/artifact-loader.js.map +1 -1
- package/dist/utils/backup-helpers.d.ts.map +1 -1
- package/dist/utils/backup-helpers.js +12 -2
- package/dist/utils/backup-helpers.js.map +1 -1
- package/dist/utils/cli.d.ts.map +1 -1
- package/dist/utils/cli.js +34 -1
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/init-agent.d.ts +2 -1
- package/dist/utils/init-agent.d.ts.map +1 -1
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-helpers.d.ts +2 -1
- package/dist/utils/init-helpers.d.ts.map +1 -1
- package/dist/utils/init-helpers.js +3 -1
- package/dist/utils/init-helpers.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +20 -1
- package/dist/utils/init-prompts.d.ts.map +1 -1
- package/dist/utils/init-prompts.js +88 -0
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/sync-display.d.ts +2 -1
- package/dist/utils/sync-display.d.ts.map +1 -1
- package/dist/utils/sync-display.js +5 -1
- package/dist/utils/sync-display.js.map +1 -1
- package/dist/utils/sync-fetch.d.ts +6 -4
- package/dist/utils/sync-fetch.d.ts.map +1 -1
- package/dist/utils/sync-fetch.js +31 -1
- package/dist/utils/sync-fetch.js.map +1 -1
- package/docs/api/LuaAgent.md +21 -3
- package/docs/api/LuaSkill.md +22 -4
- package/node_modules/@lua/shared-types/dist/index.d.mts +57 -1
- package/node_modules/@lua/shared-types/dist/index.d.ts +57 -1
- package/node_modules/@lua/shared-types/dist/index.js +65 -2
- package/node_modules/@lua/shared-types/dist/index.mjs +59 -1
- package/node_modules/@lua/shared-types/src/index.ts +1 -0
- package/node_modules/@lua/shared-types/src/persona-text.type.ts +92 -0
- package/package.json +1 -1
- 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.
|
|
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",
|