codexuse-cli 6.0.4 → 6.0.5
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/index.js +115 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2082,6 +2082,75 @@ var import_node_crypto2 = require("crypto");
|
|
|
2082
2082
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
2083
2083
|
var import_node_os = __toESM(require("os"), 1);
|
|
2084
2084
|
|
|
2085
|
+
// ../../packages/contracts/src/desktop/llm-compatibility.ts
|
|
2086
|
+
var DESKTOP_LLM_CAPABILITY_NAMES = [
|
|
2087
|
+
"streamingText",
|
|
2088
|
+
"inputImage",
|
|
2089
|
+
"reasoning",
|
|
2090
|
+
"reasoningEfforts",
|
|
2091
|
+
"functionTools",
|
|
2092
|
+
"applyPatch",
|
|
2093
|
+
"namespaceTools",
|
|
2094
|
+
"parallelTools",
|
|
2095
|
+
"toolChoice",
|
|
2096
|
+
"toolSearch",
|
|
2097
|
+
"standaloneWebSearch",
|
|
2098
|
+
"imageGeneration"
|
|
2099
|
+
];
|
|
2100
|
+
var POLICY_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
2101
|
+
"inputImage",
|
|
2102
|
+
"reasoning",
|
|
2103
|
+
"reasoningEfforts",
|
|
2104
|
+
"applyPatch",
|
|
2105
|
+
"toolSearch",
|
|
2106
|
+
"standaloneWebSearch",
|
|
2107
|
+
"imageGeneration"
|
|
2108
|
+
]);
|
|
2109
|
+
function createDesktopLlmCapability(input) {
|
|
2110
|
+
return {
|
|
2111
|
+
nativeSupport: {
|
|
2112
|
+
state: input.state,
|
|
2113
|
+
source: input.source ?? "default"
|
|
2114
|
+
},
|
|
2115
|
+
userPolicy: input.policy ?? "auto"
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
function migrateDesktopLlmCapabilityV3(name, value3) {
|
|
2119
|
+
const record2 = value3 && typeof value3 === "object" && !Array.isArray(value3) ? value3 : {};
|
|
2120
|
+
const enabled = record2.enabled === true;
|
|
2121
|
+
const legacySource = record2.source;
|
|
2122
|
+
const source = legacySource === "verified" ? "probe" : "default";
|
|
2123
|
+
return createDesktopLlmCapability({
|
|
2124
|
+
state: enabled ? "supported" : "unsupported",
|
|
2125
|
+
source,
|
|
2126
|
+
// Version 3 used one boolean for support and user intent. Preserve the
|
|
2127
|
+
// stricter behavior for semantic capabilities during the one-way migration.
|
|
2128
|
+
policy: POLICY_CAPABILITIES.has(name) ? enabled ? "allow" : "deny" : "auto"
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2131
|
+
function normalizeDesktopLlmCapability(name, value3) {
|
|
2132
|
+
const record2 = value3 && typeof value3 === "object" && !Array.isArray(value3) ? value3 : null;
|
|
2133
|
+
const nativeSupport = record2?.nativeSupport && typeof record2.nativeSupport === "object" && !Array.isArray(record2.nativeSupport) ? record2.nativeSupport : null;
|
|
2134
|
+
if (nativeSupport) {
|
|
2135
|
+
const state = nativeSupport.state;
|
|
2136
|
+
const source = nativeSupport.source;
|
|
2137
|
+
const policy = record2?.userPolicy;
|
|
2138
|
+
if ((state === "unknown" || state === "supported" || state === "unsupported") && (source === "default" || source === "provider" || source === "probe" || source === "runtime" || source === "user") && !(source === "runtime" && state === "supported") && (policy === "auto" || policy === "allow" || policy === "deny")) {
|
|
2139
|
+
return createDesktopLlmCapability({ state, source, policy });
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
return migrateDesktopLlmCapabilityV3(name, value3);
|
|
2143
|
+
}
|
|
2144
|
+
function normalizeDesktopLlmCapabilities(value3) {
|
|
2145
|
+
const record2 = value3 && typeof value3 === "object" && !Array.isArray(value3) ? value3 : {};
|
|
2146
|
+
return Object.fromEntries(
|
|
2147
|
+
DESKTOP_LLM_CAPABILITY_NAMES.map((name) => [
|
|
2148
|
+
name,
|
|
2149
|
+
normalizeDesktopLlmCapability(name, record2[name])
|
|
2150
|
+
])
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2085
2154
|
// ../../packages/contracts/src/settings/auto-roll.ts
|
|
2086
2155
|
var DEFAULT_AUTO_ROLL_ENABLED = false;
|
|
2087
2156
|
var DEFAULT_AUTO_ROLL_REARM_REMAINING_THRESHOLD = 15;
|
|
@@ -3251,7 +3320,7 @@ function createDefaultAppState() {
|
|
|
3251
3320
|
relayProfilesById: {},
|
|
3252
3321
|
desktopLlmEnabled: false,
|
|
3253
3322
|
desktopLlmRegistry: {
|
|
3254
|
-
version:
|
|
3323
|
+
version: 4,
|
|
3255
3324
|
revision: (0, import_node_crypto2.createHash)("sha256").update("empty").digest("hex"),
|
|
3256
3325
|
providers: [],
|
|
3257
3326
|
routes: [],
|
|
@@ -3558,12 +3627,12 @@ function migrateDesktopLlmRegistry(profiles) {
|
|
|
3558
3627
|
])
|
|
3559
3628
|
)
|
|
3560
3629
|
).digest("hex");
|
|
3561
|
-
const capability = (
|
|
3562
|
-
|
|
3563
|
-
source
|
|
3564
|
-
|
|
3630
|
+
const capability = (name, enabled) => migrateDesktopLlmCapabilityV3(
|
|
3631
|
+
name,
|
|
3632
|
+
{ enabled, source: enabled ? "declared" : "failed" }
|
|
3633
|
+
);
|
|
3565
3634
|
return {
|
|
3566
|
-
version:
|
|
3635
|
+
version: 4,
|
|
3567
3636
|
revision,
|
|
3568
3637
|
providers: entries3.map((profile) => {
|
|
3569
3638
|
const endpoint = profile.baseUrl.trim().replace(/\/+$/g, "");
|
|
@@ -3619,18 +3688,18 @@ function migrateDesktopLlmRegistry(profiles) {
|
|
|
3619
3688
|
adapter: profile.protocol === "chat-completions" ? "openai-chat" : "openai-responses",
|
|
3620
3689
|
path: profile.protocol === "chat-completions" ? `${apiRoot}/chat/completions` : `${apiRoot}/responses`,
|
|
3621
3690
|
capabilities: {
|
|
3622
|
-
streamingText: capability(
|
|
3623
|
-
inputImage: capability(
|
|
3624
|
-
reasoning: capability(
|
|
3625
|
-
reasoningEfforts: capability(
|
|
3626
|
-
functionTools: capability(
|
|
3627
|
-
applyPatch: capability(
|
|
3628
|
-
namespaceTools: capability(
|
|
3629
|
-
parallelTools: capability(
|
|
3630
|
-
toolChoice: capability(
|
|
3631
|
-
toolSearch: capability(
|
|
3632
|
-
standaloneWebSearch: capability(
|
|
3633
|
-
imageGeneration: capability(
|
|
3691
|
+
streamingText: capability("streamingText", true),
|
|
3692
|
+
inputImage: capability("inputImage", false),
|
|
3693
|
+
reasoning: capability("reasoning", false),
|
|
3694
|
+
reasoningEfforts: capability("reasoningEfforts", false),
|
|
3695
|
+
functionTools: capability("functionTools", true),
|
|
3696
|
+
applyPatch: capability("applyPatch", false),
|
|
3697
|
+
namespaceTools: capability("namespaceTools", false),
|
|
3698
|
+
parallelTools: capability("parallelTools", false),
|
|
3699
|
+
toolChoice: capability("toolChoice", true),
|
|
3700
|
+
toolSearch: capability("toolSearch", false),
|
|
3701
|
+
standaloneWebSearch: capability("standaloneWebSearch", false),
|
|
3702
|
+
imageGeneration: capability("imageGeneration", false)
|
|
3634
3703
|
},
|
|
3635
3704
|
requestProfile: {
|
|
3636
3705
|
reasoningStyle: "none",
|
|
@@ -3657,20 +3726,6 @@ function migrateDesktopLlmRegistry(profiles) {
|
|
|
3657
3726
|
externalProfiles: []
|
|
3658
3727
|
};
|
|
3659
3728
|
}
|
|
3660
|
-
var DESKTOP_LLM_CAPABILITIES = [
|
|
3661
|
-
"streamingText",
|
|
3662
|
-
"inputImage",
|
|
3663
|
-
"reasoning",
|
|
3664
|
-
"reasoningEfforts",
|
|
3665
|
-
"functionTools",
|
|
3666
|
-
"applyPatch",
|
|
3667
|
-
"namespaceTools",
|
|
3668
|
-
"parallelTools",
|
|
3669
|
-
"toolChoice",
|
|
3670
|
-
"toolSearch",
|
|
3671
|
-
"standaloneWebSearch",
|
|
3672
|
-
"imageGeneration"
|
|
3673
|
-
];
|
|
3674
3729
|
var DESKTOP_LLM_REASONING_EFFORTS = [
|
|
3675
3730
|
"minimal",
|
|
3676
3731
|
"low",
|
|
@@ -3693,7 +3748,7 @@ function desktopLlmReasoningEffortsMatchStyle(adapter, style, values2) {
|
|
|
3693
3748
|
return style !== "openrouter" || !values2.includes("max");
|
|
3694
3749
|
}
|
|
3695
3750
|
function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
3696
|
-
if (!isRecord2(value3) || value3.version !== 1 && value3.version !== 2 && value3.version !== 3) {
|
|
3751
|
+
if (!isRecord2(value3) || value3.version !== 1 && value3.version !== 2 && value3.version !== 3 && value3.version !== 4) {
|
|
3697
3752
|
return migrateDesktopLlmRegistry(profiles);
|
|
3698
3753
|
}
|
|
3699
3754
|
const legacyProviderTransport = /* @__PURE__ */ new Map();
|
|
@@ -3757,17 +3812,12 @@ function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
|
3757
3812
|
if (!publicSlug || !providerId || !upstreamModelId || !displayName || !adapter || !routePath) {
|
|
3758
3813
|
return [];
|
|
3759
3814
|
}
|
|
3760
|
-
const
|
|
3761
|
-
|
|
3762
|
-
DESKTOP_LLM_CAPABILITIES.map((name) => {
|
|
3763
|
-
const rawCapability = isRecord2(rawCapabilities[name]) ? rawCapabilities[name] : {};
|
|
3764
|
-
const source = rawCapability.source === "declared" || rawCapability.source === "verified" || rawCapability.source === "failed" || rawCapability.source === "unknown" ? rawCapability.source : "unknown";
|
|
3765
|
-
return [name, { enabled: rawCapability.enabled === true, source }];
|
|
3766
|
-
})
|
|
3815
|
+
const capabilities = normalizeDesktopLlmCapabilities(
|
|
3816
|
+
entry.capabilities
|
|
3767
3817
|
);
|
|
3768
3818
|
const rawProfile = isRecord2(entry.requestProfile) ? entry.requestProfile : {};
|
|
3769
|
-
const reasoningStyle = rawProfile.reasoningStyle === "default" || rawProfile.reasoningStyle === "deepseek" || rawProfile.reasoningStyle === "low-high" || rawProfile.reasoningStyle === "openrouter" || rawProfile.reasoningStyle === "thinking" || rawProfile.reasoningStyle === "enable-thinking" || rawProfile.reasoningStyle === "reasoning-split" ? rawProfile.reasoningStyle : "none";
|
|
3770
3819
|
const rawProbe = isRecord2(entry.lastProbeResult) ? entry.lastProbeResult : null;
|
|
3820
|
+
const reasoningStyle = rawProfile.reasoningStyle === "default" || rawProfile.reasoningStyle === "deepseek" || rawProfile.reasoningStyle === "low-high" || rawProfile.reasoningStyle === "openrouter" || rawProfile.reasoningStyle === "thinking" || rawProfile.reasoningStyle === "enable-thinking" || rawProfile.reasoningStyle === "reasoning-split" ? rawProfile.reasoningStyle : "none";
|
|
3771
3821
|
const rawReasoningEffort = isRecord2(entry.reasoningEffort) ? entry.reasoningEffort : {};
|
|
3772
3822
|
const reasoningEffortValues = Array.isArray(rawReasoningEffort.values) ? Array.from(
|
|
3773
3823
|
new Set(
|
|
@@ -3777,17 +3827,20 @@ function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
|
3777
3827
|
const reasoningEffortDefault = isDesktopLlmReasoningEffort(
|
|
3778
3828
|
rawReasoningEffort.defaultValue
|
|
3779
3829
|
) ? rawReasoningEffort.defaultValue : null;
|
|
3780
|
-
const
|
|
3781
|
-
|
|
3830
|
+
const hasSelectableReasoningEffortConfig = Boolean(
|
|
3831
|
+
rawReasoningEffort.mode === "selectable" && reasoningEffortValues.length > 0 && reasoningEffortDefault && reasoningEffortValues.includes(reasoningEffortDefault) && desktopLlmReasoningEffortsMatchStyle(
|
|
3782
3832
|
adapter,
|
|
3783
3833
|
reasoningStyle,
|
|
3784
3834
|
reasoningEffortValues
|
|
3785
3835
|
)
|
|
3786
3836
|
);
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3837
|
+
if (!hasSelectableReasoningEffortConfig) {
|
|
3838
|
+
capabilities.reasoningEfforts = createDesktopLlmCapability({
|
|
3839
|
+
state: "unsupported",
|
|
3840
|
+
source: capabilities.reasoningEfforts.nativeSupport.source,
|
|
3841
|
+
policy: capabilities.reasoningEfforts.userPolicy
|
|
3842
|
+
});
|
|
3843
|
+
}
|
|
3791
3844
|
const reasoningEffortSource = rawReasoningEffort.source === "provider" || rawReasoningEffort.source === "models.dev" || rawReasoningEffort.source === "user" ? rawReasoningEffort.source : "unknown";
|
|
3792
3845
|
const rawReasoningEffortFetchedAt = asString(
|
|
3793
3846
|
rawReasoningEffort.fetchedAt
|
|
@@ -3805,10 +3858,10 @@ function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
|
3805
3858
|
capabilities,
|
|
3806
3859
|
requestProfile: {
|
|
3807
3860
|
reasoningStyle,
|
|
3808
|
-
supportsReasoningEffort:
|
|
3861
|
+
supportsReasoningEffort: hasSelectableReasoningEffortConfig,
|
|
3809
3862
|
maxOutputTokensField: rawProfile.maxOutputTokensField === "max_completion_tokens" ? "max_completion_tokens" : "max_tokens"
|
|
3810
3863
|
},
|
|
3811
|
-
reasoningEffort:
|
|
3864
|
+
reasoningEffort: hasSelectableReasoningEffortConfig ? {
|
|
3812
3865
|
mode: "selectable",
|
|
3813
3866
|
values: reasoningEffortValues,
|
|
3814
3867
|
defaultValue: reasoningEffortDefault,
|
|
@@ -3830,7 +3883,7 @@ function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
|
3830
3883
|
} : null
|
|
3831
3884
|
}];
|
|
3832
3885
|
}) : [];
|
|
3833
|
-
const externalProfiles = value3.version === 3 && Array.isArray(value3.externalProfiles) ? value3.externalProfiles.flatMap((entry) => {
|
|
3886
|
+
const externalProfiles = (value3.version === 3 || value3.version === 4) && Array.isArray(value3.externalProfiles) ? value3.externalProfiles.flatMap((entry) => {
|
|
3834
3887
|
if (!isRecord2(entry)) return [];
|
|
3835
3888
|
const id2 = asString(entry.id);
|
|
3836
3889
|
const name = asString(entry.name);
|
|
@@ -3915,7 +3968,7 @@ function normalizeDesktopLlmRegistry(value3, profiles) {
|
|
|
3915
3968
|
})
|
|
3916
3969
|
).digest("hex");
|
|
3917
3970
|
return {
|
|
3918
|
-
version:
|
|
3971
|
+
version: 4,
|
|
3919
3972
|
revision,
|
|
3920
3973
|
providers,
|
|
3921
3974
|
routes,
|
|
@@ -23266,6 +23319,7 @@ var RPC_METHODS = {
|
|
|
23266
23319
|
desktopLlmLaunchExternalProfile: "desktopLlm.launchExternalProfile",
|
|
23267
23320
|
desktopLlmStopExternalProfile: "desktopLlm.stopExternalProfile",
|
|
23268
23321
|
desktopLlmLifecycle: "desktopLlm.lifecycle",
|
|
23322
|
+
desktopLlmRuntimeControl: "desktopLlm.runtimeControl",
|
|
23269
23323
|
cliInfo: "cli.info",
|
|
23270
23324
|
cliStatus: "cli.status",
|
|
23271
23325
|
cliCheckFreshness: "cli.checkFreshness",
|
|
@@ -23732,6 +23786,15 @@ var DesktopRpcRequestBody = Schema_exports.Union([
|
|
|
23732
23786
|
])
|
|
23733
23787
|
})
|
|
23734
23788
|
),
|
|
23789
|
+
tagRequestBody(
|
|
23790
|
+
RPC_METHODS.desktopLlmRuntimeControl,
|
|
23791
|
+
Schema_exports.Struct({
|
|
23792
|
+
action: Schema_exports.Union([
|
|
23793
|
+
Schema_exports.Literal("drain"),
|
|
23794
|
+
Schema_exports.Literal("resume")
|
|
23795
|
+
])
|
|
23796
|
+
})
|
|
23797
|
+
),
|
|
23735
23798
|
tagRequestBody(RPC_METHODS.cliInfo, Schema_exports.Struct({})),
|
|
23736
23799
|
tagRequestBody(RPC_METHODS.cliStatus, Schema_exports.Struct({})),
|
|
23737
23800
|
tagRequestBody(RPC_METHODS.cliCheckFreshness, Schema_exports.Struct({})),
|
|
@@ -45397,7 +45460,7 @@ async function ensureCliStorageReady() {
|
|
|
45397
45460
|
}
|
|
45398
45461
|
|
|
45399
45462
|
// src/app/main.ts
|
|
45400
|
-
var VERSION = true ? "6.0.
|
|
45463
|
+
var VERSION = true ? "6.0.5" : "0.0.0";
|
|
45401
45464
|
async function runCli() {
|
|
45402
45465
|
const args2 = process.argv.slice(2);
|
|
45403
45466
|
if (args2.length === 0) {
|