@michaelfromyeg/weft-adapter-codex 1.2.0 → 1.3.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/index.js CHANGED
@@ -40,13 +40,18 @@ function sourceToString(source) {
40
40
  if (typeof source === "string") return source;
41
41
  const s = source;
42
42
  switch (s?.source) {
43
- case "github":
44
- return `github:${s.repo}${s.ref ? `#${s.ref}` : ""}`;
45
- case "url":
46
- case "git-subdir":
47
- return String(s.url);
48
- case "npm":
49
- return `npm:${s.package}${s.version ? `@${s.version}` : ""}`;
43
+ case "local":
44
+ return String(s.path ?? "");
45
+ case "git-subdir": {
46
+ const url = String(s.url ?? "");
47
+ const gh = url.match(/github\.com\/([^/]+)\/(.+?)(?:\.git)?$/);
48
+ if (gh) {
49
+ const sub = typeof s.path === "string" ? s.path.replace(/^\.\//, "") : "";
50
+ const ref = typeof s.ref === "string" ? s.ref : "";
51
+ return `github:${gh[1]}/${gh[2]}${sub ? `/${sub}` : ""}${ref ? `#${ref}` : ""}`;
52
+ }
53
+ return url;
54
+ }
50
55
  default:
51
56
  return String(source);
52
57
  }
@@ -85,55 +90,13 @@ function synthesizeServerJson(namespace, name, cfg) {
85
90
  ...cfg.env ? { env: cfg.env } : {}
86
91
  };
87
92
  }
88
- function parseMcpServersToml(toml) {
93
+ function readMcpJson(path) {
94
+ const parsed = readJson(path);
95
+ if (!parsed) return {};
96
+ const map = parsed.mcp_servers && typeof parsed.mcp_servers === "object" ? parsed.mcp_servers : parsed;
89
97
  const servers = {};
90
- let current = null;
91
- let envOf = null;
92
- const unquote = (v) => v.trim().replace(/^"(.*)"$/, "$1").replace(/\\"/g, '"').replace(/\\\\/g, "\\");
93
- const parseArray = (v) => {
94
- const inner = v.trim().replace(/^\[(.*)\]$/s, "$1");
95
- const matches = inner.match(/"(?:[^"\\]|\\.)*"/g) ?? [];
96
- return matches.map((m) => unquote(m));
97
- };
98
- for (const raw of toml.split("\n")) {
99
- const line = raw.trim();
100
- if (!line || line.startsWith("#")) continue;
101
- const envHeader = line.match(/^\[mcp_servers\.([^.\]]+)\.env\]$/);
102
- if (envHeader) {
103
- const name = envHeader[1];
104
- servers[name] ??= {};
105
- const server = servers[name];
106
- server.env ??= {};
107
- envOf = server;
108
- current = null;
109
- continue;
110
- }
111
- const serverHeader = line.match(/^\[mcp_servers\.([^.\]]+)\]$/);
112
- if (serverHeader) {
113
- const name = serverHeader[1];
114
- servers[name] ??= {};
115
- current = servers[name];
116
- envOf = null;
117
- continue;
118
- }
119
- if (line.startsWith("[")) {
120
- current = null;
121
- envOf = null;
122
- continue;
123
- }
124
- const eq = line.indexOf("=");
125
- if (eq < 0) continue;
126
- const key = line.slice(0, eq).trim();
127
- const value = line.slice(eq + 1).trim();
128
- if (envOf) {
129
- envOf.env ??= {};
130
- envOf.env[key] = unquote(value);
131
- continue;
132
- }
133
- if (!current) continue;
134
- if (key === "command") current.command = unquote(value);
135
- else if (key === "url") current.url = unquote(value);
136
- else if (key === "args") current.args = parseArray(value);
98
+ for (const [name, cfg] of Object.entries(map)) {
99
+ if (cfg && typeof cfg === "object") servers[name] = cfg;
137
100
  }
138
101
  return servers;
139
102
  }
@@ -158,8 +121,8 @@ function importPlugin(dir, manifest, name, namespace) {
158
121
  })
159
122
  );
160
123
  }
