@lakitu/sdk 0.1.45 → 0.1.46

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.
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Template Configuration Module
3
+ *
4
+ * Type helpers for customizing the E2B sandbox template.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * // convex/lakitu/template.config.ts
9
+ * import { defineTemplate } from '@lakitu/sdk/template';
10
+ *
11
+ * export default defineTemplate({
12
+ * packages: {
13
+ * apt: ["ffmpeg", "imagemagick"],
14
+ * pip: ["pandas", "numpy"],
15
+ * npm: ["sharp"],
16
+ * },
17
+ * services: ["redis"],
18
+ * setup: ["pip install -r requirements.txt"],
19
+ * });
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ /**
25
+ * Template configuration for customizing sandbox packages and services.
26
+ */
27
+ export interface TemplateConfig {
28
+ /**
29
+ * Packages to install in the sandbox.
30
+ */
31
+ packages?: {
32
+ /** APT packages (Ubuntu) */
33
+ apt?: string[];
34
+ /** Python packages via pip */
35
+ pip?: string[];
36
+ /** Node.js packages via npm */
37
+ npm?: string[];
38
+ };
39
+ /**
40
+ * Services to pre-start in the sandbox.
41
+ * Currently supported: "redis", "postgres"
42
+ */
43
+ services?: ("redis" | "postgres" | string)[];
44
+ /**
45
+ * Custom setup commands to run after package installation.
46
+ * These run as the user (not root).
47
+ */
48
+ setup?: string[];
49
+ /**
50
+ * Environment variables to set in the sandbox.
51
+ */
52
+ env?: Record<string, string>;
53
+ /**
54
+ * Files to copy into the sandbox.
55
+ * Key is destination path, value is source path (relative to project root).
56
+ */
57
+ files?: Record<string, string>;
58
+ }
59
+ /**
60
+ * Define a template configuration with type checking.
61
+ *
62
+ * @param config - Template configuration object
63
+ * @returns The same config object (for type inference)
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * import { defineTemplate } from '@lakitu/sdk/template';
68
+ *
69
+ * export default defineTemplate({
70
+ * packages: {
71
+ * apt: ["ffmpeg"],
72
+ * pip: ["opencv-python"],
73
+ * },
74
+ * setup: [
75
+ * "pip install -r requirements.txt",
76
+ * ],
77
+ * });
78
+ * ```
79
+ */
80
+ export declare function defineTemplate(config: TemplateConfig): TemplateConfig;
81
+ /**
82
+ * Default template configuration (empty - no customizations).
83
+ */
84
+ export declare const DEFAULT_TEMPLATE_CONFIG: TemplateConfig;
85
+ /**
86
+ * Merge two template configs, with the second taking precedence.
87
+ */
88
+ export declare function mergeTemplateConfigs(base: TemplateConfig, override: TemplateConfig): TemplateConfig;
89
+ //# sourceMappingURL=template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../sdk/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,4BAA4B;QAC5B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACf,8BAA8B;QAC9B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;QACf,+BAA+B;QAC/B,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB,CAAC;IAEF;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC;IAE7C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAErE;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAUrC,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,cAAc,GACvB,cAAc,CAYhB"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Template Configuration Module
3
+ *
4
+ * Type helpers for customizing the E2B sandbox template.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * // convex/lakitu/template.config.ts
9
+ * import { defineTemplate } from '@lakitu/sdk/template';
10
+ *
11
+ * export default defineTemplate({
12
+ * packages: {
13
+ * apt: ["ffmpeg", "imagemagick"],
14
+ * pip: ["pandas", "numpy"],
15
+ * npm: ["sharp"],
16
+ * },
17
+ * services: ["redis"],
18
+ * setup: ["pip install -r requirements.txt"],
19
+ * });
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ /**
25
+ * Define a template configuration with type checking.
26
+ *
27
+ * @param config - Template configuration object
28
+ * @returns The same config object (for type inference)
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * import { defineTemplate } from '@lakitu/sdk/template';
33
+ *
34
+ * export default defineTemplate({
35
+ * packages: {
36
+ * apt: ["ffmpeg"],
37
+ * pip: ["opencv-python"],
38
+ * },
39
+ * setup: [
40
+ * "pip install -r requirements.txt",
41
+ * ],
42
+ * });
43
+ * ```
44
+ */
45
+ export function defineTemplate(config) {
46
+ return config;
47
+ }
48
+ /**
49
+ * Default template configuration (empty - no customizations).
50
+ */
51
+ export const DEFAULT_TEMPLATE_CONFIG = {
52
+ packages: {
53
+ apt: [],
54
+ pip: [],
55
+ npm: [],
56
+ },
57
+ services: [],
58
+ setup: [],
59
+ env: {},
60
+ files: {},
61
+ };
62
+ /**
63
+ * Merge two template configs, with the second taking precedence.
64
+ */
65
+ export function mergeTemplateConfigs(base, override) {
66
+ return {
67
+ packages: {
68
+ apt: [...(base.packages?.apt || []), ...(override.packages?.apt || [])],
69
+ pip: [...(base.packages?.pip || []), ...(override.packages?.pip || [])],
70
+ npm: [...(base.packages?.npm || []), ...(override.packages?.npm || [])],
71
+ },
72
+ services: [...(base.services || []), ...(override.services || [])],
73
+ setup: [...(base.setup || []), ...(override.setup || [])],
74
+ env: { ...(base.env || {}), ...(override.env || {}) },
75
+ files: { ...(base.files || {}), ...(override.files || {}) },
76
+ };
77
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lakitu/sdk",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Self-hosted AI agent framework for Convex + E2B with code execution",
5
5
  "type": "module",
6
6
  "main": "./dist/sdk/index.js",