@mcpmesh/sdk 2.8.2 → 3.0.1
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/__tests__/agent-add-tool.spec.js +106 -0
- package/dist/__tests__/agent-add-tool.spec.js.map +1 -1
- package/dist/__tests__/api-runtime-apply-idempotency.spec.d.ts +2 -0
- package/dist/__tests__/api-runtime-apply-idempotency.spec.d.ts.map +1 -0
- package/dist/__tests__/api-runtime-apply-idempotency.spec.js +89 -0
- package/dist/__tests__/api-runtime-apply-idempotency.spec.js.map +1 -0
- package/dist/__tests__/claim-dispatcher-resume-cursor.test.d.ts +2 -0
- package/dist/__tests__/claim-dispatcher-resume-cursor.test.d.ts.map +1 -0
- package/dist/__tests__/claim-dispatcher-resume-cursor.test.js +145 -0
- package/dist/__tests__/claim-dispatcher-resume-cursor.test.js.map +1 -0
- package/dist/__tests__/dependency-apply-idempotency.spec.d.ts +2 -0
- package/dist/__tests__/dependency-apply-idempotency.spec.d.ts.map +1 -0
- package/dist/__tests__/dependency-apply-idempotency.spec.js +114 -0
- package/dist/__tests__/dependency-apply-idempotency.spec.js.map +1 -0
- package/dist/__tests__/service-view-types.spec.d.ts +2 -0
- package/dist/__tests__/service-view-types.spec.d.ts.map +1 -0
- package/dist/__tests__/service-view-types.spec.js +66 -0
- package/dist/__tests__/service-view-types.spec.js.map +1 -0
- package/dist/__tests__/service-view.spec.d.ts +2 -0
- package/dist/__tests__/service-view.spec.d.ts.map +1 -0
- package/dist/__tests__/service-view.spec.js +902 -0
- package/dist/__tests__/service-view.spec.js.map +1 -0
- package/dist/__tests__/superseded-signal.spec.d.ts +19 -0
- package/dist/__tests__/superseded-signal.spec.d.ts.map +1 -0
- package/dist/__tests__/superseded-signal.spec.js +222 -0
- package/dist/__tests__/superseded-signal.spec.js.map +1 -0
- package/dist/__tests__/worker-error-serde.spec.d.ts +2 -0
- package/dist/__tests__/worker-error-serde.spec.d.ts.map +1 -0
- package/dist/__tests__/worker-error-serde.spec.js +122 -0
- package/dist/__tests__/worker-error-serde.spec.js.map +1 -0
- package/dist/a2a/producer/mount.d.ts.map +1 -1
- package/dist/a2a/producer/mount.js +4 -0
- package/dist/a2a/producer/mount.js.map +1 -1
- package/dist/agent.d.ts +53 -3
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +406 -33
- package/dist/agent.js.map +1 -1
- package/dist/api-runtime.d.ts +9 -0
- package/dist/api-runtime.d.ts.map +1 -1
- package/dist/api-runtime.js +29 -0
- package/dist/api-runtime.js.map +1 -1
- package/dist/claim-dispatcher.d.ts +25 -1
- package/dist/claim-dispatcher.d.ts.map +1 -1
- package/dist/claim-dispatcher.js +51 -2
- package/dist/claim-dispatcher.js.map +1 -1
- package/dist/inbound-job-dispatch.d.ts +1 -1
- package/dist/inbound-job-dispatch.d.ts.map +1 -1
- package/dist/inbound-job-dispatch.js +8 -2
- package/dist/inbound-job-dispatch.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/llm-provider.d.ts +14 -16
- package/dist/llm-provider.d.ts.map +1 -1
- package/dist/llm-provider.js +2 -4
- package/dist/llm-provider.js.map +1 -1
- package/dist/llm.d.ts +1 -2
- package/dist/llm.d.ts.map +1 -1
- package/dist/llm.js +1 -2
- package/dist/llm.js.map +1 -1
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +37 -0
- package/dist/proxy.js.map +1 -1
- package/dist/route.d.ts.map +1 -1
- package/dist/route.js +5 -0
- package/dist/route.js.map +1 -1
- package/dist/service-view.d.ts +245 -0
- package/dist/service-view.d.ts.map +1 -0
- package/dist/service-view.js +210 -0
- package/dist/service-view.js.map +1 -0
- package/dist/settle.d.ts +22 -0
- package/dist/settle.d.ts.map +1 -1
- package/dist/settle.js +51 -22
- package/dist/settle.js.map +1 -1
- package/dist/superseded.d.ts +70 -0
- package/dist/superseded.d.ts.map +1 -0
- package/dist/superseded.js +99 -0
- package/dist/superseded.js.map +1 -0
- package/dist/tool-worker-entry.js +1 -12
- package/dist/tool-worker-entry.js.map +1 -1
- package/dist/tool-worker-pool.d.ts.map +1 -1
- package/dist/tool-worker-pool.js +1 -12
- package/dist/tool-worker-pool.js.map +1 -1
- package/dist/types.d.ts +31 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/worker-error-serde.d.ts +40 -0
- package/dist/worker-error-serde.d.ts.map +1 -0
- package/dist/worker-error-serde.js +86 -0
- package/dist/worker-error-serde.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict-mode COMPILE test for the documented service-view consumer idiom
|
|
3
|
+
* (RFC #1280). The failure mode this guards against: "docs show code that
|
|
4
|
+
* doesn't compile." The project's `tsc --noEmit` (strict) type-checks this file,
|
|
5
|
+
* so if the documented idiom in service-view.ts's `MeshServiceFacade` JSDoc ever
|
|
6
|
+
* stops compiling, the build breaks here.
|
|
7
|
+
*
|
|
8
|
+
* The idiom functions below are never INVOKED (they'd construct a real
|
|
9
|
+
* MeshAgent); they exist purely so the compiler checks their bodies. Vitest runs
|
|
10
|
+
* the trivial assertion so this counts as a spec.
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, expect } from "vitest";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
import { mesh } from "../index.js";
|
|
15
|
+
// ── The canonical documented idiom, verbatim: un-annotated params + a cast on
|
|
16
|
+
// the view slot at point of use. Must compile under strictFunctionTypes. ──────
|
|
17
|
+
function _documentedConsumerIdiom() {
|
|
18
|
+
const server = {};
|
|
19
|
+
const agent = mesh(server, { name: "example", httpPort: 0 });
|
|
20
|
+
const Media = mesh.serviceView({
|
|
21
|
+
methods: {
|
|
22
|
+
caption: { capability: "media.caption", required: true, tags: ["+fast"] },
|
|
23
|
+
thumbnail: "media.thumbnail",
|
|
24
|
+
},
|
|
25
|
+
minAvailable: 1,
|
|
26
|
+
});
|
|
27
|
+
agent.addTool({
|
|
28
|
+
name: "process",
|
|
29
|
+
parameters: z.object({ text: z.string() }),
|
|
30
|
+
dependencies: ["audit_log", Media],
|
|
31
|
+
execute: async (args, auditLog, media) => {
|
|
32
|
+
const svc = media;
|
|
33
|
+
// Both spec method keys are typed on the facade, callable with the
|
|
34
|
+
// McpMeshTool signature (args?, options?) => Promise<unknown>.
|
|
35
|
+
const cap = await svc.caption({ text: args.text });
|
|
36
|
+
await svc.thumbnail();
|
|
37
|
+
// Ordinary McpMeshTool deps are consumed with the same cast idiom.
|
|
38
|
+
const audit = auditLog;
|
|
39
|
+
if (audit)
|
|
40
|
+
await audit({ event: "captioned" });
|
|
41
|
+
return cap;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// ── Producer sugar idiom, verbatim. ──────────────────────────────────────────
|
|
46
|
+
function _documentedProducerIdiom() {
|
|
47
|
+
const server = {};
|
|
48
|
+
const agent = mesh(server, { name: "producer", httpPort: 0 });
|
|
49
|
+
agent.addService("media", {
|
|
50
|
+
caption: async (args) => ({ caption: args.text }),
|
|
51
|
+
thumbnail: {
|
|
52
|
+
execute: async (args) => ({ url: args.assetId }),
|
|
53
|
+
tags: ["fast"],
|
|
54
|
+
description: "thumbnail",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const _facadeMethodIsCallable = async () => undefined;
|
|
59
|
+
describe("service-view documented idiom compiles under strict", () => {
|
|
60
|
+
it("type-checks the consumer + producer idioms (compile-only)", () => {
|
|
61
|
+
expect(typeof _documentedConsumerIdiom).toBe("function");
|
|
62
|
+
expect(typeof _documentedProducerIdiom).toBe("function");
|
|
63
|
+
expect(typeof _facadeMethodIsCallable).toBe("function");
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=service-view-types.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-view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