@layernorm/overlay-agent-bridge-protocol 0.3.6 → 0.3.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/dist/index.d.ts +310 -169
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +490 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,8BAA8B,EAAG,CAAU,CAAA;AACxD,eAAO,MAAM,qBAAqB,KAAK,CAAA;AACvC,eAAO,MAAM,iBAAiB,QAAa,CAAA;AAC3C,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,eAAO,MAAM,qBAAqB,QAAa,CAAA;AAC/C,eAAO,MAAM,sBAAsB,QAAa,CAAA;AAKhD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;IAQhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWzB,CAAA;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOxB,CAAA;AACX,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,uBAAuB;;;;;;;;;;;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AA;IAC5B,KAAK,EAAE,gBAAgB,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B,KAAK,CAAC,EAAE,WAAW,EAAE,CAAA;IACrB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAC9B,CAAA;AAID;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,eAAe,CAmBrF;AAED,qIAAqI;AACrI,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAGlF,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,16 @@ export const hostCapabilitiesSchema = z.object({
|
|
|
36
36
|
filesystem: filesystemGrantSchema,
|
|
37
37
|
maxConcurrentRuns: z.number().int().positive().max(1_000),
|
|
38
38
|
}).strict();
|
|
39
|
+
/** A host asks for the provider credentials of one run; the secret is never part of a stored command. */
|
|
40
|
+
export const runCredentialsRequestSchema = z.object({
|
|
41
|
+
protocolVersion: z.literal(OVERLAY_AGENT_PROTOCOL_VERSION),
|
|
42
|
+
runId: identifier,
|
|
43
|
+
}).strict();
|
|
44
|
+
export const runCredentialsResponseSchema = z.object({
|
|
45
|
+
protocolVersion: z.literal(OVERLAY_AGENT_PROTOCOL_VERSION),
|
|
46
|
+
/** Environment variables for the agent process of this run only. */
|
|
47
|
+
env: z.record(z.string().min(1).max(128), z.string().min(1).max(8_192)),
|
|
48
|
+
}).strict();
|
|
39
49
|
export const enrollmentRequestSchema = z.object({
|
|
40
50
|
code: z.string().trim().min(16).max(512),
|
|
41
51
|
name: z.string().trim().min(1).max(200),
|
|
@@ -71,6 +81,7 @@ export const environmentCredentialResponseSchema = z.object({
|
|
|
71
81
|
'agent:events:write',
|
|
72
82
|
'agent:artifacts:write',
|
|
73
83
|
'agent:credentials:refresh',
|
|
84
|
+
'agent:run-credentials',
|
|
74
85
|
])).min(1),
|
|
75
86
|
token: z.string().trim().min(32).max(512),
|
|
76
87
|
expiresAt: z.number().int().positive(),
|
|
@@ -218,4 +229,483 @@ export const eventAcknowledgementSchema = z.discriminatedUnion('accepted', [
|
|
|
218
229
|
z.object({ protocolVersion: z.literal(OVERLAY_AGENT_PROTOCOL_VERSION), accepted: z.literal(true), acknowledgedSequence: z.number().int().nonnegative() }).strict(),
|
|
219
230
|
z.object({ protocolVersion: z.literal(OVERLAY_AGENT_PROTOCOL_VERSION), accepted: z.literal(false), expectedSequence: z.number().int().positive() }).strict(),
|
|
220
231
|
]);
|
|
232
|
+
// ---- Agent profiles (imported Claude Code / Codex config) ----
|
|
233
|
+
/**
|
|
234
|
+
* Agent profiles: the part of a person's Claude Code or Codex setup that can move to an agent on Overlay Cloud
|
|
235
|
+
* (instructions, skills, commands, subagents, MCP servers), and the rules that decide what may leave their computer.
|
|
236
|
+
*
|
|
237
|
+
* This module is pure and shared. The Agent Host runs it on the person's own machine so secrets are removed
|
|
238
|
+
* before anything is uploaded, and Overlay runs it again on receipt, so a modified or older client cannot
|
|
239
|
+
* smuggle one in. Nothing here reads the file system: callers pass in text files and get back what is safe.
|
|
240
|
+
*/
|
|
241
|
+
export const AGENT_PROFILE_HARNESSES = ['claude-code', 'codex'];
|
|
242
|
+
export function isAgentProfileHarness(value) {
|
|
243
|
+
return typeof value === 'string' && AGENT_PROFILE_HARNESSES.includes(value);
|
|
244
|
+
}
|
|
245
|
+
export const AGENT_PROFILE_LIMITS = {
|
|
246
|
+
maxFiles: 3_000,
|
|
247
|
+
maxFileBytes: 256 * 1024,
|
|
248
|
+
maxTotalBytes: 12 * 1024 * 1024,
|
|
249
|
+
maxPathLength: 300,
|
|
250
|
+
};
|
|
251
|
+
const SECRET_TEXT_PATTERNS = [
|
|
252
|
+
/sk-ant-[A-Za-z0-9_-]{16,}/g,
|
|
253
|
+
/sk-(?:proj-)?[A-Za-z0-9_-]{32,}/g,
|
|
254
|
+
/gh[pousr]_[A-Za-z0-9]{30,}/g,
|
|
255
|
+
/github_pat_[A-Za-z0-9_]{40,}/g,
|
|
256
|
+
/xox[abprs]-[A-Za-z0-9-]{20,}/g,
|
|
257
|
+
/AKIA[0-9A-Z]{16}/g,
|
|
258
|
+
/AIza[0-9A-Za-z_-]{30,}/g,
|
|
259
|
+
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g,
|
|
260
|
+
/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g,
|
|
261
|
+
/Bearer\s+[A-Za-z0-9._~+/=-]{30,}/g,
|
|
262
|
+
];
|
|
263
|
+
const SECRET_NAME = /(?:^|[_-])(?:key|token|secret|password|passwd|pass|auth|authorization|credential|credentials|cookie)(?:$|[_-])|apikey|api_key/i;
|
|
264
|
+
/** A value that is, or contains, a credential: a known token shape, or a long unbroken high-entropy string. */
|
|
265
|
+
export function looksLikeSecret(value) {
|
|
266
|
+
const text = value.trim();
|
|
267
|
+
if (!text)
|
|
268
|
+
return false;
|
|
269
|
+
for (const pattern of SECRET_TEXT_PATTERNS) {
|
|
270
|
+
pattern.lastIndex = 0;
|
|
271
|
+
if (pattern.test(text))
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
// Long, no spaces, mixed letters and digits: an opaque token rather than a word, a path, or a URL.
|
|
275
|
+
return text.length >= 28 && /^[A-Za-z0-9_\-+/=.]+$/.test(text) && /[A-Za-z]/.test(text) && /\d/.test(text) && !text.includes('/');
|
|
276
|
+
}
|
|
277
|
+
/** Replaces secret-looking text; returns the cleaned text and how many replacements were made. */
|
|
278
|
+
export function redactSecretText(text) {
|
|
279
|
+
let count = 0;
|
|
280
|
+
let out = text;
|
|
281
|
+
for (const pattern of SECRET_TEXT_PATTERNS) {
|
|
282
|
+
pattern.lastIndex = 0;
|
|
283
|
+
out = out.replace(pattern, () => { count += 1; return '[REDACTED]'; });
|
|
284
|
+
}
|
|
285
|
+
return { text: out, count };
|
|
286
|
+
}
|
|
287
|
+
/** Environment-variable style name for a secret value: `GITHUB_TOKEN`, or `SERVER_HEADER` when nothing better is known. */
|
|
288
|
+
export function secretEnvName(...parts) {
|
|
289
|
+
const name = parts.join('_').toUpperCase().replace(/[^A-Z0-9]+/g, '_').replace(/^_+|_+$/g, '');
|
|
290
|
+
return /^[A-Z_]/.test(name) ? name : `S_${name}`;
|
|
291
|
+
}
|
|
292
|
+
const DENIED_SEGMENT = /^(?:\.env(?:\..*)?|\.git|node_modules|\.credentials\.json|credentials\.json|auth\.json|\.netrc|id_(?:rsa|ed25519|ecdsa)(?:\.pub)?|.*\.(?:pem|key|p12|pfx|keychain))$/i;
|
|
293
|
+
const CLAUDE_RULES = [
|
|
294
|
+
{ test: (p) => p === 'CLAUDE.md', sanitize: 'text' },
|
|
295
|
+
{ test: (p) => p === 'settings.json', sanitize: 'settings' },
|
|
296
|
+
{ test: (p) => p === 'claude.json', sanitize: 'mcp-source' },
|
|
297
|
+
{ test: (p) => /^agents\/.+\.md$/.test(p), sanitize: 'text' },
|
|
298
|
+
{ test: (p) => /^commands\/.+\.md$/.test(p), sanitize: 'text' },
|
|
299
|
+
{ test: (p) => /^output-styles\/.+\.md$/.test(p), sanitize: 'text' },
|
|
300
|
+
{ test: (p) => p.startsWith('skills/') && p.length > 'skills/'.length, sanitize: 'text' },
|
|
301
|
+
];
|
|
302
|
+
const CODEX_RULES = [
|
|
303
|
+
{ test: (p) => p === 'AGENTS.md', sanitize: 'text' },
|
|
304
|
+
{ test: (p) => p === 'config.toml', sanitize: 'codex-config' },
|
|
305
|
+
{ test: (p) => /^prompts\/.+\.md$/.test(p), sanitize: 'text' },
|
|
306
|
+
{ test: (p) => p.startsWith('skills/') && p.length > 'skills/'.length, sanitize: 'text' },
|
|
307
|
+
];
|
|
308
|
+
/** Why a path is not part of the import, for the paths a person's folder upload contained. */
|
|
309
|
+
const NOT_IMPORTED = [
|
|
310
|
+
{ test: (p) => /^(?:\.credentials\.json|auth\.json)$/.test(p), reason: 'Sign-in credentials are never imported.' },
|
|
311
|
+
{ test: (p) => p.startsWith('plugins/'), reason: 'Plugins are not imported; their skills and commands are not copied.' },
|
|
312
|
+
{ test: (p) => p.startsWith('hooks/'), reason: 'Hook scripts run code; they are not imported.' },
|
|
313
|
+
{ test: (p) => /^(?:projects|sessions|history|file-history|shell-snapshots|todos|statsig|telemetry|debug|cache|downloads|ide|paste-cache|session-env|backups|state)(?:\/|\.|$)/.test(p), reason: 'Conversation history, caches, and local state are not imported.' },
|
|
314
|
+
];
|
|
315
|
+
function normalizePath(path) {
|
|
316
|
+
const unified = path.replace(/\\/g, '/').replace(/^\.\//, '');
|
|
317
|
+
if (!unified || unified.length > AGENT_PROFILE_LIMITS.maxPathLength)
|
|
318
|
+
return null;
|
|
319
|
+
if (unified.startsWith('/') || /^[A-Za-z]:/.test(unified) || unified.includes('\0'))
|
|
320
|
+
return null;
|
|
321
|
+
const segments = unified.split('/');
|
|
322
|
+
if (segments.some((segment) => segment === '' || segment === '.' || segment === '..'))
|
|
323
|
+
return null;
|
|
324
|
+
return segments.join('/');
|
|
325
|
+
}
|
|
326
|
+
function safeJson(text) {
|
|
327
|
+
try {
|
|
328
|
+
const parsed = JSON.parse(text);
|
|
329
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
|
|
330
|
+
}
|
|
331
|
+
catch (_error) {
|
|
332
|
+
return null;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function isRecord(value) {
|
|
336
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
337
|
+
}
|
|
338
|
+
const LOCAL_PATH = /^(?:\/Users\/|\/home\/|~\/|[A-Za-z]:[\\/])/;
|
|
339
|
+
class Collector {
|
|
340
|
+
files = [];
|
|
341
|
+
dropped = [];
|
|
342
|
+
redactions = [];
|
|
343
|
+
secrets = new Map();
|
|
344
|
+
hooks = [];
|
|
345
|
+
warnings = [];
|
|
346
|
+
mcpServers = {};
|
|
347
|
+
drop(path, reason) { this.dropped.push({ path, reason }); }
|
|
348
|
+
need(name, usedBy) { if (!this.secrets.has(name))
|
|
349
|
+
this.secrets.set(name, { name, usedBy }); }
|
|
350
|
+
}
|
|
351
|
+
const SETTINGS_DROPPED_KEYS = {
|
|
352
|
+
env: 'Environment values can hold credentials.',
|
|
353
|
+
apiKeyHelper: 'Runs a command to fetch a credential.',
|
|
354
|
+
awsAuthRefresh: 'Runs a command to refresh credentials.',
|
|
355
|
+
awsCredentialExport: 'Runs a command to export credentials.',
|
|
356
|
+
otelHeadersHelper: 'Runs a command to produce telemetry headers.',
|
|
357
|
+
forceLoginMethod: 'Sign-in is set up separately on Overlay.',
|
|
358
|
+
forceLoginOrgUUID: 'Sign-in is set up separately on Overlay.',
|
|
359
|
+
enabledPlugins: 'Plugins are not imported.',
|
|
360
|
+
extraKnownMarketplaces: 'Plugins are not imported.',
|
|
361
|
+
skipDangerousModePermissionPrompt: 'Overlay asks for approval itself.',
|
|
362
|
+
};
|
|
363
|
+
function sanitizeSettings(collector, path, text) {
|
|
364
|
+
const parsed = safeJson(text);
|
|
365
|
+
if (!parsed) {
|
|
366
|
+
collector.drop(path, 'Not valid JSON.');
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
const settings = { ...parsed };
|
|
370
|
+
for (const [key, reason] of Object.entries(SETTINGS_DROPPED_KEYS)) {
|
|
371
|
+
if (key in settings) {
|
|
372
|
+
delete settings[key];
|
|
373
|
+
collector.drop(`${path}: ${key}`, reason);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Overlay's approval cards are the permission prompt for a cloud agent. A mode that skips the prompt (bypass,
|
|
377
|
+
// accept edits) would sidestep them, and one that denies whatever is not pre-approved (don't ask) would silently
|
|
378
|
+
// refuse every tool, so only the modes that ask are imported.
|
|
379
|
+
if (isRecord(settings.permissions) && typeof settings.permissions.defaultMode === 'string'
|
|
380
|
+
&& !['default', 'plan'].includes(settings.permissions.defaultMode)) {
|
|
381
|
+
const { defaultMode: _mode, ...rest } = settings.permissions;
|
|
382
|
+
settings.permissions = rest;
|
|
383
|
+
collector.drop(`${path}: permissions.defaultMode`, 'Overlay asks for approval itself, so a mode that skips or denies the prompt is not imported.');
|
|
384
|
+
}
|
|
385
|
+
if (isRecord(settings.hooks)) {
|
|
386
|
+
for (const [event, groups] of Object.entries(settings.hooks)) {
|
|
387
|
+
for (const group of Array.isArray(groups) ? groups : []) {
|
|
388
|
+
for (const hook of isRecord(group) && Array.isArray(group.hooks) ? group.hooks : []) {
|
|
389
|
+
if (isRecord(hook) && typeof hook.command === 'string')
|
|
390
|
+
collector.hooks.push({ kind: 'hook', event, command: hook.command.slice(0, 500) });
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
delete settings.hooks;
|
|
395
|
+
}
|
|
396
|
+
if (isRecord(settings.statusLine) && typeof settings.statusLine.command === 'string') {
|
|
397
|
+
collector.hooks.push({ kind: 'statusline', event: 'statusLine', command: settings.statusLine.command.slice(0, 500) });
|
|
398
|
+
delete settings.statusLine;
|
|
399
|
+
}
|
|
400
|
+
if (isRecord(settings.mcpServers)) {
|
|
401
|
+
absorbMcpServers(collector, settings.mcpServers);
|
|
402
|
+
delete settings.mcpServers;
|
|
403
|
+
}
|
|
404
|
+
// Anything left that is, or contains, a credential goes too.
|
|
405
|
+
const scrub = (value, trail) => {
|
|
406
|
+
if (typeof value === 'string') {
|
|
407
|
+
if (looksLikeSecret(value)) {
|
|
408
|
+
collector.drop(`${path}: ${trail}`, 'Looks like a credential.');
|
|
409
|
+
return undefined;
|
|
410
|
+
}
|
|
411
|
+
return value;
|
|
412
|
+
}
|
|
413
|
+
if (Array.isArray(value))
|
|
414
|
+
return value.map((entry, index) => scrub(entry, `${trail}[${index}]`)).filter((entry) => entry !== undefined);
|
|
415
|
+
if (isRecord(value)) {
|
|
416
|
+
const out = {};
|
|
417
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
418
|
+
const cleaned = scrub(entry, trail ? `${trail}.${key}` : key);
|
|
419
|
+
if (cleaned !== undefined)
|
|
420
|
+
out[key] = cleaned;
|
|
421
|
+
}
|
|
422
|
+
return out;
|
|
423
|
+
}
|
|
424
|
+
return value;
|
|
425
|
+
};
|
|
426
|
+
const cleaned = scrub(settings, '');
|
|
427
|
+
return { path, content: `${JSON.stringify(cleaned, null, 2)}\n` };
|
|
428
|
+
}
|
|
429
|
+
function placeholder(name) {
|
|
430
|
+
return `\${${name}}`;
|
|
431
|
+
}
|
|
432
|
+
function absorbMcpServers(collector, servers) {
|
|
433
|
+
for (const [name, raw] of Object.entries(servers)) {
|
|
434
|
+
if (!isRecord(raw) || !/^[A-Za-z0-9_.-]{1,64}$/.test(name)) {
|
|
435
|
+
collector.drop(`MCP server ${name}`, 'Unreadable or unsupported entry.');
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
const server = { ...raw };
|
|
439
|
+
// Keep only fields Claude Code defines for a server; anything else is dropped rather than copied.
|
|
440
|
+
for (const key of Object.keys(server)) {
|
|
441
|
+
if (!['type', 'command', 'args', 'env', 'url', 'headers'].includes(key))
|
|
442
|
+
delete server[key];
|
|
443
|
+
}
|
|
444
|
+
if (isRecord(server.env)) {
|
|
445
|
+
const env = {};
|
|
446
|
+
for (const [key, value] of Object.entries(server.env)) {
|
|
447
|
+
if (typeof value !== 'string')
|
|
448
|
+
continue;
|
|
449
|
+
if (SECRET_NAME.test(key) || looksLikeSecret(value)) {
|
|
450
|
+
const envName = secretEnvName(key);
|
|
451
|
+
env[key] = placeholder(envName);
|
|
452
|
+
collector.need(envName, name);
|
|
453
|
+
}
|
|
454
|
+
else
|
|
455
|
+
env[key] = value;
|
|
456
|
+
}
|
|
457
|
+
server.env = env;
|
|
458
|
+
}
|
|
459
|
+
if (isRecord(server.headers)) {
|
|
460
|
+
const headers = {};
|
|
461
|
+
for (const [key, value] of Object.entries(server.headers)) {
|
|
462
|
+
if (typeof value !== 'string')
|
|
463
|
+
continue;
|
|
464
|
+
if (SECRET_NAME.test(key) || looksLikeSecret(value)) {
|
|
465
|
+
const envName = secretEnvName(name, key);
|
|
466
|
+
const scheme = /^(Bearer|Basic|Token)\s+/i.exec(value);
|
|
467
|
+
headers[key] = `${scheme ? `${scheme[1]} ` : ''}${placeholder(envName)}`;
|
|
468
|
+
collector.need(envName, name);
|
|
469
|
+
}
|
|
470
|
+
else
|
|
471
|
+
headers[key] = value;
|
|
472
|
+
}
|
|
473
|
+
server.headers = headers;
|
|
474
|
+
}
|
|
475
|
+
if (Array.isArray(server.args)) {
|
|
476
|
+
server.args = server.args.map((arg, index) => {
|
|
477
|
+
if (typeof arg !== 'string')
|
|
478
|
+
return arg;
|
|
479
|
+
if (looksLikeSecret(arg)) {
|
|
480
|
+
const envName = secretEnvName(name, 'ARG', String(index));
|
|
481
|
+
collector.need(envName, name);
|
|
482
|
+
return placeholder(envName);
|
|
483
|
+
}
|
|
484
|
+
return arg;
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
if (typeof server.url === 'string') {
|
|
488
|
+
try {
|
|
489
|
+
const url = new URL(server.url);
|
|
490
|
+
for (const [key, value] of [...url.searchParams.entries()]) {
|
|
491
|
+
if (SECRET_NAME.test(key) || looksLikeSecret(value)) {
|
|
492
|
+
const envName = secretEnvName(name, key);
|
|
493
|
+
url.searchParams.set(key, placeholder(envName));
|
|
494
|
+
collector.need(envName, name);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
// URL.toString percent-encodes the braces of a placeholder; restore them so Claude Code can expand it.
|
|
498
|
+
server.url = url.toString().replace(/%24%7B([A-Z0-9_]+)%7D/g, '${$1}');
|
|
499
|
+
}
|
|
500
|
+
catch (_error) {
|
|
501
|
+
collector.drop(`MCP server ${name}`, 'Its URL could not be read.');
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
if (typeof server.command === 'string' && LOCAL_PATH.test(server.command)) {
|
|
506
|
+
collector.warnings.push({ path: `MCP server ${name}`, message: 'Its command points at a path on your computer, which will not exist on the agent\'s machine.' });
|
|
507
|
+
}
|
|
508
|
+
collector.mcpServers[name] = server;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function sanitizeCodexConfig(collector, path, text) {
|
|
512
|
+
const lines = text.split(/\r?\n/);
|
|
513
|
+
const out = [];
|
|
514
|
+
let table = '';
|
|
515
|
+
let skipTable = false;
|
|
516
|
+
for (const line of lines) {
|
|
517
|
+
const header = /^\s*\[{1,2}\s*([^\]]+?)\s*\]{1,2}\s*$/.exec(line);
|
|
518
|
+
if (header) {
|
|
519
|
+
table = header[1];
|
|
520
|
+
skipTable = /^projects(\.|$)/.test(table);
|
|
521
|
+
if (skipTable)
|
|
522
|
+
collector.drop(`${path}: [${table}]`, 'Trusted project paths belong to your computer.');
|
|
523
|
+
if (!skipTable)
|
|
524
|
+
out.push(line);
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
527
|
+
if (skipTable)
|
|
528
|
+
continue;
|
|
529
|
+
const entry = /^\s*([A-Za-z0-9_."-]+)\s*=\s*(.*)$/.exec(line);
|
|
530
|
+
if (entry) {
|
|
531
|
+
const key = entry[1];
|
|
532
|
+
const value = entry[2];
|
|
533
|
+
if (key === 'notify') {
|
|
534
|
+
collector.hooks.push({ kind: 'notify', event: 'notify', command: value.slice(0, 500) });
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
const isEnvName = /(?:_env|env_key|_env_var|env_vars)$/i.test(key);
|
|
538
|
+
const secretKey = SECRET_NAME.test(key) && !isEnvName;
|
|
539
|
+
if (secretKey || looksLikeSecret(value.replace(/^["']|["']$/g, ''))) {
|
|
540
|
+
collector.drop(`${path}: ${table ? `${table}.` : ''}${key}`, 'Looks like a credential; Codex cannot receive it yet.');
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
out.push(line);
|
|
545
|
+
}
|
|
546
|
+
return { path, content: `${out.join('\n').replace(/\n{3,}/g, '\n\n').trim()}\n` };
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Applies the import rules to a set of files (from a person's `~/.claude` or `~/.codex`): what is allowed in, with
|
|
550
|
+
* secrets removed and a record of what was left out and why.
|
|
551
|
+
*/
|
|
552
|
+
export function analyzeAgentProfile(harness, input) {
|
|
553
|
+
const collector = new Collector();
|
|
554
|
+
const rules = harness === 'claude-code' ? CLAUDE_RULES : CODEX_RULES;
|
|
555
|
+
let total = 0;
|
|
556
|
+
const seen = new Set();
|
|
557
|
+
for (const file of input) {
|
|
558
|
+
const path = typeof file?.path === 'string' ? normalizePath(file.path) : null;
|
|
559
|
+
if (!path) {
|
|
560
|
+
collector.drop(String(file?.path ?? '(no path)').slice(0, 120), 'Not a valid relative path.');
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
if (seen.has(path)) {
|
|
564
|
+
collector.drop(path, 'Listed twice.');
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
seen.add(path);
|
|
568
|
+
const notImported = NOT_IMPORTED.find((entry) => entry.test(path));
|
|
569
|
+
if (notImported) {
|
|
570
|
+
collector.drop(path, notImported.reason);
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
const rule = rules.find((candidate) => candidate.test(path));
|
|
574
|
+
if (!rule) {
|
|
575
|
+
collector.drop(path, 'Not part of what an agent imports.');
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
if (path.split('/').some((segment) => DENIED_SEGMENT.test(segment))) {
|
|
579
|
+
collector.drop(path, 'Looks like a credential or a dependency folder.');
|
|
580
|
+
continue;
|
|
581
|
+
}
|
|
582
|
+
if (typeof file.content !== 'string') {
|
|
583
|
+
collector.drop(path, 'Not text.');
|
|
584
|
+
continue;
|
|
585
|
+
}
|
|
586
|
+
if (file.content.includes('\0')) {
|
|
587
|
+
collector.drop(path, 'Binary file.');
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
const bytes = new TextEncoder().encode(file.content).length;
|
|
591
|
+
if (bytes > AGENT_PROFILE_LIMITS.maxFileBytes) {
|
|
592
|
+
collector.drop(path, `Larger than ${AGENT_PROFILE_LIMITS.maxFileBytes / 1024} KB.`);
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (collector.files.length >= AGENT_PROFILE_LIMITS.maxFiles) {
|
|
596
|
+
collector.drop(path, `More than ${AGENT_PROFILE_LIMITS.maxFiles} files.`);
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
if (total + bytes > AGENT_PROFILE_LIMITS.maxTotalBytes) {
|
|
600
|
+
collector.drop(path, 'The import is over its total size limit.');
|
|
601
|
+
continue;
|
|
602
|
+
}
|
|
603
|
+
if (rule.sanitize === 'mcp-source') {
|
|
604
|
+
const parsed = safeJson(file.content);
|
|
605
|
+
if (!parsed) {
|
|
606
|
+
collector.drop(path, 'Not valid JSON.');
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
if (isRecord(parsed.mcpServers))
|
|
610
|
+
absorbMcpServers(collector, parsed.mcpServers);
|
|
611
|
+
// The rest of ~/.claude.json is account and project state: never imported.
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
let cleaned;
|
|
615
|
+
if (rule.sanitize === 'settings')
|
|
616
|
+
cleaned = sanitizeSettings(collector, path, file.content);
|
|
617
|
+
else if (rule.sanitize === 'codex-config')
|
|
618
|
+
cleaned = sanitizeCodexConfig(collector, path, file.content);
|
|
619
|
+
else {
|
|
620
|
+
const redacted = redactSecretText(file.content);
|
|
621
|
+
if (redacted.count > 0)
|
|
622
|
+
collector.redactions.push({ path, count: redacted.count });
|
|
623
|
+
cleaned = { path, content: redacted.text };
|
|
624
|
+
}
|
|
625
|
+
if (!cleaned)
|
|
626
|
+
continue;
|
|
627
|
+
total += new TextEncoder().encode(cleaned.content).length;
|
|
628
|
+
collector.files.push(cleaned);
|
|
629
|
+
}
|
|
630
|
+
return {
|
|
631
|
+
harness,
|
|
632
|
+
files: collector.files,
|
|
633
|
+
mcpServers: collector.mcpServers,
|
|
634
|
+
hooks: collector.hooks,
|
|
635
|
+
secrets: [...collector.secrets.values()],
|
|
636
|
+
dropped: collector.dropped,
|
|
637
|
+
redactions: collector.redactions,
|
|
638
|
+
warnings: collector.warnings,
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
export function summarizeAgentProfile(profile) {
|
|
642
|
+
const skillNames = new Set();
|
|
643
|
+
let skillFiles = 0;
|
|
644
|
+
let commands = 0;
|
|
645
|
+
let subagents = 0;
|
|
646
|
+
let outputStyles = 0;
|
|
647
|
+
let prompts = 0;
|
|
648
|
+
let bytes = 0;
|
|
649
|
+
for (const file of profile.files) {
|
|
650
|
+
bytes += new TextEncoder().encode(file.content).length;
|
|
651
|
+
if (file.path.startsWith('skills/')) {
|
|
652
|
+
skillFiles += 1;
|
|
653
|
+
skillNames.add(file.path.split('/')[1] ?? '');
|
|
654
|
+
}
|
|
655
|
+
else if (file.path.startsWith('commands/'))
|
|
656
|
+
commands += 1;
|
|
657
|
+
else if (file.path.startsWith('agents/'))
|
|
658
|
+
subagents += 1;
|
|
659
|
+
else if (file.path.startsWith('output-styles/'))
|
|
660
|
+
outputStyles += 1;
|
|
661
|
+
else if (file.path.startsWith('prompts/'))
|
|
662
|
+
prompts += 1;
|
|
663
|
+
}
|
|
664
|
+
return {
|
|
665
|
+
claudeMd: profile.files.some((file) => file.path === 'CLAUDE.md'),
|
|
666
|
+
agentsMd: profile.files.some((file) => file.path === 'AGENTS.md'),
|
|
667
|
+
settings: profile.files.some((file) => file.path === 'settings.json' || file.path === 'config.toml'),
|
|
668
|
+
skills: skillNames.size, skillFiles, commands, subagents, outputStyles, prompts,
|
|
669
|
+
mcpServers: Object.keys(profile.mcpServers).length,
|
|
670
|
+
hooks: profile.hooks.length,
|
|
671
|
+
secrets: profile.secrets.length,
|
|
672
|
+
dropped: profile.dropped.length,
|
|
673
|
+
files: profile.files.length,
|
|
674
|
+
bytes,
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
export function bundleFromAnalysis(profile) {
|
|
678
|
+
return { version: 1, harness: profile.harness, files: profile.files, mcpServers: profile.mcpServers, hooks: profile.hooks, secrets: profile.secrets };
|
|
679
|
+
}
|
|
680
|
+
const SECRET_ENV_NAME = /^[A-Z_][A-Z0-9_]{0,63}$/;
|
|
681
|
+
/**
|
|
682
|
+
* Runs the import rules over an upload. The receiving side calls this whatever the sender claims to have cleaned:
|
|
683
|
+
* files and servers are analyzed again, and the hooks and secret names a host reports are accepted only in a bounded,
|
|
684
|
+
* validated form.
|
|
685
|
+
*/
|
|
686
|
+
export function analyzeAgentProfileUpload(upload) {
|
|
687
|
+
const input = [...upload.files];
|
|
688
|
+
if (upload.harness === 'claude-code' && upload.mcpServers && Object.keys(upload.mcpServers).length > 0) {
|
|
689
|
+
input.push({ path: 'claude.json', content: JSON.stringify({ mcpServers: upload.mcpServers }) });
|
|
690
|
+
}
|
|
691
|
+
const analyzed = analyzeAgentProfile(upload.harness, input);
|
|
692
|
+
const hooks = [...analyzed.hooks];
|
|
693
|
+
for (const hook of Array.isArray(upload.hooks) ? upload.hooks.slice(0, 100) : []) {
|
|
694
|
+
if (hook && ['hook', 'notify', 'statusline'].includes(hook.kind) && typeof hook.command === 'string' && typeof hook.event === 'string') {
|
|
695
|
+
hooks.push({ kind: hook.kind, event: hook.event.slice(0, 80), command: hook.command.slice(0, 500) });
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const secrets = new Map(analyzed.secrets.map((secret) => [secret.name, secret]));
|
|
699
|
+
for (const secret of Array.isArray(upload.secrets) ? upload.secrets.slice(0, 200) : []) {
|
|
700
|
+
if (secret && typeof secret.name === 'string' && SECRET_ENV_NAME.test(secret.name) && !secrets.has(secret.name)) {
|
|
701
|
+
secrets.set(secret.name, { name: secret.name, usedBy: typeof secret.usedBy === 'string' ? secret.usedBy.slice(0, 80) : '' });
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return { ...analyzed, hooks, secrets: [...secrets.values()] };
|
|
705
|
+
}
|
|
706
|
+
/** The folders and files a client may read at the top of a harness's config folder; a browser uses it to skip big folders unread. */
|
|
707
|
+
export const AGENT_PROFILE_TOP_LEVEL = {
|
|
708
|
+
'claude-code': ['CLAUDE.md', 'settings.json', 'agents', 'commands', 'skills', 'output-styles'],
|
|
709
|
+
codex: ['AGENTS.md', 'config.toml', 'prompts', 'skills'],
|
|
710
|
+
};
|
|
221
711
|
//# sourceMappingURL=index.js.map
|