@renseiai/agentfactory 0.8.21 → 0.8.22
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/orchestrator.d.ts +8 -0
- package/dist/src/orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/src/orchestrator/orchestrator.js +96 -10
- 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 +68 -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 +244 -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 +11 -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
|
@@ -15,9 +15,9 @@ export declare const ProjectConfigSchema: z.ZodObject<{
|
|
|
15
15
|
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
16
16
|
pnpm: "pnpm";
|
|
17
17
|
npm: "npm";
|
|
18
|
+
none: "none";
|
|
18
19
|
yarn: "yarn";
|
|
19
20
|
bun: "bun";
|
|
20
|
-
none: "none";
|
|
21
21
|
}>>;
|
|
22
22
|
buildCommand: z.ZodOptional<z.ZodString>;
|
|
23
23
|
testCommand: z.ZodOptional<z.ZodString>;
|
|
@@ -67,9 +67,9 @@ export declare const RepositoryConfigSchema: z.ZodObject<{
|
|
|
67
67
|
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
68
68
|
pnpm: "pnpm";
|
|
69
69
|
npm: "npm";
|
|
70
|
+
none: "none";
|
|
70
71
|
yarn: "yarn";
|
|
71
72
|
bun: "bun";
|
|
72
|
-
none: "none";
|
|
73
73
|
}>>;
|
|
74
74
|
buildCommand: z.ZodOptional<z.ZodString>;
|
|
75
75
|
testCommand: z.ZodOptional<z.ZodString>;
|
|
@@ -80,9 +80,9 @@ export declare const RepositoryConfigSchema: z.ZodObject<{
|
|
|
80
80
|
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
81
81
|
pnpm: "pnpm";
|
|
82
82
|
npm: "npm";
|
|
83
|
+
none: "none";
|
|
83
84
|
yarn: "yarn";
|
|
84
85
|
bun: "bun";
|
|
85
|
-
none: "none";
|
|
86
86
|
}>>;
|
|
87
87
|
buildCommand: z.ZodOptional<z.ZodString>;
|
|
88
88
|
testCommand: z.ZodOptional<z.ZodString>;
|
|
@@ -91,6 +91,7 @@ export declare class AgentOrchestrator {
|
|
|
91
91
|
private readonly sessionLoggers;
|
|
92
92
|
private readonly contextManagers;
|
|
93
93
|
private readonly sessionOutputFlags;
|
|
94
|
+
private readonly assistantTextBuffers;
|
|
94
95
|
private readonly templateRegistry;
|
|
95
96
|
private allowedProjects?;
|
|
96
97
|
private repoConfig?;
|
|
@@ -110,6 +111,13 @@ export declare class AgentOrchestrator {
|
|
|
110
111
|
* @param issueId - The issue ID of the agent
|
|
111
112
|
* @param activityType - Optional description of the activity type
|
|
112
113
|
*/
|
|
114
|
+
/**
|
|
115
|
+
* Buffer assistant text and flush in batches for readable logging.
|
|
116
|
+
* Streaming providers (Codex) emit one token per event — this buffers
|
|
117
|
+
* and flushes after 500ms of silence or on sentence boundaries.
|
|
118
|
+
*/
|
|
119
|
+
private bufferAssistantText;
|
|
120
|
+
private flushAssistantTextBuffer;
|
|
113
121
|
private updateLastActivity;
|
|
114
122
|
/**
|
|
115
123
|
* Get timeout configuration for a specific work type
|
|
@@ -1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E,kBAAkB,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC1B,iBAAiB,CAEnB"}
|
|
@@ -870,6 +870,9 @@ export class AgentOrchestrator {
|
|
|
870
870
|
contextManagers = new Map();
|
|
871
871
|
// Session output flags for completion contract validation (keyed by issueId)
|
|
872
872
|
sessionOutputFlags = new Map();
|
|
873
|
+
// Buffered assistant text for batched logging (keyed by issueId)
|
|
874
|
+
// Streaming providers (Codex) send one token per event — buffer and flush on sentence boundaries
|
|
875
|
+
assistantTextBuffers = new Map();
|
|
873
876
|
// Template registry for configurable workflow prompts
|
|
874
877
|
templateRegistry;
|
|
875
878
|
// Allowlisted project names from .agentfactory/config.yaml
|
|
@@ -1049,6 +1052,40 @@ export class AgentOrchestrator {
|
|
|
1049
1052
|
* @param issueId - The issue ID of the agent
|
|
1050
1053
|
* @param activityType - Optional description of the activity type
|
|
1051
1054
|
*/
|
|
1055
|
+
/**
|
|
1056
|
+
* Buffer assistant text and flush in batches for readable logging.
|
|
1057
|
+
* Streaming providers (Codex) emit one token per event — this buffers
|
|
1058
|
+
* and flushes after 500ms of silence or on sentence boundaries.
|
|
1059
|
+
*/
|
|
1060
|
+
bufferAssistantText(issueId, text, log) {
|
|
1061
|
+
let buf = this.assistantTextBuffers.get(issueId);
|
|
1062
|
+
if (!buf) {
|
|
1063
|
+
buf = { text: '', timer: null };
|
|
1064
|
+
this.assistantTextBuffers.set(issueId, buf);
|
|
1065
|
+
}
|
|
1066
|
+
buf.text += text;
|
|
1067
|
+
// Clear existing timer
|
|
1068
|
+
if (buf.timer)
|
|
1069
|
+
clearTimeout(buf.timer);
|
|
1070
|
+
// Flush after 500ms of silence
|
|
1071
|
+
buf.timer = setTimeout(() => {
|
|
1072
|
+
this.flushAssistantTextBuffer(issueId, log);
|
|
1073
|
+
}, 500);
|
|
1074
|
+
}
|
|
1075
|
+
flushAssistantTextBuffer(issueId, log) {
|
|
1076
|
+
const buf = this.assistantTextBuffers.get(issueId);
|
|
1077
|
+
if (!buf || !buf.text.trim())
|
|
1078
|
+
return;
|
|
1079
|
+
const text = buf.text.trim();
|
|
1080
|
+
if (text.length > 0) {
|
|
1081
|
+
log?.info('Agent', { text: text.substring(0, 300) });
|
|
1082
|
+
}
|
|
1083
|
+
buf.text = '';
|
|
1084
|
+
if (buf.timer) {
|
|
1085
|
+
clearTimeout(buf.timer);
|
|
1086
|
+
buf.timer = null;
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1052
1089
|
updateLastActivity(issueId, activityType = 'activity') {
|
|
1053
1090
|
const agent = this.activeAgents.get(issueId);
|
|
1054
1091
|
if (agent) {
|
|
@@ -2312,6 +2349,8 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
2312
2349
|
workerId: this.config.apiActivityConfig?.workerId ?? null,
|
|
2313
2350
|
pid: null, // Will be updated when process spawns
|
|
2314
2351
|
});
|
|
2352
|
+
// Track which provider was used so recovery can detect provider changes
|
|
2353
|
+
initialState.providerName = spawnProviderName;
|
|
2315
2354
|
writeState(worktreePath, initialState);
|
|
2316
2355
|
// Start heartbeat writer for crash detection
|
|
2317
2356
|
const heartbeatWriter = createHeartbeatWriter({
|
|
@@ -3121,6 +3160,18 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3121
3160
|
log?.warn('Hook failed', { hook: raw.hook_name, exitCode: raw.exit_code });
|
|
3122
3161
|
}
|
|
3123
3162
|
}
|
|
3163
|
+
else if (event.subtype === 'reasoning') {
|
|
3164
|
+
// Codex reasoning/thinking events — buffer and log for fleet observability
|
|
3165
|
+
this.updateLastActivity(issueId, 'thinking');
|
|
3166
|
+
if (event.message) {
|
|
3167
|
+
this.bufferAssistantText(issueId, event.message, log);
|
|
3168
|
+
}
|
|
3169
|
+
heartbeatWriter?.recordThinking();
|
|
3170
|
+
// Persist reasoning to Linear session (same pattern as Claude's assistant_text)
|
|
3171
|
+
if (emitter && event.message) {
|
|
3172
|
+
await emitter.emitThought(event.message.substring(0, 200));
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3124
3175
|
else if (event.subtype === 'auth_status') {
|
|
3125
3176
|
if (event.message?.includes('error') || event.message?.includes('Error')) {
|
|
3126
3177
|
log?.error('Auth error', { error: event.message });
|
|
@@ -3149,6 +3200,11 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3149
3200
|
case 'assistant_text':
|
|
3150
3201
|
// Assistant text output
|
|
3151
3202
|
this.updateLastActivity(issueId, 'assistant');
|
|
3203
|
+
// Buffer and log agent reasoning for fleet observability.
|
|
3204
|
+
// Streaming providers (Codex) send one token per event — buffer for readability.
|
|
3205
|
+
if (event.text) {
|
|
3206
|
+
this.bufferAssistantText(issueId, event.text, log);
|
|
3207
|
+
}
|
|
3152
3208
|
// Feed to context manager for session intent extraction
|
|
3153
3209
|
this.contextManagers.get(issueId)?.processEvent(event);
|
|
3154
3210
|
heartbeatWriter?.recordThinking();
|
|
@@ -3204,6 +3260,8 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3204
3260
|
log?.debug('Tool progress', { tool: event.toolName, elapsed: `${event.elapsedSeconds}s` });
|
|
3205
3261
|
break;
|
|
3206
3262
|
case 'result':
|
|
3263
|
+
// Flush any buffered assistant text before processing result
|
|
3264
|
+
this.flushAssistantTextBuffer(issueId, log);
|
|
3207
3265
|
if (event.success) {
|
|
3208
3266
|
log?.success('Agent completed', {
|
|
3209
3267
|
cost: event.cost?.totalCostUsd ? `$${event.cost.totalCostUsd.toFixed(4)}` : 'N/A',
|
|
@@ -3266,8 +3324,12 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3266
3324
|
if (agent.worktreePath) {
|
|
3267
3325
|
try {
|
|
3268
3326
|
// If the error is a stale session (resume failed), clear providerSessionId
|
|
3269
|
-
// so the next recovery attempt starts fresh instead of hitting the same error
|
|
3270
|
-
|
|
3327
|
+
// so the next recovery attempt starts fresh instead of hitting the same error.
|
|
3328
|
+
// Claude: "No conversation found with session ID"
|
|
3329
|
+
// Codex: "thread/resume failed" or "thread/resume: ..."
|
|
3330
|
+
const isStaleSession = errorMessage.includes('No conversation found with session ID') ||
|
|
3331
|
+
errorMessage.includes('thread/resume failed') ||
|
|
3332
|
+
errorMessage.includes('thread/resume:');
|
|
3271
3333
|
updateState(agent.worktreePath, {
|
|
3272
3334
|
status: 'failed',
|
|
3273
3335
|
errorMessage,
|
|
@@ -3513,6 +3575,10 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3513
3575
|
this.activityEmitters.delete(issueId);
|
|
3514
3576
|
this.abortControllers.delete(issueId);
|
|
3515
3577
|
this.agentLoggers.delete(issueId);
|
|
3578
|
+
const buf = this.assistantTextBuffers.get(issueId);
|
|
3579
|
+
if (buf?.timer)
|
|
3580
|
+
clearTimeout(buf.timer);
|
|
3581
|
+
this.assistantTextBuffers.delete(issueId);
|
|
3516
3582
|
// Stop heartbeat writer
|
|
3517
3583
|
const heartbeatWriter = this.heartbeatWriters.get(issueId);
|
|
3518
3584
|
if (heartbeatWriter) {
|
|
@@ -3719,15 +3785,29 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
3719
3785
|
// Inherit work type from previous state if not provided
|
|
3720
3786
|
const recoveryWorkType = workType ?? recoveryCheck.state.workType ?? effectiveWorkType;
|
|
3721
3787
|
// Use existing provider session ID for resume if available,
|
|
3722
|
-
// but clear it when the work type has changed
|
|
3723
|
-
// A session from a different work type cannot be resumed —
|
|
3724
|
-
// it produces
|
|
3788
|
+
// but clear it when the work type or provider has changed.
|
|
3789
|
+
// A session from a different work type or provider cannot be resumed —
|
|
3790
|
+
// attempting it produces errors and wastes the recovery attempt.
|
|
3725
3791
|
const workTypeChanged = recoveryWorkType !== recoveryCheck.state.workType;
|
|
3726
|
-
|
|
3792
|
+
// Resolve which provider will handle this recovery to detect provider switches
|
|
3793
|
+
// (e.g., previous run was Claude but labels now route to Codex)
|
|
3794
|
+
const { name: recoveryProviderName } = resolveProviderWithSource({
|
|
3795
|
+
project: projectName,
|
|
3796
|
+
workType: recoveryWorkType,
|
|
3797
|
+
labels: labelNames,
|
|
3798
|
+
configProviders: this.configProviders,
|
|
3799
|
+
});
|
|
3800
|
+
const providerChanged = recoveryCheck.state.providerName != null &&
|
|
3801
|
+
recoveryProviderName !== recoveryCheck.state.providerName;
|
|
3802
|
+
const shouldClearSession = workTypeChanged || providerChanged;
|
|
3803
|
+
const providerSessionId = shouldClearSession
|
|
3727
3804
|
? undefined
|
|
3728
3805
|
: (recoveryCheck.state.providerSessionId ?? undefined);
|
|
3729
|
-
if (
|
|
3730
|
-
|
|
3806
|
+
if (shouldClearSession && recoveryCheck.state.providerSessionId) {
|
|
3807
|
+
const reason = providerChanged
|
|
3808
|
+
? `provider changed from ${recoveryCheck.state.providerName} to ${recoveryProviderName}`
|
|
3809
|
+
: `work type changed from ${recoveryCheck.state.workType} to ${recoveryWorkType}`;
|
|
3810
|
+
console.log(`Clearing stale providerSessionId — ${reason}`);
|
|
3731
3811
|
updateState(worktreePath, { providerSessionId: null });
|
|
3732
3812
|
}
|
|
3733
3813
|
const effectiveSessionId = sessionId ?? recoveryCheck.state.linearSessionId ?? randomUUID();
|
|
@@ -4138,6 +4218,8 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
4138
4218
|
if (providerSessionId) {
|
|
4139
4219
|
initialState.providerSessionId = providerSessionId;
|
|
4140
4220
|
}
|
|
4221
|
+
// Track which provider was used so recovery can detect provider changes
|
|
4222
|
+
initialState.providerName = spawnProviderName;
|
|
4141
4223
|
writeState(worktreePath, initialState);
|
|
4142
4224
|
// Start heartbeat writer for crash detection
|
|
4143
4225
|
const heartbeatWriter = createHeartbeatWriter({
|
|
@@ -4318,10 +4400,14 @@ You are running in an AgentFactory-managed worktree. Follow these rules strictly
|
|
|
4318
4400
|
let currentHandle = provider.resume(providerSessionId, spawnConfig);
|
|
4319
4401
|
const fallbackStream = async function* () {
|
|
4320
4402
|
for await (const event of currentHandle.stream) {
|
|
4321
|
-
// Detect stale session error: the resume failed because the session no longer exists
|
|
4403
|
+
// Detect stale session error: the resume failed because the session no longer exists.
|
|
4404
|
+
// Claude: "No conversation found with session ID"
|
|
4405
|
+
// Codex: "thread/resume failed" or "thread/resume: ..."
|
|
4322
4406
|
if (event.type === 'result' &&
|
|
4323
4407
|
!event.success &&
|
|
4324
|
-
event.errors?.some(e => e.includes('No conversation found with session ID')
|
|
4408
|
+
event.errors?.some(e => e.includes('No conversation found with session ID') ||
|
|
4409
|
+
e.includes('thread/resume failed') ||
|
|
4410
|
+
e.includes('thread/resume:'))) {
|
|
4325
4411
|
log?.warn('Stale session detected during resume — falling back to fresh spawn', {
|
|
4326
4412
|
staleSessionId: providerSessionId,
|
|
4327
4413
|
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* This enables crash recovery, heartbeat monitoring, and progress tracking.
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentWorkType } from './work-types.js';
|
|
8
|
+
import type { AgentProviderName } from '../providers/index.js';
|
|
8
9
|
/**
|
|
9
10
|
* Status of the agent's work in the worktree
|
|
10
11
|
*/
|
|
@@ -22,6 +23,8 @@ export interface WorktreeState {
|
|
|
22
23
|
linearSessionId: string | null;
|
|
23
24
|
/** Provider CLI session ID for --resume (if available) */
|
|
24
25
|
providerSessionId: string | null;
|
|
26
|
+
/** Name of the provider used for the session (e.g., 'claude', 'codex') */
|
|
27
|
+
providerName?: AgentProviderName | null;
|
|
25
28
|
/** Type of work being performed */
|
|
26
29
|
workType: AgentWorkType;
|
|
27
30
|
/** The prompt that was given to the agent */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-types.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/state-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"state-types.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/state-types.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;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,+CAA+C;IAC/C,aAAa,EAAE,MAAM,CAAA;IACrB,6CAA6C;IAC7C,aAAa,EAAE,MAAM,CAAA;IACrB,2CAA2C;IAC3C,iBAAiB,EAAE,gBAAgB,EAAE,CAAA;IACrC,kCAAkC;IAClC,aAAa,EAAE,QAAQ,EAAE,CAAA;IACzB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAA;IACvB,yCAAyC;IACzC,eAAe,EAAE,MAAM,CAAA;IACvB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAA;CACtB"}
|
|
@@ -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
|
*
|
|
@@ -134,6 +149,17 @@ export declare class AppServerProcessManager {
|
|
|
134
149
|
* Handle an incoming JSON-RPC response.
|
|
135
150
|
*/
|
|
136
151
|
private handleResponse;
|
|
152
|
+
/**
|
|
153
|
+
* Handle an incoming JSON-RPC server request (has both `id` and `method`).
|
|
154
|
+
* Codex sends approval requests as server requests that expect a response.
|
|
155
|
+
* Route to the thread listener (as a notification-like object) and store
|
|
156
|
+
* the request ID so the handle can respond.
|
|
157
|
+
*/
|
|
158
|
+
private handleServerRequest;
|
|
159
|
+
/**
|
|
160
|
+
* Send a JSON-RPC response to a server request.
|
|
161
|
+
*/
|
|
162
|
+
respondToServerRequest(requestId: number | string, result: unknown): void;
|
|
137
163
|
/**
|
|
138
164
|
* Handle an incoming JSON-RPC notification.
|
|
139
165
|
* Routes to the appropriate thread listener based on threadId in params.
|
|
@@ -172,6 +198,14 @@ export declare class AppServerProcessManager {
|
|
|
172
198
|
* Returns the status of all registered MCP servers.
|
|
173
199
|
*/
|
|
174
200
|
getMcpServerStatus(): Promise<McpServerStatusResult[]>;
|
|
201
|
+
/**
|
|
202
|
+
* Discover available models from the app-server via model/list.
|
|
203
|
+
*/
|
|
204
|
+
listModels(): Promise<Array<{
|
|
205
|
+
id: string;
|
|
206
|
+
name?: string;
|
|
207
|
+
capabilities?: Record<string, unknown>;
|
|
208
|
+
}>>;
|
|
175
209
|
/**
|
|
176
210
|
* Get the PID of the app-server process.
|
|
177
211
|
*/
|
|
@@ -185,8 +219,10 @@ export declare class AppServerProcessManager {
|
|
|
185
219
|
}
|
|
186
220
|
export interface AppServerEventMapperState {
|
|
187
221
|
sessionId: string | null;
|
|
222
|
+
model: string | null;
|
|
188
223
|
totalInputTokens: number;
|
|
189
224
|
totalOutputTokens: number;
|
|
225
|
+
totalCachedInputTokens: number;
|
|
190
226
|
turnCount: number;
|
|
191
227
|
}
|
|
192
228
|
/**
|
|
@@ -207,6 +243,38 @@ export declare function mapAppServerItemEvent(method: string, params: Record<str
|
|
|
207
243
|
* tool='af_linear_get_issue'). We normalize to 'mcp__af-linear__af_linear_get_issue'.
|
|
208
244
|
*/
|
|
209
245
|
export declare function normalizeMcpToolName(server?: string, tool?: string): string;
|
|
246
|
+
/**
|
|
247
|
+
* Map AgentSpawnConfig sandbox settings to Codex App Server sandbox policy.
|
|
248
|
+
*
|
|
249
|
+
* Codex sandbox levels vs Claude sandbox:
|
|
250
|
+
* | Feature | Claude | Codex |
|
|
251
|
+
* |-----------------------|-------------------------|--------------------------------|
|
|
252
|
+
* | File write control | Per-file glob patterns | Workspace root only |
|
|
253
|
+
* | Network access | Per-domain allow-lists | All-or-nothing per level |
|
|
254
|
+
* | Tool-level permissions| Per-tool allow/deny | Not supported (approval policy)|
|
|
255
|
+
* | Custom writable paths | Multiple glob patterns | Single writableRoots array |
|
|
256
|
+
* | Process isolation | macOS sandbox-exec | Docker/firewall container |
|
|
257
|
+
*
|
|
258
|
+
* Key limitation: Codex cannot restrict writes to specific subdirectories within
|
|
259
|
+
* the workspace or allow network access to specific domains. The mapping is intent-based:
|
|
260
|
+
* "safe browsing/analysis" → readOnly
|
|
261
|
+
* "normal development" → workspaceWrite
|
|
262
|
+
* "install/deploy/admin" → dangerFullAccess
|
|
263
|
+
*/
|
|
264
|
+
/**
|
|
265
|
+
* Resolve sandbox policy as an object for turn/start (supports writableRoots).
|
|
266
|
+
* Codex v0.117+ turn/start accepts: { type: 'workspaceWrite', writableRoots: [...] }
|
|
267
|
+
*
|
|
268
|
+
* Network access is enabled by default for agents because they need to run
|
|
269
|
+
* commands like `gh`, `curl`, `pnpm install`, etc. The sandbox still restricts
|
|
270
|
+
* file writes to the workspace root.
|
|
271
|
+
*/
|
|
272
|
+
export declare function resolveSandboxPolicy(config: AgentSpawnConfig): Record<string, unknown> | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Resolve sandbox mode as a simple string for thread/start.
|
|
275
|
+
* Codex v0.117+ thread/start accepts: 'read-only' | 'workspace-write' | 'danger-full-access'
|
|
276
|
+
*/
|
|
277
|
+
export declare function resolveSandboxMode(config: AgentSpawnConfig): string | undefined;
|
|
210
278
|
/**
|
|
211
279
|
* Codex App Server Provider
|
|
212
280
|
*
|
|
@@ -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;AAIH,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;
|
|
1
|
+
{"version":3,"file":"codex-app-server-provider.d.ts","sourceRoot":"","sources":["../../../src/providers/codex-app-server-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,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,C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BAAgB,GAAG,WAAW;IAK5C,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,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"}
|