@roll-agent/core 0.7.1 → 0.9.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/commands/agent-info.js +1 -1
- package/dist/cli/commands/agent-install.js +1 -1
- package/dist/cli/commands/browser-clear-data.d.ts +67 -0
- package/dist/cli/commands/browser-clear-data.js +1 -0
- package/dist/cli/commands/browser-stop.d.ts +81 -0
- package/dist/cli/commands/browser-stop.js +1 -0
- package/dist/cli/commands/browser.d.ts +2 -0
- package/dist/cli/commands/browser.js +1 -0
- package/dist/cli/commands/doctor.d.ts +1 -0
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/update.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/config/browser-inspection.d.ts +4 -0
- package/dist/config/browser-inspection.js +1 -0
- package/dist/config/defaults.js +1 -1
- package/dist/config/helpers.js +1 -1
- package/dist/config/key-codec.js +1 -1
- package/dist/config/loader.js +1 -1
- package/dist/config/runtime-env.d.ts +211 -0
- package/dist/config/runtime-env.js +1 -1
- package/dist/config/schema.d.ts +613 -0
- package/dist/config/schema.js +1 -1
- package/dist/mcp/agent-diagnostics.d.ts +2 -1
- package/dist/mcp/agent-diagnostics.js +1 -1
- package/package.json +1 -1
|
@@ -61,6 +61,88 @@ export declare const BrowserUsePolicyWarningDiagnosticSchema: z.ZodObject<{
|
|
|
61
61
|
code: string;
|
|
62
62
|
message: string;
|
|
63
63
|
}>;
|
|
64
|
+
export declare const BrowserInstanceStatusDiagnosticSchema: z.ZodObject<{
|
|
65
|
+
id: z.ZodString;
|
|
66
|
+
platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
|
|
67
|
+
mode: z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>;
|
|
68
|
+
cdp: z.ZodObject<{
|
|
69
|
+
endpoint: z.ZodString;
|
|
70
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
versionReachable: z.ZodBoolean;
|
|
72
|
+
listReachable: z.ZodBoolean;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
endpoint: string;
|
|
75
|
+
versionReachable: boolean;
|
|
76
|
+
listReachable: boolean;
|
|
77
|
+
port?: number | undefined;
|
|
78
|
+
}, {
|
|
79
|
+
endpoint: string;
|
|
80
|
+
versionReachable: boolean;
|
|
81
|
+
listReachable: boolean;
|
|
82
|
+
port?: number | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
profile: z.ZodObject<{
|
|
85
|
+
userDataDir: z.ZodOptional<z.ZodString>;
|
|
86
|
+
exists: z.ZodBoolean;
|
|
87
|
+
writable: z.ZodBoolean;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
exists: boolean;
|
|
90
|
+
writable: boolean;
|
|
91
|
+
userDataDir?: string | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
exists: boolean;
|
|
94
|
+
writable: boolean;
|
|
95
|
+
userDataDir?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
tracking: z.ZodObject<{
|
|
98
|
+
source: z.ZodEnum<["instance", "default-env", "missing"]>;
|
|
99
|
+
agentIdFingerprint: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
source: "instance" | "missing" | "default-env";
|
|
102
|
+
agentIdFingerprint?: string | undefined;
|
|
103
|
+
}, {
|
|
104
|
+
source: "instance" | "missing" | "default-env";
|
|
105
|
+
agentIdFingerprint?: string | undefined;
|
|
106
|
+
}>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
109
|
+
id: string;
|
|
110
|
+
cdp: {
|
|
111
|
+
endpoint: string;
|
|
112
|
+
versionReachable: boolean;
|
|
113
|
+
listReachable: boolean;
|
|
114
|
+
port?: number | undefined;
|
|
115
|
+
};
|
|
116
|
+
profile: {
|
|
117
|
+
exists: boolean;
|
|
118
|
+
writable: boolean;
|
|
119
|
+
userDataDir?: string | undefined;
|
|
120
|
+
};
|
|
121
|
+
tracking: {
|
|
122
|
+
source: "instance" | "missing" | "default-env";
|
|
123
|
+
agentIdFingerprint?: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
128
|
+
id: string;
|
|
129
|
+
cdp: {
|
|
130
|
+
endpoint: string;
|
|
131
|
+
versionReachable: boolean;
|
|
132
|
+
listReachable: boolean;
|
|
133
|
+
port?: number | undefined;
|
|
134
|
+
};
|
|
135
|
+
profile: {
|
|
136
|
+
exists: boolean;
|
|
137
|
+
writable: boolean;
|
|
138
|
+
userDataDir?: string | undefined;
|
|
139
|
+
};
|
|
140
|
+
tracking: {
|
|
141
|
+
source: "instance" | "missing" | "default-env";
|
|
142
|
+
agentIdFingerprint?: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
145
|
+
}>;
|
|
64
146
|
export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
65
147
|
effectiveEnvSources: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
66
148
|
present: z.ZodBoolean;
|
|
@@ -121,11 +203,115 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
121
203
|
code: string;
|
|
122
204
|
message: string;
|
|
123
205
|
}>, "many">>;
|
|
206
|
+
defaultInstanceId: z.ZodOptional<z.ZodString>;
|
|
207
|
+
primaryInstanceId: z.ZodOptional<z.ZodString>;
|
|
208
|
+
instances: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
platform: z.ZodOptional<z.ZodEnum<["zhipin", "yupao"]>>;
|
|
211
|
+
mode: z.ZodEnum<["managed-cdp", "remote-cdp", "existing-session"]>;
|
|
212
|
+
cdp: z.ZodObject<{
|
|
213
|
+
endpoint: z.ZodString;
|
|
214
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
215
|
+
versionReachable: z.ZodBoolean;
|
|
216
|
+
listReachable: z.ZodBoolean;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
endpoint: string;
|
|
219
|
+
versionReachable: boolean;
|
|
220
|
+
listReachable: boolean;
|
|
221
|
+
port?: number | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
endpoint: string;
|
|
224
|
+
versionReachable: boolean;
|
|
225
|
+
listReachable: boolean;
|
|
226
|
+
port?: number | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
profile: z.ZodObject<{
|
|
229
|
+
userDataDir: z.ZodOptional<z.ZodString>;
|
|
230
|
+
exists: z.ZodBoolean;
|
|
231
|
+
writable: z.ZodBoolean;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
exists: boolean;
|
|
234
|
+
writable: boolean;
|
|
235
|
+
userDataDir?: string | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
exists: boolean;
|
|
238
|
+
writable: boolean;
|
|
239
|
+
userDataDir?: string | undefined;
|
|
240
|
+
}>;
|
|
241
|
+
tracking: z.ZodObject<{
|
|
242
|
+
source: z.ZodEnum<["instance", "default-env", "missing"]>;
|
|
243
|
+
agentIdFingerprint: z.ZodOptional<z.ZodString>;
|
|
244
|
+
}, "strip", z.ZodTypeAny, {
|
|
245
|
+
source: "instance" | "missing" | "default-env";
|
|
246
|
+
agentIdFingerprint?: string | undefined;
|
|
247
|
+
}, {
|
|
248
|
+
source: "instance" | "missing" | "default-env";
|
|
249
|
+
agentIdFingerprint?: string | undefined;
|
|
250
|
+
}>;
|
|
251
|
+
}, "strip", z.ZodTypeAny, {
|
|
252
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
253
|
+
id: string;
|
|
254
|
+
cdp: {
|
|
255
|
+
endpoint: string;
|
|
256
|
+
versionReachable: boolean;
|
|
257
|
+
listReachable: boolean;
|
|
258
|
+
port?: number | undefined;
|
|
259
|
+
};
|
|
260
|
+
profile: {
|
|
261
|
+
exists: boolean;
|
|
262
|
+
writable: boolean;
|
|
263
|
+
userDataDir?: string | undefined;
|
|
264
|
+
};
|
|
265
|
+
tracking: {
|
|
266
|
+
source: "instance" | "missing" | "default-env";
|
|
267
|
+
agentIdFingerprint?: string | undefined;
|
|
268
|
+
};
|
|
269
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
270
|
+
}, {
|
|
271
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
272
|
+
id: string;
|
|
273
|
+
cdp: {
|
|
274
|
+
endpoint: string;
|
|
275
|
+
versionReachable: boolean;
|
|
276
|
+
listReachable: boolean;
|
|
277
|
+
port?: number | undefined;
|
|
278
|
+
};
|
|
279
|
+
profile: {
|
|
280
|
+
exists: boolean;
|
|
281
|
+
writable: boolean;
|
|
282
|
+
userDataDir?: string | undefined;
|
|
283
|
+
};
|
|
284
|
+
tracking: {
|
|
285
|
+
source: "instance" | "missing" | "default-env";
|
|
286
|
+
agentIdFingerprint?: string | undefined;
|
|
287
|
+
};
|
|
288
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
289
|
+
}>, "many">>;
|
|
124
290
|
}, "strip", z.ZodTypeAny, {
|
|
125
291
|
effectiveEnvSources: Record<string, {
|
|
126
292
|
present: boolean;
|
|
127
293
|
fingerprint?: string | undefined;
|
|
128
294
|
}>;
|
|
295
|
+
instances?: {
|
|
296
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
297
|
+
id: string;
|
|
298
|
+
cdp: {
|
|
299
|
+
endpoint: string;
|
|
300
|
+
versionReachable: boolean;
|
|
301
|
+
listReachable: boolean;
|
|
302
|
+
port?: number | undefined;
|
|
303
|
+
};
|
|
304
|
+
profile: {
|
|
305
|
+
exists: boolean;
|
|
306
|
+
writable: boolean;
|
|
307
|
+
userDataDir?: string | undefined;
|
|
308
|
+
};
|
|
309
|
+
tracking: {
|
|
310
|
+
source: "instance" | "missing" | "default-env";
|
|
311
|
+
agentIdFingerprint?: string | undefined;
|
|
312
|
+
};
|
|
313
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
314
|
+
}[] | undefined;
|
|
129
315
|
security?: {
|
|
130
316
|
domainAllowlist: string[];
|
|
131
317
|
maxPageContentBytes: number;
|
|
@@ -143,11 +329,33 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
143
329
|
code: string;
|
|
144
330
|
message: string;
|
|
145
331
|
}[] | undefined;
|
|
332
|
+
defaultInstanceId?: string | undefined;
|
|
333
|
+
primaryInstanceId?: string | undefined;
|
|
146
334
|
}, {
|
|
147
335
|
effectiveEnvSources: Record<string, {
|
|
148
336
|
present: boolean;
|
|
149
337
|
fingerprint?: string | undefined;
|
|
150
338
|
}>;
|
|
339
|
+
instances?: {
|
|
340
|
+
mode: "managed-cdp" | "remote-cdp" | "existing-session";
|
|
341
|
+
id: string;
|
|
342
|
+
cdp: {
|
|
343
|
+
endpoint: string;
|
|
344
|
+
versionReachable: boolean;
|
|
345
|
+
listReachable: boolean;
|
|
346
|
+
port?: number | undefined;
|
|
347
|
+
};
|
|
348
|
+
profile: {
|
|
349
|
+
exists: boolean;
|
|
350
|
+
writable: boolean;
|
|
351
|
+
userDataDir?: string | undefined;
|
|
352
|
+
};
|
|
353
|
+
tracking: {
|
|
354
|
+
source: "instance" | "missing" | "default-env";
|
|
355
|
+
agentIdFingerprint?: string | undefined;
|
|
356
|
+
};
|
|
357
|
+
platform?: "zhipin" | "yupao" | undefined;
|
|
358
|
+
}[] | undefined;
|
|
151
359
|
security?: {
|
|
152
360
|
domainAllowlist: string[];
|
|
153
361
|
maxPageContentBytes: number;
|
|
@@ -165,11 +373,14 @@ export declare const AgentRuntimeEnvDiagnosticPayloadSchema: z.ZodObject<{
|
|
|
165
373
|
code: string;
|
|
166
374
|
message: string;
|
|
167
375
|
}[] | undefined;
|
|
376
|
+
defaultInstanceId?: string | undefined;
|
|
377
|
+
primaryInstanceId?: string | undefined;
|
|
168
378
|
}>;
|
|
169
379
|
export type AgentRuntimeEnvDiagnosticPayload = z.infer<typeof AgentRuntimeEnvDiagnosticPayloadSchema>;
|
|
170
380
|
export type BrowserSecurityDiagnostic = z.infer<typeof BrowserSecurityDiagnosticSchema>;
|
|
171
381
|
export type BrowserUseToolPolicyDiagnostic = z.infer<typeof BrowserUseToolPolicyDiagnosticSchema>;
|
|
172
382
|
export type BrowserUsePolicyWarningDiagnostic = z.infer<typeof BrowserUsePolicyWarningDiagnosticSchema>;
|
|
383
|
+
export type BrowserInstanceStatusDiagnostic = z.infer<typeof BrowserInstanceStatusDiagnosticSchema>;
|
|
173
384
|
export type AgentRuntimeEnvInspection = {
|
|
174
385
|
readonly status: "verified";
|
|
175
386
|
readonly toolName: DiagnosticToolName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as e}from"node:crypto";import{z as n}from"zod";export const DIAGNOSTIC_TOOL_CANDIDATES=["diagnostic_status","browser_status"];const t=new Set(
|
|
1
|
+
import{createHash as e}from"node:crypto";import{z as n}from"zod";export const DIAGNOSTIC_TOOL_CANDIDATES=["diagnostic_status","browser_status"];const t=[...DIAGNOSTIC_TOOL_CANDIDATES,"browser_stop"],i=new Set(t),s=/^[0-9a-f]{8}$/;export const EffectiveEnvSourceSchema=n.object({present:n.boolean(),fingerprint:n.string().regex(s).optional()});export const BrowserSecurityDiagnosticSchema=n.object({domainAllowlist:n.array(n.string()),maxPageContentBytes:n.number(),maxSnapshotNodes:n.number(),actionPolicy:n.enum(["log","deny","confirm"]),foregroundPolicy:n.enum(["when-minimized","always","never"]).default("when-minimized")});export const BrowserUseToolPolicyDiagnosticSchema=n.object({approvalTtlMs:n.number(),tools:n.record(n.object({policy:n.enum(["log","deny","confirm"])}))});export const BrowserUsePolicyWarningDiagnosticSchema=n.object({code:n.string(),message:n.string()});export const BrowserInstanceStatusDiagnosticSchema=n.object({id:n.string(),platform:n.enum(["zhipin","yupao"]).optional(),mode:n.enum(["managed-cdp","remote-cdp","existing-session"]),cdp:n.object({endpoint:n.string(),port:n.number().int().min(1).max(65535).optional(),versionReachable:n.boolean(),listReachable:n.boolean()}),profile:n.object({userDataDir:n.string().optional(),exists:n.boolean(),writable:n.boolean()}),tracking:n.object({source:n.enum(["instance","default-env","missing"]),agentIdFingerprint:n.string().regex(s).optional()})});export const AgentRuntimeEnvDiagnosticPayloadSchema=n.object({effectiveEnvSources:n.record(EffectiveEnvSourceSchema),security:BrowserSecurityDiagnosticSchema.optional(),toolPolicy:BrowserUseToolPolicyDiagnosticSchema.optional(),policyWarnings:n.array(BrowserUsePolicyWarningDiagnosticSchema).optional(),defaultInstanceId:n.string().optional(),primaryInstanceId:n.string().optional(),instances:n.array(BrowserInstanceStatusDiagnosticSchema).optional()});export function shouldSkipRuntimeReadinessForTool(e){return i.has(e)}export function inspectAgentRuntimeEnvRequirements(e,n,t){const i=e.items.map(e=>{const i=n?.[e.name],s=void 0!==i;if("unverified"===t.status)return{...e,configuredInAgentsEnv:s,runtime:{verified:!1,reason:t.reason,message:t.message}};const o=t.payload.effectiveEnvSources[e.name];return o?.present?{...e,configuredInAgentsEnv:s,runtime:{verified:!0,present:!0,...void 0!==o.fingerprint?{fingerprint:o.fingerprint}:{},matchesAgentsEnv:void 0!==i&&void 0!==o.fingerprint&&r(i)===o.fingerprint}}:{...e,configuredInAgentsEnv:s,runtime:{verified:!0,present:!1}}});return{items:i,inspection:t,missingRequired:i.filter(e=>e.required&&o(e)),ephemeralItems:i.filter(a)}}export function summarizeAgentRuntimeEnvReport(e){if(e.missingRequired.length>0){const n=u(e.missingRequired);return"verified"===e.inspection.status?{status:"fail",message:`运行态缺失: ${n}`}:{status:"fail",message:`${c(e)};${e.inspection.message}`}}if(e.ephemeralItems.length>0)return{status:"warn",message:`运行态漂移: ${u(e.ephemeralItems)}`};if("verified"===e.inspection.status)return{status:"ok",message:`声明的必填项已在运行态生效(${e.inspection.toolName})`};const n=e.items.filter(e=>e.required&&"process.env"===e.source);return n.length>0?{status:"warn",message:`依赖当前 shell 环境: ${u(n)};${e.inspection.message}`}:"diagnostic-tool-unavailable"===e.inspection.reason?{status:"ok",message:`声明的必填项已满足(${e.inspection.message})`}:{status:"warn",message:`声明的必填项已满足;${e.inspection.message}`}}export function formatAgentEnvDeclarationSource(e){switch(e.source){case"agents.env":return"已配置于 agents.env";case"process.env":return"仅当前 shell 环境";case"default":return`默认值 (${e.default})`;case"missing":return"缺失"}}export function formatAgentRuntimeVerification(e){return"verified"===e.inspection.status?`已验证(${e.inspection.toolName})`:`未校验(${e.inspection.message})`}export function formatAgentEnvRuntimeStatus(e){if(e.runtime.verified)return e.runtime.present?e.runtime.matchesAgentsEnv?"✓ from yaml (stable)":e.configuredInAgentsEnv?"⚠ differs from yaml (ephemeral)":"⚠ from shell (ephemeral)":"default"===e.source?"未设置(使用默认值)":"process.env"===e.source?"✗ 当前运行 agent 未看到该变量":"✗ missing"}function r(n){return e("sha256").update(n).digest("hex").slice(0,8)}function o(e){return e.runtime.verified?!e.runtime.present&&"default"!==e.source:"missing"===e.source}function a(e){return e.runtime.verified&&e.runtime.present&&!e.runtime.matchesAgentsEnv}function c(e){return`缺少必填项: ${u(e.missingRequired)}`}function u(e){return e.map(e=>e.name).join(", ")}
|