refactor: remove the billing tier model (P0.1)

The community edition has no monetization (ADR-0001). Remove the tier
model (packages/shared/src/tiers.ts), the requireTier middleware and every
tier gate, GET/PATCH /api/tier and the trial start, and the Stripe
integration, which depends on the tier model.

Personal features a tier used to limit are open to everyone: unlimited
workspaces and connectors, every embedding provider including LiteLLM,
per-workspace costs, Approvals. The workspace session cap is one constant
(100). Team and enterprise surfaces are hidden instead of unlocked (team
dock zone, Settings Team/Enterprise/Plan tabs, workspace Team tab);
cloud sync reports unavailable, as it did for free users.

The sidecar ignores the tier keys in config.json but does not delete them:
both editions may still share ~/.waggle.

Web billing UI is deleted: plan cards, upgrade and trial modals, payment
success route, the KVARK sales block, tier 403 handling.
This commit is contained in:
shumeiko.it
2026-10-15 19:31:50 +02:00
parent 369d8269c1
commit fe2eb0f648
117 changed files with 342 additions and 6424 deletions

View File

@@ -11,18 +11,16 @@
* `{ kind:'none', fallback:true }` so the frontend falls back to Tier 0.
*/
import type { InterpretResult, ResolvedAction, Tier } from '@waggle/shared';
import type { InterpretResult, ResolvedAction } from '@waggle/shared';
import {
buildActionCatalog,
validateAndBuildAction,
checkTier,
type RegistryContext,
} from './command-registry.js';
export interface InterpretDeps {
text: string;
workspaceId?: string;
currentTier: Tier;
workspaces: ReadonlyArray<{ id: string; name: string }>;
/** The workspace "now" block (awareness + recent sessions + pending). */
memoryContext: string;
@@ -93,21 +91,6 @@ function buildValidStep(
return validateAndBuildAction(actionId, params, ctx);
}
/** Apply the tier gate to a resolved single action. */
function finalizeAction(action: ResolvedAction, currentTier: Tier): InterpretResult {
const tier = checkTier(action.id, currentTier);
if (tier.gated && tier.requiredTier) {
return {
kind: 'tier_gated',
capability: action.label,
requiredTier: tier.requiredTier,
actualTier: currentTier,
message: `${action.label} requires the ${tier.requiredTier} tier.`,
};
}
return { kind: 'action', action };
}
export async function interpretCommand(deps: InterpretDeps): Promise<InterpretResult> {
const ctx: RegistryContext = { workspaceId: deps.workspaceId, workspaces: deps.workspaces };
@@ -136,7 +119,7 @@ export async function interpretCommand(deps: InterpretDeps): Promise<InterpretRe
if (!action) {
return { kind: 'none', fallback: true, message: "I couldn't map that to an action I can run." };
}
return finalizeAction(action, deps.currentTier);
return { kind: 'action', action };
}
case 'plan': {
@@ -144,7 +127,7 @@ export async function interpretCommand(deps: InterpretDeps): Promise<InterpretRe
// a true multi-step plan downgrades to clarify (fast-follow executes it).
const rawSteps = Array.isArray(parsed.steps) ? parsed.steps : [];
const steps = rawSteps.map((s) => buildValidStep(s, ctx)).filter((s): s is ResolvedAction => s !== null);
if (steps.length === 1) return finalizeAction(steps[0], deps.currentTier);
if (steps.length === 1) return { kind: 'action', action: steps[0] };
if (steps.length > 1) {
const labels = steps.map((s) => s.label).join(' → ');
return {