@yansigit/opencodex 2.35.2-dev.20260829.13 → 2.35.2-dev.20260829.15
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/gui/dist/index.html
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
} catch (e) {}
|
|
17
17
|
})();
|
|
18
18
|
</script>
|
|
19
|
-
<script type="module" crossorigin src="/assets/index-
|
|
19
|
+
<script type="module" crossorigin src="/assets/index-DHcEY_TX.js"></script>
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-DLkXOXLC.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yansigit/opencodex",
|
|
3
|
-
"version": "2.35.2-dev.20260829.
|
|
3
|
+
"version": "2.35.2-dev.20260829.15",
|
|
4
4
|
"description": "Universal provider proxy for OpenAI Codex & Claude Code — use any LLM with Codex CLI/App/SDK and Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./bin/package-main.mjs",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"path": "package.json",
|
|
13
|
-
"sha256": "
|
|
13
|
+
"sha256": "1e5e4d18d1b11c9a32eeca524b6d06316a028e0fa7d3279820c69282c069a4d6"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"path": "scripts/model-metadata.source.json",
|
|
@@ -2994,7 +2994,7 @@
|
|
|
2994
2994
|
},
|
|
2995
2995
|
{
|
|
2996
2996
|
"path": "src/server/responses/v2-routed-delegation-bridge.ts",
|
|
2997
|
-
"sha256": "
|
|
2997
|
+
"sha256": "6b4e814ea2539d51bd8e4071230954d46c045e08745fd2d586ee0d0636610b21"
|
|
2998
2998
|
},
|
|
2999
2999
|
{
|
|
3000
3000
|
"path": "src/server/responses/ws-upstream.ts",
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isDeepStrictEqual } from "node:util";
|
|
2
1
|
import type { OcxParsedRequest, OcxTool } from "../../types";
|
|
3
2
|
import type { SsePayloadRewrite } from "../sse-payload-rewrite";
|
|
4
3
|
|
|
@@ -7,6 +6,7 @@ const NATIVE_NAMESPACE = "collaboration";
|
|
|
7
6
|
const MIRRORED_NAMES = new Set(["spawn_agent", "send_message", "followup_task"]);
|
|
8
7
|
const GUIDANCE = "Use this routed-child mirror for collaboration operations.";
|
|
9
8
|
const MAX_SSE_BINDINGS = 128;
|
|
9
|
+
const injectedGroups = new WeakSet<object>();
|
|
10
10
|
|
|
11
11
|
type RecordValue = Record<string, unknown>;
|
|
12
12
|
|
|
@@ -33,21 +33,38 @@ function rawToolLists(body: unknown, replayPrefixLength: number): unknown[][] {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function requestStateBody(body: unknown): unknown {
|
|
36
|
-
if (!isRecord(body)
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
if (!isRecord(body)) return body;
|
|
37
|
+
const cloneTools = (tools: unknown[]) => tools.map(tool => (
|
|
38
|
+
isRecord(tool) && tool.type === "namespace" && Array.isArray(tool.tools)
|
|
39
|
+
? { ...tool, tools: [...tool.tools] }
|
|
40
|
+
: tool
|
|
41
|
+
));
|
|
42
|
+
if (!Array.isArray(body.tools) && !Array.isArray(body.input)) return body;
|
|
43
|
+
// Only tool catalogs are mutated below. Clone that narrow path so the continuation
|
|
44
|
+
// cache retains the caller's catalog without copying unrelated context.
|
|
39
45
|
return {
|
|
40
46
|
...body,
|
|
41
|
-
|
|
47
|
+
...(Array.isArray(body.tools) ? { tools: cloneTools(body.tools) } : {}),
|
|
48
|
+
...(Array.isArray(body.input) ? { input: body.input.map(item => (
|
|
42
49
|
isRecord(item) && item.type === "additional_tools" && Array.isArray(item.tools)
|
|
43
|
-
? { ...item, tools:
|
|
50
|
+
? { ...item, tools: cloneTools(item.tools) }
|
|
44
51
|
: item
|
|
45
|
-
)),
|
|
52
|
+
)) } : {}),
|
|
46
53
|
};
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
function mirrorTool(tool: RecordValue): RecordValue {
|
|
50
|
-
|
|
57
|
+
const parameters = isRecord(tool.parameters) ? tool.parameters : undefined;
|
|
58
|
+
const properties = isRecord(parameters?.properties) ? parameters.properties : undefined;
|
|
59
|
+
const message = isRecord(properties?.message) ? properties.message : undefined;
|
|
60
|
+
const { encrypted: _, ...plaintextMessage } = message ?? {};
|
|
61
|
+
return {
|
|
62
|
+
...tool,
|
|
63
|
+
description: `${GUIDANCE} ${tool.name}.`,
|
|
64
|
+
...(message && Object.hasOwn(message, "encrypted") ? {
|
|
65
|
+
parameters: { ...parameters, properties: { ...properties, message: plaintextMessage } },
|
|
66
|
+
} : {}),
|
|
67
|
+
};
|
|
51
68
|
}
|
|
52
69
|
|
|
53
70
|
function mirrorChildren(group: RecordValue): RecordValue[] {
|
|
@@ -85,25 +102,31 @@ export function injectV2RoutedDelegationBridge(
|
|
|
85
102
|
for (const { group } of nativeGroups) {
|
|
86
103
|
for (const child of mirrorChildren(group)) names.add(child.name as string);
|
|
87
104
|
}
|
|
105
|
+
for (const { group } of existing) {
|
|
106
|
+
for (const child of mirrorChildren(group)) names.add(child.name as string);
|
|
107
|
+
}
|
|
88
108
|
if (names.size === 0) return undefined;
|
|
89
109
|
|
|
90
110
|
const expected = nativeGroups.map(({ list, index, group }) => ({ list, index: index + 1, group: mirrorGroup(group) }));
|
|
91
|
-
const idempotent = existing.length ===
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
111
|
+
const idempotent = existing.length === nativeGroups.length && existing.every(({ list, index, group }) => (
|
|
112
|
+
injectedGroups.has(group)
|
|
113
|
+
&& nativeGroups.some(native => native.list === list && native.index + 1 === index)
|
|
114
|
+
));
|
|
95
115
|
if (existing.length > 0 && !idempotent) {
|
|
96
116
|
throw new Error("v2 routed delegation bridge namespace collision");
|
|
97
117
|
}
|
|
98
118
|
if (!idempotent) {
|
|
99
|
-
for (const { list, index, group } of [...expected].reverse())
|
|
119
|
+
for (const { list, index, group } of [...expected].reverse()) {
|
|
120
|
+
injectedGroups.add(group);
|
|
121
|
+
list.splice(index, 0, group);
|
|
122
|
+
}
|
|
100
123
|
}
|
|
101
124
|
|
|
102
125
|
const mirrorTools: OcxTool[] = [];
|
|
103
126
|
for (const name of names) {
|
|
104
127
|
const source = parsed.context.tools?.find(tool => tool.namespace === NATIVE_NAMESPACE && tool.name === name);
|
|
105
128
|
if (source) {
|
|
106
|
-
mirrorTools.push({ ...source, namespace: MIRROR_NAMESPACE
|
|
129
|
+
mirrorTools.push({ ...mirrorTool(source as unknown as RecordValue), namespace: MIRROR_NAMESPACE } as OcxTool);
|
|
107
130
|
continue;
|
|
108
131
|
}
|
|
109
132
|
const raw = nativeGroups.flatMap(entry => mirrorChildren(entry.group)).find(tool => tool.name === name);
|
|
@@ -114,7 +137,15 @@ export function injectV2RoutedDelegationBridge(
|
|
|
114
137
|
parameters: isRecord(raw?.parameters) ? raw.parameters : {},
|
|
115
138
|
});
|
|
116
139
|
}
|
|
140
|
+
for (const { group } of nativeGroups) {
|
|
141
|
+
if (Array.isArray(group.tools)) group.tools = group.tools.filter(tool => (
|
|
142
|
+
!isRecord(tool) || typeof tool.name !== "string" || !MIRRORED_NAMES.has(tool.name)
|
|
143
|
+
));
|
|
144
|
+
}
|
|
117
145
|
if (mirrorTools.length > 0) {
|
|
146
|
+
parsed.context.tools = (parsed.context.tools ?? []).filter(tool => (
|
|
147
|
+
tool.namespace !== NATIVE_NAMESPACE || !MIRRORED_NAMES.has(tool.name)
|
|
148
|
+
));
|
|
118
149
|
const present = new Set((parsed.context.tools ?? [])
|
|
119
150
|
.filter(tool => tool.namespace === MIRROR_NAMESPACE)
|
|
120
151
|
.map(tool => tool.name));
|