lua-cli 3.7.2 → 3.7.3
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/node_modules/@lua/shared-types/dist/index.d.mts +92 -0
- package/node_modules/@lua/shared-types/dist/index.d.ts +92 -0
- package/node_modules/@lua/shared-types/dist/index.js +104 -0
- package/node_modules/@lua/shared-types/dist/index.mjs +79 -0
- package/node_modules/@lua/shared-types/package.json +26 -0
- package/node_modules/@lua/shared-types/src/ai-generate.types.ts +79 -0
- package/node_modules/@lua/shared-types/src/ai-generate.utils.ts +19 -0
- package/node_modules/@lua/shared-types/src/channel.type.ts +21 -0
- package/node_modules/@lua/shared-types/src/index.ts +4 -0
- package/node_modules/@lua/shared-types/src/unstructured-types.ts +58 -0
- package/node_modules/@lua/shared-types/tsconfig.json +12 -0
- package/node_modules/@lua/shared-types/tsup.config.ts +9 -0
- package/package.json +8 -2
- package/scripts/resolve-workspace-deps.cjs +61 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserContent } from 'ai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Channel type.
|
|
5
|
+
* Represents the communication channel through which a request originated.
|
|
6
|
+
* Known channels are typed as string literals, unrecognized channels are unknown.
|
|
7
|
+
*/
|
|
8
|
+
type Channel = 'web' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* MIME types supported by Unstructured.io for document text extraction.
|
|
12
|
+
* Source: https://docs.unstructured.io/api-reference/supported-file-types
|
|
13
|
+
*
|
|
14
|
+
* Shared across lua-core (FileConversionService) and lua-agents (UnstructuredService).
|
|
15
|
+
*/
|
|
16
|
+
declare const UNSTRUCTURED_SUPPORTED_MEDIA_TYPES: Set<string>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Wire-format input for sandbox `AI.generate` / `POST .../generate` (JSON-serializable).
|
|
20
|
+
* Serializable subset of AI SDK `generateText` parameters.
|
|
21
|
+
* `messages` is untyped over HTTP; callers typically send AI SDK `ModelMessage[]`.
|
|
22
|
+
*/
|
|
23
|
+
interface AiGenerateInput {
|
|
24
|
+
model?: string;
|
|
25
|
+
system?: string;
|
|
26
|
+
prompt?: string;
|
|
27
|
+
messages?: unknown[];
|
|
28
|
+
temperature?: number;
|
|
29
|
+
maxOutputTokens?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* URL source from Google Search grounding.
|
|
33
|
+
* Mirrors `LanguageModelV2Source` (AI SDK `Source` type — not exported from `ai` as of v5).
|
|
34
|
+
*/
|
|
35
|
+
interface AiGenerateSource {
|
|
36
|
+
sourceType: 'url';
|
|
37
|
+
id: string;
|
|
38
|
+
url: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Serializable tool call. Mirrors `TypedToolCall` without generics.
|
|
43
|
+
* `input` matches the AI SDK field name (renamed from `args` in v5).
|
|
44
|
+
*/
|
|
45
|
+
interface AiGenerateToolCall {
|
|
46
|
+
type: 'tool-call';
|
|
47
|
+
toolCallId: string;
|
|
48
|
+
toolName: string;
|
|
49
|
+
input: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Serializable tool result. Mirrors `TypedToolResult` without generics.
|
|
53
|
+
* `output` matches the AI SDK field name.
|
|
54
|
+
*/
|
|
55
|
+
interface AiGenerateToolResult {
|
|
56
|
+
type: 'tool-result';
|
|
57
|
+
toolCallId: string;
|
|
58
|
+
toolName: string;
|
|
59
|
+
output: unknown;
|
|
60
|
+
isError?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Wire-format output from `AI.generate` / `POST .../generate`.
|
|
64
|
+
* Fields mirror AI SDK `GenerateTextResult` — uses AI SDK types where exported.
|
|
65
|
+
* See https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text
|
|
66
|
+
*/
|
|
67
|
+
interface AiGenerateOutput {
|
|
68
|
+
text: string;
|
|
69
|
+
/** AI SDK `FinishReason` */
|
|
70
|
+
finishReason: FinishReason;
|
|
71
|
+
/** AI SDK `LanguageModelUsage` */
|
|
72
|
+
usage: LanguageModelUsage;
|
|
73
|
+
/** Model reasoning steps (e.g. Gemini thinking) */
|
|
74
|
+
reasoning?: ReasoningOutput[];
|
|
75
|
+
/** Concatenated reasoning text */
|
|
76
|
+
reasoningText?: string;
|
|
77
|
+
/** URL sources from Google Search grounding */
|
|
78
|
+
sources?: AiGenerateSource[];
|
|
79
|
+
/** Tool calls made during generation */
|
|
80
|
+
toolCalls?: AiGenerateToolCall[];
|
|
81
|
+
/** Tool results from generation */
|
|
82
|
+
toolResults?: AiGenerateToolResult[];
|
|
83
|
+
/** Provider warnings (e.g. unsupported settings) — AI SDK `CallWarning[]` */
|
|
84
|
+
warnings?: CallWarning[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Maps simplified `AI.generate(prompt, content?)` calls to wire-format input.
|
|
89
|
+
*/
|
|
90
|
+
declare function aiGenerateInputFromSimplified(prompt: string, content?: UserContent): AiGenerateInput;
|
|
91
|
+
|
|
92
|
+
export { type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type Channel, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserContent } from 'ai';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Channel type.
|
|
5
|
+
* Represents the communication channel through which a request originated.
|
|
6
|
+
* Known channels are typed as string literals, unrecognized channels are unknown.
|
|
7
|
+
*/
|
|
8
|
+
type Channel = 'web' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* MIME types supported by Unstructured.io for document text extraction.
|
|
12
|
+
* Source: https://docs.unstructured.io/api-reference/supported-file-types
|
|
13
|
+
*
|
|
14
|
+
* Shared across lua-core (FileConversionService) and lua-agents (UnstructuredService).
|
|
15
|
+
*/
|
|
16
|
+
declare const UNSTRUCTURED_SUPPORTED_MEDIA_TYPES: Set<string>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Wire-format input for sandbox `AI.generate` / `POST .../generate` (JSON-serializable).
|
|
20
|
+
* Serializable subset of AI SDK `generateText` parameters.
|
|
21
|
+
* `messages` is untyped over HTTP; callers typically send AI SDK `ModelMessage[]`.
|
|
22
|
+
*/
|
|
23
|
+
interface AiGenerateInput {
|
|
24
|
+
model?: string;
|
|
25
|
+
system?: string;
|
|
26
|
+
prompt?: string;
|
|
27
|
+
messages?: unknown[];
|
|
28
|
+
temperature?: number;
|
|
29
|
+
maxOutputTokens?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* URL source from Google Search grounding.
|
|
33
|
+
* Mirrors `LanguageModelV2Source` (AI SDK `Source` type — not exported from `ai` as of v5).
|
|
34
|
+
*/
|
|
35
|
+
interface AiGenerateSource {
|
|
36
|
+
sourceType: 'url';
|
|
37
|
+
id: string;
|
|
38
|
+
url: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Serializable tool call. Mirrors `TypedToolCall` without generics.
|
|
43
|
+
* `input` matches the AI SDK field name (renamed from `args` in v5).
|
|
44
|
+
*/
|
|
45
|
+
interface AiGenerateToolCall {
|
|
46
|
+
type: 'tool-call';
|
|
47
|
+
toolCallId: string;
|
|
48
|
+
toolName: string;
|
|
49
|
+
input: unknown;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Serializable tool result. Mirrors `TypedToolResult` without generics.
|
|
53
|
+
* `output` matches the AI SDK field name.
|
|
54
|
+
*/
|
|
55
|
+
interface AiGenerateToolResult {
|
|
56
|
+
type: 'tool-result';
|
|
57
|
+
toolCallId: string;
|
|
58
|
+
toolName: string;
|
|
59
|
+
output: unknown;
|
|
60
|
+
isError?: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Wire-format output from `AI.generate` / `POST .../generate`.
|
|
64
|
+
* Fields mirror AI SDK `GenerateTextResult` — uses AI SDK types where exported.
|
|
65
|
+
* See https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text
|
|
66
|
+
*/
|
|
67
|
+
interface AiGenerateOutput {
|
|
68
|
+
text: string;
|
|
69
|
+
/** AI SDK `FinishReason` */
|
|
70
|
+
finishReason: FinishReason;
|
|
71
|
+
/** AI SDK `LanguageModelUsage` */
|
|
72
|
+
usage: LanguageModelUsage;
|
|
73
|
+
/** Model reasoning steps (e.g. Gemini thinking) */
|
|
74
|
+
reasoning?: ReasoningOutput[];
|
|
75
|
+
/** Concatenated reasoning text */
|
|
76
|
+
reasoningText?: string;
|
|
77
|
+
/** URL sources from Google Search grounding */
|
|
78
|
+
sources?: AiGenerateSource[];
|
|
79
|
+
/** Tool calls made during generation */
|
|
80
|
+
toolCalls?: AiGenerateToolCall[];
|
|
81
|
+
/** Tool results from generation */
|
|
82
|
+
toolResults?: AiGenerateToolResult[];
|
|
83
|
+
/** Provider warnings (e.g. unsupported settings) — AI SDK `CallWarning[]` */
|
|
84
|
+
warnings?: CallWarning[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Maps simplified `AI.generate(prompt, content?)` calls to wire-format input.
|
|
89
|
+
*/
|
|
90
|
+
declare function aiGenerateInputFromSimplified(prompt: string, content?: UserContent): AiGenerateInput;
|
|
91
|
+
|
|
92
|
+
export { type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type Channel, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
UNSTRUCTURED_SUPPORTED_MEDIA_TYPES: () => UNSTRUCTURED_SUPPORTED_MEDIA_TYPES,
|
|
24
|
+
aiGenerateInputFromSimplified: () => aiGenerateInputFromSimplified
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/unstructured-types.ts
|
|
29
|
+
var UNSTRUCTURED_SUPPORTED_MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
30
|
+
// PDF
|
|
31
|
+
"application/pdf",
|
|
32
|
+
// Word processing (.doc, .docx, .dot, .dotm, .zabw)
|
|
33
|
+
"application/msword",
|
|
34
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
35
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
36
|
+
"application/vnd.oasis.opendocument.text",
|
|
37
|
+
"application/rtf",
|
|
38
|
+
"text/rtf",
|
|
39
|
+
"application/x-abiword",
|
|
40
|
+
// Spreadsheets (.xls, .xlsx, .fods, .csv, .tsv, .dbf, .et, .mw)
|
|
41
|
+
"application/vnd.ms-excel",
|
|
42
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
43
|
+
"application/vnd.oasis.opendocument.spreadsheet",
|
|
44
|
+
"text/csv",
|
|
45
|
+
"text/tab-separated-values",
|
|
46
|
+
"application/dbase",
|
|
47
|
+
"application/x-et",
|
|
48
|
+
// Presentations (.ppt, .pptx, .pptm, .pot)
|
|
49
|
+
"application/vnd.ms-powerpoint",
|
|
50
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
51
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
52
|
+
// Images — OCR (.bmp, .heic, .jpeg, .jpg, .png, .prn, .tiff)
|
|
53
|
+
"image/jpeg",
|
|
54
|
+
"image/jpg",
|
|
55
|
+
"image/png",
|
|
56
|
+
"image/tiff",
|
|
57
|
+
"image/bmp",
|
|
58
|
+
"image/heic",
|
|
59
|
+
// Email (.eml, .msg, .p7s)
|
|
60
|
+
"message/rfc822",
|
|
61
|
+
"application/vnd.ms-outlook",
|
|
62
|
+
"application/pkcs7-signature",
|
|
63
|
+
// Web/Markup (.htm, .html, .md, .rst, .xml, .org)
|
|
64
|
+
"text/html",
|
|
65
|
+
"text/markdown",
|
|
66
|
+
"text/x-rst",
|
|
67
|
+
"text/x-org",
|
|
68
|
+
"application/xml",
|
|
69
|
+
"text/xml",
|
|
70
|
+
// Text (.txt)
|
|
71
|
+
"text/plain",
|
|
72
|
+
// eBook (.epub)
|
|
73
|
+
"application/epub+zip",
|
|
74
|
+
// Other (.hwp, .json, .cwk, .mcw, .dif, .sxg)
|
|
75
|
+
"application/json",
|
|
76
|
+
"application/x-hwp",
|
|
77
|
+
"application/clarisworks",
|
|
78
|
+
"application/x-dif",
|
|
79
|
+
"application/vnd.sun.xml.writer.global"
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
// src/ai-generate.utils.ts
|
|
83
|
+
function aiGenerateInputFromSimplified(prompt, content) {
|
|
84
|
+
if (content === void 0) {
|
|
85
|
+
return {
|
|
86
|
+
prompt
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
system: prompt,
|
|
91
|
+
messages: [
|
|
92
|
+
{
|
|
93
|
+
role: "user",
|
|
94
|
+
content
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
__name(aiGenerateInputFromSimplified, "aiGenerateInputFromSimplified");
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
UNSTRUCTURED_SUPPORTED_MEDIA_TYPES,
|
|
103
|
+
aiGenerateInputFromSimplified
|
|
104
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/unstructured-types.ts
|
|
5
|
+
var UNSTRUCTURED_SUPPORTED_MEDIA_TYPES = /* @__PURE__ */ new Set([
|
|
6
|
+
// PDF
|
|
7
|
+
"application/pdf",
|
|
8
|
+
// Word processing (.doc, .docx, .dot, .dotm, .zabw)
|
|
9
|
+
"application/msword",
|
|
10
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
|
12
|
+
"application/vnd.oasis.opendocument.text",
|
|
13
|
+
"application/rtf",
|
|
14
|
+
"text/rtf",
|
|
15
|
+
"application/x-abiword",
|
|
16
|
+
// Spreadsheets (.xls, .xlsx, .fods, .csv, .tsv, .dbf, .et, .mw)
|
|
17
|
+
"application/vnd.ms-excel",
|
|
18
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
19
|
+
"application/vnd.oasis.opendocument.spreadsheet",
|
|
20
|
+
"text/csv",
|
|
21
|
+
"text/tab-separated-values",
|
|
22
|
+
"application/dbase",
|
|
23
|
+
"application/x-et",
|
|
24
|
+
// Presentations (.ppt, .pptx, .pptm, .pot)
|
|
25
|
+
"application/vnd.ms-powerpoint",
|
|
26
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
27
|
+
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
|
28
|
+
// Images — OCR (.bmp, .heic, .jpeg, .jpg, .png, .prn, .tiff)
|
|
29
|
+
"image/jpeg",
|
|
30
|
+
"image/jpg",
|
|
31
|
+
"image/png",
|
|
32
|
+
"image/tiff",
|
|
33
|
+
"image/bmp",
|
|
34
|
+
"image/heic",
|
|
35
|
+
// Email (.eml, .msg, .p7s)
|
|
36
|
+
"message/rfc822",
|
|
37
|
+
"application/vnd.ms-outlook",
|
|
38
|
+
"application/pkcs7-signature",
|
|
39
|
+
// Web/Markup (.htm, .html, .md, .rst, .xml, .org)
|
|
40
|
+
"text/html",
|
|
41
|
+
"text/markdown",
|
|
42
|
+
"text/x-rst",
|
|
43
|
+
"text/x-org",
|
|
44
|
+
"application/xml",
|
|
45
|
+
"text/xml",
|
|
46
|
+
// Text (.txt)
|
|
47
|
+
"text/plain",
|
|
48
|
+
// eBook (.epub)
|
|
49
|
+
"application/epub+zip",
|
|
50
|
+
// Other (.hwp, .json, .cwk, .mcw, .dif, .sxg)
|
|
51
|
+
"application/json",
|
|
52
|
+
"application/x-hwp",
|
|
53
|
+
"application/clarisworks",
|
|
54
|
+
"application/x-dif",
|
|
55
|
+
"application/vnd.sun.xml.writer.global"
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
// src/ai-generate.utils.ts
|
|
59
|
+
function aiGenerateInputFromSimplified(prompt, content) {
|
|
60
|
+
if (content === void 0) {
|
|
61
|
+
return {
|
|
62
|
+
prompt
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
system: prompt,
|
|
67
|
+
messages: [
|
|
68
|
+
{
|
|
69
|
+
role: "user",
|
|
70
|
+
content
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
__name(aiGenerateInputFromSimplified, "aiGenerateInputFromSimplified");
|
|
76
|
+
export {
|
|
77
|
+
UNSTRUCTURED_SUPPORTED_MEDIA_TYPES,
|
|
78
|
+
aiGenerateInputFromSimplified
|
|
79
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lua/shared-types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"clean": "rm -rf dist"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"ai": "^5.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"tsup": "^8.5.1",
|
|
24
|
+
"typescript": "^5.8.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FinishReason,
|
|
3
|
+
LanguageModelUsage,
|
|
4
|
+
CallWarning,
|
|
5
|
+
ReasoningOutput,
|
|
6
|
+
} from 'ai';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Wire-format input for sandbox `AI.generate` / `POST .../generate` (JSON-serializable).
|
|
10
|
+
* Serializable subset of AI SDK `generateText` parameters.
|
|
11
|
+
* `messages` is untyped over HTTP; callers typically send AI SDK `ModelMessage[]`.
|
|
12
|
+
*/
|
|
13
|
+
export interface AiGenerateInput {
|
|
14
|
+
model?: string;
|
|
15
|
+
system?: string;
|
|
16
|
+
prompt?: string;
|
|
17
|
+
messages?: unknown[];
|
|
18
|
+
temperature?: number;
|
|
19
|
+
maxOutputTokens?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* URL source from Google Search grounding.
|
|
24
|
+
* Mirrors `LanguageModelV2Source` (AI SDK `Source` type — not exported from `ai` as of v5).
|
|
25
|
+
*/
|
|
26
|
+
export interface AiGenerateSource {
|
|
27
|
+
sourceType: 'url';
|
|
28
|
+
id: string;
|
|
29
|
+
url: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Serializable tool call. Mirrors `TypedToolCall` without generics.
|
|
35
|
+
* `input` matches the AI SDK field name (renamed from `args` in v5).
|
|
36
|
+
*/
|
|
37
|
+
export interface AiGenerateToolCall {
|
|
38
|
+
type: 'tool-call';
|
|
39
|
+
toolCallId: string;
|
|
40
|
+
toolName: string;
|
|
41
|
+
input: unknown;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Serializable tool result. Mirrors `TypedToolResult` without generics.
|
|
46
|
+
* `output` matches the AI SDK field name.
|
|
47
|
+
*/
|
|
48
|
+
export interface AiGenerateToolResult {
|
|
49
|
+
type: 'tool-result';
|
|
50
|
+
toolCallId: string;
|
|
51
|
+
toolName: string;
|
|
52
|
+
output: unknown;
|
|
53
|
+
isError?: boolean;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wire-format output from `AI.generate` / `POST .../generate`.
|
|
58
|
+
* Fields mirror AI SDK `GenerateTextResult` — uses AI SDK types where exported.
|
|
59
|
+
* See https://ai-sdk.dev/docs/reference/ai-sdk-core/generate-text
|
|
60
|
+
*/
|
|
61
|
+
export interface AiGenerateOutput {
|
|
62
|
+
text: string;
|
|
63
|
+
/** AI SDK `FinishReason` */
|
|
64
|
+
finishReason: FinishReason;
|
|
65
|
+
/** AI SDK `LanguageModelUsage` */
|
|
66
|
+
usage: LanguageModelUsage;
|
|
67
|
+
/** Model reasoning steps (e.g. Gemini thinking) */
|
|
68
|
+
reasoning?: ReasoningOutput[];
|
|
69
|
+
/** Concatenated reasoning text */
|
|
70
|
+
reasoningText?: string;
|
|
71
|
+
/** URL sources from Google Search grounding */
|
|
72
|
+
sources?: AiGenerateSource[];
|
|
73
|
+
/** Tool calls made during generation */
|
|
74
|
+
toolCalls?: AiGenerateToolCall[];
|
|
75
|
+
/** Tool results from generation */
|
|
76
|
+
toolResults?: AiGenerateToolResult[];
|
|
77
|
+
/** Provider warnings (e.g. unsupported settings) — AI SDK `CallWarning[]` */
|
|
78
|
+
warnings?: CallWarning[];
|
|
79
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { UserContent } from 'ai';
|
|
2
|
+
import type { AiGenerateInput } from './ai-generate.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Maps simplified `AI.generate(prompt, content?)` calls to wire-format input.
|
|
6
|
+
*/
|
|
7
|
+
export function aiGenerateInputFromSimplified(
|
|
8
|
+
prompt: string,
|
|
9
|
+
content?: UserContent
|
|
10
|
+
): AiGenerateInput {
|
|
11
|
+
if (content === undefined) {
|
|
12
|
+
return { prompt };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
system: prompt,
|
|
17
|
+
messages: [{ role: 'user', content }],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Channel type.
|
|
3
|
+
* Represents the communication channel through which a request originated.
|
|
4
|
+
* Known channels are typed as string literals, unrecognized channels are unknown.
|
|
5
|
+
*/
|
|
6
|
+
export type Channel =
|
|
7
|
+
| 'web' // Chat widget on a website
|
|
8
|
+
| 'whatsapp' // WhatsApp integration
|
|
9
|
+
| 'facebook' // Facebook Messenger integration
|
|
10
|
+
| 'instagram' // Instagram integration
|
|
11
|
+
| 'slack' // Slack integration
|
|
12
|
+
| 'teams' // Microsoft Teams integration
|
|
13
|
+
| 'messagebird' // MessageBird integration
|
|
14
|
+
| 'front' // Front integration
|
|
15
|
+
| 'api' // Direct HTTP API call
|
|
16
|
+
| 'dev' // Local development / CLI testing
|
|
17
|
+
| 'email' // Email integration
|
|
18
|
+
| 'rcs' // RCS (Rich Communication Services) integration
|
|
19
|
+
| 'sms' // SMS via Vonage Messages API
|
|
20
|
+
| 'mms' // MMS via Vonage Messages API
|
|
21
|
+
| string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIME types supported by Unstructured.io for document text extraction.
|
|
3
|
+
* Source: https://docs.unstructured.io/api-reference/supported-file-types
|
|
4
|
+
*
|
|
5
|
+
* Shared across lua-core (FileConversionService) and lua-agents (UnstructuredService).
|
|
6
|
+
*/
|
|
7
|
+
export const UNSTRUCTURED_SUPPORTED_MEDIA_TYPES = new Set([
|
|
8
|
+
// PDF
|
|
9
|
+
'application/pdf',
|
|
10
|
+
// Word processing (.doc, .docx, .dot, .dotm, .zabw)
|
|
11
|
+
'application/msword', // .doc, .dot
|
|
12
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
|
|
13
|
+
'application/vnd.openxmlformats-officedocument.wordprocessingml.template', // .dotm
|
|
14
|
+
'application/vnd.oasis.opendocument.text', // .odt
|
|
15
|
+
'application/rtf', // .rtf
|
|
16
|
+
'text/rtf',
|
|
17
|
+
'application/x-abiword', // .abw, .zabw
|
|
18
|
+
// Spreadsheets (.xls, .xlsx, .fods, .csv, .tsv, .dbf, .et, .mw)
|
|
19
|
+
'application/vnd.ms-excel', // .xls
|
|
20
|
+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
|
|
21
|
+
'application/vnd.oasis.opendocument.spreadsheet', // .fods
|
|
22
|
+
'text/csv', // .csv
|
|
23
|
+
'text/tab-separated-values', // .tsv
|
|
24
|
+
'application/dbase', // .dbf
|
|
25
|
+
'application/x-et', // .et (WPS Spreadsheet)
|
|
26
|
+
// Presentations (.ppt, .pptx, .pptm, .pot)
|
|
27
|
+
'application/vnd.ms-powerpoint', // .ppt
|
|
28
|
+
'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
|
|
29
|
+
'application/vnd.openxmlformats-officedocument.presentationml.template', // .pptm, .pot
|
|
30
|
+
// Images — OCR (.bmp, .heic, .jpeg, .jpg, .png, .prn, .tiff)
|
|
31
|
+
'image/jpeg',
|
|
32
|
+
'image/jpg',
|
|
33
|
+
'image/png',
|
|
34
|
+
'image/tiff',
|
|
35
|
+
'image/bmp',
|
|
36
|
+
'image/heic',
|
|
37
|
+
// Email (.eml, .msg, .p7s)
|
|
38
|
+
'message/rfc822', // .eml
|
|
39
|
+
'application/vnd.ms-outlook', // .msg
|
|
40
|
+
'application/pkcs7-signature', // .p7s
|
|
41
|
+
// Web/Markup (.htm, .html, .md, .rst, .xml, .org)
|
|
42
|
+
'text/html',
|
|
43
|
+
'text/markdown',
|
|
44
|
+
'text/x-rst', // .rst
|
|
45
|
+
'text/x-org', // .org (Org Mode)
|
|
46
|
+
'application/xml',
|
|
47
|
+
'text/xml',
|
|
48
|
+
// Text (.txt)
|
|
49
|
+
'text/plain',
|
|
50
|
+
// eBook (.epub)
|
|
51
|
+
'application/epub+zip', // .epub
|
|
52
|
+
// Other (.hwp, .json, .cwk, .mcw, .dif, .sxg)
|
|
53
|
+
'application/json',
|
|
54
|
+
'application/x-hwp', // .hwp (Hangul)
|
|
55
|
+
'application/clarisworks', // .cwk, .mcw (Apple ClarisWorks)
|
|
56
|
+
'application/x-dif', // .dif (Data Interchange Format)
|
|
57
|
+
'application/vnd.sun.xml.writer.global', // .sxg (StarOffice)
|
|
58
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lua-cli",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.3",
|
|
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",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"clean": "rm -rf dist",
|
|
15
15
|
"build:react": "cd src/web && npx tsx build.ts",
|
|
16
16
|
"build": "npm run clean && npm run build:react && tsc && chmod +x dist/index.js",
|
|
17
|
+
"prepack": "node scripts/resolve-workspace-deps.cjs",
|
|
18
|
+
"postpack": "git checkout package.json",
|
|
17
19
|
"prepublishOnly": "npm run build",
|
|
18
20
|
"test": "jest",
|
|
19
21
|
"test:watch": "jest --watch",
|
|
@@ -53,12 +55,13 @@
|
|
|
53
55
|
"dist/**/*",
|
|
54
56
|
"template/**/*",
|
|
55
57
|
"docs/**/*",
|
|
58
|
+
"scripts/**/*",
|
|
56
59
|
"README.md",
|
|
57
60
|
"CHANGELOG.md",
|
|
58
61
|
"LICENSE"
|
|
59
62
|
],
|
|
60
63
|
"dependencies": {
|
|
61
|
-
"@lua/shared-types": "
|
|
64
|
+
"@lua/shared-types": "0.0.1",
|
|
62
65
|
"ai": "^5.0.76",
|
|
63
66
|
"@tailwindcss/postcss": "^4.1.14",
|
|
64
67
|
"@tanstack/react-query": "^5.90.11",
|
|
@@ -85,6 +88,9 @@
|
|
|
85
88
|
"zod": "^3.24.1",
|
|
86
89
|
"zod-to-json-schema": "^3.24.6"
|
|
87
90
|
},
|
|
91
|
+
"bundledDependencies": [
|
|
92
|
+
"@lua/shared-types"
|
|
93
|
+
],
|
|
88
94
|
"optionalDependencies": {
|
|
89
95
|
"keytar": "^7.9.0"
|
|
90
96
|
},
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-pack script: resolves workspace:* references in package.json
|
|
3
|
+
* before npm creates the tarball.
|
|
4
|
+
*
|
|
5
|
+
* pnpm does this automatically during `pnpm publish`, but `npm publish`
|
|
6
|
+
* does not. This script bridges the gap so both work.
|
|
7
|
+
*
|
|
8
|
+
* Usage: Called automatically via the "prepack" lifecycle hook.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
15
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
16
|
+
|
|
17
|
+
let changed = false;
|
|
18
|
+
|
|
19
|
+
for (const depType of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
20
|
+
const deps = pkg[depType];
|
|
21
|
+
if (!deps) continue;
|
|
22
|
+
|
|
23
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
24
|
+
if (typeof version === 'string' && version.startsWith('workspace:')) {
|
|
25
|
+
// Extract the modifier after "workspace:" (e.g., *, ^, ~)
|
|
26
|
+
const modifier = version.slice('workspace:'.length);
|
|
27
|
+
|
|
28
|
+
// Resolve the actual version from the workspace package
|
|
29
|
+
const possiblePaths = [
|
|
30
|
+
path.join(__dirname, '..', '..', name.replace('@lua/', ''), 'package.json'),
|
|
31
|
+
path.join(__dirname, '..', '..', name.split('/').pop(), 'package.json'),
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
let resolved = false;
|
|
35
|
+
for (const depPkgPath of possiblePaths) {
|
|
36
|
+
if (fs.existsSync(depPkgPath)) {
|
|
37
|
+
const depPkg = JSON.parse(fs.readFileSync(depPkgPath, 'utf8'));
|
|
38
|
+
// Preserve pnpm workspace modifiers: ^ → ^version, ~ → ~version, * → version
|
|
39
|
+
const prefix = modifier === '^' ? '^' : modifier === '~' ? '~' : '';
|
|
40
|
+
deps[name] = prefix + depPkg.version;
|
|
41
|
+
console.log(` Resolved ${name}: ${version} → ${deps[name]}`);
|
|
42
|
+
resolved = true;
|
|
43
|
+
changed = true;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!resolved) {
|
|
49
|
+
console.error(` Error: Could not resolve workspace dependency ${name}`);
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (changed) {
|
|
57
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
58
|
+
console.log('Workspace dependencies resolved for publishing.');
|
|
59
|
+
} else {
|
|
60
|
+
console.log('No workspace dependencies found.');
|
|
61
|
+
}
|