Files
waggle-os/packages/shared/src/command-intent.ts
shumeiko.it fe2eb0f648 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.
2026-10-15 19:31:50 +02:00

62 lines
2.4 KiB
TypeScript

// Natural-Language Command Bar (Ctrl+K Tier 1 intent layer).
//
// The contract returned by `POST /api/command/interpret`. The resolver maps a
// plain-language request onto the CLOSED action registry (server-side) and
// returns one structured `InterpretResult`. The LLM never emits an endpoint,
// route, or free code — it picks a registry action id; the SERVER derives the
// executable shape below. See docs/nl-command-bar/STEP0-AND-DESIGN.md.
import type { RiskLevel } from './risk.js';
/** The four resolution outcomes. `plan` is typed but NOT executed in v1. */
export type InterpretKind = 'action' | 'plan' | 'clarify' | 'none';
/**
* A single resolved, server-validated action. Exactly one of `navigate` /
* `endpoint` is set — both are derived server-side from the registry, never
* supplied by the model.
*/
export interface ResolvedAction {
/** Registry action id (closed set), e.g. 'create_workspace'. */
id: string;
/** Human-readable summary for the preview / approval surface. */
label: string;
/** Validated params the action was built from (for display + audit). */
params: Record<string, unknown>;
/** True → the frontend MUST render the approval surface before executing. */
sideEffect: boolean;
/** Risk badge for the approval surface (consistent with confirmation.ts). */
riskLevel: RiskLevel;
/** Navigation target — reuses CommandResult nav semantics (`onNavigate`). */
navigate?: { type: string; id: string };
/** Server-derived endpoint for a create / side-effect execute. */
endpoint?: { method: 'POST' | 'PATCH' | 'DELETE'; path: string; body?: Record<string, unknown> };
}
/** The single structured result of an interpret call. */
export interface InterpretResult {
kind: InterpretKind;
/** kind === 'action'. */
action?: ResolvedAction;
/** kind === 'plan' — typed only; v1 downgrades to clarify/single-action. */
steps?: ResolvedAction[];
/** kind === 'clarify'. */
question?: string;
options?: string[];
/** User-facing message (kind 'none', and a hint on others). */
message?: string;
/**
* True when resolution failed/degraded (no key, LLM error, parse failure):
* the frontend should fall back to Tier 0 results.
*/
fallback?: boolean;
}
/** Request body for `POST /api/command/interpret`. */
export interface InterpretRequest {
text: string;
workspaceId?: string;
/** Lightweight client hints (current route, etc.). Optional. */
context?: Record<string, unknown>;
}