appsWorkspace onlyv0.1.6

app.organization-planning-host

Thin OPA host: mounts the organization-planning operation registry on REST, GraphQL, and MCP surfaces via the shared contracts-runtime adapters.

@lssm-tech/app.organization-planning-host
Source, release and verification context

Source snapshot bcc79fcc · Declared package version 0.1.6. This page combines the checked-in package guide and manifest; commands and runtime behavior were not executed in this review.

Package source ↗ Manifest ↗
EXPLORE THE PACKAGE

See where this package fits.

Follow a declared connection, inspect an import, then open the source guide when you need the detail.

THIS PACKAGEapp.organization-planning-hostapps

Arrows point from a package to its direct dependency. Each count is derived from the captured manifests.

20 déclarations · les 6 premières affichéesSELECT TO INSPECT

@lssm-tech/app.organization-planning-host

Website: https://contractspec.io

Thin OPA host — mounts the organization-planning operation registry on REST, GraphQL, and MCP.

What It Provides

  • Couche: app. (thin deployable host; transport wiring only).
  • Exposes buildOpaOps() (from @lssm-tech/lib.organization-planning-runtime) identically on three surfaces via existing contracts-runtime adapters:
    • REST — createOpaRestHandler(ctxFactory), served by the Next App Router catch-all at app/api/ops/[...route]/route.ts.
    • GraphQL — createOpaGraphqlBuilder() returns a Pothos builder with the OPA query/mutation fields.
    • MCP — mountOpaMcp(server, ctxFactories) registers the OPA tools.
  • Serves the public booking page at app/book/[link]/page.tsx. The page speaks the OPA v2 public booking protocol through @lssm-tech/opa-booking-react (useOpaBooking plus the typed ./availability projections): anonymous visitors load the availability quote, pick a slot and create a booking intent bound to its availabilityRef/slotRef. The booking link must allowlist this host's origin; only name, email, timezone and locale are sent.

Auth

Fail-closed at every step. The REST route (app/api/ops/[...route]/route.ts) composes three pieces:

  1. Session projection (src/session-context.ts, createOpaHostSessionContext). An Authorization: Bearer token is checked against AuthOS (/api/auth/get-session, through createBetterAuthBearerSessionReader) and then against the caller's own CompanyOS authority (GET /api/companyos/auth/authority, same bearer, no cookies or redirects, 1.5 s budget, answer at most 5 s old). The session and active organization must match, and the identity is read again after the authority read. The result is { actor: 'user', userId, organizationId, tenantId, workspaceId, roles }, where tenantId/workspaceId use the OPA ref grammar (tenant:<segment>, workspace:<segment>) and roles is the CompanyOS persona (grantRole). Anything else is { actor: 'anonymous' }, which the REST adapter rejects with 401 on every non-public operation. Module entitlement (src/opa-workspace-module.ts). Like the monolith's requireWorkspaceModule(session, 'opa'), the host requires opa in the authority read's enabledModules. When the list is missing or lacks opa, the user ctx gets a decide that answers 403 on every non-public operation, whatever the persona; public operations stay reachable as for an anonymous caller. A malformed enabledModules is treated as no authority (401).

  2. RBAC binding (src/opa-host-rbac.ts, createOpaHostRbac). Identity RBAC's RBACPolicyEngine plus one user-bound, tenant-tagged binding per CompanyOS persona. opa.loop.execute (admin, founder approver, operations manager) and opa.booking.approve (admin, founder approver) follow the api-application-monolith bindings. The profile capabilities (opa.profile.read/manage/publish) and every capability of the meeting-workspace operations a deployment can install through OpaBuildDeps (opa.meeting_policy.*, opa.meeting_workspace.*, opa.meeting_context.*, opa.meeting_artifact.*, opa.meeting_work_session.*, opa.meeting_outcome.*, opa.meeting_dispatch.*, opa.meeting_share.*, opa.recording.source_bind) go to the OPA personas of the managed-companyos coverage manifest (founder approver, operations manager) and the admin. The manifest gives the other personas no OPA coverage, so they get only the meeting capabilities of their AuthOS built-in role template:

    Persona Meeting operations allowed
    expert_reviewer opa.meeting_workspace.get, opa.meeting_artifact.list/get, opa.meeting_artifact.review_decide
    auditor opa.meeting_workspace.get, opa.meeting_artifact.list/get (read-only)
    frontline_staff opa.meeting_workspace.get
    ai_operator none (not an assignable AuthOS role)

    Every other operation answers 403 for these personas, including opa.meeting_work_session.*, policy, context, dispatch and sharing, and unknown roles get no binding at all. The runtime authority port still checks the actor's own grant on each meeting resource. An operation group whose capabilities have no persona grant answers 403 for every persona until its capabilities are mapped in src/opa-host-rbac.ts.

  3. Policy decision point (src/opa-host-policy.ts). When createOpaRestHandler(ctxFactory, { rbac }) is given an RBAC port, every request context gets a decide that requires the operation's declared capability for a resolved tenant and workspace actor. Public (policy.auth: 'anonymous') operations pass, unknown operations and missing grants are 403, and a context decide can only narrow the result. Bindings are tenant-scoped like the runtime's authorizeOpaOperation (src/opa-host-tenant-scope.ts): grants tagged, scoped or targeted to another tenant are dropped, and own-tenant tenantId or tenant-scope grants are honored. The runtime authority port still rejects a resource from another workspace (403). Without an RBAC port, createOpaRestHandler is default-deny: a non-anonymous ctx that brings no decide of its own (such as the one createOpaHostSessionContext projects) gets one that answers 403 on every non-public operation. Pair the session projection with { rbac }.

