@nobulex/sdk 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/dist/adapters/express.d.ts +322 -0
- package/dist/adapters/express.d.ts.map +1 -0
- package/dist/adapters/express.js +356 -0
- package/dist/adapters/express.js.map +1 -0
- package/dist/adapters/index.d.ts +15 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +15 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/langchain.d.ts +183 -0
- package/dist/adapters/langchain.d.ts.map +1 -0
- package/dist/adapters/langchain.js +203 -0
- package/dist/adapters/langchain.js.map +1 -0
- package/dist/adapters/vercel-ai.d.ts +122 -0
- package/dist/adapters/vercel-ai.d.ts.map +1 -0
- package/dist/adapters/vercel-ai.js +128 -0
- package/dist/adapters/vercel-ai.js.map +1 -0
- package/dist/benchmarks.d.ts +164 -0
- package/dist/benchmarks.d.ts.map +1 -0
- package/dist/benchmarks.js +327 -0
- package/dist/benchmarks.js.map +1 -0
- package/dist/benchmarks.test.d.ts +2 -0
- package/dist/benchmarks.test.d.ts.map +1 -0
- package/dist/benchmarks.test.js +71 -0
- package/dist/benchmarks.test.js.map +1 -0
- package/dist/conformance.d.ts +160 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +1242 -0
- package/dist/conformance.js.map +1 -0
- package/dist/events.d.ts +176 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +208 -0
- package/dist/events.js.map +1 -0
- package/dist/index.d.ts +384 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +695 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +986 -0
- package/dist/index.test.js.map +1 -0
- package/dist/middleware.d.ts +104 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +222 -0
- package/dist/middleware.js.map +1 -0
- package/dist/middleware.test.d.ts +5 -0
- package/dist/middleware.test.d.ts.map +1 -0
- package/dist/middleware.test.js +735 -0
- package/dist/middleware.test.js.map +1 -0
- package/dist/plugins/auth.d.ts +49 -0
- package/dist/plugins/auth.d.ts.map +1 -0
- package/dist/plugins/auth.js +82 -0
- package/dist/plugins/auth.js.map +1 -0
- package/dist/plugins/cache.d.ts +40 -0
- package/dist/plugins/cache.d.ts.map +1 -0
- package/dist/plugins/cache.js +191 -0
- package/dist/plugins/cache.js.map +1 -0
- package/dist/plugins/index.d.ts +16 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +12 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/metrics-plugin.d.ts +32 -0
- package/dist/plugins/metrics-plugin.d.ts.map +1 -0
- package/dist/plugins/metrics-plugin.js +61 -0
- package/dist/plugins/metrics-plugin.js.map +1 -0
- package/dist/plugins/plugins.test.d.ts +8 -0
- package/dist/plugins/plugins.test.d.ts.map +1 -0
- package/dist/plugins/plugins.test.js +640 -0
- package/dist/plugins/plugins.test.js.map +1 -0
- package/dist/plugins/retry-plugin.d.ts +55 -0
- package/dist/plugins/retry-plugin.d.ts.map +1 -0
- package/dist/plugins/retry-plugin.js +133 -0
- package/dist/plugins/retry-plugin.js.map +1 -0
- package/dist/telemetry.d.ts +183 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +241 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/types.d.ts +200 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { runBenchmarkSuite, benchmark, PERFORMANCE_SLAS, formatBenchmarkResults } from './benchmarks.js';
|
|
3
|
+
describe('Performance SLAs', () => {
|
|
4
|
+
it('all SLA targets are met', async () => {
|
|
5
|
+
const results = await runBenchmarkSuite();
|
|
6
|
+
console.log(formatBenchmarkResults(results));
|
|
7
|
+
expect(results.allPassed).toBe(true);
|
|
8
|
+
}, 60_000); // 60s timeout for benchmarks
|
|
9
|
+
it('PERFORMANCE_SLAS covers all critical operations', () => {
|
|
10
|
+
const required = [
|
|
11
|
+
'crypto.generateKeyPair',
|
|
12
|
+
'crypto.sign',
|
|
13
|
+
'crypto.verify',
|
|
14
|
+
'ccl.parse',
|
|
15
|
+
'ccl.evaluate',
|
|
16
|
+
'covenant.build',
|
|
17
|
+
'covenant.verify',
|
|
18
|
+
];
|
|
19
|
+
for (const op of required) {
|
|
20
|
+
expect(PERFORMANCE_SLAS).toHaveProperty(op);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
it('benchmark utility computes correct percentiles', async () => {
|
|
24
|
+
const result = await benchmark('test.noop', () => { }, 100);
|
|
25
|
+
expect(result.iterations).toBe(100);
|
|
26
|
+
expect(result.p50).toBeLessThanOrEqual(result.p95);
|
|
27
|
+
expect(result.p95).toBeLessThanOrEqual(result.p99);
|
|
28
|
+
expect(result.min).toBeLessThanOrEqual(result.p50);
|
|
29
|
+
expect(result.max).toBeGreaterThanOrEqual(result.p99);
|
|
30
|
+
});
|
|
31
|
+
it('benchmark result has correct structure', async () => {
|
|
32
|
+
const result = await benchmark('test.structure', () => { }, 50);
|
|
33
|
+
expect(result).toHaveProperty('name', 'test.structure');
|
|
34
|
+
expect(result).toHaveProperty('iterations', 50);
|
|
35
|
+
expect(typeof result.p50).toBe('number');
|
|
36
|
+
expect(typeof result.p95).toBe('number');
|
|
37
|
+
expect(typeof result.p99).toBe('number');
|
|
38
|
+
expect(typeof result.min).toBe('number');
|
|
39
|
+
expect(typeof result.max).toBe('number');
|
|
40
|
+
expect(typeof result.mean).toBe('number');
|
|
41
|
+
expect(typeof result.slaTarget).toBe('number');
|
|
42
|
+
expect(typeof result.slaPassed).toBe('boolean');
|
|
43
|
+
});
|
|
44
|
+
it('formatBenchmarkResults produces readable output', async () => {
|
|
45
|
+
const result = await benchmark('test.format', () => { }, 50);
|
|
46
|
+
const suiteResult = {
|
|
47
|
+
results: [result],
|
|
48
|
+
allPassed: true,
|
|
49
|
+
totalDuration: 100,
|
|
50
|
+
timestamp: new Date().toISOString(),
|
|
51
|
+
};
|
|
52
|
+
const output = formatBenchmarkResults(suiteResult);
|
|
53
|
+
expect(output).toContain('test.format');
|
|
54
|
+
expect(output).toContain('PASS');
|
|
55
|
+
expect(output).toContain('Stele Performance Benchmark Suite');
|
|
56
|
+
});
|
|
57
|
+
it('PERFORMANCE_SLAS has all 13 targets', () => {
|
|
58
|
+
const keys = Object.keys(PERFORMANCE_SLAS);
|
|
59
|
+
expect(keys.length).toBe(13);
|
|
60
|
+
});
|
|
61
|
+
it('all SLA targets have required fields', () => {
|
|
62
|
+
for (const [name, sla] of Object.entries(PERFORMANCE_SLAS)) {
|
|
63
|
+
expect(typeof sla.p99).toBe('number');
|
|
64
|
+
expect(sla.unit).toBe('ms');
|
|
65
|
+
expect(typeof sla.description).toBe('string');
|
|
66
|
+
expect(sla.description.length).toBeGreaterThan(0);
|
|
67
|
+
expect(sla.p99).toBeGreaterThan(0);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=benchmarks.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmarks.test.js","sourceRoot":"","sources":["../src/benchmarks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzG,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,OAAO,GAAG,MAAM,iBAAiB,EAAE,CAAC;QAC1C,OAAO,CAAC,GAAG,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|
|
4
|
+
* Provides test vectors and validation functions for any implementation
|
|
5
|
+
* of the Stele protocol. Implementations that pass all conformance checks
|
|
6
|
+
* are considered spec-compliant.
|
|
7
|
+
*
|
|
8
|
+
* Like the W3C Acid Tests for browsers or TLS conformance suites --
|
|
9
|
+
* a standardized set of test vectors that any Stele implementation must pass.
|
|
10
|
+
*
|
|
11
|
+
* This module is self-contained at runtime: it uses the provided
|
|
12
|
+
* {@link ConformanceTarget} interface to generate keys and test documents.
|
|
13
|
+
* Type imports from @stele packages are used only for interface definitions.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import type { CovenantDocument, CovenantBuilderOptions, VerificationResult } from '@nobulex/core';
|
|
18
|
+
import type { CCLDocument, EvaluationResult as CCLEvaluationResult } from '@nobulex/ccl';
|
|
19
|
+
import type { KeyPair } from '@nobulex/crypto';
|
|
20
|
+
/** Aggregate result from running the full conformance suite. */
|
|
21
|
+
export interface ConformanceResult {
|
|
22
|
+
/** True when every check passed. */
|
|
23
|
+
passed: boolean;
|
|
24
|
+
/** Total number of individual checks that were executed. */
|
|
25
|
+
total: number;
|
|
26
|
+
/** Details for every check that failed. */
|
|
27
|
+
failures: ConformanceFailure[];
|
|
28
|
+
/** Wall-clock duration in milliseconds. */
|
|
29
|
+
duration: number;
|
|
30
|
+
}
|
|
31
|
+
/** A single conformance check that did not pass. */
|
|
32
|
+
export interface ConformanceFailure {
|
|
33
|
+
/** Short identifier for the check (e.g. `"ed25519-roundtrip"`). */
|
|
34
|
+
test: string;
|
|
35
|
+
/** Category the check belongs to (e.g. `"crypto"`, `"ccl"`). */
|
|
36
|
+
category: string;
|
|
37
|
+
/** The value the check expected. */
|
|
38
|
+
expected: unknown;
|
|
39
|
+
/** The value the implementation actually produced. */
|
|
40
|
+
actual: unknown;
|
|
41
|
+
/** Human-readable explanation of the failure. */
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Functions that the implementation under test must provide.
|
|
46
|
+
*
|
|
47
|
+
* Any Stele-compatible implementation can be tested by wiring up these
|
|
48
|
+
* functions and passing the resulting object to {@link runConformanceSuite}.
|
|
49
|
+
*/
|
|
50
|
+
export interface ConformanceTarget {
|
|
51
|
+
/** Build a signed covenant document from builder options. */
|
|
52
|
+
buildCovenant: (options: CovenantBuilderOptions) => Promise<CovenantDocument>;
|
|
53
|
+
/** Verify a covenant document. Returns `{ valid, checks }`. */
|
|
54
|
+
verifyCovenant: (doc: CovenantDocument) => Promise<VerificationResult>;
|
|
55
|
+
/** Evaluate an action/resource against a covenant's CCL constraints. */
|
|
56
|
+
evaluateAction: (doc: CovenantDocument, action: string, resource: string, context?: Record<string, unknown>) => Promise<CCLEvaluationResult>;
|
|
57
|
+
/** Generate an Ed25519 key pair. Returns `{ privateKey, publicKey, publicKeyHex }`. */
|
|
58
|
+
generateKeyPair: () => Promise<KeyPair>;
|
|
59
|
+
/** Sign a message with an Ed25519 private key. */
|
|
60
|
+
sign: (message: Uint8Array, privateKey: Uint8Array) => Promise<Uint8Array>;
|
|
61
|
+
/** Verify an Ed25519 signature. */
|
|
62
|
+
verify: (message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array) => Promise<boolean>;
|
|
63
|
+
/** SHA-256 hash returning a lowercase hex string. */
|
|
64
|
+
sha256: (data: Uint8Array) => Promise<string> | string;
|
|
65
|
+
/** Parse CCL source text into a CCLDocument. */
|
|
66
|
+
parseCCL: (source: string) => CCLDocument;
|
|
67
|
+
}
|
|
68
|
+
/** Result from a single conformance category. */
|
|
69
|
+
interface CategoryResult {
|
|
70
|
+
failures: ConformanceFailure[];
|
|
71
|
+
total: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Verify that the target's cryptographic primitives conform to spec.
|
|
75
|
+
*
|
|
76
|
+
* Checks:
|
|
77
|
+
* - Ed25519 sign/verify round-trip
|
|
78
|
+
* - SHA-256 known-answer tests (NIST vectors)
|
|
79
|
+
* - Signature verification rejects tampered messages
|
|
80
|
+
* - Different keys produce different signatures
|
|
81
|
+
* - Wrong public key rejects valid signature
|
|
82
|
+
*/
|
|
83
|
+
export declare function cryptoConformance(target: ConformanceTarget): Promise<CategoryResult>;
|
|
84
|
+
/**
|
|
85
|
+
* Verify that the target's CCL parser and evaluator conform to spec.
|
|
86
|
+
*
|
|
87
|
+
* Checks:
|
|
88
|
+
* - `permit read on '/data'` permits read on /data
|
|
89
|
+
* - `deny write on '/system/**'` denies write on /system/config
|
|
90
|
+
* - Default deny: no matching rule results in denied
|
|
91
|
+
* - Deny-wins: permit + deny on same resource results in denied
|
|
92
|
+
* - Wildcards: `**` matches nested paths
|
|
93
|
+
* - Rate limits parse correctly
|
|
94
|
+
* - Conditions evaluate correctly
|
|
95
|
+
* - Exact resource matching: `/secrets` does NOT match `/secrets/key`
|
|
96
|
+
*/
|
|
97
|
+
export declare function cclConformance(target: ConformanceTarget): Promise<CategoryResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Verify that the target's covenant build/verify lifecycle conforms to spec.
|
|
100
|
+
*
|
|
101
|
+
* Checks:
|
|
102
|
+
* - Build -> verify round-trip
|
|
103
|
+
* - Tampered covenant fails verification
|
|
104
|
+
* - Expired covenant detected
|
|
105
|
+
* - ID integrity check (id matches content hash)
|
|
106
|
+
* - Constraints must be valid CCL
|
|
107
|
+
* - Nonce must be present
|
|
108
|
+
* - Signature is a hex string of correct length
|
|
109
|
+
*/
|
|
110
|
+
export declare function covenantConformance(target: ConformanceTarget): Promise<CategoryResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Verify cross-implementation interoperability.
|
|
113
|
+
*
|
|
114
|
+
* Checks:
|
|
115
|
+
* - Canonical JSON test vectors (JCS compatibility)
|
|
116
|
+
* - JSON serialize/deserialize round-trip
|
|
117
|
+
* - Document ID matches reference canonical form hash
|
|
118
|
+
* - ID format (64-char lowercase hex)
|
|
119
|
+
* - Protocol version is "1.0"
|
|
120
|
+
* - Nonce format (64-char hex)
|
|
121
|
+
*/
|
|
122
|
+
export declare function interopConformance(target: ConformanceTarget): Promise<CategoryResult>;
|
|
123
|
+
/**
|
|
124
|
+
* Run the complete Stele Protocol Conformance Suite.
|
|
125
|
+
*
|
|
126
|
+
* Executes all four categories (crypto, CCL, covenant, interop) and
|
|
127
|
+
* aggregates the results. An implementation that returns
|
|
128
|
+
* `result.passed === true` is considered spec-compliant.
|
|
129
|
+
*
|
|
130
|
+
* @param target - The implementation under test.
|
|
131
|
+
* @returns Aggregate conformance result.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* import { runConformanceSuite } from '@nobulex/sdk/conformance';
|
|
136
|
+
* import { buildCovenant, verifyCovenant } from '@nobulex/core';
|
|
137
|
+
* import { generateKeyPair, sign, verify, sha256 } from '@nobulex/crypto';
|
|
138
|
+
* import { parse, evaluate } from '@nobulex/ccl';
|
|
139
|
+
*
|
|
140
|
+
* const result = await runConformanceSuite({
|
|
141
|
+
* buildCovenant,
|
|
142
|
+
* verifyCovenant,
|
|
143
|
+
* evaluateAction: async (doc, action, resource, ctx) => {
|
|
144
|
+
* const cclDoc = parse(doc.constraints);
|
|
145
|
+
* return evaluate(cclDoc, action, resource, ctx);
|
|
146
|
+
* },
|
|
147
|
+
* generateKeyPair,
|
|
148
|
+
* sign: async (msg, key) => sign(msg, key),
|
|
149
|
+
* verify: async (msg, sig, key) => verify(msg, sig, key),
|
|
150
|
+
* sha256: (data) => sha256(data),
|
|
151
|
+
* parseCCL: parse,
|
|
152
|
+
* });
|
|
153
|
+
*
|
|
154
|
+
* console.log(result.passed); // true
|
|
155
|
+
* console.log(result.total); // number of checks run
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export declare function runConformanceSuite(target: ConformanceTarget): Promise<ConformanceResult>;
|
|
159
|
+
export {};
|
|
160
|
+
//# sourceMappingURL=conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.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