@veil-runtime/core 0.1.3 → 0.3.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/README.md +58 -522
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/runtime/events/memory-event-bus.js +8 -1
- package/dist/runtime/execution/governed-value.d.ts +5 -0
- package/dist/runtime/execution/governed-value.js +198 -0
- package/dist/runtime/execution/plan-admission-error.d.ts +22 -0
- package/dist/runtime/execution/plan-admission-error.js +44 -0
- package/dist/runtime/execution/plan-validator.d.ts +3 -0
- package/dist/runtime/execution/plan-validator.js +23 -2
- package/dist/runtime/execution/result-reference.js +10 -3
- package/dist/runtime/jobs/job-manager.d.ts +3 -2
- package/dist/runtime/jobs/job-manager.js +97 -27
- package/dist/runtime/operator-runtime.d.ts +5 -7
- package/dist/runtime/operator-runtime.js +20 -1
- package/dist/runtime/registry/capability.d.ts +9 -0
- package/dist/runtime/registry/registry.d.ts +3 -8
- package/dist/runtime/registry/registry.js +22 -7
- package/package.json +4 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.operatorRuntime = exports.OperatorRuntime = void 0;
|
|
4
|
+
const plan_admission_error_js_1 = require("./execution/plan-admission-error.js");
|
|
4
5
|
const job_manager_js_1 = require("./jobs/job-manager.js");
|
|
5
6
|
const job_memory_js_1 = require("./jobs/job-memory.js");
|
|
6
7
|
const execution_authorizer_js_1 = require("./permissions/execution-authorizer.js");
|
|
@@ -23,10 +24,19 @@ function immutableCaller(caller) {
|
|
|
23
24
|
}
|
|
24
25
|
class OperatorRuntime {
|
|
25
26
|
authorizer;
|
|
27
|
+
planVersions;
|
|
26
28
|
constructor(options = {}) {
|
|
27
29
|
this.authorizer =
|
|
28
30
|
options.authorizer ??
|
|
29
31
|
execution_authorizer_js_1.defaultExecutionAuthorizer;
|
|
32
|
+
const versions = options.planVersions ?? ['1.0'];
|
|
33
|
+
if (!Array.isArray(versions) ||
|
|
34
|
+
versions.length === 0 ||
|
|
35
|
+
versions.some((version) => version !== '1.0' && version !== '2.0') ||
|
|
36
|
+
new Set(versions).size !== versions.length) {
|
|
37
|
+
throw new Error('planVersions must contain unique supported semantic versions');
|
|
38
|
+
}
|
|
39
|
+
this.planVersions = new Set(versions);
|
|
30
40
|
}
|
|
31
41
|
use(module) {
|
|
32
42
|
const declared = new Set(module.manifest.capabilities);
|
|
@@ -38,7 +48,13 @@ class OperatorRuntime {
|
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
async executePlan(plan, options = {}) {
|
|
41
|
-
|
|
51
|
+
const admissionOwner = {};
|
|
52
|
+
try {
|
|
53
|
+
return await job_manager_js_1.jobManager.executePlan(plan, immutableCaller(options.caller), this.authorizer, admissionOwner, this.planVersions);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw (0, plan_admission_error_js_1.containForeignAdmissionError)(admissionOwner, error);
|
|
57
|
+
}
|
|
42
58
|
}
|
|
43
59
|
async run(goal, options = {}) {
|
|
44
60
|
const router = planner_router_registry_js_1.plannerRouterRegistry.getDefault();
|
|
@@ -70,6 +86,9 @@ class OperatorRuntime {
|
|
|
70
86
|
listCapabilities() {
|
|
71
87
|
return registry_js_1.capabilityRegistry.list();
|
|
72
88
|
}
|
|
89
|
+
describeCapability(name, version) {
|
|
90
|
+
return registry_js_1.capabilityRegistry.describe(name, version);
|
|
91
|
+
}
|
|
73
92
|
listPlanners() {
|
|
74
93
|
return planner_registry_js_1.plannerRegistry.list();
|
|
75
94
|
}
|
|
@@ -13,3 +13,12 @@ export interface Capability<TInput = unknown, TResult = unknown> {
|
|
|
13
13
|
inputSchema?: Record<string, CapabilityInputField>;
|
|
14
14
|
execute(input: TInput, context?: ExecutionContext): Promise<TResult>;
|
|
15
15
|
}
|
|
16
|
+
/** Detached execution metadata. Introspection is not authorization. */
|
|
17
|
+
export interface CapabilityDescriptor {
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
description: string;
|
|
21
|
+
risk: CapabilityRisk;
|
|
22
|
+
/** Limited Veil field contract, not full JSON Schema. */
|
|
23
|
+
inputSchema: Record<string, CapabilityInputField>;
|
|
24
|
+
}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { Capability } from './capability.js';
|
|
1
|
+
import { Capability, CapabilityDescriptor } from './capability.js';
|
|
2
2
|
declare class CapabilityRegistry {
|
|
3
3
|
private capabilities;
|
|
4
4
|
register(capability: Capability): void;
|
|
5
5
|
get(name: string): Capability | undefined;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
version: string;
|
|
9
|
-
description: string;
|
|
10
|
-
risk: import("./capability.js").CapabilityRisk;
|
|
11
|
-
inputSchema: Record<string, import("./capability.js").CapabilityInputField>;
|
|
12
|
-
}[];
|
|
6
|
+
describe(name: string, version?: string): CapabilityDescriptor | undefined;
|
|
7
|
+
list(): CapabilityDescriptor[];
|
|
13
8
|
}
|
|
14
9
|
export declare const capabilityRegistry: CapabilityRegistry;
|
|
15
10
|
export {};
|
|
@@ -12,14 +12,29 @@ class CapabilityRegistry {
|
|
|
12
12
|
get(name) {
|
|
13
13
|
return this.capabilities.get(name);
|
|
14
14
|
}
|
|
15
|
+
describe(name, version) {
|
|
16
|
+
const capability = this.get(name);
|
|
17
|
+
if (!capability || (version !== undefined && version !== capability.version)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
return describeCapability(capability);
|
|
21
|
+
}
|
|
15
22
|
list() {
|
|
16
|
-
return Array.from(this.capabilities.values())
|
|
17
|
-
name: capability.name,
|
|
18
|
-
version: capability.version,
|
|
19
|
-
description: capability.description,
|
|
20
|
-
risk: capability.risk,
|
|
21
|
-
inputSchema: capability.inputSchema ?? {},
|
|
22
|
-
}));
|
|
23
|
+
return Array.from(this.capabilities.values(), describeCapability);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
exports.capabilityRegistry = new CapabilityRegistry();
|
|
27
|
+
// Explicitly project passive metadata; never copy implementation properties.
|
|
28
|
+
function describeCapability(capability) {
|
|
29
|
+
return {
|
|
30
|
+
name: capability.name,
|
|
31
|
+
version: capability.version,
|
|
32
|
+
description: capability.description,
|
|
33
|
+
risk: capability.risk,
|
|
34
|
+
inputSchema: Object.fromEntries(Object.entries(capability.inputSchema ?? {}).map(([name, field]) => [name, {
|
|
35
|
+
type: field.type,
|
|
36
|
+
required: field.required,
|
|
37
|
+
description: field.description,
|
|
38
|
+
}])),
|
|
39
|
+
};
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veil-runtime/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A governed, capability-driven execution runtime",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"test": "tsc --project tsconfig.test.json && node --test .tmp/test-build/test/*.test.js",
|
|
44
44
|
"verify:package": "npm run build && node tools/verify-package.mjs",
|
|
45
45
|
"check": "npm run typecheck && npm test && npm run verify:package",
|
|
46
|
+
"quality": "node tools/quality.mjs",
|
|
47
|
+
"test:quality": "node --test tools/quality.test.mjs tools/quality-governance.test.mjs",
|
|
46
48
|
"mcp:stdio": "tsx src/integrations/mcp/stdio-server.ts",
|
|
47
49
|
"mcp:test": "tsx src/integrations/mcp/test-client.ts",
|
|
48
50
|
"mcp:test:outbound": "tsx src/integrations/mcp/test-outbound.ts"
|
|
@@ -61,6 +63,7 @@
|
|
|
61
63
|
"better-sqlite3": "^13.0.3"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
66
|
+
"@babel/parser": "8.0.6",
|
|
64
67
|
"@types/better-sqlite3": "^9.6.0",
|
|
65
68
|
"@types/node": "^26.2.0",
|
|
66
69
|
"fastify": "^5.11.3",
|