@junctionpanel/server 0.1.59 → 0.1.60
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/server/server/agent/providers/codex-app-server-agent.d.ts +29 -0
- package/dist/server/server/agent/providers/codex-app-server-agent.d.ts.map +1 -1
- package/dist/server/server/agent/providers/codex-app-server-agent.js +52 -23
- package/dist/server/server/agent/providers/codex-app-server-agent.js.map +1 -1
- package/dist/server/server/bootstrap.d.ts +2 -10
- package/dist/server/server/bootstrap.d.ts.map +1 -1
- package/dist/server/server/bootstrap.js.map +1 -1
- package/dist/server/server/index.js +11 -2
- package/dist/server/server/index.js.map +1 -1
- package/dist/server/server/lifecycle-intent.d.ts +20 -0
- package/dist/server/server/lifecycle-intent.d.ts.map +1 -0
- package/dist/server/server/lifecycle-intent.js +2 -0
- package/dist/server/server/lifecycle-intent.js.map +1 -0
- package/dist/server/server/persisted-config.d.ts +19 -19
- package/dist/server/server/session.d.ts +3 -11
- package/dist/server/server/session.d.ts.map +1 -1
- package/dist/server/server/session.js +8 -0
- package/dist/server/server/session.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { AgentCapabilityFlags, AgentClient, AgentModelDefinition, AgentPermissionResponse, AgentPromptInput, AgentSession, AgentSessionConfig, AgentTimelineItem, ToolCallTimelineItem, ListModelsOptions, ListPersistedAgentsOptions, PersistedAgentDescriptor } from "../agent-sdk-types.js";
|
|
2
2
|
import type { Logger } from "pino";
|
|
3
|
+
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
3
4
|
import { type ProviderRuntimeSettings } from "../provider-launch-config.js";
|
|
5
|
+
type CodexConfiguredDefaults = {
|
|
6
|
+
model?: string;
|
|
7
|
+
thinkingOptionId?: string;
|
|
8
|
+
};
|
|
4
9
|
declare function parseUpdatedQuestionAnswers(updatedInput: unknown): Record<string, string[]>;
|
|
5
10
|
type CodexQuestionOption = {
|
|
6
11
|
label?: string;
|
|
@@ -25,6 +30,9 @@ declare function buildCodexElicitationResponse(response: AgentPermissionResponse
|
|
|
25
30
|
content: unknown | null;
|
|
26
31
|
_meta: unknown | null;
|
|
27
32
|
};
|
|
33
|
+
declare function isCodexAppServerUnsupportedMethodError(error: unknown, method: string): boolean;
|
|
34
|
+
type RequestHandler = (params: unknown, requestId: number) => Promise<unknown> | unknown;
|
|
35
|
+
type NotificationHandler = (method: string, params: unknown) => void;
|
|
28
36
|
type CodexAppServerRateLimitWindowSnapshot = {
|
|
29
37
|
usedPercent?: number | null;
|
|
30
38
|
windowDurationMins?: number | null;
|
|
@@ -46,6 +54,24 @@ export type CodexAppServerRateLimitsReadResult = {
|
|
|
46
54
|
rateLimits?: CodexAppServerRateLimitBucket | null;
|
|
47
55
|
rateLimitsByLimitId?: Record<string, CodexAppServerRateLimitBucket> | null;
|
|
48
56
|
};
|
|
57
|
+
declare class CodexAppServerClient {
|
|
58
|
+
private readonly child;
|
|
59
|
+
private readonly logger;
|
|
60
|
+
private readonly rl;
|
|
61
|
+
private readonly pending;
|
|
62
|
+
private readonly requestHandlers;
|
|
63
|
+
private notificationHandler;
|
|
64
|
+
private nextId;
|
|
65
|
+
private disposed;
|
|
66
|
+
private stderrBuffer;
|
|
67
|
+
constructor(child: ChildProcessWithoutNullStreams, logger: Logger);
|
|
68
|
+
setNotificationHandler(handler: NotificationHandler): void;
|
|
69
|
+
setRequestHandler(method: string, handler: RequestHandler): void;
|
|
70
|
+
request(method: string, params?: unknown, timeoutMs?: number): Promise<unknown>;
|
|
71
|
+
notify(method: string, params?: unknown): void;
|
|
72
|
+
dispose(): Promise<void>;
|
|
73
|
+
private handleLine;
|
|
74
|
+
}
|
|
49
75
|
export declare function readCodexAppServerRateLimits(options?: {
|
|
50
76
|
runtimeSettings?: ProviderRuntimeSettings;
|
|
51
77
|
timeoutMs?: number;
|
|
@@ -82,12 +108,15 @@ declare function mapCodexPatchNotificationToToolCall(params: {
|
|
|
82
108
|
success?: boolean | null;
|
|
83
109
|
running: boolean;
|
|
84
110
|
}): ToolCallTimelineItem | null;
|
|
111
|
+
declare function readCodexConfiguredDefaults(client: CodexAppServerClient, logger: Logger): Promise<CodexConfiguredDefaults>;
|
|
85
112
|
export declare function codexAppServerTurnInputFromPrompt(prompt: AgentPromptInput, logger: Logger): Promise<unknown[]>;
|
|
86
113
|
export declare const __codexAppServerInternals: {
|
|
87
114
|
mapCodexPatchNotificationToToolCall: typeof mapCodexPatchNotificationToToolCall;
|
|
88
115
|
supportsPlanCollaborationMode: typeof supportsPlanCollaborationMode;
|
|
89
116
|
shouldRetryInitializeWithoutExperimentalApi: typeof shouldRetryInitializeWithoutExperimentalApi;
|
|
90
117
|
shouldRetryTurnStartWithoutCollaborationMode: typeof shouldRetryTurnStartWithoutCollaborationMode;
|
|
118
|
+
isCodexAppServerUnsupportedMethodError: typeof isCodexAppServerUnsupportedMethodError;
|
|
119
|
+
readCodexConfiguredDefaults: typeof readCodexConfiguredDefaults;
|
|
91
120
|
formatProposedPlanBlock: typeof formatProposedPlanBlock;
|
|
92
121
|
formatProposedPlanChunk: typeof formatProposedPlanChunk;
|
|
93
122
|
buildCompletedCodexTimelineItem: typeof buildCompletedCodexTimelineItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-app-server-agent.d.ts","sourceRoot":"","sources":["../../../../../src/server/agent/providers/codex-app-server-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EAEX,oBAAoB,EAGpB,uBAAuB,EAEvB,gBAAgB,EAIhB,YAAY,EACZ,kBAAkB,EAGlB,iBAAiB,EACjB,oBAAoB,EAEpB,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"codex-app-server-agent.d.ts","sourceRoot":"","sources":["../../../../../src/server/agent/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,CAAC;CAOtC"}
|
|
@@ -82,10 +82,16 @@ function normalizeCodexModelId(modelId) {
|
|
|
82
82
|
}
|
|
83
83
|
return normalized;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function readCodexLegacyConfiguredDefaultsResponse(response) {
|
|
86
86
|
return {
|
|
87
|
-
model:
|
|
88
|
-
thinkingOptionId:
|
|
87
|
+
model: normalizeCodexModelId(response?.config?.model),
|
|
88
|
+
thinkingOptionId: normalizeCodexThinkingOptionId(response?.config?.modelReasoningEffort ?? null),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function readCodexCurrentConfiguredDefaultsResponse(response) {
|
|
92
|
+
return {
|
|
93
|
+
model: normalizeCodexModelId(response?.config?.model),
|
|
94
|
+
thinkingOptionId: normalizeCodexThinkingOptionId(response?.config?.model_reasoning_effort ?? null),
|
|
89
95
|
};
|
|
90
96
|
}
|
|
91
97
|
function resolveCodexBinary(runtimeSettings) {
|
|
@@ -523,6 +529,29 @@ class Pushable {
|
|
|
523
529
|
};
|
|
524
530
|
}
|
|
525
531
|
}
|
|
532
|
+
class CodexAppServerRequestError extends Error {
|
|
533
|
+
constructor(method, message, code) {
|
|
534
|
+
super(message);
|
|
535
|
+
this.name = "CodexAppServerRequestError";
|
|
536
|
+
this.method = method;
|
|
537
|
+
this.code = code;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
function isCodexAppServerUnsupportedMethodError(error, method) {
|
|
541
|
+
if (!error || typeof error !== "object") {
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
const methodValue = "method" in error ? error.method : undefined;
|
|
545
|
+
if (methodValue !== method) {
|
|
546
|
+
return false;
|
|
547
|
+
}
|
|
548
|
+
const codeValue = "code" in error && typeof error.code === "number" ? error.code : undefined;
|
|
549
|
+
const messageValue = "message" in error && typeof error.message === "string" ? error.message : "";
|
|
550
|
+
const lowered = messageValue.toLowerCase();
|
|
551
|
+
return (codeValue === -32601 ||
|
|
552
|
+
lowered.includes("method not found") ||
|
|
553
|
+
lowered.includes(`unknown variant \`${method.toLowerCase()}\``));
|
|
554
|
+
}
|
|
526
555
|
class CodexAppServerClient {
|
|
527
556
|
constructor(child, logger) {
|
|
528
557
|
this.child = child;
|
|
@@ -573,7 +602,7 @@ class CodexAppServerClient {
|
|
|
573
602
|
this.pending.delete(id);
|
|
574
603
|
reject(new Error(`Codex app-server request timed out for ${method}`));
|
|
575
604
|
}, timeoutMs);
|
|
576
|
-
this.pending.set(id, { resolve, reject, timer });
|
|
605
|
+
this.pending.set(id, { method, resolve, reject, timer });
|
|
577
606
|
});
|
|
578
607
|
}
|
|
579
608
|
notify(method, params) {
|
|
@@ -615,7 +644,8 @@ class CodexAppServerClient {
|
|
|
615
644
|
clearTimeout(pending.timer);
|
|
616
645
|
this.pending.delete(id);
|
|
617
646
|
if (msg.error) {
|
|
618
|
-
|
|
647
|
+
const errorPayload = msg.error;
|
|
648
|
+
pending.reject(new CodexAppServerRequestError(pending.method ?? "unknown", errorPayload?.message ?? "Unknown error", errorPayload?.code));
|
|
619
649
|
}
|
|
620
650
|
else {
|
|
621
651
|
pending.resolve(msg.result);
|
|
@@ -1527,32 +1557,29 @@ const CodexNotificationSchema = z.union([
|
|
|
1527
1557
|
z.object({ method: z.string(), params: z.unknown() }).transform(({ method, params }) => ({ kind: "unknown_method", method, params })),
|
|
1528
1558
|
]);
|
|
1529
1559
|
async function readCodexConfiguredDefaults(client, logger) {
|
|
1530
|
-
let savedConfigDefaults = {};
|
|
1531
1560
|
try {
|
|
1532
|
-
const response = (await client.request("
|
|
1533
|
-
|
|
1534
|
-
model: normalizeCodexModelId(response?.config?.model),
|
|
1535
|
-
thinkingOptionId: normalizeCodexThinkingOptionId(response?.config?.modelReasoningEffort ?? null),
|
|
1536
|
-
};
|
|
1561
|
+
const response = (await client.request("config/read", {}));
|
|
1562
|
+
return readCodexCurrentConfiguredDefaultsResponse(response);
|
|
1537
1563
|
}
|
|
1538
1564
|
catch (error) {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1565
|
+
if (!isCodexAppServerUnsupportedMethodError(error, "config/read")) {
|
|
1566
|
+
logger.debug({ err: error }, "Failed to read Codex config defaults via config/read");
|
|
1567
|
+
return {};
|
|
1568
|
+
}
|
|
1569
|
+
logger.debug({ err: error, fallbackMethod: "getUserSavedConfig" }, "Codex app-server does not support config/read; falling back to legacy config defaults request");
|
|
1543
1570
|
}
|
|
1544
|
-
let configReadDefaults = {};
|
|
1545
1571
|
try {
|
|
1546
|
-
const response = (await client.request("
|
|
1547
|
-
|
|
1548
|
-
model: normalizeCodexModelId(response?.config?.model),
|
|
1549
|
-
thinkingOptionId: normalizeCodexThinkingOptionId(response?.config?.model_reasoning_effort ?? null),
|
|
1550
|
-
};
|
|
1572
|
+
const response = (await client.request("getUserSavedConfig", {}));
|
|
1573
|
+
return readCodexLegacyConfiguredDefaultsResponse(response);
|
|
1551
1574
|
}
|
|
1552
1575
|
catch (error) {
|
|
1553
|
-
|
|
1576
|
+
if (isCodexAppServerUnsupportedMethodError(error, "getUserSavedConfig")) {
|
|
1577
|
+
logger.debug({ err: error }, "Codex app-server does not support the legacy getUserSavedConfig request");
|
|
1578
|
+
return {};
|
|
1579
|
+
}
|
|
1580
|
+
logger.debug({ err: error }, "Failed to read Codex legacy config defaults");
|
|
1581
|
+
return {};
|
|
1554
1582
|
}
|
|
1555
|
-
return mergeCodexConfiguredDefaults(savedConfigDefaults, configReadDefaults);
|
|
1556
1583
|
}
|
|
1557
1584
|
export async function codexAppServerTurnInputFromPrompt(prompt, logger) {
|
|
1558
1585
|
if (typeof prompt === "string") {
|
|
@@ -1592,6 +1619,8 @@ export const __codexAppServerInternals = {
|
|
|
1592
1619
|
supportsPlanCollaborationMode,
|
|
1593
1620
|
shouldRetryInitializeWithoutExperimentalApi,
|
|
1594
1621
|
shouldRetryTurnStartWithoutCollaborationMode,
|
|
1622
|
+
isCodexAppServerUnsupportedMethodError,
|
|
1623
|
+
readCodexConfiguredDefaults,
|
|
1595
1624
|
formatProposedPlanBlock,
|
|
1596
1625
|
formatProposedPlanChunk,
|
|
1597
1626
|
buildCompletedCodexTimelineItem,
|