@nextera.one/axis-server-sdk 2.2.1 → 2.2.3

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 (49) hide show
  1. package/dist/axis-sensor-GBEI3Fab.d.mts +209 -0
  2. package/dist/axis-sensor-GBEI3Fab.d.ts +209 -0
  3. package/dist/cce/index.d.mts +162 -0
  4. package/dist/cce/index.d.ts +162 -0
  5. package/dist/cce/index.js +1502 -0
  6. package/dist/cce/index.js.map +1 -0
  7. package/dist/cce/index.mjs +1442 -0
  8. package/dist/cce/index.mjs.map +1 -0
  9. package/dist/cce-pipeline-B-zUBHo3.d.mts +294 -0
  10. package/dist/cce-pipeline-DbGBSsCG.d.ts +294 -0
  11. package/dist/idel/index.d.mts +24 -0
  12. package/dist/idel/index.d.ts +24 -0
  13. package/dist/idel/index.js +306 -0
  14. package/dist/idel/index.js.map +1 -0
  15. package/dist/idel/index.mjs +279 -0
  16. package/dist/idel/index.mjs.map +1 -0
  17. package/dist/idel.types-DuUAcOnQ.d.mts +83 -0
  18. package/dist/idel.types-DuUAcOnQ.d.ts +83 -0
  19. package/dist/index-B2G6cbRL.d.mts +824 -0
  20. package/dist/index-DbSxdR0f.d.ts +824 -0
  21. package/dist/index-_S4fmVUJ.d.mts +501 -0
  22. package/dist/index-l3Hhirqb.d.ts +501 -0
  23. package/dist/index.d.mts +77 -1894
  24. package/dist/index.d.ts +77 -1894
  25. package/dist/index.js +10087 -5970
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +10302 -5897
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/needle/index.d.mts +4 -0
  30. package/dist/needle/index.d.ts +4 -0
  31. package/dist/needle/index.js +3499 -0
  32. package/dist/needle/index.js.map +1 -0
  33. package/dist/needle/index.mjs +3528 -0
  34. package/dist/needle/index.mjs.map +1 -0
  35. package/dist/sensors/index.d.mts +5 -0
  36. package/dist/sensors/index.d.ts +5 -0
  37. package/dist/sensors/index.js +12767 -0
  38. package/dist/sensors/index.js.map +1 -0
  39. package/dist/sensors/index.mjs +12835 -0
  40. package/dist/sensors/index.mjs.map +1 -0
  41. package/dist/timeline/index.d.mts +54 -0
  42. package/dist/timeline/index.d.ts +54 -0
  43. package/dist/timeline/index.js +389 -0
  44. package/dist/timeline/index.js.map +1 -0
  45. package/dist/timeline/index.mjs +362 -0
  46. package/dist/timeline/index.mjs.map +1 -0
  47. package/dist/timeline.types-Cn0aqbUj.d.mts +125 -0
  48. package/dist/timeline.types-Cn0aqbUj.d.ts +125 -0
  49. package/package.json +28 -10
