@renseiai/agentfactory 0.8.21 → 0.8.23
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/src/config/repository-config.d.ts +3 -3
- package/dist/src/orchestrator/index.d.ts +1 -0
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +2 -0
- package/dist/src/orchestrator/null-issue-tracker-client.d.ts +34 -0
- package/dist/src/orchestrator/null-issue-tracker-client.d.ts.map +1 -0
- package/dist/src/orchestrator/null-issue-tracker-client.js +72 -0
- package/dist/src/orchestrator/orchestrator.d.ts +19 -0
- package/dist/src/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/src/orchestrator/orchestrator.js +134 -15
- package/dist/src/orchestrator/state-types.d.ts +3 -0
- package/dist/src/orchestrator/state-types.d.ts.map +1 -1
- package/dist/src/providers/codex-app-server-provider.d.ts +87 -0
- package/dist/src/providers/codex-app-server-provider.d.ts.map +1 -1
- package/dist/src/providers/codex-app-server-provider.integration.test.d.ts +14 -0
- package/dist/src/providers/codex-app-server-provider.integration.test.d.ts.map +1 -0
- package/dist/src/providers/codex-app-server-provider.integration.test.js +909 -0
- package/dist/src/providers/codex-app-server-provider.js +339 -52
- package/dist/src/providers/codex-app-server-provider.test.js +838 -10
- package/dist/src/providers/codex-provider.d.ts +2 -0
- package/dist/src/providers/codex-provider.d.ts.map +1 -1
- package/dist/src/providers/codex-provider.js +36 -6
- package/dist/src/providers/codex-provider.test.js +12 -3
- package/dist/src/providers/types.d.ts +17 -0
- package/dist/src/providers/types.d.ts.map +1 -1
- package/dist/src/workflow/workflow-types.d.ts +5 -5
- package/package.json +2 -2
|
@@ -81,6 +81,21 @@ interface AppServerThread {
|
|
|
81
81
|
id: string;
|
|
82
82
|
status?: string;
|
|
83
83
|
}
|
|
84
|
+
export declare const CODEX_MODEL_MAP: Record<string, string>;
|
|
85
|
+
export declare const CODEX_DEFAULT_MODEL = "gpt-5-codex";
|
|
86
|
+
export declare function resolveCodexModel(config: AgentSpawnConfig): string;
|
|
87
|
+
/** Codex pricing per 1M tokens (USD). Update when pricing changes. */
|
|
88
|
+
export declare const CODEX_PRICING: Record<string, {
|
|
89
|
+
input: number;
|
|
90
|
+
cachedInput: number;
|
|
91
|
+
output: number;
|
|
92
|
+
}>;
|
|
93
|
+
export declare const CODEX_DEFAULT_PRICING: {
|
|
94
|
+
input: number;
|
|
95
|
+
cachedInput: number;
|
|
96
|
+
output: number;
|
|
97
|
+
};
|
|
98
|
+
export declare function calculateCostUsd(inputTokens: number, cachedInputTokens: number, outputTokens: number, model?: string): number;
|
|
84
99
|
/**
|
|
85
100
|
* Manages a single long-lived `codex app-server` process.
|
|
86
101
|
*
|
|
@@ -110,9 +125,28 @@ export declare class AppServerProcessManager {
|
|
|
110
125
|
cwd: string;
|
|
111
126
|
env?: Record<string, string>;
|
|
112
127
|
});
|
|
128
|
+
/**
|
|
129
|
+
* Get the PID file path for tracking the app-server process.
|
|
130
|
+
* Used for orphan detection on startup.
|
|
131
|
+
*/
|
|
132
|
+
private static getPidFilePath;
|
|
133
|
+
/**
|
|
134
|
+
* Kill any orphaned app-server process from a prior fleet run.
|
|
135
|
+
* Called before starting a new process to prevent resource leaks.
|
|
136
|
+
*/
|
|
137
|
+
private static killOrphanedProcess;
|
|
138
|
+
/**
|
|
139
|
+
* Write the current app-server PID to the PID file.
|
|
140
|
+
*/
|
|
141
|
+
private writePidFile;
|
|
142
|
+
/**
|
|
143
|
+
* Remove the PID file on shutdown.
|
|
144
|
+
*/
|
|
145
|
+
private static removePidFile;
|
|
113
146
|
/**
|
|
114
147
|
* Start the app-server process and complete the initialization handshake.
|
|
115
148
|
* Idempotent — returns immediately if already initialized.
|
|
149
|
+
* Kills any orphaned app-server from a prior fleet run before starting.
|
|
116
150
|
*/
|
|
117
151
|
start(): Promise<void>;
|
|
118
152
|
/**
|
|
@@ -134,6 +168,17 @@ export declare class AppServerProcessManager {
|
|
|
134
168
|
* Handle an incoming JSON-RPC response.
|
|
135
169
|
*/
|
|
136
170
|
private handleResponse;
|
|
171
|
+
/**
|
|
172
|
+
* Handle an incoming JSON-RPC server request (has both `id` and `method`).
|
|
173
|
+
* Codex sends approval requests as server requests that expect a response.
|
|
174
|
+
* Route to the thread listener (as a notification-like object) and store
|
|
175
|
+
* the request ID so the handle can respond.
|
|
176
|
+
*/
|
|
177
|
+
private handleServerRequest;
|
|
178
|
+
/**
|
|
179
|
+
* Send a JSON-RPC response to a server request.
|
|
180
|
+
*/
|
|
181
|
+
respondToServerRequest(requestId: number | string, result: unknown): void;
|
|
137
182
|
/**
|
|
138
183
|
* Handle an incoming JSON-RPC notification.
|
|
139
184
|
* Routes to the appropriate thread listener based on threadId in params.
|
|
@@ -172,6 +217,14 @@ export declare class AppServerProcessManager {
|
|
|
172
217
|
* Returns the status of all registered MCP servers.
|
|
173
218
|
*/
|
|
174
219
|
getMcpServerStatus(): Promise<McpServerStatusResult[]>;
|
|
220
|
+
/**
|
|
221
|
+
* Discover available models from the app-server via model/list.
|
|
222
|
+
*/
|
|
223
|
+
listModels(): Promise<Array<{
|
|
224
|
+
id: string;
|
|
225
|
+
name?: string;
|
|
226
|
+
capabilities?: Record<string, unknown>;
|
|
227
|
+
}>>;
|
|
175
228
|
/**
|
|
176
229
|
* Get the PID of the app-server process.
|
|
177
230
|
*/
|
|
@@ -185,8 +238,10 @@ export declare class AppServerProcessManager {
|
|
|
185
238
|
}
|
|
186
239
|
export interface AppServerEventMapperState {
|
|
187
240
|
sessionId: string | null;
|
|
241
|
+
model: string | null;
|
|
188
242
|
totalInputTokens: number;
|
|
189
243
|
totalOutputTokens: number;
|
|
244
|
+
totalCachedInputTokens: number;
|
|
190
245
|
turnCount: number;
|
|
191
246
|
}
|
|
192
247
|
/**
|
|
@@ -207,6 +262,38 @@ export declare function mapAppServerItemEvent(method: string, params: Record<str
|
|
|
207
262
|
* tool='af_linear_get_issue'). We normalize to 'mcp__af-linear__af_linear_get_issue'.
|
|
208
263
|
*/
|
|
209
264
|
export declare function normalizeMcpToolName(server?: string, tool?: string): string;
|
|
265
|
+
/**
|
|
266
|
+
* Map AgentSpawnConfig sandbox settings to Codex App Server sandbox policy.
|
|
267
|
+
*
|
|
268
|
+
* Codex sandbox levels vs Claude sandbox:
|
|
269
|
+
* | Feature | Claude | Codex |
|
|
270
|
+
* |-----------------------|-------------------------|--------------------------------|
|
|
271
|
+
* | File write control | Per-file glob patterns | Workspace root only |
|
|
272
|
+
* | Network access | Per-domain allow-lists | All-or-nothing per level |
|
|
273
|
+
* | Tool-level permissions| Per-tool allow/deny | Not supported (approval policy)|
|
|
274
|
+
* | Custom writable paths | Multiple glob patterns | Single writableRoots array |
|
|
275
|
+
* | Process isolation | macOS sandbox-exec | Docker/firewall container |
|
|
276
|
+
*
|
|
277
|
+
* Key limitation: Codex cannot restrict writes to specific subdirectories within
|
|
278
|
+
* the workspace or allow network access to specific domains. The mapping is intent-based:
|
|
279
|
+
* "safe browsing/analysis" → readOnly
|
|
280
|
+
* "normal development" → workspaceWrite
|
|
281
|
+
* "install/deploy/admin" → dangerFullAccess
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* Resolve sandbox policy as an object for turn/start (supports writableRoots).
|
|
285
|
+
* Codex v0.117+ turn/start accepts: { type: 'workspaceWrite', writableRoots: [...] }
|
|
286
|
+
*
|
|
287
|
+
* Network access is enabled by default for agents because they need to run
|
|
288
|
+
* commands like `gh`, `curl`, `pnpm install`, etc. The sandbox still restricts
|
|
289
|
+
* file writes to the workspace root.
|
|
290
|
+
*/
|
|
291
|
+
export declare function resolveSandboxPolicy(config: AgentSpawnConfig): Record<string, unknown> | undefined;
|
|
292
|
+
/**
|
|
293
|
+
* Resolve sandbox mode as a simple string for thread/start.
|
|
294
|
+
* Codex v0.117+ thread/start accepts: 'read-only' | 'workspace-write' | 'danger-full-access'
|
|
295
|
+
*/
|
|
296
|
+
export declare function resolveSandboxMode(config: AgentSpawnConfig): string | undefined;
|
|
210
297
|
/**
|
|
211
298
|
* Codex App Server Provider
|
|
212
299
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-app-server-provider.d.ts","sourceRoot":"","sources":["../../../src/providers/codex-app-server-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"codex-app-server-provider.d.ts","sourceRoot":"","sources":["../../../src/providers/codex-app-server-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,UAAU,EACX,MAAM,YAAY,CAAA;AAuBnB,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AA2BD,4EAA4E;AAC5E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,WAAW,GAAG,YAAY,GAAG,cAAc,GAAG,OAAO,CAAA;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAMD,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,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AM,EAAE,gBAAgB,GAAG,WAAW;IAKhE;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B,OAAO,CAAC,yBAAyB;CAalC;AAMD,wBAAgB,4BAA4B,IAAI,sBAAsB,CAErE;AAED,2BAA2B;AAC3B,YAAY,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for the Codex App Server Provider
|
|
3
|
+
*
|
|
4
|
+
* Exercises the full AppServerAgentHandle lifecycle by mocking the
|
|
5
|
+
* `codex app-server` child process. Unlike the unit tests which test individual
|
|
6
|
+
* functions in isolation, these tests verify the end-to-end flow:
|
|
7
|
+
* process start -> handshake -> thread creation -> turn execution
|
|
8
|
+
* -> notification streaming -> event mapping -> message injection -> shutdown
|
|
9
|
+
*
|
|
10
|
+
* Uses a MockAppServer helper that captures JSON-RPC stdin writes and pushes
|
|
11
|
+
* fake stdout lines (responses + notifications) to exercise the real code path.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=codex-app-server-provider.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-app-server-provider.integration.test.d.ts","sourceRoot":"","sources":["../../../src/providers/codex-app-server-provider.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|