@veil-runtime/core 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.
- package/LICENSE +201 -0
- package/README.md +480 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +21 -0
- package/dist/providers/storage/sqlite-job-store.d.ts +10 -0
- package/dist/providers/storage/sqlite-job-store.js +89 -0
- package/dist/runtime/events/event-bus.d.ts +6 -0
- package/dist/runtime/events/event-bus.js +2 -0
- package/dist/runtime/events/event-subscriber.d.ts +6 -0
- package/dist/runtime/events/event-subscriber.js +2 -0
- package/dist/runtime/events/memory-event-bus.d.ts +9 -0
- package/dist/runtime/events/memory-event-bus.js +31 -0
- package/dist/runtime/events/runtime-event.d.ts +10 -0
- package/dist/runtime/events/runtime-event.js +2 -0
- package/dist/runtime/execution/console-execution-logger.d.ts +13 -0
- package/dist/runtime/execution/console-execution-logger.js +37 -0
- package/dist/runtime/execution/execution-context.d.ts +13 -0
- package/dist/runtime/execution/execution-context.js +2 -0
- package/dist/runtime/execution/execution-logger.d.ts +15 -0
- package/dist/runtime/execution/execution-logger.js +2 -0
- package/dist/runtime/execution/plan-validator.d.ts +13 -0
- package/dist/runtime/execution/plan-validator.js +122 -0
- package/dist/runtime/execution/result-reference.d.ts +9 -0
- package/dist/runtime/execution/result-reference.js +59 -0
- package/dist/runtime/jobs/job-event.d.ts +8 -0
- package/dist/runtime/jobs/job-event.js +2 -0
- package/dist/runtime/jobs/job-manager.d.ts +17 -0
- package/dist/runtime/jobs/job-manager.js +214 -0
- package/dist/runtime/jobs/job-memory.d.ts +6 -0
- package/dist/runtime/jobs/job-memory.js +70 -0
- package/dist/runtime/jobs/job-status.d.ts +1 -0
- package/dist/runtime/jobs/job-status.js +2 -0
- package/dist/runtime/jobs/job-step.d.ts +10 -0
- package/dist/runtime/jobs/job-step.js +2 -0
- package/dist/runtime/jobs/job-store.d.ts +15 -0
- package/dist/runtime/jobs/job-store.js +52 -0
- package/dist/runtime/jobs/job.d.ts +20 -0
- package/dist/runtime/jobs/job.js +2 -0
- package/dist/runtime/logging/composite-log-sink.d.ts +7 -0
- package/dist/runtime/logging/composite-log-sink.js +13 -0
- package/dist/runtime/logging/console-log-sink.d.ts +6 -0
- package/dist/runtime/logging/console-log-sink.js +28 -0
- package/dist/runtime/logging/execution-log-sink.d.ts +4 -0
- package/dist/runtime/logging/execution-log-sink.js +2 -0
- package/dist/runtime/logging/sqlite-log-sink.d.ts +7 -0
- package/dist/runtime/logging/sqlite-log-sink.js +52 -0
- package/dist/runtime/modules/capability-module-manifest.d.ts +11 -0
- package/dist/runtime/modules/capability-module-manifest.js +2 -0
- package/dist/runtime/modules/capability-module.d.ts +6 -0
- package/dist/runtime/modules/capability-module.js +2 -0
- package/dist/runtime/operator-runtime.d.ts +31 -0
- package/dist/runtime/operator-runtime.js +71 -0
- package/dist/runtime/permissions/permissions.d.ts +7 -0
- package/dist/runtime/permissions/permissions.js +42 -0
- package/dist/runtime/planner/planner-definition.d.ts +9 -0
- package/dist/runtime/planner/planner-definition.js +2 -0
- package/dist/runtime/planner/planner-eligibility.d.ts +7 -0
- package/dist/runtime/planner/planner-eligibility.js +20 -0
- package/dist/runtime/planner/planner-provider.d.ts +11 -0
- package/dist/runtime/planner/planner-provider.js +2 -0
- package/dist/runtime/planner/planner-registry.d.ts +40 -0
- package/dist/runtime/planner/planner-registry.js +103 -0
- package/dist/runtime/planner/planner-router-registry.d.ts +17 -0
- package/dist/runtime/planner/planner-router-registry.js +37 -0
- package/dist/runtime/planner/planner-router.d.ts +14 -0
- package/dist/runtime/planner/planner-router.js +2 -0
- package/dist/runtime/planner/planner-runtime-state.d.ts +6 -0
- package/dist/runtime/planner/planner-runtime-state.js +2 -0
- package/dist/runtime/planner/planner-traits.d.ts +10 -0
- package/dist/runtime/planner/planner-traits.js +2 -0
- package/dist/runtime/planner/planner.d.ts +29 -0
- package/dist/runtime/planner/planner.js +2 -0
- package/dist/runtime/planner/strategies/planner-strategy-registry.d.ts +12 -0
- package/dist/runtime/planner/strategies/planner-strategy-registry.js +22 -0
- package/dist/runtime/planner/strategies/planner-strategy.d.ts +11 -0
- package/dist/runtime/planner/strategies/planner-strategy.js +2 -0
- package/dist/runtime/registry/capability.d.ts +15 -0
- package/dist/runtime/registry/capability.js +2 -0
- package/dist/runtime/registry/registry.d.ts +15 -0
- package/dist/runtime/registry/registry.js +25 -0
- package/dist/sdk/capability/capability-definition.d.ts +19 -0
- package/dist/sdk/capability/capability-definition.js +2 -0
- package/dist/sdk/capability/capability-middleware.d.ts +5 -0
- package/dist/sdk/capability/capability-middleware.js +2 -0
- package/dist/sdk/capability/create-capability.d.ts +3 -0
- package/dist/sdk/capability/create-capability.js +37 -0
- package/dist/sdk/capability/index.d.ts +5 -0
- package/dist/sdk/capability/index.js +9 -0
- package/dist/sdk/capability/lifecycle-logging-middleware.d.ts +7 -0
- package/dist/sdk/capability/lifecycle-logging-middleware.js +35 -0
- package/dist/sdk/capability/timeout-middleware.d.ts +7 -0
- package/dist/sdk/capability/timeout-middleware.js +43 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/sdk/index.js +17 -0
- package/package.json +70 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CapabilityMiddleware, CapabilityNext } from './capability-middleware.js';
|
|
2
|
+
import { CapabilityExecution } from './capability-definition.js';
|
|
3
|
+
export declare class TimeoutMiddleware<TInput = unknown, TResult = unknown> implements CapabilityMiddleware<TInput, TResult> {
|
|
4
|
+
private readonly timeoutMs;
|
|
5
|
+
constructor(timeoutMs: number);
|
|
6
|
+
execute(execution: CapabilityExecution<TInput, TResult>, next: CapabilityNext<TResult>): Promise<TResult>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TimeoutMiddleware = void 0;
|
|
4
|
+
class TimeoutMiddleware {
|
|
5
|
+
timeoutMs;
|
|
6
|
+
constructor(timeoutMs) {
|
|
7
|
+
this.timeoutMs = timeoutMs;
|
|
8
|
+
if (!Number.isFinite(timeoutMs) ||
|
|
9
|
+
timeoutMs <= 0) {
|
|
10
|
+
throw new Error('timeoutMs must be greater than zero');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async execute(execution, next) {
|
|
14
|
+
let timeoutHandle;
|
|
15
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
16
|
+
timeoutHandle =
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
reject(new Error(`Capability execution timed out after ${this.timeoutMs}ms`));
|
|
19
|
+
}, this.timeoutMs);
|
|
20
|
+
});
|
|
21
|
+
try {
|
|
22
|
+
return await Promise.race([
|
|
23
|
+
next(),
|
|
24
|
+
timeoutPromise,
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (error instanceof Error &&
|
|
29
|
+
error.message.includes('timed out')) {
|
|
30
|
+
execution.context?.logger.warn('Capability execution timed out', {
|
|
31
|
+
timeoutMs: this.timeoutMs,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
if (timeoutHandle) {
|
|
38
|
+
clearTimeout(timeoutHandle);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.TimeoutMiddleware = TimeoutMiddleware;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './capability/index.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./capability/index.js"), exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@veil-runtime/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A governed, capability-driven execution runtime",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/veil-runtime/veil.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/veil-runtime/veil#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/veil-runtime/veil/issues"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=24"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE"
|
|
34
|
+
],
|
|
35
|
+
"type": "commonjs",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "tsx watch src/api/server/server.ts",
|
|
38
|
+
"start": "tsx src/api/server/server.ts",
|
|
39
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
40
|
+
"build": "npm run clean && tsc --project tsconfig.build.json",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"test": "tsc --project tsconfig.test.json && node --test .tmp/test-build/test/*.test.js",
|
|
43
|
+
"verify:package": "npm run build && node tools/verify-package.mjs",
|
|
44
|
+
"check": "npm run typecheck && npm test && npm run verify:package",
|
|
45
|
+
"mcp:stdio": "tsx src/integrations/mcp/stdio-server.ts",
|
|
46
|
+
"mcp:test": "tsx src/integrations/mcp/test-client.ts",
|
|
47
|
+
"mcp:test:outbound": "tsx src/integrations/mcp/test-outbound.ts"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"execution-runtime",
|
|
51
|
+
"capabilities",
|
|
52
|
+
"automation",
|
|
53
|
+
"ai",
|
|
54
|
+
"agents"
|
|
55
|
+
],
|
|
56
|
+
"author": "Mustapha",
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"better-sqlite3": "^13.0.3"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
62
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
63
|
+
"@types/node": "^26.2.0",
|
|
64
|
+
"fastify": "^5.11.3",
|
|
65
|
+
"playwright": "^1.62.1",
|
|
66
|
+
"tsx": "^4.23.12",
|
|
67
|
+
"typescript": "^7.0.2",
|
|
68
|
+
"zod": "^4.4.3"
|
|
69
|
+
}
|
|
70
|
+
}
|