Skip to main content

collab-surface-core

Use when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces. Covers parent entities, service entry points, authorization, content storage, and lifecycle.

معلومات المصدر

المستودع
macro-inc/macro
آخر نشاط في المصدر
٥ أكتوبر ٢٠٢٦ في ٢٢:٥٠
لغة SKILL.md المكتشفة
الإنجليزية
النجوم
٤٬٥٩٩
التفرعات
٤٤٦

خيارات التثبيت

يُحدَّد Prompt الذي يراجع المصدر أولًا بشكل افتراضي. يمكنك التبديل إلى أمر مباشر أو تنزيل نسخة محلية.

مراجعة ملفات المصدر

اقرأ SKILL.md وأي ملفات مرافقة يعرضها SkillsMP قبل أن تقرر التثبيت.

مستكشف الملفات
2 ملفات

عرض SKILL.md

SKILL.md
تعليمات المصدر · معاينة للقراءة فقط
name
collab-surface-core
description
Use when adding collaborative markdown, notes, or descriptions to a feature with collab surfaces. Covers parent entities, service entry points, authorization, content storage, and lifecycle.
# Collab surface core Use collab surfaces for collaborative markdown within a feature. Each surface has its own Loro session in sync-service and can exist without a `Document` row. The surface is a child resource of an app entity: product names, owners, sharing, and discovery belong to the parent. ## Choose the entry point - **A field managed by its parent domain**, such as an initiative description: use `OwnedSurfaceService` through the feature's domain port. The owning domain authorizes callers and chooses the surface id before calling `ensure_owned_surface`, `owned_surface_markdown`, or `retire_surface`. - **A surface managed through the public API**, such as a channel's shared input: use `CollabSurfaceService` with an access receipt for the parent. Surface reads, connection tokens, and deletion derive their permissions from that parent. Check `surface_ownership` and the parent's access resolution when adding a new parent type. Parents marked `ParentDomain` use their domain's creation and retirement paths; the public API still provides connection tokens. Keep the trusted `OwnedSurfaceService` behind domain authorization, with adapters supplied by the composition root. ## Keep content and lifecycle with their owners - The Loro session is the source of truth for content. `collab_surfaces` records the id, parent, initialization state, timestamps, and soft deletion. - Use application-generated UUIDv7 ids and the service's ensure operation. It handles namespace collisions and retries initialization from `pending` to `ready`. The id also names the sync session and must never be recycled. - Initial markdown seeds a new session. Ensuring an existing surface preserves its content; subsequent edits go through the collaborative session. - Wire retirement into the owning feature's cleanup. The parent reference is polymorphic and has no foreign-key cascade. Retirement blocks new connection tokens; it does not reclaim the sync-service session. Read the [domain ports](../../../crates/collab_surface/src/domain/ports.rs) and [parent policy](../../../crates/collab_surface/src/domain/models.rs) before wiring a consumer. The [initiative adapter](../../../crates/initiative_description/src/lib.rs) shows how a feature reuses the service through its own domain port.
عرض على GitHub