@posthog/agent 2.3.465 → 2.3.466
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/adapters/codex/models.d.ts +5 -1
- package/dist/adapters/codex/models.js +35 -1
- package/dist/adapters/codex/models.js.map +1 -1
- package/dist/adapters/reasoning-effort.js.map +1 -1
- package/dist/agent.js +50 -1
- package/dist/agent.js.map +1 -1
- package/dist/posthog-api.js +1 -1
- package/dist/posthog-api.js.map +1 -1
- package/dist/server/agent-server.js +50 -1
- package/dist/server/agent-server.js.map +1 -1
- package/dist/server/bin.cjs +48 -1
- package/dist/server/bin.cjs.map +1 -1
- package/package.json +1 -1
- package/src/adapters/codex/codex-agent.ts +16 -0
- package/src/adapters/codex/models.ts +50 -0
package/package.json
CHANGED
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
} from "../../utils/streams";
|
|
61
61
|
import { BaseAcpAgent, type BaseSession } from "../base-acp-agent";
|
|
62
62
|
import { createCodexClient } from "./codex-client";
|
|
63
|
+
import { normalizeCodexConfigOptions } from "./models";
|
|
63
64
|
import {
|
|
64
65
|
type CodexSessionState,
|
|
65
66
|
createSessionState,
|
|
@@ -265,6 +266,9 @@ export class CodexAcpAgent extends BaseAcpAgent {
|
|
|
265
266
|
const requestedPermissionMode = toCodexPermissionMode(meta?.permissionMode);
|
|
266
267
|
|
|
267
268
|
const response = await this.codexConnection.newSession(params);
|
|
269
|
+
response.configOptions = normalizeCodexConfigOptions(
|
|
270
|
+
response.configOptions,
|
|
271
|
+
);
|
|
268
272
|
|
|
269
273
|
// Initialize session state
|
|
270
274
|
this.sessionState = createSessionState(response.sessionId, params.cwd, {
|
|
@@ -302,6 +306,9 @@ export class CodexAcpAgent extends BaseAcpAgent {
|
|
|
302
306
|
|
|
303
307
|
async loadSession(params: LoadSessionRequest): Promise<LoadSessionResponse> {
|
|
304
308
|
const response = await this.codexConnection.loadSession(params);
|
|
309
|
+
response.configOptions = normalizeCodexConfigOptions(
|
|
310
|
+
response.configOptions,
|
|
311
|
+
);
|
|
305
312
|
const meta = params._meta as NewSessionMeta | undefined;
|
|
306
313
|
const currentPermissionMode = getCurrentPermissionMode(
|
|
307
314
|
response.modes?.currentModeId,
|
|
@@ -341,6 +348,9 @@ export class CodexAcpAgent extends BaseAcpAgent {
|
|
|
341
348
|
cwd: params.cwd,
|
|
342
349
|
mcpServers: params.mcpServers ?? [],
|
|
343
350
|
});
|
|
351
|
+
loadResponse.configOptions = normalizeCodexConfigOptions(
|
|
352
|
+
loadResponse.configOptions,
|
|
353
|
+
);
|
|
344
354
|
|
|
345
355
|
const meta = params._meta as NewSessionMeta | undefined;
|
|
346
356
|
const currentPermissionMode = getCurrentPermissionMode(
|
|
@@ -380,6 +390,9 @@ export class CodexAcpAgent extends BaseAcpAgent {
|
|
|
380
390
|
mcpServers: params.mcpServers ?? [],
|
|
381
391
|
_meta: params._meta,
|
|
382
392
|
});
|
|
393
|
+
newResponse.configOptions = normalizeCodexConfigOptions(
|
|
394
|
+
newResponse.configOptions,
|
|
395
|
+
);
|
|
383
396
|
|
|
384
397
|
const meta = params._meta as NewSessionMeta | undefined;
|
|
385
398
|
const requestedPermissionMode = toCodexPermissionMode(meta?.permissionMode);
|
|
@@ -665,6 +678,9 @@ export class CodexAcpAgent extends BaseAcpAgent {
|
|
|
665
678
|
): Promise<SetSessionConfigOptionResponse> {
|
|
666
679
|
const response = await this.codexConnection.setSessionConfigOption(params);
|
|
667
680
|
if (response.configOptions) {
|
|
681
|
+
response.configOptions = normalizeCodexConfigOptions(
|
|
682
|
+
response.configOptions,
|
|
683
|
+
) as typeof response.configOptions;
|
|
668
684
|
this.sessionState.configOptions = response.configOptions;
|
|
669
685
|
}
|
|
670
686
|
if (params.configId === "mode" && typeof params.value === "string") {
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
SessionConfigOption,
|
|
3
|
+
SessionConfigSelectGroup,
|
|
4
|
+
SessionConfigSelectOption,
|
|
5
|
+
} from "@agentclientprotocol/sdk";
|
|
6
|
+
|
|
1
7
|
interface ReasoningEffortOption {
|
|
2
8
|
value: string;
|
|
3
9
|
name: string;
|
|
@@ -14,3 +20,47 @@ export function getReasoningEffortOptions(
|
|
|
14
20
|
): ReasoningEffortOption[] {
|
|
15
21
|
return CODEX_REASONING_EFFORT_OPTIONS;
|
|
16
22
|
}
|
|
23
|
+
|
|
24
|
+
const CODEX_ACRONYMS: Record<string, string> = {
|
|
25
|
+
gpt: "GPT",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function formatCodexModelName(value: string): string {
|
|
29
|
+
const normalized = value.replace(/(\d)-(\d)/g, "$1.$2");
|
|
30
|
+
return normalized
|
|
31
|
+
.split("-")
|
|
32
|
+
.map((part) => {
|
|
33
|
+
const lower = part.toLowerCase();
|
|
34
|
+
if (CODEX_ACRONYMS[lower]) return CODEX_ACRONYMS[lower];
|
|
35
|
+
if (/^[0-9.]+$/.test(part)) return part;
|
|
36
|
+
return part.charAt(0).toUpperCase() + part.slice(1).toLowerCase();
|
|
37
|
+
})
|
|
38
|
+
.join("-");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function normalizeCodexConfigOptions(
|
|
42
|
+
configOptions: SessionConfigOption[] | null | undefined,
|
|
43
|
+
): SessionConfigOption[] | null | undefined {
|
|
44
|
+
if (!configOptions) return configOptions;
|
|
45
|
+
const formatOption = (
|
|
46
|
+
opt: SessionConfigSelectOption,
|
|
47
|
+
): SessionConfigSelectOption => ({
|
|
48
|
+
...opt,
|
|
49
|
+
name: formatCodexModelName(opt.value),
|
|
50
|
+
});
|
|
51
|
+
return configOptions.map((option) => {
|
|
52
|
+
if (option.category !== "model" || option.type !== "select") return option;
|
|
53
|
+
const options = option.options;
|
|
54
|
+
if (options.length === 0) return option;
|
|
55
|
+
const isGroup = "group" in options[0];
|
|
56
|
+
return {
|
|
57
|
+
...option,
|
|
58
|
+
options: isGroup
|
|
59
|
+
? (options as SessionConfigSelectGroup[]).map((group) => ({
|
|
60
|
+
...group,
|
|
61
|
+
options: group.options.map(formatOption),
|
|
62
|
+
}))
|
|
63
|
+
: (options as SessionConfigSelectOption[]).map(formatOption),
|
|
64
|
+
} as SessionConfigOption;
|
|
65
|
+
});
|
|
66
|
+
}
|