Known scope: the CompanyOS authority read does not return the selected team or sub-workspace, so the host scopes OPA to the active organization's workspace (workspace:<segment(activeOrganizationId)>). The route binds no profile or meeting persistence, so it serves only the operation groups a deployment configures through OpaBuildDeps.

Variable Objectif
OPA_HOST_AUTHOS_BASE_URL Origin (no path) of the CompanyOS API, which serves AuthOS and the authority read. Unset → every caller is anonymous. HTTPS only, except http://localhost. A value that is not an exact origin (trailing slash, path, credentials, HTTP on another host) is logged once as opa_host.invalid_authos_base_url when the route loads, and every caller is then anonymous; public operations keep working.
OPA_HOST_INSECURE_DEV 1 enables the LOCAL-ONLY x-opa-dev-user/-tenant/-workspace/-roles headers when no bearer is sent. Ignored when NODE_ENV=production; the dev subject still needs a persona in x-opa-dev-roles.

The MCP mount (mountOpaMcp) still takes the caller's toolCtx; it does not use this session projection yet.

Local Commands

  • bun run test — smoke tests (3 surface mounts + REST round-trip), session projection, REST default-deny and RBAC tests
  • bun run typecheck — TypeScript check
  • bun run lint:check — Biome check

Declared capabilities.

This manifest does not declare a capability catalogue. Use the guide, import map and source to assess the package.

Imports and export paths.

0 entries

These are package-manifest entry points. Named symbols listed above come from the capability catalogue; this is not an exhaustive TypeScript symbol reference.

This workspace does not declare package export paths.

Dependencies and related packages.

Runtime dependencies 20
@modelcontextprotocol/sdk
catalog:ai
@pothos/core
catalog:graphql
lucide-react
catalog:ui
next
catalog:
react
catalog:
react-dom
catalog:
zod
catalog:
Development dependencies 5
@types/react
catalog:types
@types/react-dom
catalog:types
typescript
catalog:

Package scripts.

Commands declared by this package. Review its setup requirements before running them; no command here was executed by this review.

cleanrimraf dist .turbo
lintbun lint:fix
lint:fixnode ../../../scripts/biome.cjs check --write .
lint:checknode ../../../scripts/biome.cjs check .
testbun test
typechecktsgo --noEmit
Votre vue

Make room for your context.

Shape the presentation around this moment. You can change it whenever you need.

Votre contexte

The different parts of you

Choose a starting point

Un mélange utile de contexte, de visuels et de guidage discret.

Tune each dimension
Each dimension can change independently. Product permissions and available actions stay unchanged.

Support the way you begin and return

Tune your support

Confort de lecture

Choisir votre langue

La langue de l’interface change uniquement le texte. Les marchés, les prix et les parcours conservent leurs propres paramètres.

Couverture des traductions

Une partie du contenu est affichée en anglais.

Navigation151
Graphe616
Catégories378
Portfolio833
Exemples2 035
Aperçu de la source1 542

D’autres traductions seront ajoutées à mesure que le contenu sera relu.

Cette préférence est enregistrée dans ce navigateur.

Rechercher sur le site

Des points de départ utiles

Aucun résultat. Essayez une expression plus courte, un nom d’opération ou un autre périmètre de recherche.

UN PEU DE PLACE POUR EXPLORER

Trouvez quelque chose à explorer.

Ouvrez un aperçu détaillé sur cette page, essayez une autre perspective ou suivez le détail vers sa propre page.

Fonctionnement des aperçus et des commandes
01

Regarder avant de partir

Survolez un lien ou sélectionnez-le avec Tab pour voir un aperçu. Cliquer sur le lien d’origine ou appuyer sur Entrée ouvre toujours sa destination.

02

Rester dans le contexte

Entrez dans l’aperçu pour explorer ses sections. Depuis un lien sélectionné, utilisez Alt + ↓ pour y entrer au clavier. Échap le ferme.

03

Ouvrir les possibilités

Les lignes dépliables, les choix de perspective et les commandes mises en évidence révèlent davantage. Votre vue adapte le confort de lecture et le contexte exploré.

Un bouton séparé pour voir de plus près

Affichez de petits boutons d’aperçu à côté des liens quand l’espace le permet. Touchez l’œil pour examiner ou le lien pour y aller directement. Ce choix reste dans cet onglet.

Aucun historique de navigation n’est collecté. La réduction des animations suit votre appareil et Votre vue.