@mcpmesh/sdk 2.8.1 → 3.0.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/__tests__/agent-add-tool.spec.js +106 -0
- package/dist/__tests__/agent-add-tool.spec.js.map +1 -1
- 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__/direct-invoke-required.spec.d.ts +2 -0
- package/dist/__tests__/direct-invoke-required.spec.d.ts.map +1 -0
- package/dist/__tests__/direct-invoke-required.spec.js +209 -0
- package/dist/__tests__/direct-invoke-required.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 +51 -3
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +435 -33
- package/dist/agent.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
package/dist/agent.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { FastMCP } from "fastmcp";
|
|
|
12
12
|
import type { z } from "zod";
|
|
13
13
|
import { type JsAgentHandle } from "@mcpmesh/core";
|
|
14
14
|
import type { AgentConfig, ResolvedAgentConfig, MeshToolDef, McpMeshTool, LlmProviderConfig } from "./types.js";
|
|
15
|
+
import { type ServiceProducerMethod } from "./service-view.js";
|
|
15
16
|
/**
|
|
16
17
|
* Globally-set symbol that user agent code can check to detect whether it
|
|
17
18
|
* is running inside a mesh tool-isolation worker. The mesh runtime sets
|
|
@@ -150,6 +151,34 @@ export declare class MeshAgent {
|
|
|
150
151
|
* they will be injected positionally at runtime.
|
|
151
152
|
*/
|
|
152
153
|
addTool<T extends z.ZodType>(def: MeshToolDef<T>): this;
|
|
154
|
+
/**
|
|
155
|
+
* RFC #1280 producer sugar: publish each entry of `methods` as an ordinary
|
|
156
|
+
* mesh tool with capability `prefix.<method>`, routed through the SAME
|
|
157
|
+
* `addTool` machinery (schemas, heartbeat, DI, duplicate handling all fall
|
|
158
|
+
* out). Entries are registered NAME-SORTED for deterministic registration.
|
|
159
|
+
*
|
|
160
|
+
* Each entry is either a bare execute function (shorthand) or an object
|
|
161
|
+
* `{ execute, parameters?, tags?, version?, description?, dependencies?, ... }`
|
|
162
|
+
* carrying any `addTool` passthrough (but NOT `name`/`capability` — those are
|
|
163
|
+
* derived). A method with no `parameters` gets a permissive passthrough schema.
|
|
164
|
+
*
|
|
165
|
+
* The prefix AND every derived capability are validated against the segment-
|
|
166
|
+
* wise dotted grammar (kept in lockstep with the Go registry validator —
|
|
167
|
+
* src/core/registry/validation.go). addTool applies the same grammar to its
|
|
168
|
+
* produced capability (#1293 item 6), so both surfaces validate a PRODUCED
|
|
169
|
+
* capability name before it reaches the registry; dependency capability names
|
|
170
|
+
* remain the registry's authority.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* agent.addService("media", {
|
|
175
|
+
* caption: async (args) => ({ caption: `...${args.text}` }),
|
|
176
|
+
* thumbnail: { execute: async (args) => ({ url: "..." }), tags: ["fast"] },
|
|
177
|
+
* });
|
|
178
|
+
* // → tools/capabilities "media.caption" and "media.thumbnail"
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
addService(prefix: string, methods: Record<string, ServiceProducerMethod>): this;
|
|
153
182
|
/**
|
|
154
183
|
* Add an LLM provider to the agent.
|
|
155
184
|
*
|
|
@@ -197,19 +226,38 @@ export declare class MeshAgent {
|
|
|
197
226
|
* Build the positional dependency-slot array for one tool call, shared by
|
|
198
227
|
* BOTH the inbound HTTP wrapper (wrappedExecute) and the claim-dispatch
|
|
199
228
|
* path (the ClaimHandler for task:true tools). Centralising this keeps the
|
|
200
|
-
* two slot-assembly sites identical:
|
|
229
|
+
* two slot-assembly sites identical. One entry per AUTHORED slot:
|
|
230
|
+
* - a service-view slot (RFC #1280) → a facade over its method edges
|
|
201
231
|
* - the MeshJob slot (meshJobDepIndex) → a freshly-bound MeshJobSubmitter
|
|
202
|
-
* - every other slot → resolvedDeps.get(`${toolName}:dep_${
|
|
232
|
+
* - every other slot → resolvedDeps.get(`${toolName}:dep_${edgeIndex}`) ?? null
|
|
233
|
+
*
|
|
234
|
+
* `depSlots` carries the slot→edge mapping (a `dep` slot owns one edge; a
|
|
235
|
+
* `view` slot owns a contiguous edge range). `edges` is the flat edge array;
|
|
236
|
+
* a slot's proxy/capability is read via its edge index.
|
|
203
237
|
*
|
|
204
238
|
* #1231: a typed dep slot can resolve at the registry yet never receive an
|
|
205
239
|
* injected proxy, leaving the parameter null. Once the settle latch has
|
|
206
240
|
* flipped (during settling the proxy may still land), warn ONCE per
|
|
207
241
|
* tool+slot — the array is rebuilt per call, so a per-call warning would
|
|
208
|
-
* spam. The warn-once dedupe keys on `${toolName}:dep_${
|
|
242
|
+
* spam. The warn-once dedupe keys on `${toolName}:dep_${edgeIndex}` via the
|
|
209
243
|
* module-level `_unwiredSlotWarned` Set, so a tool exercised via BOTH the
|
|
210
244
|
* inbound and claim paths warns at most once total.
|
|
211
245
|
*/
|
|
212
246
|
private _buildDepSlots;
|
|
247
|
+
/**
|
|
248
|
+
* RFC #1280: build the facade injected at a service-view slot. Each facade
|
|
249
|
+
* method reads its edge's CURRENT proxy from `resolvedDeps` at call time —
|
|
250
|
+
* rebinding-free: a `dependency_available`/`unavailable` event swapping the
|
|
251
|
+
* per-edge proxy is observed on the next call without rebuilding the facade.
|
|
252
|
+
*
|
|
253
|
+
* The `minAvailable` floor is enforced BEFORE delegation on every call: below
|
|
254
|
+
* the floor during the settling window (#1193) the method performs the same
|
|
255
|
+
* bounded, capability-keyed wait the injected-proxy path uses, recounts, then
|
|
256
|
+
* throws {@link MeshServiceUnavailableError}. An unresolved OPTIONAL method
|
|
257
|
+
* edge throws a `TypeError` — the same failure shape a directly-injected
|
|
258
|
+
* unresolved `McpMeshTool` (a null proxy) produces when called.
|
|
259
|
+
*/
|
|
260
|
+
private _buildServiceViewFacade;
|
|
213
261
|
private _getOrBuildA2AClient;
|
|
214
262
|
/**
|
|
215
263
|
* Convert Zod schema to JSON Schema.
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAGL,KAAK,aAAa,EAIn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