@agentchatme/codex 0.0.1
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/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/agentchat-cli.mjs +7582 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine, shipped inside this package's own tarball (stamped at build time
|
|
3
|
+
* from core/dist by scripts/stamp-content.mjs). Bundling it rather than
|
|
4
|
+
* depending on @agentchatme/cli means there is no separate resolution step to
|
|
5
|
+
* fail, no npx cold start, and no window in which the front door and the
|
|
6
|
+
* engine are different versions.
|
|
7
|
+
*/
|
|
8
|
+
declare function cliBundlePath(): string;
|
|
9
|
+
declare function main(argv?: string[]): number;
|
|
10
|
+
|
|
11
|
+
export { cliBundlePath, main };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { spawnSync } from "child_process";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path2 from "path";
|
|
7
|
+
import { fileURLToPath } from "url";
|
|
8
|
+
|
|
9
|
+
// src/args.ts
|
|
10
|
+
import * as os from "os";
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
function codexHome() {
|
|
13
|
+
const override = process.env["CODEX_HOME"];
|
|
14
|
+
if (override !== void 0 && override.trim().length > 0) return path.resolve(override);
|
|
15
|
+
return path.join(os.homedir(), ".codex");
|
|
16
|
+
}
|
|
17
|
+
function codexIdentityHome() {
|
|
18
|
+
return path.join(codexHome(), "agentchat");
|
|
19
|
+
}
|
|
20
|
+
function buildArgs(argv) {
|
|
21
|
+
const offending = argv.find((a) => a === "--platform" || a.startsWith("--platform="));
|
|
22
|
+
if (offending !== void 0) {
|
|
23
|
+
return {
|
|
24
|
+
ok: false,
|
|
25
|
+
error: [
|
|
26
|
+
"This command only ever sets up your Codex agent, so --platform is not accepted here.",
|
|
27
|
+
"Working on a different coding agent? Use its own front door:",
|
|
28
|
+
" Claude Code: /plugin marketplace add agentchatme/agentchat-coding-agents",
|
|
29
|
+
" /plugin install agentchat@agentchatme"
|
|
30
|
+
].join("\n")
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const args = argv.length === 0 ? ["install"] : argv;
|
|
34
|
+
return { ok: true, args: [...args, "--platform", "codex"] };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/index.ts
|
|
38
|
+
function cliBundlePath() {
|
|
39
|
+
return path2.join(path2.dirname(fileURLToPath(import.meta.url)), "agentchat-cli.mjs");
|
|
40
|
+
}
|
|
41
|
+
function main(argv = process.argv.slice(2)) {
|
|
42
|
+
const built = buildArgs(argv);
|
|
43
|
+
if (!built.ok) {
|
|
44
|
+
console.error(built.error);
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
const cli = cliBundlePath();
|
|
48
|
+
if (!fs.existsSync(cli)) {
|
|
49
|
+
console.error(
|
|
50
|
+
`The AgentChat engine is missing from this install (expected ${cli}). Re-run with: npx -y @agentchatme/codex@latest`
|
|
51
|
+
);
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
const result = spawnSync(process.execPath, [cli, ...built.args], {
|
|
55
|
+
stdio: "inherit",
|
|
56
|
+
env: {
|
|
57
|
+
...process.env,
|
|
58
|
+
// Pin every downstream read/write to the CODEX agent's identity home.
|
|
59
|
+
// Belt and braces with --platform: commands that take no platform flag
|
|
60
|
+
// (status, doctor) are scoped by this alone.
|
|
61
|
+
AGENTCHAT_HOME: codexIdentityHome(),
|
|
62
|
+
// Tell the engine what command this user actually has. Someone who ran
|
|
63
|
+
// `npx -y @agentchatme/codex` never installed a global `agentchat`, so
|
|
64
|
+
// every "now run …" hint must be phrased in the front door they used.
|
|
65
|
+
AGENTCHAT_CLI_NAME: "npx -y @agentchatme/codex"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
if (result.error !== void 0) {
|
|
69
|
+
console.error(`Could not run the AgentChat CLI: ${String(result.error)}`);
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
return result.status ?? 1;
|
|
73
|
+
}
|
|
74
|
+
process.exitCode = main();
|
|
75
|
+
export {
|
|
76
|
+
cliBundlePath,
|
|
77
|
+
main
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/args.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process'\nimport * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { buildArgs, codexIdentityHome } from './args.js'\n\n// ─── @agentchatme/codex — the Codex front door ──────────────────────────────\n//\n// Codex users get their own entry point, exactly like OpenClaw and Hermes\n// users get theirs:\n//\n// npx -y @agentchatme/codex wire Codex up\n// npx -y @agentchatme/codex register --email … --handle …\n// npx -y @agentchatme/codex status | doctor | logout | daemon …\n//\n// The engine underneath is shared — @agentchatme/cli is built once and used by\n// every packaging, and the always-on daemon likewise. What is NOT shared is\n// the surface: this command can only ever act on the Codex agent. It pins\n// AGENTCHAT_HOME to Codex's own identity home and forces `--platform codex`\n// onto every forwarded command, so \"touched another coding agent\" is not a bug\n// that can be introduced here later — no argument reaches that decision.\n//\n// A user's Codex agent and Claude Code agent are two distinct peers with two\n// distinct @handles that can DM each other. Setting one up must never depend\n// on, or disturb, the other.\n\n/**\n * The engine, shipped inside this package's own tarball (stamped at build time\n * from core/dist by scripts/stamp-content.mjs). Bundling it rather than\n * depending on @agentchatme/cli means there is no separate resolution step to\n * fail, no npx cold start, and no window in which the front door and the\n * engine are different versions.\n */\nexport function cliBundlePath(): string {\n return path.join(path.dirname(fileURLToPath(import.meta.url)), 'agentchat-cli.mjs')\n}\n\nexport function main(argv: string[] = process.argv.slice(2)): number {\n const built = buildArgs(argv)\n if (!built.ok) {\n console.error(built.error)\n return 1\n }\n\n const cli = cliBundlePath()\n if (!fs.existsSync(cli)) {\n console.error(\n `The AgentChat engine is missing from this install (expected ${cli}). Re-run with: npx -y @agentchatme/codex@latest`,\n )\n return 1\n }\n\n const result = spawnSync(process.execPath, [cli, ...built.args], {\n stdio: 'inherit',\n env: {\n ...process.env,\n // Pin every downstream read/write to the CODEX agent's identity home.\n // Belt and braces with --platform: commands that take no platform flag\n // (status, doctor) are scoped by this alone.\n AGENTCHAT_HOME: codexIdentityHome(),\n // Tell the engine what command this user actually has. Someone who ran\n // `npx -y @agentchatme/codex` never installed a global `agentchat`, so\n // every \"now run …\" hint must be phrased in the front door they used.\n AGENTCHAT_CLI_NAME: 'npx -y @agentchatme/codex',\n },\n })\n if (result.error !== undefined) {\n console.error(`Could not run the AgentChat CLI: ${String(result.error)}`)\n return 1\n }\n return result.status ?? 1\n}\n\n// Set exitCode and drain rather than process.exit() — same reasoning as the\n// core CLI: exiting mid-teardown aborts the process on Windows.\nprocess.exitCode = main()\n","import * as os from 'node:os'\nimport * as path from 'node:path'\n\n// Pure argument/path logic, kept apart from index.ts so tests can import it\n// without triggering the bin's top-level execution.\n\n/** Codex's config root, honouring CODEX_HOME exactly as the core CLI does. */\nexport function codexHome(): string {\n const override = process.env['CODEX_HOME']\n if (override !== undefined && override.trim().length > 0) return path.resolve(override)\n return path.join(os.homedir(), '.codex')\n}\n\n/** The Codex agent's own identity home — the only home this front door reads\n * or writes. Must stay in step with core's `hostHome('codex')`. */\nexport function codexIdentityHome(): string {\n return path.join(codexHome(), 'agentchat')\n}\n\nexport type BuiltArgs = { ok: true; args: string[] } | { ok: false; error: string }\n\nexport function buildArgs(argv: string[]): BuiltArgs {\n // A user-supplied --platform is refused rather than silently overridden: if\n // someone types `@agentchatme/codex … --platform claude-code` they hold a\n // wrong belief about what this command does, and quietly doing something\n // else is exactly how the old fan-out installer confused people.\n const offending = argv.find((a) => a === '--platform' || a.startsWith('--platform='))\n if (offending !== undefined) {\n return {\n ok: false,\n error: [\n 'This command only ever sets up your Codex agent, so --platform is not accepted here.',\n 'Working on a different coding agent? Use its own front door:',\n ' Claude Code: /plugin marketplace add agentchatme/agentchat-coding-agents',\n ' /plugin install agentchat@agentchatme',\n ].join('\\n'),\n }\n }\n // No subcommand → the thing people came here to do.\n const args = argv.length === 0 ? ['install'] : argv\n return { ok: true, args: [...args, '--platform', 'codex'] }\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,YAAY,QAAQ;AACpB,YAAYA,WAAU;AACtB,SAAS,qBAAqB;;;ACH9B,YAAY,QAAQ;AACpB,YAAY,UAAU;AAMf,SAAS,YAAoB;AAClC,QAAM,WAAW,QAAQ,IAAI,YAAY;AACzC,MAAI,aAAa,UAAa,SAAS,KAAK,EAAE,SAAS,EAAG,QAAY,aAAQ,QAAQ;AACtF,SAAY,UAAQ,WAAQ,GAAG,QAAQ;AACzC;AAIO,SAAS,oBAA4B;AAC1C,SAAY,UAAK,UAAU,GAAG,WAAW;AAC3C;AAIO,SAAS,UAAU,MAA2B;AAKnD,QAAM,YAAY,KAAK,KAAK,CAAC,MAAM,MAAM,gBAAgB,EAAE,WAAW,aAAa,CAAC;AACpF,MAAI,cAAc,QAAW;AAC3B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,OAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,EAAE,KAAK,IAAI;AAAA,IACb;AAAA,EACF;AAEA,QAAM,OAAO,KAAK,WAAW,IAAI,CAAC,SAAS,IAAI;AAC/C,SAAO,EAAE,IAAI,MAAM,MAAM,CAAC,GAAG,MAAM,cAAc,OAAO,EAAE;AAC5D;;;ADRO,SAAS,gBAAwB;AACtC,SAAY,WAAU,cAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,mBAAmB;AACpF;AAEO,SAAS,KAAK,OAAiB,QAAQ,KAAK,MAAM,CAAC,GAAW;AACnE,QAAM,QAAQ,UAAU,IAAI;AAC5B,MAAI,CAAC,MAAM,IAAI;AACb,YAAQ,MAAM,MAAM,KAAK;AACzB,WAAO;AAAA,EACT;AAEA,QAAM,MAAM,cAAc;AAC1B,MAAI,CAAI,cAAW,GAAG,GAAG;AACvB,YAAQ;AAAA,MACN,+DAA+D,GAAG;AAAA,IACpE;AACA,WAAO;AAAA,EACT;AAEA,QAAM,SAAS,UAAU,QAAQ,UAAU,CAAC,KAAK,GAAG,MAAM,IAAI,GAAG;AAAA,IAC/D,OAAO;AAAA,IACP,KAAK;AAAA,MACH,GAAG,QAAQ;AAAA;AAAA;AAAA;AAAA,MAIX,gBAAgB,kBAAkB;AAAA;AAAA;AAAA;AAAA,MAIlC,oBAAoB;AAAA,IACtB;AAAA,EACF,CAAC;AACD,MAAI,OAAO,UAAU,QAAW;AAC9B,YAAQ,MAAM,oCAAoC,OAAO,OAAO,KAAK,CAAC,EAAE;AACxE,WAAO;AAAA,EACT;AACA,SAAO,OAAO,UAAU;AAC1B;AAIA,QAAQ,WAAW,KAAK;","names":["path"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentchatme/codex",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "AgentChat for Codex — give your Codex agent a persistent @handle other agents can DM. One command wires the MCP server, session hooks and identity anchor, and only ever touches Codex.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agentchat-codex": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
12
|
+
"sideEffects": true,
|
|
13
|
+
"engines": { "node": ">=20.0.0" },
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"dev": "tsup --watch",
|
|
17
|
+
"type-check": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"test:watch": "vitest",
|
|
20
|
+
"prepublishOnly": "pnpm run build && pnpm run type-check && pnpm run test"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.19.17",
|
|
24
|
+
"tsup": "^8.5.1",
|
|
25
|
+
"typescript": "^5.7.0",
|
|
26
|
+
"vitest": "^3.2.4"
|
|
27
|
+
},
|
|
28
|
+
"keywords": ["agentchat", "codex", "openai-codex", "agents", "messaging", "mcp", "agent-to-agent"],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "AgentChat",
|
|
31
|
+
"homepage": "https://agentchat.me",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/agentchatme/agentchat-coding-agents.git",
|
|
35
|
+
"directory": "codex"
|
|
36
|
+
},
|
|
37
|
+
"bugs": { "url": "https://github.com/agentchatme/agentchat-coding-agents/issues" },
|
|
38
|
+
"publishConfig": { "access": "public" }
|
|
39
|
+
}
|