@lssm/example.learning-journey-registry 0.0.0-canary-20251213172311 → 0.0.0-canary-20251215220103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -4
- package/CHANGELOG.md +12 -12
- package/dist/libs/contracts/src/docs/index.js +1 -1
- package/dist/libs/contracts/src/docs/tech/auth/better-auth-nextjs.docblock.js +58 -0
- package/dist/libs/contracts/src/docs/tech/studio/learning-events.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/learning-journeys.docblock.js +57 -0
- package/dist/libs/contracts/src/docs/tech/studio/platform-admin-panel.docblock.js +63 -0
- package/dist/libs/contracts/src/docs/tech/studio/project-access-teams.docblock.js +36 -0
- package/dist/libs/contracts/src/docs/tech/studio/project-routing.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
- package/dist/libs/contracts/src/docs/tech/studio/team-invitations.docblock.js +65 -0
- package/dist/libs/contracts/src/docs/tech/studio/workspace-ops.docblock.js +1 -0
- package/dist/libs/contracts/src/docs/tech/studio/workspaces.docblock.js +41 -0
- package/package.json +4 -4
- package/src/example.ts +0 -2
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ bun build:bundle && bun build:types
|
|
2
2
|
$ tsdown
|
|
3
|
-
[34mℹ[39m tsdown [2mv0.17.
|
|
3
|
+
[34mℹ[39m tsdown [2mv0.17.4[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
4
|
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/learning-journey-registry/tsdown.config.js[24m
|
|
5
5
|
[34mℹ[39m entry: [34msrc/api-types.ts, src/api.ts, src/example.ts, src/index.ts, src/progress-store.ts, src/tracks.ts, src/docs/index.ts, src/docs/learning-journey-registry.docblock.ts, src/presentations/index.ts, src/ui/LearningMiniApp.tsx, src/ui/index.ts[39m
|
|
6
6
|
[34mℹ[39m target: [34mesnext[39m
|
|
@@ -28,14 +28,24 @@ $ tsdown
|
|
|
28
28
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/telemetry-ingest.docblock.js [2m 3.90 kB[22m [2m│ gzip: 1.70 kB[22m
|
|
29
29
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/vscode-extension.docblock.js [2m 3.60 kB[22m [2m│ gzip: 1.39 kB[22m
|
|
30
30
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/PUBLISHING.docblock.js [2m 3.43 kB[22m [2m│ gzip: 1.59 kB[22m
|
|
31
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/auth/better-auth-nextjs.docblock.js [2m 3.35 kB[22m [2m│ gzip: 1.45 kB[22m
|
|
32
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/learning-journeys.docblock.js [2m 3.08 kB[22m [2m│ gzip: 1.39 kB[22m
|
|
33
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/platform-admin-panel.docblock.js [2m 3.04 kB[22m [2m│ gzip: 1.33 kB[22m
|
|
31
34
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js [2m 3.00 kB[22m [2m│ gzip: 1.53 kB[22m
|
|
32
35
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js [2m 2.83 kB[22m [2m│ gzip: 1.41 kB[22m
|
|
33
36
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/presentation-runtime.docblock.js [2m 2.75 kB[22m [2m│ gzip: 1.30 kB[22m
|
|
37
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/project-routing.docblock.js [2m 2.50 kB[22m [2m│ gzip: 1.12 kB[22m
|
|
38
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/team-invitations.docblock.js [2m 2.14 kB[22m [2m│ gzip: 1.04 kB[22m
|
|
39
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/workspaces.docblock.js [2m 1.90 kB[22m [2m│ gzip: 0.94 kB[22m
|
|
40
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/learning-events.docblock.js [2m 1.79 kB[22m [2m│ gzip: 0.88 kB[22m
|
|
34
41
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/contracts/openapi-export.docblock.js [2m 1.72 kB[22m [2m│ gzip: 0.90 kB[22m
|
|
42
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/project-access-teams.docblock.js [2m 1.58 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
43
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/index.js [2m 1.50 kB[22m [2m│ gzip: 0.51 kB[22m
|
|
44
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/workspace-ops.docblock.js [2m 1.49 kB[22m [2m│ gzip: 0.73 kB[22m
|
|
35
45
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/mcp-endpoints.docblock.js [2m 1.24 kB[22m [2m│ gzip: 0.68 kB[22m
|
|
36
46
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/presentations.js [2m 1.23 kB[22m [2m│ gzip: 0.59 kB[22m
|
|
37
|
-
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/
|
|
47
|
+
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/tech/studio/sandbox-unlogged.docblock.js [2m 0.90 kB[22m [2m│ gzip: 0.56 kB[22m
|
|
38
48
|
[34mℹ[39m [2mdist/[22mlibs/contracts/src/docs/registry.js [2m 0.74 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
39
|
-
[34mℹ[39m
|
|
40
|
-
[32m✔[39m Build complete in [
|
|
49
|
+
[34mℹ[39m 40 files, total: 126.00 kB
|
|
50
|
+
[32m✔[39m Build complete in [32m51ms[39m
|
|
41
51
|
$ tsc --noEmit
|
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# @lssm/example.learning-journey-registry
|
|
2
2
|
|
|
3
|
-
## 0.0.0-canary-
|
|
3
|
+
## 0.0.0-canary-20251215220103
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- @lssm/example.learning-journey-crm-onboarding@0.0.0-canary-
|
|
8
|
-
- @lssm/example.learning-journey-ui-coaching@0.0.0-canary-
|
|
9
|
-
- @lssm/example.learning-journey-ui-gamified@0.0.0-canary-
|
|
10
|
-
- @lssm/example.learning-journey-ui-onboarding@0.0.0-canary-
|
|
11
|
-
- @lssm/example.learning-journey-ui-shared@0.0.0-canary-
|
|
12
|
-
- @lssm/example.learning-journey-ambient-coach@0.0.0-canary-
|
|
13
|
-
- @lssm/example.learning-journey-duo-drills@0.0.0-canary-
|
|
14
|
-
- @lssm/example.learning-journey-platform-tour@0.0.0-canary-
|
|
15
|
-
- @lssm/example.learning-journey-quest-challenges@0.0.0-canary-
|
|
16
|
-
- @lssm/example.learning-journey-studio-onboarding@0.0.0-canary-
|
|
17
|
-
- @lssm/module.learning-journey@0.0.0-canary-
|
|
7
|
+
- @lssm/example.learning-journey-crm-onboarding@0.0.0-canary-20251215220103
|
|
8
|
+
- @lssm/example.learning-journey-ui-coaching@0.0.0-canary-20251215220103
|
|
9
|
+
- @lssm/example.learning-journey-ui-gamified@0.0.0-canary-20251215220103
|
|
10
|
+
- @lssm/example.learning-journey-ui-onboarding@0.0.0-canary-20251215220103
|
|
11
|
+
- @lssm/example.learning-journey-ui-shared@0.0.0-canary-20251215220103
|
|
12
|
+
- @lssm/example.learning-journey-ambient-coach@0.0.0-canary-20251215220103
|
|
13
|
+
- @lssm/example.learning-journey-duo-drills@0.0.0-canary-20251215220103
|
|
14
|
+
- @lssm/example.learning-journey-platform-tour@0.0.0-canary-20251215220103
|
|
15
|
+
- @lssm/example.learning-journey-quest-challenges@0.0.0-canary-20251215220103
|
|
16
|
+
- @lssm/example.learning-journey-studio-onboarding@0.0.0-canary-20251215220103
|
|
17
|
+
- @lssm/module.learning-journey@0.0.0-canary-20251215220103
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{docBlockToPresentationSpec as e,docBlockToPresentationV2 as t,docBlocksToPresentationRoutes as n}from"./presentations.js";import{DocRegistry as r,defaultDocRegistry as i,registerDocBlocks as a}from"./registry.js";import"./PUBLISHING.docblock.js";import"./accessibility_wcag_compliance_specs.docblock.js";import"./tech/PHASE_1_QUICKSTART.docblock.js";import"./tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js";import"./tech/PHASE_3_AUTO_EVOLUTION.docblock.js";import"./tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js";import"./tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js";import"./tech/lifecycle-stage-system.docblock.js";import"./tech/presentation-runtime.docblock.js";import"./tech/schema/README.docblock.js";import"./tech/templates/runtime.docblock.js";import"./tech/workflows/overview.docblock.js";import"./tech/mcp-endpoints.docblock.js";import"./tech/vscode-extension.docblock.js";import"./tech/telemetry-ingest.docblock.js";import"./tech/contracts/openapi-export.docblock.js";
|
|
1
|
+
import{docBlockToPresentationSpec as e,docBlockToPresentationV2 as t,docBlocksToPresentationRoutes as n}from"./presentations.js";import{DocRegistry as r,defaultDocRegistry as i,registerDocBlocks as a}from"./registry.js";import"./PUBLISHING.docblock.js";import"./accessibility_wcag_compliance_specs.docblock.js";import"./tech/PHASE_1_QUICKSTART.docblock.js";import"./tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js";import"./tech/PHASE_3_AUTO_EVOLUTION.docblock.js";import"./tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js";import"./tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js";import"./tech/lifecycle-stage-system.docblock.js";import"./tech/presentation-runtime.docblock.js";import"./tech/auth/better-auth-nextjs.docblock.js";import"./tech/schema/README.docblock.js";import"./tech/templates/runtime.docblock.js";import"./tech/workflows/overview.docblock.js";import"./tech/mcp-endpoints.docblock.js";import"./tech/vscode-extension.docblock.js";import"./tech/telemetry-ingest.docblock.js";import"./tech/contracts/openapi-export.docblock.js";import"./tech/studio/workspaces.docblock.js";import"./tech/studio/sandbox-unlogged.docblock.js";import"./tech/studio/workspace-ops.docblock.js";import"./tech/studio/project-routing.docblock.js";import"./tech/studio/platform-admin-panel.docblock.js";import"./tech/studio/learning-events.docblock.js";import"./tech/studio/learning-journeys.docblock.js";import"./tech/studio/project-access-teams.docblock.js";import"./tech/studio/team-invitations.docblock.js";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.auth.better-auth-nextjs`,title:`Better Auth + Next.js integration (ContractSpec)`,summary:`How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).`,kind:`reference`,visibility:`public`,route:`/docs/tech/auth/better-auth-nextjs`,tags:[`auth`,`better-auth`,`nextjs`,`cookies`,`proxy`,`hmr`],body:`# Better Auth + Next.js integration (ContractSpec)
|
|
2
|
+
|
|
3
|
+
This repo uses Better Auth as the primary auth layer (sessions, organizations, teams, API keys, and OAuth).
|
|
4
|
+
|
|
5
|
+
## Server config (Better Auth)
|
|
6
|
+
|
|
7
|
+
- Source: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
8
|
+
- Important: \`nextCookies()\` must be the **last** plugin in the Better Auth plugin list so \`Set-Cookie\` is applied correctly in Next.js environments.
|
|
9
|
+
|
|
10
|
+
## Better Auth Admin plugin
|
|
11
|
+
|
|
12
|
+
ContractSpec Studio enables the Better Auth **Admin plugin** to support platform-admin user operations (list users, impersonation, etc.).
|
|
13
|
+
|
|
14
|
+
- Server: \`admin()\` plugin in \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
15
|
+
- Client: \`adminClient()\` in \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
16
|
+
|
|
17
|
+
### PLATFORM_ADMIN ⇒ Better Auth admin role
|
|
18
|
+
|
|
19
|
+
Better Auth Admin endpoints authorize via \`user.role\`. ContractSpec enforces an org-driven rule:
|
|
20
|
+
|
|
21
|
+
- If the **active organization** has \`type = PLATFORM_ADMIN\`, the signed-in user is ensured to have \`User.role\` containing \`admin\`.
|
|
22
|
+
- This is applied in the session creation hook and re-checked in \`assertsPlatformAdmin()\`.
|
|
23
|
+
|
|
24
|
+
This keeps admin enablement deterministic and avoids manual role backfills.
|
|
25
|
+
|
|
26
|
+
## Client config (React web + Expo)
|
|
27
|
+
|
|
28
|
+
To avoid duplicate background refresh/polling loops in dev (Fast Refresh/HMR), the Better Auth client is implemented as a singleton cached on \`globalThis\`.
|
|
29
|
+
|
|
30
|
+
- Web client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.ts\`
|
|
31
|
+
- Native client: \`packages/bundles/contractspec-studio/src/presentation/providers/auth/client.native.ts\`
|
|
32
|
+
|
|
33
|
+
Import guidance:
|
|
34
|
+
|
|
35
|
+
- If you only need the context/hook, prefer importing from \`@lssm/bundle.contractspec-studio/presentation/providers/auth\`.
|
|
36
|
+
- If you explicitly need the Better Auth client instance (e.g. admin impersonation, direct API calls), import from \`@lssm/bundle.contractspec-studio/presentation/providers/auth/client\`.
|
|
37
|
+
|
|
38
|
+
## Public routes (login / signup)
|
|
39
|
+
|
|
40
|
+
Public auth pages should avoid eager \`authClient\` initialization.
|
|
41
|
+
|
|
42
|
+
Pattern used:
|
|
43
|
+
|
|
44
|
+
- In the submit handler, dynamically import \`@lssm/bundle.contractspec-studio/presentation/providers/auth/index.web\` and call \`authClient.signIn.*\` / \`authClient.signUp.*\`.
|
|
45
|
+
|
|
46
|
+
This prevents session refresh behavior from starting just because a public page rendered.
|
|
47
|
+
|
|
48
|
+
## Next.js proxy auth (web-landing)
|
|
49
|
+
|
|
50
|
+
The Next.js proxy/middleware is used for **redirect decisions only**. It must not perform DB-backed session reads on every request.
|
|
51
|
+
|
|
52
|
+
- Source: \`packages/apps/web-landing/src/proxy.ts\`
|
|
53
|
+
- Approach: cookie-only checks via Better Auth cookies helpers:
|
|
54
|
+
- \`getSessionCookie(request)\`
|
|
55
|
+
- \`getCookieCache(request)\`
|
|
56
|
+
|
|
57
|
+
These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
|
|
58
|
+
`}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.learning-events`,title:`Studio Learning Events`,summary:`Studio persists learning/activity events to the database; Sandbox keeps learning local-first and unlogged.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/learning-events`,tags:[`studio`,`learning`,`events`,`analytics`,`sandbox`],body:"# Studio Learning Events\n\nStudio emits lightweight **learning/activity events** to support onboarding, ambient coaching, and learning journeys.\n\n## Persistence model\n\n- **Studio**: events are persisted to the database in `StudioLearningEvent` and are organization-scoped (optionally project-scoped).\n- **Sandbox**: events remain **local-only** (unlogged); they must never be sent to backend services.\n\n## GraphQL API\n\n- `recordLearningEvent(input: { name, projectId?, payload? })`\n- `myLearningEvents(projectId?, limit?)`\n- `myOnboardingTracks(productId?, includeProgress?)`\n- `myOnboardingProgress(trackKey)`\n- `dismissOnboardingTrack(trackKey)`\n\n## Common event names (convention)\n\n- `module.navigated` — user navigated to a Studio module (payload at minimum: `{ moduleId }`).\n- `studio.template.instantiated` — created a new Studio project (starter template). Payload commonly includes `{ templateId, projectSlug }`.\n- `spec.changed` — created or updated a Studio spec. Payload may include `{ action: 'create' | 'update', specId?, specType? }`.\n- `regeneration.completed` — finished a “regen/deploy” action (currently emitted on successful Studio deploy actions).\n- `studio.evolution.applied` — completed an Evolution session (payload commonly includes `{ evolutionSessionId }`).\n\nThese events are intentionally minimal and must avoid PII/secrets in payloads.\n"}]);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.learning-journeys`,title:`Studio learning journeys (onboarding + coach)`,summary:`DB-backed learning journeys tracked per organization: seeded tracks/steps, event-driven progress, XP/streaks, and a Studio coach surface.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/learning-journeys`,tags:[`studio`,`learning`,`onboarding`,`journey`,`graphql`,`database`],body:`# Studio learning journeys
|
|
2
|
+
|
|
3
|
+
Studio supports **DB-backed learning journeys** (onboarding tracks + ambient coach tips) that are advanced by **recorded learning events**.
|
|
4
|
+
|
|
5
|
+
> See also: \`/docs/tech/studio/learning-events\` for event naming + payload guardrails.
|
|
6
|
+
|
|
7
|
+
## Scope (multi-tenancy)
|
|
8
|
+
|
|
9
|
+
- Progress is tracked **per organization** (tenant/workspace), via a \`Learner\` record keyed by \`(userId, organizationId)\`.
|
|
10
|
+
- Learning events are stored as \`StudioLearningEvent\` under the Studio DB schema, scoped to an organization (optionally a project).
|
|
11
|
+
|
|
12
|
+
## Persistence model (Prisma)
|
|
13
|
+
|
|
14
|
+
Learning journey progress lives in the \`lssm_learning\` schema:
|
|
15
|
+
|
|
16
|
+
- \`Learner\` — one per \`(userId, organizationId)\`
|
|
17
|
+
- \`OnboardingTrack\` — seeded track definitions (trackKey, name, metadata)
|
|
18
|
+
- \`OnboardingStep\` — seeded step definitions (stepKey, completionCondition, xpReward, metadata)
|
|
19
|
+
- \`OnboardingProgress\` — learner × track progress (progress %, xpEarned, completedAt, dismissedAt)
|
|
20
|
+
- \`OnboardingStepCompletion\` — append-only completion records (stepKey, status, xpEarned, completedAt)
|
|
21
|
+
|
|
22
|
+
## Track definition source (spec-first)
|
|
23
|
+
|
|
24
|
+
- Canonical track specs live in \`@lssm/example.learning-journey-registry\`.
|
|
25
|
+
- The Studio API seeds/updates the DB definitions via an idempotent “ensure tracks” routine.
|
|
26
|
+
- The DB is kept aligned with track specs (stale steps are removed) to prevent drift and unblock completion.
|
|
27
|
+
|
|
28
|
+
## Progress advancement (event-driven)
|
|
29
|
+
|
|
30
|
+
1) UI records an event via GraphQL \`recordLearningEvent\`
|
|
31
|
+
2) Backend creates \`StudioLearningEvent\`
|
|
32
|
+
3) Backend advances onboarding by matching the new event against step completion conditions
|
|
33
|
+
4) Backend persists step completions and recomputes:
|
|
34
|
+
- \`progress\` percentage
|
|
35
|
+
- \`xpEarned\` (including streak/completion bonuses when configured)
|
|
36
|
+
- track completion state (\`completedAt\`)
|
|
37
|
+
|
|
38
|
+
## GraphQL API (Studio)
|
|
39
|
+
|
|
40
|
+
- \`myOnboardingTracks(productId?, includeProgress?)\`
|
|
41
|
+
- returns all tracks + optional progress for the current learner
|
|
42
|
+
- \`myOnboardingProgress(trackKey)\`
|
|
43
|
+
- returns progress + step completion list for a single track
|
|
44
|
+
- \`dismissOnboardingTrack(trackKey)\`
|
|
45
|
+
- marks a track dismissed for the learner (prevents auto-coach)
|
|
46
|
+
|
|
47
|
+
## UI routes/surfaces (web)
|
|
48
|
+
|
|
49
|
+
- \`/studio/learning\` — learning hub (track list + progress widget)
|
|
50
|
+
- \`/studio/learning/{trackKey}\` — track detail (steps + map)
|
|
51
|
+
- Studio shell mounts a **coach sheet** that can auto-open for incomplete, non-dismissed onboarding.
|
|
52
|
+
|
|
53
|
+
## Security + data hygiene
|
|
54
|
+
|
|
55
|
+
- Do not put secrets/PII in \`payload\` fields of learning events.
|
|
56
|
+
- Prefer shallow payload filters (small, stable keys).
|
|
57
|
+
`}]);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.platform-admin-panel`,title:`Studio Platform Admin Panel`,summary:`How PLATFORM_ADMIN organizations manage tenant orgs and integration connections without session switching.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/platform-admin-panel`,tags:[`studio`,`admin`,`multi-tenancy`,`integrations`,`better-auth`],body:`# Studio Platform Admin Panel
|
|
2
|
+
|
|
3
|
+
ContractSpec Studio exposes a dedicated **Platform Admin Panel** for users whose **active organization** has:
|
|
4
|
+
|
|
5
|
+
- \`Organization.type = PLATFORM_ADMIN\`
|
|
6
|
+
|
|
7
|
+
The UI route is:
|
|
8
|
+
|
|
9
|
+
- \`/studio/admin\`
|
|
10
|
+
|
|
11
|
+
## Authorization model (no org switching)
|
|
12
|
+
|
|
13
|
+
Platform admins **remain in their own organization**. Cross-tenant actions are always explicit and scoped:
|
|
14
|
+
|
|
15
|
+
- Admin operations require an explicit \`targetOrganizationId\`.
|
|
16
|
+
- No session / activeOrganizationId switching is performed as part of admin operations.
|
|
17
|
+
|
|
18
|
+
## Integrations management
|
|
19
|
+
|
|
20
|
+
The admin panel manages the full ContractSpec Integrations system:
|
|
21
|
+
|
|
22
|
+
- Lists all shipped \`IntegrationSpec\` entries (registry built via \`createDefaultIntegrationSpecRegistry()\`).
|
|
23
|
+
- CRUD \`IntegrationConnection\` records for a selected tenant org.
|
|
24
|
+
|
|
25
|
+
### Secrets (reference-only + write-only)
|
|
26
|
+
|
|
27
|
+
The admin UI supports two modes:
|
|
28
|
+
|
|
29
|
+
- **Reference-only (BYOK)**: store only \`secretProvider\` + \`secretRef\`.
|
|
30
|
+
- **Write-only provisioning/rotation**: paste a raw secret payload; server writes to the selected backend and stores the resulting reference. The secret value is **never returned or displayed**.
|
|
31
|
+
|
|
32
|
+
Supported backends:
|
|
33
|
+
|
|
34
|
+
- Env overrides (\`env://...\`)
|
|
35
|
+
- Google Cloud Secret Manager (\`gcp://...\`)
|
|
36
|
+
- AWS Secrets Manager (\`aws://secretsmanager/...\`)
|
|
37
|
+
- Scaleway Secret Manager (\`scw://secret-manager/...\`)
|
|
38
|
+
|
|
39
|
+
## Better Auth Admin plugin
|
|
40
|
+
|
|
41
|
+
The panel uses the Better Auth **Admin plugin** for user operations (list users, impersonation):
|
|
42
|
+
|
|
43
|
+
- Client calls use \`authClient.admin.*\`.
|
|
44
|
+
- Server-side, ContractSpec enforces that users in a PLATFORM_ADMIN active org have \`User.role\` containing \`admin\` so Better Auth Admin endpoints authorize.
|
|
45
|
+
|
|
46
|
+
## GraphQL surface
|
|
47
|
+
|
|
48
|
+
The platform-admin GraphQL operations are guarded by the active org type and include:
|
|
49
|
+
|
|
50
|
+
- \`platformAdminOrganizations(search, limit, offset)\`
|
|
51
|
+
- \`platformAdminIntegrationSpecs\`
|
|
52
|
+
- \`platformAdminIntegrationConnections(input: { targetOrganizationId, category?, status? })\`
|
|
53
|
+
- \`platformAdminIntegrationConnectionCreate(input)\`
|
|
54
|
+
- \`platformAdminIntegrationConnectionUpdate(input)\`
|
|
55
|
+
- \`platformAdminIntegrationConnectionDelete(targetOrganizationId, connectionId)\`
|
|
56
|
+
|
|
57
|
+
## Key implementation files
|
|
58
|
+
|
|
59
|
+
- Auth + role enforcement: \`packages/bundles/contractspec-studio/src/application/services/auth.ts\`
|
|
60
|
+
- Admin GraphQL module: \`packages/bundles/contractspec-studio/src/infrastructure/graphql/modules/platform-admin.ts\`
|
|
61
|
+
- Integrations admin service: \`packages/bundles/contractspec-studio/src/modules/platform-integrations/index.ts\`
|
|
62
|
+
- Web route: \`packages/apps/web-landing/src/app/(app-customer)/studio/admin/*\`
|
|
63
|
+
`}]);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.project-access-teams`,title:`Studio Project Access via Teams`,summary:`Projects live under organizations; team sharing refines access with an admin/owner override.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/project-access-teams`,tags:[`studio`,`projects`,`teams`,`rbac`,`access-control`],body:`# Studio Project Access via Teams
|
|
2
|
+
|
|
3
|
+
Studio access control is **organization-first** with optional **team-based sharing**.
|
|
4
|
+
|
|
5
|
+
## Data model
|
|
6
|
+
|
|
7
|
+
- \`Team\` and \`TeamMember\` define team membership inside an organization.
|
|
8
|
+
- \`StudioProject\` is owned by an organization.
|
|
9
|
+
- \`StudioProjectTeam\` links projects to 0..N teams.
|
|
10
|
+
|
|
11
|
+
## Access rules
|
|
12
|
+
|
|
13
|
+
- **Admins/owners**: always have access to all projects in the organization.
|
|
14
|
+
- **Org-wide projects**: if a project has **no team links**, all organization members can access it.
|
|
15
|
+
- **Team-scoped projects**: if a project has **one or more team links**, a user must be a member of at least one linked team.
|
|
16
|
+
|
|
17
|
+
## GraphQL surfaces
|
|
18
|
+
|
|
19
|
+
- Read:
|
|
20
|
+
- \`myStudioProjects\` (returns only projects you can access)
|
|
21
|
+
- \`studioProjectBySlug(slug)\` (enforces the same access rules)
|
|
22
|
+
- \`myTeams\`
|
|
23
|
+
- \`projectTeams(projectId)\`
|
|
24
|
+
|
|
25
|
+
- Write:
|
|
26
|
+
- \`createStudioProject(input.teamIds?)\` (teamIds optional)
|
|
27
|
+
- \`setProjectTeams(projectId, teamIds)\` (admin-only)
|
|
28
|
+
|
|
29
|
+
## Related
|
|
30
|
+
+
|
|
31
|
+
+- Team administration + invitations: see \`/docs/tech/studio/team-invitations\`.
|
|
32
|
+
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
Payloads and events must avoid secrets/PII. For Sandbox, the model remains local-first and unlogged.
|
|
36
|
+
`}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.project-routing`,title:`Studio Project Routing`,summary:`Studio uses slugged, project-first routes: /studio/{projectSlug}/* with canonical slug redirects and soft-deleted projects hidden.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/project-routing`,tags:[`studio`,`routing`,`projects`,`slug`,`redirects`],body:"# Studio Project Routing\n\nContractSpec Studio uses a **project-first URL scheme**:\n\n- `/studio/projects` — create, select, and delete projects.\n- `/studio/{projectSlug}/*` — project modules (canvas/specs/deploy/integrations/evolution/learning).\n- `/studio/learning` — learning hub that does not require selecting a project.\n\n## Studio layout shell\n\nStudio routes are wrapped in a dedicated **Studio app shell** (header + footer) that provides in-app navigation (Projects/Learning/Teams), organization switching, and account actions.\n\nProject module routes (`/studio/{projectSlug}/*`) render their own module shell (`WorkspaceProjectShellLayout`). When combined with the global Studio header, the project shell uses a **sticky header offset** to avoid overlapping sticky headers.\n\n## Slug behavior (rename-safe)\n\n- Each project has a `slug` stored in the database (`StudioProject.slug`).\n- When a project name changes, Studio **updates the slug** and stores the previous slug as an alias (`StudioProjectSlugAlias`).\n- Requests to an alias slug are **redirected to the canonical slug**.\n\nGraphQL entrypoint:\n\n- `studioProjectBySlug(slug: String!)` returns:\n - `project`\n - `canonicalSlug`\n - `wasRedirect`\n\n## Deletion behavior (soft delete)\n\nProjects are **soft-deleted**:\n\n- `deleteStudioProject(id: String!)` sets `StudioProject.deletedAt`.\n- All listings and access checks filter `deletedAt = null`.\n- Soft-deleted projects are treated as “not found” in Studio routes and GraphQL access checks.\n\n## Available modules for a selected project\n\nThe following project modules are expected under `/studio/{projectSlug}`:\n\n- `/canvas` — Visual builder canvas (stored via overlays and canvas versions).\n- `/specs` — Spec editor (stored as `StudioSpec`).\n- `/deploy` — Deployments history + triggers (stored as `StudioDeployment`).\n- `/integrations` — Integrations scoped to project (stored as `StudioIntegration`).\n- `/evolution` — Evolution sessions (stored as `EvolutionSession`).\n- `/learning` — Project learning activity.\n"}]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.sandbox.unlogged`,title:`Sandbox (unlogged) vs Studio (authenticated)`,summary:`The sandbox is a lightweight, unlogged surface that mirrors Studio navigation without auth or analytics.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/sandbox-unlogged`,tags:[`studio`,`sandbox`,`privacy`,`analytics`],body:`## Sandbox guarantees
|
|
2
|
+
|
|
3
|
+
- Route: \`/sandbox\`
|
|
4
|
+
- **No auth requirement**
|
|
5
|
+
- **No PostHog init**
|
|
6
|
+
- **No Vercel Analytics**
|
|
7
|
+
- Local-only state (in-browser runtime + localStorage where needed)
|
|
8
|
+
|
|
9
|
+
## What Sandbox is for
|
|
10
|
+
|
|
11
|
+
- Try templates and feature modules safely
|
|
12
|
+
- Preview specs/builder/evolution/learning
|
|
13
|
+
- Produce copyable CLI commands (no side effects)
|
|
14
|
+
|
|
15
|
+
## What Sandbox is *not* for
|
|
16
|
+
|
|
17
|
+
- Persisted projects/workspaces
|
|
18
|
+
- Real deployments
|
|
19
|
+
- Organization-scoped integrations (unless explicitly enabled later)
|
|
20
|
+
`}]);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.team-invitations`,title:`Studio Teams & Invitations`,summary:`Admin-only team management and email invitation flow to join an organization and optionally a team.`,kind:`reference`,visibility:`public`,route:`/docs/tech/studio/team-invitations`,tags:[`studio`,`teams`,`invitations`,`access-control`,`onboarding`],body:`# Studio Teams & Invitations
|
|
2
|
+
|
|
3
|
+
Studio uses **organization membership** as the base access model. Teams are optional and used to refine access to projects.
|
|
4
|
+
|
|
5
|
+
## Who can manage teams?
|
|
6
|
+
|
|
7
|
+
- **Admins/owners only**: create, rename, delete teams; manage project team access; issue invitations.
|
|
8
|
+
|
|
9
|
+
## Invitation data model
|
|
10
|
+
|
|
11
|
+
- \`Invitation\` rows are stored under an organization and target an **email** address.
|
|
12
|
+
|
|
13
|
+
- An invitation can optionally target a \`teamId\`, which will grant the user membership in that team upon acceptance.
|
|
14
|
+
|
|
15
|
+
Key fields:
|
|
16
|
+
- \`email\`: invited address (must match the accepting user's account email)
|
|
17
|
+
|
|
18
|
+
- \`status\`: \`pending | accepted | declined | expired\`
|
|
19
|
+
|
|
20
|
+
- \`teamId?\`: optional team to join
|
|
21
|
+
|
|
22
|
+
- \`inviterId\`: user who issued the invitation
|
|
23
|
+
|
|
24
|
+
## GraphQL surfaces
|
|
25
|
+
|
|
26
|
+
- Team CRUD (admin-only):
|
|
27
|
+
|
|
28
|
+
- \`createTeam(name)\`
|
|
29
|
+
|
|
30
|
+
- \`renameTeam(teamId, name)\`
|
|
31
|
+
|
|
32
|
+
- \`deleteTeam(teamId)\`
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- Invitations (admin-only):
|
|
36
|
+
|
|
37
|
+
- \`organizationInvitations\`
|
|
38
|
+
|
|
39
|
+
- \`inviteToOrganization(email, role?, teamId?)\` → returns \`inviteUrl\` and whether an email was sent
|
|
40
|
+
|
|
41
|
+
## Accepting an invitation
|
|
42
|
+
|
|
43
|
+
The invite link is served as:
|
|
44
|
+
|
|
45
|
+
- \`/invite/{invitationId}\`
|
|
46
|
+
|
|
47
|
+
Acceptance rules:
|
|
48
|
+
- The user must be authenticated.
|
|
49
|
+
|
|
50
|
+
- The authenticated user’s email must match \`Invitation.email\`.
|
|
51
|
+
|
|
52
|
+
- If not already a member, create \`Member(userId, organizationId, role)\`.
|
|
53
|
+
|
|
54
|
+
- If \`teamId\` is present, ensure \`TeamMember(teamId, userId)\`.
|
|
55
|
+
|
|
56
|
+
- Mark invitation \`status='accepted'\` and set \`acceptedAt\`.
|
|
57
|
+
|
|
58
|
+
- Set \`activeOrganizationId\` for the session so \`/studio/*\` routes work immediately.
|
|
59
|
+
|
|
60
|
+
## Email delivery
|
|
61
|
+
|
|
62
|
+
- If \`RESEND_API_KEY\` is set, the system attempts to send an email.
|
|
63
|
+
|
|
64
|
+
- Otherwise, the UI uses the returned \`inviteUrl\` for manual copy/share.
|
|
65
|
+
`}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.workspace_ops`,title:`Workspace ops (repo-linked): list / validate / deps / diff`,summary:`Read-only repo operations used by Studio to inspect and validate a linked ContractSpec workspace.`,kind:`reference`,visibility:`mixed`,route:`/docs/tech/studio/workspace-ops`,tags:[`studio`,`repo`,`workspace`,`validate`,`diff`],body:"## API surface (api-contractspec)\n\nBase: `/api/workspace-ops`\n\nThese endpoints are **read-only** in v1 and never push to git:\n\n- `GET /api/workspace-ops/:integrationId/config?organizationId=`\n- `GET /api/workspace-ops/:integrationId/specs?organizationId=`\n- `POST /api/workspace-ops/:integrationId/validate` (body: organizationId, files?, pattern?)\n- `POST /api/workspace-ops/:integrationId/deps` (body: organizationId, pattern?)\n- `POST /api/workspace-ops/:integrationId/diff` (body: organizationId, specPath, baseline?, breakingOnly?)\n\n## Repo resolution\n\n- The repo root is resolved from the Studio Integration (`IntegrationProvider.GITHUB`) config:\n - `config.repoCachePath` (preferred) or `config.localPath`\n- Resolution is constrained to `CONTRACTSPEC_REPO_CACHE_DIR` (default: `/tmp/contractspec-repos`)\n\n## Intended UX\n\n- Studio Assistant can run these checks and present results as suggestions.\n- Users can copy equivalent CLI commands for local runs:\n - `contractspec validate`\n - `contractspec deps`\n - `contractspec diff --baseline <ref>`\n"}]);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"../../registry.js";e([{id:`docs.tech.studio.workspaces`,title:`Studio projects, teams, environments`,summary:`Organization-first Studio: projects live under an organization; teams refine access; projects deploy to multiple environments.`,kind:`reference`,visibility:`mixed`,route:`/docs/tech/studio/workspaces`,tags:[`studio`,`projects`,`teams`,`rbac`,`environments`],body:`## Concepts
|
|
2
|
+
|
|
3
|
+
- **Organization**: the primary grouping boundary for Studio projects.
|
|
4
|
+
- **Project**: one application (specs, overlays, deployments, integrations, evolution, learning).
|
|
5
|
+
- **Team**: refines who can see/edit a project within an organization.
|
|
6
|
+
- **Environment**: deployment target (Development / Staging / Production).
|
|
7
|
+
|
|
8
|
+
## Project access (teams + admin override)
|
|
9
|
+
|
|
10
|
+
Studio uses multi-team sharing to refine access:
|
|
11
|
+
|
|
12
|
+
- **Admins/owners** can access all projects.
|
|
13
|
+
- If a project is shared with **no teams**, it is **org-wide** (all org members).
|
|
14
|
+
- If a project is shared with **one or more teams**, it is visible to:
|
|
15
|
+
- admins/owners, and
|
|
16
|
+
- members of any linked team.
|
|
17
|
+
|
|
18
|
+
## Current persistence (DB + GraphQL)
|
|
19
|
+
|
|
20
|
+
- DB (Prisma): \`StudioProject\`, \`Team\`, \`TeamMember\`, \`StudioProjectTeam\`
|
|
21
|
+
- GraphQL:
|
|
22
|
+
- \`myStudioProjects\`
|
|
23
|
+
- \`createStudioProject(input.teamIds?)\`
|
|
24
|
+
- \`myTeams\`
|
|
25
|
+
- \`projectTeams(projectId)\`
|
|
26
|
+
- \`setProjectTeams(projectId, teamIds)\`
|
|
27
|
+
|
|
28
|
+
## UI shell behavior
|
|
29
|
+
|
|
30
|
+
Studio and Sandbox both use a shared shell:
|
|
31
|
+
|
|
32
|
+
- Project selector → Module navigation → Environment selector
|
|
33
|
+
- Always-on Assistant button (floating)
|
|
34
|
+
- Learning journey progress (Studio persists learning events; Sandbox stays local-only)
|
|
35
|
+
|
|
36
|
+
## Routing
|
|
37
|
+
|
|
38
|
+
- \`/studio/projects\`: create/select/delete projects (organization-first).
|
|
39
|
+
- \`/studio/{projectSlug}/*\`: project modules (canvas/specs/deploy/integrations/evolution/learning).
|
|
40
|
+
- \`/studio/learning\`: learning hub without selecting a project.
|
|
41
|
+
`}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.learning-journey-registry",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251215220103",
|
|
4
4
|
"description": "Registry that aggregates learning journey example tracks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,17 +42,17 @@
|
|
|
42
42
|
"@lssm/example.learning-journey-ui-onboarding": "workspace:*",
|
|
43
43
|
"@lssm/example.learning-journey-ui-coaching": "workspace:*",
|
|
44
44
|
"@lssm/module.learning-journey": "workspace:*",
|
|
45
|
-
"react": "^19.
|
|
45
|
+
"react": "^19.2.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@lssm/tool.tsdown": "workspace:*",
|
|
49
49
|
"@lssm/tool.typescript": "workspace:*",
|
|
50
50
|
"@types/react": "^19.1.6",
|
|
51
|
-
"tsdown": "^0.17.
|
|
51
|
+
"tsdown": "^0.17.4",
|
|
52
52
|
"typescript": "^5.9.3"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"react": "^
|
|
55
|
+
"react": "^19.2.3"
|
|
56
56
|
},
|
|
57
57
|
"module": "./dist/index.js",
|
|
58
58
|
"publishConfig": {
|