161
- } else if (existsSync(join(dir, "config.toml"))) {
162
- const servers = parseMcpServersToml(readFileSync(join(dir, "config.toml"), "utf8"));
124
+ } else if (existsSync(join(dir, ".mcp.json"))) {
125
+ const servers = readMcpJson(join(dir, ".mcp.json"));
163
126
  for (const [serverName, cfg] of Object.entries(servers)) {
164
127
  components.push({ mcp: `mcp/${serverName}` });
165
128
  files.push(
@@ -171,14 +134,14 @@ function importPlugin(dir, manifest, name, namespace) {
171
134
  );
172
135
  }
173
136
  }
174
- const author = manifest?.author;
137
+ const author2 = manifest?.author;
175
138
  const plugin = {
176
139
  name,
177
140
  version: String(manifest?.version ?? "0.1.0"),
178
141
  owner: {
179
- name: author?.name ?? name,
142
+ name: author2?.name ?? name,
180
143
  namespace,
181
- ...author?.email ? { email: author.email } : {}
144
+ ...author2?.email ? { email: author2.email } : {}
182
145
  },
183
146
  ...manifest?.description ? { description: String(manifest.description) } : {},
184
147
  components
@@ -186,30 +149,24 @@ function importPlugin(dir, manifest, name, namespace) {
186
149
  return { kind: "plugin", plugin, files };
187
150
  }
188
151
  function importMarketplace(manifest, namespace) {
189
- const owner = manifest.owner;
152
+ const iface = manifest.interface;
153
+ const ownerName = iface?.displayName ?? String(manifest.name);
190
154
  const plugins = (manifest.plugins ?? []).map((p) => ({
191
155
  plugin: sourceToString(p.source),
192
- ...p.version ? { version: String(p.version) } : {},
193
- ...p.category ? { category: String(p.category) } : {},
194
- ...Array.isArray(p.tags) ? { tags: p.tags } : {}
156
+ ...p.category ? { category: String(p.category) } : {}
195
157
  }));
196
158
  const marketplace = {
197
159
  name: String(manifest.name),
198
- owner: {
199
- name: owner?.name ?? String(manifest.name),
200
- namespace,
201
- ...owner?.email ? { email: owner.email } : {}
202
- },
203
- ...manifest.description ? { description: String(manifest.description) } : {},
160
+ owner: { name: ownerName, namespace },
204
161
  plugins
205
162
  };
206
163
  return { kind: "marketplace", marketplace };
207
164
  }
208
165
  function importCodex(dir, opts) {
209
166
  const namespace = opts?.namespace ?? "com.imported";
210
- const marketplace = readJson(join(dir, "weft-marketplace.json"));
167
+ const marketplace = readJson(join(dir, ".agents", "plugins", "marketplace.json"));
211
168
  if (marketplace) return importMarketplace(marketplace, namespace);
212
- const manifest = readJson(join(dir, "plugin.json"));
169
+ const manifest = readJson(join(dir, ".codex-plugin", "plugin.json"));
213
170
  const basename2 = dir.replace(/\/+$/, "").split("/").pop() || "imported-plugin";
214
171
  const name = typeof manifest?.name === "string" ? manifest.name : basename2;
215
172
  if (manifest || existsSync(join(dir, "skills")) || existsSync(join(dir, "agents"))) {
@@ -248,36 +205,33 @@ function mcpRunConfig(server) {
248
205
  }
249
206
  return { command: "echo", args: ["server.json declares no runnable transport"] };
250
207
  }
251
- function tomlString(value) {
252
- return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
253
- }
254
- function tomlArray(values) {
255
- return `[${values.map(tomlString).join(", ")}]`;
256
- }
257
- function renderMcpServersToml(servers) {
258
- const blocks = [];
259
- for (const [name, config] of Object.entries(servers)) {
260
- const lines = [`[mcp_servers.${name}]`];
261
- if (config.command !== void 0) lines.push(`command = ${tomlString(config.command)}`);
262
- if (config.args !== void 0) lines.push(`args = ${tomlArray(config.args)}`);
263
- if (config.url !== void 0) lines.push(`url = ${tomlString(config.url)}`);
264
- if (config.env && Object.keys(config.env).length > 0) {
265
- lines.push("");
266
- lines.push(`[mcp_servers.${name}.env]`);
267
- for (const [key, val] of Object.entries(config.env)) {
268
- lines.push(`${key} = ${tomlString(val)}`);
269
- }
270
- }
271
- blocks.push(lines.join("\n"));
272
- }
273
- return blocks.length > 0 ? `${blocks.join("\n\n")}
274
- ` : "";
275
- }
276
208
 
277
209
  // src/index.ts
278
- var TARGET_SCHEMA = "codex-plugin/0.117";
210
+ var TARGET_SCHEMA = "codex-plugin/0.121";
279
211
  var json2 = (o) => `${JSON.stringify(o, null, 2)}
280
212
  `;
213
+ function author(name, email) {
214
+ return email ? { name, email } : { name };
215
+ }
216
+ function toCodexSource(source) {
217
+ const gh = source.match(/^github:([^/#]+)\/([^#]+?)(?:#(.+))?$/);
218
+ if (gh) {
219
+ const [, owner, repoAndSub, ref] = gh;
220
+ const slash = repoAndSub.indexOf("/");
221
+ const repo = slash >= 0 ? repoAndSub.slice(0, slash) : repoAndSub;
222
+ const sub = slash >= 0 ? repoAndSub.slice(slash + 1) : "";
223
+ return {
224
+ source: "git-subdir",
225
+ url: `https://github.com/${owner}/${repo}.git`,
226
+ ...sub ? { path: `./${sub}` } : {},
227
+ ...ref ? { ref } : {}
228
+ };
229
+ }
230
+ if (/^https?:\/\//.test(source) || source.endsWith(".git")) {
231
+ return { source: "git-subdir", url: source };
232
+ }
233
+ return { source: "local", path: source.startsWith("./") ? source : `./${source}` };
234
+ }
281
235
  function copyDir(ctx, ref, destPrefix, kind) {
282
236
  return ctx.list(ref).map((file) => {
283
237
  const within = file.startsWith(`${ref}/`) ? file.slice(ref.length + 1) : basename(file);
@@ -328,9 +282,12 @@ var codexAdapter = {
328
282
  agents: join(root, "agents"),
329
283
  // TODO(verify): Codex documents no dedicated commands dir; best-effort under root.
330
284
  commands: join(root, "commands"),
331
- // TODO(verify): Codex documents no hooks dir; best-effort under root.
285
+ // TODO(verify): Codex plugins reference hooks via a `hooks/hooks.json` manifest
286
+ // path; this install-scope dir placement is best-effort and not wired to it.
332
287
  hooks: join(root, "hooks"),
333
- catalog: root
288
+ // Native marketplace catalog lives at `.agents/plugins/marketplace.json`
289
+ // (shared `.agents` tree), NOT under the `.codex` root.
290
+ catalog: scope === "user" ? join(homedir(), ".agents", "plugins") : join(cwd, ".agents", "plugins")
334
291
  };
335
292
  },
336
293
  transform(component, ctx) {
@@ -389,44 +346,45 @@ var codexAdapter = {
389
346
  } catch {
390
347
  }
391
348
  }
392
- const toml = renderMcpServersToml(mcpServers);
393
- if (toml) artifacts.push(artifact("config.toml", toml, { kind: "manifest" }));
349
+ const hasSkills = plugin.components.some((c) => kindOf(c) === "skill");
350
+ const hasMcp = Object.keys(mcpServers).length > 0;
394
351
  const manifest = {
395
352
  name: plugin.name,
396
- version: plugin.version
353
+ version: plugin.version,
354
+ author: author(plugin.owner.name, plugin.owner.email)
397
355
  };
398
356
  if (plugin.description) manifest.description = plugin.description;
399
- artifacts.push(artifact("plugin.json", json2(manifest), { kind: "manifest" }));
357
+ if (hasSkills) manifest.skills = "./skills/";
358
+ if (hasMcp) manifest.mcpServers = "./.mcp.json";
359
+ manifest.interface = plugin.description ? { displayName: plugin.name, shortDescription: plugin.description } : { displayName: plugin.name };
360
+ artifacts.push(artifact(".codex-plugin/plugin.json", json2(manifest), { kind: "manifest" }));
361
+ if (hasMcp) artifacts.push(artifact(".mcp.json", json2(mcpServers), { kind: "manifest" }));
400
362
  return artifacts;
401
363
  },
402
364
  emitCatalog(marketplace) {
403
- const plugins = marketplace.entries.map((entry) => {
404
- const e = {
405
- name: entry.name,
406
- source: entry.source.startsWith("./") ? entry.source : `./${entry.source}`
407
- };
408
- if (entry.description) e.description = entry.description;
409
- if (entry.version) e.version = entry.version;
410
- if (entry.category) e.category = entry.category;
411
- if (entry.tags) e.tags = entry.tags;
412
- return e;
413
- });
365
+ const plugins = marketplace.entries.map((entry) => ({
366
+ name: entry.name,
367
+ source: toCodexSource(entry.source),
368
+ // Codex requires a policy; these defaults match its own example marketplaces.
369
+ policy: { installation: "AVAILABLE", authentication: "ON_INSTALL" },
370
+ // Codex requires a category; fall back to a valid default when unset.
371
+ category: entry.category ?? "Productivity"
372
+ }));
414
373
  const catalog = {
415
374
  name: marketplace.name,
416
- owner: marketplace.owner.email ? { name: marketplace.owner.name, email: marketplace.owner.email } : { name: marketplace.owner.name },
375
+ interface: { displayName: marketplace.name },
417
376
  plugins
418
377
  };
419
- if (marketplace.description) catalog.description = marketplace.description;
420
- return [artifact("weft-marketplace.json", json2(catalog), { kind: "catalog" })];
378
+ return [artifact(".agents/plugins/marketplace.json", json2(catalog), { kind: "catalog" })];
421
379
  },
422
380
  importNative: importCodex
423
381
  };
424
- function tomlString2(value) {
382
+ function tomlString(value) {
425
383
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
426
384
  }
427
385
  function renderAgentToml(name, description, instructions) {
428
- const lines = [`name = ${tomlString2(name)}`];
429
- if (description) lines.push(`description = ${tomlString2(description)}`);
386
+ const lines = [`name = ${tomlString(name)}`];
387
+ if (description) lines.push(`description = ${tomlString(description)}`);
430
388
  const body = instructions.trim();
431
389
  if (body) {
432
390
  const escaped = body.replace(/\\/g, "\\\\").replace(/"""/g, '\\"\\"\\"');
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/import.ts","../src/mcp.ts","../src/index.ts"],"names":["basename","json","artif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AA,CAAK,IAAI,CAAC;AAAA,CAAA;AAC5B;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport {\n artifact,\n type CompiledArtifact,\n type ImportedMarketplace,\n type ImportedPlugin,\n type ImportOptions,\n type ImportResult,\n} from \"@michaelfromyeg/weft-adapter-kit\";\nimport type { Component, Marketplace, Plugin } from \"@michaelfromyeg/weft-schema\";\n\nconst MCP_SCHEMA = \"https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json\";\nconst json = (o: unknown): string => `${JSON.stringify(o, null, 2)}\\n`;\n\nfunction readJson(path: string): Record<string, unknown> | null {\n try {\n return JSON.parse(readFileSync(path, \"utf8\"));\n } catch {\n return null;\n }\n}\n\n/** Subdirectories of `dir` that contain `marker`. */\nfunction subdirsWith(dir: string, marker: string): string[] {\n if (!(existsSync(dir) && statSync(dir).isDirectory())) return [];\n return readdirSync(dir)\n .filter((n) => statSync(join(dir, n)).isDirectory() && existsSync(join(dir, n, marker)))\n .sort();\n}\n\nfunction filesWithExt(dir: string, ext: string): string[] {\n if (!(existsSync(dir) && statSync(dir).isDirectory())) return [];\n return readdirSync(dir)\n .filter((n) => n.endsWith(ext) && statSync(join(dir, n)).isFile())\n .sort();\n}\n\nfunction copyTree(\n srcDir: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n const out: CompiledArtifact[] = [];\n const walk = (d: string) => {\n for (const n of readdirSync(d).sort()) {\n const abs = join(d, n);\n if (statSync(abs).isDirectory()) walk(abs);\n else\n out.push(artifact(`${destPrefix}/${relative(srcDir, abs)}`, readFileSync(abs), { kind }));\n }\n };\n walk(srcDir);\n return out;\n}\n\n/** A Weft source string from a Codex `weft-marketplace.json` entry `source`. */\nfunction sourceToString(source: unknown): string {\n if (typeof source === \"string\") return source;\n const s = source as Record<string, unknown>;\n switch (s?.source) {\n case \"github\":\n return `github:${s.repo}${s.ref ? `#${s.ref}` : \"\"}`;\n case \"url\":\n case \"git-subdir\":\n return String(s.url);\n case \"npm\":\n return `npm:${s.package}${s.version ? `@${s.version}` : \"\"}`;\n default:\n return String(source);\n }\n}\n\ninterface McpServerCfg {\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n type?: string;\n url?: string;\n}\n\n/** Reconstruct an MCP-standard server.json from a Codex run config (lossy but functional). */\nfunction synthesizeServerJson(namespace: string, name: string, cfg: McpServerCfg): unknown {\n const base = {\n $schema: MCP_SCHEMA,\n name: `${namespace}/${name}`,\n description: `Imported ${name} MCP server.`,\n version: \"0.0.0\",\n };\n if (cfg.url) return { ...base, remotes: [{ type: cfg.type ?? \"streamable-http\", url: cfg.url }] };\n if (cfg.command === \"npx\" && Array.isArray(cfg.args)) {\n const ident = cfg.args.find((a) => a !== \"-y\" && !a.startsWith(\"-\"));\n if (ident) {\n const at = ident.lastIndexOf(\"@\");\n const id = at > 0 ? ident.slice(0, at) : ident;\n const version = at > 0 ? ident.slice(at + 1) : undefined;\n return {\n ...base,\n packages: [\n {\n registryType: \"npm\",\n identifier: id,\n ...(version ? { version } : {}),\n transport: { type: \"stdio\" },\n },\n ],\n };\n }\n }\n return {\n ...base,\n ...(cfg.command ? { command: cfg.command } : {}),\n ...(cfg.args ? { args: cfg.args } : {}),\n ...(cfg.env ? { env: cfg.env } : {}),\n };\n}\n\n/**\n * Parse the `[mcp_servers.<name>]` tables from a Codex `config.toml` fragment.\n * This is a deliberately small, hand-rolled parser for the subset our adapter\n * emits: `command = \"..\"`, `args = [\"..\", ..]`, `url = \"..\"`, and a nested\n * `[mcp_servers.<name>.env]` table of `KEY = \"..\"` string pairs.\n * TODO(verify): full Codex config.toml grammar (cwd, bearer_token_env_var,\n * http_headers, enabled_tools, etc.) is not parsed; verbatim mcp/ is preferred.\n */\nfunction parseMcpServersToml(toml: string): Record<string, McpServerCfg> {\n const servers: Record<string, McpServerCfg> = {};\n let current: McpServerCfg | null = null;\n let envOf: McpServerCfg | null = null;\n\n const unquote = (v: string): string =>\n v\n .trim()\n .replace(/^\"(.*)\"$/, \"$1\")\n .replace(/\\\\\"/g, '\"')\n .replace(/\\\\\\\\/g, \"\\\\\");\n const parseArray = (v: string): string[] => {\n const inner = v.trim().replace(/^\\[(.*)\\]$/s, \"$1\");\n const matches = inner.match(/\"(?:[^\"\\\\]|\\\\.)*\"/g) ?? [];\n return matches.map((m) => unquote(m));\n };\n\n for (const raw of toml.split(\"\\n\")) {\n const line = raw.trim();\n if (!line || line.startsWith(\"#\")) continue;\n\n const envHeader = line.match(/^\\[mcp_servers\\.([^.\\]]+)\\.env\\]$/);\n if (envHeader) {\n const name = envHeader[1];\n servers[name] ??= {};\n const server = servers[name];\n server.env ??= {};\n envOf = server;\n current = null;\n continue;\n }\n const serverHeader = line.match(/^\\[mcp_servers\\.([^.\\]]+)\\]$/);\n if (serverHeader) {\n const name = serverHeader[1];\n servers[name] ??= {};\n current = servers[name];\n envOf = null;\n continue;\n }\n if (line.startsWith(\"[\")) {\n current = null;\n envOf = null;\n continue;\n }\n\n const eq = line.indexOf(\"=\");\n if (eq < 0) continue;\n const key = line.slice(0, eq).trim();\n const value = line.slice(eq + 1).trim();\n\n if (envOf) {\n envOf.env ??= {};\n envOf.env[key] = unquote(value);\n continue;\n }\n if (!current) continue;\n if (key === \"command\") current.command = unquote(value);\n else if (key === \"url\") current.url = unquote(value);\n else if (key === \"args\") current.args = parseArray(value);\n }\n return servers;\n}\n\nfunction importPlugin(\n dir: string,\n manifest: Record<string, unknown> | null,\n name: string,\n namespace: string,\n): ImportedPlugin {\n const components: Component[] = [];\n const files: CompiledArtifact[] = [];\n\n // Skills: each skills/<name> dir with a SKILL.md. The per-skill\n // agents/openai.yaml sidecar inside is harness metadata, not a component; it\n // is carried along verbatim as a skill asset but never wired as an agent.\n for (const sk of subdirsWith(join(dir, \"skills\"), \"SKILL.md\")) {\n components.push({ skill: `skills/${sk}` });\n files.push(...copyTree(join(dir, \"skills\", sk), `skills/${sk}`, \"skill\"));\n }\n // Codex subagents are TOML files at agents/<file>.toml.\n for (const f of filesWithExt(join(dir, \"agents\"), \".toml\")) {\n components.push({ agent: `agents/${f}` });\n files.push(artifact(`agents/${f}`, readFileSync(join(dir, \"agents\", f)), { kind: \"agent\" }));\n }\n\n // MCP: prefer the verbatim server.json copies a Weft build leaves under mcp/.\n // Only when there is no mcp/ dir do we reconstruct from the config.toml tables.\n const mcpDir = join(dir, \"mcp\");\n if (existsSync(mcpDir) && statSync(mcpDir).isDirectory()) {\n for (const leaf of subdirsWith(mcpDir, \"server.json\")) {\n components.push({ mcp: `mcp/${leaf}` });\n files.push(\n artifact(`mcp/${leaf}/server.json`, readFileSync(join(mcpDir, leaf, \"server.json\")), {\n kind: \"mcp\",\n }),\n );\n }\n } else if (existsSync(join(dir, \"config.toml\"))) {\n const servers = parseMcpServersToml(readFileSync(join(dir, \"config.toml\"), \"utf8\"));\n for (const [serverName, cfg] of Object.entries(servers)) {\n components.push({ mcp: `mcp/${serverName}` });\n files.push(\n artifact(\n `mcp/${serverName}/server.json`,\n json(synthesizeServerJson(namespace, serverName, cfg)),\n { kind: \"mcp\" },\n ),\n );\n }\n }\n\n const author = manifest?.author as { name?: string; email?: string } | undefined;\n const plugin: Plugin = {\n name,\n version: String(manifest?.version ?? \"0.1.0\"),\n owner: {\n name: author?.name ?? name,\n namespace,\n ...(author?.email ? { email: author.email } : {}),\n },\n ...(manifest?.description ? { description: String(manifest.description) } : {}),\n components,\n };\n return { kind: \"plugin\", plugin, files };\n}\n\nfunction importMarketplace(\n manifest: Record<string, unknown>,\n namespace: string,\n): ImportedMarketplace {\n const owner = manifest.owner as { name?: string; email?: string } | undefined;\n const plugins = ((manifest.plugins as Record<string, unknown>[]) ?? []).map((p) => ({\n plugin: sourceToString(p.source),\n ...(p.version ? { version: String(p.version) } : {}),\n ...(p.category ? { category: String(p.category) } : {}),\n ...(Array.isArray(p.tags) ? { tags: p.tags as string[] } : {}),\n }));\n const marketplace: Marketplace = {\n name: String(manifest.name),\n owner: {\n name: owner?.name ?? String(manifest.name),\n namespace,\n ...(owner?.email ? { email: owner.email } : {}),\n },\n ...(manifest.description ? { description: String(manifest.description) } : {}),\n plugins,\n };\n return { kind: \"marketplace\", marketplace };\n}\n\n/** Reverse-compile a Codex plugin or marketplace dir into the Weft model. */\nexport function importCodex(dir: string, opts?: ImportOptions): ImportResult | null {\n const namespace = opts?.namespace ?? \"com.imported\";\n\n // Codex has no native marketplace; our adapter emits a Weft-only index.\n const marketplace = readJson(join(dir, \"weft-marketplace.json\"));\n if (marketplace) return importMarketplace(marketplace, namespace);\n\n const manifest = readJson(join(dir, \"plugin.json\"));\n const basename = dir.replace(/\\/+$/, \"\").split(\"/\").pop() || \"imported-plugin\";\n const name = typeof manifest?.name === \"string\" ? manifest.name : basename;\n\n // A plugin is anything with the Codex component layout (manifest is best-effort).\n if (manifest || existsSync(join(dir, \"skills\")) || existsSync(join(dir, \"agents\"))) {\n return importPlugin(dir, manifest, name, namespace);\n }\n return null;\n}\n","/**\n * Derives a runnable Codex MCP server config from an MCP-standard `server.json`\n * (the registry's ServerJSON shape: packages[] / remotes[] / a bare command) and\n * renders it as a `config.toml` fragment under `[mcp_servers.<name>]`.\n *\n * Codex infers the transport from the keys present (`command` => stdio, `url` =>\n * http); there is NO `transport` key (harness-research.md, Codex MCP section).\n * Stored standards stay verbatim in the plugin; this is the tool-specific view.\n */\n\nexport interface McpServerConfig {\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n}\n\ninterface McpPackage {\n registryType?: string;\n identifier?: string;\n version?: string;\n transport?: { type?: string };\n}\ninterface McpRemote {\n type?: string;\n url?: string;\n headers?: Array<{ name: string; value: string }>;\n}\ninterface ServerJson {\n name?: string;\n packages?: McpPackage[];\n remotes?: McpRemote[];\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n}\n\n/** The short server key Codex uses (the part after the reverse-DNS namespace). */\nexport function mcpServerName(server: ServerJson): string {\n const raw = server.name ?? \"server\";\n const afterSlash = raw.includes(\"/\") ? raw.slice(raw.lastIndexOf(\"/\") + 1) : raw;\n return afterSlash || \"server\";\n}\n\nconst RUNNERS: Record<string, string> = { npm: \"npx\", pypi: \"uvx\" };\n\nexport function mcpRunConfig(server: ServerJson): McpServerConfig {\n const pkg = server.packages?.[0];\n if (pkg?.identifier) {\n if (pkg.registryType === \"oci\") {\n return { command: \"docker\", args: [\"run\", \"-i\", \"--rm\", pkg.identifier] };\n }\n const runner = RUNNERS[pkg.registryType ?? \"npm\"] ?? \"npx\";\n const ident = pkg.version ? `${pkg.identifier}@${pkg.version}` : pkg.identifier;\n const args = runner === \"npx\" ? [\"-y\", ident] : [ident];\n return { command: runner, args };\n }\n\n const remote = server.remotes?.[0];\n if (remote?.url) {\n // Codex http servers carry only `url` here; headers/bearer-token live under\n // documented sub-keys we don't synthesize without provenance.\n return { url: remote.url };\n }\n\n if (server.command) {\n const config: McpServerConfig = { command: server.command };\n if (server.args) config.args = server.args;\n if (server.env) config.env = server.env;\n return config;\n }\n\n return { command: \"echo\", args: [\"server.json declares no runnable transport\"] };\n}\n\nfunction tomlString(value: string): string {\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\nfunction tomlArray(values: string[]): string {\n return `[${values.map(tomlString).join(\", \")}]`;\n}\n\n/**\n * Render the `[mcp_servers.<name>]` tables for a set of servers as a single\n * `config.toml` fragment. `env` becomes a nested `[mcp_servers.<name>.env]`\n * table; transport is implied by `command` vs `url`.\n */\nexport function renderMcpServersToml(servers: Record<string, McpServerConfig>): string {\n const blocks: string[] = [];\n for (const [name, config] of Object.entries(servers)) {\n const lines = [`[mcp_servers.${name}]`];\n if (config.command !== undefined) lines.push(`command = ${tomlString(config.command)}`);\n if (config.args !== undefined) lines.push(`args = ${tomlArray(config.args)}`);\n if (config.url !== undefined) lines.push(`url = ${tomlString(config.url)}`);\n if (config.env && Object.keys(config.env).length > 0) {\n lines.push(\"\");\n lines.push(`[mcp_servers.${name}.env]`);\n for (const [key, val] of Object.entries(config.env)) {\n lines.push(`${key} = ${tomlString(val)}`);\n }\n }\n blocks.push(lines.join(\"\\n\"));\n }\n return blocks.length > 0 ? `${blocks.join(\"\\n\\n\")}\\n` : \"\";\n}\n","import { homedir } from \"node:os\";\nimport { basename, extname, join } from \"node:path\";\nimport {\n artifact,\n type CompiledArtifact,\n type HarnessAdapter,\n type InstallPaths,\n type PluginCtx,\n parseFrontmatter,\n type ResolvedMarketplace,\n} from \"@michaelfromyeg/weft-adapter-kit\";\nimport {\n type Component,\n kindOf,\n leafNameOf,\n type Plugin,\n refOf,\n type Scope,\n} from \"@michaelfromyeg/weft-schema\";\nimport { importCodex } from \"./import\";\nimport { type McpServerConfig, mcpRunConfig, mcpServerName, renderMcpServersToml } from \"./mcp\";\n\n/** Bump on any change to Codex's plugin/config/sidecar shape (spec §5). */\nconst TARGET_SCHEMA = \"codex-plugin/0.117\";\n\nconst json = (o: unknown): string => `${JSON.stringify(o, null, 2)}\\n`;\n\n/** Copy every file under a plugin dir into `destPrefix/`, preserving structure. */\nfunction copyDir(\n ctx: PluginCtx,\n ref: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n return ctx.list(ref).map((file) => {\n const within = file.startsWith(`${ref}/`) ? file.slice(ref.length + 1) : basename(file);\n return artifact(`${destPrefix}/${within}`, ctx.read(file), { kind });\n });\n}\n\n/** Place a component that may be a single Markdown file or a directory. */\nfunction copyFileOrDir(\n ctx: PluginCtx,\n ref: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n const files = ctx.list(ref);\n if (files.length === 0) {\n return [artifact(`${destPrefix}${extname(ref) || \".md\"}`, ctx.read(ref), { kind })];\n }\n return copyDir(ctx, ref, destPrefix, kind);\n}\n\n/**\n * Read a skill's SKILL.md frontmatter so the sidecar can mirror its identity.\n * Returns empty data when there is no SKILL.md or no frontmatter block.\n */\nfunction skillFrontmatter(ctx: PluginCtx, ref: string): Record<string, unknown> {\n try {\n const md = ctx.read(`${ref}/SKILL.md`).toString(\"utf8\");\n return parseFrontmatter(md).data;\n } catch {\n return {};\n }\n}\n\n/**\n * Build the per-skill `agents/openai.yaml` sidecar. Shape is CONFIRMED in\n * harness-research.md: `interface.{display_name,short_description}`,\n * `policy.allow_implicit_invocation`, `dependencies.tools`.\n */\nfunction skillSidecar(name: string, description: string): string {\n const yamlString = (v: string): string => JSON.stringify(v);\n return [\n \"interface:\",\n ` display_name: ${yamlString(name)}`,\n ` short_description: ${yamlString(description)}`,\n \"policy:\",\n \" allow_implicit_invocation: true\",\n \"dependencies:\",\n \" tools: []\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport const codexAdapter: HarnessAdapter = {\n target: \"codex\",\n version: \"0.1.0\",\n targetSchema: TARGET_SCHEMA,\n\n detect(scope: Scope, cwd: string): InstallPaths {\n const root = scope === \"user\" ? join(homedir(), \".codex\") : join(cwd, \".codex\");\n // User and project skills live on the SHARED `.agents/skills` path, NOT under\n // the `.codex` root (harness-research.md, Codex Skills section).\n const skills =\n scope === \"user\" ? join(homedir(), \".agents\", \"skills\") : join(cwd, \".agents\", \"skills\");\n return {\n root,\n plugins: join(root, \"plugins\"),\n skills,\n // config.toml (MCP servers) lives at the `.codex` root.\n mcp: root,\n agents: join(root, \"agents\"),\n // TODO(verify): Codex documents no dedicated commands dir; best-effort under root.\n commands: join(root, \"commands\"),\n // TODO(verify): Codex documents no hooks dir; best-effort under root.\n hooks: join(root, \"hooks\"),\n catalog: root,\n };\n },\n\n transform(component: Component, ctx: PluginCtx): CompiledArtifact[] {\n const ref = refOf(component);\n const leaf = leafNameOf(component);\n switch (kindOf(component)) {\n case \"skill\": {\n const files = copyDir(ctx, ref, `skills/${leaf}`, \"skill\");\n const fm = skillFrontmatter(ctx, ref);\n const displayName = typeof fm.name === \"string\" ? fm.name : leaf;\n const shortDescription = typeof fm.description === \"string\" ? fm.description : \"\";\n files.push(\n artifact(\n `skills/${leaf}/agents/openai.yaml`,\n skillSidecar(displayName, shortDescription),\n {\n kind: \"skill\",\n },\n ),\n );\n return files;\n }\n case \"agent\": {\n // Codex subagents are TOML files at agents/<leaf>.toml.\n // TODO(verify): exact subagent field set; documented fields are name,\n // description, developer_instructions (+ optional model/sandbox_mode/etc).\n const md = ctx.read(ref).toString(\"utf8\");\n const { data, body } = parseFrontmatter(md);\n const name = typeof data.name === \"string\" ? data.name : leaf;\n const description = typeof data.description === \"string\" ? data.description : \"\";\n return [\n artifact(`agents/${leaf}.toml`, renderAgentToml(name, description, body), {\n kind: \"agent\",\n }),\n ];\n }\n case \"command\":\n // TODO(verify): no documented Codex commands dir; placed best-effort.\n return copyFileOrDir(ctx, ref, `commands/${leaf}`, \"command\");\n case \"hook\":\n // TODO(verify): no documented Codex hooks dir; placed best-effort.\n return copyFileOrDir(ctx, ref, `hooks/${leaf}`, \"hook\");\n case \"mcp\":\n // Verbatim provenance copy; the runnable config goes into config.toml.\n return copyDir(ctx, ref, `mcp/${leaf}`, \"mcp\");\n case \"passthrough\":\n // TODO(verify): no documented Codex hooks dir; placed best-effort, disabled.\n return [\n artifact(`hooks/${basename(ref)}`, ctx.read(ref), { kind: \"hook\", executable: true }),\n ];\n default:\n return [];\n }\n },\n\n emitManifest(plugin: Plugin, ctx: PluginCtx): CompiledArtifact[] {\n const artifacts: CompiledArtifact[] = [];\n\n const mcpServers: Record<string, McpServerConfig> = {};\n for (const c of plugin.components) {\n if (kindOf(c) !== \"mcp\") continue;\n try {\n const server = JSON.parse(ctx.read(`${refOf(c)}/server.json`).toString(\"utf8\"));\n mcpServers[mcpServerName(server)] = mcpRunConfig(server);\n } catch {\n // validate.ts already surfaced an error for an unparsable server.json.\n }\n }\n\n const toml = renderMcpServersToml(mcpServers);\n if (toml) artifacts.push(artifact(\"config.toml\", toml, { kind: \"manifest\" }));\n\n // Best-effort plugin descriptor. TODO(verify): the v0.117 plugin.json shape\n // is not fully documented; fields here are a sensible minimum.\n const manifest: { name: string; version?: string; description?: string } = {\n name: plugin.name,\n version: plugin.version,\n };\n if (plugin.description) manifest.description = plugin.description;\n artifacts.push(artifact(\"plugin.json\", json(manifest), { kind: \"manifest\" }));\n\n return artifacts;\n },\n\n emitCatalog(marketplace: ResolvedMarketplace): CompiledArtifact[] {\n // TODO(verify): Codex has no confirmed native marketplace catalog format;\n // this weft-marketplace.json index is best-effort.\n const plugins = marketplace.entries.map((entry) => {\n const e: {\n name: string;\n source: string;\n description?: string;\n version?: string;\n category?: string;\n tags?: string[];\n } = {\n name: entry.name,\n source: entry.source.startsWith(\"./\") ? entry.source : `./${entry.source}`,\n };\n if (entry.description) e.description = entry.description;\n if (entry.version) e.version = entry.version;\n if (entry.category) e.category = entry.category;\n if (entry.tags) e.tags = entry.tags;\n return e;\n });\n\n const catalog: {\n name: string;\n owner: { name: string; email?: string };\n description?: string;\n plugins: typeof plugins;\n } = {\n name: marketplace.name,\n owner: marketplace.owner.email\n ? { name: marketplace.owner.name, email: marketplace.owner.email }\n : { name: marketplace.owner.name },\n plugins,\n };\n if (marketplace.description) catalog.description = marketplace.description;\n\n return [artifact(\"weft-marketplace.json\", json(catalog), { kind: \"catalog\" })];\n },\n\n importNative: importCodex,\n};\n\nfunction tomlString(value: string): string {\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/** Render a Codex subagent TOML. Multi-line instructions use a basic string. */\nfunction renderAgentToml(name: string, description: string, instructions: string): string {\n const lines = [`name = ${tomlString(name)}`];\n if (description) lines.push(`description = ${tomlString(description)}`);\n const body = instructions.trim();\n if (body) {\n const escaped = body.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n lines.push(`developer_instructions = \"\"\"\\n${escaped}\\n\"\"\"`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport default codexAdapter;\n"]}
1
+ {"version":3,"sources":["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R,IAAA,MAAM,OAAA,GAAU,KAAK,OAAA,CAAQ,KAAA,EAAO,MAAM,CAAA,CAAE,OAAA,CAAQ,QAAQ,WAAW,CAAA;AACvE,IAAA,KAAA,CAAM,IAAA,CAAK,CAAA;AAAA,EAAiC,OAAO;AAAA,GAAA,CAAO,CAAA;AAAA,EAC5D;AACA,EAAA,OAAO,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,IAAI,CAAC;AAAA,CAAA;AAC5B;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from \"node:fs\";\nimport { join, relative } from \"node:path\";\nimport {\n artifact,\n type CompiledArtifact,\n type ImportedMarketplace,\n type ImportedPlugin,\n type ImportOptions,\n type ImportResult,\n} from \"@michaelfromyeg/weft-adapter-kit\";\nimport type { Component, Marketplace, Plugin } from \"@michaelfromyeg/weft-schema\";\n\nconst MCP_SCHEMA = \"https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json\";\nconst json = (o: unknown): string => `${JSON.stringify(o, null, 2)}\\n`;\n\nfunction readJson(path: string): Record<string, unknown> | null {\n try {\n return JSON.parse(readFileSync(path, \"utf8\"));\n } catch {\n return null;\n }\n}\n\n/** Subdirectories of `dir` that contain `marker`. */\nfunction subdirsWith(dir: string, marker: string): string[] {\n if (!(existsSync(dir) && statSync(dir).isDirectory())) return [];\n return readdirSync(dir)\n .filter((n) => statSync(join(dir, n)).isDirectory() && existsSync(join(dir, n, marker)))\n .sort();\n}\n\nfunction filesWithExt(dir: string, ext: string): string[] {\n if (!(existsSync(dir) && statSync(dir).isDirectory())) return [];\n return readdirSync(dir)\n .filter((n) => n.endsWith(ext) && statSync(join(dir, n)).isFile())\n .sort();\n}\n\nfunction copyTree(\n srcDir: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n const out: CompiledArtifact[] = [];\n const walk = (d: string) => {\n for (const n of readdirSync(d).sort()) {\n const abs = join(d, n);\n if (statSync(abs).isDirectory()) walk(abs);\n else\n out.push(artifact(`${destPrefix}/${relative(srcDir, abs)}`, readFileSync(abs), { kind }));\n }\n };\n walk(srcDir);\n return out;\n}\n\n/** A Weft source string from a Codex marketplace entry `source` object. */\nfunction sourceToString(source: unknown): string {\n if (typeof source === \"string\") return source;\n const s = source as Record<string, unknown>;\n switch (s?.source) {\n case \"local\":\n return String(s.path ?? \"\");\n case \"git-subdir\": {\n const url = String(s.url ?? \"\");\n const gh = url.match(/github\\.com\\/([^/]+)\\/(.+?)(?:\\.git)?$/);\n if (gh) {\n const sub = typeof s.path === \"string\" ? s.path.replace(/^\\.\\//, \"\") : \"\";\n const ref = typeof s.ref === \"string\" ? s.ref : \"\";\n return `github:${gh[1]}/${gh[2]}${sub ? `/${sub}` : \"\"}${ref ? `#${ref}` : \"\"}`;\n }\n return url;\n }\n default:\n return String(source);\n }\n}\n\ninterface McpServerCfg {\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n type?: string;\n url?: string;\n}\n\n/** Reconstruct an MCP-standard server.json from a Codex run config (lossy but functional). */\nfunction synthesizeServerJson(namespace: string, name: string, cfg: McpServerCfg): unknown {\n const base = {\n $schema: MCP_SCHEMA,\n name: `${namespace}/${name}`,\n description: `Imported ${name} MCP server.`,\n version: \"0.0.0\",\n };\n if (cfg.url) return { ...base, remotes: [{ type: cfg.type ?? \"streamable-http\", url: cfg.url }] };\n if (cfg.command === \"npx\" && Array.isArray(cfg.args)) {\n const ident = cfg.args.find((a) => a !== \"-y\" && !a.startsWith(\"-\"));\n if (ident) {\n const at = ident.lastIndexOf(\"@\");\n const id = at > 0 ? ident.slice(0, at) : ident;\n const version = at > 0 ? ident.slice(at + 1) : undefined;\n return {\n ...base,\n packages: [\n {\n registryType: \"npm\",\n identifier: id,\n ...(version ? { version } : {}),\n transport: { type: \"stdio\" },\n },\n ],\n };\n }\n }\n return {\n ...base,\n ...(cfg.command ? { command: cfg.command } : {}),\n ...(cfg.args ? { args: cfg.args } : {}),\n ...(cfg.env ? { env: cfg.env } : {}),\n };\n}\n\n/**\n * Read a plugin's `.mcp.json` server map. Accepts both the direct\n * `{ \"<name>\": { command, args, ... } }` form Weft emits and the wrapped\n * `{ \"mcp_servers\": { ... } }` form Codex also documents.\n */\nfunction readMcpJson(path: string): Record<string, McpServerCfg> {\n const parsed = readJson(path);\n if (!parsed) return {};\n const map =\n parsed.mcp_servers && typeof parsed.mcp_servers === \"object\"\n ? (parsed.mcp_servers as Record<string, unknown>)\n : parsed;\n const servers: Record<string, McpServerCfg> = {};\n for (const [name, cfg] of Object.entries(map)) {\n if (cfg && typeof cfg === \"object\") servers[name] = cfg as McpServerCfg;\n }\n return servers;\n}\n\nfunction importPlugin(\n dir: string,\n manifest: Record<string, unknown> | null,\n name: string,\n namespace: string,\n): ImportedPlugin {\n const components: Component[] = [];\n const files: CompiledArtifact[] = [];\n\n // Skills: each skills/<name> dir with a SKILL.md. The per-skill\n // agents/openai.yaml sidecar inside is harness metadata, not a component; it\n // is carried along verbatim as a skill asset but never wired as an agent.\n for (const sk of subdirsWith(join(dir, \"skills\"), \"SKILL.md\")) {\n components.push({ skill: `skills/${sk}` });\n files.push(...copyTree(join(dir, \"skills\", sk), `skills/${sk}`, \"skill\"));\n }\n // Codex subagents are TOML files at agents/<file>.toml.\n for (const f of filesWithExt(join(dir, \"agents\"), \".toml\")) {\n components.push({ agent: `agents/${f}` });\n files.push(artifact(`agents/${f}`, readFileSync(join(dir, \"agents\", f)), { kind: \"agent\" }));\n }\n\n // MCP: prefer the verbatim server.json copies a Weft build leaves under mcp/.\n // Only when there is no mcp/ dir do we reconstruct from the .mcp.json server map.\n const mcpDir = join(dir, \"mcp\");\n if (existsSync(mcpDir) && statSync(mcpDir).isDirectory()) {\n for (const leaf of subdirsWith(mcpDir, \"server.json\")) {\n components.push({ mcp: `mcp/${leaf}` });\n files.push(\n artifact(`mcp/${leaf}/server.json`, readFileSync(join(mcpDir, leaf, \"server.json\")), {\n kind: \"mcp\",\n }),\n );\n }\n } else if (existsSync(join(dir, \".mcp.json\"))) {\n const servers = readMcpJson(join(dir, \".mcp.json\"));\n for (const [serverName, cfg] of Object.entries(servers)) {\n components.push({ mcp: `mcp/${serverName}` });\n files.push(\n artifact(\n `mcp/${serverName}/server.json`,\n json(synthesizeServerJson(namespace, serverName, cfg)),\n { kind: \"mcp\" },\n ),\n );\n }\n }\n\n const author = manifest?.author as { name?: string; email?: string } | undefined;\n const plugin: Plugin = {\n name,\n version: String(manifest?.version ?? \"0.1.0\"),\n owner: {\n name: author?.name ?? name,\n namespace,\n ...(author?.email ? { email: author.email } : {}),\n },\n ...(manifest?.description ? { description: String(manifest.description) } : {}),\n components,\n };\n return { kind: \"plugin\", plugin, files };\n}\n\nfunction importMarketplace(\n manifest: Record<string, unknown>,\n namespace: string,\n): ImportedMarketplace {\n // The Codex catalog has no owner; it carries `interface.displayName` instead.\n const iface = manifest.interface as { displayName?: string } | undefined;\n const ownerName = iface?.displayName ?? String(manifest.name);\n const plugins = ((manifest.plugins as Record<string, unknown>[]) ?? []).map((p) => ({\n plugin: sourceToString(p.source),\n ...(p.category ? { category: String(p.category) } : {}),\n }));\n const marketplace: Marketplace = {\n name: String(manifest.name),\n owner: { name: ownerName, namespace },\n plugins,\n };\n return { kind: \"marketplace\", marketplace };\n}\n\n/** Reverse-compile a Codex plugin or marketplace dir into the Weft model. */\nexport function importCodex(dir: string, opts?: ImportOptions): ImportResult | null {\n const namespace = opts?.namespace ?? \"com.imported\";\n\n // Native Codex marketplace catalog (shared `.agents` tree).\n const marketplace = readJson(join(dir, \".agents\", \"plugins\", \"marketplace.json\"));\n if (marketplace) return importMarketplace(marketplace, namespace);\n\n const manifest = readJson(join(dir, \".codex-plugin\", \"plugin.json\"));\n const basename = dir.replace(/\\/+$/, \"\").split(\"/\").pop() || \"imported-plugin\";\n const name = typeof manifest?.name === \"string\" ? manifest.name : basename;\n\n // A plugin is anything with the Codex component layout (manifest is best-effort).\n if (manifest || existsSync(join(dir, \"skills\")) || existsSync(join(dir, \"agents\"))) {\n return importPlugin(dir, manifest, name, namespace);\n }\n return null;\n}\n","/**\n * Derives a runnable Codex MCP server config from an MCP-standard `server.json`\n * (the registry's ServerJSON shape: packages[] / remotes[] / a bare command).\n * The result is one entry in a plugin's `.mcp.json` server map.\n *\n * Codex infers the transport from the keys present (`command` => stdio, `url` =>\n * http); there is NO `transport` key (harness-research.md, Codex MCP section).\n * Stored standards stay verbatim in the plugin; this is the tool-specific view.\n */\n\nexport interface McpServerConfig {\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n url?: string;\n}\n\ninterface McpPackage {\n registryType?: string;\n identifier?: string;\n version?: string;\n transport?: { type?: string };\n}\ninterface McpRemote {\n type?: string;\n url?: string;\n headers?: Array<{ name: string; value: string }>;\n}\ninterface ServerJson {\n name?: string;\n packages?: McpPackage[];\n remotes?: McpRemote[];\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n}\n\n/** The short server key Codex uses (the part after the reverse-DNS namespace). */\nexport function mcpServerName(server: ServerJson): string {\n const raw = server.name ?? \"server\";\n const afterSlash = raw.includes(\"/\") ? raw.slice(raw.lastIndexOf(\"/\") + 1) : raw;\n return afterSlash || \"server\";\n}\n\nconst RUNNERS: Record<string, string> = { npm: \"npx\", pypi: \"uvx\" };\n\nexport function mcpRunConfig(server: ServerJson): McpServerConfig {\n const pkg = server.packages?.[0];\n if (pkg?.identifier) {\n if (pkg.registryType === \"oci\") {\n return { command: \"docker\", args: [\"run\", \"-i\", \"--rm\", pkg.identifier] };\n }\n const runner = RUNNERS[pkg.registryType ?? \"npm\"] ?? \"npx\";\n const ident = pkg.version ? `${pkg.identifier}@${pkg.version}` : pkg.identifier;\n const args = runner === \"npx\" ? [\"-y\", ident] : [ident];\n return { command: runner, args };\n }\n\n const remote = server.remotes?.[0];\n if (remote?.url) {\n // Codex http servers carry only `url` here; headers/bearer-token live under\n // documented sub-keys we don't synthesize without provenance.\n return { url: remote.url };\n }\n\n if (server.command) {\n const config: McpServerConfig = { command: server.command };\n if (server.args) config.args = server.args;\n if (server.env) config.env = server.env;\n return config;\n }\n\n return { command: \"echo\", args: [\"server.json declares no runnable transport\"] };\n}\n","import { homedir } from \"node:os\";\nimport { basename, extname, join } from \"node:path\";\nimport {\n artifact,\n type CompiledArtifact,\n type HarnessAdapter,\n type InstallPaths,\n type PluginCtx,\n parseFrontmatter,\n type ResolvedMarketplace,\n} from \"@michaelfromyeg/weft-adapter-kit\";\nimport {\n type Component,\n kindOf,\n leafNameOf,\n type Plugin,\n refOf,\n type Scope,\n} from \"@michaelfromyeg/weft-schema\";\nimport { importCodex } from \"./import\";\nimport { type McpServerConfig, mcpRunConfig, mcpServerName } from \"./mcp\";\n\n/** Bump on any change to Codex's plugin/marketplace/sidecar shape (spec §5). */\nconst TARGET_SCHEMA = \"codex-plugin/0.121\";\n\nconst json = (o: unknown): string => `${JSON.stringify(o, null, 2)}\\n`;\n\ninterface CodexAuthor {\n name: string;\n email?: string;\n}\nfunction author(name: string, email?: string): CodexAuthor {\n return email ? { name, email } : { name };\n}\n\ninterface CodexPluginManifest {\n name: string;\n version?: string;\n description?: string;\n author?: CodexAuthor;\n /** Path to the skills dir, relative to the plugin root. */\n skills?: string;\n /** Path to the MCP server map (.mcp.json), relative to the plugin root. */\n mcpServers?: string;\n interface?: { displayName: string; shortDescription?: string };\n}\n\ninterface CodexLocalSource {\n source: \"local\";\n path: string;\n}\ninterface CodexGitSource {\n source: \"git-subdir\";\n url: string;\n path?: string;\n ref?: string;\n}\ninterface CodexCatalogPlugin {\n name: string;\n source: CodexLocalSource | CodexGitSource;\n policy: { installation: string; authentication: string };\n category: string;\n}\ninterface CodexMarketplace {\n name: string;\n interface: { displayName: string };\n plugins: CodexCatalogPlugin[];\n}\n\n/**\n * Map a resolved Weft entry source to Codex's discriminated source object. Local\n * relative paths become `{source:\"local\"}`; github/git URLs become\n * `{source:\"git-subdir\"}`. Codex resolves `path` relative to the repo root.\n */\nfunction toCodexSource(source: string): CodexLocalSource | CodexGitSource {\n const gh = source.match(/^github:([^/#]+)\\/([^#]+?)(?:#(.+))?$/);\n if (gh) {\n const [, owner, repoAndSub, ref] = gh;\n const slash = repoAndSub.indexOf(\"/\");\n const repo = slash >= 0 ? repoAndSub.slice(0, slash) : repoAndSub;\n const sub = slash >= 0 ? repoAndSub.slice(slash + 1) : \"\";\n return {\n source: \"git-subdir\",\n url: `https://github.com/${owner}/${repo}.git`,\n ...(sub ? { path: `./${sub}` } : {}),\n ...(ref ? { ref } : {}),\n };\n }\n if (/^https?:\\/\\//.test(source) || source.endsWith(\".git\")) {\n return { source: \"git-subdir\", url: source };\n }\n return { source: \"local\", path: source.startsWith(\"./\") ? source : `./${source}` };\n}\n\n/** Copy every file under a plugin dir into `destPrefix/`, preserving structure. */\nfunction copyDir(\n ctx: PluginCtx,\n ref: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n return ctx.list(ref).map((file) => {\n const within = file.startsWith(`${ref}/`) ? file.slice(ref.length + 1) : basename(file);\n return artifact(`${destPrefix}/${within}`, ctx.read(file), { kind });\n });\n}\n\n/** Place a component that may be a single Markdown file or a directory. */\nfunction copyFileOrDir(\n ctx: PluginCtx,\n ref: string,\n destPrefix: string,\n kind: CompiledArtifact[\"kind\"],\n): CompiledArtifact[] {\n const files = ctx.list(ref);\n if (files.length === 0) {\n return [artifact(`${destPrefix}${extname(ref) || \".md\"}`, ctx.read(ref), { kind })];\n }\n return copyDir(ctx, ref, destPrefix, kind);\n}\n\n/**\n * Read a skill's SKILL.md frontmatter so the sidecar can mirror its identity.\n * Returns empty data when there is no SKILL.md or no frontmatter block.\n */\nfunction skillFrontmatter(ctx: PluginCtx, ref: string): Record<string, unknown> {\n try {\n const md = ctx.read(`${ref}/SKILL.md`).toString(\"utf8\");\n return parseFrontmatter(md).data;\n } catch {\n return {};\n }\n}\n\n/**\n * Build the per-skill `agents/openai.yaml` sidecar. Shape is CONFIRMED in\n * harness-research.md: `interface.{display_name,short_description}`,\n * `policy.allow_implicit_invocation`, `dependencies.tools`.\n */\nfunction skillSidecar(name: string, description: string): string {\n const yamlString = (v: string): string => JSON.stringify(v);\n return [\n \"interface:\",\n ` display_name: ${yamlString(name)}`,\n ` short_description: ${yamlString(description)}`,\n \"policy:\",\n \" allow_implicit_invocation: true\",\n \"dependencies:\",\n \" tools: []\",\n \"\",\n ].join(\"\\n\");\n}\n\nexport const codexAdapter: HarnessAdapter = {\n target: \"codex\",\n version: \"0.1.0\",\n targetSchema: TARGET_SCHEMA,\n\n detect(scope: Scope, cwd: string): InstallPaths {\n const root = scope === \"user\" ? join(homedir(), \".codex\") : join(cwd, \".codex\");\n // User and project skills live on the SHARED `.agents/skills` path, NOT under\n // the `.codex` root (harness-research.md, Codex Skills section).\n const skills =\n scope === \"user\" ? join(homedir(), \".agents\", \"skills\") : join(cwd, \".agents\", \"skills\");\n return {\n root,\n plugins: join(root, \"plugins\"),\n skills,\n // config.toml (MCP servers) lives at the `.codex` root.\n mcp: root,\n agents: join(root, \"agents\"),\n // TODO(verify): Codex documents no dedicated commands dir; best-effort under root.\n commands: join(root, \"commands\"),\n // TODO(verify): Codex plugins reference hooks via a `hooks/hooks.json` manifest\n // path; this install-scope dir placement is best-effort and not wired to it.\n hooks: join(root, \"hooks\"),\n // Native marketplace catalog lives at `.agents/plugins/marketplace.json`\n // (shared `.agents` tree), NOT under the `.codex` root.\n catalog:\n scope === \"user\" ? join(homedir(), \".agents\", \"plugins\") : join(cwd, \".agents\", \"plugins\"),\n };\n },\n\n transform(component: Component, ctx: PluginCtx): CompiledArtifact[] {\n const ref = refOf(component);\n const leaf = leafNameOf(component);\n switch (kindOf(component)) {\n case \"skill\": {\n const files = copyDir(ctx, ref, `skills/${leaf}`, \"skill\");\n const fm = skillFrontmatter(ctx, ref);\n const displayName = typeof fm.name === \"string\" ? fm.name : leaf;\n const shortDescription = typeof fm.description === \"string\" ? fm.description : \"\";\n files.push(\n artifact(\n `skills/${leaf}/agents/openai.yaml`,\n skillSidecar(displayName, shortDescription),\n {\n kind: \"skill\",\n },\n ),\n );\n return files;\n }\n case \"agent\": {\n // Codex subagents are TOML files at agents/<leaf>.toml.\n // TODO(verify): exact subagent field set; documented fields are name,\n // description, developer_instructions (+ optional model/sandbox_mode/etc).\n const md = ctx.read(ref).toString(\"utf8\");\n const { data, body } = parseFrontmatter(md);\n const name = typeof data.name === \"string\" ? data.name : leaf;\n const description = typeof data.description === \"string\" ? data.description : \"\";\n return [\n artifact(`agents/${leaf}.toml`, renderAgentToml(name, description, body), {\n kind: \"agent\",\n }),\n ];\n }\n case \"command\":\n // TODO(verify): no documented Codex commands dir; placed best-effort.\n return copyFileOrDir(ctx, ref, `commands/${leaf}`, \"command\");\n case \"hook\":\n // TODO(verify): Codex declares hooks via a `hooks/hooks.json` manifest; this\n // per-hook placement is best-effort and not yet wired into that file.\n return copyFileOrDir(ctx, ref, `hooks/${leaf}`, \"hook\");\n case \"mcp\":\n // Verbatim provenance copy; the runnable config goes into .mcp.json.\n return copyDir(ctx, ref, `mcp/${leaf}`, \"mcp\");\n case \"passthrough\":\n // TODO(verify): see the hook case; placed best-effort, disabled.\n return [\n artifact(`hooks/${basename(ref)}`, ctx.read(ref), { kind: \"hook\", executable: true }),\n ];\n default:\n return [];\n }\n },\n\n emitManifest(plugin: Plugin, ctx: PluginCtx): CompiledArtifact[] {\n const artifacts: CompiledArtifact[] = [];\n\n const mcpServers: Record<string, McpServerConfig> = {};\n for (const c of plugin.components) {\n if (kindOf(c) !== \"mcp\") continue;\n try {\n const server = JSON.parse(ctx.read(`${refOf(c)}/server.json`).toString(\"utf8\"));\n mcpServers[mcpServerName(server)] = mcpRunConfig(server);\n } catch {\n // validate.ts already surfaced an error for an unparsable server.json.\n }\n }\n\n const hasSkills = plugin.components.some((c) => kindOf(c) === \"skill\");\n const hasMcp = Object.keys(mcpServers).length > 0;\n\n const manifest: CodexPluginManifest = {\n name: plugin.name,\n version: plugin.version,\n author: author(plugin.owner.name, plugin.owner.email),\n };\n if (plugin.description) manifest.description = plugin.description;\n // Auto-discovery covers the default layout; the explicit paths let Codex find\n // skills/MCP without scanning and make the bundle self-describing.\n if (hasSkills) manifest.skills = \"./skills/\";\n if (hasMcp) manifest.mcpServers = \"./.mcp.json\";\n manifest.interface = plugin.description\n ? { displayName: plugin.name, shortDescription: plugin.description }\n : { displayName: plugin.name };\n\n // The manifest MUST live under `.codex-plugin/` (Codex plugin spec, v0.121).\n artifacts.push(artifact(\".codex-plugin/plugin.json\", json(manifest), { kind: \"manifest\" }));\n // MCP servers go in a sibling `.mcp.json` (a direct name->config map) that the\n // manifest references -- Codex no longer reads a plugin-local config.toml.\n if (hasMcp) artifacts.push(artifact(\".mcp.json\", json(mcpServers), { kind: \"manifest\" }));\n\n return artifacts;\n },\n\n emitCatalog(marketplace: ResolvedMarketplace): CompiledArtifact[] {\n const plugins: CodexCatalogPlugin[] = marketplace.entries.map((entry) => ({\n name: entry.name,\n source: toCodexSource(entry.source),\n // Codex requires a policy; these defaults match its own example marketplaces.\n policy: { installation: \"AVAILABLE\", authentication: \"ON_INSTALL\" },\n // Codex requires a category; fall back to a valid default when unset.\n category: entry.category ?? \"Productivity\",\n }));\n\n const catalog: CodexMarketplace = {\n name: marketplace.name,\n interface: { displayName: marketplace.name },\n plugins,\n };\n\n return [artifact(\".agents/plugins/marketplace.json\", json(catalog), { kind: \"catalog\" })];\n },\n\n importNative: importCodex,\n};\n\nfunction tomlString(value: string): string {\n return `\"${value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/** Render a Codex subagent TOML. Multi-line instructions use a basic string. */\nfunction renderAgentToml(name: string, description: string, instructions: string): string {\n const lines = [`name = ${tomlString(name)}`];\n if (description) lines.push(`description = ${tomlString(description)}`);\n const body = instructions.trim();\n if (body) {\n const escaped = body.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"\"\"/g, '\\\\\"\\\\\"\\\\\"');\n lines.push(`developer_instructions = \"\"\"\\n${escaped}\\n\"\"\"`);\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\nexport default codexAdapter;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@michaelfromyeg/weft-adapter-codex",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Weft adapter for OpenAI Codex: config.toml MCP servers + skill sidecars + component placement.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,11 +16,11 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@michaelfromyeg/weft-adapter-kit": "1.2.0",
20
- "@michaelfromyeg/weft-schema": "1.2.0"
19
+ "@michaelfromyeg/weft-schema": "1.3.0",
20
+ "@michaelfromyeg/weft-adapter-kit": "1.3.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@michaelfromyeg/weft-core": "1.2.0"
23
+ "@michaelfromyeg/weft-core": "1.3.0"
24
24
  },
25
25
  "license": "MIT",
26
26
  "author": "Michael DeMarco",