@1agents/dreammate-network 0.3.2 → 0.5.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.
@@ -12,7 +12,7 @@
12
12
  * 协议版本,与本包的 package.json 版本保持一致——两个版本号会让人永远猜不准
13
13
  * 该看哪个。服务在 `manifest.metadata.protocol_version` 里报告它遵循的版本。
14
14
  */
15
- export declare const PROTOCOL_VERSION = "0.3.2";
15
+ export declare const PROTOCOL_VERSION = "0.5.0";
16
16
  /** `session://<node>/<runtime>/<session_id>` */
17
17
  export type SessionURI = `session://${string}/${string}/${string}`;
18
18
  /** 资源寻址,如 `recording://tingqi-01/abc`、`speaker://tingqi-001/speaker-23` */
@@ -98,13 +98,71 @@ export type ServiceKind = "generic" | "agent_runtime" | "session_registry" | "re
98
98
  */
99
99
  /** 这个 Service 能被谁连上。省略时按 `network` 理解。 */
100
100
  export type Reachability = "localhost" | "network";
101
+ /**
102
+ * 方法契约描述:定义供大模型与 RPC 调用的方法接口。
103
+ */
104
+ export interface MethodDescriptor {
105
+ /** 方法的业务功能描述,供智能体理解意图。 */
106
+ description: string;
107
+ /**
108
+ * 入参 JSON Schema(必须为 object 结构)。
109
+ * 包含 properties、required 等标准 JSON Schema 字段。
110
+ */
111
+ parameters?: {
112
+ type?: 'object';
113
+ properties?: Record<string, unknown>;
114
+ required?: string[];
115
+ [key: string]: unknown;
116
+ } | Record<string, unknown>;
117
+ /** 返回值结构说明。 */
118
+ returns?: Record<string, unknown>;
119
+ }
120
+ /**
121
+ * 技能 SOP 指南描述:提供大模型在复杂任务下的多步编排与避坑指南。
122
+ */
123
+ export interface SkillDescriptor {
124
+ /** 技能唯一标识名。 */
125
+ name: string;
126
+ /** 技能触发场景描述。 */
127
+ description: string;
128
+ /** Markdown 格式的完整 SOP 操作指南。 */
129
+ sop: string;
130
+ /** 是否具备可跨节点打包下载的本地技能包。 */
131
+ has_package?: boolean;
132
+ metadata?: Record<string, unknown>;
133
+ }
134
+ /** 服务调用方式:cli=仅命令行;http=仅常驻HTTP;hybrid=双模兼容,优先CLI。 */
135
+ export type ExecutionMode = "cli" | "http" | "hybrid";
136
+ /** 服务启停生命周期规范,声明能否被网关按需拉起或关闭。 */
137
+ export interface ServiceLifecycle {
138
+ /** 如何拉起该服务的常驻进程(如 'transcribe serve --port 7782')。 */
139
+ start_command?: string;
140
+ /** 如何通过 HTTP 关闭该服务(如 '/shutdown')。 */
141
+ stop_endpoint?: string;
142
+ /** 是否支持被 node agent 自动拉起。 */
143
+ can_spawn?: boolean;
144
+ /** 是否支持被 node agent 请求关闭。 */
145
+ can_shutdown?: boolean;
146
+ }
101
147
  export interface Service {
102
148
  id: string;
103
149
  name?: string | null;
104
150
  /** 省略等同于 `"generic"` */
105
151
  kind?: ServiceKind;
106
- /** 可以为空数组(纯 Resource Provider)或省略 */
152
+ /** 服务调用模式:cli | http | hybrid(默认 hybrid)。 */
153
+ execution?: ExecutionMode;
154
+ /** 执行指令或可执行文件名称(如 'transcribe')。 */
155
+ command?: string;
156
+ /** 服务的启停生命周期控制参数。 */
157
+ lifecycle?: ServiceLifecycle;
158
+ /**
159
+ * @deprecated 历史遗留字段,新服务请直接使用 `methods` 与 `skills`。
160
+ */
107
161
  capabilities?: Capability[];
162
+ /** 可供调用的机器方法契约集合。 */
163
+ methods?: Record<string, MethodDescriptor>;
164
+ /** 配套的领域业务 SOP 与技能指南。 */
165
+ skills?: Record<string, SkillDescriptor>;
108
166
  resources?: ResourceDescriptor[];
109
167
  access?: AccessDescriptor[];
110
168
  /**
@@ -112,7 +170,7 @@ export interface Service {
112
170
  * 声明而**不做代理**——调用方看到 `localhost` 就知道不用白跑一趟。
113
171
  */
114
172
  reachability?: Reachability;
115
- /** 实际监听端口。不必等于 {@link DEFAULT_PORTS} 里的默认值。 */
173
+ /** 实际监听端口。纯 CLI 模式可省略。不必等于 {@link DEFAULT_PORTS} 里的默认值。 */
116
174
  port?: number | null;
117
175
  /** 存活探测路径,默认 `/health`。 */
118
176
  health?: string | null;
@@ -12,7 +12,7 @@
12
12
  * 协议版本,与本包的 package.json 版本保持一致——两个版本号会让人永远猜不准
13
13
  * 该看哪个。服务在 `manifest.metadata.protocol_version` 里报告它遵循的版本。
14
14
  */
15
- export const PROTOCOL_VERSION = "0.3.2";
15
+ export const PROTOCOL_VERSION = "0.5.0";
16
16
  /* ------------------------------------------------------------------ *
17
17
  * 发现
18
18
  * ------------------------------------------------------------------ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1agents/dreammate-network",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "DreamMate Network L0 协议包:schema + types,零运行时依赖,不含业务逻辑。",
5
5
  "keywords": [
6
6
  "dreammate",
@@ -40,24 +40,68 @@
40
40
  },
41
41
  "capabilities": {
42
42
  "type": "array",
43
- "description": "该 Service 能做什么。第一版就是点分命名的字符串,不带权限/可用性等元数据。可以为空数组(纯 Resource Provider)。",
43
+ "description": "@deprecated 历史遗留字段,新服务请优先使用 methods 与 skills。可以为空数组(纯 Resource Provider)。",
44
44
  "items": {
45
45
  "type": "string",
46
46
  "minLength": 1
47
- },
48
- "examples": [
49
- [
50
- "sessions.list",
51
- "sessions.read"
47
+ }
48
+ },
49
+ "methods": {
50
+ "type": "object",
51
+ "description": "该 Service 提供的可调用 RPC 方法集合,明确参数与返回值契约。",
52
+ "additionalProperties": {
53
+ "type": "object",
54
+ "required": [
55
+ "description"
52
56
  ],
53
- [
54
- "reminders.create"
57
+ "properties": {
58
+ "description": {
59
+ "type": "string",
60
+ "description": "该方法的业务功能描述。"
61
+ },
62
+ "parameters": {
63
+ "type": "object",
64
+ "description": "入参 JSON Schema 定义(必须是 object 结构)。"
65
+ },
66
+ "returns": {
67
+ "type": "object",
68
+ "description": "返回值结构说明。"
69
+ }
70
+ }
71
+ }
72
+ },
73
+ "skills": {
74
+ "type": "object",
75
+ "description": "该 Service 配套的领域业务 SOP 与操作指南(Markdown 格式)。",
76
+ "additionalProperties": {
77
+ "type": "object",
78
+ "required": [
79
+ "name",
80
+ "description",
81
+ "sop"
55
82
  ],
56
- [
57
- "recordings.list",
58
- "recording.read"
59
- ]
60
- ]
83
+ "properties": {
84
+ "name": {
85
+ "type": "string",
86
+ "description": "技能唯一标识名。"
87
+ },
88
+ "description": {
89
+ "type": "string",
90
+ "description": "技能触发场景说明。"
91
+ },
92
+ "sop": {
93
+ "type": "string",
94
+ "description": "包含步骤指导的完整 Markdown SOP 正文。"
95
+ },
96
+ "has_package": {
97
+ "type": "boolean",
98
+ "description": "是否具备可供跨节点打包下载的完整本地技能包。"
99
+ },
100
+ "metadata": {
101
+ "type": "object"
102
+ }
103
+ }
104
+ }
61
105
  },
62
106
  "resources": {
63
107
  "type": "array",
@@ -107,6 +151,42 @@
107
151
  ],
108
152
  "description": "这个 Service 能被谁连上。localhost=只监听回环,外部节点发现得了但连不上;network=监听 0.0.0.0 或 tailnet 地址,外部可直连。node agent 如实转述服务自己的声明,不做代理——调用方看到 localhost 就知道不用白跑一趟。省略时按 network 理解。"
109
153
  },
154
+ "execution": {
155
+ "type": "string",
156
+ "enum": [
157
+ "cli",
158
+ "http",
159
+ "hybrid"
160
+ ],
161
+ "default": "hybrid",
162
+ "description": "服务调用执行模式:cli=仅本地命令行;http=仅常驻HTTP服务;hybrid=双模兼容,优先本地CLI执行,亦可按需拉起常驻HTTP。"
163
+ },
164
+ "command": {
165
+ "type": "string",
166
+ "description": "execution 为 cli 或 hybrid 时对应的执行指令或可执行文件名称(如 'transcribe')。"
167
+ },
168
+ "lifecycle": {
169
+ "type": "object",
170
+ "description": "服务启停生命周期规范,声明能否被网关按需拉起和关闭及对应参数。",
171
+ "properties": {
172
+ "start_command": {
173
+ "type": "string",
174
+ "description": "如何拉起该服务的常驻进程(如 'transcribe serve --port 7782')。"
175
+ },
176
+ "stop_endpoint": {
177
+ "type": "string",
178
+ "description": "如何通过 HTTP 关闭该服务(如 '/shutdown')。"
179
+ },
180
+ "can_spawn": {
181
+ "type": "boolean",
182
+ "description": "是否支持被 node agent 自动拉起。"
183
+ },
184
+ "can_shutdown": {
185
+ "type": "boolean",
186
+ "description": "是否支持被 node agent 请求关闭。"
187
+ }
188
+ }
189
+ },
110
190
  "port": {
111
191
  "type": [
112
192
  "integer",
@@ -114,7 +194,7 @@
114
194
  ],
115
195
  "minimum": 1,
116
196
  "maximum": 65535,
117
- "description": "服务实际监听的端口。向本机 node agent 报备时带上,外部才知道该连哪儿;它不必等于 DEFAULT_PORTS 里的默认值。"
197
+ "description": "服务实际监听的端口。向本机 node agent 报备时带上,外部才知道该连哪儿;纯 CLI 模式可省略。"
118
198
  },
119
199
  "health": {
120
200
  "type": [