@lssm/lib.contracts 1.42.9 → 1.42.10
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/registry.d.ts +1 -0
- package/dist/registry.js +3 -0
- package/dist/server/mcp/createMcpServer.js +1 -2
- package/dist/server/mcp/mcpTypes.d.ts +0 -3
- package/dist/server/mcp/registerPresentations.d.ts +1 -1
- package/dist/server/mcp/registerPresentations.js +12 -61
- package/dist/workspace-config/contractsrc-schema.d.ts +2 -2
- package/package.json +5 -5
package/dist/registry.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare abstract class SpecContractRegistry<ContractType extends ContractSpecTyp
|
|
|
13
13
|
private items;
|
|
14
14
|
protected constructor(contractType: ContractType, items?: SpecContract[]);
|
|
15
15
|
register(p: SpecContract): this;
|
|
16
|
+
count(): number;
|
|
16
17
|
list(): SpecContract[];
|
|
17
18
|
get(key: string, version?: number): SpecContract | undefined;
|
|
18
19
|
/** Filter presentations by criteria. */
|
package/dist/registry.js
CHANGED
|
@@ -17,8 +17,7 @@ function createMcpServer(server, ops, resources, prompts, ctxFactories) {
|
|
|
17
17
|
});
|
|
18
18
|
registerMcpPresentations(server, {
|
|
19
19
|
logger: ctxFactories.logger,
|
|
20
|
-
presentations: ctxFactories.presentations
|
|
21
|
-
presentationsV2: ctxFactories.presentationsV2
|
|
20
|
+
presentations: ctxFactories.presentations
|
|
22
21
|
});
|
|
23
22
|
registerMcpPrompts(server, prompts, { promptCtx: ctxFactories.promptCtx });
|
|
24
23
|
return server;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { PresentationSpec } from "../../presentations/presentations.js";
|
|
2
1
|
import { HandlerCtx } from "../../types.js";
|
|
3
2
|
import { PresentationRegistry } from "../../presentations/registry.js";
|
|
4
3
|
import "../../presentations/index.js";
|
|
@@ -23,8 +22,6 @@ interface McpCtxFactories {
|
|
|
23
22
|
};
|
|
24
23
|
/** Optional registry for presentations */
|
|
25
24
|
presentations?: PresentationRegistry;
|
|
26
|
-
/** Optional list of presentation specs */
|
|
27
|
-
presentationsV2?: PresentationSpec[];
|
|
28
25
|
}
|
|
29
26
|
//#endregion
|
|
30
27
|
export { McpCtxFactories };
|
|
@@ -2,6 +2,6 @@ import { McpCtxFactories } from "./mcpTypes.js";
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
|
|
4
4
|
//#region src/server/mcp/registerPresentations.d.ts
|
|
5
|
-
declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations'
|
|
5
|
+
declare function registerMcpPresentations(server: McpServer, ctx: Pick<McpCtxFactories, 'logger' | 'presentations'>): void;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { registerMcpPresentations };
|
|
@@ -7,25 +7,24 @@ function isEngineRenderOutput(x) {
|
|
|
7
7
|
return "body" in x && typeof x.body === "string";
|
|
8
8
|
}
|
|
9
9
|
function registerMcpPresentations(server, ctx) {
|
|
10
|
-
|
|
11
|
-
const __presentationsV2 = ctx.presentationsV2;
|
|
10
|
+
if (!ctx.presentations?.count()) return;
|
|
12
11
|
const engine = registerBasicValidation(registerDefaultReactRenderer(createDefaultTransformEngine()));
|
|
13
|
-
|
|
14
|
-
const baseKey = `presentation.${
|
|
15
|
-
const baseUri = `presentation://${
|
|
12
|
+
for (const presentationSpec of ctx.presentations.list()) {
|
|
13
|
+
const baseKey = `presentation.${presentationSpec.meta.key.replace(/\./g, "_")}.v${presentationSpec.meta.version}`;
|
|
14
|
+
const baseUri = `presentation://${presentationSpec.meta.key}/v${presentationSpec.meta.version}`;
|
|
16
15
|
ctx.logger.info(`Registering presentation ${baseUri} for ${baseKey}`);
|
|
17
16
|
server.registerResource(baseKey, baseUri, {
|
|
18
|
-
title: `${
|
|
19
|
-
description:
|
|
17
|
+
title: `${presentationSpec.meta.key} v${presentationSpec.meta.version}`,
|
|
18
|
+
description: presentationSpec.meta.description ?? "Presentation",
|
|
20
19
|
mimeType: "application/json"
|
|
21
20
|
}, async () => {
|
|
22
21
|
return { contents: [{
|
|
23
22
|
uri: baseUri,
|
|
24
23
|
mimeType: "application/json",
|
|
25
24
|
text: JSON.stringify({
|
|
26
|
-
meta:
|
|
27
|
-
source:
|
|
28
|
-
targets:
|
|
25
|
+
meta: presentationSpec.meta,
|
|
26
|
+
source: presentationSpec.source,
|
|
27
|
+
targets: presentationSpec.targets
|
|
29
28
|
}, null, 2)
|
|
30
29
|
}] };
|
|
31
30
|
});
|
|
@@ -46,58 +45,10 @@ function registerMcpPresentations(server, ctx) {
|
|
|
46
45
|
const key = `${baseKey}${v.ext}`;
|
|
47
46
|
const uri = `${baseUri}${v.ext}`;
|
|
48
47
|
server.registerResource(key, uri, {
|
|
49
|
-
title: `${
|
|
50
|
-
description: `${
|
|
48
|
+
title: `${presentationSpec.meta.key} v${presentationSpec.meta.version} (${v.ext})`,
|
|
49
|
+
description: `${presentationSpec.meta.description ?? "Presentation"} (${v.ext})`
|
|
51
50
|
}, async () => {
|
|
52
|
-
const out = await engine.render(v.target,
|
|
53
|
-
return { contents: [{
|
|
54
|
-
uri,
|
|
55
|
-
mimeType: isEngineRenderOutput(out) && out.mimeType ? out.mimeType : v.target === "markdown" ? "text/markdown" : v.target,
|
|
56
|
-
text: isEngineRenderOutput(out) && typeof out.body === "string" ? out.body : String(out)
|
|
57
|
-
}] };
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (__presentationsV2 && __presentationsV2.length) for (const d of __presentationsV2) {
|
|
62
|
-
const baseKey = `presentation.${d.meta.key.replace(/\./g, "_")}.v${d.meta.version}`;
|
|
63
|
-
const baseUri = `presentation://${d.meta.key}/v${d.meta.version}`;
|
|
64
|
-
ctx.logger.info(`Registering presentation descriptor ${baseUri} for ${baseKey}`);
|
|
65
|
-
server.registerResource(baseKey, baseUri, {
|
|
66
|
-
title: `${d.meta.key} v${d.meta.version}`,
|
|
67
|
-
description: d.meta.description ?? "Presentation",
|
|
68
|
-
mimeType: "application/json"
|
|
69
|
-
}, async () => {
|
|
70
|
-
return { contents: [{
|
|
71
|
-
uri: baseUri,
|
|
72
|
-
mimeType: "application/json",
|
|
73
|
-
text: JSON.stringify({
|
|
74
|
-
meta: d.meta,
|
|
75
|
-
source: d.source,
|
|
76
|
-
targets: d.targets
|
|
77
|
-
}, null, 2)
|
|
78
|
-
}] };
|
|
79
|
-
});
|
|
80
|
-
for (const v of [
|
|
81
|
-
{
|
|
82
|
-
ext: ".md",
|
|
83
|
-
target: "markdown"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
ext: ".json",
|
|
87
|
-
target: "application/json"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
ext: ".xml",
|
|
91
|
-
target: "application/xml"
|
|
92
|
-
}
|
|
93
|
-
]) {
|
|
94
|
-
const key = `${baseKey}${v.ext}`;
|
|
95
|
-
const uri = `${baseUri}${v.ext}`;
|
|
96
|
-
server.registerResource(key, uri, {
|
|
97
|
-
title: `${d.meta.key} v${d.meta.version} (${v.ext})`,
|
|
98
|
-
description: `${d.meta.description ?? "Presentation"} (${v.ext})`
|
|
99
|
-
}, async () => {
|
|
100
|
-
const out = await engine.render(v.target, d);
|
|
51
|
+
const out = await engine.render(v.target, presentationSpec);
|
|
101
52
|
return { contents: [{
|
|
102
53
|
uri,
|
|
103
54
|
mimeType: isEngineRenderOutput(out) && out.mimeType ? out.mimeType : v.target === "markdown" ? "text/markdown" : v.target,
|
|
@@ -486,9 +486,9 @@ declare const ContractsrcSchema: z$1.ZodObject<{
|
|
|
486
486
|
}>>;
|
|
487
487
|
aiModel: z$1.ZodOptional<z$1.ZodString>;
|
|
488
488
|
agentMode: z$1.ZodDefault<z$1.ZodEnum<{
|
|
489
|
-
simple: "simple";
|
|
490
|
-
cursor: "cursor";
|
|
491
489
|
"claude-code": "claude-code";
|
|
490
|
+
cursor: "cursor";
|
|
491
|
+
simple: "simple";
|
|
492
492
|
"openai-codex": "openai-codex";
|
|
493
493
|
}>>;
|
|
494
494
|
customEndpoint: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodURL>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/lib.contracts",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.10",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
6
6
|
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"test": "bun run"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@lssm/tool.tsdown": "1.42.
|
|
20
|
-
"@lssm/tool.typescript": "1.42.
|
|
19
|
+
"@lssm/tool.tsdown": "1.42.10",
|
|
20
|
+
"@lssm/tool.typescript": "1.42.10",
|
|
21
21
|
"@types/express": "^5.0.3",
|
|
22
22
|
"@types/turndown": "^5.0.6",
|
|
23
23
|
"tsdown": "^0.18.3",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@elevenlabs/elevenlabs-js": "^2.27.0",
|
|
36
36
|
"@google-cloud/secret-manager": "^6.1.1",
|
|
37
37
|
"@google-cloud/storage": "^7.18.0",
|
|
38
|
-
"@lssm/lib.logger": "1.42.
|
|
39
|
-
"@lssm/lib.schema": "1.42.
|
|
38
|
+
"@lssm/lib.logger": "1.42.10",
|
|
39
|
+
"@lssm/lib.schema": "1.42.10",
|
|
40
40
|
"@mistralai/mistralai": "^1.11.0",
|
|
41
41
|
"@modelcontextprotocol/sdk": "^1.24.3",
|
|
42
42
|
"@qdrant/js-client-rest": "^1.16.2",
|