lavs-runtime 0.1.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 (42) hide show
  1. package/README.md +75 -0
  2. package/dist/function-executor.d.ts +26 -0
  3. package/dist/function-executor.d.ts.map +1 -0
  4. package/dist/function-executor.js +116 -0
  5. package/dist/function-executor.js.map +1 -0
  6. package/dist/index.d.ts +25 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +35 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/loader.d.ts +37 -0
  11. package/dist/loader.d.ts.map +1 -0
  12. package/dist/loader.js +187 -0
  13. package/dist/loader.js.map +1 -0
  14. package/dist/permission-checker.d.ts +86 -0
  15. package/dist/permission-checker.d.ts.map +1 -0
  16. package/dist/permission-checker.js +172 -0
  17. package/dist/permission-checker.js.map +1 -0
  18. package/dist/rate-limiter.d.ts +57 -0
  19. package/dist/rate-limiter.d.ts.map +1 -0
  20. package/dist/rate-limiter.js +84 -0
  21. package/dist/rate-limiter.js.map +1 -0
  22. package/dist/script-executor.d.ts +70 -0
  23. package/dist/script-executor.d.ts.map +1 -0
  24. package/dist/script-executor.js +314 -0
  25. package/dist/script-executor.js.map +1 -0
  26. package/dist/subscription-manager.d.ts +106 -0
  27. package/dist/subscription-manager.d.ts.map +1 -0
  28. package/dist/subscription-manager.js +257 -0
  29. package/dist/subscription-manager.js.map +1 -0
  30. package/dist/tool-generator.d.ts +51 -0
  31. package/dist/tool-generator.d.ts.map +1 -0
  32. package/dist/tool-generator.js +147 -0
  33. package/dist/tool-generator.js.map +1 -0
  34. package/dist/types.d.ts +171 -0
  35. package/dist/types.d.ts.map +1 -0
  36. package/dist/types.js +38 -0
  37. package/dist/types.js.map +1 -0
  38. package/dist/validator.d.ts +94 -0
  39. package/dist/validator.d.ts.map +1 -0
  40. package/dist/validator.js +187 -0
  41. package/dist/validator.js.map +1 -0
  42. package/package.json +51 -0