@@ -0,0 +1,294 @@
1
+ import { A as AxisSensor } from './axis-sensor-GBEI3Fab.js';
2
+
3
+ declare const CCE_PROTOCOL_VERSION: "cce-v1";
4
+ declare const CCE_DERIVATION: {
5
+ readonly REQUEST: "axis:cce:req:v1";
6
+ readonly RESPONSE: "axis:cce:resp:v1";
7
+ readonly WITNESS: "axis:cce:witness:v1";
8
+ };
9
+ type CceAlgorithm = "AES-256-GCM";
10
+ type CceKemAlgorithm = "X25519" | "RSA-OAEP-256";
11
+ type CceKdfAlgorithm = "HKDF-SHA256";
12
+ declare const CCE_AES_KEY_BYTES = 32;
13
+ declare const CCE_IV_BYTES = 12;
14
+ declare const CCE_TAG_BYTES = 16;
15
+ declare const CCE_NONCE_BYTES = 32;
16
+ interface CceCapsuleClaims {
17
+ capsule_id: string;
18
+ ver: typeof CCE_PROTOCOL_VERSION;
19
+ sub: string;
20
+ kid: string;
21
+ intent: string;
22
+ aud: string;
23
+ tps_from: number;
24
+ tps_to: number;
25
+ capsule_nonce: string;
26
+ challenge_id: string;
27
+ proof_hash?: string;
28
+ policy_hash?: string;
29
+ iat: number;
30
+ exp: number;
31
+ mode: "SINGLE_USE" | "SESSION";
32
+ scope?: string[];
33
+ constraints?: CceConstraints;
34
+ issuer_sig: CceSignature;
35
+ }
36
+ interface CceConstraints {
37
+ max_payload_bytes?: number;
38
+ ip_allow?: string[];
39
+ device_allow?: string[];
40
+ country_allow?: string[];
41
+ }
42
+ interface CceSignature {
43
+ alg: "EdDSA" | "ES256";
44
+ kid: string;
45
+ value: string;
46
+ }
47
+ interface CceRequestEnvelope {
48
+ ver: typeof CCE_PROTOCOL_VERSION;
49
+ request_id: string;
50
+ correlation_id: string;
51
+ client_kid: string;
52
+ capsule: CceCapsuleClaims;
53
+ encrypted_key: CceEncryptedKey;
54
+ encrypted_payload: CceEncryptedPayload;
55
+ request_nonce: string;
56
+ client_sig: CceSignature;
57
+ content_type: string;
58
+ algorithms: CceAlgorithmDescriptor;
59
+ aad_descriptor?: string;
60
+ }
61
+ interface CceEncryptedKey {
62
+ alg: CceKemAlgorithm;
63
+ axis_kid: string;
64
+ ciphertext: string;
65
+ ephemeral_pk?: string;
66
+ }
67
+ interface CceEncryptedPayload {
68
+ alg: CceAlgorithm;
69
+ iv: string;
70
+ ciphertext: string;
71
+ tag: string;
72
+ }
73
+ interface CceAlgorithmDescriptor {
74
+ kem: CceKemAlgorithm;
75
+ enc: CceAlgorithm;
76
+ kdf: CceKdfAlgorithm;
77
+ sig: "EdDSA" | "ES256";
78
+ }
79
+ interface CceResponseEnvelope {
80
+ ver: typeof CCE_PROTOCOL_VERSION;
81
+ response_id: string;
82
+ request_id: string;
83
+ correlation_id: string;
84
+ capsule_id: string;
85
+ encrypted_key: CceEncryptedKey;
86
+ encrypted_payload: CceEncryptedPayload;
87
+ response_nonce: string;
88
+ axis_sig: CceSignature;
89
+ witness_ref?: string;
90
+ algorithms: CceAlgorithmDescriptor;
91
+ status: CceResponseStatus;
92
+ }
93
+ type CceResponseStatus = "SUCCESS" | "DENIED" | "PARTIAL" | "FAILED" | "ERROR";
94
+ interface CceExecutionContext {
95
+ execution_key_hash: string;
96
+ request_id: string;
97
+ capsule_id: string;
98
+ sub: string;
99
+ kid: string;
100
+ intent: string;
101
+ aud: string;
102
+ tps_from: number;
103
+ tps_to: number;
104
+ policy_hash?: string;
105
+ derived_at: number;
106
+ valid: boolean;
107
+ }
108
+ interface CceWitnessRecord {
109
+ witness_id: string;
110
+ request_id: string;
111
+ capsule_id: string;
112
+ sub: string;
113
+ intent: string;
114
+ aud: string;
115
+ tps_from: number;
116
+ tps_to: number;
117
+ timestamp: number;
118
+ verification: {
119
+ client_sig: boolean;
120
+ capsule_sig: boolean;
121
+ tps_valid: boolean;
122
+ audience_match: boolean;
123
+ intent_match: boolean;
124
+ replay_clean: boolean;
125
+ nonce_unique: boolean;
126
+ decryption_ok: boolean;
127
+ };
128
+ execution: {
129
+ status: CceResponseStatus;
130
+ handler_duration_ms: number;
131
+ effect?: string;
132
+ };
133
+ response_encrypted: boolean;
134
+ execution_context_hash: string;
135
+ request_payload_hash?: string;
136
+ response_payload_hash?: string;
137
+ }
138
+ declare const CCE_ERROR: {
139
+ readonly INVALID_ENVELOPE: "CCE_INVALID_ENVELOPE";
140
+ readonly UNSUPPORTED_VERSION: "CCE_UNSUPPORTED_VERSION";
141
+ readonly MISSING_CAPSULE: "CCE_MISSING_CAPSULE";
142
+ readonly MISSING_ENCRYPTED_KEY: "CCE_MISSING_ENCRYPTED_KEY";
143
+ readonly CLIENT_SIG_INVALID: "CCE_CLIENT_SIG_INVALID";
144
+ readonly CLIENT_KEY_NOT_FOUND: "CCE_CLIENT_KEY_NOT_FOUND";
145
+ readonly CAPSULE_SIG_INVALID: "CCE_CAPSULE_SIG_INVALID";
146
+ readonly CAPSULE_EXPIRED: "CCE_CAPSULE_EXPIRED";
147
+ readonly CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID";
148
+ readonly CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED";
149
+ readonly CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED";
150
+ readonly AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH";
151
+ readonly INTENT_MISMATCH: "CCE_INTENT_MISMATCH";
152
+ readonly TPS_WINDOW_EXPIRED: "CCE_TPS_WINDOW_EXPIRED";
153
+ readonly TPS_WINDOW_FUTURE: "CCE_TPS_WINDOW_FUTURE";
154
+ readonly REPLAY_DETECTED: "CCE_REPLAY_DETECTED";
155
+ readonly NONCE_REUSED: "CCE_NONCE_REUSED";
156
+ readonly DECRYPTION_FAILED: "CCE_DECRYPTION_FAILED";
157
+ readonly KEY_UNWRAP_FAILED: "CCE_KEY_UNWRAP_FAILED";
158
+ readonly AEAD_TAG_MISMATCH: "CCE_AEAD_TAG_MISMATCH";
159
+ readonly PAYLOAD_TOO_LARGE: "CCE_PAYLOAD_TOO_LARGE";
160
+ readonly PAYLOAD_SCHEMA_INVALID: "CCE_PAYLOAD_SCHEMA_INVALID";
161
+ readonly INTENT_SCHEMA_MISMATCH: "CCE_INTENT_SCHEMA_MISMATCH";
162
+ readonly POLICY_DENIED: "CCE_POLICY_DENIED";
163
+ readonly CONSTRAINT_VIOLATED: "CCE_CONSTRAINT_VIOLATED";
164
+ readonly HANDLER_NOT_FOUND: "CCE_HANDLER_NOT_FOUND";
165
+ readonly HANDLER_EXECUTION_FAILED: "CCE_HANDLER_EXECUTION_FAILED";
166
+ readonly HANDLER_TIMEOUT: "CCE_HANDLER_TIMEOUT";
167
+ readonly RESPONSE_ENCRYPTION_FAILED: "CCE_RESPONSE_ENCRYPTION_FAILED";
168
+ };
169
+ type CceErrorCode = (typeof CCE_ERROR)[keyof typeof CCE_ERROR];
170
+ declare class CceError extends Error {
171
+ readonly code: CceErrorCode;
172
+ readonly metadata?: Record<string, unknown> | undefined;
173
+ constructor(code: CceErrorCode, message: string, metadata?: Record<string, unknown> | undefined);
174
+ get clientSafe(): boolean;
175
+ toClientError(): {
176
+ code: CceErrorCode;
177
+ message: string;
178
+ };
179
+ }
180
+
181
+ interface CceClientKeyEncryptor {
182
+ wrapKey(aesKey: Uint8Array, clientKid: string, clientPublicKeyHex: string): Promise<CceEncryptedKey>;
183
+ }
184
+ interface CceAxisSigner {
185
+ sign(payload: Uint8Array): Promise<CceSignature>;
186
+ }
187
+ interface CceResponseOptions {
188
+ request: CceRequestEnvelope;
189
+ capsule: CceCapsuleClaims;
190
+ status: CceResponseStatus;
191
+ body: Uint8Array;
192
+ clientPublicKeyHex: string;
193
+ witnessRef?: string;
194
+ }
195
+ declare function buildCceResponse(options: CceResponseOptions, clientKeyEncryptor: CceClientKeyEncryptor, axisSigner: CceAxisSigner): Promise<{
196
+ envelope: CceResponseEnvelope;
197
+ responsePayloadHash: string;
198
+ }>;
199
+ declare function buildCceErrorResponse(requestId: string, correlationId: string, status: CceResponseStatus, errorCode: string, message: string): {
200
+ ver: string;
201
+ request_id: string;
202
+ correlation_id: string;
203
+ status: CceResponseStatus;
204
+ error: {
205
+ code: string;
206
+ message: string;
207
+ };
208
+ };
209
+
210
+ interface CceWitnessStore {
211
+ record(witness: CceWitnessRecord): Promise<void>;
212
+ }
213
+ declare class InMemoryCceWitnessStore implements CceWitnessStore {
214
+ readonly records: CceWitnessRecord[];
215
+ record(witness: CceWitnessRecord): Promise<void>;
216
+ getByRequestId(requestId: string): CceWitnessRecord | undefined;
217
+ getByCapsuleId(capsuleId: string): CceWitnessRecord[];
218
+ }
219
+ interface CceVerificationState {
220
+ clientSigVerified: boolean;
221
+ capsuleSigVerified: boolean;
222
+ tpsValid: boolean;
223
+ audienceMatch: boolean;
224
+ intentMatch: boolean;
225
+ replayClean: boolean;
226
+ nonceUnique: boolean;
227
+ decryptionOk: boolean;
228
+ }
229
+ declare function buildWitnessRecord(envelope: CceRequestEnvelope, capsule: CceCapsuleClaims, verification: CceVerificationState, execution: {
230
+ status: CceResponseStatus;
231
+ handlerDurationMs: number;
232
+ effect?: string;
233
+ }, options: {
234
+ axisLocalSecret: string;
235
+ requestPayload?: Uint8Array;
236
+ responsePayload?: Uint8Array;
237
+ responseEncrypted: boolean;
238
+ }): CceWitnessRecord;
239
+ declare function extractVerificationState(metadata: Record<string, any>): CceVerificationState;
240
+
241
+ type CceHandler = (payload: Uint8Array, context: CceHandlerContext) => Promise<CceHandlerResult>;
242
+ interface CceHandlerContext {
243
+ capsule: CceCapsuleClaims;
244
+ executionContext: CceExecutionContext;
245
+ envelope: CceRequestEnvelope;
246
+ clientPublicKeyHex: string;
247
+ intent: string;
248
+ sub: string;
249
+ }
250
+ interface CceHandlerResult {
251
+ status: CceResponseStatus;
252
+ body: Uint8Array;
253
+ effect?: string;
254
+ }
255
+ interface CcePolicyContext {
256
+ envelope: CceRequestEnvelope;
257
+ capsule: CceCapsuleClaims;
258
+ executionContext: CceExecutionContext;
259
+ decryptedPayload: Uint8Array;
260
+ clientPublicKeyHex: string;
261
+ }
262
+ interface CcePolicyDecision {
263
+ allow: boolean;
264
+ code?: string;
265
+ message?: string;
266
+ }
267
+ interface CcePolicyEvaluator {
268
+ evaluate(context: CcePolicyContext): Promise<CcePolicyDecision>;
269
+ }
270
+ interface CcePipelineConfig {
271
+ axisLocalSecret: string;
272
+ axisAudience: string;
273
+ sensors: AxisSensor[];
274
+ handlers: Map<string, CceHandler>;
275
+ witnessStore: CceWitnessStore;
276
+ clientKeyEncryptor: CceClientKeyEncryptor;
277
+ axisSigner: CceAxisSigner;
278
+ policyEvaluator?: CcePolicyEvaluator;
279
+ }
280
+ type CcePipelineResult = {
281
+ ok: true;
282
+ response: CceResponseEnvelope;
283
+ witnessId: string;
284
+ } | {
285
+ ok: false;
286
+ error: {
287
+ code: string;
288
+ message: string;
289
+ };
290
+ status: CceResponseStatus;
291
+ };
292
+ declare function executeCcePipeline(envelope: CceRequestEnvelope, config: CcePipelineConfig): Promise<CcePipelineResult>;
293
+
294
+ export { type CcePolicyDecision as A, type CcePolicyEvaluator as B, type CceCapsuleClaims as C, type CceResponseEnvelope as D, type CceResponseOptions as E, type CceResponseStatus as F, type CceSignature as G, type CceVerificationState as H, type CceWitnessRecord as I, type CceWitnessStore as J, InMemoryCceWitnessStore as K, buildCceErrorResponse as L, buildCceResponse as M, buildWitnessRecord as N, executeCcePipeline as O, extractVerificationState as P, type CceExecutionContext as a, type CceRequestEnvelope as b, CCE_AES_KEY_BYTES as c, CCE_DERIVATION as d, CCE_ERROR as e, CCE_IV_BYTES as f, CCE_NONCE_BYTES as g, CCE_PROTOCOL_VERSION as h, CCE_TAG_BYTES as i, type CceAlgorithm as j, type CceAlgorithmDescriptor as k, type CceAxisSigner as l, type CceClientKeyEncryptor as m, type CceConstraints as n, type CceEncryptedKey as o, type CceEncryptedPayload as p, CceError as q, type CceErrorCode as r, type CceHandler as s, type CceHandlerContext as t, type CceHandlerResult as u, type CceKdfAlgorithm as v, type CceKemAlgorithm as w, type CcePipelineConfig as x, type CcePipelineResult as y, type CcePolicyContext as z };
@@ -0,0 +1,24 @@
1
+ import { h as IntentSchema, f as IntentProposal, b as CompilationResult, c as CompiledIntent } from '../idel.types-DuUAcOnQ.mjs';
2
+ export { A as AlternativeIntent, C as ClarificationQuestion, a as CompilationError, d as ConstraintKind, I as IntentConstraint, e as IntentParamSchema, g as IntentRisk, R as RiskLevel } from '../idel.types-DuUAcOnQ.mjs';
3
+
4
+ declare class IdelSchemaRegistry {
5
+ private schemas;
6
+ private aliases;
7
+ register(schema: IntentSchema): void;
8
+ registerAlias(alias: string, intent: string): void;
9
+ get(intent: string): IntentSchema | undefined;
10
+ resolve(raw: string): IntentSchema | undefined;
11
+ findCandidates(raw: string): Array<{
12
+ schema: IntentSchema;
13
+ score: number;
14
+ }>;
15
+ list(): IntentSchema[];
16
+ }
17
+ declare class IdelCompiler {
18
+ private readonly registry;
19
+ constructor(registry: IdelSchemaRegistry);
20
+ compile(proposal: IntentProposal): CompilationResult;
21
+ applyClarifications(compiled: CompiledIntent, answers: Record<string, unknown>): CompilationResult;
22
+ }
23
+
24
+ export { CompilationResult, CompiledIntent, IdelCompiler, IdelSchemaRegistry, IntentProposal, IntentSchema };
@@ -0,0 +1,24 @@
1
+ import { h as IntentSchema, f as IntentProposal, b as CompilationResult, c as CompiledIntent } from '../idel.types-DuUAcOnQ.js';
2
+ export { A as AlternativeIntent, C as ClarificationQuestion, a as CompilationError, d as ConstraintKind, I as IntentConstraint, e as IntentParamSchema, g as IntentRisk, R as RiskLevel } from '../idel.types-DuUAcOnQ.js';
3
+
4
+ declare class IdelSchemaRegistry {
5
+ private schemas;
6
+ private aliases;
7
+ register(schema: IntentSchema): void;
8
+ registerAlias(alias: string, intent: string): void;
9
+ get(intent: string): IntentSchema | undefined;
10
+ resolve(raw: string): IntentSchema | undefined;
11
+ findCandidates(raw: string): Array<{
12
+ schema: IntentSchema;
13
+ score: number;
14
+ }>;
15
+ list(): IntentSchema[];
16
+ }
17
+ declare class IdelCompiler {
18
+ private readonly registry;
19
+ constructor(registry: IdelSchemaRegistry);
20
+ compile(proposal: IntentProposal): CompilationResult;
21
+ applyClarifications(compiled: CompiledIntent, answers: Record<string, unknown>): CompilationResult;
22
+ }
23
+
24
+ export { CompilationResult, CompiledIntent, IdelCompiler, IdelSchemaRegistry, IntentProposal, IntentSchema };
@@ -0,0 +1,306 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/idel/index.ts
20
+ var idel_exports = {};
21
+ __export(idel_exports, {
22
+ IdelCompiler: () => IdelCompiler,
23
+ IdelSchemaRegistry: () => IdelSchemaRegistry
24
+ });
25
+ module.exports = __toCommonJS(idel_exports);
26
+
27
+ // src/idel/idel.compiler.ts
28
+ var IdelSchemaRegistry = class {
29
+ constructor() {
30
+ this.schemas = /* @__PURE__ */ new Map();
31
+ this.aliases = /* @__PURE__ */ new Map();
32
+ }
33
+ register(schema) {
34
+ this.schemas.set(schema.intent, schema);
35
+ }
36
+ registerAlias(alias, intent) {
37
+ this.aliases.set(alias.toLowerCase(), intent);
38
+ }
39
+ get(intent) {
40
+ return this.schemas.get(intent);
41
+ }
42
+ resolve(raw) {
43
+ const exact = this.schemas.get(raw);
44
+ if (exact) return exact;
45
+ const aliased = this.aliases.get(raw.toLowerCase());
46
+ if (aliased) return this.schemas.get(aliased);
47
+ const candidates = [...this.schemas.keys()].filter(
48
+ (k) => k.startsWith(raw + ".") || k.toLowerCase().includes(raw.toLowerCase())
49
+ );
50
+ if (candidates.length === 1) {
51
+ return this.schemas.get(candidates[0]);
52
+ }
53
+ return void 0;
54
+ }
55
+ /**
56
+ * Find all schemas that partially match the raw input.
57
+ * Returns scored candidates for ambiguity resolution.
58
+ */
59
+ findCandidates(raw) {
60
+ const normalized = raw.toLowerCase().trim();
61
+ const results = [];
62
+ for (const [key, schema] of this.schemas) {
63
+ let score = 0;
64
+ if (key === raw) {
65
+ score = 1;
66
+ } else if (key.toLowerCase() === normalized) {
67
+ score = 0.95;
68
+ } else if (this.aliases.get(normalized) === key) {
69
+ score = 0.9;
70
+ } else if (key.toLowerCase().startsWith(normalized)) {
71
+ score = 0.7;
72
+ } else if (key.toLowerCase().includes(normalized)) {
73
+ score = 0.5;
74
+ } else if (schema.tags?.some((t) => t.toLowerCase().includes(normalized))) {
75
+ score = 0.4;
76
+ } else if (schema.description.toLowerCase().includes(normalized)) {
77
+ score = 0.3;
78
+ }
79
+ if (score > 0) {
80
+ results.push({ schema, score });
81
+ }
82
+ }
83
+ return results.sort((a, b) => b.score - a.score);
84
+ }
85
+ list() {
86
+ return [...this.schemas.values()];
87
+ }
88
+ };
89
+ var IdelCompiler = class {
90
+ constructor(registry) {
91
+ this.registry = registry;
92
+ }
93
+ /**
94
+ * Compile a raw intent proposal into a validated, executable structure.
95
+ */
96
+ compile(proposal) {
97
+ const errors = [];
98
+ const candidates = this.registry.findCandidates(proposal.raw);
99
+ if (candidates.length === 0) {
100
+ return {
101
+ ok: false,
102
+ errors: [{
103
+ code: "IDEL_UNKNOWN_INTENT",
104
+ message: `No intent found matching '${proposal.raw}'`
105
+ }]
106
+ };
107
+ }
108
+ const best = candidates[0];
109
+ const schema = best.schema;
110
+ const alternatives = candidates.slice(1, 4).filter((c) => c.score >= 0.3).map((c) => ({
111
+ intent: c.schema.intent,
112
+ confidence: c.score,
113
+ reason: c.schema.description
114
+ }));
115
+ const constraints = [];
116
+ const clarifications = [];
117
+ const params = { ...proposal.params };
118
+ for (const paramSchema of schema.params) {
119
+ const value = params[paramSchema.name];
120
+ if (paramSchema.required && value === void 0) {
121
+ if (paramSchema.default !== void 0) {
122
+ params[paramSchema.name] = paramSchema.default;
123
+ constraints.push({
124
+ kind: "required_param",
125
+ field: paramSchema.name,
126
+ description: `Defaulted to ${JSON.stringify(paramSchema.default)}`,
127
+ satisfied: true,
128
+ value: paramSchema.default
129
+ });
130
+ } else {
131
+ constraints.push({
132
+ kind: "required_param",
133
+ field: paramSchema.name,
134
+ description: `Required parameter '${paramSchema.name}' is missing`,
135
+ satisfied: false
136
+ });
137
+ clarifications.push({
138
+ id: `clarify_${paramSchema.name}`,
139
+ question: paramSchema.description ?? `What is the ${paramSchema.name}?`,
140
+ field: paramSchema.name,
141
+ options: paramSchema.enum?.map(String),
142
+ required: true
143
+ });
144
+ }
145
+ continue;
146
+ }
147
+ if (value === void 0) continue;
148
+ const typeValid = validateType(value, paramSchema.type);
149
+ constraints.push({
150
+ kind: "type_check",
151
+ field: paramSchema.name,
152
+ description: `Must be ${paramSchema.type}`,
153
+ satisfied: typeValid,
154
+ value,
155
+ expected: paramSchema.type
156
+ });
157
+ if (!typeValid) {
158
+ errors.push({
159
+ code: "IDEL_TYPE_ERROR",
160
+ message: `Parameter '${paramSchema.name}' must be ${paramSchema.type}, got ${typeof value}`,
161
+ field: paramSchema.name
162
+ });
163
+ }
164
+ if (paramSchema.min !== void 0 || paramSchema.max !== void 0) {
165
+ const numVal = typeof value === "number" ? value : Number(value);
166
+ const inRange = (paramSchema.min === void 0 || numVal >= paramSchema.min) && (paramSchema.max === void 0 || numVal <= paramSchema.max);
167
+ constraints.push({
168
+ kind: "range",
169
+ field: paramSchema.name,
170
+ description: `Must be between ${paramSchema.min ?? "-\u221E"} and ${paramSchema.max ?? "\u221E"}`,
171
+ satisfied: inRange,
172
+ value: numVal
173
+ });
174
+ }
175
+ if (paramSchema.pattern) {
176
+ const matches = new RegExp(paramSchema.pattern).test(String(value));
177
+ constraints.push({
178
+ kind: "pattern",
179
+ field: paramSchema.name,
180
+ description: `Must match ${paramSchema.pattern}`,
181
+ satisfied: matches,
182
+ value,
183
+ expected: paramSchema.pattern
184
+ });
185
+ }
186
+ if (paramSchema.enum) {
187
+ const inEnum = paramSchema.enum.some(
188
+ (e) => JSON.stringify(e) === JSON.stringify(value)
189
+ );
190
+ constraints.push({
191
+ kind: "custom",
192
+ field: paramSchema.name,
193
+ description: `Must be one of: ${paramSchema.enum.join(", ")}`,
194
+ satisfied: inEnum,
195
+ value,
196
+ expected: paramSchema.enum
197
+ });
198
+ }
199
+ }
200
+ const risk = assessRisk(schema, proposal, constraints);
201
+ const unsatisfied = constraints.filter((c) => !c.satisfied);
202
+ const needsClarification = clarifications.length > 0;
203
+ let confidence = best.score;
204
+ if (unsatisfied.length > 0) {
205
+ confidence *= 1 - unsatisfied.length / Math.max(constraints.length, 1) * 0.5;
206
+ }
207
+ if (errors.length > 0) {
208
+ confidence *= 0.5;
209
+ }
210
+ const compiled = {
211
+ intent: schema.intent,
212
+ actor_id: proposal.actor_id,
213
+ target: proposal.target,
214
+ params,
215
+ constraints,
216
+ confidence,
217
+ alternatives,
218
+ needs_clarification: needsClarification,
219
+ clarifications,
220
+ expected_outcome: schema.description,
221
+ fallback: schema.related?.[0],
222
+ risk,
223
+ metadata: {
224
+ schema_intent: schema.intent,
225
+ resolved_from: proposal.raw,
226
+ has_side_effects: schema.has_side_effects,
227
+ reversible: schema.reversible
228
+ }
229
+ };
230
+ return {
231
+ ok: errors.length === 0 && !needsClarification,
232
+ compiled,
233
+ errors
234
+ };
235
+ }
236
+ /**
237
+ * Apply clarification answers and re-compile.
238
+ */
239
+ applyClarifications(compiled, answers) {
240
+ const proposal = {
241
+ raw: compiled.intent,
242
+ actor_id: compiled.actor_id,
243
+ target: compiled.target,
244
+ params: { ...compiled.params, ...answers }
245
+ };
246
+ return this.compile(proposal);
247
+ }
248
+ };
249
+ function validateType(value, expectedType) {
250
+ switch (expectedType) {
251
+ case "string":
252
+ return typeof value === "string";
253
+ case "number":
254
+ return typeof value === "number" && Number.isFinite(value);
255
+ case "boolean":
256
+ return typeof value === "boolean";
257
+ case "object":
258
+ return typeof value === "object" && value !== null && !Array.isArray(value);
259
+ case "array":
260
+ return Array.isArray(value);
261
+ default:
262
+ return true;
263
+ }
264
+ }
265
+ function assessRisk(schema, proposal, constraints) {
266
+ const factors = [];
267
+ let score = 0;
268
+ const baseRiskMap = {
269
+ none: 0,
270
+ low: 0.1,
271
+ medium: 0.3,
272
+ high: 0.6,
273
+ critical: 0.9
274
+ };
275
+ score = baseRiskMap[schema.risk_level] ?? 0;
276
+ if (schema.risk_level !== "none") {
277
+ factors.push(`Base risk: ${schema.risk_level}`);
278
+ }
279
+ if (schema.has_side_effects) {
280
+ score += 0.1;
281
+ factors.push("Has side effects");
282
+ }
283
+ if (!schema.reversible) {
284
+ score += 0.1;
285
+ factors.push("Not reversible");
286
+ }
287
+ const failed = constraints.filter((c) => !c.satisfied);
288
+ if (failed.length > 0) {
289
+ score += 0.05 * failed.length;
290
+ factors.push(`${failed.length} unsatisfied constraint(s)`);
291
+ }
292
+ score = Math.min(score, 1);
293
+ let level;
294
+ if (score <= 0) level = "none";
295
+ else if (score <= 0.2) level = "low";
296
+ else if (score <= 0.5) level = "medium";
297
+ else if (score <= 0.8) level = "high";
298
+ else level = "critical";
299
+ return { level, score, factors };
300
+ }
301
+ // Annotate the CommonJS export names for ESM import in node:
302
+ 0 && (module.exports = {
303
+ IdelCompiler,
304
+ IdelSchemaRegistry
305
+ });
306
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/idel/index.ts","../../src/idel/idel.compiler.ts"],"sourcesContent":["export * from './idel.types';\nexport * from './idel.compiler';\n","/**\n * IDEL Compiler — Intent Description & Execution Language\n *\n * Compiles raw intent proposals into validated, executable structures.\n *\n * Pipeline:\n * 1. Resolve: match raw input to a known intent schema\n * 2. Validate: check all required params and constraints\n * 3. Assess risk: evaluate intent risk level\n * 4. Generate clarifications: if ambiguous or incomplete\n * 5. Output: CompiledIntent ready for AXIS execution\n */\n\nimport type {\n AlternativeIntent,\n ClarificationQuestion,\n CompilationError,\n CompilationResult,\n CompiledIntent,\n IntentConstraint,\n IntentParamSchema,\n IntentProposal,\n IntentRisk,\n IntentSchema,\n RiskLevel,\n} from './idel.types';\n\n// ────────────────────────────────────────────────────────────────────────────\n// Schema Registry\n// ────────────────────────────────────────────────────────────────────────────\n\nexport class IdelSchemaRegistry {\n private schemas = new Map<string, IntentSchema>();\n private aliases = new Map<string, string>();\n\n register(schema: IntentSchema): void {\n this.schemas.set(schema.intent, schema);\n }\n\n registerAlias(alias: string, intent: string): void {\n this.aliases.set(alias.toLowerCase(), intent);\n }\n\n get(intent: string): IntentSchema | undefined {\n return this.schemas.get(intent);\n }\n\n resolve(raw: string): IntentSchema | undefined {\n // Exact match\n const exact = this.schemas.get(raw);\n if (exact) return exact;\n\n // Alias match\n const aliased = this.aliases.get(raw.toLowerCase());\n if (aliased) return this.schemas.get(aliased);\n\n // Prefix match (e.g., \"payment\" → \"payment.create\")\n const candidates = [...this.schemas.keys()].filter(\n (k) => k.startsWith(raw + '.') || k.toLowerCase().includes(raw.toLowerCase()),\n );\n if (candidates.length === 1) {\n return this.schemas.get(candidates[0]);\n }\n\n return undefined;\n }\n\n /**\n * Find all schemas that partially match the raw input.\n * Returns scored candidates for ambiguity resolution.\n */\n findCandidates(raw: string): Array<{ schema: IntentSchema; score: number }> {\n const normalized = raw.toLowerCase().trim();\n const results: Array<{ schema: IntentSchema; score: number }> = [];\n\n for (const [key, schema] of this.schemas) {\n let score = 0;\n\n // Exact match\n if (key === raw) {\n score = 1.0;\n }\n // Case-insensitive exact\n else if (key.toLowerCase() === normalized) {\n score = 0.95;\n }\n // Alias match\n else if (this.aliases.get(normalized) === key) {\n score = 0.9;\n }\n // Prefix match\n else if (key.toLowerCase().startsWith(normalized)) {\n score = 0.7;\n }\n // Contains match\n else if (key.toLowerCase().includes(normalized)) {\n score = 0.5;\n }\n // Tag match\n else if (schema.tags?.some((t) => t.toLowerCase().includes(normalized))) {\n score = 0.4;\n }\n // Description match\n else if (schema.description.toLowerCase().includes(normalized)) {\n score = 0.3;\n }\n\n if (score > 0) {\n results.push({ schema, score });\n }\n }\n\n return results.sort((a, b) => b.score - a.score);\n }\n\n list(): IntentSchema[] {\n return [...this.schemas.values()];\n }\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// IDEL Compiler\n// ────────────────────────────────────────────────────────────────────────────\n\nexport class IdelCompiler {\n constructor(private readonly registry: IdelSchemaRegistry) {}\n\n /**\n * Compile a raw intent proposal into a validated, executable structure.\n */\n compile(proposal: IntentProposal): CompilationResult {\n const errors: CompilationError[] = [];\n\n // 1. Resolve intent\n const candidates = this.registry.findCandidates(proposal.raw);\n if (candidates.length === 0) {\n return {\n ok: false,\n errors: [{\n code: 'IDEL_UNKNOWN_INTENT',\n message: `No intent found matching '${proposal.raw}'`,\n }],\n };\n }\n\n const best = candidates[0];\n const schema = best.schema;\n\n // 2. Build alternatives\n const alternatives: AlternativeIntent[] = candidates\n .slice(1, 4)\n .filter((c) => c.score >= 0.3)\n .map((c) => ({\n intent: c.schema.intent,\n confidence: c.score,\n reason: c.schema.description,\n }));\n\n // 3. Validate parameters\n const constraints: IntentConstraint[] = [];\n const clarifications: ClarificationQuestion[] = [];\n const params = { ...proposal.params };\n\n for (const paramSchema of schema.params) {\n const value = params[paramSchema.name];\n\n // Required check\n if (paramSchema.required && value === undefined) {\n if (paramSchema.default !== undefined) {\n params[paramSchema.name] = paramSchema.default;\n constraints.push({\n kind: 'required_param',\n field: paramSchema.name,\n description: `Defaulted to ${JSON.stringify(paramSchema.default)}`,\n satisfied: true,\n value: paramSchema.default,\n });\n } else {\n constraints.push({\n kind: 'required_param',\n field: paramSchema.name,\n description: `Required parameter '${paramSchema.name}' is missing`,\n satisfied: false,\n });\n clarifications.push({\n id: `clarify_${paramSchema.name}`,\n question: paramSchema.description ?? `What is the ${paramSchema.name}?`,\n field: paramSchema.name,\n options: paramSchema.enum?.map(String),\n required: true,\n });\n }\n continue;\n }\n\n if (value === undefined) continue;\n\n // Type check\n const typeValid = validateType(value, paramSchema.type);\n constraints.push({\n kind: 'type_check',\n field: paramSchema.name,\n description: `Must be ${paramSchema.type}`,\n satisfied: typeValid,\n value,\n expected: paramSchema.type,\n });\n if (!typeValid) {\n errors.push({\n code: 'IDEL_TYPE_ERROR',\n message: `Parameter '${paramSchema.name}' must be ${paramSchema.type}, got ${typeof value}`,\n field: paramSchema.name,\n });\n }\n\n // Range check\n if (paramSchema.min !== undefined || paramSchema.max !== undefined) {\n const numVal = typeof value === 'number' ? value : Number(value);\n const inRange =\n (paramSchema.min === undefined || numVal >= paramSchema.min) &&\n (paramSchema.max === undefined || numVal <= paramSchema.max);\n constraints.push({\n kind: 'range',\n field: paramSchema.name,\n description: `Must be between ${paramSchema.min ?? '-∞'} and ${paramSchema.max ?? '∞'}`,\n satisfied: inRange,\n value: numVal,\n });\n }\n\n // Pattern check\n if (paramSchema.pattern) {\n const matches = new RegExp(paramSchema.pattern).test(String(value));\n constraints.push({\n kind: 'pattern',\n field: paramSchema.name,\n description: `Must match ${paramSchema.pattern}`,\n satisfied: matches,\n value,\n expected: paramSchema.pattern,\n });\n }\n\n // Enum check\n if (paramSchema.enum) {\n const inEnum = paramSchema.enum.some(\n (e) => JSON.stringify(e) === JSON.stringify(value),\n );\n constraints.push({\n kind: 'custom',\n field: paramSchema.name,\n description: `Must be one of: ${paramSchema.enum.join(', ')}`,\n satisfied: inEnum,\n value,\n expected: paramSchema.enum,\n });\n }\n }\n\n // 4. Assess risk\n const risk = assessRisk(schema, proposal, constraints);\n\n // 5. Compute confidence\n const unsatisfied = constraints.filter((c) => !c.satisfied);\n const needsClarification = clarifications.length > 0;\n let confidence = best.score;\n if (unsatisfied.length > 0) {\n confidence *= 1 - (unsatisfied.length / Math.max(constraints.length, 1)) * 0.5;\n }\n if (errors.length > 0) {\n confidence *= 0.5;\n }\n\n const compiled: CompiledIntent = {\n intent: schema.intent,\n actor_id: proposal.actor_id,\n target: proposal.target,\n params,\n constraints,\n confidence,\n alternatives,\n needs_clarification: needsClarification,\n clarifications,\n expected_outcome: schema.description,\n fallback: schema.related?.[0],\n risk,\n metadata: {\n schema_intent: schema.intent,\n resolved_from: proposal.raw,\n has_side_effects: schema.has_side_effects,\n reversible: schema.reversible,\n },\n };\n\n return {\n ok: errors.length === 0 && !needsClarification,\n compiled,\n errors,\n };\n }\n\n /**\n * Apply clarification answers and re-compile.\n */\n applyClarifications(\n compiled: CompiledIntent,\n answers: Record<string, unknown>,\n ): CompilationResult {\n const proposal: IntentProposal = {\n raw: compiled.intent,\n actor_id: compiled.actor_id,\n target: compiled.target,\n params: { ...compiled.params, ...answers },\n };\n return this.compile(proposal);\n }\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// Helpers\n// ────────────────────────────────────────────────────────────────────────────\n\nfunction validateType(value: unknown, expectedType: IntentParamSchema['type']): boolean {\n switch (expectedType) {\n case 'string':\n return typeof value === 'string';\n case 'number':\n return typeof value === 'number' && Number.isFinite(value);\n case 'boolean':\n return typeof value === 'boolean';\n case 'object':\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n case 'array':\n return Array.isArray(value);\n default:\n return true;\n }\n}\n\nfunction assessRisk(\n schema: IntentSchema,\n proposal: IntentProposal,\n constraints: IntentConstraint[],\n): IntentRisk {\n const factors: string[] = [];\n let score = 0;\n\n // Base risk from schema\n const baseRiskMap: Record<RiskLevel, number> = {\n none: 0,\n low: 0.1,\n medium: 0.3,\n high: 0.6,\n critical: 0.9,\n };\n score = baseRiskMap[schema.risk_level] ?? 0;\n if (schema.risk_level !== 'none') {\n factors.push(`Base risk: ${schema.risk_level}`);\n }\n\n // Side effects increase risk\n if (schema.has_side_effects) {\n score += 0.1;\n factors.push('Has side effects');\n }\n\n // Irreversible actions increase risk\n if (!schema.reversible) {\n score += 0.1;\n factors.push('Not reversible');\n }\n\n // Failed constraints increase risk\n const failed = constraints.filter((c) => !c.satisfied);\n if (failed.length > 0) {\n score += 0.05 * failed.length;\n factors.push(`${failed.length} unsatisfied constraint(s)`);\n }\n\n // Clamp\n score = Math.min(score, 1.0);\n\n let level: RiskLevel;\n if (score <= 0) level = 'none';\n else if (score <= 0.2) level = 'low';\n else if (score <= 0.5) level = 'medium';\n else if (score <= 0.8) level = 'high';\n else level = 'critical';\n\n return { level, score, factors };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC+BO,IAAM,qBAAN,MAAyB;AAAA,EAAzB;AACL,SAAQ,UAAU,oBAAI,IAA0B;AAChD,SAAQ,UAAU,oBAAI,IAAoB;AAAA;AAAA,EAE1C,SAAS,QAA4B;AACnC,SAAK,QAAQ,IAAI,OAAO,QAAQ,MAAM;AAAA,EACxC;AAAA,EAEA,cAAc,OAAe,QAAsB;AACjD,SAAK,QAAQ,IAAI,MAAM,YAAY,GAAG,MAAM;AAAA,EAC9C;AAAA,EAEA,IAAI,QAA0C;AAC5C,WAAO,KAAK,QAAQ,IAAI,MAAM;AAAA,EAChC;AAAA,EAEA,QAAQ,KAAuC;AAE7C,UAAM,QAAQ,KAAK,QAAQ,IAAI,GAAG;AAClC,QAAI,MAAO,QAAO;AAGl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