@roll-agent/core 0.14.1 → 0.16.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/cli/chat/banner.d.ts +21 -0
- package/dist/cli/chat/banner.js +1 -0
- package/dist/cli/chat/ink/app.d.ts +2 -0
- package/dist/cli/chat/ink/app.js +1 -1
- package/dist/cli/chat/ink/commands.d.ts +28 -0
- package/dist/cli/chat/ink/commands.js +1 -1
- package/dist/cli/chat/ink/history-item.js +1 -1
- package/dist/cli/chat/ink/live-region.js +1 -1
- package/dist/cli/chat/ink/run-ink-repl.d.ts +3 -0
- package/dist/cli/chat/ink/run-ink-repl.js +1 -1
- package/dist/cli/chat/ink/slash-popup.d.ts +2 -2
- package/dist/cli/chat/ink/slash-popup.js +1 -1
- package/dist/cli/chat/ink/state.d.ts +6 -0
- package/dist/cli/chat/ink/state.js +1 -1
- package/dist/cli/chat/ink/text-prompt.d.ts +1 -0
- package/dist/cli/chat/ink/text-prompt.js +1 -1
- package/dist/cli/chat/ink/use-session.d.ts +1 -1
- package/dist/cli/chat/ink/use-session.js +1 -1
- package/dist/cli/commands/agent-add.js +1 -1
- package/dist/cli/commands/agent-env-guidance.d.ts +2 -0
- package/dist/cli/commands/agent-env-guidance.js +1 -0
- package/dist/cli/commands/agent-install.d.ts +5 -0
- package/dist/cli/commands/agent-install.js +1 -1
- package/dist/cli/commands/agent-list.d.ts +5 -0
- package/dist/cli/commands/agent-list.js +1 -1
- package/dist/cli/commands/chat.d.ts +3 -0
- package/dist/cli/commands/chat.js +1 -1
- package/dist/cli/commands/config-guidance.d.ts +27 -0
- package/dist/cli/commands/config-guidance.js +1 -1
- package/dist/cli/commands/config-prompts.d.ts +6 -0
- package/dist/cli/commands/config-prompts.js +1 -1
- package/dist/cli/commands/config-setup.d.ts +6 -1
- package/dist/cli/commands/config-setup.js +1 -1
- package/dist/cli/commands/config.d.ts +1 -0
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/setup.d.ts +38 -0
- package/dist/cli/commands/setup.js +1 -0
- package/dist/cli/commands/skills-install.d.ts +30 -0
- package/dist/cli/commands/skills-install.js +1 -0
- package/dist/cli/commands/skills-utils.d.ts +4 -7
- package/dist/cli/commands/skills-utils.js +1 -1
- package/dist/cli/commands/skills.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/utils/catalog-status.d.ts +20 -0
- package/dist/cli/utils/catalog-status.js +1 -0
- package/dist/cli/utils/chat-renderer.d.ts +1 -0
- package/dist/cli/utils/chat-renderer.js +1 -1
- package/dist/cli/utils/git-source.d.ts +7 -0
- package/dist/cli/utils/git-source.js +1 -0
- package/dist/cli/utils/tool-format.d.ts +1 -0
- package/dist/cli/utils/tool-format.js +1 -1
- package/dist/config/defaults.js +1 -1
- package/dist/config/helpers.d.ts +17 -0
- package/dist/config/helpers.js +1 -1
- package/dist/config/key-codec.js +1 -1
- package/dist/config/loader.d.ts +2 -0
- package/dist/config/loader.js +1 -1
- package/dist/config/migration.d.ts +5 -1
- package/dist/config/migration.js +1 -1
- package/dist/config/runtime-env.d.ts +30 -30
- package/dist/config/schema.d.ts +273 -0
- package/dist/config/schema.js +1 -1
- package/dist/mcp/client-manager.js +1 -1
- package/dist/registry/catalog-discovery.d.ts +30 -0
- package/dist/registry/catalog-discovery.js +1 -0
- package/dist/registry/catalog.d.ts +42 -0
- package/dist/registry/catalog.js +1 -0
- package/dist/registry/discovery.js +1 -1
- package/dist/registry/index.d.ts +4 -0
- package/dist/registry/index.js +1 -1
- package/dist/registry/install.d.ts +69 -0
- package/dist/registry/install.js +1 -0
- package/dist/skills/documents.d.ts +8 -0
- package/dist/skills/documents.js +1 -0
- package/dist/skills/install.d.ts +17 -0
- package/dist/skills/install.js +1 -0
- package/dist/skills/library.d.ts +31 -0
- package/dist/skills/library.js +1 -0
- package/dist/skills/orchestrators.d.ts +39 -0
- package/dist/skills/orchestrators.js +1 -0
- package/package.json +6 -2
|
@@ -107,17 +107,17 @@ export declare const BrowserInstanceStatusDiagnosticSchema: z.ZodObject<{
|
|
|
107
107
|
}, "strip", z.ZodTypeAny, {
|
|
108
108
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
109
109
|
id: string;
|
|
110
|
+
profile: {
|
|
111
|
+
exists: boolean;
|
|
112
|
+
writable: boolean;
|
|
113
|
+
userDataDir?: string | undefined;
|
|
114
|
+
};
|
|
110
115
|
cdp: {
|
|
111
116
|
endpoint: string;
|
|
112
117
|
versionReachable: boolean;
|
|
113
118
|
listReachable: boolean;
|
|
114
119
|
port?: number | undefined;
|
|
115
120
|
};
|
|
116
|
-
profile: {
|
|
117
|
-
exists: boolean;
|
|
118
|
-
writable: boolean;
|
|
119
|
-
userDataDir?: string | undefined;
|
|
120
|
-
};
|
|
121
121
|
tracking: {
|
|
122
122
|
source: "instance" | "missing" | "default-env";
|
|
123
123
|
agentIdFingerprint?: string | undefined;
|
|
@@ -126,17 +126,17 @@ export declare const BrowserInstanceStatusDiagnosticSchema: z.ZodObject<{
|
|
|
126
126
|
}, {
|
|
127
127
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
128
128
|
id: string;
|
|
129
|
+
profile: {
|
|
130
|
+
exists: boolean;
|
|
131
|
+
writable: boolean;
|
|
132
|
+
userDataDir?: string | undefined;
|
|
133
|
+
};
|
|
129
134
|
cdp: {
|
|
130
135
|
endpoint: string;
|
|
131
136
|
versionReachable: boolean;
|
|
132
137
|
listReachable: boolean;
|
|
133
138
|
port?: number | undefined;
|
|
134
139
|
};
|
|
135
|
-
profile: {
|
|
136
|
-
exists: boolean;
|
|
137
|
-
writable: boolean;
|
|
138
|
-
userDataDir?: string | undefined;
|
|
139
|
-
};
|
|
140
140
|
tracking: {
|
|
141
141
|
source: "instance" | "missing" | "default-env";
|
|
142
142
|
agentIdFingerprint?: string | undefined;
|
|
@@ -251,17 +251,17 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
251
251
|
}, "strip", z.ZodTypeAny, {
|
|
252
252
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
253
253
|
id: string;
|
|
254
|
+
profile: {
|
|
255
|
+
exists: boolean;
|
|
256
|
+
writable: boolean;
|
|
257
|
+
userDataDir?: string | undefined;
|
|
258
|
+
};
|
|
254
259
|
cdp: {
|
|
255
260
|
endpoint: string;
|
|
256
261
|
versionReachable: boolean;
|
|
257
262
|
listReachable: boolean;
|
|
258
263
|
port?: number | undefined;
|
|
259
264
|
};
|
|
260
|
-
profile: {
|
|
261
|
-
exists: boolean;
|
|
262
|
-
writable: boolean;
|
|
263
|
-
userDataDir?: string | undefined;
|
|
264
|
-
};
|
|
265
265
|
tracking: {
|
|
266
266
|
source: "instance" | "missing" | "default-env";
|
|
267
267
|
agentIdFingerprint?: string | undefined;
|
|
@@ -270,17 +270,17 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
270
270
|
}, {
|
|
271
271
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
272
272
|
id: string;
|
|
273
|
+
profile: {
|
|
274
|
+
exists: boolean;
|
|
275
|
+
writable: boolean;
|
|
276
|
+
userDataDir?: string | undefined;
|
|
277
|
+
};
|
|
273
278
|
cdp: {
|
|
274
279
|
endpoint: string;
|
|
275
280
|
versionReachable: boolean;
|
|
276
281
|
listReachable: boolean;
|
|
277
282
|
port?: number | undefined;
|
|
278
283
|
};
|
|
279
|
-
profile: {
|
|
280
|
-
exists: boolean;
|
|
281
|
-
writable: boolean;
|
|
282
|
-
userDataDir?: string | undefined;
|
|
283
|
-
};
|
|
284
284
|
tracking: {
|
|
285
285
|
source: "instance" | "missing" | "default-env";
|
|
286
286
|
agentIdFingerprint?: string | undefined;
|
|
@@ -295,17 +295,17 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
295
295
|
instances?: {
|
|
296
296
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
297
297
|
id: string;
|
|
298
|
+
profile: {
|
|
299
|
+
exists: boolean;
|
|
300
|
+
writable: boolean;
|
|
301
|
+
userDataDir?: string | undefined;
|
|
302
|
+
};
|
|
298
303
|
cdp: {
|
|
299
304
|
endpoint: string;
|
|
300
305
|
versionReachable: boolean;
|
|
301
306
|
listReachable: boolean;
|
|
302
307
|
port?: number | undefined;
|
|
303
308
|
};
|
|
304
|
-
profile: {
|
|
305
|
-
exists: boolean;
|
|
306
|
-
writable: boolean;
|
|
307
|
-
userDataDir?: string | undefined;
|
|
308
|
-
};
|
|
309
309
|
tracking: {
|
|
310
310
|
source: "instance" | "missing" | "default-env";
|
|
311
311
|
agentIdFingerprint?: string | undefined;
|
|
@@ -339,17 +339,17 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
339
339
|
instances?: {
|
|
340
340
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
341
341
|
id: string;
|
|
342
|
+
profile: {
|
|
343
|
+
exists: boolean;
|
|
344
|
+
writable: boolean;
|
|
345
|
+
userDataDir?: string | undefined;
|
|
346
|
+
};
|
|
342
347
|
cdp: {
|
|
343
348
|
endpoint: string;
|
|
344
349
|
versionReachable: boolean;
|
|
345
350
|
listReachable: boolean;
|
|
346
351
|
port?: number | undefined;
|
|
347
352
|
};
|
|
348
|
-
profile: {
|
|
349
|
-
exists: boolean;
|
|
350
|
-
writable: boolean;
|
|
351
|
-
userDataDir?: string | undefined;
|
|
352
|
-
};
|
|
353
353
|
tracking: {
|
|
354
354
|
source: "instance" | "missing" | "default-env";
|
|
355
355
|
agentIdFingerprint?: string | undefined;
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -93,6 +93,72 @@ export declare const runtimeCompactionConfigSchema: z.ZodObject<{
|
|
|
93
93
|
keepRecentTokens?: number | undefined;
|
|
94
94
|
}>;
|
|
95
95
|
export declare const runtimeThinkingLevels: readonly ["off", "low", "medium", "high"];
|
|
96
|
+
export declare const runtimeShellSessionConfigSchema: z.ZodObject<{
|
|
97
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
98
|
+
maxSessions: z.ZodDefault<z.ZodNumber>;
|
|
99
|
+
defaultYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
100
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
}, "strip", z.ZodTypeAny, {
|
|
102
|
+
maxOutputTokens: number;
|
|
103
|
+
enabled: boolean;
|
|
104
|
+
maxSessions: number;
|
|
105
|
+
defaultYieldMs: number;
|
|
106
|
+
}, {
|
|
107
|
+
maxOutputTokens?: number | undefined;
|
|
108
|
+
enabled?: boolean | undefined;
|
|
109
|
+
maxSessions?: number | undefined;
|
|
110
|
+
defaultYieldMs?: number | undefined;
|
|
111
|
+
}>;
|
|
112
|
+
export declare const runtimeShellConfigSchema: z.ZodObject<{
|
|
113
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
114
|
+
autoApproveSafe: z.ZodDefault<z.ZodBoolean>;
|
|
115
|
+
defaultTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
116
|
+
maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
117
|
+
maxCaptureBytes: z.ZodDefault<z.ZodNumber>;
|
|
118
|
+
maxModelOutputChars: z.ZodDefault<z.ZodNumber>;
|
|
119
|
+
session: z.ZodDefault<z.ZodObject<{
|
|
120
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
121
|
+
maxSessions: z.ZodDefault<z.ZodNumber>;
|
|
122
|
+
defaultYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
123
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
maxOutputTokens: number;
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
maxSessions: number;
|
|
128
|
+
defaultYieldMs: number;
|
|
129
|
+
}, {
|
|
130
|
+
maxOutputTokens?: number | undefined;
|
|
131
|
+
enabled?: boolean | undefined;
|
|
132
|
+
maxSessions?: number | undefined;
|
|
133
|
+
defaultYieldMs?: number | undefined;
|
|
134
|
+
}>>;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
enabled: boolean;
|
|
137
|
+
autoApproveSafe: boolean;
|
|
138
|
+
defaultTimeoutMs: number;
|
|
139
|
+
maxTimeoutMs: number;
|
|
140
|
+
maxCaptureBytes: number;
|
|
141
|
+
maxModelOutputChars: number;
|
|
142
|
+
session: {
|
|
143
|
+
maxOutputTokens: number;
|
|
144
|
+
enabled: boolean;
|
|
145
|
+
maxSessions: number;
|
|
146
|
+
defaultYieldMs: number;
|
|
147
|
+
};
|
|
148
|
+
}, {
|
|
149
|
+
enabled?: boolean | undefined;
|
|
150
|
+
autoApproveSafe?: boolean | undefined;
|
|
151
|
+
defaultTimeoutMs?: number | undefined;
|
|
152
|
+
maxTimeoutMs?: number | undefined;
|
|
153
|
+
maxCaptureBytes?: number | undefined;
|
|
154
|
+
maxModelOutputChars?: number | undefined;
|
|
155
|
+
session?: {
|
|
156
|
+
maxOutputTokens?: number | undefined;
|
|
157
|
+
enabled?: boolean | undefined;
|
|
158
|
+
maxSessions?: number | undefined;
|
|
159
|
+
defaultYieldMs?: number | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
}>;
|
|
96
162
|
export declare const runtimeConfigSchema: z.ZodObject<{
|
|
97
163
|
provider: z.ZodOptional<z.ZodString>;
|
|
98
164
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -130,7 +196,71 @@ export declare const runtimeConfigSchema: z.ZodObject<{
|
|
|
130
196
|
keepRecentTurns?: number | undefined;
|
|
131
197
|
keepRecentTokens?: number | undefined;
|
|
132
198
|
}>>;
|
|
199
|
+
shell: z.ZodDefault<z.ZodObject<{
|
|
200
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
201
|
+
autoApproveSafe: z.ZodDefault<z.ZodBoolean>;
|
|
202
|
+
defaultTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
203
|
+
maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
204
|
+
maxCaptureBytes: z.ZodDefault<z.ZodNumber>;
|
|
205
|
+
maxModelOutputChars: z.ZodDefault<z.ZodNumber>;
|
|
206
|
+
session: z.ZodDefault<z.ZodObject<{
|
|
207
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
208
|
+
maxSessions: z.ZodDefault<z.ZodNumber>;
|
|
209
|
+
defaultYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
210
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
maxOutputTokens: number;
|
|
213
|
+
enabled: boolean;
|
|
214
|
+
maxSessions: number;
|
|
215
|
+
defaultYieldMs: number;
|
|
216
|
+
}, {
|
|
217
|
+
maxOutputTokens?: number | undefined;
|
|
218
|
+
enabled?: boolean | undefined;
|
|
219
|
+
maxSessions?: number | undefined;
|
|
220
|
+
defaultYieldMs?: number | undefined;
|
|
221
|
+
}>>;
|
|
222
|
+
}, "strip", z.ZodTypeAny, {
|
|
223
|
+
enabled: boolean;
|
|
224
|
+
autoApproveSafe: boolean;
|
|
225
|
+
defaultTimeoutMs: number;
|
|
226
|
+
maxTimeoutMs: number;
|
|
227
|
+
maxCaptureBytes: number;
|
|
228
|
+
maxModelOutputChars: number;
|
|
229
|
+
session: {
|
|
230
|
+
maxOutputTokens: number;
|
|
231
|
+
enabled: boolean;
|
|
232
|
+
maxSessions: number;
|
|
233
|
+
defaultYieldMs: number;
|
|
234
|
+
};
|
|
235
|
+
}, {
|
|
236
|
+
enabled?: boolean | undefined;
|
|
237
|
+
autoApproveSafe?: boolean | undefined;
|
|
238
|
+
defaultTimeoutMs?: number | undefined;
|
|
239
|
+
maxTimeoutMs?: number | undefined;
|
|
240
|
+
maxCaptureBytes?: number | undefined;
|
|
241
|
+
maxModelOutputChars?: number | undefined;
|
|
242
|
+
session?: {
|
|
243
|
+
maxOutputTokens?: number | undefined;
|
|
244
|
+
enabled?: boolean | undefined;
|
|
245
|
+
maxSessions?: number | undefined;
|
|
246
|
+
defaultYieldMs?: number | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
}>>;
|
|
133
249
|
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
shell: {
|
|
251
|
+
enabled: boolean;
|
|
252
|
+
autoApproveSafe: boolean;
|
|
253
|
+
defaultTimeoutMs: number;
|
|
254
|
+
maxTimeoutMs: number;
|
|
255
|
+
maxCaptureBytes: number;
|
|
256
|
+
maxModelOutputChars: number;
|
|
257
|
+
session: {
|
|
258
|
+
maxOutputTokens: number;
|
|
259
|
+
enabled: boolean;
|
|
260
|
+
maxSessions: number;
|
|
261
|
+
defaultYieldMs: number;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
134
264
|
maxSteps: number;
|
|
135
265
|
turnTimeoutMs: number;
|
|
136
266
|
threadsDir: string;
|
|
@@ -150,6 +280,20 @@ export declare const runtimeConfigSchema: z.ZodObject<{
|
|
|
150
280
|
provider?: string | undefined;
|
|
151
281
|
contextWindow?: number | undefined;
|
|
152
282
|
}, {
|
|
283
|
+
shell?: {
|
|
284
|
+
enabled?: boolean | undefined;
|
|
285
|
+
autoApproveSafe?: boolean | undefined;
|
|
286
|
+
defaultTimeoutMs?: number | undefined;
|
|
287
|
+
maxTimeoutMs?: number | undefined;
|
|
288
|
+
maxCaptureBytes?: number | undefined;
|
|
289
|
+
maxModelOutputChars?: number | undefined;
|
|
290
|
+
session?: {
|
|
291
|
+
maxOutputTokens?: number | undefined;
|
|
292
|
+
enabled?: boolean | undefined;
|
|
293
|
+
maxSessions?: number | undefined;
|
|
294
|
+
defaultYieldMs?: number | undefined;
|
|
295
|
+
} | undefined;
|
|
296
|
+
} | undefined;
|
|
153
297
|
model?: string | undefined;
|
|
154
298
|
provider?: string | undefined;
|
|
155
299
|
maxSteps?: number | undefined;
|
|
@@ -169,6 +313,14 @@ export declare const runtimeConfigSchema: z.ZodObject<{
|
|
|
169
313
|
keepRecentTokens?: number | undefined;
|
|
170
314
|
} | undefined;
|
|
171
315
|
}>;
|
|
316
|
+
export declare const skillsConfigSchema: z.ZodObject<{
|
|
317
|
+
/** 额外的 skill 目录(canonical `.agents/skills` 之外的补充来源)。 */
|
|
318
|
+
dirs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
dirs: string[];
|
|
321
|
+
}, {
|
|
322
|
+
dirs?: string[] | undefined;
|
|
323
|
+
}>;
|
|
172
324
|
export declare const agentsConfigSchema: z.ZodObject<{
|
|
173
325
|
dataDir: z.ZodString;
|
|
174
326
|
/** per-agent 环境变量:键为 agent name,值为 key-value 对 */
|
|
@@ -613,7 +765,71 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
613
765
|
keepRecentTurns?: number | undefined;
|
|
614
766
|
keepRecentTokens?: number | undefined;
|
|
615
767
|
}>>;
|
|
768
|
+
shell: z.ZodDefault<z.ZodObject<{
|
|
769
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
770
|
+
autoApproveSafe: z.ZodDefault<z.ZodBoolean>;
|
|
771
|
+
defaultTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
772
|
+
maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
773
|
+
maxCaptureBytes: z.ZodDefault<z.ZodNumber>;
|
|
774
|
+
maxModelOutputChars: z.ZodDefault<z.ZodNumber>;
|
|
775
|
+
session: z.ZodDefault<z.ZodObject<{
|
|
776
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
777
|
+
maxSessions: z.ZodDefault<z.ZodNumber>;
|
|
778
|
+
defaultYieldMs: z.ZodDefault<z.ZodNumber>;
|
|
779
|
+
maxOutputTokens: z.ZodDefault<z.ZodNumber>;
|
|
780
|
+
}, "strip", z.ZodTypeAny, {
|
|
781
|
+
maxOutputTokens: number;
|
|
782
|
+
enabled: boolean;
|
|
783
|
+
maxSessions: number;
|
|
784
|
+
defaultYieldMs: number;
|
|
785
|
+
}, {
|
|
786
|
+
maxOutputTokens?: number | undefined;
|
|
787
|
+
enabled?: boolean | undefined;
|
|
788
|
+
maxSessions?: number | undefined;
|
|
789
|
+
defaultYieldMs?: number | undefined;
|
|
790
|
+
}>>;
|
|
791
|
+
}, "strip", z.ZodTypeAny, {
|
|
792
|
+
enabled: boolean;
|
|
793
|
+
autoApproveSafe: boolean;
|
|
794
|
+
defaultTimeoutMs: number;
|
|
795
|
+
maxTimeoutMs: number;
|
|
796
|
+
maxCaptureBytes: number;
|
|
797
|
+
maxModelOutputChars: number;
|
|
798
|
+
session: {
|
|
799
|
+
maxOutputTokens: number;
|
|
800
|
+
enabled: boolean;
|
|
801
|
+
maxSessions: number;
|
|
802
|
+
defaultYieldMs: number;
|
|
803
|
+
};
|
|
804
|
+
}, {
|
|
805
|
+
enabled?: boolean | undefined;
|
|
806
|
+
autoApproveSafe?: boolean | undefined;
|
|
807
|
+
defaultTimeoutMs?: number | undefined;
|
|
808
|
+
maxTimeoutMs?: number | undefined;
|
|
809
|
+
maxCaptureBytes?: number | undefined;
|
|
810
|
+
maxModelOutputChars?: number | undefined;
|
|
811
|
+
session?: {
|
|
812
|
+
maxOutputTokens?: number | undefined;
|
|
813
|
+
enabled?: boolean | undefined;
|
|
814
|
+
maxSessions?: number | undefined;
|
|
815
|
+
defaultYieldMs?: number | undefined;
|
|
816
|
+
} | undefined;
|
|
817
|
+
}>>;
|
|
616
818
|
}, "strip", z.ZodTypeAny, {
|
|
819
|
+
shell: {
|
|
820
|
+
enabled: boolean;
|
|
821
|
+
autoApproveSafe: boolean;
|
|
822
|
+
defaultTimeoutMs: number;
|
|
823
|
+
maxTimeoutMs: number;
|
|
824
|
+
maxCaptureBytes: number;
|
|
825
|
+
maxModelOutputChars: number;
|
|
826
|
+
session: {
|
|
827
|
+
maxOutputTokens: number;
|
|
828
|
+
enabled: boolean;
|
|
829
|
+
maxSessions: number;
|
|
830
|
+
defaultYieldMs: number;
|
|
831
|
+
};
|
|
832
|
+
};
|
|
617
833
|
maxSteps: number;
|
|
618
834
|
turnTimeoutMs: number;
|
|
619
835
|
threadsDir: string;
|
|
@@ -633,6 +849,20 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
633
849
|
provider?: string | undefined;
|
|
634
850
|
contextWindow?: number | undefined;
|
|
635
851
|
}, {
|
|
852
|
+
shell?: {
|
|
853
|
+
enabled?: boolean | undefined;
|
|
854
|
+
autoApproveSafe?: boolean | undefined;
|
|
855
|
+
defaultTimeoutMs?: number | undefined;
|
|
856
|
+
maxTimeoutMs?: number | undefined;
|
|
857
|
+
maxCaptureBytes?: number | undefined;
|
|
858
|
+
maxModelOutputChars?: number | undefined;
|
|
859
|
+
session?: {
|
|
860
|
+
maxOutputTokens?: number | undefined;
|
|
861
|
+
enabled?: boolean | undefined;
|
|
862
|
+
maxSessions?: number | undefined;
|
|
863
|
+
defaultYieldMs?: number | undefined;
|
|
864
|
+
} | undefined;
|
|
865
|
+
} | undefined;
|
|
636
866
|
model?: string | undefined;
|
|
637
867
|
provider?: string | undefined;
|
|
638
868
|
maxSteps?: number | undefined;
|
|
@@ -652,6 +882,14 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
652
882
|
keepRecentTokens?: number | undefined;
|
|
653
883
|
} | undefined;
|
|
654
884
|
}>>;
|
|
885
|
+
skills: z.ZodDefault<z.ZodObject<{
|
|
886
|
+
/** 额外的 skill 目录(canonical `.agents/skills` 之外的补充来源)。 */
|
|
887
|
+
dirs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
888
|
+
}, "strip", z.ZodTypeAny, {
|
|
889
|
+
dirs: string[];
|
|
890
|
+
}, {
|
|
891
|
+
dirs?: string[] | undefined;
|
|
892
|
+
}>>;
|
|
655
893
|
agents: z.ZodObject<{
|
|
656
894
|
dataDir: z.ZodString;
|
|
657
895
|
/** per-agent 环境变量:键为 agent name,值为 key-value 对 */
|
|
@@ -909,6 +1147,9 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
909
1147
|
llmModel?: string | undefined;
|
|
910
1148
|
confirmThreshold?: number | undefined;
|
|
911
1149
|
};
|
|
1150
|
+
skills: {
|
|
1151
|
+
dirs: string[];
|
|
1152
|
+
};
|
|
912
1153
|
browser: {
|
|
913
1154
|
instances: Record<string, {
|
|
914
1155
|
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
@@ -943,6 +1184,20 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
943
1184
|
}>;
|
|
944
1185
|
};
|
|
945
1186
|
runtime: {
|
|
1187
|
+
shell: {
|
|
1188
|
+
enabled: boolean;
|
|
1189
|
+
autoApproveSafe: boolean;
|
|
1190
|
+
defaultTimeoutMs: number;
|
|
1191
|
+
maxTimeoutMs: number;
|
|
1192
|
+
maxCaptureBytes: number;
|
|
1193
|
+
maxModelOutputChars: number;
|
|
1194
|
+
session: {
|
|
1195
|
+
maxOutputTokens: number;
|
|
1196
|
+
enabled: boolean;
|
|
1197
|
+
maxSessions: number;
|
|
1198
|
+
defaultYieldMs: number;
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
946
1201
|
maxSteps: number;
|
|
947
1202
|
turnTimeoutMs: number;
|
|
948
1203
|
threadsDir: string;
|
|
@@ -989,6 +1244,9 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
989
1244
|
preferOffline?: boolean | undefined;
|
|
990
1245
|
networkTimeoutMs?: number | undefined;
|
|
991
1246
|
} | undefined;
|
|
1247
|
+
skills?: {
|
|
1248
|
+
dirs?: string[] | undefined;
|
|
1249
|
+
} | undefined;
|
|
992
1250
|
browser?: {
|
|
993
1251
|
defaultInstance?: string | undefined;
|
|
994
1252
|
instances?: Record<string, {
|
|
@@ -1015,6 +1273,20 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
1015
1273
|
}> | undefined;
|
|
1016
1274
|
} | undefined;
|
|
1017
1275
|
runtime?: {
|
|
1276
|
+
shell?: {
|
|
1277
|
+
enabled?: boolean | undefined;
|
|
1278
|
+
autoApproveSafe?: boolean | undefined;
|
|
1279
|
+
defaultTimeoutMs?: number | undefined;
|
|
1280
|
+
maxTimeoutMs?: number | undefined;
|
|
1281
|
+
maxCaptureBytes?: number | undefined;
|
|
1282
|
+
maxModelOutputChars?: number | undefined;
|
|
1283
|
+
session?: {
|
|
1284
|
+
maxOutputTokens?: number | undefined;
|
|
1285
|
+
enabled?: boolean | undefined;
|
|
1286
|
+
maxSessions?: number | undefined;
|
|
1287
|
+
defaultYieldMs?: number | undefined;
|
|
1288
|
+
} | undefined;
|
|
1289
|
+
} | undefined;
|
|
1018
1290
|
model?: string | undefined;
|
|
1019
1291
|
provider?: string | undefined;
|
|
1020
1292
|
maxSteps?: number | undefined;
|
|
@@ -1037,6 +1309,7 @@ export declare const rollConfigSchema: z.ZodObject<{
|
|
|
1037
1309
|
}>;
|
|
1038
1310
|
export type RollConfig = z.infer<typeof rollConfigSchema>;
|
|
1039
1311
|
export type RuntimeConfig = z.infer<typeof runtimeConfigSchema>;
|
|
1312
|
+
export type SkillsConfig = z.infer<typeof skillsConfigSchema>;
|
|
1040
1313
|
export type RuntimeApprovalConfig = z.infer<typeof runtimeApprovalConfigSchema>;
|
|
1041
1314
|
export type BrowserConfig = z.infer<typeof browserConfigSchema>;
|
|
1042
1315
|
export type InstallConfig = z.infer<typeof installConfigSchema>;
|
package/dist/config/schema.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const t=["zhipin","yupao"],
|
|
1
|
+
import{z as e}from"zod";const t=["zhipin","yupao"],n=["managed-cdp","remote-cdp","existing-session"],o=["chrome","chromium","msedge"],i=["guarded","auto","deny"],a=["auto","confirm","deny"],r=["summarize","truncate"],s=e.string().trim().regex(/^#[\da-fA-F]{6}$/,"profileColor must be a hex RGB color such as #2563EB").transform(e=>e.toUpperCase());export const browserWindowBoundsSchema=e.object({x:e.number().int().optional(),y:e.number().int().optional(),width:e.number().int().positive().optional(),height:e.number().int().positive().optional()});export const providerConfigSchema=e.object({apiKey:e.string(),baseUrl:e.string().optional()});export const llmConfigSchema=e.object({defaultProvider:e.string(),defaultModel:e.string(),providers:e.record(e.string(),providerConfigSchema)});export const askConfigSchema=e.object({llmModel:e.string().optional(),confirmThreshold:e.number().optional()});export const runtimeApprovalConfigSchema=e.object({default:e.enum(i).default("guarded"),overrides:e.record(e.string(),e.enum(a)).default({})});export const runtimeCompactionConfigSchema=e.object({enabled:e.boolean().default(!0),strategy:e.enum(r).default("summarize"),threshold:e.number().min(.1).max(.95).default(.75),keepRecentTurns:e.number().int().min(1).default(4),keepRecentTokens:e.number().int().min(1).default(32e3)});export const runtimeThinkingLevels=["off","low","medium","high"];export const runtimeShellSessionConfigSchema=e.object({enabled:e.boolean().default(!1),maxSessions:e.number().int().min(1).max(64).default(8),defaultYieldMs:e.number().int().min(250).max(3e4).default(1e4),maxOutputTokens:e.number().int().min(256).default(1e4)});export const runtimeShellConfigSchema=e.object({enabled:e.boolean().default(!1),autoApproveSafe:e.boolean().default(!0),defaultTimeoutMs:e.number().int().min(1e3).max(6e5).default(1e4),maxTimeoutMs:e.number().int().min(1e3).max(6e5).default(6e5),maxCaptureBytes:e.number().int().min(16384).default(1048576),maxModelOutputChars:e.number().int().min(1e3).default(16e3),session:runtimeShellSessionConfigSchema.default({})});export const runtimeConfigSchema=e.object({provider:e.string().optional(),model:e.string().optional(),maxSteps:e.number().int().min(1).default(80),turnTimeoutMs:e.number().int().min(1e4).default(3e5),threadsDir:e.string().default("~/.roll-agent/threads"),contextWindow:e.number().int().min(1).optional(),thinkingLevel:e.enum(runtimeThinkingLevels).default("medium"),approval:runtimeApprovalConfigSchema.default({}),compaction:runtimeCompactionConfigSchema.default({}),shell:runtimeShellConfigSchema.default({})});export const skillsConfigSchema=e.object({dirs:e.array(e.string().trim().min(1)).default([])});export const agentsConfigSchema=e.object({dataDir:e.string(),env:e.record(e.string(),e.record(e.string(),e.string())).optional()});export const installConfigSchema=e.object({registry:e.string().trim().url().optional(),fetchRetries:e.number().int().min(0).max(10).default(3),preferOffline:e.boolean().default(!1),networkTimeoutMs:e.number().int().min(1e4).default(12e4)});export const browserInstanceConfigSchema=e.object({platform:e.enum(t).optional(),mode:e.enum(n).default("managed-cdp"),headless:e.boolean().optional(),cdpUrl:e.string().optional(),cdpHost:e.string().default("127.0.0.1"),cdpPort:e.number().int().min(1).max(65535).optional(),channel:e.enum(o).default("chrome"),executablePath:e.string().optional(),userDataDir:e.string().trim().min(1),sessionsDir:e.string().trim().min(1).optional(),args:e.array(e.string()).optional(),profileName:e.string().trim().min(1).optional(),profileColor:s.optional(),windowBounds:browserWindowBoundsSchema.optional(),trackingAgentId:e.string().trim().min(1).optional()}).superRefine((t,n)=>{"managed-cdp"===t.mode&&void 0===t.cdpPort&&n.addIssue({code:e.ZodIssueCode.custom,path:["cdpPort"],message:"managed-cdp browser instance requires cdpPort"}),"remote-cdp"!==t.mode&&"existing-session"!==t.mode||void 0!==t.cdpUrl||n.addIssue({code:e.ZodIssueCode.custom,path:["cdpUrl"],message:`${t.mode} browser instance requires cdpUrl`})});export const browserConfigSchema=e.object({defaultInstance:e.string().trim().min(1).optional(),instances:e.record(e.string(),browserInstanceConfigSchema).default({})}).superRefine((t,n)=>{const o=Object.entries(t.instances);void 0!==t.defaultInstance&&void 0===t.instances[t.defaultInstance]&&n.addIssue({code:e.ZodIssueCode.custom,path:["defaultInstance"],message:`defaultInstance "${t.defaultInstance}" is not declared in browser.instances`});const i=new Map,a=new Map;for(const[t,r]of o){if(void 0!==r.cdpPort){const o=i.get(r.cdpPort);void 0!==o?n.addIssue({code:e.ZodIssueCode.custom,path:["instances",t,"cdpPort"],message:`cdpPort ${String(r.cdpPort)} is already used by browser instance "${o}"`}):i.set(r.cdpPort,t)}const o=a.get(r.userDataDir);void 0!==o?n.addIssue({code:e.ZodIssueCode.custom,path:["instances",t,"userDataDir"],message:`userDataDir is already used by browser instance "${o}"`}):a.set(r.userDataDir,t)}});export const rollConfigSchema=e.object({llm:llmConfigSchema,ask:askConfigSchema,runtime:runtimeConfigSchema.default({}),skills:skillsConfigSchema.default({}),agents:agentsConfigSchema,install:installConfigSchema.default({}),browser:browserConfigSchema.default({})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Client as n}from"@modelcontextprotocol/sdk/client/index.js";import{StdioClientTransport as t}from"@modelcontextprotocol/sdk/client/stdio.js";import{StreamableHTTPClientTransport as e}from"@modelcontextprotocol/sdk/client/streamableHttp.js";import{registerSamplingHandler as o}from"./sampling-handler.js";const s=3e4,i="--disable-warning=ExperimentalWarning";export function buildStdioChildEnv(n){const t=
|
|
1
|
+
import{Client as n}from"@modelcontextprotocol/sdk/client/index.js";import{StdioClientTransport as t}from"@modelcontextprotocol/sdk/client/stdio.js";import{StreamableHTTPClientTransport as e}from"@modelcontextprotocol/sdk/client/streamableHttp.js";import{registerSamplingHandler as o}from"./sampling-handler.js";const s=3e4,i="--disable-warning=ExperimentalWarning";export function buildStdioChildEnv(n){const t={...process.env,...n??{}};return{...t,NODE_OPTIONS:r(t.NODE_OPTIONS,i),ROLL_AGENT_LOG_LEVEL:t.ROLL_AGENT_LOG_LEVEL??"warn",PYTHONUTF8:t.PYTHONUTF8??"1",PYTHONIOENCODING:t.PYTHONIOENCODING??"utf-8"}}function r(n,t){const e=n?.trim();if(!e)return t;const o=e.split(/\s+/);return o.includes("--no-warnings")||o.includes(t)?e:`${e} ${t}`}export function shouldSuppressStdioChildStderrLine(n){const t=n.trim();return t.includes("ExperimentalWarning:")||t.startsWith("(Use `node --trace-warnings")||/\[INFO\s*\]\s*\[[^\]]+\]\s*MCP Server running on stdio$/.test(t)}function c(n,e,o){const s=new t({command:n.command,args:[...n.args??[]],cwd:e,env:buildStdioChildEnv(o),stderr:"pipe"});return l(s),s}function l(n){const t=n.stderr;if(!t)return;let e="";const o=n=>{shouldSuppressStdioChildStderrLine(n)||process.stderr.write(`${n}\n`)};t.on("data",n=>{e+=n.toString();const t=e.split(/\r?\n/);e=t.pop()??"";for(const n of t)o(n)}),t.on("end",()=>{e.length>0&&(o(e),e="")})}export class McpClientManager{connections=new Map;async connect(t,i,r,l={}){const a=this.connections.get(t);if(a)return a.client;const d=l.timeoutMs??s,p=l.samplingModel?{sampling:{}}:{},m=new n({name:`roll-client-${t}`,version:"0.0.1"},{capabilities:p});l.samplingModel&&o(m,l.samplingModel);const u="streamable-http"===i.type?new e(new URL(i.endpoint)):c(i,r,l.env),h=m.connect(u);let O;const g=new Promise((n,e)=>{O=setTimeout(()=>e(new Error(`Connection to "${t}" timed out after ${d}ms`)),d)});try{await Promise.race([h,g])}catch(n){throw await m.close().catch(()=>{}),n}finally{clearTimeout(O)}return this.connections.set(t,{client:m,transportType:i.type}),m}async disconnect(n){const t=this.connections.get(n);t&&(await t.client.close(),this.connections.delete(n))}async disconnectAll(){const n=[...this.connections.keys()];await Promise.all(n.map(n=>this.disconnect(n)))}isConnected(n){return this.connections.has(n)}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AgentCatalogEntry } from "./catalog.ts";
|
|
2
|
+
import type { RollConfig } from "../config/schema.ts";
|
|
3
|
+
export interface CatalogCacheFile {
|
|
4
|
+
readonly checkedAt: number;
|
|
5
|
+
readonly registry: string;
|
|
6
|
+
readonly entries: readonly AgentCatalogEntry[];
|
|
7
|
+
}
|
|
8
|
+
export interface DiscoveredPackageInfo {
|
|
9
|
+
readonly description?: string;
|
|
10
|
+
readonly hasRollAgentManifest: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface DiscoveryCommandOptions {
|
|
13
|
+
readonly registry?: string;
|
|
14
|
+
readonly timeoutMs: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ResolveCatalogCollaborators {
|
|
17
|
+
readonly searchScopePackages?: (options: DiscoveryCommandOptions) => Promise<readonly string[]>;
|
|
18
|
+
readonly fetchPackageInfo?: (packageName: string, options: DiscoveryCommandOptions) => Promise<DiscoveredPackageInfo | undefined>;
|
|
19
|
+
readonly readCache?: () => CatalogCacheFile | undefined;
|
|
20
|
+
readonly writeCache?: (cache: CatalogCacheFile) => void;
|
|
21
|
+
readonly now?: () => number;
|
|
22
|
+
}
|
|
23
|
+
export interface ResolveCatalogOptions {
|
|
24
|
+
readonly allowNetwork?: boolean;
|
|
25
|
+
readonly forceRefresh?: boolean;
|
|
26
|
+
readonly registry?: string;
|
|
27
|
+
readonly timeoutMs?: number;
|
|
28
|
+
readonly collaborators?: ResolveCatalogCollaborators;
|
|
29
|
+
}
|
|
30
|
+
export declare function resolveAgentCatalog(config?: RollConfig, options?: ResolveCatalogOptions): Promise<readonly AgentCatalogEntry[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as t,mkdirSync as e,readFileSync as r,writeFileSync as n}from"node:fs";import{homedir as o}from"node:os";import{dirname as i,resolve as s}from"node:path";import{npmViewNetworkArgs as a,runPackageManager as c}from"../cli/utils/package-manager.js";import{getAgentCatalog as u}from"./catalog.js";const f="@roll-agent/",l=864e5,g=1e4,m=100;export async function resolveAgentCatalog(t,e={}){const r=u(t),n=e.collaborators??{},o=n.readCache??j,i=n.writeCache??S,s=n.now??Date.now,a=e.registry??"",c=o(),f=c?.registry===a?c:void 0;if(!e.forceRefresh&&f&&s()-f.checkedAt<l)return d(r,f.entries);if(!(e.allowNetwork??1))return d(r,f?.entries??[]);const g=await p(r,e,n);return void 0===g?d(r,f?.entries??[]):(i({checkedAt:s(),registry:a,entries:g}),d(r,g))}async function p(t,e,r){const n=r.searchScopePackages??N,o=r.fetchPackageInfo??k,i={...e.registry?{registry:e.registry}:{},timeoutMs:e.timeoutMs??g};let s;try{s=await n(i)}catch{return}const a=new Set(t.map(t=>t.packageName)),c=[...new Set(s)].filter(t=>t.startsWith(f)&&!a.has(t)),u=[];for(const t of c){let e;try{e=await o(t,i)}catch{continue}e?.hasRollAgentManifest&&u.push(h(t,e.description))}return u}function y(t){const e=t.slice(12),r=e.endsWith("-agent")?e.slice(0,-6):e;return r.length>0?r:e}function h(t,e){const r=e?.trim()??"";return{shortName:y(t),packageName:t,skillName:t.slice(12),description:r.length>0?r:t,requiredEnv:[]}}function d(t,e){const r=new Set(t.map(t=>t.packageName)),n=new Set(t.map(t=>t.shortName)),o=[...t];for(const t of e){if(r.has(t.packageName))continue;let e=t.shortName;n.has(e)&&(e=t.packageName.slice(12)),n.has(e)||(o.push(e===t.shortName?t:{...t,shortName:e}),r.add(t.packageName),n.add(e))}return o}async function N(t){const e=a({...t.registry?{registry:t.registry}:{}}),{stdout:r}=await c({command:"npm",args:["search",f.slice(0,-1),"--json",`--searchlimit=${String(m)}`,...e]},{timeout:t.timeoutMs}),n=r.trim();if(0===n.length)return[];const o=JSON.parse(n);return Array.isArray(o)?o.flatMap(t=>"object"==typeof t&&null!==t&&"name"in t&&"string"==typeof t.name?[t.name]:[]):[]}async function k(t,e){const r=a({...e.registry?{registry:e.registry}:{}}),{stdout:n}=await c({command:"npm",args:["view",t,"name","description","rollAgent","--json",...r]},{timeout:e.timeoutMs}),o=n.trim();if(0===o.length)return;const i=JSON.parse(o);if("object"!=typeof i||null===i)return;const s=i;return{..."string"==typeof s.description?{description:s.description}:{},hasRollAgentManifest:"object"==typeof s.rollAgent&&null!==s.rollAgent}}function w(){return s(o(),".roll-agent","catalog-cache.json")}function A(t){if("object"!=typeof t||null===t)return!1;const e=t;return"string"==typeof e.shortName&&"string"==typeof e.packageName&&"string"==typeof e.skillName&&"string"==typeof e.description&&Array.isArray(e.requiredEnv)&&e.requiredEnv.every(t=>"string"==typeof t)}function v(t){if("object"!=typeof t||null===t)return!1;const e=t;return"number"==typeof e.checkedAt&&"string"==typeof e.registry&&Array.isArray(e.entries)&&e.entries.every(t=>A(t))}function j(){const e=w();if(t(e))try{const t=JSON.parse(r(e,"utf-8"));return v(t)?t:void 0}catch{return}}function S(r){try{const o=w(),s=i(o);t(s)||e(s,{recursive:!0}),n(o,JSON.stringify(r),"utf-8")}catch{}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RollConfig } from "../config/schema.ts";
|
|
2
|
+
export interface AgentCatalogEntry {
|
|
3
|
+
readonly shortName: string;
|
|
4
|
+
readonly packageName: string;
|
|
5
|
+
readonly skillName: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly requiredEnv: readonly string[];
|
|
8
|
+
readonly minCoreVersion?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const OFFICIAL_AGENT_CATALOG: readonly [{
|
|
11
|
+
readonly shortName: "browser-use";
|
|
12
|
+
readonly packageName: "@roll-agent/browser-use-agent";
|
|
13
|
+
readonly skillName: "browser-use-agent";
|
|
14
|
+
readonly description: "浏览器操控 Agent。控制浏览器操作招聘平台:读取消息、发送签名回复、筛选候选人,并提供通用 AX snapshot 与元素点击/输入能力。";
|
|
15
|
+
readonly requiredEnv: readonly ["REPLY_AUTHORITY_URL", "REPLY_AUTHORITY_BEARER_TOKEN", "REPLY_AUTHORITY_KEYS_URL", "RECRUITMENT_EVENTS_DEFAULT_AGENT_ID", "RECRUITMENT_EVENTS_API_TOKEN"];
|
|
16
|
+
}, {
|
|
17
|
+
readonly shortName: "smart-reply";
|
|
18
|
+
readonly packageName: "@roll-agent/smart-reply-agent";
|
|
19
|
+
readonly skillName: "smart-reply-agent";
|
|
20
|
+
readonly description: "招聘智能回复 Agent。根据候选人消息和上下文,向 Reply Authority Service 请求已签名回复。";
|
|
21
|
+
readonly requiredEnv: readonly ["REPLY_AUTHORITY_URL", "REPLY_AUTHORITY_BEARER_TOKEN"];
|
|
22
|
+
}, {
|
|
23
|
+
readonly shortName: "reply-policy-tuner";
|
|
24
|
+
readonly packageName: "@roll-agent/reply-policy-tuner-agent";
|
|
25
|
+
readonly skillName: "reply-policy-tuner-agent";
|
|
26
|
+
readonly description: "策略 RSI 编排 Agent(Reply Policy Tuner)。评估、编排与更新招聘回复策略,update 带 evaluate 门禁,与 browser-use 协同使用。";
|
|
27
|
+
readonly requiredEnv: readonly ["REPLY_AUTHORITY_URL", "REPLY_AUTHORITY_BEARER_TOKEN"];
|
|
28
|
+
}, {
|
|
29
|
+
readonly shortName: "octopus";
|
|
30
|
+
readonly packageName: "@roll-agent/octopus-agent";
|
|
31
|
+
readonly skillName: "octopus-agent";
|
|
32
|
+
readonly description: "丸子 Agent(Octopus)。把自然语言问题转换为只读 SQL,并通过 Sponge MCP Server 校验和执行。";
|
|
33
|
+
readonly requiredEnv: readonly ["SPONGE_MCP_BASE_URL", "SPONGE_MCP_ACCESS_TOKEN"];
|
|
34
|
+
}];
|
|
35
|
+
export type OfficialAgentShortName = (typeof OFFICIAL_AGENT_CATALOG)[number]["shortName"];
|
|
36
|
+
export declare function getAgentCatalog(_config?: RollConfig): readonly AgentCatalogEntry[];
|
|
37
|
+
export interface CatalogEntryMatch {
|
|
38
|
+
readonly entry: AgentCatalogEntry;
|
|
39
|
+
readonly versionSpec?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function findCatalogEntry(catalog: readonly AgentCatalogEntry[], input: string): CatalogEntryMatch | undefined;
|
|
42
|
+
export declare function catalogPackageSpec(entry: AgentCatalogEntry, versionSpec?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parsePackageName as e}from"./source.js";export const OFFICIAL_AGENT_CATALOG=[{shortName:"browser-use",packageName:"@roll-agent/browser-use-agent",skillName:"browser-use-agent",description:"浏览器操控 Agent。控制浏览器操作招聘平台:读取消息、发送签名回复、筛选候选人,并提供通用 AX snapshot 与元素点击/输入能力。",requiredEnv:["REPLY_AUTHORITY_URL","REPLY_AUTHORITY_BEARER_TOKEN","REPLY_AUTHORITY_KEYS_URL","RECRUITMENT_EVENTS_DEFAULT_AGENT_ID","RECRUITMENT_EVENTS_API_TOKEN"]},{shortName:"smart-reply",packageName:"@roll-agent/smart-reply-agent",skillName:"smart-reply-agent",description:"招聘智能回复 Agent。根据候选人消息和上下文,向 Reply Authority Service 请求已签名回复。",requiredEnv:["REPLY_AUTHORITY_URL","REPLY_AUTHORITY_BEARER_TOKEN"]},{shortName:"reply-policy-tuner",packageName:"@roll-agent/reply-policy-tuner-agent",skillName:"reply-policy-tuner-agent",description:"策略 RSI 编排 Agent(Reply Policy Tuner)。评估、编排与更新招聘回复策略,update 带 evaluate 门禁,与 browser-use 协同使用。",requiredEnv:["REPLY_AUTHORITY_URL","REPLY_AUTHORITY_BEARER_TOKEN"]},{shortName:"octopus",packageName:"@roll-agent/octopus-agent",skillName:"octopus-agent",description:"丸子 Agent(Octopus)。把自然语言问题转换为只读 SQL,并通过 Sponge MCP Server 校验和执行。",requiredEnv:["SPONGE_MCP_BASE_URL","SPONGE_MCP_ACCESS_TOKEN"]}];export function getAgentCatalog(e){return OFFICIAL_AGENT_CATALOG}export function findCatalogEntry(t,r){const a=r.trim();if(0===a.length)return;const n=e(a),o=a.length>n.length?a.slice(n.length+1):void 0,l=o&&o.length>0?o:void 0,E=t.find(e=>e.shortName===n||e.packageName===n||e.skillName===n);return E?{entry:E,...l?{versionSpec:l}:{}}:void 0}export function catalogPackageSpec(e,t){return t?`${e.packageName}@${t}`:e.packageName}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as t,existsSync as r,realpathSync as n}from"node:fs";import{readJsonFile as e}from"./json-file.js";import{resolve as o,sep as i}from"node:path";import a from"gray-matter";import{z as s}from"zod";import{parse as p}from"yaml";import{createDefaultRuntimeForTransport as
|
|
1
|
+
import{readFileSync as t,existsSync as r,realpathSync as n}from"node:fs";import{readJsonFile as e}from"./json-file.js";import{resolve as o,sep as i}from"node:path";import a from"gray-matter";import{z as s}from"zod";import{parse as p}from"yaml";import{createDefaultRuntimeForTransport as l}from"../types/agent.js";const d="SKILL.md",m="package.json",c=s.object({name:s.string().min(1),purpose:s.string().optional(),example:s.string().optional(),default:s.string().optional()}),u=s.object({required:s.array(c).optional(),optional:s.array(c).optional()}),f=s.object({required:s.boolean().optional(),purpose:s.string().optional(),example:s.string().optional(),default:s.string().optional()}),h=s.object({env:s.record(f).optional()});export function discoverAgent(n){const e=o(n),i=o(e,d);if(!r(i))throw new Error(`SKILL.md not found in ${e}`);const s=t(i,"utf-8"),{data:p,content:m}=a(s),c=j(e),u=p,f=u.name,h=u.description;if("string"!=typeof f||0===f.length)throw new Error(`SKILL.md missing required field "name" in ${i}`);if("string"!=typeof h||0===h.length)throw new Error(`SKILL.md missing required field "description" in ${i}`);const g=u.metadata??{},w={};for(const[t,r]of Object.entries(g))w[t]=String(r);const v="string"==typeof u.license?u.license:void 0,b="string"==typeof u.compatibility?u.compatibility:void 0,$=y(e,w,i),S={name:f,description:h,...v?{license:v}:{},...b?{compatibility:b}:{},metadata:w,...$?{env:$}:{}},I=c?E(c):void 0;if(I&&q(w)){if(!x(L(w),I.transport))throw new Error(`Conflicting runtime metadata in ${i}: package.json#rollAgent and SKILL.md metadata disagree`)}const K=I?.transport??L(w);return{skill:S,transport:K,runtime:I?.runtime??l(K),skillPath:i,skillBody:m.trim()}}function g(t,r){if(void 0===t)return;if(A(t)&&"env"in t)return w(t,r);const n=u.safeParse(t);if(!n.success){const t=n.error.issues.map(t=>`${t.path.length>0?`env.${t.path.join(".")}`:"env"}: ${t.message}`).join("; ");throw new Error(`SKILL.md has invalid "env" declaration in ${r}: ${t}`)}const e=n.data;return e.required||e.optional?{...e.required?{required:e.required.map(b)}:{},...e.optional?{optional:e.optional.map(b)}:{}}:void 0}function w(t,r){const n=h.safeParse(t);if(!n.success){const t=n.error.issues.map(t=>`${t.path.length>0?t.path.join("."):"env"}: ${t.message}`).join("; ");throw new Error(`SKILL.md has invalid "env" declaration in ${r}: ${t}`)}const e=n.data.env;if(!e)return;const o=[],i=[];for(const[t,n]of Object.entries(e)){if(0===t.length)throw new Error(`SKILL.md has invalid "env" declaration in ${r}: env key is empty`);const e=$(t,n);!0===n.required?o.push(e):i.push(e)}return 0!==o.length||0!==i.length?{...o.length>0?{required:o}:{},...i.length>0?{optional:i}:{}}:void 0}function y(e,i,a){const s=i["roll-env-file"];if(!s)return;const l=o(e,s);if(!v(e,l))throw new Error(`SKILL.md roll-env-file must stay within agent directory: ${a}`);if(!r(l))throw new Error(`SKILL.md roll-env-file not found: ${l}`);const d=n(e),m=n(l);if(!v(d,m))throw new Error(`SKILL.md roll-env-file must stay within agent directory: ${a}`);let c;try{c=p(t(m,"utf-8"))}catch(t){throw new Error(`Failed to parse roll-env-file for ${a}: ${t instanceof Error?t.message:String(t)}`)}return g(c,m)}function v(t,r){return r===t||r.startsWith(`${t}${i}`)}function b(t){return{name:t.name,...t.purpose?{purpose:t.purpose}:{},...t.example?{example:t.example}:{},...t.default?{default:t.default}:{}}}function $(t,r){return{name:t,...r.purpose?{purpose:r.purpose}:{},...r.example?{example:r.example}:{},...r.default?{default:r.default}:{}}}function L(t){if("streamable-http"===("streamable-http"===t["roll-transport"]?"streamable-http":"stdio")){const r=t["roll-endpoint"];if(!r)throw new Error('SKILL.md declares streamable-http transport but missing "roll-endpoint"');return{type:"streamable-http",endpoint:r}}const r=(t["roll-command"]??"node --experimental-strip-types src/index.ts").split(/\s+/),n=r[0],e=r.slice(1);if(!n)throw new Error("Invalid roll-command in SKILL.md");return e.length>0?{type:"stdio",command:n,args:e}:{type:"stdio",command:n}}function j(t){const n=o(t,m);if(!r(n))return;let i;try{i=e(n)}catch{throw new Error(`Invalid package.json in ${t}`)}if(!A(i)||!A(i.rollAgent))return;const a=i.rollAgent,s=A(a.runtime)?a.runtime:void 0;if(!s)throw new Error(`package.json#rollAgent.runtime is required in ${n}`);const p={runtime:{ownership:K(s.ownership)??"",transport:K(s.transport)??""}};if(A(a.start)){const t=K(a.start.command),r=k(a.start.args);(t||r)&&(p.start={...t?{command:t}:{},...r?{args:r}:{}})}if(A(a.endpoint)){const t=K(a.endpoint.url),r=K(a.endpoint.path),n="number"==typeof a.endpoint.port?a.endpoint.port:void 0;(t||r||void 0!==n)&&(p.endpoint={...t?{url:t}:{},...r?{path:r}:{},...void 0!==n?{port:n}:{}})}if(A(a.setup)&&A(a.setup.playwright)){const t=k(a.setup.playwright.browsers);t&&t.length>0&&(p.setup={playwright:{browsers:t}})}return p}function E(t){const{ownership:r,transport:n}=t.runtime;if("on-demand"===r&&"stdio"===n){const r=t.start?.command;if(!r)throw new Error("package.json#rollAgent.start.command is required for stdio runtime");const n=t.start?.args;return{transport:n?{type:"stdio",command:r,args:n}:{type:"stdio",command:r},runtime:{ownership:"on-demand"}}}if("core-managed"===r&&"streamable-http"===n){const r=t.start?.command,n=S(t),e=t.endpoint?.path,o=t.endpoint?.port;if(!r||!e||void 0===o)throw new Error("package.json#rollAgent for core-managed streamable-http requires start.command, endpoint.path and endpoint.port");const i=t.start?.args,a=t.setup?.playwright?.browsers;return{transport:{type:"streamable-http",endpoint:n},runtime:{ownership:"core-managed",start:i?{command:r,args:i}:{command:r},endpoint:{path:e,port:o},...a&&a.length>0?{setup:{playwright:{browsers:a}}}:{}}}}if("external-managed"===r&&"streamable-http"===n)return{transport:{type:"streamable-http",endpoint:S(t)},runtime:{ownership:"external-managed"}};throw new Error(`Unsupported package.json#rollAgent runtime combination: ${r}/${n}`)}function S(t){const r=t.endpoint?.url;if(r)return r;const n=t.endpoint?.path,e=t.endpoint?.port;if(!n||void 0===e)throw new Error("package.json#rollAgent.streamable-http requires endpoint.url or endpoint.path + endpoint.port");return I(n,e)}function I(t,r){const n=t.startsWith("/")?t:`/${t}`;return`http://127.0.0.1:${String(r)}${n}`}function q(t){return"string"==typeof t["roll-transport"]||"string"==typeof t["roll-endpoint"]||"string"==typeof t["roll-command"]}function x(t,r){if(t.type!==r.type)return!1;if("streamable-http"===t.type&&"streamable-http"===r.type)return t.endpoint===r.endpoint;if("stdio"!==t.type||"stdio"!==r.type)return!1;const n=t.args??[],e=r.args??[];return t.command===r.command&&n.join("\0")===e.join("\0")}function K(t){return"string"==typeof t&&t.length>0?t:void 0}function k(t){if(!Array.isArray(t))return;const r=t.filter(t=>"string"==typeof t);return r.length>0?r:void 0}function A(t){return"object"==typeof t&&null!==t}
|