@parall/codex-agent 1.45.0 → 1.46.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/dispatch.d.ts +58 -13
- package/dist/dispatch.d.ts.map +1 -1
- package/dist/dispatch.js +343 -67
- package/dist/index.js +10 -8
- package/dist/instructions-refresh.d.ts +136 -0
- package/dist/instructions-refresh.d.ts.map +1 -0
- package/dist/instructions-refresh.js +244 -0
- package/dist/jsonrpc-client.d.ts +49 -1
- package/dist/jsonrpc-client.d.ts.map +1 -1
- package/dist/jsonrpc-client.js +77 -5
- package/dist/server-requests.d.ts +10 -0
- package/dist/server-requests.d.ts.map +1 -0
- package/dist/server-requests.js +39 -0
- package/dist/session-manager.d.ts +12 -0
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +53 -3
- package/dist/turn-sink.d.ts +3 -0
- package/dist/turn-sink.d.ts.map +1 -1
- package/dist/turn-sink.js +5 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +5 -6
- package/package.json +4 -4
- package/src/dispatch.ts +388 -83
- package/src/index.ts +10 -7
- package/src/instructions-refresh.ts +367 -0
- package/src/jsonrpc-client.ts +109 -7
- package/src/server-requests.ts +40 -0
- package/src/session-manager.ts +74 -6
- package/src/turn-sink.ts +6 -0
- package/src/workspace.ts +5 -6
package/dist/dispatch.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CleanupForkOpts, DispatchAdapter, DispatchOpts, ForkOpts, ForkSessionHandle, GatewayLogger, RuntimeEvent } from '@parall/agent-core';
|
|
2
2
|
import type { CodexAgentConfig } from './config.js';
|
|
3
|
+
import { type NotificationTap } from './instructions-refresh.js';
|
|
3
4
|
import type { CodexSessionManager } from './session-manager.js';
|
|
4
5
|
type CodexAppServerAdapterOptions = Pick<CodexAgentConfig, 'approvalPolicy' | 'codexBin' | 'codexHome' | 'model' | 'reasoningEffort' | 'sandbox' | 'workspaceDir'> & {
|
|
5
6
|
sessionManager: CodexSessionManager;
|
|
@@ -22,19 +23,22 @@ type CodexAppServerAdapterOptions = Pick<CodexAgentConfig, 'approvalPolicy' | 'c
|
|
|
22
23
|
* which coupled the prompt to codex's interactive workspace-trust concept
|
|
23
24
|
* and made the bridge write into the operator's own config on shared homes.
|
|
24
25
|
*
|
|
25
|
-
* Where it lands
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* `thread/fork` inherits the parent's
|
|
29
|
-
*
|
|
30
|
-
* a future CLI that honors it then needs no bridge change.
|
|
26
|
+
* Where it lands on 0.144.1: `thread/start` bakes it in (canonical AND
|
|
27
|
+
* model-visible at once); a fresh-process `thread/resume` updates only the
|
|
28
|
+
* thread's CANONICAL configuration (a resume of a still-running thread
|
|
29
|
+
* ignores every override); `thread/fork` inherits the parent's; compaction
|
|
30
|
+
* rebuilds the model-visible context from the canonical configuration.
|
|
31
31
|
*
|
|
32
|
-
* Consequence: updateConfig() changes what the NEXT thread
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* Consequence: updateConfig() changes what the NEXT thread open sends; for
|
|
33
|
+
* the persisted main thread, the lazy restart's fresh-process resume plus
|
|
34
|
+
* one explicit compaction converge both planes before the next turn — the
|
|
35
|
+
* full two-plane semantics and evidence live in instructions-refresh.ts.
|
|
36
36
|
*/
|
|
37
37
|
developerInstructions?: string;
|
|
38
|
+
/** Override the compaction wait budget for the instructions refresh (tests). */
|
|
39
|
+
instructionsCompactTimeoutMs?: number;
|
|
40
|
+
/** Override the post-interrupt grace for the instructions refresh (tests). */
|
|
41
|
+
instructionsInterruptGraceMs?: number;
|
|
38
42
|
};
|
|
39
43
|
/**
|
|
40
44
|
* Bridge driver backed by `codex app-server --listen stdio://`.
|
|
@@ -60,7 +64,22 @@ export declare class CodexAppServerAdapter implements DispatchAdapter {
|
|
|
60
64
|
private readonly activeTurnIds;
|
|
61
65
|
private readonly pendingInjections;
|
|
62
66
|
private readonly resumedThreadIds;
|
|
67
|
+
/** Threads whose reconcile compaction is in flight — tap-only traffic. */
|
|
68
|
+
private readonly reconcilingThreadIds;
|
|
69
|
+
/**
|
|
70
|
+
* Set when a stalled compaction left (possibly) a zombie turn on the main
|
|
71
|
+
* thread. Until the subprocess ACTUALLY restarts, main-lane redrives must
|
|
72
|
+
* not open/compact/turn-start the thread: re-entering the zombie process
|
|
73
|
+
* lets a second compaction's watcher misattribute the zombie's close as a
|
|
74
|
+
* plain failure, dropping the stalled marker and re-arming the
|
|
75
|
+
* fresh-thread rotation this state exists to prevent. Cleared where the
|
|
76
|
+
* zombie dies: subprocess teardown.
|
|
77
|
+
*/
|
|
78
|
+
private mainLaneQuarantined;
|
|
79
|
+
private readonly notificationTaps;
|
|
80
|
+
private readonly instructionsRefresher;
|
|
63
81
|
private stopping;
|
|
82
|
+
private lastUnroutedNotificationWarnAt;
|
|
64
83
|
/**
|
|
65
84
|
* Store an active turn sink keyed by threadId. If a sink already exists for
|
|
66
85
|
* the same threadId, log a warning and fail the existing sink — this
|
|
@@ -71,6 +90,15 @@ export declare class CodexAppServerAdapter implements DispatchAdapter {
|
|
|
71
90
|
*/
|
|
72
91
|
private setActiveTurn;
|
|
73
92
|
constructor(opts: CodexAppServerAdapterOptions);
|
|
93
|
+
/** Register a listener for every server notification; returns unregister. */
|
|
94
|
+
addNotificationTap(tap: NotificationTap): () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Tell tap waiters the subprocess is gone so they abort immediately —
|
|
97
|
+
* no further notifications will ever arrive, and a waiter left to its
|
|
98
|
+
* own timeout would stall its dispatch for the full compaction budget.
|
|
99
|
+
* Mirrors the global-error broadcast routeNotification does for sinks.
|
|
100
|
+
*/
|
|
101
|
+
private notifyTapsDisposed;
|
|
74
102
|
updateConfig(config: {
|
|
75
103
|
model?: string | null;
|
|
76
104
|
reasoningEffort?: string | null;
|
|
@@ -80,6 +108,14 @@ export declare class CodexAppServerAdapter implements DispatchAdapter {
|
|
|
80
108
|
abortDispatch(sessionKey: string): void;
|
|
81
109
|
hasPendingInjections(sessionKey: string): boolean;
|
|
82
110
|
dispatch({ event, bodyForAgent, sessionKey, context, }: DispatchOpts): AsyncIterable<RuntimeEvent>;
|
|
111
|
+
/**
|
|
112
|
+
* Bring the app-server up and open (start or resume) the thread for this
|
|
113
|
+
* dispatch, then reconcile the main thread's EFFECTIVE instructions plane.
|
|
114
|
+
* Extracted from dispatch() so the convergence re-check there can loop back
|
|
115
|
+
* through the restart path without duplicating the open logic. Errors are
|
|
116
|
+
* returned, not thrown — the generator yields them as runtime events.
|
|
117
|
+
*/
|
|
118
|
+
private openDispatchTarget;
|
|
83
119
|
getBranchPoint(_sessionKey: string): string | undefined;
|
|
84
120
|
forkSession({ sessionKey: parentSessionKey }: ForkOpts): Promise<ForkSessionHandle | null>;
|
|
85
121
|
cleanupFork({ fork }: CleanupForkOpts): void;
|
|
@@ -90,12 +126,21 @@ export declare class CodexAppServerAdapter implements DispatchAdapter {
|
|
|
90
126
|
* to the next dispatch with no active turns — never kills an in-flight turn;
|
|
91
127
|
* thread state survives via thread/resume.
|
|
92
128
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
129
|
+
* For the persisted main thread this restart is also the CANONICAL half of
|
|
130
|
+
* the instructions refresh: only a fresh-process thread/resume applies the
|
|
131
|
+
* updated developerInstructions to the thread's configuration (a resume of
|
|
132
|
+
* a still-running thread ignores it). The EFFECTIVE half is the explicit
|
|
133
|
+
* compaction in instructions-refresh.ts. The capability shim dir on PATH is
|
|
134
|
+
* what makes a grant/revocation's TOOLS effective immediately.
|
|
96
135
|
*/
|
|
97
136
|
requestProcessRestart(): void;
|
|
98
137
|
private restartRequested;
|
|
138
|
+
/**
|
|
139
|
+
* Dispatches currently inside their open/reconcile phase — real work on
|
|
140
|
+
* the subprocess (thread open, possibly a compaction turn) that predates
|
|
141
|
+
* any TurnSink registration, so activeTurns alone cannot gate the restart.
|
|
142
|
+
*/
|
|
143
|
+
private openingDispatches;
|
|
99
144
|
private applyPendingRestart;
|
|
100
145
|
stop(): Promise<void>;
|
|
101
146
|
private ensureStarted;
|
package/dist/dispatch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,aAAa,EACb,YAAY,EACb,MAAM,oBAAoB,CAAC;AAa5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAEL,KAAK,eAAe,EAErB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,KAAK,4BAA4B,GAAG,IAAI,CACtC,gBAAgB,EACd,gBAAgB,GAChB,UAAU,GACV,WAAW,GACX,OAAO,GACP,iBAAiB,GACjB,SAAS,GACT,cAAc,CACjB,GAAG;IACF,cAAc,EAAE,mBAAmB,CAAC;IACpC,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,gFAAgF;IAChF,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8EAA8E;IAC9E,4BAA4B,CAAC,EAAE,MAAM,CAAC;CACvC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,YAAW,eAAe;IA8C/C,O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