@nextera.one/axis-server-sdk 2.2.1 → 2.2.2
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/axis-sensor-GBEI3Fab.d.mts +209 -0
- package/dist/axis-sensor-GBEI3Fab.d.ts +209 -0
- package/dist/cce/index.d.mts +162 -0
- package/dist/cce/index.d.ts +162 -0
- package/dist/cce/index.js +1502 -0
- package/dist/cce/index.js.map +1 -0
- package/dist/cce/index.mjs +1442 -0
- package/dist/cce/index.mjs.map +1 -0
- package/dist/cce-pipeline-B-zUBHo3.d.mts +294 -0
- package/dist/cce-pipeline-DbGBSsCG.d.ts +294 -0
- package/dist/idel/index.d.mts +24 -0
- package/dist/idel/index.d.ts +24 -0
- package/dist/idel/index.js +306 -0
- package/dist/idel/index.js.map +1 -0
- package/dist/idel/index.mjs +279 -0
- package/dist/idel/index.mjs.map +1 -0
- package/dist/idel.types-DuUAcOnQ.d.mts +83 -0
- package/dist/idel.types-DuUAcOnQ.d.ts +83 -0
- package/dist/index-B2G6cbRL.d.mts +824 -0
- package/dist/index-DbSxdR0f.d.ts +824 -0
- package/dist/index-_S4fmVUJ.d.mts +501 -0
- package/dist/index-l3Hhirqb.d.ts +501 -0
- package/dist/index.d.mts +91 -1891
- package/dist/index.d.ts +91 -1891
- package/dist/index.js +9339 -5123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10326 -5816
- package/dist/index.mjs.map +1 -1
- package/dist/needle/index.d.mts +4 -0
- package/dist/needle/index.d.ts +4 -0
- package/dist/needle/index.js +3499 -0
- package/dist/needle/index.js.map +1 -0
- package/dist/needle/index.mjs +3528 -0
- package/dist/needle/index.mjs.map +1 -0
- package/dist/sensors/index.d.mts +5 -0
- package/dist/sensors/index.d.ts +5 -0
- package/dist/sensors/index.js +12860 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/index.mjs +12928 -0
- package/dist/sensors/index.mjs.map +1 -0
- package/dist/timeline/index.d.mts +54 -0
- package/dist/timeline/index.d.ts +54 -0
- package/dist/timeline/index.js +389 -0
- package/dist/timeline/index.js.map +1 -0
- package/dist/timeline/index.mjs +362 -0
- package/dist/timeline/index.mjs.map +1 -0
- package/dist/timeline.types-Cn0aqbUj.d.mts +125 -0
- package/dist/timeline.types-Cn0aqbUj.d.ts +125 -0
- package/package.json +28 -10
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// src/idel/idel.compiler.ts
|
|
2
|
+
var IdelSchemaRegistry = class {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.schemas = /* @__PURE__ */ new Map();
|
|
5
|
+
this.aliases = /* @__PURE__ */ new Map();
|
|
6
|
+
}
|
|
7
|
+
register(schema) {
|
|
8
|
+
this.schemas.set(schema.intent, schema);
|
|
9
|
+
}
|
|
10
|
+
registerAlias(alias, intent) {
|
|
11
|
+
this.aliases.set(alias.toLowerCase(), intent);
|
|
12
|
+
}
|
|
13
|
+
get(intent) {
|
|
14
|
+
return this.schemas.get(intent);
|
|
15
|
+
}
|
|
16
|
+
resolve(raw) {
|
|
17
|
+
const exact = this.schemas.get(raw);
|
|
18
|
+
if (exact) return exact;
|
|
19
|
+
const aliased = this.aliases.get(raw.toLowerCase());
|
|
20
|
+
if (aliased) return this.schemas.get(aliased);
|
|
21
|
+
const candidates = [...this.schemas.keys()].filter(
|
|
22
|
+
(k) => k.startsWith(raw + ".") || k.toLowerCase().includes(raw.toLowerCase())
|
|
23
|
+
);
|
|
24
|
+
if (candidates.length === 1) {
|
|
25
|
+
return this.schemas.get(candidates[0]);
|
|
26
|
+
}
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Find all schemas that partially match the raw input.
|
|
31
|
+
* Returns scored candidates for ambiguity resolution.
|
|
32
|
+
*/
|
|
33
|
+
findCandidates(raw) {
|
|
34
|
+
const normalized = raw.toLowerCase().trim();
|
|
35
|
+
const results = [];
|
|
36
|
+
for (const [key, schema] of this.schemas) {
|
|
37
|
+
let score = 0;
|
|
38
|
+
if (key === raw) {
|
|
39
|
+
score = 1;
|
|
40
|
+
} else if (key.toLowerCase() === normalized) {
|
|
41
|
+
score = 0.95;
|
|
42
|
+
} else if (this.aliases.get(normalized) === key) {
|
|
43
|
+
score = 0.9;
|
|
44
|
+
} else if (key.toLowerCase().startsWith(normalized)) {
|
|
45
|
+
score = 0.7;
|
|
46
|
+
} else if (key.toLowerCase().includes(normalized)) {
|
|
47
|
+
score = 0.5;
|
|
48
|
+
} else if (schema.tags?.some((t) => t.toLowerCase().includes(normalized))) {
|
|
49
|
+
score = 0.4;
|
|
50
|
+
} else if (schema.description.toLowerCase().includes(normalized)) {
|
|
51
|
+
score = 0.3;
|
|
52
|
+
}
|
|
53
|
+
if (score > 0) {
|
|
54
|
+
results.push({ schema, score });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return results.sort((a, b) => b.score - a.score);
|
|
58
|
+
}
|
|
59
|
+
list() {
|
|
60
|
+
return [...this.schemas.values()];
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var IdelCompiler = class {
|
|
64
|
+
constructor(registry) {
|
|
65
|
+
this.registry = registry;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Compile a raw intent proposal into a validated, executable structure.
|
|
69
|
+
*/
|
|
70
|
+
compile(proposal) {
|
|
71
|
+
const errors = [];
|
|
72
|
+
const candidates = this.registry.findCandidates(proposal.raw);
|
|
73
|
+
if (candidates.length === 0) {
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
errors: [{
|
|
77
|
+
code: "IDEL_UNKNOWN_INTENT",
|
|
78
|
+
message: `No intent found matching '${proposal.raw}'`
|
|
79
|
+
}]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const best = candidates[0];
|
|
83
|
+
const schema = best.schema;
|
|
84
|
+
const alternatives = candidates.slice(1, 4).filter((c) => c.score >= 0.3).map((c) => ({
|
|
85
|
+
intent: c.schema.intent,
|
|
86
|
+
confidence: c.score,
|
|
87
|
+
reason: c.schema.description
|
|
88
|
+
}));
|
|
89
|
+
const constraints = [];
|
|
90
|
+
const clarifications = [];
|
|
91
|
+
const params = { ...proposal.params };
|
|
92
|
+
for (const paramSchema of schema.params) {
|
|
93
|
+
const value = params[paramSchema.name];
|
|
94
|
+
if (paramSchema.required && value === void 0) {
|
|
95
|
+
if (paramSchema.default !== void 0) {
|
|
96
|
+
params[paramSchema.name] = paramSchema.default;
|
|
97
|
+
constraints.push({
|
|
98
|
+
kind: "required_param",
|
|
99
|
+
field: paramSchema.name,
|
|
100
|
+
description: `Defaulted to ${JSON.stringify(paramSchema.default)}`,
|
|
101
|
+
satisfied: true,
|
|
102
|
+
value: paramSchema.default
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
constraints.push({
|
|
106
|
+
kind: "required_param",
|
|
107
|
+
field: paramSchema.name,
|
|
108
|
+
description: `Required parameter '${paramSchema.name}' is missing`,
|
|
109
|
+
satisfied: false
|
|
110
|
+
});
|
|
111
|
+
clarifications.push({
|
|
112
|
+
id: `clarify_${paramSchema.name}`,
|
|
113
|
+
question: paramSchema.description ?? `What is the ${paramSchema.name}?`,
|
|
114
|
+
field: paramSchema.name,
|
|
115
|
+
options: paramSchema.enum?.map(String),
|
|
116
|
+
required: true
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (value === void 0) continue;
|
|
122
|
+
const typeValid = validateType(value, paramSchema.type);
|
|
123
|
+
constraints.push({
|
|
124
|
+
kind: "type_check",
|
|
125
|
+
field: paramSchema.name,
|
|
126
|
+
description: `Must be ${paramSchema.type}`,
|
|
127
|
+
satisfied: typeValid,
|
|
128
|
+
value,
|
|
129
|
+
expected: paramSchema.type
|
|
130
|
+
});
|
|
131
|
+
if (!typeValid) {
|
|
132
|
+
errors.push({
|
|
133
|
+
code: "IDEL_TYPE_ERROR",
|
|
134
|
+
message: `Parameter '${paramSchema.name}' must be ${paramSchema.type}, got ${typeof value}`,
|
|
135
|
+
field: paramSchema.name
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (paramSchema.min !== void 0 || paramSchema.max !== void 0) {
|
|
139
|
+
const numVal = typeof value === "number" ? value : Number(value);
|
|
140
|
+
const inRange = (paramSchema.min === void 0 || numVal >= paramSchema.min) && (paramSchema.max === void 0 || numVal <= paramSchema.max);
|
|
141
|
+
constraints.push({
|
|
142
|
+
kind: "range",
|
|
143
|
+
field: paramSchema.name,
|
|
144
|
+
description: `Must be between ${paramSchema.min ?? "-\u221E"} and ${paramSchema.max ?? "\u221E"}`,
|
|
145
|
+
satisfied: inRange,
|
|
146
|
+
value: numVal
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (paramSchema.pattern) {
|
|
150
|
+
const matches = new RegExp(paramSchema.pattern).test(String(value));
|
|
151
|
+
constraints.push({
|
|
152
|
+
kind: "pattern",
|
|
153
|
+
field: paramSchema.name,
|
|
154
|
+
description: `Must match ${paramSchema.pattern}`,
|
|
155
|
+
satisfied: matches,
|
|
156
|
+
value,
|
|
157
|
+
expected: paramSchema.pattern
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (paramSchema.enum) {
|
|
161
|
+
const inEnum = paramSchema.enum.some(
|
|
162
|
+
(e) => JSON.stringify(e) === JSON.stringify(value)
|
|
163
|
+
);
|
|
164
|
+
constraints.push({
|
|
165
|
+
kind: "custom",
|
|
166
|
+
field: paramSchema.name,
|
|
167
|
+
description: `Must be one of: ${paramSchema.enum.join(", ")}`,
|
|
168
|
+
satisfied: inEnum,
|
|
169
|
+
value,
|
|
170
|
+
expected: paramSchema.enum
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
const risk = assessRisk(schema, proposal, constraints);
|
|
175
|
+
const unsatisfied = constraints.filter((c) => !c.satisfied);
|
|
176
|
+
const needsClarification = clarifications.length > 0;
|
|
177
|
+
let confidence = best.score;
|
|
178
|
+
if (unsatisfied.length > 0) {
|
|
179
|
+
confidence *= 1 - unsatisfied.length / Math.max(constraints.length, 1) * 0.5;
|
|
180
|
+
}
|
|
181
|
+
if (errors.length > 0) {
|
|
182
|
+
confidence *= 0.5;
|
|
183
|
+
}
|
|
184
|
+
const compiled = {
|
|
185
|
+
intent: schema.intent,
|
|
186
|
+
actor_id: proposal.actor_id,
|
|
187
|
+
target: proposal.target,
|
|
188
|
+
params,
|
|
189
|
+
constraints,
|
|
190
|
+
confidence,
|
|
191
|
+
alternatives,
|
|
192
|
+
needs_clarification: needsClarification,
|
|
193
|
+
clarifications,
|
|
194
|
+
expected_outcome: schema.description,
|
|
195
|
+
fallback: schema.related?.[0],
|
|
196
|
+
risk,
|
|
197
|
+
metadata: {
|
|
198
|
+
schema_intent: schema.intent,
|
|
199
|
+
resolved_from: proposal.raw,
|
|
200
|
+
has_side_effects: schema.has_side_effects,
|
|
201
|
+
reversible: schema.reversible
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
ok: errors.length === 0 && !needsClarification,
|
|
206
|
+
compiled,
|
|
207
|
+
errors
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Apply clarification answers and re-compile.
|
|
212
|
+
*/
|
|
213
|
+
applyClarifications(compiled, answers) {
|
|
214
|
+
const proposal = {
|
|
215
|
+
raw: compiled.intent,
|
|
216
|
+
actor_id: compiled.actor_id,
|
|
217
|
+
target: compiled.target,
|
|
218
|
+
params: { ...compiled.params, ...answers }
|
|
219
|
+
};
|
|
220
|
+
return this.compile(proposal);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
function validateType(value, expectedType) {
|
|
224
|
+
switch (expectedType) {
|
|
225
|
+
case "string":
|
|
226
|
+
return typeof value === "string";
|
|
227
|
+
case "number":
|
|
228
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
229
|
+
case "boolean":
|
|
230
|
+
return typeof value === "boolean";
|
|
231
|
+
case "object":
|
|
232
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
233
|
+
case "array":
|
|
234
|
+
return Array.isArray(value);
|
|
235
|
+
default:
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function assessRisk(schema, proposal, constraints) {
|
|
240
|
+
const factors = [];
|
|
241
|
+
let score = 0;
|
|
242
|
+
const baseRiskMap = {
|
|
243
|
+
none: 0,
|
|
244
|
+
low: 0.1,
|
|
245
|
+
medium: 0.3,
|
|
246
|
+
high: 0.6,
|
|
247
|
+
critical: 0.9
|
|
248
|
+
};
|
|
249
|
+
score = baseRiskMap[schema.risk_level] ?? 0;
|
|
250
|
+
if (schema.risk_level !== "none") {
|
|
251
|
+
factors.push(`Base risk: ${schema.risk_level}`);
|
|
252
|
+
}
|
|
253
|
+
if (schema.has_side_effects) {
|
|
254
|
+
score += 0.1;
|
|
255
|
+
factors.push("Has side effects");
|
|
256
|
+
}
|
|
257
|
+
if (!schema.reversible) {
|
|
258
|
+
score += 0.1;
|
|
259
|
+
factors.push("Not reversible");
|
|
260
|
+
}
|
|
261
|
+
const failed = constraints.filter((c) => !c.satisfied);
|
|
262
|
+
if (failed.length > 0) {
|
|
263
|
+
score += 0.05 * failed.length;
|
|
264
|
+
factors.push(`${failed.length} unsatisfied constraint(s)`);
|
|
265
|
+
}
|
|
266
|
+
score = Math.min(score, 1);
|
|
267
|
+
let level;
|
|
268
|
+
if (score <= 0) level = "none";
|
|
269
|
+
else if (score <= 0.2) level = "low";
|
|
270
|
+
else if (score <= 0.5) level = "medium";
|
|
271
|
+
else if (score <= 0.8) level = "high";
|
|
272
|
+
else level = "critical";
|
|
273
|
+
return { level, score, factors };
|
|
274
|
+
}
|
|
275
|
+
export {
|
|
276
|
+
IdelCompiler,
|
|
277
|
+
IdelSchemaRegistry
|
|
278
|
+
};
|
|
279
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/idel/idel.compiler.ts"],"sourcesContent":["/**\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":";AA+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;AAGlB,UAAM,UAAU,KAAK,QAAQ,IAAI,IAAI,YAAY,CAAC;AAClD,QAAI,QAAS,QAAO,KAAK,QAAQ,IAAI,OAAO;AAG5C,UAAM,aAAa,CAAC,GAAG,KAAK,QAAQ,KAAK,CAAC,EAAE;AAAA,MAC1C,CAAC,MAAM,EAAE,WAAW,MAAM,GAAG,KAAK,EAAE,YAAY,EAAE,SAAS,IAAI,YAAY,CAAC;AAAA,IAC9E;A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;AAAA,WACtB,SAAS,IAAK,SAAQ;AAAA,MAC1B,SAAQ;AAEb,SAAO,EAAE,OAAO,OAAO,QAAQ;AACjC;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
interface IntentProposal {
|
|
2
|
+
raw: string;
|
|
3
|
+
actor_id: string;
|
|
4
|
+
target?: string;
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
interface CompiledIntent {
|
|
9
|
+
intent: string;
|
|
10
|
+
actor_id: string;
|
|
11
|
+
target?: string;
|
|
12
|
+
params: Record<string, unknown>;
|
|
13
|
+
constraints: IntentConstraint[];
|
|
14
|
+
confidence: number;
|
|
15
|
+
alternatives: AlternativeIntent[];
|
|
16
|
+
needs_clarification: boolean;
|
|
17
|
+
clarifications: ClarificationQuestion[];
|
|
18
|
+
expected_outcome?: string;
|
|
19
|
+
fallback?: string;
|
|
20
|
+
risk: IntentRisk;
|
|
21
|
+
metadata: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
type ConstraintKind = 'required_param' | 'type_check' | 'range' | 'pattern' | 'temporal' | 'spatial' | 'authority' | 'safety' | 'custom';
|
|
24
|
+
interface IntentConstraint {
|
|
25
|
+
kind: ConstraintKind;
|
|
26
|
+
field: string;
|
|
27
|
+
description: string;
|
|
28
|
+
satisfied: boolean;
|
|
29
|
+
value?: unknown;
|
|
30
|
+
expected?: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface AlternativeIntent {
|
|
33
|
+
intent: string;
|
|
34
|
+
confidence: number;
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
interface ClarificationQuestion {
|
|
38
|
+
id: string;
|
|
39
|
+
question: string;
|
|
40
|
+
field: string;
|
|
41
|
+
options?: string[];
|
|
42
|
+
required: boolean;
|
|
43
|
+
}
|
|
44
|
+
type RiskLevel = 'none' | 'low' | 'medium' | 'high' | 'critical';
|
|
45
|
+
interface IntentRisk {
|
|
46
|
+
level: RiskLevel;
|
|
47
|
+
score: number;
|
|
48
|
+
factors: string[];
|
|
49
|
+
}
|
|
50
|
+
interface IntentParamSchema {
|
|
51
|
+
name: string;
|
|
52
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
53
|
+
required: boolean;
|
|
54
|
+
description?: string;
|
|
55
|
+
default?: unknown;
|
|
56
|
+
pattern?: string;
|
|
57
|
+
min?: number;
|
|
58
|
+
max?: number;
|
|
59
|
+
enum?: unknown[];
|
|
60
|
+
}
|
|
61
|
+
interface IntentSchema {
|
|
62
|
+
intent: string;
|
|
63
|
+
description: string;
|
|
64
|
+
params: IntentParamSchema[];
|
|
65
|
+
required_scopes?: string[];
|
|
66
|
+
risk_level: RiskLevel;
|
|
67
|
+
has_side_effects: boolean;
|
|
68
|
+
reversible: boolean;
|
|
69
|
+
related?: string[];
|
|
70
|
+
tags?: string[];
|
|
71
|
+
}
|
|
72
|
+
interface CompilationResult {
|
|
73
|
+
ok: boolean;
|
|
74
|
+
compiled?: CompiledIntent;
|
|
75
|
+
errors: CompilationError[];
|
|
76
|
+
}
|
|
77
|
+
interface CompilationError {
|
|
78
|
+
code: string;
|
|
79
|
+
message: string;
|
|
80
|
+
field?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type { AlternativeIntent as A, ClarificationQuestion as C, IntentConstraint as I, RiskLevel as R, CompilationError as a, CompilationResult as b, CompiledIntent as c, ConstraintKind as d, IntentParamSchema as e, IntentProposal as f, IntentRisk as g, IntentSchema as h };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
interface IntentProposal {
|
|
2
|
+
raw: string;
|
|
3
|
+
actor_id: string;
|
|
4
|
+
target?: string;
|
|
5
|
+
params?: Record<string, unknown>;
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
interface CompiledIntent {
|
|
9
|
+
intent: string;
|
|
10
|
+
actor_id: string;
|
|
11
|
+
target?: string;
|
|
12
|
+
params: Record<string, unknown>;
|
|
13
|
+
constraints: IntentConstraint[];
|
|
14
|
+
confidence: number;
|
|
15
|
+
alternatives: AlternativeIntent[];
|
|
16
|
+
needs_clarification: boolean;
|
|
17
|
+
clarifications: ClarificationQuestion[];
|
|
18
|
+
expected_outcome?: string;
|
|
19
|
+
fallback?: string;
|
|
20
|
+
risk: IntentRisk;
|
|
21
|
+
metadata: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
type ConstraintKind = 'required_param' | 'type_check' | 'range' | 'pattern' | 'temporal' | 'spatial' | 'authority' | 'safety' | 'custom';
|
|
24
|
+
interface IntentConstraint {
|
|
25
|
+
kind: ConstraintKind;
|
|
26
|
+
field: string;
|
|
27
|
+
description: string;
|
|
28
|
+
satisfied: boolean;
|
|
29
|
+
value?: unknown;
|
|
30
|
+
expected?: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface AlternativeIntent {
|
|
33
|
+
intent: string;
|
|
34
|
+
confidence: number;
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
interface ClarificationQuestion {
|
|
38
|
+
id: string;
|
|
39
|
+
question: string;
|
|
40
|
+
field: string;
|
|
41
|
+
options?: string[];
|
|
42
|
+
required: boolean;
|
|
43
|
+
}
|
|
44
|
+
type RiskLevel = 'none' | 'low' | 'medium' | 'high' | 'critical';
|
|
45
|
+
interface IntentRisk {
|
|
46
|
+
level: RiskLevel;
|
|
47
|
+
score: number;
|
|
48
|
+
factors: string[];
|
|
49
|
+
}
|
|
50
|
+
interface IntentParamSchema {
|
|
51
|
+
name: string;
|
|
52
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
|
53
|
+
required: boolean;
|
|
54
|
+
description?: string;
|
|
55
|
+
default?: unknown;
|
|
56
|
+
pattern?: string;
|
|
57
|
+
min?: number;
|
|
58
|
+
max?: number;
|
|
59
|
+
enum?: unknown[];
|
|
60
|
+
}
|
|
61
|
+
interface IntentSchema {
|
|
62
|
+
intent: string;
|
|
63
|
+
description: string;
|
|
64
|
+
params: IntentParamSchema[];
|
|
65
|
+
required_scopes?: string[];
|
|
66
|
+
risk_level: RiskLevel;
|
|
67
|
+
has_side_effects: boolean;
|
|
68
|
+
reversible: boolean;
|
|
69
|
+
related?: string[];
|
|
70
|
+
tags?: string[];
|
|
71
|
+
}
|
|
72
|
+
interface CompilationResult {
|
|
73
|
+
ok: boolean;
|
|
74
|
+
compiled?: CompiledIntent;
|
|
75
|
+
errors: CompilationError[];
|
|
76
|
+
}
|
|
77
|
+
interface CompilationError {
|
|
78
|
+
code: string;
|
|
79
|
+
message: string;
|
|
80
|
+
field?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export type { AlternativeIntent as A, ClarificationQuestion as C, IntentConstraint as I, RiskLevel as R, CompilationError as a, CompilationResult as b, CompiledIntent as c, ConstraintKind as d, IntentParamSchema as e, IntentProposal as f, IntentRisk as g, IntentSchema as h };
|