@zhin.js/agent-feature 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -22,6 +22,10 @@ Break the request into verifiable steps. Prefer reversible actions.
22
22
 
23
23
  完整 Markdown 是 `instructions` SSOT。首个 heading 作为 description;没有 heading 时使用文件 identity。Feature 不绑定模型、system prompt 模板、tool policy 或 session store,这些属于 orchestrator adapter。
24
24
 
25
+ 单文件插件可用 `setup({ addAgent })` 注册 Markdown Agent,例如
26
+ `addAgent('planner', '# Planner\n\nBreak work into verifiable steps.')`;目录模式和 setup
27
+ 模式共用 AgentIndex。
28
+
25
29
  ## Projection
26
30
 
27
31
  `AgentIndex.list()` 返回全树 qualified descriptors;`visible(owner)` 和 `get(owner, name)` 使用 nearest-owner inheritance。不同 Plugin owner 的同名 Agent 不通过扫描顺序覆盖。
@@ -6,5 +6,10 @@ export interface AgentDefinition {
6
6
  readonly description: string;
7
7
  readonly instructions: string;
8
8
  }
9
+ declare module '@zhin.js/plugin-runtime' {
10
+ interface PluginSetupContext<TConfig> {
11
+ addAgent(localName: string, markdown: string): void;
12
+ }
13
+ }
9
14
  export declare function parseAgentMarkdown(value: unknown, context: ValidationContext): AgentDefinition;
10
15
  export {};
package/lib/provider.js CHANGED
@@ -28,6 +28,7 @@ const agentFeature = defineFeatureProvider({
28
28
  protocol: 1,
29
29
  id: agentFeatureId,
30
30
  authoring: {
31
+ setupMethod: 'addAgent',
31
32
  conventions: [agentFiles],
32
33
  validate: parseAgentMarkdown,
33
34
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/agent-feature",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Convention-based Markdown Agent 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.1",
21
- "@zhin.js/plugin-runtime": "1.0.1"
20
+ "@zhin.js/feature-kit": "1.0.3",
21
+ "@zhin.js/plugin-runtime": "1.1.1"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^26.1.0",
package/src/definition.ts CHANGED
@@ -9,6 +9,14 @@ export interface AgentDefinition {
9
9
  readonly instructions: string;
10
10
  }
11
11
 
12
+ declare module '@zhin.js/plugin-runtime' {
13
+ // Type parameter name must match the base PluginSetupContext declaration (TS2428).
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ interface PluginSetupContext<TConfig> {
16
+ addAgent(localName: string, markdown: string): void;
17
+ }
18
+ }
19
+
12
20
  export function parseAgentMarkdown(value: unknown, context: ValidationContext): AgentDefinition {
13
21
  if (typeof value !== 'string' || !value.trim()) {
14
22
  throw new TypeError(`Agent ${context.source} must contain Markdown instructions`);
package/src/provider.ts CHANGED
@@ -33,6 +33,7 @@ const agentFeature = defineFeatureProvider({
33
33
  protocol: 1,
34
34
  id: agentFeatureId,
35
35
  authoring: {
36
+ setupMethod: 'addAgent',
36
37
  conventions: [agentFiles],
37
38
  validate: parseAgentMarkdown,
38
39
  },