mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-16 13:00:55 +00:00
* ✅ feat: Default Machine Selection and Linked-Worktree Lanes On
Per-chat machine choice from an agent's saved allowlist and linked-worktree
lane routing were both opt-in, so neither worked until a deployment found and
set its flag. Both are now on unless set to false: machine choice still only
applies to agents with a saved allowlist, and lanes still require a worker
that advertises git_linked_worktree. One helper per flag in data-provider
decides the default for every server reader and the advertised client config.
* feat: Advertise the Code Environment Decision Protocol by Default
Per-chat machine choice needs the conversation decision protocol, which the
client requires before offering allowlisted machines, but the protocol was
only advertised when CODE_ENVIRONMENT_DECISION_VERSION=1. With selection on
by default, authors could save an allowlist the composer never offered.
An unset or blank value now advertises protocol v1; any other value, such as
0, keeps the legacy-safe path.
* fix: Turn Machine Choice Off With the Decision Protocol Opt-Out
CODE_ENVIRONMENT_DECISION_VERSION=0 stopped advertising the protocol but
routing still accepted a non-default machine, so a cached tab or a direct
client could persist a choice during a mixed-version rollout. Machine choice
is recorded through that protocol, so isCodeEnvironmentSelectionEnabled now
requires both, for routing and for the advertised endpoints config. The
protocol resolver moves to code/protocol.ts (re-exported from code/config)
so execution and endpoints can use it without an import cycle.
* style: Format checkout routing regression cases
---------
Co-authored-by: Lia <lia@librechat.ai>
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import {
|
|
CODE_ENVIRONMENT_DECISION_VERSION,
|
|
isCodeEnvironmentSelectionAllowed,
|
|
} from 'librechat-data-provider';
|
|
|
|
/**
|
|
* Resolves the deployment-wide browser protocol gate. Unset or blank advertises the supported
|
|
* version, so per-chat machine choice works without a second opt-in. Any other value than the
|
|
* exact version — `0` to opt out, or an older or future wire shape — keeps the legacy-safe path.
|
|
*/
|
|
export function resolveCodeEnvironmentDecisionVersion(
|
|
configuredVersion?: string,
|
|
): typeof CODE_ENVIRONMENT_DECISION_VERSION | undefined {
|
|
const version = configuredVersion?.trim() ?? '';
|
|
return version === '' || version === String(CODE_ENVIRONMENT_DECISION_VERSION)
|
|
? CODE_ENVIRONMENT_DECISION_VERSION
|
|
: undefined;
|
|
}
|
|
|
|
/**
|
|
* Per-chat machine choice is recorded through the decision protocol, so a deployment that turns
|
|
* the protocol off (`CODE_ENVIRONMENT_DECISION_VERSION=0`) turns machine choice off as well, for
|
|
* both what the server advertises and what it routes.
|
|
*/
|
|
export function isCodeEnvironmentSelectionEnabled(
|
|
allowEnvironmentSelection?: boolean | null,
|
|
configuredDecisionVersion: string | undefined = process.env.CODE_ENVIRONMENT_DECISION_VERSION,
|
|
): boolean {
|
|
return (
|
|
isCodeEnvironmentSelectionAllowed(allowEnvironmentSelection) &&
|
|
resolveCodeEnvironmentDecisionVersion(configuredDecisionVersion) != null
|
|
);
|
|
}
|