@agentrouter-top/relay-dsh-plugin-codex 0.2.2-agentrouter.1 → 0.2.2-agentrouter.2
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/AGENTROUTER-FORK.md +1 -1
- package/docs/behavior-defaults.md +43 -0
- package/lib/host-plugin.js +27 -22
- package/lib/host-plugin.js.map +1 -1
- package/package.json +5 -3
package/AGENTROUTER-FORK.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Upstream: https://github.com/yangbobo2021/relay-dsh-plugin-codex.git @ 75918b3e06880df25375154321109f364124a544 (MIT).
|
|
4
4
|
|
|
5
|
-
Changes: version 1 generic codexHome/codexEnv launch interface, Codex 0.153.4, and package/build identity. No agent protocol, model picker, effort controls or tool implementation replaced.
|
|
5
|
+
Changes: version 1 generic codexHome/codexEnv launch interface, optional codexBehaviorDefaults=native (see docs/behavior-defaults.md), Codex 0.153.4, and package/build identity. No agent protocol, model picker, effort controls or tool implementation replaced.
|
|
6
6
|
|
|
7
7
|
Sources and checksummed contributions: https://github.com/Maybank01/agentrouter-dsh-plugins/tree/main/upstream/relay-codex
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Optional native behavior defaults
|
|
2
|
+
|
|
3
|
+
The public DSH host configuration accepts `codexBehaviorDefaults: "native"`.
|
|
4
|
+
Omitting it (or setting `"relay"`) preserves upstream Relay behavior. Unknown
|
|
5
|
+
values fail activation. This is independent of `codexExecutionMode`.
|
|
6
|
+
|
|
7
|
+
For a Codex-native agent that can still use DSH plugin tools, compose:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
codexExecutionGuidance: false
|
|
11
|
+
codexBehaviorDefaults: native
|
|
12
|
+
# codexExecutionMode remains enhanced (the default).
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This omits Relay's fixed personality, collaboration mode and multi-agent mode
|
|
16
|
+
from ordinary thread/turn requests and from model/effort synchronization. It
|
|
17
|
+
does not replace these overrides with empty strings or null, and does not remove
|
|
18
|
+
Codex's own instructions, native mode defaults, AGENTS.md or Skills. Model/effort
|
|
19
|
+
choices, tool schemas, attachment context, permissions and cancellation stay on
|
|
20
|
+
their existing paths. Native configuration may itself select a personality or
|
|
21
|
+
mode; this switch does not force a different one.
|
|
22
|
+
|
|
23
|
+
With execution guidance disabled, ordinary conversations add no Relay developer
|
|
24
|
+
instructions and do not forward the combined DSH `options.system`. Plugin tool
|
|
25
|
+
descriptions/results still carry their necessary knowledge. This is **not** an
|
|
26
|
+
automatic bridge for all DSH preset prompts or plugin context messages. A future
|
|
27
|
+
knowledge/mode bridge needs explicit source and session scope, not a heuristic
|
|
28
|
+
that classifies arbitrary system text as knowledge. Do not use this option to
|
|
29
|
+
claim that unbridged DSH prompt contributions already reach Codex.
|
|
30
|
+
|
|
31
|
+
Explicit instructions supplied by a caller still work (including separate,
|
|
32
|
+
read-only auxiliary title/compaction threads); absent instruction fields are
|
|
33
|
+
omitted. User files and existing conversation history are never rewritten.
|
|
34
|
+
Previously injected guidance can remain in a resumed/forked conversation: use
|
|
35
|
+
a new conversation to evaluate the new defaults.
|
|
36
|
+
|
|
37
|
+
Implementation: `apply(ctx, config)` passes `behaviorDefaults` through the
|
|
38
|
+
existing execution plugin to `CodexSessionRuntime`. There is no Desktop API,
|
|
39
|
+
provider policy, extra AgentLoop or tool implementation here.
|
|
40
|
+
|
|
41
|
+
Protocol semantics: [official OpenAI App Server documentation](https://learn.chatgpt.com/docs/app-server).
|
|
42
|
+
In particular, `collaborationMode.settings.developer_instructions: null` selects
|
|
43
|
+
the mode's built-in instructions; it does not clear them.
|
package/lib/host-plugin.js
CHANGED
|
@@ -681,8 +681,11 @@ function newThreadConfig(bypassHookTrust) {
|
|
|
681
681
|
};
|
|
682
682
|
}
|
|
683
683
|
var CodexSessionRuntime = class extends EventEmitter {
|
|
684
|
-
constructor({ client, cwd = process.cwd(), codexHome }) {
|
|
684
|
+
constructor({ client, cwd = process.cwd(), codexHome, behaviorDefaults = "relay" }) {
|
|
685
685
|
super();
|
|
686
|
+
if (!["relay", "native"].includes(behaviorDefaults)) throw new TypeError(`Unknown Codex behavior defaults: ${behaviorDefaults}`);
|
|
687
|
+
this.behaviorDefaults = behaviorDefaults;
|
|
688
|
+
this.defaultMultiAgentMode = behaviorDefaults === "native" ? void 0 : DEFAULT_MULTI_AGENT_MODE;
|
|
686
689
|
this.client = client;
|
|
687
690
|
this.cwd = cwd;
|
|
688
691
|
this.codexHome = codexHome;
|
|
@@ -807,15 +810,15 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
807
810
|
approvalPolicy,
|
|
808
811
|
permissions: permissionProfile(selectedSandbox),
|
|
809
812
|
runtimeWorkspaceRoots: selectedSandbox === "read-only" ? [] : [cwd],
|
|
810
|
-
personality: ephemeral ? null : "friendly",
|
|
813
|
+
personality: this.behaviorDefaults === "native" ? void 0 : ephemeral ? null : "friendly",
|
|
811
814
|
ephemeral: ephemeral ?? null,
|
|
812
|
-
baseInstructions: baseInstructions ?? null,
|
|
815
|
+
baseInstructions: this.behaviorDefaults === "native" ? baseInstructions : baseInstructions ?? null,
|
|
813
816
|
serviceName,
|
|
814
817
|
threadSource,
|
|
815
818
|
mockExperimentalField: null,
|
|
816
819
|
experimentalRawEvents: !ephemeral,
|
|
817
820
|
dynamicTools,
|
|
818
|
-
developerInstructions: developerInstructions ?? null
|
|
821
|
+
developerInstructions: this.behaviorDefaults === "native" ? developerInstructions : developerInstructions ?? null
|
|
819
822
|
}));
|
|
820
823
|
const session = this.upsertThread(result.thread, {
|
|
821
824
|
model: selectedModel,
|
|
@@ -828,7 +831,7 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
828
831
|
this.recordNativeSettings(session, result, {
|
|
829
832
|
model: selectedModel,
|
|
830
833
|
effort: selectedEffort,
|
|
831
|
-
multiAgentMode:
|
|
834
|
+
multiAgentMode: this.defaultMultiAgentMode
|
|
832
835
|
});
|
|
833
836
|
if (!session.ephemeral) this.selectedSessionId = session.id;
|
|
834
837
|
this.emitChange();
|
|
@@ -851,8 +854,8 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
851
854
|
approvalPolicy,
|
|
852
855
|
permissions: permissionProfile(selectedSandbox),
|
|
853
856
|
runtimeWorkspaceRoots: selectedSandbox === "read-only" ? [] : [cwd],
|
|
854
|
-
baseInstructions: baseInstructions ?? null,
|
|
855
|
-
developerInstructions: developerInstructions ?? null,
|
|
857
|
+
baseInstructions: this.behaviorDefaults === "native" ? baseInstructions : baseInstructions ?? null,
|
|
858
|
+
developerInstructions: this.behaviorDefaults === "native" ? developerInstructions : developerInstructions ?? null,
|
|
856
859
|
ephemeral,
|
|
857
860
|
threadSource
|
|
858
861
|
}));
|
|
@@ -868,7 +871,7 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
868
871
|
this.recordNativeSettings(session, result, {
|
|
869
872
|
model: session.model,
|
|
870
873
|
effort: session.effort,
|
|
871
|
-
multiAgentMode:
|
|
874
|
+
multiAgentMode: this.defaultMultiAgentMode
|
|
872
875
|
});
|
|
873
876
|
if (!session.ephemeral) this.selectedSessionId = session.id;
|
|
874
877
|
this.emitChange();
|
|
@@ -890,7 +893,7 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
890
893
|
this.recordNativeSettings(session, result, {
|
|
891
894
|
model: session.model,
|
|
892
895
|
effort: session.effort,
|
|
893
|
-
multiAgentMode:
|
|
896
|
+
multiAgentMode: this.defaultMultiAgentMode
|
|
894
897
|
});
|
|
895
898
|
if (result.thread.turns?.length > 0) session.turns = structuredClone(result.thread.turns);
|
|
896
899
|
this.selectedSessionId = threadId;
|
|
@@ -913,7 +916,7 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
913
916
|
await this.syncThreadSettings(session.id, {
|
|
914
917
|
model: nextModel,
|
|
915
918
|
effort: nextEffort,
|
|
916
|
-
multiAgentMode:
|
|
919
|
+
multiAgentMode: this.defaultMultiAgentMode
|
|
917
920
|
});
|
|
918
921
|
Object.assign(session, {
|
|
919
922
|
model: nextModel,
|
|
@@ -935,12 +938,12 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
935
938
|
runtimeWorkspaceRoots: usePermissionProfile ? runtimeWorkspaceRoots(nextSandbox, workspaceRoots) : null,
|
|
936
939
|
model: null,
|
|
937
940
|
effort: null,
|
|
938
|
-
multiAgentMode:
|
|
941
|
+
multiAgentMode: this.defaultMultiAgentMode,
|
|
939
942
|
summary: reasoningSummary === "none" ? "none" : "auto",
|
|
940
|
-
personality: "friendly",
|
|
943
|
+
personality: this.behaviorDefaults === "native" ? void 0 : "friendly",
|
|
941
944
|
responsesapiClientMetadata: { workspace_kind: "project" },
|
|
942
945
|
outputSchema: null,
|
|
943
|
-
collaborationMode: {
|
|
946
|
+
collaborationMode: this.behaviorDefaults === "native" ? void 0 : {
|
|
944
947
|
mode: "default",
|
|
945
948
|
settings: {
|
|
946
949
|
model: nextModel,
|
|
@@ -1051,15 +1054,15 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
1051
1054
|
});
|
|
1052
1055
|
}
|
|
1053
1056
|
async syncThreadSettings(threadId, settings) {
|
|
1054
|
-
const next = normalizeThreadSettings(settings);
|
|
1057
|
+
const next = normalizeThreadSettings(settings, this.defaultMultiAgentMode);
|
|
1055
1058
|
const current = this.appliedThreadSettings.get(threadId);
|
|
1056
1059
|
if (current && sameThreadSettings(current, next)) return;
|
|
1057
|
-
await this.client.request("thread/settings/update", {
|
|
1060
|
+
await this.client.request("thread/settings/update", compactObject({
|
|
1058
1061
|
threadId,
|
|
1059
1062
|
model: next.model,
|
|
1060
1063
|
effort: next.effort,
|
|
1061
1064
|
multiAgentMode: next.multiAgentMode
|
|
1062
|
-
});
|
|
1065
|
+
}));
|
|
1063
1066
|
this.appliedThreadSettings.set(threadId, next);
|
|
1064
1067
|
}
|
|
1065
1068
|
async releaseSession(threadId) {
|
|
@@ -1363,7 +1366,7 @@ var CodexSessionRuntime = class extends EventEmitter {
|
|
|
1363
1366
|
if (!this.closed) this.emit("connectionStatus", this.status());
|
|
1364
1367
|
}
|
|
1365
1368
|
recordAppliedThreadSettings(threadId, settings) {
|
|
1366
|
-
this.appliedThreadSettings.set(threadId, normalizeThreadSettings(settings));
|
|
1369
|
+
this.appliedThreadSettings.set(threadId, normalizeThreadSettings(settings, this.defaultMultiAgentMode));
|
|
1367
1370
|
}
|
|
1368
1371
|
recordNativeSettings(session, result, fallback = {}) {
|
|
1369
1372
|
const settings = compactObject({
|
|
@@ -1550,15 +1553,15 @@ function turnInterruptionFailure(threadId, turnId, failures) {
|
|
|
1550
1553
|
error.failures = failures;
|
|
1551
1554
|
return error;
|
|
1552
1555
|
}
|
|
1553
|
-
function normalizeThreadSettings(settings = {}) {
|
|
1556
|
+
function normalizeThreadSettings(settings = {}, defaultMultiAgentMode) {
|
|
1554
1557
|
return {
|
|
1555
1558
|
model: settings.model ?? null,
|
|
1556
1559
|
effort: settings.effort ?? null,
|
|
1557
|
-
multiAgentMode: settings.multiAgentMode ??
|
|
1560
|
+
multiAgentMode: settings.multiAgentMode ?? defaultMultiAgentMode
|
|
1558
1561
|
};
|
|
1559
1562
|
}
|
|
1560
1563
|
function sameThreadSettings(left, right) {
|
|
1561
|
-
return left.model === right.model && left.effort === right.effort && left.multiAgentMode === right.multiAgentMode;
|
|
1564
|
+
return left.model === right.model && left.effort === right.effort && (right.multiAgentMode === void 0 || left.multiAgentMode === right.multiAgentMode);
|
|
1562
1565
|
}
|
|
1563
1566
|
function summarizeTitle$1(text) {
|
|
1564
1567
|
const normalized = text.replace(/\s+/g, " ").trim();
|
|
@@ -1598,7 +1601,8 @@ function createCodexExecutionPlugin(config = {}) {
|
|
|
1598
1601
|
const runtime = new CodexSessionRuntime({
|
|
1599
1602
|
client,
|
|
1600
1603
|
cwd: config.cwd ?? process.cwd(),
|
|
1601
|
-
codexHome: config.codexHome
|
|
1604
|
+
codexHome: config.codexHome,
|
|
1605
|
+
behaviorDefaults: config.behaviorDefaults
|
|
1602
1606
|
});
|
|
1603
1607
|
defer(() => runtime.close());
|
|
1604
1608
|
const ready = runtime.initialize();
|
|
@@ -5126,7 +5130,8 @@ async function apply(ctx, config = {}) {
|
|
|
5126
5130
|
requestTimeoutMs: config.codexRequestTimeoutMs,
|
|
5127
5131
|
cwd: config.cwd,
|
|
5128
5132
|
codexHome: launch.codexHome,
|
|
5129
|
-
env: launch.env
|
|
5133
|
+
env: launch.env,
|
|
5134
|
+
behaviorDefaults: config.codexBehaviorDefaults
|
|
5130
5135
|
}), createDshCodexPlugin(ctx, {
|
|
5131
5136
|
...config,
|
|
5132
5137
|
codexHome: launch.codexHome
|