a2a-codex 1.6.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.
Files changed (80) hide show
  1. package/README.md +451 -0
  2. package/agents/example/config.json +66 -0
  3. package/agents/example/start.sh +39 -0
  4. package/agents/example/workspace/.gitkeep +0 -0
  5. package/agents/multi-agent/config.json +77 -0
  6. package/agents/multi-agent/start.sh +36 -0
  7. package/agents/multi-agent/workspace/.gitkeep +0 -0
  8. package/agents/read-only-reviewer/config.json +50 -0
  9. package/agents/read-only-reviewer/start.sh +32 -0
  10. package/agents/read-only-reviewer/workspace/.gitkeep +0 -0
  11. package/dist/cli.d.ts +17 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +175 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/codex/backend-paths.d.ts +12 -0
  16. package/dist/codex/backend-paths.d.ts.map +1 -0
  17. package/dist/codex/backend-paths.js +14 -0
  18. package/dist/codex/backend-paths.js.map +1 -0
  19. package/dist/codex/capabilities.d.ts +21 -0
  20. package/dist/codex/capabilities.d.ts.map +1 -0
  21. package/dist/codex/capabilities.js +16 -0
  22. package/dist/codex/capabilities.js.map +1 -0
  23. package/dist/codex/client-factory.d.ts +65 -0
  24. package/dist/codex/client-factory.d.ts.map +1 -0
  25. package/dist/codex/client-factory.js +36 -0
  26. package/dist/codex/client-factory.js.map +1 -0
  27. package/dist/codex/event-mapper.d.ts +33 -0
  28. package/dist/codex/event-mapper.d.ts.map +1 -0
  29. package/dist/codex/event-mapper.js +248 -0
  30. package/dist/codex/event-mapper.js.map +1 -0
  31. package/dist/codex/executor.d.ts +29 -0
  32. package/dist/codex/executor.d.ts.map +1 -0
  33. package/dist/codex/executor.js +282 -0
  34. package/dist/codex/executor.js.map +1 -0
  35. package/dist/codex/index.d.ts +8 -0
  36. package/dist/codex/index.d.ts.map +1 -0
  37. package/dist/codex/index.js +7 -0
  38. package/dist/codex/index.js.map +1 -0
  39. package/dist/codex/mcp-adapter.d.ts +29 -0
  40. package/dist/codex/mcp-adapter.d.ts.map +1 -0
  41. package/dist/codex/mcp-adapter.js +104 -0
  42. package/dist/codex/mcp-adapter.js.map +1 -0
  43. package/dist/codex/prompt-builder.d.ts +9 -0
  44. package/dist/codex/prompt-builder.d.ts.map +1 -0
  45. package/dist/codex/prompt-builder.js +16 -0
  46. package/dist/codex/prompt-builder.js.map +1 -0
  47. package/dist/codex/session-manager.d.ts +54 -0
  48. package/dist/codex/session-manager.d.ts.map +1 -0
  49. package/dist/codex/session-manager.js +124 -0
  50. package/dist/codex/session-manager.js.map +1 -0
  51. package/dist/config/defaults.d.ts +9 -0
  52. package/dist/config/defaults.d.ts.map +1 -0
  53. package/dist/config/defaults.js +60 -0
  54. package/dist/config/defaults.js.map +1 -0
  55. package/dist/config/loader.d.ts +16 -0
  56. package/dist/config/loader.d.ts.map +1 -0
  57. package/dist/config/loader.js +152 -0
  58. package/dist/config/loader.js.map +1 -0
  59. package/dist/config/types.d.ts +224 -0
  60. package/dist/config/types.d.ts.map +1 -0
  61. package/dist/config/types.js +8 -0
  62. package/dist/config/types.js.map +1 -0
  63. package/dist/index.d.ts +19 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +16 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/server/agent-card.d.ts +7 -0
  68. package/dist/server/agent-card.d.ts.map +1 -0
  69. package/dist/server/agent-card.js +20 -0
  70. package/dist/server/agent-card.js.map +1 -0
  71. package/dist/server/index.d.ts +22 -0
  72. package/dist/server/index.d.ts.map +1 -0
  73. package/dist/server/index.js +123 -0
  74. package/dist/server/index.js.map +1 -0
  75. package/dist/utils/logger.d.ts +30 -0
  76. package/dist/utils/logger.d.ts.map +1 -0
  77. package/dist/utils/logger.js +64 -0
  78. package/dist/utils/logger.js.map +1 -0
  79. package/package.json +73 -0
  80. package/schemas/agent-config.schema.json +615 -0
