You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the Effect-TS 7-layer service architecture for the nondominium UI, following the proven pattern from Requests & Offers (happenings-community/requests-and-offers). This architecture provides typed error channels, fiber-based concurrency, automatic resource cleanup via Scope, and composable retry policies — all enforced at the type level before the first real UI feature is built.
EconomicProcessWorkflow: validate role → initiate process → complete → generate PPRs
Role Guard Composable (inside Layer 5): useRoleGuard() reads myCapabilityLevel and myRoles from the person store and derives all UI permissions (canInitiateTransport, canValidateResources, canApprovePromotions, etc.).
PPR Store (inside Layer 2): myPPRs, myReputationSummary, sharedReputations — no R&O equivalent.
Validation Queue (inside Layer 2, governance store): validationQueue: UIResourceValidation[] — resources awaiting validation by the current agent, role-gated to AccountableAgents.
Implementation Tasks
Layer 4 — Error (implement first, no dependencies)
Summary
Implement the Effect-TS 7-layer service architecture for the nondominium UI, following the proven pattern from Requests & Offers (
happenings-community/requests-and-offers). This architecture provides typed error channels, fiber-based concurrency, automatic resource cleanup viaScope, and composable retry policies — all enforced at the type level before the first real UI feature is built.Reference:
requests-and-offers/documentation/guides/adopting-7-layer-architecture.mdThe 7 Canonical Layers
Context.TagDI; zome wrappers; governance workflow servicesSchema.Classvalidation at DHT boundaries;VfActionenumData.TaggedErrorper domain; centralized context constantsNondominium-Specific Additions to the R&O Baseline
The governance-as-operator architecture requires extensions that don't exist in R&O's flat CRUD model.
Workflow Services (inside Layer 1) — multi-step governance sequences:
CustodyTransferWorkflow: Commitment → GovernanceEvaluation → EconomicEvent → Claim → PPR×2AgentPromotionWorkflow: request → validate identity → validate first resource → approve → assign roleResourceValidationWorkflow: create resource → request validation → collect receipts → check statusEconomicProcessWorkflow: validate role → initiate process → complete → generate PPRsRole Guard Composable (inside Layer 5):
useRoleGuard()readsmyCapabilityLevelandmyRolesfrom the person store and derives all UI permissions (canInitiateTransport,canValidateResources,canApprovePromotions, etc.).PPR Store (inside Layer 2):
myPPRs,myReputationSummary,sharedReputations— no R&O equivalent.Validation Queue (inside Layer 2, governance store):
validationQueue: UIResourceValidation[]— resources awaiting validation by the current agent, role-gated to AccountableAgents.Implementation Tasks
Layer 4 — Error (implement first, no dependencies)
errors/person.errors.ts—PersonError extends Data.TaggedErrorerrors/resource.errors.ts—ResourceError extends Data.TaggedErrorerrors/governance.errors.ts—GovernanceError+WorkflowError extends Data.TaggedErrorerrors/ppr.errors.ts—PPRError extends Data.TaggedErrorerrors/error-contexts.ts—PERSON_CONTEXTS,RESOURCE_CONTEXTS,GOVERNANCE_CONTEXTS,PPR_CONTEXTS,WORKFLOW_CONTEXTSLayer 3 — Schema (implement second, depends on Holochain types only)
schemas/person.schemas.ts—PersonInput,UIPerson,EncryptedProfileInputschemas/resource.schemas.ts—ResourceSpecInput,UIResourceSpec,EconomicResourceInput,UIEconomicResourceschemas/governance.schemas.ts—VfActionSchema(all 16 variants),CommitmentInput,UICommitment,GovernanceTransitionResultschemas/ppr.schemas.ts—PerformanceMetrics,UIParticipationClaim,UIReputationSummaryLayer 1 — Service (zome wrappers + workflow services)
utils/zome-helpers.ts— copywrapZomeCallWithErrorFactoryfrom R&O (verbatim)utils/effect-svelte-integration.ts— copy from R&O (verbatim)utils/store-helpers/— copy entire directory from R&O (verbatim)services/connection.service.ts— copy from R&O, updateZomeNametype onlyservices/zomes/person.service.ts—PersonServiceTag+PersonServiceLiveservices/zomes/resource.service.ts—ResourceServiceTag+ResourceServiceLiveservices/zomes/governance.service.ts—GovernanceServiceTag+GovernanceServiceLiveservices/workflows/custody-transfer.workflow.tsservices/workflows/agent-promotion.workflow.tsservices/workflows/resource-validation.workflow.tsservices/workflows/economic-process.workflow.tsLayer 2 — Store (one domain at a time)
stores/person.store.svelte.ts—allPersons,myProfile,myCapabilityLevel,myRolesstores/resource.store.svelte.ts—resourceSpecs,economicResources,governanceRulesstores/governance.store.svelte.ts—pendingCommitments,validationQueue,pendingRoleRequestsstores/ppr.store.svelte.ts—myPPRs,myReputationSummaryLayer 5 — Composable
composables/ui/useRoleGuard.svelte.ts— role-based UI permission derivationcomposables/ui/useErrorBoundary.svelte.tscomposables/domain/person/usePersonManagement.svelte.tscomposables/domain/resource/useResourceManagement.svelte.tscomposables/domain/governance/useGovernanceWorkflow.svelte.tscomposables/domain/governance/useValidationQueue.svelte.tscomposables/domain/ppr/usePPRDisplay.svelte.tsLayer 6 — Component
useRoleGuard()gates all role-sensitive affordancesLayer 7 — Test
HolochainClientServiceTagwithLoadingStatetransitions and cache behaviourImplementation Order
Per the R&O guide's hybrid adoption strategy for existing projects:
effect+@effect/platform— ✅ doneconnection.service+PersonServiceLiveperson.store+usePersonManagementcomposable + testsResourceServiceLive+resource.store+ composables + testsGovernanceServiceLive+ governance store + workflow services + testsppr.store+usePPRDisplayWorkflow services are implemented last — they depend on all three zome services being stable.
Acceptance Criteria
E.Effect<T, DomainError>— no raw Promises in service layerVfActionSchemacovers all 16 RustVfActionvariants exactlyuseRoleGuard()gates all role-sensitive UI affordancesbun run check,bun run test,bun run buildall passDependencies
effect+@effect/platforminui/package.json(Impl feat(ui): Effect-TS foundation — deps, error layer, schema layer, shared utilities #89)