deepcodex 0.1.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/.codex-plugin/plugin.json +24 -0
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/bin/opencodex.js +49 -0
- package/config/desktop.json +9 -0
- package/config/pilot.json +16 -0
- package/config/worker.json +78 -0
- package/node_modules/smol-toml/LICENSE +24 -0
- package/node_modules/smol-toml/README.md +418 -0
- package/node_modules/smol-toml/dist/date.d.ts +41 -0
- package/node_modules/smol-toml/dist/date.js +127 -0
- package/node_modules/smol-toml/dist/error.d.ts +38 -0
- package/node_modules/smol-toml/dist/error.js +63 -0
- package/node_modules/smol-toml/dist/extract.js +69 -0
- package/node_modules/smol-toml/dist/index.cjs +734 -0
- package/node_modules/smol-toml/dist/index.d.ts +43 -0
- package/node_modules/smol-toml/dist/index.js +33 -0
- package/node_modules/smol-toml/dist/parse.d.ts +36 -0
- package/node_modules/smol-toml/dist/parse.js +149 -0
- package/node_modules/smol-toml/dist/primitive.js +238 -0
- package/node_modules/smol-toml/dist/stringify.d.ts +31 -0
- package/node_modules/smol-toml/dist/stringify.js +181 -0
- package/node_modules/smol-toml/dist/struct.js +179 -0
- package/node_modules/smol-toml/dist/util.d.ts +38 -0
- package/node_modules/smol-toml/dist/util.js +89 -0
- package/node_modules/smol-toml/package.json +68 -0
- package/package.json +47 -0
- package/prompts/worker.md +20 -0
- package/scripts/credentials.js +102 -0
- package/scripts/desktop.js +199 -0
- package/scripts/pilot-router.js +241 -0
- package/scripts/pilot.js +242 -0
- package/scripts/toml.js +6 -0
- package/scripts/worker.js +637 -0
- package/skills/delegate-flash/SKILL.md +63 -0
- package/vendor/codex-router/LICENSE +21 -0
- package/vendor/codex-router/deepseek-responses.js +55 -0
- package/vendor/codex-router/json-number-rewrite.js +58 -0
- package/vendor/codex-router/namespace-relay.js +4294 -0
- package/vendor/codex-router/sse-prefix.js +115 -0
- package/vendor/codex-router/subagent-completion.js +261 -0
- package/vendor/codex-router/tool-arguments.js +111 -0
- package/vendor/codex-router/tool-schema-root.js +1008 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 codex-router contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Vendored from duolahypercho/codex-router at 63ec1f3602c28f2a28ccb7e9edaf7b4f7d191c6c.
|
|
2
|
+
// Source: src/deepseek-responses.js; MIT license in LICENSE.
|
|
3
|
+
import { agentMessagesAsUserMessages } from "./namespace-relay.js";
|
|
4
|
+
|
|
5
|
+
// The current direct Flash endpoint speaks Responses natively. Keep older
|
|
6
|
+
// aliases and reseller routes on their separately verified wire contracts.
|
|
7
|
+
export function usesDeepSeekResponses(model) {
|
|
8
|
+
return model?.provider === "deepseek" && model?.upstreamModel === "deepseek-flash";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Current native endpoint aliases, documented in DeepSeek's thinking guide.
|
|
12
|
+
// In particular xhigh maps to high; it is not the legacy Chat profile's max.
|
|
13
|
+
export function deepSeekResponsesEffort(value) {
|
|
14
|
+
if (value === "none") return "none";
|
|
15
|
+
if (["minimal", "low"].includes(value)) return "low";
|
|
16
|
+
return ["max", "ultra"].includes(value) ? "max" : "high";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function reasoningContent(value) {
|
|
20
|
+
const texts = typeof value === "string" ? [value]
|
|
21
|
+
: Array.isArray(value) ? value.map((part) => part?.text) : [];
|
|
22
|
+
return texts.filter((text) => typeof text === "string" && text)
|
|
23
|
+
.map((text) => ({ type: "reasoning_text", text }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Plaintext reasoning uses an array of reasoning_text parts, not a JSON string.
|
|
27
|
+
// DeepSeek ignores summary/encrypted_content; older Chat-bridged turns can have
|
|
28
|
+
// only a summary. Replay its text once as reasoning, preserving part boundaries.
|
|
29
|
+
export function deepSeekResponsesInput(input) {
|
|
30
|
+
if (!Array.isArray(input)) return input;
|
|
31
|
+
// The task text is already recovered; expose Codex handoffs as ordinary
|
|
32
|
+
// messages because the public endpoint does not understand agent_message.
|
|
33
|
+
return agentMessagesAsUserMessages(input).flatMap((item) => {
|
|
34
|
+
if (item?.type !== "reasoning") return [item];
|
|
35
|
+
let content = reasoningContent(item.content);
|
|
36
|
+
if (!content.length) content = reasoningContent(item.summary);
|
|
37
|
+
return content.length ? [{ type: "reasoning", content }] : [];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Only apply_patch has a native custom-tool contract at this endpoint. Other
|
|
42
|
+
// Codex freeform tools use the existing reversible function-tool bridge.
|
|
43
|
+
export function deepSeekCustomToolNames(tools, input, choice) {
|
|
44
|
+
const names = new Set();
|
|
45
|
+
const add = (type, name) => {
|
|
46
|
+
if ((type === "custom" || type === "custom_tool_call") &&
|
|
47
|
+
typeof name === "string" && name && name !== "apply_patch") names.add(name);
|
|
48
|
+
};
|
|
49
|
+
for (const tool of Array.isArray(tools) ? tools : []) add(tool?.type, tool?.name);
|
|
50
|
+
for (const item of Array.isArray(input) ? input : []) add(item?.type, item?.name);
|
|
51
|
+
add(choice?.type, choice?.name);
|
|
52
|
+
for (const tool of choice?.type === "allowed_tools" && Array.isArray(choice.tools)
|
|
53
|
+
? choice.tools : []) add(tool?.type, tool?.name);
|
|
54
|
+
return [...names];
|
|
55
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Vendored from duolahypercho/codex-router at 63ec1f3602c28f2a28ccb7e9edaf7b4f7d191c6c.
|
|
2
|
+
// Source: src/json-number-rewrite.js; MIT license in LICENSE.
|
|
3
|
+
const MAX_EXACT_JSON_NUMBER_LENGTH = 4096;
|
|
4
|
+
const JSON_NUMBER_PARTS =
|
|
5
|
+
/^(-?)(0|[1-9]\d*)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
6
|
+
|
|
7
|
+
// Normalize a bounded JSON number as an exact decimal coefficient + power.
|
|
8
|
+
// This compares mathematical decimal values rather than spellings, so 1.0 and
|
|
9
|
+
// 1e3 can survive a rewrite when JSON.stringify emits 1 and 1000 respectively,
|
|
10
|
+
// while underflow and rounded high-precision tokens cannot.
|
|
11
|
+
function canonicalDecimalToken(token) {
|
|
12
|
+
if (typeof token !== "string" || token.length > MAX_EXACT_JSON_NUMBER_LENGTH) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const match = JSON_NUMBER_PARTS.exec(token);
|
|
16
|
+
if (!match) return undefined;
|
|
17
|
+
const [, sign, integer, fraction = "", exponentText = "0"] = match;
|
|
18
|
+
let digits = integer + fraction;
|
|
19
|
+
if (/^0+$/u.test(digits)) return sign === "-" ? "-0" : "0";
|
|
20
|
+
|
|
21
|
+
const exponentSign = exponentText.startsWith("-") ? -1 : 1;
|
|
22
|
+
const unsignedExponent = exponentText.replace(/^[+-]/u, "");
|
|
23
|
+
const significantExponent = unsignedExponent.replace(/^0+/u, "") || "0";
|
|
24
|
+
// A non-zero finite Number cannot retain an exponent remotely this large;
|
|
25
|
+
// bounding it also prevents attacker-controlled giant integer arithmetic.
|
|
26
|
+
if (significantExponent.length > 6) return undefined;
|
|
27
|
+
let exponent = exponentSign * Number(significantExponent) - fraction.length;
|
|
28
|
+
|
|
29
|
+
digits = digits.replace(/^0+/u, "");
|
|
30
|
+
const trailingZeros = /0+$/u.exec(digits)?.[0].length || 0;
|
|
31
|
+
if (trailingZeros) {
|
|
32
|
+
digits = digits.slice(0, -trailingZeros);
|
|
33
|
+
exponent += trailingZeros;
|
|
34
|
+
}
|
|
35
|
+
return `${sign}${digits}e${exponent}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Permission to JSON.parse and later JSON.stringify a numeric token without
|
|
39
|
+
// changing its exact mathematical decimal value. JavaScript's Number parser
|
|
40
|
+
// can otherwise underflow or round a token while still returning a finite
|
|
41
|
+
// value, which would silently mutate unrelated response fields during a
|
|
42
|
+
// compatibility rewrite.
|
|
43
|
+
export function jsonNumberIsStableForRewrite(token) {
|
|
44
|
+
if (typeof token !== "string" || token.length > MAX_EXACT_JSON_NUMBER_LENGTH) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const parsed = Number(token);
|
|
48
|
+
if (
|
|
49
|
+
!Number.isFinite(parsed) ||
|
|
50
|
+
Object.is(parsed, -0) ||
|
|
51
|
+
(Number.isInteger(parsed) && !Number.isSafeInteger(parsed))
|
|
52
|
+
) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const original = canonicalDecimalToken(token);
|
|
56
|
+
const serialized = canonicalDecimalToken(JSON.stringify(parsed));
|
|
57
|
+
return original !== undefined && original === serialized;
|
|
58
|
+
}
|