mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-28 20:21:50 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - Connections give agents access to external services. > - AgentMail needs both a saved key and an inbox assigned to the agent. > - Chat requests offered a setup link instead of an inline card and could treat a saved key as complete. > - Inbox setup also hid address conflicts behind a generic server error and a separate review step. > - This pull request makes AgentMail a default connection, adds the inline card, reduces setup to two steps, and shows conflicts beside the address. > - Shared native dropdown styles also give every caret a consistent inset. ## Linked Issues or Issue Description **What happened?** AgentMail requests in chat did not show a usable inline connection card. Manual setup required extra screens, ignored saved account keys, and could trap new-address setup in a locked inbox dropdown. Agent selectors omitted the avatar from the selected value. A taken address could produce an HTTP 403 from AgentMail and appear as an internal server error. Native dropdown arrows also touched the right edge of their fields. **Expected behavior** Make AgentMail available as a default connection. Ask for the API key inline, with a direct link to its provider page. Default human access to the company and agent access to the requesting agent. Resume the agent only after an assigned inbox is active. Manual setup should ask for an agent and email address, then finish. Address checks should run as the user types. Taken addresses should show clickable alternatives. A domain dropdown beside the name should prefer a verified custom domain. Setup should suggest authorized saved AgentMail keys and show agent avatars in the picker and selected value. **Steps to reproduce** 1. Ask an agent to connect AgentMail when it has no assigned inbox. 2. Check that an inline API-key card appears and links to the provider's API-key page. 3. Open AgentMail setup, choose an agent, and request an address that is already taken. 4. Correct the inline error, refresh, and finish setup with the same request ID. 5. Inspect native dropdown carets in light, dark, disabled, and right-to-left states. Uses the bounded provider-error parser merged in #14768. Related work: #13256 introduced AgentMail; #14725 expanded connection search. ## What Changed - Stop recurring email queries for tasks that have no email thread. Share the query between the thread provider and activity view. Keep email-task updates and invalidation-based discovery. - Make AgentMail available without the experimental chat setting. Keep the catalog, setup and management routes, agent Channels tab, task email feed, receiving worker, and agent tools available by default. Other experimental chat providers stay gated. - Make the email address and copy icon a single clickable action with the shared Copied! confirmation. Add View inbox linking directly to the matching AgentMail console inbox, with the address encoded as one URL path segment. - Reorganize inbox Settings around the copyable email address, usage instructions, and receiving status. Move reconnect credentials into a disclosure and separate the Disconnect action. Add production Settings stories for active, paused, unassigned-address, revoked, webhook, long-address, mobile, and reconnect states. Show repair controls when the inbox has an error. Keep usage instructions tied to an active inbox with an address. - Add AgentMail channel intents and an inline key field with the direct API-key URL. - Keep setup and retry state tied to the interaction. Require an active inbox for completion. Preserve company and agent access checks. - Reduce manual setup to agent selection and email selection. Put the domain dropdown beside the address and default to a verified custom domain. Preserve explicit choices across reloads. Keep receiving settings under Advanced options. - Check the initial address and edits after a 350 ms pause. Abort superseded requests and ignore stale responses. Show clickable suggestions and retain known creation conflicts across reloads. - Add a company-scoped, manager-only address check using the saved credential. Search the visible inbox list instead of fetching an uncreated inbox: live AgentMail retains negative lookups that can break subsequent access-key creation. Unlisted addresses remain unknown; creation is authoritative. - Suggest labeled saved AgentMail keys in both manual setup and the inline card. Filter by company, provider, active credential, and current-user grants on the server. Prefer an account key and preserve the selected key or an explicit new-key choice across refresh. Use verified scope metadata and bounded concurrent checks for legacy keys. Never return secret values. - Catch an inbox-only key before the email step. Allow its existing inbox only after an explicit choice. Recover old locked drafts at the key picker. Save the replacement key before retiring an empty draft, then use a new setup URL so refresh preserves the switched account; stop if cleanup fails. Preserve already allocated addresses and their original accounts. - Use the shared AgentSelect in email setup. Show the canonical agent avatar in each option and the selected value, including other consumers of the shared component. Add regression coverage for legacy and current Lucide agent-mention icon formats. - Start each catalog Add connection with a fresh setup identity. Honor Finish setup's exact draft/account/address instead of resuming an unrelated browser draft. Return Cancel and Done to Connectors and Email settings to the inbox. Group the task/thread explanation in a How it Works card. - Route AgentMail catalog removal through the email inbox control API, including unfinished drafts. Refresh both the catalog and inbox views. - Render each inbox management tab separately. Access uses the saved account grants and agent controls; Conversations and Activity use the shared persisted email feed. Activity lifecycle actions use the email API. Reconnect returns to inbox Settings. Conversation failures show a retry instead of a false empty state. Email delivery recovery stays in the task. - Map documented provider address conflicts to a field error. Preserve actionable messages for other failures. - Preserve non-secret draft fields across refresh, scoped to the requested agent. Never save API keys in browser storage. Resume partial inbox creation with the original agent, address, and request ID. - Show an already-created address with explicit retry and new-address recovery instead of locked inputs. Preserve the original inbox and resumable draft when choosing another address. Distinguish runtime-key 404 errors and log safe provider status/operation/code. - Apply final agent access once within email setup authorization for a new account whose original installs are unchanged. Preserve later permission edits and reused account installs. Support in-place retry of progress loading. - Let a failed inline setup change keys after retiring an empty draft. Persist its replacement setup identity without storing secrets. Recover a server-saved account when refresh interrupts the save response, while preserving intentional account changes. - Render the production setup in Storybook and add error, recovery, and mobile states. - Inset native select carets in shared CSS. Preserve custom icons, listboxes, keyboard behavior, and forced-color controls. - Add browser regression coverage and an AgentMail Product E2E case with persisted-state and rendered-card evidence. ## Verification - Full `pnpm -r typecheck`, `pnpm build`, `pnpm check:token-gates`, and `git diff --check` passed after the default-availability change. - All 485 focused tests passed. These cover setup, management, catalog and route gates, connection intents, email authorization, Cursor execution, and the OpenAPI contract. All 39 email integration tests run with the experimental chat setting off. - The shared polling change passed four behavioral tests, UI typecheck and build, and token gates. - `tests/e2e/agentmail.spec.ts` passed with the actual server setting off. This full-stack browser test uses simulated provider responses. It covers catalog entry, saved keys, editable address and domain controls, creation, conflicts, retry, all management tabs, clipboard feedback, the provider link, and task email rendering. - In the live local browser, Add connection reached the editable email step with the saved account key. The verified custom domain was selected by default. Both domain choices worked. The existing inbox Settings page remained available. Both active inboxes completed new mail checks with the setting off. No new provider inbox or email message was created for this pass. - Earlier live provider acceptance covered creation on a verified custom domain, Finish connecting on the reported draft, successful mail checks after refresh, and catalog removal of disposable draft and active connections. Clicking the email address copied the exact address and showed Copied!. View inbox opened the same inbox in AgentMail’s console. No email messages were sent. - Production setup and Settings Storybook builds and interactions passed. Settings states include active, paused, unassigned, revoked, webhook, long-address, mobile, and reconnect. Receiving and revoked-access stories had zero accessibility violations. - Full local `pnpm test:run` on an earlier revision completed with 14,709 passing, 87 skipped, and four transient failures. All four failed cases passed in focused reruns without product changes. That serial full local command was not repeated after each follow-up. The latest-head full CI suite is the final test gate. - CI found an obsolete browser assertion that hid every channel when the flag was off. Updated it to keep AgentMail and the Channels surface visible while preserving the GitHub chat route gates. All 11 provider browser tests passed locally after scoping the Channels selector to the agent sidebar. Two initial local attempts stopped at temporary Postgres initialization. The passing run used a separate disposable database on the existing local Postgres server; it was removed after the test. - Updated the remaining sidebar and aggregator discovery assertions for default AgentMail availability. Ordinary task fixtures now return no email thread. All 128 sidebar/task-page tests and all 42 aggregator tests passed locally. - Latest head `b42bb4cd5cc9f2d01a99ab8026832d5a956ea85f`: full CI passed, with 54 successful checks including Snyk and two intentional Storybook skips. The CI run is https://github.com/paperclipai/paperclip/actions/runs/37020833647. A fresh Greptile review scored 5/5 with no unresolved threads. Live model evaluations and inbound/outbound email delivery were not run. ## Risks - AgentMail no longer needs experimental opt-in. Setup still requires a human to connect an account and assign an inbox. Inline setup creates an inbox after a human submits a new or saved key. Company access, agent access, inbox assignment, and completion checks remain enforced. - AgentMail read APIs cannot prove global address availability. The visible-list check is bounded to 100 entries and cannot see inboxes outside the key’s scope. The UI reports this limitation, suggests alternatives without claiming they are free, and keeps final creation conflicts inline. Lookup outages show an error without preventing the authoritative creation attempt. - Native select CSS affects the whole app. Custom-icon selects and multi-row lists are excluded. Forced-color mode keeps the browser caret. - Saved-key discovery uses stored verified scope metadata and checks authorized legacy credentials concurrently within a shared three-second deadline. Provider outages mark legacy choices unavailable; users can still enter another key. Final use rechecks authorization and provider access. - No database migration or transport default change. Live connection remains the default. ## Model Used OpenAI Codex, GPT-6, with reasoning, tool use, and code execution. The exact served model ID and context-window size are not exposed in this session. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass (focused suites; full-suite limitation documented above) - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green (latest head `b42bb4cd5cc9f2d01a99ab8026832d5a956ea85f`) - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups (latest head `b42bb4cd5cc9f2d01a99ab8026832d5a956ea85f`) - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
371 lines
14 KiB
TypeScript
371 lines
14 KiB
TypeScript
import { z } from "zod";
|
|
import { instanceExperimentalSettingsSchema } from "./validators/instance.js";
|
|
|
|
/**
|
|
* Feature catalog for cloud-managed instances.
|
|
*
|
|
* The instance-settings zod schema is the feature manifest; this module adds
|
|
* only metadata about the flags the schema already declares. Keys are derived
|
|
* from the schema type, so adding, removing, or renaming a boolean flag in
|
|
* `instanceExperimentalSettingsSchema` without updating the metadata map is a
|
|
* compile error (and vice versa).
|
|
*
|
|
* Tiers:
|
|
* - `preference`: tenant-controllable taste setting; the cloud harness does
|
|
* not manage it.
|
|
* - `managed`: the cloud harness may set this per fleet/stack via
|
|
* `PAPERCLIP_MANAGED_CONFIG`.
|
|
* - `floor`: pinned by code on managed instances; no flag value may widen it.
|
|
*/
|
|
export const FEATURE_TIERS = ["preference", "managed", "floor"] as const;
|
|
|
|
export type FeatureTier = (typeof FEATURE_TIERS)[number];
|
|
|
|
type ExperimentalSettings = z.infer<typeof instanceExperimentalSettingsSchema>;
|
|
|
|
/**
|
|
* The boolean flag keys of the experimental settings schema. Non-flag keys
|
|
* (activation timestamps, numeric tuning values) are excluded.
|
|
*/
|
|
export type InstanceFeatureKey = {
|
|
[K in keyof ExperimentalSettings]: ExperimentalSettings[K] extends boolean ? K : never;
|
|
}[keyof ExperimentalSettings];
|
|
|
|
export interface FeatureCatalogEntry {
|
|
title: string;
|
|
description: string;
|
|
tier: FeatureTier;
|
|
/** Desired default on cloud-managed instances. */
|
|
cloudDefault: boolean;
|
|
/** Must match the schema default; enforced by test. */
|
|
selfHostedDefault: boolean;
|
|
}
|
|
|
|
export const INSTANCE_FEATURE_CATALOG: Record<InstanceFeatureKey, FeatureCatalogEntry> = {
|
|
enableEnvironments: {
|
|
title: "Environments",
|
|
description:
|
|
"Show environment management in company settings and allow project and agent environment assignment controls.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableNativeRunner: {
|
|
title: "Paperclip Runner",
|
|
description:
|
|
"Allow explicitly configured local Codex, OpenCode, and qualified ACPX agents to use the experimental Rust Paperclip Runner, including authenticated sandbox ingress when required. Onboarding remains on legacy adapters.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
// On by default for self-hosted instances. Requires a Rust toolchain (or
|
|
// PAPERCLIP_RUNNER_BINARY) for `pnpm dev`, which builds runnerd whenever
|
|
// this is on.
|
|
selfHostedDefault: true,
|
|
},
|
|
enableManagedSandboxOnly: {
|
|
title: "Managed Environment Only",
|
|
description:
|
|
"Hide the local environment and run all agents in the platform-managed environment.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableIsolatedWorkspaces: {
|
|
title: "Isolated Workspaces",
|
|
description:
|
|
"Show execution workspace controls in project configuration and allow isolated workspace behavior for task runs.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableIsolatedWorkspacesByDefault: {
|
|
title: "Isolated Workspaces By Default",
|
|
description:
|
|
"Treat a project that has no execution workspace policy of its own as if it selected isolated workspaces, so its tasks get a per-task worktree instead of sharing the project checkout. Requires Isolated Workspaces. A project that carries its own policy keeps it.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableStreamlinedLeftNavigation: {
|
|
title: "Streamlined Left Navigation",
|
|
description: "Use the streamlined main sidebar navigation layout.",
|
|
tier: "preference",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enableStreamlinedUi: {
|
|
title: "Streamlined UI",
|
|
description:
|
|
"Use the streamlined application shell, shared task collections, focused task detail layout, contextual navigation, and simplified main sidebar.",
|
|
tier: "preference",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enableApps: {
|
|
title: "Apps (compatibility)",
|
|
description:
|
|
"Deprecated compatibility key. Apps is always enabled; stored and managed values are ignored.",
|
|
tier: "managed",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enableChatConnectors: {
|
|
title: "Chat connectors",
|
|
description:
|
|
"Show experimental chat connector setup and Board surfaces. Existing connections keep running when hidden; AgentMail, GitHub tools, and other tool connectors are unaffected.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableMemoryConnectors: {
|
|
title: "Memory connectors",
|
|
description: "Show experimental Mem0, Zep, Supermemory, Cognee, and Honcho setup. Existing connections keep running when hidden.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableMcpAggregators: {
|
|
title: "MCP aggregators (compatibility)",
|
|
description: "Deprecated compatibility key. MCP aggregators are always enabled; stored and managed values are ignored.",
|
|
tier: "managed",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enablePipelines: {
|
|
title: "Pipelines",
|
|
description: "Enable pipeline definitions and pipeline-driven case production surfaces.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableCases: {
|
|
title: "Cases",
|
|
description:
|
|
"Durable work products that tasks create and iterate on. Adds the Cases tab and the agent case API.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableAgentChat: {
|
|
title: "Agent Chat",
|
|
description: "Persistent task-backed conversations that clarify goals and hand work off to tasks.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableConferenceRoomChat: {
|
|
title: "Conference Room Chat",
|
|
description:
|
|
"Add the Conference Room team chat, the live activity feed, and the redesigned onboarding; restyles task threads as chat bubbles.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableClassicTaskInterface: {
|
|
title: "Classic Task Interface",
|
|
description:
|
|
"Restore the pre-chat task detail page: the page-level header with inline description editor, the plain comment thread, and the fixed Properties sidebar. Chat-only features (streaming activity folding, inline plan/question cards, the three-mode composer) are unavailable in the classic view.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableIssuePlanDecompositions: {
|
|
title: "Task Plan Decomposition",
|
|
description: "Show accepted-plan decomposition history on task detail pages.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableExperimentalFileViewer: {
|
|
title: "Experimental File Viewer",
|
|
description:
|
|
"Show task detail controls for browsing and previewing workspace files relative to a task.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableStatusCards: {
|
|
title: "Status Cards",
|
|
description:
|
|
"Enable the experimental shared status-card board, update engine, and gated API.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableExternalObjects: {
|
|
title: "External Objects",
|
|
description:
|
|
"Detect external URLs in issues and show resolved status for pull requests, tickets, and other referenced work objects.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableSmokeLab: {
|
|
title: "Smoke Lab",
|
|
description:
|
|
"Add the Smoke Lab tab and dashboard card for exercising integration paths against deterministic local fixtures. Private deployments only.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableBuiltInAgents: {
|
|
title: "Built-in Agents",
|
|
description:
|
|
"Show Paperclip-managed built-in agent surfaces, including roster badges, the Built-in agents tab, and setup controls.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableBetaSkills: {
|
|
title: "Beta skills",
|
|
description: "Allow agents to pin beta releases of the Paperclip core skill.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableSummaries: {
|
|
title: "Summaries",
|
|
description:
|
|
"Show Summarizer-generated status slots on project and workspace pages, with on-demand refresh and revision history.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableDecisions: {
|
|
title: "Decisions",
|
|
description:
|
|
"Show the Decisions item in the main sidebar — the attention home that surfaces tasks awaiting input.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableGoalsSidebarLink: {
|
|
title: "Goals Sidebar Link",
|
|
description: "Restore the Goals item in the main sidebar while the goals surface is being evaluated.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableSimplifiedEnglishInteractions: {
|
|
title: "Simplified English Interactions",
|
|
description:
|
|
"Instruct agents to write user interactions (confirmations, questions, suggested tasks) in ASD-STE100 Simplified Technical English with brief decision context.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableServerInfoDebugView: {
|
|
title: "Server Info Debug View",
|
|
description:
|
|
"Show a Server section in the account drawer with the current server restart time and running commit.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enablePaperclipDeveloperMode: {
|
|
title: "Paperclip Developer Mode",
|
|
description:
|
|
"Show internal Paperclip maintainer tools and observability links, including Honeycomb trace queries on run pages.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
autoRestartDevServerWhenIdle: {
|
|
title: "Auto-Restart Dev Server When Idle",
|
|
description:
|
|
"In local development, wait for queued and running agent runs to finish, then restart the server automatically when backend changes make the current boot stale.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableWorkspaceBranchReconcileForward: {
|
|
title: "Workspace Branch Reconcile Forward",
|
|
description:
|
|
"Let execution workspaces reconcile a diverged recorded branch forward instead of failing branch containment.",
|
|
tier: "managed",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enableWorkspaceDirtyQuarantineRepair: {
|
|
title: "Workspace Dirty Quarantine Repair",
|
|
description:
|
|
"Let workspace runtime recovery quarantine and repair dirty execution workspaces before runs.",
|
|
tier: "managed",
|
|
cloudDefault: true,
|
|
selfHostedDefault: true,
|
|
},
|
|
enableOwnerInstanceAdmin: {
|
|
title: "Owner Instance Admin",
|
|
description:
|
|
"On cloud-managed instances, grant the stack owner instance-admin access to their own dedicated instance. Elevation is computed at the trusted-header auth boundary; no instance admin role rows are created. Inert on self-hosted instances.",
|
|
tier: "managed",
|
|
cloudDefault: true,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableSandboxDuplexBridge: {
|
|
title: "Sandbox Duplex Bridge",
|
|
description:
|
|
"Let a run open the sandbox duplex command-stream bridge when the provider grants the capability. The host reads this per run before it selects the transport. Off keeps the file bridge for every run.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableRunnerPreviewIngress: {
|
|
title: "Runner Preview Ingress (Deprecated)",
|
|
description:
|
|
"Compatibility-only key retained for older managed configs. Runner ingress follows the Paperclip Runner setting.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableWorktreeRunExecution: {
|
|
title: "Worktree Run Execution",
|
|
description:
|
|
"Let the scheduler execute runs inside an isolated git-worktree preview instance for tasks created after activation.",
|
|
tier: "managed",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
enableFirstTaskPlanProposal: {
|
|
title: "First task: propose with a plan document",
|
|
description:
|
|
"When the user's first request is a single task, the chief of staff writes a short plan document and a checkbox card instead of a one-card confirmation. Applies to organizations created after the toggle is flipped.",
|
|
tier: "preference",
|
|
cloudDefault: false,
|
|
selfHostedDefault: false,
|
|
},
|
|
};
|
|
|
|
export const INSTANCE_FEATURE_KEYS = Object.keys(INSTANCE_FEATURE_CATALOG).sort() as InstanceFeatureKey[];
|
|
|
|
/**
|
|
* Shape of the `feature-catalog.json` release artifact the cloud harness
|
|
* imports per app release and validates feature writes against.
|
|
*/
|
|
export const featureCatalogArtifactSchema = z
|
|
.object({
|
|
catalogVersion: z.string().min(1),
|
|
features: z.record(
|
|
z.string().min(1),
|
|
z.object({ tier: z.enum(FEATURE_TIERS) }).strict(),
|
|
),
|
|
})
|
|
.strict();
|
|
|
|
export type FeatureCatalogArtifact = z.infer<typeof featureCatalogArtifactSchema>;
|
|
|
|
export function buildFeatureCatalogArtifact(catalogVersion: string): FeatureCatalogArtifact {
|
|
if (catalogVersion.trim().length === 0) {
|
|
throw new Error("catalogVersion must be a non-empty string");
|
|
}
|
|
const features: FeatureCatalogArtifact["features"] = {};
|
|
for (const key of INSTANCE_FEATURE_KEYS) {
|
|
features[key] = { tier: INSTANCE_FEATURE_CATALOG[key].tier };
|
|
}
|
|
return { catalogVersion, features };
|
|
}
|
|
|
|
/** Deterministic serialization (sorted keys, trailing newline) for the artifact file. */
|
|
export function renderFeatureCatalogArtifact(catalogVersion: string): string {
|
|
return `${JSON.stringify(buildFeatureCatalogArtifact(catalogVersion), null, 2)}\n`;
|
|
}
|