@tiinex/app 0.1.1
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/LICENSE +201 -0
- package/NOTICE +31 -0
- package/README.md +26 -0
- package/docs/CONSUMER-CONTRACT.md +65 -0
- package/package.json +94 -0
- package/src/acceptance/knownScenarios.case.mjs +48 -0
- package/src/acceptance/knownScenarios.js +89 -0
- package/src/acceptance/postV423CanonicalTransitionProductVerticalSlice.case.mjs +774 -0
- package/src/acceptance/postV437M0ETimePortalProductParityClosure.case.mjs +51 -0
- package/src/acceptance/postV447M0FGithubSocialPublicationProductIntegration.case.mjs +33 -0
- package/src/acceptance/postV450M0ProductAcceptanceHardening.case.mjs +82 -0
- package/src/acceptance/postV470SchemaReadingContractMaterializationIdentitySourceCoalescingAuthorityCorrection.case.mjs +236 -0
- package/src/acceptance/recoveryAcceptance.case.mjs +196 -0
- package/src/adapters/adapter.definition.schema.json +33 -0
- package/src/adapters/archive/archive.adapter.case.mjs +212 -0
- package/src/adapters/export/export.adapter.js +79 -0
- package/src/adapters/git-native/git-native.adapter.js +43 -0
- package/src/adapters/github/github.adapter.case.mjs +843 -0
- package/src/adapters/github/github.adapter.js +395 -0
- package/src/adapters/github/github.issueEmbedded.js +262 -0
- package/src/adapters/github/github.issueMirror.js +309 -0
- package/src/adapters/github/github.issueSnapshot.js +475 -0
- package/src/adapters/github/github.issueSurface.js +188 -0
- package/src/adapters/github/github.issueTransport.js +237 -0
- package/src/adapters/github/github.publicationRead.js +24 -0
- package/src/adapters/github/github.readTransport.js +18 -0
- package/src/adapters/github/github.repoDiscovery.js +222 -0
- package/src/adapters/github/github.repoMirror.js +255 -0
- package/src/adapters/github/github.repoProxy.js +276 -0
- package/src/adapters/github/github.repoSurface.js +60 -0
- package/src/adapters/github/github.transportDiagnostics.js +68 -0
- package/src/adapters/local/local.adapter.case.mjs +72 -0
- package/src/adapters/local/local.adapter.js +188 -0
- package/src/adapters/registry.js +35 -0
- package/src/adapters/static/static.adapter.js +84 -0
- package/src/app/App.js +1 -0
- package/src/app/TiinexApp.jsx +822 -0
- package/src/app/appShell.views.jsx +58 -0
- package/src/app/artifactAuthoringCapability.js +49 -0
- package/src/app/boot/bootApp.js +19 -0
- package/src/app/boot/environment.js +1 -0
- package/src/app/canonicalAuthoringValues.js +4 -0
- package/src/app/canonicalCreationProductController.js +57 -0
- package/src/app/canonicalCreationProductSettlement.case.mjs +10 -0
- package/src/app/canonicalCreationProductSettlement.js +11 -0
- package/src/app/canonicalReferenceLocalCreateCommand.js +210 -0
- package/src/app/canonicalReferenceTargets.js +73 -0
- package/src/app/canonicalTransitionLocalCreateCommand.js +217 -0
- package/src/app/defaultWorkspaceStart.case.mjs +39 -0
- package/src/app/defaultWorkspaceStart.js +65 -0
- package/src/app/defaultWorkspaceStartCommand.js +55 -0
- package/src/app/durableLocalMutationPolicy.js +21 -0
- package/src/app/githubMaterializationSummary.js +69 -0
- package/src/app/githubProgress.js +25 -0
- package/src/app/githubSourceInput.js +47 -0
- package/src/app/githubSourceMaterializationCommand.js +97 -0
- package/src/app/githubSourceOperation.js +226 -0
- package/src/app/governanceDialogData.js +27 -0
- package/src/app/handoffPackageImportCommand.js +182 -0
- package/src/app/historyAuthority.js +53 -0
- package/src/app/initialWorkspaceBootstrapOperation.js +105 -0
- package/src/app/lineageCommand.js +118 -0
- package/src/app/lineageSourceRecovery.js +339 -0
- package/src/app/localDraftMutationCommand.js +174 -0
- package/src/app/localMaterialCommand.js +124 -0
- package/src/app/nodeGraphVerse.case.mjs +111 -0
- package/src/app/persistenceOwnership.js +92 -0
- package/src/app/productStateBoundary.js +7 -0
- package/src/app/providers/AppProviders.js +1 -0
- package/src/app/providers/LocaleProvider.js +1 -0
- package/src/app/providers/SchemaRegistryProvider.js +1 -0
- package/src/app/providers/WorkspaceProvider.js +1 -0
- package/src/app/publicTarget.js +251 -0
- package/src/app/publicTargetRestoreCommand.js +149 -0
- package/src/app/recordUi.cache.js +35 -0
- package/src/app/recordUi.js +11 -0
- package/src/app/routes/RouteSurface.js +1 -0
- package/src/app/routes/routes.js +1 -0
- package/src/app/runtimeState.js +54 -0
- package/src/app/schemaCurrentDeclaration.js +69 -0
- package/src/app/schemaFactoryLocalCreateCommand.js +101 -0
- package/src/app/schemaFactoryViewerProof.case.mjs +134 -0
- package/src/app/schemaFactoryViewerProof.js +20 -0
- package/src/app/schemaNavigationCommand.js +285 -0
- package/src/app/schemaNavigationMaterialization.js +171 -0
- package/src/app/schemaNavigationRuntimeCatalog.js +25 -0
- package/src/app/schemaNavigationState.js +66 -0
- package/src/app/schemaReadingContractQualification.js +91 -0
- package/src/app/schemaSourceRecovery.js +373 -0
- package/src/app/scrollPersistence.js +30 -0
- package/src/app/semanticOperationHistory.js +18 -0
- package/src/app/shareActionCommand.js +55 -0
- package/src/app/shareProjection.js +190 -0
- package/src/app/shell/AppShell.js +1 -0
- package/src/app/shell/Header.js +1 -0
- package/src/app/shell/Navigation.js +1 -0
- package/src/app/shell/SurfaceSwitcher.js +1 -0
- package/src/app/sourceTransportRefresh.js +176 -0
- package/src/app/startupOwnership.js +40 -0
- package/src/app/startupPresentation.case.mjs +34 -0
- package/src/app/startupPresentation.js +33 -0
- package/src/app/startupPresentation.views.jsx +21 -0
- package/src/app/startupRenderPhase.js +9 -0
- package/src/app/startupWorkspaceCommand.js +62 -0
- package/src/app/startupWorkspaceConfigApplication.js +49 -0
- package/src/app/statePersistenceScheduler.js +106 -0
- package/src/app/tiinexAppConfigPlan.js +108 -0
- package/src/app/tiinexAppConfigSource.js +349 -0
- package/src/app/tiinexAppStartupSource.js +79 -0
- package/src/app/tiinexHostedWorkspaceConventions.js +572 -0
- package/src/app/timePortalHistoricalRead.js +114 -0
- package/src/app/timePortalSnapshotResolution.js +53 -0
- package/src/app/urlMaterialCommand.js +24 -0
- package/src/app/useCanonicalPlacementSelectionOptions.js +9 -0
- package/src/app/useCanonicalReferenceSelectionOptions.js +8 -0
- package/src/app/useLocalMaterialIntake.js +68 -0
- package/src/app/useTimePortalProductController.jsx +111 -0
- package/src/app/useWorkspaceEntrypointIntake.js +77 -0
- package/src/app/useWorkspaceSelectionProductController.jsx +21 -0
- package/src/app/viewState.js +35 -0
- package/src/app/viewport.js +21 -0
- package/src/app/visualDormancy.js +286 -0
- package/src/app/workspaceContinuityNotices.js +32 -0
- package/src/app/workspaceDisplayCounts.js +9 -0
- package/src/app/workspaceEntrypointIntakeCommand.js +87 -0
- package/src/app/workspaceEntrypointProductRouting.case.mjs +20 -0
- package/src/app/workspaceExportCommand.js +21 -0
- package/src/app/workspaceExportDownload.js +23 -0
- package/src/app/workspaceExportExecutionCommand.js +10 -0
- package/src/app/workspaceGithubPublication.js +237 -0
- package/src/app/workspaceHandoffExport.js +56 -0
- package/src/app/workspaceHomeTarget.js +9 -0
- package/src/app/workspaceMulticolumn.js +113 -0
- package/src/app/workspaceNavigationParity.case.mjs +110 -0
- package/src/app/workspaceOpenProgress.js +26 -0
- package/src/app/workspacePlacementOptions.js +46 -0
- package/src/app/workspaceRecordActions.js +158 -0
- package/src/app/workspaceScopedInteraction.js +68 -0
- package/src/app/workspaceSelectionOriginContext.js +29 -0
- package/src/app/workspaceSelectionSession.js +54 -0
- package/src/app/workspaceSourceCloseCommand.js +25 -0
- package/src/app/workspaceSpineProductRouting.case.mjs +22 -0
- package/src/app/workspaceStartupTransition.js +32 -0
- package/src/app/workspaceWindow.js +85 -0
- package/src/artifacts/artifact.fixture.js +1 -0
- package/src/artifacts/artifact.identity.js +6 -0
- package/src/artifacts/artifact.identityAggregation.js +218 -0
- package/src/artifacts/artifact.model.js +2 -0
- package/src/artifacts/artifact.parse.case.mjs +196 -0
- package/src/artifacts/artifact.participantIndex.js +189 -0
- package/src/artifacts/fixtures/evidence.trace.md +50 -0
- package/src/artifacts/fixtures/topic.trace.md +33 -0
- package/src/artifacts/fixtures/unknown-schema.trace.md +25 -0
- package/src/audit/audit.findings.js +1 -0
- package/src/audit/audit.model.js +2 -0
- package/src/audit/audit.plan.js +13 -0
- package/src/audit/audit.report.js +12 -0
- package/src/audit/audit.severity.js +1 -0
- package/src/audit/audit.traverse.js +119 -0
- package/src/audit/integrity/auditIntegrity.checks.js +1 -0
- package/src/audit/integrity/auditIntegrity.compare.js +1 -0
- package/src/audit/lineage/auditLineage.load.js +1 -0
- package/src/audit/lineage/auditLineage.plan.js +1 -0
- package/src/audit/lineage/auditLineage.resolve.js +12 -0
- package/src/audit/sources/auditSources.boundaries.js +1 -0
- package/src/audit/sources/auditSources.checks.js +1 -0
- package/src/audit/validation/auditValidation.recheck.js +1 -0
- package/src/audit/validation/auditValidation.run.js +1 -0
- package/src/build.identity.js +15 -0
- package/src/commands/command.vocabulary.js +14 -0
- package/src/conformance/conformance.fixtures.js +151 -0
- package/src/conformance/conformance.run.js +238 -0
- package/src/data/applicationDataStore.js +23 -0
- package/src/data/companionAccess.js +35 -0
- package/src/diagnostics/events.js +1 -0
- package/src/diagnostics/invariant.js +1 -0
- package/src/diagnostics/schemaBindingChecks.js +1 -0
- package/src/diagnostics/schemaModuleChecks.js +1 -0
- package/src/diagnostics/sourceBoundaryChecks.js +5 -0
- package/src/diagnostics/sourceTransport.report.js +190 -0
- package/src/discovery/discovery.controls.js +7 -0
- package/src/export/export.plan.js +182 -0
- package/src/export/handoff.plan.js +50 -0
- package/src/export/package.builder.case.mjs +97 -0
- package/src/export/package.controlTopology.case.mjs +130 -0
- package/src/export/package.zip.case.mjs +33 -0
- package/src/graph/artifactGraph.model.js +344 -0
- package/src/graph/artifactGraph.project.js +139 -0
- package/src/graph/artifactGraph.worker.js +10 -0
- package/src/i18n/i18n.keys.js +1 -0
- package/src/i18n/i18n.provider.js +1 -0
- package/src/i18n/i18n.resolve.js +5 -0
- package/src/i18n/locales/en/common.json +4 -0
- package/src/i18n/locales/en/schemas/evidence.json +3 -0
- package/src/i18n/locales/en/schemas/presentation-surface.json +3 -0
- package/src/i18n/locales/en/schemas/preservation.json +3 -0
- package/src/i18n/locales/en/schemas/root.json +3 -0
- package/src/i18n/locales/en/schemas/schema-module.json +3 -0
- package/src/i18n/locales/en/schemas/topic.json +3 -0
- package/src/i18n/locales/en/surfaces/audit.json +3 -0
- package/src/i18n/locales/en/surfaces/create.json +3 -0
- package/src/i18n/locales/en/surfaces/detail.json +3 -0
- package/src/i18n/locales/en/surfaces/display-options.json +3 -0
- package/src/i18n/locales/en/surfaces/edit.json +3 -0
- package/src/i18n/locales/en/surfaces/feed.json +3 -0
- package/src/i18n/locales/en/surfaces/lineage.json +3 -0
- package/src/i18n/locales/en/surfaces/preview.json +3 -0
- package/src/i18n/locales/en/surfaces/share.json +3 -0
- package/src/i18n/locales/en/surfaces/source-settings.json +3 -0
- package/src/i18n/locales/en/surfaces/tree.json +3 -0
- package/src/i18n/locales/sv/common.json +4 -0
- package/src/i18n/locales/sv/schemas/evidence.json +3 -0
- package/src/i18n/locales/sv/schemas/presentation-surface.json +3 -0
- package/src/i18n/locales/sv/schemas/preservation.json +3 -0
- package/src/i18n/locales/sv/schemas/root.json +3 -0
- package/src/i18n/locales/sv/schemas/schema-module.json +3 -0
- package/src/i18n/locales/sv/schemas/topic.json +3 -0
- package/src/i18n/locales/sv/surfaces/audit.json +3 -0
- package/src/i18n/locales/sv/surfaces/create.json +3 -0
- package/src/i18n/locales/sv/surfaces/detail.json +3 -0
- package/src/i18n/locales/sv/surfaces/display-options.json +3 -0
- package/src/i18n/locales/sv/surfaces/edit.json +3 -0
- package/src/i18n/locales/sv/surfaces/feed.json +3 -0
- package/src/i18n/locales/sv/surfaces/lineage.json +3 -0
- package/src/i18n/locales/sv/surfaces/preview.json +3 -0
- package/src/i18n/locales/sv/surfaces/share.json +3 -0
- package/src/i18n/locales/sv/surfaces/source-settings.json +3 -0
- package/src/i18n/locales/sv/surfaces/tree.json +3 -0
- package/src/index.js +10 -0
- package/src/integrity/integrity.testFixture.js +9 -0
- package/src/interaction/interaction.spine.js +12 -0
- package/src/lineage/lineage.audit.js +1 -0
- package/src/lineage/lineage.edges.js +1 -0
- package/src/main.js +319 -0
- package/src/main.jsx +34 -0
- package/src/multiverse/multiverse.model.js +10 -0
- package/src/parity/poc.m1ParityScenarios.js +42 -0
- package/src/parity/poc.parityLedger.js +261 -0
- package/src/publication/publication.githubSocialContract.case.mjs +247 -0
- package/src/publication/publication.preflight.case.mjs +64 -0
- package/src/react/TiinexApplication.jsx +39 -0
- package/src/react/VerseHost.jsx +29 -0
- package/src/react/applicationDataContext.jsx +30 -0
- package/src/react.js +2 -0
- package/src/readers/modes/audit.reader.js +1 -0
- package/src/readers/modes/detail.reader.js +1 -0
- package/src/readers/modes/handover.reader.js +1 -0
- package/src/readers/modes/mobile.reader.js +1 -0
- package/src/readers/modes/print.reader.js +1 -0
- package/src/readers/modes/scan.reader.js +1 -0
- package/src/readers/reader.model.js +1 -0
- package/src/readers/reader.resolve.js +2 -0
- package/src/reingest/reingest.plan.case.mjs +65 -0
- package/src/runtime.js +54 -0
- package/src/schemas/README.md +99 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.md +614 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.md +311 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.md +227 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.md +318 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.md +243 -0
- package/src/schemas/core/interpretation/.transitions/evidence-to-interpretation-transition-definition.trace.md +102 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.md +308 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.md +312 -0
- package/src/schemas/core/relation/.generation/reference-relation-generation-authority.trace.md +185 -0
- package/src/schemas/core/relation/.transitions/topic-references-task-transition-definition.trace.md +119 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.md +240 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.md +550 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.md +239 -0
- package/src/schemas/core/task/.transitions/create-task-transition-definition.trace.md +93 -0
- package/src/schemas/core/task/.transitions/topic-to-task-transition-definition.trace.md +102 -0
- package/src/schemas/core/task/task-semantic-package.trace.md +53 -0
- package/src/schemas/core/task/tiinex.task.v1-transitions.trace.md +33 -0
- package/src/schemas/core/task/tiinex.task.v1.authoring.js +65 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.md +229 -0
- package/src/schemas/core/topic/.transitions/create-topic-transition-definition.trace.md +93 -0
- package/src/schemas/core/topic/tiinex.topic.v1-transitions.trace.md +33 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.md +197 -0
- package/src/schemas/core/topic/topic-semantic-package.trace.md +53 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.md +240 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.md +294 -0
- package/src/schemas/manifest.json +367 -0
- package/src/schemas/origins.js +46 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.md +290 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.md +298 -0
- package/src/schemas/party/tiinex.party.v1.schema.js +14 -0
- package/src/schemas/party/tiinex.party.v1.schema.json +23 -0
- package/src/schemas/party/tiinex.party.v1.schema.md +311 -0
- package/src/schemas/party/tiinex.party.v1.schema.runtime.json +2033 -0
- package/src/schemas/party/tiinex.party.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.md +476 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.md +248 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.md +465 -0
- package/src/schemas/schema.companionContract.case.mjs +259 -0
- package/src/schemas/schema.factory.case.mjs +256 -0
- package/src/schemas/schema.factory.viewerProjection.js +183 -0
- package/src/schemas/schemaMarkdownCatalog.js +19 -0
- package/src/schemas/tiinex.root.v1.schema.md +865 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.md +309 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.md +280 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.md +300 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.md +486 -0
- package/src/schemas/workspace/workspace.add.views.jsx +327 -0
- package/src/schemas/workspace/workspace.audit.views.jsx +160 -0
- package/src/schemas/workspace/workspace.auditBadge.views.jsx +98 -0
- package/src/schemas/workspace/workspace.canonicalReferenceDialog.views.jsx +63 -0
- package/src/schemas/workspace/workspace.canonicalTaskDialog.views.jsx +169 -0
- package/src/schemas/workspace/workspace.cardActions.js +9 -0
- package/src/schemas/workspace/workspace.cards.views.jsx +146 -0
- package/src/schemas/workspace/workspace.chrome.views.jsx +299 -0
- package/src/schemas/workspace/workspace.continuationDialog.views.jsx +80 -0
- package/src/schemas/workspace/workspace.discovery.views.jsx +63 -0
- package/src/schemas/workspace/workspace.discoveryRenderWindow.js +56 -0
- package/src/schemas/workspace/workspace.displayOptions.views.jsx +114 -0
- package/src/schemas/workspace/workspace.entrypointChoice.views.jsx +30 -0
- package/src/schemas/workspace/workspace.exportDialog.controller.jsx +40 -0
- package/src/schemas/workspace/workspace.exportDialog.views.jsx +142 -0
- package/src/schemas/workspace/workspace.governance.views.jsx +45 -0
- package/src/schemas/workspace/workspace.graph.views.jsx +134 -0
- package/src/schemas/workspace/workspace.lineage.views.jsx +307 -0
- package/src/schemas/workspace/workspace.read.views.jsx +105 -0
- package/src/schemas/workspace/workspace.recordActionButton.views.jsx +35 -0
- package/src/schemas/workspace/workspace.recordDialogs.views.jsx +257 -0
- package/src/schemas/workspace/workspace.selection.views.jsx +14 -0
- package/src/schemas/workspace/workspace.sourceReceipt.views.jsx +40 -0
- package/src/schemas/workspace/workspace.timePortal.views.jsx +56 -0
- package/src/schemas/workspace/workspace.tree.views.jsx +107 -0
- package/src/schemas/workspace/workspace.viewFormatting.js +172 -0
- package/src/schemas/workspace/workspace.views.jsx +210 -0
- package/src/source-settings/sourceSettings.model.js +7 -0
- package/src/sources/draft/draft.source.js +1 -0
- package/src/sources/github/github.loader.js +204 -0
- package/src/sources/github/github.permalink.js +1 -0
- package/src/sources/github/github.source.js +1 -0
- package/src/sources/github/github.transport.case.mjs +237 -0
- package/src/sources/github/github.transport.js +472 -0
- package/src/sources/local/local.source.js +1 -0
- package/src/sources/source.assetReferences.js +109 -0
- package/src/sources/source.boundaries.js +24 -0
- package/src/sources/source.identity.js +56 -0
- package/src/sources/source.model.case.mjs +26 -0
- package/src/sources/source.model.js +56 -0
- package/src/sources/source.presenter.js +66 -0
- package/src/sources/source.resolve.js +11 -0
- package/src/sources/static/static.source.js +1 -0
- package/src/sources/transport.policy.case.mjs +39 -0
- package/src/sources/transport.policy.js +81 -0
- package/src/storage/storage.policy.js +79 -0
- package/src/styles/app.css +8699 -0
- package/src/styles/responsive.css +10 -0
- package/src/styles/theme.css +4 -0
- package/src/styles/tokens.css +30 -0
- package/src/surfaces/audit/AuditSurface.js +1 -0
- package/src/surfaces/audit/audit.model.js +1 -0
- package/src/surfaces/audit/audit.render.js +1 -0
- package/src/surfaces/contracts.js +45 -0
- package/src/surfaces/create/CreateSurface.js +1 -0
- package/src/surfaces/create/create.model.js +1 -0
- package/src/surfaces/create/create.render.js +1 -0
- package/src/surfaces/detail/DetailSurface.js +1 -0
- package/src/surfaces/detail/detail.model.js +1 -0
- package/src/surfaces/detail/detail.render.js +1 -0
- package/src/surfaces/display-options/DisplayOptionsSurface.js +1 -0
- package/src/surfaces/display-options/displayOptions.model.js +1 -0
- package/src/surfaces/display-options/displayOptions.render.js +1 -0
- package/src/surfaces/edit/EditSurface.js +1 -0
- package/src/surfaces/edit/edit.model.js +1 -0
- package/src/surfaces/edit/edit.render.js +1 -0
- package/src/surfaces/feed/FeedSurface.js +1 -0
- package/src/surfaces/feed/feed.model.js +1 -0
- package/src/surfaces/feed/feed.render.js +1 -0
- package/src/surfaces/lineage/LineageSurface.js +1 -0
- package/src/surfaces/lineage/lineage.model.js +1 -0
- package/src/surfaces/lineage/lineage.render.js +1 -0
- package/src/surfaces/preview/PreviewSurface.js +1 -0
- package/src/surfaces/preview/preview.model.js +1 -0
- package/src/surfaces/preview/preview.render.js +1 -0
- package/src/surfaces/registry.js +58 -0
- package/src/surfaces/share/ShareSurface.js +1 -0
- package/src/surfaces/share/share.model.js +1 -0
- package/src/surfaces/share/share.render.js +1 -0
- package/src/surfaces/source-settings/SourceSettingsSurface.js +1 -0
- package/src/surfaces/source-settings/sourceSettings.model.js +1 -0
- package/src/surfaces/source-settings/sourceSettings.render.js +1 -0
- package/src/surfaces/surfaceContext.js +1 -0
- package/src/surfaces/tree/TreeSurface.js +1 -0
- package/src/surfaces/tree/tree.model.js +1 -0
- package/src/surfaces/tree/tree.render.js +1 -0
- package/src/tooling/portable/adapters/cli/cli.common-output.case.mjs +153 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.case.mjs +52 -0
- package/src/tooling/portable/adapters/cli/cli.run.case.mjs +372 -0
- package/src/tooling/portable/adapters/cli/cli.summaryProjection.case.mjs +46 -0
- package/src/tooling/portable/audit/audit.capability.case.mjs +45 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/collaboration/dogfood/001-tiinex-development-dogfood-collaboration-model.trace.fixture.txt +37 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/handoff/tooling/001-v480-tooling-workflow-schema-enablement-handoff.trace.fixture.txt +108 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/handoff/tooling/002-v481-tooling-recipient-relative-handoff-material-closure-planner-foundation-handoff.trace.fixture.txt +130 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/loom/role/001-loom-role.trace.fixture.txt +61 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/sigma/role/001-1-sigma-role.trace.fixture.txt +61 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-1-1-site-tooling-v474-loaded-parent-identity-evidence-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-1-site-tooling-v474-loaded-parent-identity-evidence-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-site-tooling-v473-portable-parent-authority-coherence-metadata-fidelity-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-site-tooling-v473-portable-parent-authority-coherence-metadata-fidelity-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-site-tooling-v472-portable-exact-authoring-fidelity-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-site-tooling-v472-portable-exact-authoring-fidelity-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-site-tooling-v471-portable-lineage-authoring-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-site-tooling-v471-portable-lineage-authoring-closure.trace.fixture.txt +39 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/002-1-v475-canonical-artifact-envelope-reference-integrity-validation.trace.fixture.txt +43 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/003-1-v476-canonical-authority-binding-integrity-method-lineage-alloca.trace.fixture.txt +42 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/027-handoff-package-workspace-archive-and-control-plane-minimality-audit.trace.fixture.txt +56 -0
- package/src/tooling/portable/fixtures/legacyArtifactFixtures.mjs +34 -0
- package/src/tooling/portable/grounding/grounding.capsule.case.mjs +65 -0
- package/src/tooling/portable/grounding/grounding.readiness.case.mjs +543 -0
- package/src/tooling/portable/grounding/grounding.semanticIntegration.case.mjs +131 -0
- package/src/tooling/portable/handoff/boundedWorkspaceRepresentation.case.mjs +103 -0
- package/src/tooling/portable/handoff/carrierLineage.fixedWidth.case.mjs +97 -0
- package/src/tooling/portable/handoff/coldStartQualification.case.mjs +293 -0
- package/src/tooling/portable/handoff/fixtures/027-invalid-audit-result.fixture.txt +192 -0
- package/src/tooling/portable/handoff/fixtures/027-invalid-return-handoff.fixture.txt +92 -0
- package/src/tooling/portable/handoff/fixtures/cold-start-qualification.v1.examples.json +60 -0
- package/src/tooling/portable/handoff/handoff.manufacture.case.mjs +293 -0
- package/src/tooling/portable/handoff/materialClosure.case.mjs +727 -0
- package/src/tooling/portable/handoff/multiRootManufacture.case.mjs +615 -0
- package/src/tooling/portable/handoff/operatorBridgeCore.case.mjs +205 -0
- package/src/tooling/portable/handoff/workspaceLandingPlan.case.mjs +143 -0
- package/src/tooling/portable/input/node.input.case.mjs +293 -0
- package/src/tooling/portable/lifecycle/lifecycle.readiness.case.mjs +179 -0
- package/src/tooling/portable/lineage/fixtures/lineage.integrity.repair-projection.v1.examples.json +605 -0
- package/src/tooling/portable/lineage/lineage.integrity.shared-capability.case.mjs +37 -0
- package/src/tooling/portable/lineage/publicationProviderReceipt.fixture.mjs +50 -0
- package/src/tooling/portable/package/fixtures/reference-relation-generation-authority.trace.md +84 -0
- package/src/tooling/portable/package/fixtures/tiinex.root.v1.package-authority.contract-fixture.md +64 -0
- package/src/tooling/portable/package/fixtures/tiinex.schema.generation.v1.generation-binding.contract-fixture.md +140 -0
- package/src/tooling/portable/package/fixtures/tiinex.schema.transition.companion.v1.contract-fixture.md +73 -0
- package/src/tooling/portable/package/fixtures/tiinex.semantic.package.v1.contract-fixture.md +147 -0
- package/src/tooling/portable/package/fixtures/tiinex.transition.definition.v1.package-contract-fixture.md +77 -0
- package/src/tooling/portable/providers/schema.providers.genericity.case.mjs +31 -0
- package/src/tooling/portable/reduction/reduction.preflight.case.mjs +298 -0
- package/src/tooling/portable/schema/fixtures/evidence-preservation-body.inheritance-record-fixture.md +65 -0
- package/src/tooling/portable/schema/fixtures/tiinex.portal.time.v1.contract-fixture.md +294 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.contract-fixture.md +584 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.machine-shape.contract-fixture.md +44 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.ordinary-target.contract-fixture.md +630 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.contract.v1.repeated-record.contract-fixture.md +69 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.generation.v1.repeated-record.contract-fixture.md +98 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.inheritance.v1.repeated-record.contract-fixture.md +58 -0
- package/src/tooling/portable/schema/fixtures/tiinex.task.v1.contract-fixture.md +165 -0
- package/src/tooling/portable/schema/fixtures/tiinex.transition.definition.v1.contract-fixture.md +744 -0
- package/src/tooling/portable/schema/fixtures/tiinex.transition.definition.v1.field-domain.contract-fixture.md +319 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.relation.v1.schema.md +240 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.contract.v1.schema.md +391 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.generation.v1.schema.md +379 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.transition.companion.v1.schema.md +265 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.semantic.package.v1.schema.md +402 -0
- package/src/transitions/canonical-schema-cache/52ecdea0a75893882ce282214d155f70e1309c2a/tiinex.topic.v1.schema.md +197 -0
- package/src/transitions/canonical-schema-cache/d69b8ff55a56b8cb9282b8684db6a938a4435b94/tiinex.root.v1.schema.md +797 -0
- package/src/transitions/canonical-schema-cache/d69b8ff55a56b8cb9282b8684db6a938a4435b94/tiinex.transition.definition.v1.schema.md +1062 -0
- package/src/transitions/canonicalTransition.packageContracts.js +22 -0
- package/src/transitions/canonicalTransition.productDefaults.js +105 -0
- package/src/transitions/canonicalTransition.schemaCache.case.mjs +45 -0
- package/src/transitions/canonicalTransition.schemaCache.js +81 -0
- package/src/transitions/canonicalTransition.semanticPackage.js +146 -0
- package/src/transitions/record.transitions.case.mjs +88 -0
- package/src/transitions/transition.authorityRepresentation.js +55 -0
- package/src/transitions/transition.availabilityPlanner.js +376 -0
- package/src/transitions/transition.availabilitySemantics.js +150 -0
- package/src/transitions/transition.definitionReadProjection.js +107 -0
- package/src/transitions/transition.definitionRegistry.js +355 -0
- package/src/transitions/transition.definitionRegistryAggregation.js +21 -0
- package/src/transitions/transition.definitions.js +46 -0
- package/src/transitions/transition.explicitGenerationPlanner.js +58 -0
- package/src/transitions/transition.generationInputPlanner.js +19 -0
- package/src/transitions/transition.interpretationMaterializer.js +2 -0
- package/src/transitions/transition.invocationBindingPacket.js +52 -0
- package/src/transitions/transition.invocationBindingPlanner.js +467 -0
- package/src/transitions/transition.legacyShorthand.js +133 -0
- package/src/transitions/transition.localArtifactMaterializers.js +16 -0
- package/src/transitions/transition.localCreateCapability.js +111 -0
- package/src/transitions/transition.outputMaterializationPlanner.js +336 -0
- package/src/transitions/transition.parentReference.js +90 -0
- package/src/transitions/transition.presentation.js +43 -0
- package/src/transitions/transition.productPreparation.js +377 -0
- package/src/transitions/transition.productPresentation.browser.js +28 -0
- package/src/transitions/transition.productPresentation.js +55 -0
- package/src/transitions/transition.referenceCreateCapability.js +119 -0
- package/src/transitions/transition.referenceTarget.js +50 -0
- package/src/transitions/transition.relationMaterializer.js +2 -0
- package/src/transitions/transition.resultSemantics.js +453 -0
- package/src/transitions/transition.taskMaterializer.js +2 -0
- package/src/transitions/transition.topicMaterializer.js +2 -0
- package/src/transitions/transition.validate.case.mjs +58 -0
- package/src/ui/cards/ArtifactCard.js +1 -0
- package/src/ui/cards/SchemaCard.js +1 -0
- package/src/ui/cards/SourceCard.js +1 -0
- package/src/ui/dialog.presenter.js +24 -0
- package/src/ui/feedback/DegradedNotice.js +1 -0
- package/src/ui/feedback/EmptyState.js +1 -0
- package/src/ui/feedback/ValidationNotice.js +1 -0
- package/src/ui/forms/FormRenderer.js +1 -0
- package/src/ui/forms/fields/MarkdownField.js +1 -0
- package/src/ui/forms/fields/SelectField.js +1 -0
- package/src/ui/forms/fields/SourcePickerField.js +1 -0
- package/src/ui/forms/fields/TextField.js +1 -0
- package/src/ui/icon.paths.js +37 -0
- package/src/ui/layout/Panel.js +1 -0
- package/src/ui/layout/ResponsiveFrame.js +1 -0
- package/src/ui/layout/SplitView.js +1 -0
- package/src/ui/layout/Stack.js +1 -0
- package/src/ui/panels/DetailPanel.js +1 -0
- package/src/ui/panels/LineagePanel.js +1 -0
- package/src/ui/panels/SourcePanel.js +1 -0
- package/src/ui/primitives/Badge.js +1 -0
- package/src/ui/primitives/Badge.jsx +5 -0
- package/src/ui/primitives/Button.js +1 -0
- package/src/ui/primitives/Button.jsx +12 -0
- package/src/ui/primitives/Card.js +1 -0
- package/src/ui/primitives/Field.js +1 -0
- package/src/ui/primitives/Field.jsx +21 -0
- package/src/ui/primitives/Icon.jsx +90 -0
- package/src/ui/primitives/Modal.jsx +27 -0
- package/src/validation/i18n.js +37 -0
- package/src/validation/validateArtifact.case.mjs +41 -0
- package/src/verses/column/ColumnVerse.js +1 -0
- package/src/verses/column/column.model.js +6 -0
- package/src/verses/column/column.project.js +7 -0
- package/src/verses/context.js +26 -0
- package/src/verses/contracts.js +1 -0
- package/src/verses/hostRegistry.js +47 -0
- package/src/verses/registry.js +22 -0
- package/src/verses/universe.model.js +8 -0
- package/src/verses/universe.presenter.js +8 -0
- package/src/verses/universe.project.js +12 -0
- package/src/viewer.js +34 -0
- package/src/workspace.model.js +5 -0
- package/src/workspaces/workspace.actions.js +1 -0
- package/src/workspaces/workspace.artifactActions.js +56 -0
- package/src/workspaces/workspace.auditView.js +153 -0
- package/src/workspaces/workspace.candidates.js +149 -0
- package/src/workspaces/workspace.config.js +153 -0
- package/src/workspaces/workspace.configuredSource.js +68 -0
- package/src/workspaces/workspace.discoveryProgress.js +34 -0
- package/src/workspaces/workspace.discoveryView.js +386 -0
- package/src/workspaces/workspace.displayFilters.js +63 -0
- package/src/workspaces/workspace.displayOptions.js +58 -0
- package/src/workspaces/workspace.emptyStateCopy.js +24 -0
- package/src/workspaces/workspace.entrypointLifecycle.js +131 -0
- package/src/workspaces/workspace.entrypointViewIntent.js +83 -0
- package/src/workspaces/workspace.entrypoints.js +157 -0
- package/src/workspaces/workspace.feedSort.js +152 -0
- package/src/workspaces/workspace.import.js +212 -0
- package/src/workspaces/workspace.importConflicts.js +200 -0
- package/src/workspaces/workspace.importLifecycle.case.mjs +103 -0
- package/src/workspaces/workspace.lifecycle.case.mjs +353 -0
- package/src/workspaces/workspace.lifecycle.js +357 -0
- package/src/workspaces/workspace.lineageView.js +244 -0
- package/src/workspaces/workspace.localSourceLifecycle.js +91 -0
- package/src/workspaces/workspace.materialLedger.js +110 -0
- package/src/workspaces/workspace.materialReconciliation.case.mjs +164 -0
- package/src/workspaces/workspace.materialReconciliation.js +390 -0
- package/src/workspaces/workspace.memberIdentity.js +140 -0
- package/src/workspaces/workspace.model.js +2 -0
- package/src/workspaces/workspace.navigation.js +20 -0
- package/src/workspaces/workspace.openSemantics.js +33 -0
- package/src/workspaces/workspace.pathTree.js +132 -0
- package/src/workspaces/workspace.persistence.case.mjs +271 -0
- package/src/workspaces/workspace.persistence.js +469 -0
- package/src/workspaces/workspace.persistenceCache.js +41 -0
- package/src/workspaces/workspace.persistenceClear.js +45 -0
- package/src/workspaces/workspace.persistencePresentation.js +93 -0
- package/src/workspaces/workspace.persistenceRecovery.js +147 -0
- package/src/workspaces/workspace.persistenceRouteCache.js +82 -0
- package/src/workspaces/workspace.publicationReceipts.case.mjs +36 -0
- package/src/workspaces/workspace.publicationReceipts.js +56 -0
- package/src/workspaces/workspace.recoverabilityView.js +264 -0
- package/src/workspaces/workspace.route.js +432 -0
- package/src/workspaces/workspace.runtimeCanonical.js +18 -0
- package/src/workspaces/workspace.sourceMaterial.js +71 -0
- package/src/workspaces/workspace.sourceRecordPath.js +5 -0
- package/src/workspaces/workspace.sourceRecords.js +75 -0
- package/src/workspaces/workspace.store.js +3 -0
- package/src/workspaces/workspace.summary.js +116 -0
- package/src/workspaces/workspace.timePortal.js +137 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
(function attachWorkspaceRoute(global) {
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const HASH_PREFIX = '#state=';
|
|
5
|
+
const STATE_VERSION = 2;
|
|
6
|
+
const ROUTE_ISSUE_MARKDOWN_LIMIT = 120000;
|
|
7
|
+
|
|
8
|
+
function makeRouteState(appState) {
|
|
9
|
+
const state = appState && typeof appState === 'object' ? appState : {};
|
|
10
|
+
return {
|
|
11
|
+
v: STATE_VERSION,
|
|
12
|
+
activeWorkspaceId: state.activeWorkspaceId || '',
|
|
13
|
+
view: semanticRouteView(state.view || {}),
|
|
14
|
+
workspaces: Array.isArray(state.workspaces) ? state.workspaces.map(compactWorkspace) : []
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function semanticRouteView(view = {}) {
|
|
19
|
+
const out = Object.assign({ universe: 'column', workspaceVerse: 'feed', reader: 'scan', query: '', displayOptions: { leavesFirst: false, leavesOnly: true, mismatchesOnly: false, showSupportingMarkdown: false, showWorkspaceArtifacts: true, showAssets: false, schemaFilter: 'all', artifactFilter: 'all' } }, view || {});
|
|
20
|
+
delete out.layoutMode;
|
|
21
|
+
delete out.scrollPositions;
|
|
22
|
+
const displayOptions = Object.assign({}, out.displayOptions || {});
|
|
23
|
+
if (displayOptions.showWorkspaceArtifacts == null && displayOptions.showWorkspaceCandidates != null) displayOptions.showWorkspaceArtifacts = displayOptions.showWorkspaceCandidates !== false;
|
|
24
|
+
delete displayOptions.showWorkspaceCandidates;
|
|
25
|
+
if (displayOptions.artifactFilter === 'workspace-candidate') displayOptions.artifactFilter = 'workspace-artifact';
|
|
26
|
+
out.displayOptions = displayOptions;
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function semanticRouteState(routeState = {}) {
|
|
31
|
+
const source = routeState && typeof routeState === 'object' && !Array.isArray(routeState) ? routeState : {};
|
|
32
|
+
const out = Object.assign({}, source, { view: semanticRouteView(source.view || {}) });
|
|
33
|
+
delete out.workspaceViews;
|
|
34
|
+
delete out.workspaceWindow;
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function compactWorkspace(workspace) {
|
|
39
|
+
return {
|
|
40
|
+
id: workspace.id || '',
|
|
41
|
+
name: workspace.name || workspace.title || 'Workspace',
|
|
42
|
+
title: workspace.title || workspace.name || 'Workspace',
|
|
43
|
+
createdAt: workspace.createdAt || '',
|
|
44
|
+
kind: workspace.kind || 'workspace',
|
|
45
|
+
source: compactSource(workspace.source || {}),
|
|
46
|
+
sources: Array.isArray(workspace.sources) ? workspace.sources.map(compactSource) : [],
|
|
47
|
+
sourceOrder: Array.isArray(workspace.sourceOrder) ? workspace.sourceOrder.slice() : [],
|
|
48
|
+
records: Array.isArray(workspace.records) ? workspace.records.map(compactRecord) : [],
|
|
49
|
+
assets: Array.isArray(workspace.assets) ? workspace.assets.map(compactAsset) : [],
|
|
50
|
+
workspaceMemberBindings: compactWorkspaceMemberBindings(workspace.workspaceMemberBindings),
|
|
51
|
+
importLog: Array.isArray(workspace.importLog) ? workspace.importLog.slice(0, 10).map(compactImportLogEntry) : [],
|
|
52
|
+
mode: workspace.mode || 'feed'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function compactWorkspaceMemberBindings(value = []) {
|
|
57
|
+
return (Array.isArray(value) ? value : []).map((binding) => {
|
|
58
|
+
const descriptor = binding?.descriptorTarget || {};
|
|
59
|
+
const identity = binding?.memberIdentity || {};
|
|
60
|
+
if (!descriptor.externalTarget || !identity.key) return null;
|
|
61
|
+
return {
|
|
62
|
+
schema: binding.schema || 'tiinex.workspace.memberBinding.v1',
|
|
63
|
+
descriptorTarget: {
|
|
64
|
+
schema: descriptor.schema || 'tiinex.publicTarget.v1',
|
|
65
|
+
adapterId: descriptor.adapterId || '',
|
|
66
|
+
targetKind: 'workspace',
|
|
67
|
+
externalTarget: descriptor.externalTarget || '',
|
|
68
|
+
repository: descriptor.repository || '',
|
|
69
|
+
ref: descriptor.ref || '',
|
|
70
|
+
path: descriptor.path || ''
|
|
71
|
+
},
|
|
72
|
+
memberIdentity: {
|
|
73
|
+
schema: identity.schema || 'tiinex.workspace.memberIdentity.v1',
|
|
74
|
+
kind: identity.kind || 'semantic',
|
|
75
|
+
key: identity.key || '',
|
|
76
|
+
name: identity.name || '',
|
|
77
|
+
label: identity.label || '',
|
|
78
|
+
sourceKind: identity.sourceKind || '',
|
|
79
|
+
sourceSignature: identity.sourceSignature || ''
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}).filter(Boolean);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function compactSurfaceMap(map = {}) {
|
|
86
|
+
const source = map && typeof map === 'object' ? map : {};
|
|
87
|
+
const out = {};
|
|
88
|
+
for (const [key, value] of Object.entries(source)) {
|
|
89
|
+
if (!value || typeof value !== 'object') continue;
|
|
90
|
+
const next = Object.assign({}, value);
|
|
91
|
+
delete next.transportTier;
|
|
92
|
+
delete next.transportTiers;
|
|
93
|
+
delete next.transportRefreshTier;
|
|
94
|
+
delete next.pendingTier;
|
|
95
|
+
delete next.activeStatus;
|
|
96
|
+
delete next.status;
|
|
97
|
+
out[key] = next;
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function compactSource(source = {}) {
|
|
103
|
+
const config = Object.assign({}, source.config || {});
|
|
104
|
+
return {
|
|
105
|
+
id: source.id || '',
|
|
106
|
+
kind: source.kind || '',
|
|
107
|
+
adapterId: source.adapterId || '',
|
|
108
|
+
sourceKind: source.sourceKind || '',
|
|
109
|
+
label: source.label || '',
|
|
110
|
+
repo: source.repo || config.repo || '',
|
|
111
|
+
ref: source.ref || config.ref || '',
|
|
112
|
+
requestedRef: source.requestedRef ?? config.requestedRef ?? '',
|
|
113
|
+
materializedCommit: source.materializedCommit || '',
|
|
114
|
+
rootPath: source.rootPath || config.rootPath || '',
|
|
115
|
+
count: Number(source.count || 0),
|
|
116
|
+
boundary: source.boundary || '',
|
|
117
|
+
discoveryState: source.discoveryState || '',
|
|
118
|
+
repoDiscovery: Boolean(source.repoDiscovery),
|
|
119
|
+
issueDiscovery: Boolean(source.issueDiscovery),
|
|
120
|
+
issueUrls: source.issueUrls || config.issueUrls || '',
|
|
121
|
+
explicitFileRefs: Array.isArray(source.explicitFileRefs || config.explicitFileRefs) ? Array.from(source.explicitFileRefs || config.explicitFileRefs) : [],
|
|
122
|
+
workspaceMatch: source.workspaceMatch || config.workspaceMatch || '',
|
|
123
|
+
appConfigPlan: source.appConfigPlan || config.appConfigPlan || '',
|
|
124
|
+
openBehavior: source.openBehavior || config.openBehavior || '',
|
|
125
|
+
preferredDisplay: source.preferredDisplay || config.preferredDisplay || '',
|
|
126
|
+
requestedSurfaces: compactSurfaceMap(source.requestedSurfaces || {}),
|
|
127
|
+
surfaces: compactSurfaceMap(source.surfaces || {}),
|
|
128
|
+
governanceBoundary: compactGovernanceBoundary(source.governanceBoundary || null),
|
|
129
|
+
closeable: Boolean(source.closeable),
|
|
130
|
+
loadable: source.loadable !== false,
|
|
131
|
+
config
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
function compactGovernanceBoundary(boundary = null) {
|
|
137
|
+
if (!boundary || typeof boundary !== 'object') return undefined;
|
|
138
|
+
const copyFile = (file = null) => {
|
|
139
|
+
if (!file || typeof file !== 'object') return null;
|
|
140
|
+
const out = {};
|
|
141
|
+
for (const key of ['status', 'kind', 'path', 'url', 'contentAvailable', 'note']) {
|
|
142
|
+
if (file[key] != null && file[key] !== '') out[key] = file[key];
|
|
143
|
+
}
|
|
144
|
+
return Object.keys(out).length ? out : null;
|
|
145
|
+
};
|
|
146
|
+
const out = {};
|
|
147
|
+
for (const key of ['schema', 'status', 'rootChecked', 'discoveredFrom', 'note', 'boundary']) {
|
|
148
|
+
if (boundary[key] != null && boundary[key] !== '') out[key] = boundary[key];
|
|
149
|
+
}
|
|
150
|
+
if (boundary.scope && typeof boundary.scope === 'object') out.scope = Object.assign({}, boundary.scope);
|
|
151
|
+
const policy = copyFile(boundary.policy || null);
|
|
152
|
+
if (policy) out.policy = policy;
|
|
153
|
+
const notice = copyFile(boundary.notice || null);
|
|
154
|
+
if (notice) out.notice = notice;
|
|
155
|
+
if (boundary.candidates && typeof boundary.candidates === 'object') out.candidates = Object.assign({}, boundary.candidates);
|
|
156
|
+
return Object.keys(out).length ? out : undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function compactRecordSource(source = {}) {
|
|
160
|
+
const config = source.config && typeof source.config === 'object' ? source.config : {};
|
|
161
|
+
const out = {
|
|
162
|
+
id: source.id || '',
|
|
163
|
+
kind: source.kind || '',
|
|
164
|
+
adapterId: source.adapterId || '',
|
|
165
|
+
sourceKind: source.sourceKind || '',
|
|
166
|
+
label: source.label || '',
|
|
167
|
+
repo: source.repo || config.repo || '',
|
|
168
|
+
ref: source.ref || config.ref || '',
|
|
169
|
+
requestedRef: source.requestedRef ?? config.requestedRef ?? '',
|
|
170
|
+
materializedCommit: source.materializedCommit || '',
|
|
171
|
+
rootPath: source.rootPath || config.rootPath || '',
|
|
172
|
+
boundary: source.boundary || ''
|
|
173
|
+
};
|
|
174
|
+
if (source.url) out.url = source.url;
|
|
175
|
+
return out;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function compactAsset(asset = {}) {
|
|
179
|
+
const source = compactRecordSource(asset.source || {});
|
|
180
|
+
return {
|
|
181
|
+
id: asset.id || '',
|
|
182
|
+
name: asset.name || asset.path || 'asset',
|
|
183
|
+
path: asset.path || '',
|
|
184
|
+
type: asset.type || asset.mimeType || '',
|
|
185
|
+
size: Number(asset.size || asset.sizeBytes || 0),
|
|
186
|
+
kind: asset.kind || 'asset',
|
|
187
|
+
previewState: 'metadata-only',
|
|
188
|
+
cacheState: 'route-shell-material-unavailable',
|
|
189
|
+
materialAvailability: 'material-unavailable',
|
|
190
|
+
source
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function compactWorkspaceCandidate(candidate = {}) {
|
|
195
|
+
const source = compactRecordSource(candidate.source || {});
|
|
196
|
+
return {
|
|
197
|
+
id: candidate.id || '',
|
|
198
|
+
title: candidate.title || candidate.name || candidate.path || 'Workspace candidate',
|
|
199
|
+
name: candidate.name || candidate.title || '',
|
|
200
|
+
path: candidate.path || '',
|
|
201
|
+
kind: candidate.kind || 'workspace-candidate',
|
|
202
|
+
summary: candidate.summary || '',
|
|
203
|
+
cacheState: 'route-shell-material-unavailable',
|
|
204
|
+
materialAvailability: 'material-unavailable',
|
|
205
|
+
source
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function compactImportLogEntry(entry = {}) {
|
|
210
|
+
return {
|
|
211
|
+
kind: entry.kind || entry.adapterId || 'import',
|
|
212
|
+
at: entry.at || entry.createdAt || '',
|
|
213
|
+
ok: entry.ok !== false,
|
|
214
|
+
message: entry.message || '',
|
|
215
|
+
counts: entry.counts ? Object.assign({}, entry.counts) : undefined
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function compactRecord(record = {}) {
|
|
220
|
+
const source = compactRecordSource(record.source || {});
|
|
221
|
+
const sourceBacked = isSourceBackedShell(record, source);
|
|
222
|
+
const routeMarkdown = routeRecordMarkdown(record);
|
|
223
|
+
const materialUnavailable = !String(routeMarkdown || '').trim();
|
|
224
|
+
const out = {
|
|
225
|
+
id: record.id || '',
|
|
226
|
+
title: record.title || '',
|
|
227
|
+
summary: record.summary || '',
|
|
228
|
+
kind: record.kind || '',
|
|
229
|
+
status: record.status || '',
|
|
230
|
+
currentCreatedAt: record.currentCreatedAt || '',
|
|
231
|
+
createdAt: record.createdAt || '',
|
|
232
|
+
path: record.path || '',
|
|
233
|
+
markdown: routeMarkdown,
|
|
234
|
+
sourceMode: record.sourceMode || (sourceBacked ? 'source-backed' : 'local-route-shell'),
|
|
235
|
+
cacheState: materialUnavailable ? 'route-shell-material-unavailable' : 'route-issue-snapshot-cache-complete',
|
|
236
|
+
materialAvailability: materialUnavailable ? 'material-unavailable' : 'available',
|
|
237
|
+
hasContinuityContext: Boolean(record.hasContinuityContext),
|
|
238
|
+
hasIntegrity: Boolean(record.hasIntegrity),
|
|
239
|
+
schemaId: record.schemaId || '',
|
|
240
|
+
envelopeSchemaId: record.envelopeSchemaId || '',
|
|
241
|
+
parentSchemaId: record.parentSchemaId || '',
|
|
242
|
+
trace: record.trace || '',
|
|
243
|
+
origin: record.origin || '',
|
|
244
|
+
boundary: record.boundary || source.boundary || '',
|
|
245
|
+
source
|
|
246
|
+
};
|
|
247
|
+
const sourceTarget = compactSourceTarget(record.sourceTarget || null);
|
|
248
|
+
if (sourceTarget) out.sourceTarget = sourceTarget;
|
|
249
|
+
const snapshot = compactSnapshot(record.snapshot || null);
|
|
250
|
+
if (snapshot) out.snapshot = snapshot;
|
|
251
|
+
return out;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function routeRecordMarkdown(record = {}) {
|
|
255
|
+
if (!isIssueSnapshotRecord(record)) return '';
|
|
256
|
+
const markdown = String(record.markdown || '');
|
|
257
|
+
if (!markdown.trim()) return '';
|
|
258
|
+
if (markdown.length > ROUTE_ISSUE_MARKDOWN_LIMIT) return '';
|
|
259
|
+
return markdown;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function isIssueSnapshotRecord(record = {}) {
|
|
263
|
+
return String(record?.sourceTarget?.surface || '') === 'issueSnapshots'
|
|
264
|
+
|| String(record?.snapshot?.schema || '') === 'tiinex.github.issueSnapshot.v1'
|
|
265
|
+
|| /(^|\/)\.issues\/github\//.test(String(record.path || ''));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function compactSourceTarget(sourceTarget = null) {
|
|
269
|
+
if (!sourceTarget || typeof sourceTarget !== 'object') return null;
|
|
270
|
+
const out = {};
|
|
271
|
+
for (const key of ['schema', 'surface', 'targetKind', 'inputTarget', 'sourceArtifactPath', 'materializedCommit', 'parentArtifactPath', 'parentRawUrl', 'parentSourceUrl', 'sourceUpdatedAt', 'sourceSortAt', 'gitCommittedAt', 'committedAt', 'transportTier']) {
|
|
272
|
+
if (sourceTarget[key] != null && sourceTarget[key] !== '') out[key] = sourceTarget[key];
|
|
273
|
+
}
|
|
274
|
+
if (sourceTarget.loaded != null) out.loaded = Boolean(sourceTarget.loaded);
|
|
275
|
+
return Object.keys(out).length ? out : null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function compactSnapshot(snapshot = null) {
|
|
279
|
+
if (!snapshot || typeof snapshot !== 'object') return null;
|
|
280
|
+
const out = {};
|
|
281
|
+
for (const key of ['schema', 'embedded', 'sourceKind', 'sourceUrl', 'method', 'sourceArtifactPath', 'parentArtifactPath', 'parentRawUrl', 'parentSourceUrl', 'sourceUpdatedAt', 'sourceSortAt', 'comments', 'state', 'author']) {
|
|
282
|
+
if (snapshot[key] != null && snapshot[key] !== '') out[key] = snapshot[key];
|
|
283
|
+
}
|
|
284
|
+
if (snapshot.target && typeof snapshot.target === 'object') {
|
|
285
|
+
out.target = {};
|
|
286
|
+
for (const key of ['repository', 'kind', 'number', 'canonicalUrl', 'apiUrl', 'input', 'directRawUrl', 'directRawFormat']) {
|
|
287
|
+
if (snapshot.target[key] != null && snapshot.target[key] !== '') out.target[key] = snapshot.target[key];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return Object.keys(out).length ? out : null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function isSourceBackedAsset(asset = {}, source = {}) {
|
|
294
|
+
const adapter = String(source.adapterId || asset.source?.adapterId || '').toLowerCase();
|
|
295
|
+
return adapter === 'github' || source.kind === 'github-tree' || source.sourceKind === 'github.repo';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function isSourceBackedShell(record = {}, source = {}) {
|
|
299
|
+
const adapter = String(source.adapterId || record.source?.adapterId || '').toLowerCase();
|
|
300
|
+
const mode = String(record.sourceMode || '').toLowerCase();
|
|
301
|
+
return adapter === 'github' || mode === 'source-backed' || Boolean(source.repo || source.config?.repo);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function validateRouteOwnershipState(routeState) {
|
|
305
|
+
if (!routeState || typeof routeState !== 'object' || Array.isArray(routeState)) return { ok: false, reason: 'route-not-object' };
|
|
306
|
+
const routeVersion = routeState.v == null ? null : Number(routeState.v);
|
|
307
|
+
const legacyVersion = routeState.version == null ? null : Number(routeState.version);
|
|
308
|
+
const canonical = routeVersion === STATE_VERSION;
|
|
309
|
+
const legacy = routeVersion === 1 || (routeVersion == null && legacyVersion === 1);
|
|
310
|
+
if (!canonical && !legacy) return { ok: false, reason: 'route-version-unsupported' };
|
|
311
|
+
if (!Array.isArray(routeState.workspaces)) return { ok: false, reason: 'route-workspaces-missing' };
|
|
312
|
+
if (routeState.view != null && (typeof routeState.view !== 'object' || Array.isArray(routeState.view))) return { ok: false, reason: 'route-view-invalid' };
|
|
313
|
+
for (const workspace of routeState.workspaces) {
|
|
314
|
+
if (!workspace || typeof workspace !== 'object' || Array.isArray(workspace)) return { ok: false, reason: 'route-workspace-invalid' };
|
|
315
|
+
if (!String(workspace.id || '').trim()) return { ok: false, reason: 'route-workspace-id-missing' };
|
|
316
|
+
}
|
|
317
|
+
if (legacy) return { ok: true, reason: routeState.workspaces.length ? 'route-owned-legacy-v1' : 'route-owned-legacy-v1-empty' };
|
|
318
|
+
return { ok: true, reason: routeState.workspaces.length ? 'route-owned-workspaces' : 'route-owned-empty' };
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function routeHasWorkspaces(routeState) {
|
|
322
|
+
return Array.isArray(routeState?.workspaces) && routeState.workspaces.length > 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function normalizeRouteState(routeState, lifecycle) {
|
|
326
|
+
const semanticRoute = semanticRouteState(routeState);
|
|
327
|
+
const empty = lifecycle?.makeEmptyAppState?.() || { version: 1, activeWorkspaceId: '', view: {}, workspaces: [], audit: null };
|
|
328
|
+
if (!routeState || !routeHasWorkspaces(semanticRoute)) return empty;
|
|
329
|
+
const next = lifecycle?.cloneState?.(Object.assign({}, empty, semanticRoute)) || JSON.parse(JSON.stringify(Object.assign({}, empty, semanticRoute)));
|
|
330
|
+
next.view = Object.assign({ universe: 'column', workspaceVerse: 'feed', reader: 'scan', query: '', displayOptions: { leavesFirst: false, leavesOnly: true, mismatchesOnly: false, showSupportingMarkdown: false, showWorkspaceArtifacts: true, showAssets: false, schemaFilter: 'all', artifactFilter: 'all' } }, next.view || {});
|
|
331
|
+
next.workspaces = Array.isArray(next.workspaces) ? next.workspaces.map(normalizeRouteWorkspaceShell) : [];
|
|
332
|
+
next.activeWorkspaceId = next.workspaces.some((workspace) => workspace.id === next.activeWorkspaceId)
|
|
333
|
+
? next.activeWorkspaceId
|
|
334
|
+
: (next.workspaces[0]?.id || '');
|
|
335
|
+
return next;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
function normalizeRouteWorkspaceShell(workspace = {}) {
|
|
340
|
+
return Object.assign({}, workspace, {
|
|
341
|
+
source: workspace.source ? compactSource(workspace.source) : workspace.source,
|
|
342
|
+
sources: Array.isArray(workspace.sources) ? workspace.sources.map(compactSource) : [],
|
|
343
|
+
records: Array.isArray(workspace.records) ? workspace.records.map(normalizeRouteRecordShell) : [],
|
|
344
|
+
assets: Array.isArray(workspace.assets) ? workspace.assets.map(normalizeRouteAssetShell) : [],
|
|
345
|
+
workspaceMemberBindings: compactWorkspaceMemberBindings(workspace.workspaceMemberBindings),
|
|
346
|
+
...(Array.isArray(workspace.workspaceMergeCandidates) && workspace.workspaceMergeCandidates.length ? { workspaceMergeCandidates: workspace.workspaceMergeCandidates.map(normalizeRouteWorkspaceCandidateShell) } : {})
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function normalizeRouteAssetShell(asset = {}) {
|
|
351
|
+
const source = compactSource(asset.source || {});
|
|
352
|
+
return Object.assign({}, asset, {
|
|
353
|
+
source,
|
|
354
|
+
content: '',
|
|
355
|
+
dataUrl: '',
|
|
356
|
+
previewState: 'metadata-only',
|
|
357
|
+
cacheState: 'route-shell-material-unavailable',
|
|
358
|
+
materialAvailability: 'material-unavailable',
|
|
359
|
+
routeShell: asset.routeShell !== false,
|
|
360
|
+
materialUnavailable: true
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function normalizeRouteWorkspaceCandidateShell(candidate = {}) {
|
|
365
|
+
const source = compactRecordSource(candidate.source || {});
|
|
366
|
+
return Object.assign({}, candidate, {
|
|
367
|
+
source,
|
|
368
|
+
markdown: '',
|
|
369
|
+
cacheState: 'route-shell-material-unavailable',
|
|
370
|
+
materialAvailability: 'material-unavailable',
|
|
371
|
+
routeShell: candidate.routeShell !== false,
|
|
372
|
+
materialUnavailable: true
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function normalizeRouteRecordShell(record = {}) {
|
|
377
|
+
const source = compactRecordSource(record.source || {});
|
|
378
|
+
const markdown = String(record.markdown || '');
|
|
379
|
+
const materialAvailability = markdown.trim() ? 'available' : 'material-unavailable';
|
|
380
|
+
const inlineCacheState = isIssueSnapshotRecord(record) ? 'route-issue-snapshot-cache-complete' : 'route-inline-material-cache-complete';
|
|
381
|
+
return Object.assign({}, record, {
|
|
382
|
+
source,
|
|
383
|
+
markdown,
|
|
384
|
+
sourceMode: record.sourceMode || (isSourceBackedShell(record, source) ? 'source-backed' : 'local-route-shell'),
|
|
385
|
+
cacheState: materialAvailability === 'available' ? inlineCacheState : 'route-shell-material-unavailable',
|
|
386
|
+
materialAvailability,
|
|
387
|
+
routeShell: record.routeShell !== false,
|
|
388
|
+
materialUnavailable: materialAvailability === 'material-unavailable'
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function routeHistoryState(routeState, explicitIndex, existingState = null, statePatch = null) {
|
|
393
|
+
const index = Number.isFinite(Number(explicitIndex)) ? Number(explicitIndex) : Date.now();
|
|
394
|
+
const out = existingState && typeof existingState === 'object' && !Array.isArray(existingState) ? Object.assign({}, existingState) : {};
|
|
395
|
+
Object.assign(out, routeSummary(routeState), { __tiinexRouteIndex: index });
|
|
396
|
+
if (statePatch && typeof statePatch === 'object') {
|
|
397
|
+
for (const [key, value] of Object.entries(statePatch)) {
|
|
398
|
+
if (value == null) delete out[key];
|
|
399
|
+
else out[key] = value;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return out;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
function routeSummary(routeState) {
|
|
406
|
+
return {
|
|
407
|
+
v: routeState?.v || STATE_VERSION,
|
|
408
|
+
workspaces: Array.isArray(routeState?.workspaces) ? routeState.workspaces.length : 0,
|
|
409
|
+
activeWorkspaceId: routeState?.activeWorkspaceId || '',
|
|
410
|
+
workspaceVerse: routeState?.view?.workspaceVerse || 'feed',
|
|
411
|
+
query: routeState?.view?.query || ''
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
global.TiinexWorkspaceRoute = {
|
|
416
|
+
HASH_PREFIX,
|
|
417
|
+
STATE_VERSION,
|
|
418
|
+
compactRecord,
|
|
419
|
+
compactSource,
|
|
420
|
+
compactWorkspace,
|
|
421
|
+
compactAsset,
|
|
422
|
+
compactWorkspaceCandidate,
|
|
423
|
+
makeRouteState,
|
|
424
|
+
semanticRouteView,
|
|
425
|
+
semanticRouteState,
|
|
426
|
+
normalizeRouteState,
|
|
427
|
+
validateRouteOwnershipState,
|
|
428
|
+
routeHasWorkspaces,
|
|
429
|
+
routeSummary,
|
|
430
|
+
routeHistoryState
|
|
431
|
+
};
|
|
432
|
+
})(typeof window !== 'undefined' ? window : globalThis);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function workspaceRuntimeCandidateViolations(state = {}) {
|
|
2
|
+
const workspaces = Array.isArray(state?.workspaces) ? state.workspaces : [];
|
|
3
|
+
return workspaces.flatMap((workspace) => {
|
|
4
|
+
if (!workspace || !Object.prototype.hasOwnProperty.call(workspace, 'workspaceMergeCandidates')) return [];
|
|
5
|
+
const candidates = Array.isArray(workspace.workspaceMergeCandidates) ? workspace.workspaceMergeCandidates : [];
|
|
6
|
+
return [{ workspaceId: workspace.id || '', count: candidates.length, reason: 'legacy-candidate-shape-present' }];
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function assertCanonicalWorkspaceRuntimeState(state = {}, boundary = 'runtime') {
|
|
11
|
+
const violations = workspaceRuntimeCandidateViolations(state);
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
ok: violations.length === 0,
|
|
14
|
+
schema: 'tiinex.workspace.runtime-canonicality.v1',
|
|
15
|
+
boundary,
|
|
16
|
+
violations: Object.freeze(violations)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import{makeLocalSource}from'./workspace.localSourceLifecycle.js';
|
|
2
|
+
import{restoreLocalShadowForRemovedSource,restoreLocalSnapshotsForRemovedSourceRecord}from'./workspace.materialReconciliation.js';
|
|
3
|
+
const SOURCE_STATES = new Set(['not-started', 'deferred', 'loading', 'loaded', 'partial', 'failed', 'unavailable']);
|
|
4
|
+
|
|
5
|
+
export function stateWithSourceMaterialCleared(state = {}, workspaceId = '', sourceId = '', options = {}) {
|
|
6
|
+
const next = cloneState(state);
|
|
7
|
+
const workspace = (next.workspaces || []).find((item) => item.id === (workspaceId || next.activeWorkspaceId));
|
|
8
|
+
const cleanId = String(sourceId || '').trim();
|
|
9
|
+
if (!workspace || !cleanId || cleanId === 'local') return { ok: false, error: workspace ? 'source.material.clear.refused' : 'workspace.not.found', state };
|
|
10
|
+
const source = (Array.isArray(workspace.sources) ? workspace.sources : []).find((item) => item.id === cleanId);
|
|
11
|
+
if (!source || source.kind !== 'github-tree') return { ok: false, error: 'source.not.configured', state };
|
|
12
|
+
const counts = clearSourceMaterialFromWorkspace(workspace, cleanId, { surfaces: options.surfaces });
|
|
13
|
+
const remainingCount = countSourceRecords(workspace, cleanId);
|
|
14
|
+
workspace.sources = upsertSource(workspace.sources, Object.assign({}, source, { count: remainingCount, discoveryState: normalizeSourceDiscoveryState(options.discoveryState || 'deferred') }));
|
|
15
|
+
workspace.sourceOrder = workspace.sources.map((item) => item.id);
|
|
16
|
+
const selected = String(next.view?.selectedRecordId || '').trim();
|
|
17
|
+
if (selected && !workspaceHasRecord(workspace, selected)) next.view = Object.assign(next.view || {}, { selectedRecordId: '', lineageLoadReport: null, lineageAuditReport: null });
|
|
18
|
+
next.activeWorkspaceId = workspace.id;
|
|
19
|
+
return { ok: true, counts, workspace, state: next };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function clearSourceMaterialFromWorkspace(workspace = {}, sourceId = '', options = {}) {
|
|
23
|
+
const cleanId = String(sourceId || '').trim();
|
|
24
|
+
const counts = { records: 0, assets: 0 };
|
|
25
|
+
if (!workspace || !cleanId) return counts;
|
|
26
|
+
const surfaceSet = new Set((Array.isArray(options.surfaces) ? options.surfaces : []).map((item) => String(item || '').trim()).filter(Boolean));
|
|
27
|
+
const keep = (item) => {
|
|
28
|
+
if (String(item?.source?.id || '') !== cleanId) return true;
|
|
29
|
+
if (!surfaceSet.size) return false;
|
|
30
|
+
return !surfaceSet.has(String(item?.sourceTarget?.surface || '').trim());
|
|
31
|
+
};
|
|
32
|
+
const beforeRecords = Array.isArray(workspace.records) ? workspace.records : [];
|
|
33
|
+
let removedRecords = 0;
|
|
34
|
+
workspace.records = beforeRecords.flatMap((record) => {
|
|
35
|
+
if (keep(record)) return [restoreLocalShadowForRemovedSource(record, cleanId)];
|
|
36
|
+
removedRecords += 1;
|
|
37
|
+
const restored = restoreLocalSnapshotsForRemovedSourceRecord(record);
|
|
38
|
+
return restored ? [restored] : [];
|
|
39
|
+
});
|
|
40
|
+
counts.records = removedRecords;
|
|
41
|
+
const beforeAssets = Array.isArray(workspace.assets) ? workspace.assets : [];
|
|
42
|
+
workspace.assets = beforeAssets.filter(keep);
|
|
43
|
+
counts.assets = beforeAssets.length - workspace.assets.length;
|
|
44
|
+
if (workspace.discoveryProgress?.sourceId === cleanId) workspace.discoveryProgress = null;
|
|
45
|
+
return counts;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function countSourceRecords(workspace = {}, sourceId = '') {
|
|
49
|
+
const cleanId = String(sourceId || '').trim();
|
|
50
|
+
return Array.isArray(workspace.records) ? workspace.records.filter((record) => String(record?.source?.id || '') === cleanId).length : 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function workspaceHasRecord(workspace = {}, recordId = '') {
|
|
54
|
+
const id = String(recordId || '').trim();
|
|
55
|
+
return Boolean(id && Array.isArray(workspace.records) && workspace.records.some((record) => String(record?.id || '') === id));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function upsertSource(sources = [], source = {}) {
|
|
59
|
+
const hasLocal = sources.some((item) => item.id === 'local');
|
|
60
|
+
const local = hasLocal ? [] : [makeLocalSource()];
|
|
61
|
+
return local.concat(sources.filter((item) => item.id !== source.id), [source]);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function normalizeSourceDiscoveryState(value = '') {
|
|
65
|
+
const candidate = String(value || '').trim();
|
|
66
|
+
return SOURCE_STATES.has(candidate) ? candidate : 'deferred';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function cloneState(state = {}) {
|
|
70
|
+
return JSON.parse(JSON.stringify(Object.assign({ version: 1, activeWorkspaceId: '', view: {}, workspaces: [] }, state || {})));
|
|
71
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{githubIssueLogicalPathForRecord as issuePath}from'@tiinex/core/workspaces/workspace.recordPaths.js';
|
|
2
|
+
|
|
3
|
+
export function canonicalizeSourceRecordPath(input={},source={}){const t=input.sourceTarget||{},s=input.snapshot||{},raw=t.inputTarget||t.url||s.sourceUrl||s.target?.canonicalUrl||input.recoveredFromUrl||input.path||input.name||'',surface=String(t.surface||'').toLowerCase(),mode=String(input.sourceMode||'').toLowerCase(),kind=String(t.targetKind||'').toLowerCase(),issue=surface==='issuesnapshots'||mode.includes('issue-snapshot')||mode.includes('github-issue')||mode.includes('github-comment')||/^https?:\/\/github\.com\/[^/]+\/[^/]+\/(issues|discussions|pull)\/\d+/i.test(String(raw||input.path||''));if(!issue)return canonicalizeSourcePath(input.path||input.name||'',source);const p=issuePath(input);if(s.embedded||/embedded-artifact|lineage-parent/.test(kind)||mode.includes('embedded-artifact'))return canonicalizeSourcePath(t.sourceArtifactPath||s.sourceArtifactPath||p||input.path||input.name||'',{});return p?canonicalizeSourcePath(p,{}):canonicalizeExternalSourceTarget(raw,{preserveHash:kind.includes('comment')||/issuecomment-|discussioncomment-/i.test(String(raw||''))});}
|
|
4
|
+
function canonicalizeExternalSourceTarget(value='',options={}){const raw=String(value||'').trim();if(!raw)return'';try{const u=new URL(raw),h=String(u.hostname||'').toLowerCase(),path=u.pathname.replace(/\/+$/g,''),hash=options.preserveHash?String(u.hash||''):'';return`${(h==='github.com'||h.endsWith('.github.com'))?'https://github.com':u.origin}${path}${hash}`;}catch(_){const clean=raw.replace(/\?utm_[^#]*/g,'').replace(/\/+$/g,'');return options.preserveHash?clean:clean.replace(/#.*$/g,'');}}
|
|
5
|
+
function canonicalizeSourcePath(inputPath,source={}){let p=String(inputPath||'').trim();if(!p)return'';try{const u=new URL(p),h=String(u.hostname||'').toLowerCase(),parts=u.pathname.split('/').filter(Boolean),bi=parts.indexOf('blob');p=h==='raw.githubusercontent.com'?(parts.length>=4?parts.slice(3).join('/'):parts.join('/')):h.endsWith('github.com')?((bi>=0&&parts.length>bi+2)?parts.slice(bi+2).join('/'):parts.join('/')):u.pathname.replace(/^\/+/,'');}catch(_){}p=p.replace(/\\/g,'/').replace(/\/{2,}/g,'/');const out=[];for(const part of p.split('/')){if(!part||part==='.')continue;if(part==='..')out.pop();else out.push(part);}p=out.join('/');const roots=String(source.rootPath||'').split(/\r?\n|,/).map((item)=>item.trim().replace(/^\.\//,'').replace(/^\/+/, '').replace(/\/+$/,'')).filter((item)=>item&&item!=='.');if(roots.length){const root=roots.find((item)=>p===item||p.startsWith(item+'/'))||roots[0];if(root&&p&&!p.startsWith(root+'/')&&p!==root)p=root+'/'+p;else if(root&&!p)p=root;}return p.replace(/\/+$/,'');}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { reconcileSourceRecordWithWorkspace } from './workspace.materialReconciliation.js';
|
|
2
|
+
import { schemaIdForRecord } from '@tiinex/core/schemas/schema.identity.js';
|
|
3
|
+
|
|
4
|
+
export function addWorkspaceSourceRecordsWithReconciliation(state, workspaceId, sourceId, inputs = [], options = {}, runtime = {}) {
|
|
5
|
+
const records = Array.isArray(inputs) ? inputs : [];
|
|
6
|
+
const next = runtime.cloneState(state);
|
|
7
|
+
const targetId = workspaceId || next.activeWorkspaceId;
|
|
8
|
+
const workspace = next.workspaces.find((item) => item.id === targetId);
|
|
9
|
+
if (!workspace) return { ok: false, error: 'workspace.not.found', state };
|
|
10
|
+
const existingSource = Array.isArray(workspace.sources) ? workspace.sources.find((s) => s.id === sourceId) : null;
|
|
11
|
+
if (!existingSource) return { ok: false, error: 'source.not.found', state };
|
|
12
|
+
if (existingSource.kind !== runtime.CONFIGURED_SOURCE_KIND) return { ok: false, error: 'source.not.configured', state };
|
|
13
|
+
const added = [];
|
|
14
|
+
for (const input of records) {
|
|
15
|
+
const title = runtime.normalizeRecordTitle(input.title || input.name);
|
|
16
|
+
if (!title) continue;
|
|
17
|
+
const createdAt = runtime.nowIso(options.clock);
|
|
18
|
+
const canonicalPath = runtime.canonicalizeSourceRecordPath(input, existingSource);
|
|
19
|
+
const deterministicId = `source:${existingSource.id}:${canonicalPath || 'root'}`;
|
|
20
|
+
const record = Object.assign({}, input, {
|
|
21
|
+
id: deterministicId,
|
|
22
|
+
title,
|
|
23
|
+
summary: runtime.normalizeRecordSummary(input.summary || input.body || 'Source-backed material added in Tiinex.'),
|
|
24
|
+
kind: input.kind || 'local.material',
|
|
25
|
+
status: input.status || 'local',
|
|
26
|
+
createdAt: input.createdAt || createdAt.slice(0, 10),
|
|
27
|
+
path: canonicalPath || '',
|
|
28
|
+
markdown: input.markdown || '',
|
|
29
|
+
sourceMode: input.sourceMode || 'source-backed',
|
|
30
|
+
hasContinuityContext: Boolean(input.hasContinuityContext),
|
|
31
|
+
hasIntegrity: Boolean(input.hasIntegrity),
|
|
32
|
+
source: Object.assign({}, existingSource)
|
|
33
|
+
});
|
|
34
|
+
const reconciled = reconcileSourceRecordWithWorkspace(workspace, record, existingSource);
|
|
35
|
+
if (reconciled.action === 'insert') {
|
|
36
|
+
workspace.records = [record].concat(Array.isArray(workspace.records) ? workspace.records : []);
|
|
37
|
+
added.push(record);
|
|
38
|
+
} else {
|
|
39
|
+
const finalRecord = reconciled.record || record;
|
|
40
|
+
added.push(finalRecord);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!added.length) return { ok: false, error: 'records.empty', state };
|
|
44
|
+
const count = workspace.records.filter((r) => r.source && r.source.id === existingSource.id).length;
|
|
45
|
+
const materializedSource = Object.assign({}, existingSource, {
|
|
46
|
+
count,
|
|
47
|
+
discoveryState: runtime.normalizeSourceDiscoveryState(options.discoveryState || 'loaded', 'loaded')
|
|
48
|
+
});
|
|
49
|
+
workspace.sources = runtime.ensureWorkspaceSources(workspace);
|
|
50
|
+
runtime.upsertSource(workspace, materializedSource);
|
|
51
|
+
next.activeWorkspaceId = workspace.id;
|
|
52
|
+
if (!options.preserveView) next.view = Object.assign({ universe: 'column', workspaceVerse: 'feed', reader: 'scan', query: '' }, next.view || {}, { workspaceVerse: 'feed' });
|
|
53
|
+
const finalWorkspace = runtime.activeWorkspace(next);
|
|
54
|
+
return { ok: true, records: added, workspace: finalWorkspace, state: next, receipt: buildSourceRecordInsertReceipt({ sourceId: existingSource.id, inputRecords: records, addedRecords: added, workspace: finalWorkspace }) };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isWorkspaceRecord(record = {}) {
|
|
58
|
+
const schema = schemaIdForRecord(record).toLowerCase();
|
|
59
|
+
const path = String(record.path || record.sourceTarget?.sourceArtifactPath || '').trim().toLowerCase();
|
|
60
|
+
return schema === 'tiinex.workspace.v1' || schema.includes('.workspace.') || /\.workspace\.md$/i.test(path);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildSourceRecordInsertReceipt({ sourceId = '', inputRecords = [], addedRecords = [], workspace = {} } = {}) {
|
|
64
|
+
const sourceRecords = (Array.isArray(workspace.records) ? workspace.records : []).filter((record) => String(record?.source?.id || '') === String(sourceId || ''));
|
|
65
|
+
const sourceWorkspaceArtifacts = sourceRecords.filter(isWorkspaceRecord).length;
|
|
66
|
+
return Object.freeze({
|
|
67
|
+
schema: 'tiinex.workspace.source-material.receipt.v1',
|
|
68
|
+
sourceId,
|
|
69
|
+
rawAdapterRecords: Array.isArray(inputRecords) ? inputRecords.length : 0,
|
|
70
|
+
returnedRecords: Array.isArray(addedRecords) ? addedRecords.length : 0,
|
|
71
|
+
sourceRecords: sourceRecords.length,
|
|
72
|
+
sourceWorkspaceArtifacts,
|
|
73
|
+
hiddenOrGroupedRecords: Math.max(0, Number(inputRecords.length || 0) - sourceRecords.length)
|
|
74
|
+
});
|
|
75
|
+
}
|