package/dist/types.js ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * LAVS (Local Agent View Service) Type Definitions
4
+ *
5
+ * This file defines the TypeScript types for LAVS manifests and related interfaces.
6
+ * See docs/LAVS-SPEC.md for full specification.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.LAVSErrorCode = exports.LAVSError = void 0;
10
+ /**
11
+ * LAVS Error - standard error format
12
+ */
13
+ class LAVSError extends Error {
14
+ code;
15
+ data;
16
+ constructor(code, message, data) {
17
+ super(message);
18
+ this.code = code;
19
+ this.data = data;
20
+ this.name = 'LAVSError';
21
+ }
22
+ }
23
+ exports.LAVSError = LAVSError;
24
+ /**
25
+ * LAVS Error Codes (JSON-RPC 2.0 compatible)
26
+ */
27
+ var LAVSErrorCode;
28
+ (function (LAVSErrorCode) {
29
+ LAVSErrorCode[LAVSErrorCode["ParseError"] = -32700] = "ParseError";
30
+ LAVSErrorCode[LAVSErrorCode["InvalidRequest"] = -32600] = "InvalidRequest";
31
+ LAVSErrorCode[LAVSErrorCode["MethodNotFound"] = -32601] = "MethodNotFound";
32
+ LAVSErrorCode[LAVSErrorCode["InvalidParams"] = -32602] = "InvalidParams";
33
+ LAVSErrorCode[LAVSErrorCode["InternalError"] = -32603] = "InternalError";
34
+ LAVSErrorCode[LAVSErrorCode["PermissionDenied"] = -32001] = "PermissionDenied";
35
+ LAVSErrorCode[LAVSErrorCode["Timeout"] = -32002] = "Timeout";
36
+ LAVSErrorCode[LAVSErrorCode["HandlerError"] = -32003] = "HandlerError";
37
+ })(LAVSErrorCode || (exports.LAVSErrorCode = LAVSErrorCode = {}));
38
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAuJH;;GAEG;AACH,MAAa,SAAU,SAAQ,KAAK;IAEzB;IAEA;IAHT,YACS,IAAY,EACnB,OAAe,EACR,IAA8B;QAErC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJR,SAAI,GAAJ,IAAI,CAAQ;QAEZ,SAAI,GAAJ,IAAI,CAA0B;QAGrC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AATD,8BASC;AAED;;GAEG;AACH,IAAY,aASX;AATD,WAAY,aAAa;IACvB,kEAAmB,CAAA;IACnB,0EAAuB,CAAA;IACvB,0EAAuB,CAAA;IACvB,wEAAsB,CAAA;IACtB,wEAAsB,CAAA;IACtB,8EAAyB,CAAA;IACzB,4DAAgB,CAAA;IAChB,sEAAqB,CAAA;AACvB,CAAC,EATW,aAAa,6BAAb,aAAa,QASxB"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * LAVS Validator
3
+ *
4
+ * Validates endpoint inputs and outputs against JSON Schema definitions.
5
+ * Uses ajv for fast JSON Schema compilation and validation.
6
+ */
7
+ import { Endpoint, JSONSchema } from './types';
8
+ /**
9
+ * Validation result
10
+ */
11
+ export interface ValidationResult {
12
+ valid: boolean;
13
+ errors?: ValidationError[];
14
+ }
15
+ /**
16
+ * Individual validation error detail
17
+ */
18
+ export interface ValidationError {
19
+ path: string;
20
+ message: string;
21
+ keyword: string;
22
+ params?: Record<string, unknown>;
23
+ }
24
+ /**
25
+ * LAVS Validator - validates endpoint inputs and outputs against JSON Schema
26
+ */
27
+ export declare class LAVSValidator {
28
+ private ajv;
29
+ private inputValidators;
30
+ private outputValidators;
31
+ constructor();
32
+ /**
33
+ * Validate endpoint input against schema.input
34
+ * If no schema.input is defined, validation passes (returns valid).
35
+ *
36
+ * @param endpoint - Endpoint definition containing schema
37
+ * @param input - Input data to validate
38
+ * @param types - Optional types map from manifest for resolving $ref references
39
+ * @returns Validation result
40
+ */
41
+ validateInput(endpoint: Endpoint, input: unknown, types?: Record<string, JSONSchema>): ValidationResult;
42
+ /**
43
+ * Validate endpoint output against schema.output
44
+ * If no schema.output is defined, validation passes (returns valid).
45
+ *
46
+ * @param endpoint - Endpoint definition containing schema
47
+ * @param output - Output data to validate
48
+ * @param types - Optional types map from manifest for resolving $ref references
49
+ * @returns Validation result
50
+ */
51
+ validateOutput(endpoint: Endpoint, output: unknown, types?: Record<string, JSONSchema>): ValidationResult;
52
+ /**
53
+ * Validate input and throw LAVSError if invalid
54
+ *
55
+ * @param endpoint - Endpoint definition
56
+ * @param input - Input data to validate
57
+ * @param types - Optional types map from manifest for resolving $ref references
58
+ * @throws LAVSError with code InvalidParams if validation fails
59
+ */
60
+ assertValidInput(endpoint: Endpoint, input: unknown, types?: Record<string, JSONSchema>): void;
61
+ /**
62
+ * Validate output and throw LAVSError if invalid
63
+ *
64
+ * @param endpoint - Endpoint definition
65
+ * @param output - Output data to validate
66
+ * @param types - Optional types map from manifest for resolving $ref references
67
+ * @throws LAVSError with code InternalError if validation fails
68
+ */
69
+ assertValidOutput(endpoint: Endpoint, output: unknown, types?: Record<string, JSONSchema>): void;
70
+ /**
71
+ * Get or compile a JSON Schema validator, using cache.
72
+ * When types are provided, they are merged into the schema root so that
73
+ * $ref references like "#/types/Todo" can be resolved by ajv via JSON Pointer.
74
+ */
75
+ private getOrCompileValidator;
76
+ /**
77
+ * Check if a schema (or any nested part) contains $ref references to #/types/
78
+ */
79
+ private hasTypeRefs;
80
+ /**
81
+ * Format ajv errors into our ValidationError format
82
+ */
83
+ private formatErrors;
84
+ /**
85
+ * Create a human-readable summary from validation errors
86
+ */
87
+ private summarizeErrors;
88
+ /**
89
+ * Clear all cached validators
90
+ * Useful when schemas change (e.g., manifest reload)
91
+ */
92
+ clearCache(): void;
93
+ }
94
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EACL,QAAQ,EAGR,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;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";
2
+ /**
3
+ * LAVS Validator
4
+ *
5
+ * Validates endpoint inputs and outputs against JSON Schema definitions.
6
+ * Uses ajv for fast JSON Schema compilation and validation.
7
+ */
8
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LAVSValidator = void 0;
13
+ const ajv_1 = __importDefault(require("ajv"));
14
+ const ajv_formats_1 = __importDefault(require("ajv-formats"));
15
+ const types_1 = require("./types");
16
+ /**
17
+ * LAVS Validator - validates endpoint inputs and outputs against JSON Schema
18
+ */
19
+ class LAVSValidator {
20
+ ajv;
21
+ inputValidators = new Map();
22
+ outputValidators = new Map();
23
+ constructor() {
24
+ this.ajv = new ajv_1.default({
25
+ allErrors: true, // Report all errors, not just first
26
+ strict: false, // Allow extra keywords in schema
27
+ coerceTypes: false, // Don't coerce types
28
+ useDefaults: true, // Apply default values from schema
29
+ });
30
+ (0, ajv_formats_1.default)(this.ajv);
31
+ }
32
+ /**
33
+ * Validate endpoint input against schema.input
34
+ * If no schema.input is defined, validation passes (returns valid).
35
+ *
36
+ * @param endpoint - Endpoint definition containing schema
37
+ * @param input - Input data to validate
38
+ * @param types - Optional types map from manifest for resolving $ref references
39
+ * @returns Validation result
40
+ */
41
+ validateInput(endpoint, input, types) {
42
+ // No schema defined - skip validation
43
+ if (!endpoint.schema?.input) {
44
+ return { valid: true };
45
+ }
46
+ const cacheKey = `input:${endpoint.id}`;
47
+ const validate = this.getOrCompileValidator(cacheKey, endpoint.schema.input, types);
48
+ const valid = validate(input);
49
+ if (valid) {
50
+ return { valid: true };
51
+ }
52
+ return {
53
+ valid: false,
54
+ errors: this.formatErrors(validate.errors || []),
55
+ };
56
+ }
57
+ /**
58
+ * Validate endpoint output against schema.output
59
+ * If no schema.output is defined, validation passes (returns valid).
60
+ *
61
+ * @param endpoint - Endpoint definition containing schema
62
+ * @param output - Output data to validate
63
+ * @param types - Optional types map from manifest for resolving $ref references
64
+ * @returns Validation result
65
+ */
66
+ validateOutput(endpoint, output, types) {
67
+ // No schema defined - skip validation
68
+ if (!endpoint.schema?.output) {
69
+ return { valid: true };
70
+ }
71
+ const cacheKey = `output:${endpoint.id}`;
72
+ const validate = this.getOrCompileValidator(cacheKey, endpoint.schema.output, types);
73
+ const valid = validate(output);
74
+ if (valid) {
75
+ return { valid: true };
76
+ }
77
+ return {
78
+ valid: false,
79
+ errors: this.formatErrors(validate.errors || []),
80
+ };
81
+ }
82
+ /**
83
+ * Validate input and throw LAVSError if invalid
84
+ *
85
+ * @param endpoint - Endpoint definition
86
+ * @param input - Input data to validate
87
+ * @param types - Optional types map from manifest for resolving $ref references
88
+ * @throws LAVSError with code InvalidParams if validation fails
89
+ */
90
+ assertValidInput(endpoint, input, types) {
91
+ const result = this.validateInput(endpoint, input, types);
92
+ if (!result.valid) {
93
+ throw new types_1.LAVSError(types_1.LAVSErrorCode.InvalidParams, `Invalid input for endpoint '${endpoint.id}': ${this.summarizeErrors(result.errors)}`, { validationErrors: result.errors });
94
+ }
95
+ }
96
+ /**
97
+ * Validate output and throw LAVSError if invalid
98
+ *
99
+ * @param endpoint - Endpoint definition
100
+ * @param output - Output data to validate
101
+ * @param types - Optional types map from manifest for resolving $ref references
102
+ * @throws LAVSError with code InternalError if validation fails
103
+ */
104
+ assertValidOutput(endpoint, output, types) {
105
+ const result = this.validateOutput(endpoint, output, types);
106
+ if (!result.valid) {
107
+ throw new types_1.LAVSError(types_1.LAVSErrorCode.InternalError, `Invalid output from endpoint '${endpoint.id}': handler returned data that does not match schema`, { validationErrors: result.errors });
108
+ }
109
+ }
110
+ /**
111
+ * Get or compile a JSON Schema validator, using cache.
112
+ * When types are provided, they are merged into the schema root so that
113
+ * $ref references like "#/types/Todo" can be resolved by ajv via JSON Pointer.
114
+ */
115
+ getOrCompileValidator(cacheKey, schema, types) {
116
+ const isInput = cacheKey.startsWith('input:');
117
+ const cache = isInput ? this.inputValidators : this.outputValidators;
118
+ let validate = cache.get(cacheKey);
119
+ if (!validate) {
120
+ try {
121
+ // If manifest defines types, merge them into the schema root
122
+ // so that $ref: "#/types/Todo" resolves via JSON Pointer (#/types/Todo)
123
+ let schemaToCompile = schema;
124
+ if (types && Object.keys(types).length > 0 && this.hasTypeRefs(schema)) {
125
+ schemaToCompile = { ...schema, types };
126
+ }
127
+ validate = this.ajv.compile(schemaToCompile);
128
+ cache.set(cacheKey, validate);
129
+ }
130
+ catch (error) {
131
+ const message = error instanceof Error ? error.message : String(error);
132
+ throw new types_1.LAVSError(types_1.LAVSErrorCode.InternalError, `Failed to compile JSON Schema for ${cacheKey}: ${message}`);
133
+ }
134
+ }
135
+ return validate;
136
+ }
137
+ /**
138
+ * Check if a schema (or any nested part) contains $ref references to #/types/
139
+ */
140
+ hasTypeRefs(obj) {
141
+ if (!obj || typeof obj !== 'object')
142
+ return false;
143
+ const record = obj;
144
+ if (typeof record.$ref === 'string' && record.$ref.startsWith('#/types/'))
145
+ return true;
146
+ for (const value of Object.values(record)) {
147
+ if (this.hasTypeRefs(value))
148
+ return true;
149
+ }
150
+ return false;
151
+ }
152
+ /**
153
+ * Format ajv errors into our ValidationError format
154
+ */
155
+ formatErrors(errors) {
156
+ return errors.map((err) => ({
157
+ path: err.instancePath || '/',
158
+ message: err.message || 'Validation failed',
159
+ keyword: err.keyword,
160
+ params: err.params,
161
+ }));
162
+ }
163
+ /**
164
+ * Create a human-readable summary from validation errors
165
+ */
166
+ summarizeErrors(errors) {
167
+ if (errors.length === 0)
168
+ return 'Unknown validation error';
169
+ if (errors.length === 1) {
170
+ const err = errors[0];
171
+ return `${err.path || '/'} ${err.message}`;
172
+ }
173
+ return errors
174
+ .map((err) => `${err.path || '/'} ${err.message}`)
175
+ .join('; ');
176
+ }
177
+ /**
178
+ * Clear all cached validators
179
+ * Useful when schemas change (e.g., manifest reload)
180
+ */
181
+ clearCache() {
182
+ this.inputValidators.clear();
183
+ this.outputValidators.clear();
184
+ }
185
+ }
186
+ exports.LAVSValidator = LAVSValidator;
187
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,8CAAyD;AACzD,8DAAqC;AACrC,mCAKiB;AAoBjB;;GAEG;AACH,MAAa,aAAa;IAChB,GAAG,CAAM;IACT,eAAe,GAAkC,IAAI,GAAG,EAAE,CAAC;IAC3D,gBAAgB,GAAkC,IAAI,GAAG,EAAE,CAAC;IAEpE;QACE,IAAI,CAAC,GAAG,GAAG,IAAI,aAAG,CAAC;YACjB,SAAS,EAAE,IAAI,EAAQ,oCAAoC;YAC3D,MAAM,EAAE,KAAK,EAAU,iCAAiC;YACxD,WAAW,EAAE,KAAK,EAAK,qBAAqB;YAC5C,WAAW,EAAE,IAAI,EAAM,mCAAmC;SAC3D,CAAC,CAAC;QACH,IAAA,qBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,QAAkB,EAAE,KAAc,EAAE,KAAkC;QAClF,sCAAsC;QACtC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;YAC5B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,QAAQ,GAAG,SAAS,QAAQ,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAEpF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAED,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,IAA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,MAAM,CAAC,CAAC,CAAC,CAAC;YACtB,OAAO,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC7C,CAAC;QACD,OAAO,MAAM;aACV,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACF;AA9LD,sCA8LC"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "lavs-runtime",
3
+ "version": "0.1.0",
4
+ "description": "LAVS (Local Agent View Service) server-side runtime - manifest loading, handler execution, validation",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "test": "vitest",
18
+ "test:run": "vitest run",
19
+ "clean": "rm -rf dist",
20
+ "prepublishOnly": "npm run clean && npm run build"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md"
25
+ ],
26
+ "keywords": [
27
+ "lavs",
28
+ "agent",
29
+ "view",
30
+ "service",
31
+ "runtime",
32
+ "manifest",
33
+ "validation"
34
+ ],
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/nicepkg/lavs.git",
39
+ "directory": "sdk/typescript/runtime"
40
+ },
41
+ "dependencies": {
42
+ "ajv": "^8.18.0",
43
+ "ajv-formats": "^3.0.1",
44
+ "minimatch": "^9.0.5"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.5.0",
48
+ "typescript": "^5.1.6",
49
+ "vitest": "^2.1.0"
50
+ }
51
+ }