@zhin.js/mcp-feature 1.0.6 → 1.0.8

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/lib/provider.js CHANGED
@@ -18,28 +18,18 @@ const mcpFeature = defineFeatureProvider({
18
18
  runtime: {
19
19
  async project(slots, context) {
20
20
  const index = await McpIndex.create(slots, context.snapshot);
21
- let previousIndex;
22
21
  return {
23
22
  value: index,
24
23
  dispose: () => index.stop(),
25
24
  handoff: {
26
- // 先停旧代连接再激活新代:独占端口型 server 热重载不会新旧并存。
27
- quiescePrevious(previous) {
28
- previousIndex = previousMcpIndex(previous);
29
- return previousIndex?.stop();
30
- },
25
+ // Candidate connections become ready before publication. The old
26
+ // index stays usable until its snapshot's final lease drains.
31
27
  activateNext: () => index.start(),
32
28
  deactivateNext: () => index.stop(),
33
- resumePrevious() {
34
- return previousIndex?.start();
35
- },
36
29
  },
37
30
  };
38
31
  },
39
32
  },
40
33
  });
41
- function previousMcpIndex(snapshot) {
42
- return snapshot.projections.get(mcpFeatureId);
43
- }
44
34
  export { mcpFeature };
45
35
  export default mcpFeature;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/mcp-feature",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Convention-based MCP client Feature for Zhin Plugin Runtime",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -17,8 +17,8 @@
17
17
  "src"
18
18
  ],
19
19
  "dependencies": {
20
- "@zhin.js/feature-kit": "1.0.6",
21
- "@zhin.js/plugin-runtime": "1.1.3"
20
+ "@zhin.js/feature-kit": "1.0.8",
21
+ "@zhin.js/plugin-runtime": "1.1.5"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^26.1.2",
package/src/provider.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { featureId, type RuntimeSnapshot } from '@zhin.js/plugin-runtime';
1
+ import { featureId } from '@zhin.js/plugin-runtime';
2
2
  import { defineFeatureProvider, typeScriptModules } from '@zhin.js/feature-kit';
3
3
  import { parseMcpDefinition } from './definition.js';
4
4
  import { McpIndex } from './mcp-index.js';
@@ -20,30 +20,19 @@ const mcpFeature = defineFeatureProvider({
20
20
  runtime: {
21
21
  async project(slots, context) {
22
22
  const index = await McpIndex.create(slots, context.snapshot);
23
- let previousIndex: McpIndex | undefined;
24
23
  return {
25
24
  value: index,
26
25
  dispose: () => index.stop(),
27
26
  handoff: {
28
- // 先停旧代连接再激活新代:独占端口型 server 热重载不会新旧并存。
29
- quiescePrevious(previous) {
30
- previousIndex = previousMcpIndex(previous);
31
- return previousIndex?.stop();
32
- },
27
+ // Candidate connections become ready before publication. The old
28
+ // index stays usable until its snapshot's final lease drains.
33
29
  activateNext: () => index.start(),
34
30
  deactivateNext: () => index.stop(),
35
- resumePrevious() {
36
- return previousIndex?.start();
37
- },
38
31
  },
39
32
  };
40
33
  },
41
34
  },
42
35
  });
43
36
 
44
- function previousMcpIndex(snapshot: RuntimeSnapshot): McpIndex | undefined {
45
- return snapshot.projections.get(mcpFeatureId) as McpIndex | undefined;
46
- }
47
-
48
37
  export { mcpFeature };
49
38
  export default mcpFeature;