lua-cli 3.9.3 → 3.10.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/device.api.service.d.ts +61 -0
- package/dist/api/device.api.service.d.ts.map +1 -0
- package/dist/api/device.api.service.js +72 -0
- package/dist/api/device.api.service.js.map +1 -0
- package/dist/api/lazy-instances.d.ts +1 -0
- package/dist/api/lazy-instances.d.ts.map +1 -1
- package/dist/api/lazy-instances.js +12 -0
- package/dist/api/lazy-instances.js.map +1 -1
- package/dist/api-exports.d.ts +38 -2
- package/dist/api-exports.d.ts.map +1 -1
- package/dist/api-exports.js +45 -2
- package/dist/api-exports.js.map +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +75 -11
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/devices.d.ts +6 -0
- package/dist/commands/devices.d.ts.map +1 -0
- package/dist/commands/devices.js +266 -0
- package/dist/commands/devices.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/models.d.ts +18 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +206 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +8 -4
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts.map +1 -1
- package/dist/commands/pushBackup.js +9 -1
- package/dist/commands/pushBackup.js.map +1 -1
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +116 -17
- package/dist/commands/sync.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts.map +1 -1
- package/dist/compiler/agent-traverser.js +1 -0
- package/dist/compiler/agent-traverser.js.map +1 -1
- package/dist/compiler/index.d.ts +1 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +1 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/plugins/device.plugin.d.ts +46 -0
- package/dist/compiler/plugins/device.plugin.d.ts.map +1 -0
- package/dist/compiler/plugins/device.plugin.js +279 -0
- package/dist/compiler/plugins/device.plugin.js.map +1 -0
- package/dist/compiler/plugins/registry.d.ts.map +1 -1
- package/dist/compiler/plugins/registry.js +2 -0
- package/dist/compiler/plugins/registry.js.map +1 -1
- package/dist/compiler/source-writer.d.ts +17 -1
- package/dist/compiler/source-writer.d.ts.map +1 -1
- package/dist/compiler/source-writer.js +92 -28
- package/dist/compiler/source-writer.js.map +1 -1
- package/dist/compiler/types.d.ts +44 -2
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js +1 -0
- package/dist/compiler/types.js.map +1 -1
- package/dist/interfaces/devices.d.ts +75 -0
- package/dist/interfaces/devices.d.ts.map +1 -0
- package/dist/interfaces/devices.js +5 -0
- package/dist/interfaces/devices.js.map +1 -0
- package/dist/primitives/base.handler.d.ts.map +1 -1
- package/dist/primitives/base.handler.js +31 -7
- package/dist/primitives/base.handler.js.map +1 -1
- package/dist/primitives/device.handler.d.ts +43 -0
- package/dist/primitives/device.handler.d.ts.map +1 -0
- package/dist/primitives/device.handler.js +82 -0
- package/dist/primitives/device.handler.js.map +1 -0
- package/dist/primitives/index.d.ts +2 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +4 -0
- package/dist/primitives/index.js.map +1 -1
- package/dist/types/skill.d.ts +98 -0
- package/dist/types/skill.d.ts.map +1 -1
- package/dist/types/skill.js +21 -0
- package/dist/types/skill.js.map +1 -1
- package/dist/types/yaml.types.d.ts +8 -0
- package/dist/types/yaml.types.d.ts.map +1 -1
- package/dist/utils/backup-helpers.d.ts +41 -10
- package/dist/utils/backup-helpers.d.ts.map +1 -1
- package/dist/utils/backup-helpers.js +227 -15
- package/dist/utils/backup-helpers.js.map +1 -1
- package/dist/utils/init-agent.d.ts +8 -1
- package/dist/utils/init-agent.d.ts.map +1 -1
- package/dist/utils/init-agent.js +14 -1
- package/dist/utils/init-agent.js.map +1 -1
- package/dist/utils/init-prompts.d.ts +1 -1
- package/dist/utils/init-prompts.d.ts.map +1 -1
- package/dist/utils/init-prompts.js +7 -20
- package/dist/utils/init-prompts.js.map +1 -1
- package/dist/utils/sandbox-storage.d.ts +6 -0
- package/dist/utils/sandbox-storage.d.ts.map +1 -1
- package/dist/utils/sandbox-storage.js +32 -1
- package/dist/utils/sandbox-storage.js.map +1 -1
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/sandbox.js +23 -0
- package/dist/utils/sandbox.js.map +1 -1
- package/docs/CLI_REFERENCE.md +152 -2
- package/docs/README.md +3 -1
- package/node_modules/@lua/shared-types/dist/index.d.mts +135 -2
- package/node_modules/@lua/shared-types/dist/index.d.ts +135 -2
- package/node_modules/@lua/shared-types/dist/index.js +57 -2
- package/node_modules/@lua/shared-types/dist/index.mjs +55 -1
- package/node_modules/@lua/shared-types/src/channel.type.ts +1 -0
- package/node_modules/@lua/shared-types/src/device.types.ts +172 -0
- package/node_modules/@lua/shared-types/src/index.ts +2 -0
- package/node_modules/@lua/shared-types/src/persona-defaults.ts +59 -0
- package/package.json +1 -1
- package/template/package.json +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Gateway Types
|
|
3
|
+
*
|
|
4
|
+
* Types for bidirectional communication between AI agents and external devices.
|
|
5
|
+
* Used across lua-api (gateway), lua-core (runtime), and lua-cli (compilation).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// COMMAND (Agent → Device)
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
/** Command message sent from the server to a device */
|
|
13
|
+
export interface DeviceCommandMessage {
|
|
14
|
+
/** Unique identifier for this command (UUID). Used for idempotency. */
|
|
15
|
+
commandId: string;
|
|
16
|
+
/** Command name (must match a command defined in defineDevice) */
|
|
17
|
+
command: string;
|
|
18
|
+
/** Command payload (validated against inputSchema if defined) */
|
|
19
|
+
payload: any;
|
|
20
|
+
/** Timeout in milliseconds (defaults to 30000) */
|
|
21
|
+
timeout?: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Response message sent from a device back to the server */
|
|
25
|
+
export interface DeviceResponseMessage {
|
|
26
|
+
/** Must match the commandId of the original command */
|
|
27
|
+
commandId: string;
|
|
28
|
+
/** Whether the command executed successfully on the device */
|
|
29
|
+
success: boolean;
|
|
30
|
+
/** Response data (present when success=true) */
|
|
31
|
+
data?: any;
|
|
32
|
+
/** Error message (present when success=false) */
|
|
33
|
+
error?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// TRIGGER (Device → Agent)
|
|
38
|
+
// =============================================================================
|
|
39
|
+
|
|
40
|
+
/** Trigger message sent from a device to the server */
|
|
41
|
+
export interface DeviceTriggerMessage {
|
|
42
|
+
/** Trigger name (must match a trigger defined in defineDevice) */
|
|
43
|
+
triggerName: string;
|
|
44
|
+
/** Trigger payload (validated against payloadSchema if defined) */
|
|
45
|
+
payload: any;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Acknowledgment sent from the server back to the device after receiving a trigger */
|
|
49
|
+
export interface DeviceTriggerAckMessage {
|
|
50
|
+
/** Server-generated unique identifier for this trigger event */
|
|
51
|
+
triggerId: string;
|
|
52
|
+
/** Whether the trigger was received and queued for processing */
|
|
53
|
+
received: boolean;
|
|
54
|
+
/** Error details if the trigger was rejected */
|
|
55
|
+
error?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// STATE
|
|
60
|
+
// =============================================================================
|
|
61
|
+
|
|
62
|
+
/** Device connection status */
|
|
63
|
+
export type DeviceStatus = 'online' | 'offline' | 'registered' | 'disabled';
|
|
64
|
+
|
|
65
|
+
/** State of a command in the Valkey state machine */
|
|
66
|
+
export type CommandState =
|
|
67
|
+
| 'PENDING' // Command written to stream, not yet consumed
|
|
68
|
+
| 'SENT' // Consumed by target pod, emitted to socket
|
|
69
|
+
| 'ACK' // Device acknowledged receipt via Socket.IO ack
|
|
70
|
+
| 'COMPLETED' // Device responded successfully
|
|
71
|
+
| 'FAILED' // Device responded with error, or validation failed
|
|
72
|
+
| 'TIMED_OUT'; // No response within timeout period
|
|
73
|
+
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// DEVICE INFO
|
|
76
|
+
// =============================================================================
|
|
77
|
+
|
|
78
|
+
/** Device information returned by API endpoints */
|
|
79
|
+
export interface DeviceInfo {
|
|
80
|
+
/** Unique device name within the agent */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Agent this device belongs to */
|
|
83
|
+
agentId: string;
|
|
84
|
+
/** Current connection status */
|
|
85
|
+
status: DeviceStatus;
|
|
86
|
+
/** Device group (optional, for fan-out commands) */
|
|
87
|
+
group?: string;
|
|
88
|
+
/** Device capabilities */
|
|
89
|
+
capabilities: string[];
|
|
90
|
+
/** Free-form device metadata */
|
|
91
|
+
metadata: Record<string, any>;
|
|
92
|
+
/** Last time the device was seen (heartbeat or connect) */
|
|
93
|
+
lastSeenAt: Date | null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// =============================================================================
|
|
97
|
+
// VALKEY STREAM ENTRIES
|
|
98
|
+
// =============================================================================
|
|
99
|
+
|
|
100
|
+
/** Entry written to the device command stream */
|
|
101
|
+
export interface CommandStreamEntry {
|
|
102
|
+
commandId: string;
|
|
103
|
+
command: string;
|
|
104
|
+
payload: string; // JSON-serialized
|
|
105
|
+
originPodId: string;
|
|
106
|
+
agentId: string;
|
|
107
|
+
deviceName: string;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Entry written to the device response stream */
|
|
111
|
+
export interface ResponseStreamEntry {
|
|
112
|
+
commandId: string;
|
|
113
|
+
success: string; // 'true' or 'false' (Redis streams store strings)
|
|
114
|
+
data?: string; // JSON-serialized
|
|
115
|
+
error?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Entry written to the device trigger stream */
|
|
119
|
+
export interface TriggerStreamEntry {
|
|
120
|
+
triggerId: string;
|
|
121
|
+
agentId: string;
|
|
122
|
+
deviceName: string;
|
|
123
|
+
deviceId: string;
|
|
124
|
+
triggerName: string;
|
|
125
|
+
payload: string; // JSON-serialized
|
|
126
|
+
timestamp: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// =============================================================================
|
|
130
|
+
// VALKEY COMMAND HASH
|
|
131
|
+
// =============================================================================
|
|
132
|
+
|
|
133
|
+
/** Data stored in the Valkey hash for a command's state */
|
|
134
|
+
export interface CommandHashData {
|
|
135
|
+
status: CommandState;
|
|
136
|
+
agentId: string;
|
|
137
|
+
deviceName: string;
|
|
138
|
+
originPodId: string;
|
|
139
|
+
timestamp: number;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// =============================================================================
|
|
143
|
+
// DEVICE DEFINITION (stored in lua-agents, cached in Redis)
|
|
144
|
+
// =============================================================================
|
|
145
|
+
|
|
146
|
+
/** Device definition as stored in Redis cache */
|
|
147
|
+
export interface CachedDeviceDefinition {
|
|
148
|
+
name: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
group?: string;
|
|
151
|
+
commands: CachedDeviceCommand[];
|
|
152
|
+
triggers: CachedDeviceTrigger[];
|
|
153
|
+
/** Compressed (gzip + base64) compiled artifact containing trigger handlers */
|
|
154
|
+
artifact: string;
|
|
155
|
+
/** Environment variables for the device */
|
|
156
|
+
env: Record<string, string>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface CachedDeviceCommand {
|
|
160
|
+
name: string;
|
|
161
|
+
description: string;
|
|
162
|
+
inputSchema?: Record<string, any>; // JSON Schema
|
|
163
|
+
retry?: { maxAttempts: number; backoffMs: number };
|
|
164
|
+
timeoutMs?: number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface CachedDeviceTrigger {
|
|
168
|
+
name: string;
|
|
169
|
+
description: string;
|
|
170
|
+
payloadSchema?: Record<string, any>; // JSON Schema
|
|
171
|
+
hasExecute: boolean;
|
|
172
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
const AGENT_NAME_TOKEN = '[Your Agent Name]';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Structured persona guide template for newly created agents.
|
|
5
|
+
* Each section teaches the developer what to write, with a brief example.
|
|
6
|
+
*/
|
|
7
|
+
const DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
8
|
+
|
|
9
|
+
This is a starting template to help you think about your agent's persona.
|
|
10
|
+
Use it as-is, rearrange it, or replace it entirely with your own format — whatever works best for your use case.
|
|
11
|
+
The sections below are suggestions, not requirements.
|
|
12
|
+
|
|
13
|
+
## Identity & Role
|
|
14
|
+
Who is your agent? What's their name and core purpose?
|
|
15
|
+
- Give it a name and a clear one-line role
|
|
16
|
+
- e.g. a customer support rep, a shopping assistant, an internal ops copilot, a scheduling bot
|
|
17
|
+
|
|
18
|
+
## Business Context
|
|
19
|
+
What company, product, or service does the agent represent? What does the business do?
|
|
20
|
+
- Describe the business in a sentence or two so the agent understands the world it operates in
|
|
21
|
+
- Include industry, value proposition, and anything the agent should "know" about the brand
|
|
22
|
+
|
|
23
|
+
## Tone & Communication Style
|
|
24
|
+
How should the agent sound?
|
|
25
|
+
- Formal or casual? Concise or detailed? Empathetic or matter-of-fact?
|
|
26
|
+
- Should it match a specific brand voice or adapt to the user's tone?
|
|
27
|
+
- Any language or cultural considerations (e.g. greetings, local expressions)?
|
|
28
|
+
|
|
29
|
+
## Target Audience
|
|
30
|
+
Who will the agent be talking to?
|
|
31
|
+
- Describe the typical user: consumers, business customers, internal team members, etc.
|
|
32
|
+
- What do they usually need help with? What matters most to them?
|
|
33
|
+
|
|
34
|
+
## Capabilities
|
|
35
|
+
What can the agent help with? List the main things it should handle.
|
|
36
|
+
- e.g. answering product questions, placing orders, looking up account info, scheduling meetings
|
|
37
|
+
- Be specific — this shapes which skills and tools the agent will use
|
|
38
|
+
|
|
39
|
+
## Boundaries
|
|
40
|
+
What should the agent NOT do? When should it escalate to a human?
|
|
41
|
+
- e.g. cannot process refunds, should not give medical/legal advice
|
|
42
|
+
- Define when to hand off: frustrated user, request outside scope, sensitive data
|
|
43
|
+
|
|
44
|
+
## Guidelines
|
|
45
|
+
Any rules for how the agent behaves?
|
|
46
|
+
- Response length limits (e.g. keep messages under 300 words)
|
|
47
|
+
- Formatting preferences (e.g. use bullet points, avoid jargon)
|
|
48
|
+
- Things to always or never do (e.g. always confirm before changes, never share internal IDs)
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
Feel free to add, remove, or rename sections. Your persona can be a single paragraph or a detailed playbook — whatever gives your agent the context it needs.
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Build a default persona guide with the agent name filled in.
|
|
56
|
+
*/
|
|
57
|
+
export function buildDefaultPersona(agentName: string): string {
|
|
58
|
+
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || 'My Agent');
|
|
59
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lua-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.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",
|