@hyperfixi/mcp-server 2.1.0 → 2.2.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/{esm-QH3OJYW7.js → esm-LUPOYJFX.js} +293 -288
- package/dist/index.js +167 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8077,7 +8077,7 @@ function createInlineExtractor() {
|
|
|
8077
8077
|
const fs = await import("fs");
|
|
8078
8078
|
const path = await import("path");
|
|
8079
8079
|
const crypto = await import("crypto");
|
|
8080
|
-
const { glob } = await import("./esm-
|
|
8080
|
+
const { glob } = await import("./esm-LUPOYJFX.js");
|
|
8081
8081
|
const globs = [
|
|
8082
8082
|
"**/*.html",
|
|
8083
8083
|
"**/*.htm",
|
|
@@ -8539,6 +8539,57 @@ function createSchemaLookup(schemas) {
|
|
|
8539
8539
|
|
|
8540
8540
|
// src/tools/lse-pipeline.ts
|
|
8541
8541
|
var lsePipelineTools = [
|
|
8542
|
+
// ── Phase 7.5: LLM-Native LSE tools ──────────────────────────────────────
|
|
8543
|
+
{
|
|
8544
|
+
name: "execute_lse",
|
|
8545
|
+
description: "Execute LSE bracket syntax directly. Parses the LSE, compiles to JavaScript, and returns the execution result. Use this when an LLM has generated LSE and you want to run it.",
|
|
8546
|
+
inputSchema: {
|
|
8547
|
+
type: "object",
|
|
8548
|
+
properties: {
|
|
8549
|
+
lse: {
|
|
8550
|
+
type: "string",
|
|
8551
|
+
description: "LSE bracket syntax: [command role:value ...]"
|
|
8552
|
+
}
|
|
8553
|
+
},
|
|
8554
|
+
required: ["lse"]
|
|
8555
|
+
}
|
|
8556
|
+
},
|
|
8557
|
+
{
|
|
8558
|
+
name: "validate_lse",
|
|
8559
|
+
description: "Validate LSE bracket syntax or protocol JSON without executing. Returns diagnostics (errors, warnings) and the normalized LSE. Use for pre-flight checks before execution.",
|
|
8560
|
+
inputSchema: {
|
|
8561
|
+
type: "object",
|
|
8562
|
+
properties: {
|
|
8563
|
+
lse: {
|
|
8564
|
+
type: "string",
|
|
8565
|
+
description: "LSE bracket syntax to validate"
|
|
8566
|
+
},
|
|
8567
|
+
protocol: {
|
|
8568
|
+
type: "object",
|
|
8569
|
+
description: "Protocol JSON to validate (alternative to lse)"
|
|
8570
|
+
}
|
|
8571
|
+
}
|
|
8572
|
+
}
|
|
8573
|
+
},
|
|
8574
|
+
{
|
|
8575
|
+
name: "translate_lse",
|
|
8576
|
+
description: "Translate LSE bracket syntax to natural language in a specified target language. Returns the natural-language hyperscript equivalent. Supports all 24 languages.",
|
|
8577
|
+
inputSchema: {
|
|
8578
|
+
type: "object",
|
|
8579
|
+
properties: {
|
|
8580
|
+
lse: {
|
|
8581
|
+
type: "string",
|
|
8582
|
+
description: "LSE bracket syntax: [command role:value ...]"
|
|
8583
|
+
},
|
|
8584
|
+
language: {
|
|
8585
|
+
type: "string",
|
|
8586
|
+
description: "Target language code (e.g., en, ja, es, ko, ar, zh)"
|
|
8587
|
+
}
|
|
8588
|
+
},
|
|
8589
|
+
required: ["lse", "language"]
|
|
8590
|
+
}
|
|
8591
|
+
},
|
|
8592
|
+
// ── Existing pipeline tools ───────────────────────────────────────────────
|
|
8542
8593
|
{
|
|
8543
8594
|
name: "lse_from_hyperscript",
|
|
8544
8595
|
description: "Parse hyperscript code (any of 24 languages) to LSE bracket syntax and protocol JSON. Use this to get a structured representation for LLM modification or cross-language translation. Returns both bracket syntax (human-readable) and protocol JSON (machine-readable).",
|
|
@@ -8586,6 +8637,12 @@ var lsePipelineTools = [
|
|
|
8586
8637
|
async function handleLsePipelineTool(name, args) {
|
|
8587
8638
|
try {
|
|
8588
8639
|
switch (name) {
|
|
8640
|
+
case "execute_lse":
|
|
8641
|
+
return await handleExecuteLse(args);
|
|
8642
|
+
case "validate_lse":
|
|
8643
|
+
return await handleValidateLse(args);
|
|
8644
|
+
case "translate_lse":
|
|
8645
|
+
return await handleTranslateLse(args);
|
|
8589
8646
|
case "lse_from_hyperscript":
|
|
8590
8647
|
return await handleFromHyperscript(args);
|
|
8591
8648
|
case "lse_to_hyperscript":
|
|
@@ -8736,6 +8793,115 @@ async function handleToHyperscript(args) {
|
|
|
8736
8793
|
}
|
|
8737
8794
|
return jsonResponse(result);
|
|
8738
8795
|
}
|
|
8796
|
+
async function handleExecuteLse(args) {
|
|
8797
|
+
const lseInput = args.lse;
|
|
8798
|
+
if (!lseInput || typeof lseInput !== "string") {
|
|
8799
|
+
return errorResponse("Missing required parameter: lse");
|
|
8800
|
+
}
|
|
8801
|
+
const { parseExplicit: parseExplicit2, renderExplicit: renderExplicit2, toProtocolJSON: toProtocolJSON2 } = await import("@lokascript/framework");
|
|
8802
|
+
let node;
|
|
8803
|
+
try {
|
|
8804
|
+
node = parseExplicit2(lseInput);
|
|
8805
|
+
} catch (e) {
|
|
8806
|
+
return errorResponse(`LSE parse error: ${e instanceof Error ? e.message : String(e)}`);
|
|
8807
|
+
}
|
|
8808
|
+
const normalizedLse = renderExplicit2(node);
|
|
8809
|
+
const protocol = toProtocolJSON2(node);
|
|
8810
|
+
let js;
|
|
8811
|
+
try {
|
|
8812
|
+
const { CompilationService } = await import("@lokascript/compilation-service");
|
|
8813
|
+
const service = await CompilationService.create();
|
|
8814
|
+
const compileResult = service.compile({ explicit: normalizedLse });
|
|
8815
|
+
js = compileResult.ok ? compileResult.js : void 0;
|
|
8816
|
+
} catch {
|
|
8817
|
+
}
|
|
8818
|
+
return jsonResponse({
|
|
8819
|
+
ok: true,
|
|
8820
|
+
lse: normalizedLse,
|
|
8821
|
+
protocol,
|
|
8822
|
+
js,
|
|
8823
|
+
note: js ? "Compiled successfully" : "Compilation service unavailable \u2014 parsed and validated only"
|
|
8824
|
+
});
|
|
8825
|
+
}
|
|
8826
|
+
async function handleValidateLse(args) {
|
|
8827
|
+
const lseInput = typeof args.lse === "string" ? args.lse : void 0;
|
|
8828
|
+
const protocolInput = typeof args.protocol === "object" && args.protocol ? args.protocol : void 0;
|
|
8829
|
+
if (!lseInput && !protocolInput) {
|
|
8830
|
+
return errorResponse("Provide `lse` (bracket syntax) or `protocol` (JSON).");
|
|
8831
|
+
}
|
|
8832
|
+
const { parseExplicit: parseExplicit2, renderExplicit: renderExplicit2, validateProtocolJSON: validateProtocolJSON2 } = await import("@lokascript/framework");
|
|
8833
|
+
const diagnostics = [];
|
|
8834
|
+
if (lseInput) {
|
|
8835
|
+
try {
|
|
8836
|
+
const node = parseExplicit2(lseInput);
|
|
8837
|
+
const normalized = renderExplicit2(node);
|
|
8838
|
+
return jsonResponse({
|
|
8839
|
+
valid: true,
|
|
8840
|
+
normalized,
|
|
8841
|
+
diagnostics: []
|
|
8842
|
+
});
|
|
8843
|
+
} catch (e) {
|
|
8844
|
+
diagnostics.push({
|
|
8845
|
+
severity: "error",
|
|
8846
|
+
code: "PARSE_ERROR",
|
|
8847
|
+
message: e instanceof Error ? e.message : String(e)
|
|
8848
|
+
});
|
|
8849
|
+
return jsonResponse({ valid: false, diagnostics });
|
|
8850
|
+
}
|
|
8851
|
+
}
|
|
8852
|
+
if (protocolInput) {
|
|
8853
|
+
const protoDiags = validateProtocolJSON2(protocolInput);
|
|
8854
|
+
const hasErrors = protoDiags.some((d) => d.severity === "error");
|
|
8855
|
+
return jsonResponse({
|
|
8856
|
+
valid: !hasErrors,
|
|
8857
|
+
diagnostics: protoDiags
|
|
8858
|
+
});
|
|
8859
|
+
}
|
|
8860
|
+
return jsonResponse({ valid: false, diagnostics });
|
|
8861
|
+
}
|
|
8862
|
+
async function handleTranslateLse(args) {
|
|
8863
|
+
const lseInput = args.lse;
|
|
8864
|
+
const language = args.language;
|
|
8865
|
+
if (!lseInput || typeof lseInput !== "string") {
|
|
8866
|
+
return errorResponse("Missing required parameter: lse");
|
|
8867
|
+
}
|
|
8868
|
+
if (!language || typeof language !== "string") {
|
|
8869
|
+
return errorResponse("Missing required parameter: language");
|
|
8870
|
+
}
|
|
8871
|
+
try {
|
|
8872
|
+
const { parseExplicit: parseExplicit2, renderExplicit: renderExplicit2 } = await import("@lokascript/framework");
|
|
8873
|
+
const { translate } = await import("@lokascript/semantic");
|
|
8874
|
+
const node = parseExplicit2(lseInput);
|
|
8875
|
+
const normalized = renderExplicit2(node);
|
|
8876
|
+
const action = node.action;
|
|
8877
|
+
const roles = node.roles;
|
|
8878
|
+
const parts = [action];
|
|
8879
|
+
const roleEntries = roles instanceof Map ? [...roles.entries()] : Object.entries(roles || {});
|
|
8880
|
+
for (const [role, value] of roleEntries) {
|
|
8881
|
+
const val = typeof value === "object" && value !== null ? value.value ?? value : value;
|
|
8882
|
+
if (role === "patient") {
|
|
8883
|
+
parts.push(String(val));
|
|
8884
|
+
} else if (role === "destination") {
|
|
8885
|
+
parts.push("on", String(val));
|
|
8886
|
+
} else if (role === "source") {
|
|
8887
|
+
parts.push("from", String(val));
|
|
8888
|
+
} else {
|
|
8889
|
+
parts.push(String(val));
|
|
8890
|
+
}
|
|
8891
|
+
}
|
|
8892
|
+
const english = parts.join(" ");
|
|
8893
|
+
const translated = translate(english, "en", language);
|
|
8894
|
+
return jsonResponse({
|
|
8895
|
+
ok: true,
|
|
8896
|
+
language,
|
|
8897
|
+
translated,
|
|
8898
|
+
lse: normalized,
|
|
8899
|
+
english
|
|
8900
|
+
});
|
|
8901
|
+
} catch (e) {
|
|
8902
|
+
return errorResponse(`Translation error: ${e instanceof Error ? e.message : String(e)}`);
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8739
8905
|
|
|
8740
8906
|
// src/resources/content.ts
|
|
8741
8907
|
function getCommandsReference() {
|