Skip to content

Commit 01168ad

Browse files
author
ben
authored
chore(features): fold and retire Workbot, headless and other rollout switches (#6261)
Signed-off-by: Benjamin Shafii <ben@prologe.io>
1 parent 3963ed9 commit 01168ad

162 files changed

Lines changed: 23121 additions & 31209 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/app/src/components/chat/credential-prompt-card.tsx‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import { gatewayCredentialBody, promptFields, promptFieldsProblem } from "./cred
1414
import { Button, buttonVariants } from "@/components/ui/button"
1515
import { DenReauthNotice } from "@/react-app/domains/cloud/den-reauth-notice"
1616
import { useDenAuth } from "@/react-app/domains/cloud/den-auth-provider"
17-
import { useOrgFeatureState } from "@/react-app/domains/cloud/use-org-feature"
1817
import { useOptionalMessageList } from "./message-list-provider"
1918
import { credentialPromptFromToolPart } from "./credential-prompt"
2019

@@ -88,7 +87,6 @@ export function CredentialPromptCard({ part, continueToolCallId = part.toolCallI
8887
const signedIn = auth.isSignedIn && Boolean(token && organizationId)
8988
const key = prompt ? targetKey(prompt) : ""
9089
const local = useSyncExternalStore(subscribe, () => savedHere.has(key), () => false)
91-
const enabled = useOrgFeatureState("secureSecretFields", { active: signedIn })
9290
// Den's own answer, so a reopened conversation shows what is true now.
9391
const stored = useQuery({
9492
queryKey: ["den", "credential-prompt", organizationId, key],
@@ -111,10 +109,8 @@ export function CredentialPromptCard({ part, continueToolCallId = part.toolCallI
111109
const readOnly = messageList?.readOnly === true
112110
const saved = local || stored.data === true
113111
const dashboardUrl = denDashboardUrl(settings.baseUrl, prompt)
114-
// The field, and its show control, appear only once the rollout is confirmed on.
115-
const confirmed = enabled.data === true
116-
const blocked = !signedIn ? "signed_out" : readOnly ? "read_only" : enabled.data === false ? "off" : enabled.isError ? "unverified" : phase === "denied" ? "denied" : phase === "gone" ? "gone" : null
117-
const showField = confirmed && !blocked && phase !== "reauth" && (!saved || replacing)
112+
const blocked = !signedIn ? "signed_out" : readOnly ? "read_only" : phase === "denied" ? "denied" : phase === "gone" ? "gone" : null
113+
const showField = !blocked && phase !== "reauth" && (!saved || replacing)
118114

119115
const specs = promptFields(prompt.target)
120116
const clearAll = () => {
@@ -186,10 +182,8 @@ export function CredentialPromptCard({ part, continueToolCallId = part.toolCallI
186182
: `Add the ${what} for ${name}`
187183
const blockedLine = blocked === "read_only" ? "This conversation is read-only."
188184
: blocked === "signed_out" ? "Sign in to OpenWork Cloud to add this key here."
189-
: blocked === "off" ? "Adding keys in chat is off for your organization. Use OpenWork Cloud instead."
190185
: blocked === "denied" ? "You can't change this key. Ask an organization admin."
191186
: blocked === "gone" ? "Ask the agent to set it up again."
192-
: blocked === "unverified" ? "OpenWork couldn't check whether keys can be added here. Use OpenWork Cloud instead."
193187
: null
194188
// One state line: who uses the key and where it goes (P9).
195189
const consent = `Shared with people who can use ${name}${prompt.destination ? ` · sent only to ${prompt.destination}` : ""} · never shown to the agent`
@@ -237,7 +231,7 @@ export function CredentialPromptCard({ part, continueToolCallId = part.toolCallI
237231
onChange={(event) => track(spec.id, event.currentTarget.value.length > 0)} />
238232
</Field>
239233
) : (
240-
<SecretField key={spec.id} id={`${fieldId}-${spec.id}`} label={spec.label} revealable={confirmed} multiline={spec.kind === "json"}
234+
<SecretField key={spec.id} id={`${fieldId}-${spec.id}`} label={spec.label} multiline={spec.kind === "json"}
241235
disabled={phase === "saving"} onSubmit={() => void save()}
242236
handleRef={(handle) => { if (handle) fields.current.set(spec.id, handle); else fields.current.delete(spec.id) }}
243237
onValueChange={(has) => track(spec.id, has)} />
@@ -248,7 +242,7 @@ export function CredentialPromptCard({ part, continueToolCallId = part.toolCallI
248242
<div className="flex items-start gap-2">
249243
{specs.length === 1 && specs[0]?.kind === "secret" ? (
250244
<div className="min-w-0 flex-1">
251-
<SecretField id={fieldId} label="API key" labelHidden revealable={confirmed} error={error} disabled={phase === "saving"}
245+
<SecretField id={fieldId} label="API key" labelHidden error={error} disabled={phase === "saving"}
252246
handleRef={(handle) => { if (handle) fields.current.set("apiKey", handle); else fields.current.delete("apiKey") }}
253247
onSubmit={() => void save()} onValueChange={(has) => track("apiKey", has)} />
254248
</div>

‎apps/app/src/components/secret-field.tsx‎

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client"
22

3-
import { createContext, use, useEffect, useImperativeHandle, useRef, useState, type ReactNode, type Ref } from "react"
3+
import { useEffect, useImperativeHandle, useRef, useState, type Ref } from "react"
44
import { Eye, EyeOff } from "lucide-react"
55
import { SECRET_INPUT_ATTRIBUTES, SECRET_REGION_ATTRIBUTES, useMultilineSecretSupported, useSecretReveal } from "@openwork/ui/secret-input"
66
import { Field, FieldDescription, FieldError, FieldLabel } from "@/components/ui/field"
@@ -14,16 +14,6 @@ export type SecretFieldHandle = {
1414
focus: () => void
1515
}
1616

17-
/**
18-
* Whether secret fields offer "Show while typing". Off unless the signed-in
19-
* organization has secureSecretFields, so turning the rollout off restores
20-
* plain masked inputs everywhere.
21-
*/
22-
const SecretRevealContext = createContext(false)
23-
export function SecretRevealProvider({ enabled, children }: { enabled: boolean; children: ReactNode }) {
24-
return <SecretRevealContext value={enabled}>{children}</SecretRevealContext>
25-
}
26-
2717
/**
2818
* A private, host-owned input for one secret. The value never enters React
2919
* state, props, telemetry or the transcript: the parent takes it once to send
@@ -33,7 +23,7 @@ export function SecretRevealProvider({ enabled, children }: { enabled: boolean;
3323
* `multiline` is for pasted JSON keys (service accounts): the text stays
3424
* masked the same way until revealed.
3525
*/
36-
export function SecretField({ id, label, labelHidden = false, labelClassName, description, error, disabled, onSubmit, onValueChange, handleRef, autoFocus = false, multiline: multilineRequested = false, placeholder, revealable, testId, className }: {
26+
export function SecretField({ id, label, labelHidden = false, labelClassName, description, error, disabled, onSubmit, onValueChange, handleRef, autoFocus = false, multiline: multilineRequested = false, placeholder, testId, className }: {
3727
id: string
3828
label: string
3929
/** The surrounding title already names the secret; keep the label for assistive tech only. */
@@ -50,14 +40,11 @@ export function SecretField({ id, label, labelHidden = false, labelClassName, de
5040
autoFocus?: boolean
5141
multiline?: boolean
5242
placeholder?: string
53-
/** Overrides the rollout context, e.g. for surfaces already gated on it. */
54-
revealable?: boolean
5543
/** `data-testid` on the input itself, for journey specs. */
5644
testId?: string
5745
/** Extra classes for the input box, to match the surrounding screen's fields. */
5846
className?: string
5947
}) {
60-
const canReveal = revealable ?? use(SecretRevealContext)
6148
// Only where the browser can mask a textarea; otherwise a password input.
6249
const multiline = useMultilineSecretSupported() && multilineRequested
6350
const input = useRef<HTMLInputElement>(null)
@@ -106,7 +93,7 @@ export function SecretField({ id, label, labelHidden = false, labelClassName, de
10693
...SECRET_INPUT_ATTRIBUTES,
10794
}
10895
const reveal = multiline ? areaReveal : inputReveal
109-
const toggle = !canReveal ? null : (
96+
const toggle = (
11097
<InputGroupButton size="icon-xs" aria-controls={id} {...reveal.toggleProps}>
11198
{reveal.revealed ? <EyeOff aria-hidden="true" strokeWidth={1.5} /> : <Eye aria-hidden="true" strokeWidth={1.5} />}
11299
</InputGroupButton>
@@ -132,7 +119,7 @@ export function SecretField({ id, label, labelHidden = false, labelClassName, de
132119
if (event.key === "Enter" && (event.metaKey || event.ctrlKey) && onSubmit) { event.preventDefault(); onSubmit() }
133120
}}
134121
/>
135-
{toggle ? <InputGroupAddon align="block-end" className="justify-end">{toggle}</InputGroupAddon> : null}
122+
<InputGroupAddon align="block-end" className="justify-end">{toggle}</InputGroupAddon>
136123
</>
137124
) : (
138125
<>
@@ -148,7 +135,7 @@ export function SecretField({ id, label, labelHidden = false, labelClassName, de
148135
if (event.key === "Enter" && onSubmit) { event.preventDefault(); onSubmit() }
149136
}}
150137
/>
151-
{toggle ? <InputGroupAddon align="inline-end">{toggle}</InputGroupAddon> : null}
138+
<InputGroupAddon align="inline-end">{toggle}</InputGroupAddon>
152139
</>
153140
)}
154141
</InputGroup>

‎apps/app/src/i18n/locales/en.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ export default {
693693
"engine_migration.trimmed_other": "{trimmed} chats were copied without their largest attachments or outputs; the full versions stay in OpenCode v1.",
694694
"engine_migration.try_again": "Try again",
695695
"engine_migration.upgrade": "Upgrade",
696-
"engine_migration.upgrade_later": "Later",
697-
"engine_migration.upgrade_notice": "A chat upgrade is available in OpenWork.",
698696
"engine_migration.upgrade_consent_title": "Upgrade chats?",
699697
"engine_migration.upgrade_consent_body": "Copies your full chat history to OpenCode v2 on this computer, backing up its existing chats first, then switches OpenWork to v2. Your v1 chats and newer v2 messages are kept. Large chats are copied without removing content.",
700698
"engine_migration.upgraded_title": "Upgraded to OpenCode v2",

‎apps/app/src/i18n/locales/zh.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ export default {
138138
"den.sync_provider_failed": "同步{name}失败。",
139139
"engine_migration.progress_note": "在完成前,OpenWork 可能会变慢或不稳定。你的 v1 聊天记录保持不变。",
140140
"engine_migration.upgrade": "升级",
141-
"engine_migration.upgrade_later": "稍后",
142-
"engine_migration.upgrade_notice": "OpenWork 可升级聊天记录。",
143141
"engine_migration.upgrade_consent_title": "升级聊天记录?",
144142
"engine_migration.upgrade_consent_body": "先备份此电脑上已有的 OpenCode v2 聊天记录,再将你的聊天记录复制到 v2,最后将 OpenWork 切换到 v2。你的 v1 聊天记录保持不变。在完成前,OpenWork 可能会变慢。",
145143
"engine_migration.upgraded_title": "已升级到 OpenCode v2",

‎apps/app/src/react-app/domains/cloud/secret-reveal-feature-provider.tsx‎

Lines changed: 0 additions & 14 deletions
This file was deleted.

‎apps/app/src/react-app/shell/engine-migration.tsx‎

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ import { Progress } from "@/components/ui/progress";
2727
import { toast } from "@/components/ui/sonner";
2828
import { t } from "@/i18n";
2929
import { cn } from "@/lib/utils";
30-
import { resolveExtensionIconSrc } from "@/react-app/design-system/extension-icon-src";
31-
import { useOrgFeature, useOrgFeatureState } from "@/react-app/domains/cloud/use-org-feature";
30+
import { useOrgFeatureState } from "@/react-app/domains/cloud/use-org-feature";
3231
import { resolveOpenworkConnection } from "./openwork-connection";
3332

3433
/**
@@ -215,8 +214,8 @@ export async function confirmEngineMigration() {
215214
try {
216215
const status = await consent.client.migrateOpencodeHistory({ allowActiveSessions: consent.runningTasks > 0 });
217216
useEngineMigrationStore.setState({ consent: null });
218-
// Only the flag-gated invitation uses upgrade mode. Manual migrations and
219-
// reload discovery retain their dialog and explicit engine-switch decision.
217+
// Upgrade mode comes from a switch to v2 that first needs chats copied. Manual
218+
// migrations and reload discovery retain their dialog and explicit engine-switch decision.
220219
presentMigration(consent.client, status, consent.mode === "upgrade" ? "banner" : "dialog", consent.mode === "upgrade");
221220
} catch (cause) {
222221
const running = refusedForRunningTasks(cause);
@@ -715,36 +714,8 @@ function useRunningMigrationDiscovery(enabled: boolean) {
715714
}, [enabled]);
716715
}
717716

718-
const UPGRADE_SNOOZE_KEY = "openwork.engineUpgrade.snoozedUntil";
719-
const UPGRADE_SNOOZE_MS = 3 * 24 * 60 * 60_000;
720-
721-
function readUpgradeSnooze(): number {
722-
try {
723-
const value = Number(window.localStorage.getItem(UPGRADE_SNOOZE_KEY));
724-
return Number.isFinite(value) ? value : 0;
725-
} catch {
726-
return 0;
727-
}
728-
}
729-
730-
function snoozeUpgrade(now = Date.now()) {
731-
try { window.localStorage.setItem(UPGRADE_SNOOZE_KEY, String(now + UPGRADE_SNOOZE_MS)); } catch { /* best effort */ }
732-
}
733-
734-
/** Offer the upgrade only to people still chatting on v1 who have v1 chats to bring along. */
735-
export function shouldOfferEngineUpgrade(
736-
status: Pick<EngineV2PreviewStatus, "enabled" | "chatRouting" | "v1HistoryAvailable" | "migration">,
737-
options: { now: number; snoozedUntil: number },
738-
): boolean {
739-
return selectedChatEngine(status) === "v1"
740-
&& status.v1HistoryAvailable === true
741-
&& status.migration?.state !== "running"
742-
&& options.snoozedUntil <= options.now;
743-
}
744-
745717
type EngineUpgradeFeatures = {
746718
ready: boolean;
747-
offer: boolean;
748719
upgrade: boolean;
749720
};
750721

@@ -812,68 +783,6 @@ function useDesktopEngineForcePolicy(features: EngineUpgradeFeatures) {
812783
}, [ready, upgrade]);
813784
}
814785

815-
type UpgradeCandidate = { client: EngineMigrationClient; status: EngineV2PreviewStatus };
816-
817-
/** Discovers engine status through startup, and again whenever the engine changes. */
818-
function useEngineUpgradeCandidate(enabled: boolean): UpgradeCandidate | null {
819-
const [candidate, setCandidate] = useState<UpgradeCandidate | null>(null);
820-
useEffect(() => {
821-
if (!enabled) {
822-
setCandidate(null);
823-
return;
824-
}
825-
let cancelled = false;
826-
let timer: number | undefined;
827-
const load = async (remaining: number) => {
828-
try {
829-
const connection = await resolveOpenworkConnection();
830-
if (cancelled) return;
831-
if (!connection.normalizedBaseUrl || !connection.resolvedToken) throw new Error("Local host is not ready");
832-
const client = createOpenworkServerClient({
833-
baseUrl: connection.normalizedBaseUrl,
834-
token: connection.resolvedToken,
835-
hostToken: connection.resolvedHostToken,
836-
});
837-
const status = await client.getEngineV2PreviewStatus();
838-
if (!cancelled) setCandidate({ client, status });
839-
return;
840-
} catch {
841-
// The organization can resolve before the local host starts. Keep the
842-
// optional offer discoverable without asking the person to reload.
843-
}
844-
if (!cancelled && remaining > 1) timer = window.setTimeout(() => void load(remaining - 1), DISCOVERY_RETRY_MS);
845-
};
846-
const reload = () => { window.clearTimeout(timer); void load(DISCOVERY_ATTEMPTS); };
847-
reload();
848-
window.addEventListener("openwork-engine-changed", reload);
849-
return () => { cancelled = true; window.clearTimeout(timer); window.removeEventListener("openwork-engine-changed", reload); };
850-
}, [enabled]);
851-
return candidate;
852-
}
853-
854-
function EngineUpgradeNotice(props: { candidate: UpgradeCandidate; onLater: () => void }) {
855-
return (
856-
<MigrationFloatingRegion>
857-
<div
858-
role="status"
859-
data-testid="engine-upgrade-notice"
860-
className="pointer-events-auto flex max-w-xl items-center gap-3 rounded-2xl bg-popover px-4 py-3 text-popover-foreground shadow-[var(--dls-card-shadow)] ring-1 ring-foreground/5"
861-
>
862-
<img src={resolveExtensionIconSrc("/openwork-mark.svg")} alt="" className="size-4 shrink-0 opacity-80 dark:invert" />
863-
<p className="min-w-0 flex-1 text-sm">{t("engine_migration.upgrade_notice")}</p>
864-
<div className="flex shrink-0 items-center gap-2">
865-
<Button type="button" size="xs" variant="ghost" onClick={props.onLater}>
866-
{t("engine_migration.upgrade_later")}
867-
</Button>
868-
<Button type="button" size="xs" onClick={() => requestEngineMigration(props.candidate.client, "upgrade")}>
869-
{t("engine_migration.upgrade")}
870-
</Button>
871-
</div>
872-
</div>
873-
</MigrationFloatingRegion>
874-
);
875-
}
876-
877786
export function EngineMigrationOverlay(props: { discoverRunningMigration?: boolean }) {
878787
const desktop = isDesktopRuntime();
879788
const consent = useEngineMigrationStore((state) => state.consent);
@@ -883,26 +792,14 @@ export function EngineMigrationOverlay(props: { discoverRunningMigration?: boole
883792
const forceUpgrade = useOrgFeatureState("engineV2ForceUpgrade", { desktopOnly: true });
884793
const features = {
885794
ready: forceUpgrade.resolved,
886-
offer: useOrgFeature("engineV2Upgrade", { desktopOnly: true }),
887795
upgrade: forceUpgrade.enabled,
888796
};
889797
useDesktopEngineForcePolicy(features);
890798
useRunningMigrationDiscovery(desktop && props.discoverRunningMigration !== false);
891-
const candidate = useEngineUpgradeCandidate(features.offer && !features.upgrade);
892-
const [snoozedUntil, setSnoozedUntil] = useState(readUpgradeSnooze);
893799
// Local-engine consent and progress never apply to the web runtime, even if the store is populated.
894800
if (!desktop) return null;
895-
const offerUpgrade = features.offer && !features.upgrade
896-
&& candidate !== null && !consent && !progress && !switchPrompt
897-
&& shouldOfferEngineUpgrade(candidate.status, { now: Date.now(), snoozedUntil });
898801
return (
899802
<>
900-
{offerUpgrade ? (
901-
<EngineUpgradeNotice
902-
candidate={candidate}
903-
onLater={() => { snoozeUpgrade(); setSnoozedUntil(readUpgradeSnooze()); }}
904-
/>
905-
) : null}
906803
{consent && !(consent.mode === "upgrade" && features.upgrade)
907804
? <MigrationConsentDialog consent={consent} /> : null}
908805
{progress?.view === "dialog" ? <MigrationProgressDialog progress={progress} /> : null}

‎apps/app/src/react-app/shell/providers.tsx‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { hydrateOpenworkServerSettingsFromEnv } from "@/app/lib/openwork-server"
88
import { isDesktopRuntime } from "@/app/utils";
99
import { ConnectLinkProvider } from "@/react-app/domains/cloud/connect-link-provider";
1010
import { DenAuthProvider } from "@/react-app/domains/cloud/den-auth-provider";
11-
import { SecretRevealFeatureProvider } from "@/react-app/domains/cloud/secret-reveal-feature-provider";
1211
import { AutoRejectedTurnRecoveryBridge } from "@/react-app/domains/cloud/auto-access-ui";
1312
import { AutomationRunnerBridge } from "@/react-app/domains/automations/automation-runner-bridge";
1413
import { GlobalQueueDrainerBridge } from "@/react-app/domains/session/sync/global-queue-drainer-bridge";
@@ -104,9 +103,7 @@ export function AppProviders({ children }: AppProvidersProps) {
104103
<ServerProvider defaultUrl={defaultUrl}>
105104
<ArchitectureMismatchGate>
106105
<DenAuthProvider>
107-
<SecretRevealFeatureProvider>
108-
<EnterpriseAwareAppProviders>{children}</EnterpriseAwareAppProviders>
109-
</SecretRevealFeatureProvider>
106+
<EnterpriseAwareAppProviders>{children}</EnterpriseAwareAppProviders>
110107
</DenAuthProvider>
111108
</ArchitectureMismatchGate>
112109
</ServerProvider>

0 commit comments

Comments
 (0)