@@ -0,0 +1,50 @@
1
+ {
2
+ "$comment": [
3
+ "Read-only repository analysis and code review agent.",
4
+ "Codex cannot modify files in this mode.",
5
+ "Required: OPENAI_API_KEY, WORKSPACE_DIR"
6
+ ],
7
+ "agentCard": {
8
+ "name": "Codex Code Reviewer",
9
+ "description": "Read-only repository analysis and code review agent backed by OpenAI Codex.",
10
+ "version": "1.0.0",
11
+ "protocolVersion": "0.3.0",
12
+ "streaming": true,
13
+ "defaultInputModes": ["text"],
14
+ "defaultOutputModes": ["text"],
15
+ "skills": [
16
+ {
17
+ "id": "code-review",
18
+ "name": "Code Review",
19
+ "description": "Analyse repository structure and review code without modifying any files.",
20
+ "tags": ["review", "analysis", "read-only", "security"]
21
+ }
22
+ ]
23
+ },
24
+ "server": {
25
+ "port": 3022,
26
+ "hostname": "0.0.0.0",
27
+ "advertiseHost": "localhost",
28
+ "advertiseProtocol": "http"
29
+ },
30
+ "codex": {
31
+ "workingDirectory": "${WORKSPACE_DIR}",
32
+ "sandboxMode": "read-only",
33
+ "approvalPolicy": "never",
34
+ "networkAccessEnabled": false,
35
+ "webSearchMode": "disabled",
36
+ "skipGitRepoCheck": false
37
+ },
38
+ "features": {
39
+ "streamArtifactChunks": false,
40
+ "emitReasoningSummaries": true,
41
+ "emitCommandEvents": true,
42
+ "emitFileChangeEvents": false
43
+ },
44
+ "timeouts": {
45
+ "prompt": 300000
46
+ },
47
+ "logging": {
48
+ "level": "info"
49
+ }
50
+ }
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env bash
2
+ ###############################################################################
3
+ # Read-Only Reviewer Agent — start / stop / status / logs
4
+ #
5
+ # Code review and repository analysis agent backed by OpenAI Codex.
6
+ # Codex is restricted to read-only access — it cannot modify any files.
7
+ # Safe to point at any repository without risk of accidental changes.
8
+ #
9
+ # Usage:
10
+ # ./start.sh start — Start the agent in the background
11
+ # ./start.sh stop — Stop the running agent
12
+ # ./start.sh restart — Stop then start
13
+ # ./start.sh status — Show running / stopped status
14
+ # ./start.sh logs — Tail the agent log
15
+ # ./start.sh foreground — Run in the foreground (useful for debugging)
16
+ #
17
+ # Required environment:
18
+ # OPENAI_API_KEY Your OpenAI API key
19
+ #
20
+ # Point at any repository with WORKSPACE_DIR:
21
+ # WORKSPACE_DIR=/path/to/repo ./start.sh start
22
+ ###############################################################################
23
+
24
+ set -euo pipefail
25
+
26
+ AGENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
27
+ ROOT_DIR="$(cd "${AGENT_DIR}/../.." && pwd)"
28
+
29
+ export CONFIG_FILE="${AGENT_DIR}/config.json"
30
+ export WORKSPACE_DIR="${WORKSPACE_DIR:-${AGENT_DIR}/workspace}"
31
+
32
+ exec "${ROOT_DIR}/server.sh" "$@"
File without changes
package/dist/cli.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI Entry Point — a2a-codex
4
+ *
5
+ * Parses command-line flags, resolves the final configuration (in priority
6
+ * order: defaults ← JSON file ← environment variables ← CLI flags), then
7
+ * boots the A2A HTTP server and blocks until SIGINT / SIGTERM.
8
+ *
9
+ * Usage:
10
+ * a2a-codex --config agents/example/config.json
11
+ * a2a-codex --config agents/my-agent/config.json --port 3020
12
+ * a2a-codex --workspace /path/to/repo --model o4-mini
13
+ *
14
+ * Run `a2a-codex --help` for the full flag reference.
15
+ */
16
+ export {};
17
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
package/dist/cli.js ADDED
@@ -0,0 +1,175 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI Entry Point — a2a-codex
4
+ *
5
+ * Parses command-line flags, resolves the final configuration (in priority
6
+ * order: defaults ← JSON file ← environment variables ← CLI flags), then
7
+ * boots the A2A HTTP server and blocks until SIGINT / SIGTERM.
8
+ *
9
+ * Usage:
10
+ * a2a-codex --config agents/example/config.json
11
+ * a2a-codex --config agents/my-agent/config.json --port 3020
12
+ * a2a-codex --workspace /path/to/repo --model o4-mini
13
+ *
14
+ * Run `a2a-codex --help` for the full flag reference.
15
+ */
16
+ import { createRequire } from "node:module";
17
+ import { parseArgs } from "node:util";
18
+ import { dirname, resolve } from "node:path";
19
+ import { resolveConfig } from "./config/loader.js";
20
+ import { createA2AServer } from "./server/index.js";
21
+ import { logger } from "./utils/logger.js";
22
+ const _require = createRequire(import.meta.url);
23
+ const { version: PKG_VERSION } = _require("../package.json");
24
+ const log = logger.child("cli");
25
+ // ─── Help Text ────────────────────────────────────────────────────────────────
26
+ function printUsage() {
27
+ console.log(`
28
+ Usage: a2a-codex [options]
29
+
30
+ Options:
31
+ --agent-json <path> Path to agent JSON config file (alias: --config)
32
+ --config <path> Path to agent JSON config file (alias: --agent-json)
33
+ --port <number> A2A server port (default: 3020)
34
+ --hostname <addr> Bind address (default: 0.0.0.0)
35
+ --advertise-host <host> Hostname for agent card URLs (default: localhost)
36
+ --workspace <path> Workspace directory (Git repo) (alias: --working-dir)
37
+ --working-dir <path> Workspace directory (Git repo) (alias: --workspace)
38
+ --model <model> Codex model (e.g. o4-mini, gpt-4o)
39
+ --sandbox <mode> Sandbox mode (read-only | workspace-write | danger-full-access)
40
+ --agent-name <name> Agent display name
41
+ --agent-description <desc> Agent description
42
+ --stream-artifacts Stream artifact chunks (spec-correct, streaming clients)
43
+ --no-stream-artifacts Buffer artifacts — Inspector-compatible (default)
44
+ --log-level <level> Log level: debug | info | warn | error (default: info)
45
+ --help Show this help message
46
+ --version Show version
47
+
48
+ Environment variables:
49
+ OPENAI_API_KEY Required. Your OpenAI API key.
50
+ WORKSPACE_DIR Workspace directory (alternative to --workspace).
51
+ CODEX_MODEL Model override (alternative to --model).
52
+ CODEX_CA_CERTIFICATE Path to a corporate CA certificate PEM file.
53
+ LOG_LEVEL Log level override.
54
+ STREAM_ARTIFACTS Set to "true" to enable streaming artifact chunks.
55
+
56
+ Examples:
57
+ a2a-codex --config agents/example/config.json
58
+ OPENAI_API_KEY=sk-... WORKSPACE_DIR=/repo a2a-codex --config agents/example/config.json
59
+ a2a-codex --workspace /repo --model o4-mini --port 3020
60
+ `);
61
+ }
62
+ // ─── Argument Parsing ─────────────────────────────────────────────────────────
63
+ function parseCliArgs() {
64
+ const { values } = parseArgs({
65
+ options: {
66
+ "agent-json": { type: "string" },
67
+ config: { type: "string", short: "c" },
68
+ port: { type: "string", short: "p" },
69
+ hostname: { type: "string" },
70
+ "advertise-host": { type: "string" },
71
+ workspace: { type: "string", short: "w" },
72
+ "working-dir": { type: "string" },
73
+ model: { type: "string", short: "m" },
74
+ sandbox: { type: "string" },
75
+ "agent-name": { type: "string" },
76
+ "agent-description": { type: "string" },
77
+ "stream-artifacts": { type: "boolean" },
78
+ "no-stream-artifacts": { type: "boolean" },
79
+ "log-level": { type: "string" },
80
+ help: { type: "boolean", short: "h" },
81
+ version: { type: "boolean", short: "v" },
82
+ },
83
+ strict: false,
84
+ });
85
+ if (values.help) {
86
+ printUsage();
87
+ process.exit(0);
88
+ }
89
+ if (values.version) {
90
+ console.log(PKG_VERSION);
91
+ process.exit(0);
92
+ }
93
+ const configPath = (values["agent-json"] ?? values.config);
94
+ const overrides = {};
95
+ // Server
96
+ if (values.port || values.hostname || values["advertise-host"]) {
97
+ overrides.server = {};
98
+ if (values.port)
99
+ overrides.server.port = parseInt(values.port, 10);
100
+ if (values.hostname)
101
+ overrides.server.hostname = values.hostname;
102
+ if (values["advertise-host"])
103
+ overrides.server.advertiseHost = values["advertise-host"];
104
+ }
105
+ // Codex
106
+ const workspaceDir = (values.workspace ?? values["working-dir"]);
107
+ const model = values.model;
108
+ const sandbox = values.sandbox;
109
+ if (workspaceDir || model || sandbox) {
110
+ overrides.codex = {};
111
+ if (workspaceDir)
112
+ overrides.codex.workingDirectory = workspaceDir;
113
+ if (model)
114
+ overrides.codex.model = model;
115
+ if (sandbox)
116
+ overrides.codex.sandboxMode = sandbox;
117
+ }
118
+ // Agent card
119
+ if (values["agent-name"] || values["agent-description"]) {
120
+ overrides.agentCard = { name: "", description: "" };
121
+ if (values["agent-name"])
122
+ overrides.agentCard.name = values["agent-name"];
123
+ if (values["agent-description"])
124
+ overrides.agentCard.description = values["agent-description"];
125
+ }
126
+ // Features
127
+ const featureOverrides = {};
128
+ if (values["stream-artifacts"])
129
+ featureOverrides.streamArtifactChunks = true;
130
+ if (values["no-stream-artifacts"])
131
+ featureOverrides.streamArtifactChunks = false;
132
+ if (Object.keys(featureOverrides).length > 0) {
133
+ overrides.features = featureOverrides;
134
+ }
135
+ // Logging
136
+ if (values["log-level"]) {
137
+ overrides.logging = { level: values["log-level"] };
138
+ }
139
+ return { configPath, overrides };
140
+ }
141
+ // ─── Main ─────────────────────────────────────────────────────────────────────
142
+ async function main() {
143
+ const { configPath, overrides } = parseCliArgs();
144
+ const config = resolveConfig(configPath, overrides);
145
+ config.configDir = configPath
146
+ ? dirname(resolve(configPath))
147
+ : process.cwd();
148
+ // Apply log level
149
+ const levelStr = config.logging?.level ?? "info";
150
+ logger.setLevel(Logger.parseLevel(levelStr));
151
+ if (!configPath) {
152
+ log.info("No --config provided — running with built-in defaults. Pass --config <path> to load a custom agent.");
153
+ }
154
+ log.info("Starting a2a-codex", {
155
+ config: configPath ?? "(built-in defaults)",
156
+ agent: config.agentCard?.name,
157
+ port: config.server?.port,
158
+ workingDirectory: config.codex?.workingDirectory || "(not set)",
159
+ sandboxMode: config.codex?.sandboxMode,
160
+ });
161
+ const handle = await createA2AServer(config);
162
+ const shutdown = async (signal) => {
163
+ log.info(`${signal} received, shutting down...`);
164
+ await handle.shutdown();
165
+ process.exit(0);
166
+ };
167
+ process.on("SIGINT", () => void shutdown("SIGINT"));
168
+ process.on("SIGTERM", () => void shutdown("SIGTERM"));
169
+ }
170
+ import { Logger } from "./utils/logger.js";
171
+ main().catch((err) => {
172
+ log.error("Fatal error", { error: err.message, stack: err.stack });
173
+ process.exit(1);
174
+ });
175
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
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7B,MAAM,EAAE,UAAU,IAAI,qBAAqB;QAC3C,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,IAAI;QAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI;QACzB,gBAAgB,EAAE,MAAM,CAAC,KAAK,EAAE,gBAAgB,IAAI,WAAW;QAC/D,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,WAAW;KACvC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAc,EAAiB,EAAE;QACvD,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,6BAA6B,CAAC,CAAC;QACjD,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAG,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,EAAE,KAAK,EAAG,GAAa,CAAC,OAAO,EAAE,KAAK,EAAG,GAAa,CAAC,KAAK,EAAE,CAAC,CAAC;IACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Backend Paths — Codex Memory Materialization Targets
3
+ *
4
+ * Defines where Codex reads project instructions and skills.
5
+ * Codex uses AGENTS.md (not .codex/instructions.md) for project context.
6
+ *
7
+ * Note: The core WELL_KNOWN_PATHS.codex currently has an incorrect default
8
+ * (.codex/instructions.md). This wrapper-local constant takes precedence.
9
+ */
10
+ import type { BackendPaths } from "@a2a-wrapper/core";
11
+ export declare const CODEX_BACKEND_PATHS: BackendPaths;
12
+ //# sourceMappingURL=backend-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-paths.d.ts","sourceRoot":"","sources":["../../src/codex/backend-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,eAAO,MAAM,mBAAmB,EAAE,YAGjC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Backend Paths — Codex Memory Materialization Targets
3
+ *
4
+ * Defines where Codex reads project instructions and skills.
5
+ * Codex uses AGENTS.md (not .codex/instructions.md) for project context.
6
+ *
7
+ * Note: The core WELL_KNOWN_PATHS.codex currently has an incorrect default
8
+ * (.codex/instructions.md). This wrapper-local constant takes precedence.
9
+ */
10
+ export const CODEX_BACKEND_PATHS = {
11
+ instructionsPath: "AGENTS.md",
12
+ skillsBaseDir: ".agents/skills",
13
+ };
14
+ //# sourceMappingURL=backend-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend-paths.js","sourceRoot":"","sources":["../../src/codex/backend-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC/C,gBAAgB,EAAE,WAAW;IAC7B,aAAa,EAAE,gBAAgB;CAChC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Backend Capability Declaration — Codex
3
+ *
4
+ * Declares the capabilities of the Codex backend to callers and
5
+ * orchestrators. Use this to make runtime decisions about what
6
+ * the backend can and cannot do.
7
+ */
8
+ export interface BackendCapabilities {
9
+ /** Artifact delivery model. "buffered" = single final artifact. */
10
+ artifactStreaming: "buffered" | "incremental";
11
+ /** Whether tasks can be aborted mid-execution. */
12
+ cancellation: "state-only" | "abortable";
13
+ /** MCP transports the backend can accept. */
14
+ mcpTransports: Array<"stdio" | "http" | "sse">;
15
+ /** Whether the backend runs in a sandboxed environment. */
16
+ sandboxing: boolean;
17
+ /** Approval model. "none" = auto-approve; "interactive" = blocks waiting for human. */
18
+ approvals: "none" | "headless" | "interactive";
19
+ }
20
+ export declare const CODEX_CAPABILITIES: BackendCapabilities;
21
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/codex/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,iBAAiB,EAAE,UAAU,GAAG,aAAa,CAAC;IAC9C,kDAAkD;IAClD,YAAY,EAAE,YAAY,GAAG,WAAW,CAAC;IACzC,6CAA6C;IAC7C,aAAa,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,CAAC;IAC/C,2DAA2D;IAC3D,UAAU,EAAE,OAAO,CAAC;IACpB,uFAAuF;IACvF,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC;CAChD;AAED,eAAO,MAAM,kBAAkB,EAAE,mBAOhC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Backend Capability Declaration — Codex
3
+ *
4
+ * Declares the capabilities of the Codex backend to callers and
5
+ * orchestrators. Use this to make runtime decisions about what
6
+ * the backend can and cannot do.
7
+ */
8
+ export const CODEX_CAPABILITIES = {
9
+ // Declared buffered until integration tests confirm snapshot-delta extraction is safe
10
+ artifactStreaming: "buffered",
11
+ cancellation: "abortable",
12
+ mcpTransports: ["stdio", "http"],
13
+ sandboxing: true,
14
+ approvals: "none",
15
+ };
16
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/codex/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,sFAAsF;IACtF,iBAAiB,EAAE,UAAU;IAC7B,YAAY,EAAE,WAAW;IACzB,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,MAAM;CAClB,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Codex Client Factory
3
+ *
4
+ * Creates a @openai/codex-sdk Codex client configured with the resolved
5
+ * agent config. The narrow CodexClientLike/CodexThreadLike interfaces allow
6
+ * unit tests to inject fakes without invoking the real Codex CLI subprocess.
7
+ *
8
+ * MCP servers must be configured at construction time — there is no runtime
9
+ * MCP registration API in the SDK. See buildMcpConfig() in mcp-adapter.ts.
10
+ */
11
+ import type { AgentConfig } from "../config/types.js";
12
+ export interface CodexThreadLike {
13
+ readonly id: string | null;
14
+ runStreamed(input: string, options?: {
15
+ signal?: AbortSignal;
16
+ }): Promise<{
17
+ events: AsyncIterable<ThreadEventLike>;
18
+ }>;
19
+ run(input: string, options?: {
20
+ signal?: AbortSignal;
21
+ }): Promise<RunResultLike>;
22
+ }
23
+ export interface CodexClientLike {
24
+ startThread(options?: ThreadOptionsLike): CodexThreadLike;
25
+ resumeThread(threadId: string, options?: ThreadOptionsLike): CodexThreadLike;
26
+ }
27
+ export interface ThreadOptionsLike {
28
+ model?: string;
29
+ sandboxMode?: string;
30
+ approvalPolicy?: string;
31
+ workingDirectory?: string;
32
+ skipGitRepoCheck?: boolean;
33
+ networkAccessEnabled?: boolean;
34
+ webSearchMode?: string;
35
+ additionalDirectories?: string[];
36
+ }
37
+ export interface RunResultLike {
38
+ finalResponse: string;
39
+ items: ThreadItemLike[];
40
+ usage: UsageLike | null;
41
+ }
42
+ export interface UsageLike {
43
+ input_tokens?: number;
44
+ output_tokens?: number;
45
+ cached_input_tokens?: number;
46
+ reasoning_output_tokens?: number;
47
+ }
48
+ export interface ThreadEventLike {
49
+ type: string;
50
+ [key: string]: unknown;
51
+ }
52
+ export interface ThreadItemLike {
53
+ type: string;
54
+ id: string;
55
+ [key: string]: unknown;
56
+ }
57
+ /**
58
+ * Create a real Codex client from the resolved agent configuration.
59
+ * Constructs exactly one client per executor instance.
60
+ *
61
+ * OPENAI_API_KEY is read from the environment by the SDK automatically.
62
+ * Do not pass it through config.json.
63
+ */
64
+ export declare function createCodexClient(config: Required<AgentConfig>): CodexClientLike;
65
+ //# sourceMappingURL=client-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-factory.d.ts","sourceRoot":"","sources":["../../src/codex/client-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKtD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CACT,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACjC,OAAO,CAAC;QAAE,MAAM,EAAE,aAAa,CAAC,eAAe,CAAC,CAAA;KAAE,CAAC,CAAC;IACvD,GAAG,CACD,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACjC,OAAO,CAAC,aAAa,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC1D,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC;CAC9E;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,SAAS;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAID;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,eAAe,CAiBhF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Codex Client Factory
3
+ *
4
+ * Creates a @openai/codex-sdk Codex client configured with the resolved
5
+ * agent config. The narrow CodexClientLike/CodexThreadLike interfaces allow
6
+ * unit tests to inject fakes without invoking the real Codex CLI subprocess.
7
+ *
8
+ * MCP servers must be configured at construction time — there is no runtime
9
+ * MCP registration API in the SDK. See buildMcpConfig() in mcp-adapter.ts.
10
+ */
11
+ import { Codex } from "@openai/codex-sdk";
12
+ import { buildMcpConfig } from "./mcp-adapter.js";
13
+ // ─── Real Factory ────────────────────────────────────────────────────────────
14
+ /**
15
+ * Create a real Codex client from the resolved agent configuration.
16
+ * Constructs exactly one client per executor instance.
17
+ *
18
+ * OPENAI_API_KEY is read from the environment by the SDK automatically.
19
+ * Do not pass it through config.json.
20
+ */
21
+ export function createCodexClient(config) {
22
+ const codexCfg = config.codex;
23
+ const mcpServers = buildMcpConfig(config.mcp ?? {});
24
+ const sdkConfig = {
25
+ ...(codexCfg.configOverrides ?? {}),
26
+ };
27
+ if (Object.keys(mcpServers).length > 0) {
28
+ sdkConfig.mcp_servers = mcpServers;
29
+ }
30
+ return new Codex({
31
+ ...(codexCfg.baseUrl ? { baseUrl: codexCfg.baseUrl } : {}),
32
+ ...(codexCfg.codexPathOverride ? { codexPathOverride: codexCfg.codexPathOverride } : {}),
33
+ config: Object.keys(sdkConfig).length > 0 ? sdkConfig : undefined,
34
+ });
35
+ }
36
+ //# sourceMappingURL=client-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-factory.js","sourceRoot":"","sources":["../../src/codex/client-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAwDlD,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9B,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IAEpD,MAAM,SAAS,GAA4B;QACzC,GAAG,CAAC,QAAQ,CAAC,eAAe,IAAI,EAAE,CAAC;KACpC,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC;IACrC,CAAC;IAED,OAAO,IAAI,KAAK,CAAC;QACf,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACxF,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAgB,CAAC,CAAC,CAAC,SAAS;KACzE,CAA+B,CAAC;AACnC,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Event Mapper — Codex ThreadEvent → A2A Sideband
3
+ *
4
+ * Translates @openai/codex-sdk ThreadEvent and ThreadItem instances into
5
+ * A2A sideband events published via AgentEventEmitter.
6
+ *
7
+ * Sanitization rules (applied to all emitted data):
8
+ * - Redact fields matching SENSITIVE_KEYS
9
+ * - Truncate command output to MAX_OUTPUT_LENGTH characters
10
+ * - Never emit file contents (only path + operation kind)
11
+ * - Never emit raw reasoning text (only summaries)
12
+ * - Never emit raw environment variable values
13
+ */
14
+ import type { AgentEventEmitter } from "@a2a-wrapper/core";
15
+ import type { AgentConfig } from "../config/types.js";
16
+ import type { ThreadEventLike, ThreadItemLike } from "./client-factory.js";
17
+ declare function sanitizeMessage(msg: unknown): string;
18
+ export declare class EventMapper {
19
+ private readonly emitter;
20
+ private readonly config;
21
+ constructor(emitter: AgentEventEmitter, config: Required<AgentConfig>);
22
+ /**
23
+ * Handle a top-level ThreadEvent.
24
+ * Returns the thread_id if this is a thread.started event (for session capture).
25
+ */
26
+ handleEvent(event: ThreadEventLike): string | undefined;
27
+ /**
28
+ * Handle a ThreadItem embedded in an item.* event.
29
+ */
30
+ handleItem(item: ThreadItemLike, phase: "started" | "updated" | "completed"): void;
31
+ }
32
+ export { sanitizeMessage };
33
+ //# sourceMappingURL=event-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-mapper.d.ts","sourceRoot":"","sources":["../../src/codex/event-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAsB3E,iBAAS,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAM7C;AAuBD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;gBAEnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC;IAKrE;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;IAuDvD;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI;CAoInF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}