mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 15:33:45 +00:00
✅ feat: Default Machine Selection and Linked-Worktree Lanes On (#16678)
* ✅ 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>
This commit is contained in:
parent
2d35614a0c
commit
1a8d23e1ed
16 changed files with 218 additions and 71 deletions
33
packages/api/src/code/protocol.ts
Normal file
33
packages/api/src/code/protocol.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue