@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,106 @@
|
|
|
1
|
+
import { canonicalProductState } from './productStateBoundary.js';
|
|
2
|
+
import { persistenceWriteEnvForOwnership } from './persistenceOwnership.js';
|
|
3
|
+
|
|
4
|
+
export function createStatePersistenceScheduler(win = globalThis, options = {}) {
|
|
5
|
+
const state = {
|
|
6
|
+
timer: null,
|
|
7
|
+
idle: null,
|
|
8
|
+
pending: null,
|
|
9
|
+
writes: 0,
|
|
10
|
+
deferred: 0,
|
|
11
|
+
flushed: 0,
|
|
12
|
+
lastReason: ''
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const clearTimer = () => {
|
|
16
|
+
if (state.timer && win?.clearTimeout) win.clearTimeout(state.timer);
|
|
17
|
+
state.timer = null;
|
|
18
|
+
};
|
|
19
|
+
const clearIdle = () => {
|
|
20
|
+
if (state.idle && typeof win?.cancelIdleCallback === 'function') win.cancelIdleCallback(state.idle);
|
|
21
|
+
state.idle = null;
|
|
22
|
+
};
|
|
23
|
+
const clearScheduled = () => { clearTimer(); clearIdle(); };
|
|
24
|
+
|
|
25
|
+
function writeNow(entry, reason = 'write') {
|
|
26
|
+
if (!entry?.state?.workspaces?.length) return null;
|
|
27
|
+
state.writes += 1;
|
|
28
|
+
state.lastReason = reason;
|
|
29
|
+
entry.runtime?.().persistence?.writeState?.(entry.state, persistenceWriteEnvForOwnership(options.persistenceOwnership, { mode: entry.mode || 'replace' }));
|
|
30
|
+
return entry.state;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function flush(reason = 'flush') {
|
|
34
|
+
const entry = state.pending;
|
|
35
|
+
state.pending = null;
|
|
36
|
+
clearScheduled();
|
|
37
|
+
if (!entry) return null;
|
|
38
|
+
state.flushed += 1;
|
|
39
|
+
return writeNow(entry, reason);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function schedule(entry = {}, options = {}) {
|
|
43
|
+
if (!entry?.state?.workspaces?.length) return null;
|
|
44
|
+
state.pending = entry;
|
|
45
|
+
state.deferred += 1;
|
|
46
|
+
state.lastReason = options.reason || 'deferred';
|
|
47
|
+
clearScheduled();
|
|
48
|
+
const delayMs = Math.max(0, Number(options.delayMs ?? 180));
|
|
49
|
+
const idleTimeout = Math.max(0, Number(options.idleTimeout ?? 1600));
|
|
50
|
+
const run = () => {
|
|
51
|
+
state.timer = null;
|
|
52
|
+
const idleRun = () => {
|
|
53
|
+
state.idle = null;
|
|
54
|
+
flush(options.reason || 'idle');
|
|
55
|
+
};
|
|
56
|
+
if (typeof win?.requestIdleCallback === 'function') state.idle = win.requestIdleCallback(idleRun, { timeout: idleTimeout });
|
|
57
|
+
else state.timer = win?.setTimeout?.(idleRun, Math.max(60, Math.min(450, idleTimeout))) || null;
|
|
58
|
+
};
|
|
59
|
+
state.timer = win?.setTimeout?.(run, delayMs) || null;
|
|
60
|
+
return entry.state;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function cancel() {
|
|
64
|
+
state.pending = null;
|
|
65
|
+
clearScheduled();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function report() {
|
|
69
|
+
return {
|
|
70
|
+
pending: Boolean(state.pending),
|
|
71
|
+
writes: state.writes,
|
|
72
|
+
deferred: state.deferred,
|
|
73
|
+
flushed: state.flushed,
|
|
74
|
+
lastReason: state.lastReason
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return { schedule, flush, cancel, report };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
export function commitStateWithPersistence({ nextState, mode = 'push', options = {}, sourceState = {}, preserveCapturedViewScroll, latestStateRef, setState, runtime, scheduler, persistenceOwnership } = {}) {
|
|
83
|
+
const withScroll = preserveCapturedViewScroll?.(nextState, sourceState) || nextState;
|
|
84
|
+
const persistence = runtime?.().persistence || {};
|
|
85
|
+
const canonicalState = canonicalProductState(withScroll, persistence, 'commit');
|
|
86
|
+
if (latestStateRef) latestStateRef.current = canonicalState;
|
|
87
|
+
setState?.(canonicalState);
|
|
88
|
+
const persistenceEnv = persistenceWriteEnvForOwnership(persistenceOwnership, { mode, preserveUrl: Boolean(options.preserveUrl) });
|
|
89
|
+
if (!canonicalState?.workspaces?.length) {
|
|
90
|
+
scheduler?.cancel?.();
|
|
91
|
+
if (options.allowEmptySemanticState) persistence.writeState?.(canonicalState, persistenceEnv);
|
|
92
|
+
else persistence.clearState?.(persistenceEnv);
|
|
93
|
+
return canonicalState;
|
|
94
|
+
}
|
|
95
|
+
if (options.deferPersistence) {
|
|
96
|
+
scheduler?.schedule?.({ state: canonicalState, mode, runtime }, {
|
|
97
|
+
reason: options.persistenceReason || 'view-state',
|
|
98
|
+
delayMs: options.persistenceDelayMs,
|
|
99
|
+
idleTimeout: options.persistenceIdleTimeout
|
|
100
|
+
});
|
|
101
|
+
return canonicalState;
|
|
102
|
+
}
|
|
103
|
+
scheduler?.cancel?.();
|
|
104
|
+
persistence.writeState?.(canonicalState, persistenceEnv);
|
|
105
|
+
return canonicalState;
|
|
106
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { workspaceEntrypointApplies } from '../workspaces/workspace.entrypoints.js';
|
|
2
|
+
|
|
3
|
+
export function tiinexAppConfigSourceToStartupPlan(result = {}) {
|
|
4
|
+
const config = result.config || {};
|
|
5
|
+
const entrypoints = (Array.isArray(config.workspaceEntrypoints) ? config.workspaceEntrypoints : [])
|
|
6
|
+
.filter(workspaceEntrypointApplies)
|
|
7
|
+
.map((entrypoint, index) => workspaceSourceToGithubInput(entrypoint, {
|
|
8
|
+
result,
|
|
9
|
+
config,
|
|
10
|
+
plan: 'workspace-entrypoints',
|
|
11
|
+
preserveView: false,
|
|
12
|
+
preferredDisplay: '',
|
|
13
|
+
fallbackLabel: entrypoint.workspaceLabel || entrypoint.label || entrypoint.name || `Workspace ${index + 1}`
|
|
14
|
+
}))
|
|
15
|
+
.filter(Boolean);
|
|
16
|
+
if (entrypoints.length) return { ok: true, selectedPlan: 'workspace-entrypoints', input: entrypoints[0], inputs: entrypoints };
|
|
17
|
+
const discovery = firstWorkspaceDiscovery(config);
|
|
18
|
+
const mappedDiscovery = workspaceSourceToGithubInput(discovery, {
|
|
19
|
+
result,
|
|
20
|
+
config,
|
|
21
|
+
plan: 'workspace-discovery',
|
|
22
|
+
preserveView: true,
|
|
23
|
+
preferredDisplay: 'workspace-artifacts',
|
|
24
|
+
fallbackLabel: discovery?.label || discovery?.title || config.viewerIdentity?.browserTitle || ''
|
|
25
|
+
});
|
|
26
|
+
if (mappedDiscovery) return { ok: true, selectedPlan: 'workspace-discovery', input: mappedDiscovery, inputs: [mappedDiscovery] };
|
|
27
|
+
return { ok: false, message: 'The Tiinex app config did not declare an openable workspace entrypoint or GitHub workspace discovery target.' };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function tiinexAppConfigSourceToGithubInput(result = {}) {
|
|
31
|
+
const config = result.config || {};
|
|
32
|
+
const explicitEntrypoint = result.entrypoint && workspaceEntrypointApplies(result.entrypoint) ? result.entrypoint : null;
|
|
33
|
+
const entrypoint = explicitEntrypoint || firstWorkspaceEntrypoint(config);
|
|
34
|
+
const preferEntrypoint = shouldPreferWorkspaceEntrypoint(result);
|
|
35
|
+
const discovery = preferEntrypoint ? null : firstWorkspaceDiscovery(config);
|
|
36
|
+
const source = discovery || entrypoint;
|
|
37
|
+
const input = workspaceSourceToGithubInput(source, {
|
|
38
|
+
result,
|
|
39
|
+
config,
|
|
40
|
+
plan: discovery ? 'workspace-discovery' : 'workspace-entrypoint',
|
|
41
|
+
preserveView: Boolean(discovery),
|
|
42
|
+
preferredDisplay: discovery ? 'workspace-artifacts' : '',
|
|
43
|
+
fallbackLabel: source?.label || source?.name || source?.title || config.viewerIdentity?.browserTitle || ''
|
|
44
|
+
});
|
|
45
|
+
if (!input) return { ok: false, message: 'The Tiinex app config did not declare a GitHub repository or workspace discovery target.' };
|
|
46
|
+
return { ok: true, selectedPlan: discovery ? 'workspace-discovery' : 'workspace-entrypoint', input };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function workspaceSourceToGithubInput(source = null, { result = {}, config = {}, plan = 'workspace-entrypoint', preserveView = false, preferredDisplay = '', fallbackLabel = '' } = {}) {
|
|
50
|
+
if (!source) return null;
|
|
51
|
+
const sourceKind = String(source?.sourceKind || source?.kind || '').trim() || 'github-tree';
|
|
52
|
+
const repository = String(source?.repository || source?.repo || githubRepositoryFromUrl(source?.href || source?.url || '') || '').trim();
|
|
53
|
+
if (!repository) return null;
|
|
54
|
+
const discoveryMode = plan === 'workspace-discovery';
|
|
55
|
+
return {
|
|
56
|
+
repository,
|
|
57
|
+
ref: source.ref || '',
|
|
58
|
+
rootPath: source.rootPath || '.topics',
|
|
59
|
+
operation: 'materialize',
|
|
60
|
+
repoDiscovery: discoveryMode ? true : truthyConfigValue(source.repoFilesDiscovery ?? source.repoDiscovery ?? true),
|
|
61
|
+
issueDiscovery: discoveryMode ? false : truthyConfigValue(source.issueDiscovery ?? source.issueSnapshots ?? false),
|
|
62
|
+
issueUrls: discoveryMode ? '' : (source.issueUrl || source.issueUrls || ''),
|
|
63
|
+
label: source.workspaceLabel || source.label || source.name || source.title || fallbackLabel || config.viewerIdentity?.browserTitle || repository,
|
|
64
|
+
workspaceLabel: source.workspaceLabel || source.label || source.name || source.title || fallbackLabel || config.viewerIdentity?.browserTitle || repository,
|
|
65
|
+
fileRefs: source.fileRefs || source.explicitMarkdownPaths || '',
|
|
66
|
+
sourceKind,
|
|
67
|
+
appConfigSourceUrl: result.configUrl || result.targetUrl || '',
|
|
68
|
+
appConfigPlan: plan,
|
|
69
|
+
workspaceMatch: source.match || source.pattern || '',
|
|
70
|
+
openBehavior: source.openBehavior || '',
|
|
71
|
+
preserveView,
|
|
72
|
+
preferredDisplay,
|
|
73
|
+
hostedRepoMirrorBaseUrls: source.hostedRepoMirrorBaseUrls || source.repositoryMirrorBaseUrls || [],
|
|
74
|
+
hostedIssueSnapshotBaseUrls: source.hostedIssueSnapshotBaseUrls || source.mirrorIssueSnapshotBaseUrls || []
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function shouldPreferWorkspaceEntrypoint(result = {}) {
|
|
79
|
+
const convention = String(result?.diagnostics?.selectedConvention || '').toLowerCase();
|
|
80
|
+
return /github-issue|public-build-issue-sync|workspace-state/.test(convention);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function firstWorkspaceEntrypoint(config = {}) {
|
|
84
|
+
return Array.isArray(config.workspaceEntrypoints) ? config.workspaceEntrypoints.find(workspaceEntrypointApplies) || null : null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function firstWorkspaceDiscovery(config = {}) {
|
|
88
|
+
const items = Array.isArray(config.workspaceDiscovery) ? config.workspaceDiscovery : [];
|
|
89
|
+
return items.find((item) => String(item?.kind || item?.sourceKind || '').trim().toLowerCase().includes('github') || githubRepositoryFromUrl(item?.href || item?.url || '') || item?.repository || item?.repo) || items[0] || null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function githubRepositoryFromUrl(value = '') {
|
|
93
|
+
try {
|
|
94
|
+
const url = new URL(String(value || '').trim());
|
|
95
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
96
|
+
if ((url.hostname === 'github.com' || url.hostname.endsWith('.github.com')) && parts.length >= 2) return `${parts[0]}/${parts[1]}`;
|
|
97
|
+
if (url.hostname === 'raw.githubusercontent.com' && parts.length >= 2) return `${parts[0]}/${parts[1]}`;
|
|
98
|
+
} catch (_) {}
|
|
99
|
+
const match = String(value || '').trim().match(/^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)(?:\.git)?$/u);
|
|
100
|
+
return match ? `${match[1]}/${match[2]}` : '';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function truthyConfigValue(value) {
|
|
104
|
+
if (typeof value === 'boolean') return value;
|
|
105
|
+
const text = String(value ?? '').trim().toLowerCase();
|
|
106
|
+
if (!text) return false;
|
|
107
|
+
return !['off', 'false', 'no', '0', 'disabled'].includes(text);
|
|
108
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { extractConfigLinks, extractEmbeddedWorkspaceMarkdowns, extractHostedViewerSourceDeclarations, extractRuntimeWorkspaceDeclarations, extractScriptUrls, isLikelyConfigUrl, looksLikeWorkspaceConfig, normalizeConfigTargetUrl, normalizeNewlines, normalizeWorkspaceBootstrapCandidate, parseGithubIssueSpec, sameOriginOrExplicit, scriptFileName, sourceDeclarationFromPublicBuildIdentity, toFetchableWorkspaceUrl, tryFetchText, workspaceUrlFromPointerMarkdown } from './tiinexHostedWorkspaceConventions.js';
|
|
2
|
+
import { tiinexAppConfigSourceToGithubInput, tiinexAppConfigSourceToStartupPlan } from './tiinexAppConfigPlan.js';
|
|
3
|
+
import { workspaceEntrypointApplies } from '../workspaces/workspace.entrypoints.js';
|
|
4
|
+
export { tiinexAppConfigSourceToGithubInput, tiinexAppConfigSourceToStartupPlan } from './tiinexAppConfigPlan.js';
|
|
5
|
+
|
|
6
|
+
const DEFAULT_CONFIG_PATHS = Object.freeze([
|
|
7
|
+
'/.well-known/tiinex/workspace.md',
|
|
8
|
+
'/tiinex.workspace.md',
|
|
9
|
+
'/viewer.workspace.md',
|
|
10
|
+
'/workspace.md',
|
|
11
|
+
'/.topics/.workspaces/viewer.workspace.md'
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
const MAX_SCRIPT_CANDIDATES = 8;
|
|
15
|
+
|
|
16
|
+
export function tiinexAppConfigUrlCandidates(targetUrl = '', options = {}) {
|
|
17
|
+
const url = normalizeConfigTargetUrl(targetUrl, options.baseUrl);
|
|
18
|
+
if (!url) return [];
|
|
19
|
+
const candidates = [];
|
|
20
|
+
const add = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
const href = toFetchableWorkspaceUrl(new URL(value, url).href);
|
|
23
|
+
if (!candidates.includes(href)) candidates.push(href);
|
|
24
|
+
} catch (_) {}
|
|
25
|
+
};
|
|
26
|
+
if (isLikelyConfigUrl(url)) add(url.href);
|
|
27
|
+
for (const path of DEFAULT_CONFIG_PATHS) add(`${url.origin}${path}`);
|
|
28
|
+
return candidates;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function firstReadableWorkspaceConfig(candidates = [], context = {}) {
|
|
32
|
+
const { fetchImpl, target, parseWorkspaceConfig, diagnostics, selectedConvention } = context;
|
|
33
|
+
for (const href of candidates || []) {
|
|
34
|
+
const fetched = await tryFetchText(fetchImpl, href, 'text/markdown,text/plain,application/json,*/*');
|
|
35
|
+
if (!fetched.ok || !looksLikeWorkspaceConfig(fetched.text)) continue;
|
|
36
|
+
return successFromMarkdown({ markdown: fetched.text, configUrl: href, target, parseWorkspaceConfig, diagnostics: Object.assign({}, diagnostics, { selectedConvention }) });
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function fetchTiinexAppConfigSource(targetUrl = '', options = {}) {
|
|
42
|
+
const fetchImpl = options.fetchImpl || globalThis.fetch;
|
|
43
|
+
const parseWorkspaceConfig = options.parseWorkspaceConfig || ((markdown) => ({ workspaceEntrypoints: [] }));
|
|
44
|
+
const target = normalizeConfigTargetUrl(targetUrl, options.baseUrl);
|
|
45
|
+
if (!target) return failure('Enter a Tiinex app URL.');
|
|
46
|
+
if (typeof fetchImpl !== 'function') return failure('Fetch is unavailable in this browser.');
|
|
47
|
+
|
|
48
|
+
const explicitCandidates = [];
|
|
49
|
+
const fallbackCandidates = [];
|
|
50
|
+
const runtimeCandidates = [];
|
|
51
|
+
const embeddedWorkspaces = [];
|
|
52
|
+
const hostedViewerSources = [];
|
|
53
|
+
const scriptUrls = [];
|
|
54
|
+
const diagnostics = { html: 'unavailable', candidates: [], explicitCandidates, fallbackCandidates, runtimeCandidates: [], hostedViewerSources: [], scripts: [], publicBuildIdentity: null };
|
|
55
|
+
|
|
56
|
+
const addCandidate = (value, source = 'explicit') => {
|
|
57
|
+
try {
|
|
58
|
+
const href = toFetchableWorkspaceUrl(new URL(value, target).href);
|
|
59
|
+
const bucket = source === 'convention-path' ? fallbackCandidates : explicitCandidates;
|
|
60
|
+
if (!bucket.includes(href)) bucket.push(href);
|
|
61
|
+
if (!diagnostics.candidates.includes(href)) diagnostics.candidates.push(href);
|
|
62
|
+
return href;
|
|
63
|
+
} catch (_) { return ''; }
|
|
64
|
+
};
|
|
65
|
+
const addRuntimeCandidate = (candidate, source = '') => {
|
|
66
|
+
const normalized = normalizeWorkspaceBootstrapCandidate(candidate, { source, role: source || 'hosted-runtime' });
|
|
67
|
+
if (!normalized) return;
|
|
68
|
+
const key = `${normalized.kind}\n${normalized.url || ''}\n${normalized.path || ''}`;
|
|
69
|
+
if (runtimeCandidates.some((item) => `${item.kind}\n${item.url || ''}\n${item.path || ''}` === key)) return;
|
|
70
|
+
runtimeCandidates.push(normalized);
|
|
71
|
+
diagnostics.runtimeCandidates.push({ kind: normalized.kind, role: normalized.role || '', source: normalized.source || source || '', url: normalized.url || '', path: normalized.path || '' });
|
|
72
|
+
};
|
|
73
|
+
const addEmbeddedWorkspace = (markdown, sourceUrl = '') => {
|
|
74
|
+
if (!looksLikeWorkspaceConfig(markdown)) return;
|
|
75
|
+
embeddedWorkspaces.push({ markdown, sourceUrl: sourceUrl || target.href });
|
|
76
|
+
};
|
|
77
|
+
const addHostedViewerSource = (source = {}, sourceUrl = '') => {
|
|
78
|
+
if (!source?.repository) return;
|
|
79
|
+
const key = `${source.repository}\n${source.ref || ''}\n${source.rootPath || ''}`;
|
|
80
|
+
if (hostedViewerSources.some((item) => `${item.repository}\n${item.ref || ''}\n${item.rootPath || ''}` === key)) return;
|
|
81
|
+
const item = Object.assign({ sourceUrl: sourceUrl || target.href }, source);
|
|
82
|
+
hostedViewerSources.push(item);
|
|
83
|
+
diagnostics.hostedViewerSources.push({ repository: item.repository, ref: item.ref || '', rootPath: item.rootPath || '', sourceUrl: item.sourceUrl || '', convention: item.hostedConvention || '' });
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
if (isLikelyConfigUrl(target)) addCandidate(target.href, 'target-url');
|
|
87
|
+
|
|
88
|
+
const html = await tryFetchText(fetchImpl, target.href, 'text/html,application/xhtml+xml,text/plain,*/*');
|
|
89
|
+
if (html.ok) {
|
|
90
|
+
diagnostics.html = 'read';
|
|
91
|
+
extractConfigLinks(html.text, target.href).forEach((href) => addCandidate(href, 'html-link'));
|
|
92
|
+
extractScriptUrls(html.text, target.href).forEach((href) => {
|
|
93
|
+
if (!scriptUrls.includes(href) && sameOriginOrExplicit(href, target.href)) scriptUrls.push(href);
|
|
94
|
+
});
|
|
95
|
+
extractRuntimeWorkspaceDeclarations(html.text, target.href).forEach((candidate) => addRuntimeCandidate(candidate, 'html-runtime'));
|
|
96
|
+
extractHostedViewerSourceDeclarations(html.text, target.href).forEach((source) => addHostedViewerSource(source, target.href));
|
|
97
|
+
extractEmbeddedWorkspaceMarkdowns(html.text, target.href).forEach((item) => addEmbeddedWorkspace(item.markdown, item.sourceUrl || target.href));
|
|
98
|
+
} else {
|
|
99
|
+
diagnostics.html = html.reason || 'unavailable';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
for (const href of scriptUrls.slice(0, MAX_SCRIPT_CANDIDATES)) {
|
|
103
|
+
const script = await tryFetchText(fetchImpl, href, 'application/javascript,text/javascript,text/plain,*/*');
|
|
104
|
+
diagnostics.scripts.push({ url: href, ok: script.ok, reason: script.ok ? 'read' : script.reason || 'unavailable' });
|
|
105
|
+
if (!script.ok) continue;
|
|
106
|
+
extractConfigLinks(script.text, href).forEach((link) => addCandidate(link, 'script-link'));
|
|
107
|
+
extractRuntimeWorkspaceDeclarations(script.text, href).forEach((candidate) => addRuntimeCandidate(candidate, `script:${scriptFileName(href)}`));
|
|
108
|
+
extractHostedViewerSourceDeclarations(script.text, href).forEach((source) => addHostedViewerSource(source, href));
|
|
109
|
+
extractEmbeddedWorkspaceMarkdowns(script.text, href).forEach((item) => addEmbeddedWorkspace(item.markdown, item.sourceUrl || href));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const buildIdentityUrl = publicBuildIdentityUrlFor(target);
|
|
114
|
+
if (buildIdentityUrl) {
|
|
115
|
+
const buildIdentity = await tryFetchText(fetchImpl, buildIdentityUrl, 'application/json,text/plain,*/*');
|
|
116
|
+
diagnostics.publicBuildIdentity = { url: buildIdentityUrl, ok: buildIdentity.ok, reason: buildIdentity.ok ? 'read' : buildIdentity.reason || 'unavailable' };
|
|
117
|
+
if (buildIdentity.ok) {
|
|
118
|
+
const pointer = workspacePointerCandidateFromPublicBuildIdentity(buildIdentity.text, buildIdentityUrl);
|
|
119
|
+
if (pointer) addRuntimeCandidate(pointer, 'public-build-identity');
|
|
120
|
+
const source = sourceDeclarationFromPublicBuildIdentity(buildIdentity.text, buildIdentityUrl);
|
|
121
|
+
if (source?.repository) addHostedViewerSource(source, buildIdentityUrl);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const explicitTargetConfig = isLikelyConfigUrl(target);
|
|
126
|
+
if (explicitTargetConfig) {
|
|
127
|
+
const resolved = await firstReadableWorkspaceConfig(explicitCandidates, { fetchImpl, target, parseWorkspaceConfig, diagnostics, selectedConvention: 'explicit-config' });
|
|
128
|
+
if (resolved?.ok) return resolved;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (!explicitTargetConfig) {
|
|
132
|
+
const resolved = await firstReadableWorkspaceConfig(strongHtmlConfigCandidates(explicitCandidates, target), { fetchImpl, target, parseWorkspaceConfig, diagnostics, selectedConvention: 'html-declared-config' });
|
|
133
|
+
if (resolved?.ok) return resolved;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
for (const runtimeCandidate of runtimeCandidates) {
|
|
137
|
+
const resolved = await resolveWorkspaceBootstrapCandidate(runtimeCandidate, { fetchImpl, target, parseWorkspaceConfig, diagnostics });
|
|
138
|
+
if (resolved?.ok) return resolved;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
for (const hostedSource of hostedViewerSources) {
|
|
142
|
+
return successFromHostedViewerSource({ source: hostedSource, configUrl: `${hostedSource.sourceUrl || target.href}#hosted-viewer-source`, target, diagnostics: Object.assign({}, diagnostics, { selectedConvention: hostedSource.hostedConvention || 'hosted-viewer-source' }) });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (!explicitTargetConfig) {
|
|
146
|
+
const resolved = await firstReadableWorkspaceConfig(weakHtmlConfigCandidates(explicitCandidates, target), { fetchImpl, target, parseWorkspaceConfig, diagnostics, selectedConvention: 'html-packaged-config' });
|
|
147
|
+
if (resolved?.ok) return resolved;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (const embedded of embeddedWorkspaces) {
|
|
151
|
+
return successFromMarkdown({ markdown: embedded.markdown, configUrl: `${embedded.sourceUrl || target.href}#embedded-default-workspace`, target, parseWorkspaceConfig, diagnostics: Object.assign({}, diagnostics, { selectedConvention: 'embedded-default-workspace' }) });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
tiinexAppConfigUrlCandidates(target.href).forEach((href) => addCandidate(href, 'convention-path'));
|
|
155
|
+
|
|
156
|
+
for (const href of fallbackCandidates) {
|
|
157
|
+
const fetched = await tryFetchText(fetchImpl, href, 'text/markdown,text/plain,application/json,*/*');
|
|
158
|
+
if (!fetched.ok || !looksLikeWorkspaceConfig(fetched.text)) continue;
|
|
159
|
+
return successFromMarkdown({ markdown: fetched.text, configUrl: href, target, parseWorkspaceConfig, diagnostics: Object.assign({}, diagnostics, { selectedConvention: 'convention-path' }) });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return failure(`No Tiinex workspace config was found at ${target.origin}.`, { targetUrl: target.href, diagnostics });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export async function resolveTiinexRuntimeWorkspaceCandidate(candidate = {}, options = {}) {
|
|
167
|
+
const fetchImpl = options.fetchImpl || globalThis.fetch;
|
|
168
|
+
const parseWorkspaceConfig = options.parseWorkspaceConfig || ((markdown) => ({ workspaceEntrypoints: [] }));
|
|
169
|
+
const target = normalizeConfigTargetUrl(options.targetUrl || options.locationLike?.href || globalThis.location?.href || candidate?.url || candidate?.path || '', options.baseUrl);
|
|
170
|
+
if (!target) return failure('Tiinex runtime workspace target is unavailable.');
|
|
171
|
+
return resolveWorkspaceBootstrapCandidate(candidate, { fetchImpl, target, parseWorkspaceConfig, diagnostics: options.diagnostics || {} });
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export async function resolveTiinexAppConfigGithubInput(targetUrl = '', options = {}) {
|
|
175
|
+
const result = await fetchTiinexAppConfigSource(targetUrl, options);
|
|
176
|
+
if (!result.ok) return result;
|
|
177
|
+
const mapped = tiinexAppConfigSourceToGithubInput(result);
|
|
178
|
+
if (!mapped.ok) return Object.assign({}, mapped, { diagnostics: result.diagnostics, configUrl: result.configUrl });
|
|
179
|
+
return Object.assign({}, mapped, { configUrl: result.configUrl, targetUrl: result.targetUrl, diagnostics: result.diagnostics });
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
function shouldPreferWorkspaceEntrypoint(result = {}) {
|
|
184
|
+
const convention = String(result?.diagnostics?.selectedConvention || '').toLowerCase();
|
|
185
|
+
return /github-issue|public-build-issue-sync|workspace-state/.test(convention);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function strongHtmlConfigCandidates(candidates = [], target) {
|
|
189
|
+
return (candidates || []).filter((href) => !isWeakPackagedWorkspaceConfigUrl(href, target));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function weakHtmlConfigCandidates(candidates = [], target) {
|
|
193
|
+
return (candidates || []).filter((href) => isWeakPackagedWorkspaceConfigUrl(href, target));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function isWeakPackagedWorkspaceConfigUrl(href = '', target) {
|
|
197
|
+
try {
|
|
198
|
+
const url = new URL(href, target?.href || undefined);
|
|
199
|
+
const path = url.pathname.replace(/\/+$/u, '');
|
|
200
|
+
return /(?:^|\/)\.topics\/\.workspaces\/viewer\.workspace\.md$/iu.test(path)
|
|
201
|
+
|| /(?:^|\/)viewer\.workspace\.md$/iu.test(path);
|
|
202
|
+
} catch (_) {
|
|
203
|
+
return /(?:^|\/)\.topics\/\.workspaces\/viewer\.workspace\.md(?:[?#].*)?$/iu.test(String(href || ''))
|
|
204
|
+
|| /(?:^|\/)viewer\.workspace\.md(?:[?#].*)?$/iu.test(String(href || ''));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function workspacePointerCandidateFromPublicBuildIdentity(text = '', baseUrl = '') {
|
|
209
|
+
let parsed = null;
|
|
210
|
+
try { parsed = JSON.parse(String(text || '').trim()); } catch (_) { return null; }
|
|
211
|
+
const repository = githubRepositoryFromUrl(parsed.repository || parsed.sourceRepository || parsed.repo || parsed.buildSource || '');
|
|
212
|
+
const reason = [parsed.reason, parsed.releaseCacheKey, parsed.previousReleaseCacheKey, parsed.type].map((value) => String(value || '').toLowerCase()).join(' ');
|
|
213
|
+
if (!repository || !/(?:^|[^a-z0-9])issue[-_]?sync(?:[^a-z0-9]|$)/iu.test(reason)) return null;
|
|
214
|
+
return { kind: 'github-issue-pointer', role: 'public-build-issue-sync-root', label: parsed.browserTitle || parsed.title || repository, url: `https://github.com/${repository}/issues/1`, source: baseUrl || 'tiinex.build.json' };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function publicBuildIdentityUrlFor(target) {
|
|
218
|
+
try {
|
|
219
|
+
if (!target || isLikelyConfigUrl(target)) return '';
|
|
220
|
+
if (!/^https?:$/i.test(target.protocol || '')) return '';
|
|
221
|
+
return new URL('/tiinex.build.json', target.href).href;
|
|
222
|
+
} catch (_) { return ''; }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function successFromMarkdown({ markdown, configUrl, target, parseWorkspaceConfig, diagnostics }) {
|
|
226
|
+
const config = parseWorkspaceConfig(markdown);
|
|
227
|
+
const entrypoint = firstWorkspaceEntrypoint(config);
|
|
228
|
+
return { ok: true, targetUrl: target.href, configUrl, markdown, config, entrypoint, diagnostics };
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function successFromHostedViewerSource({ source = {}, configUrl, target, diagnostics }) {
|
|
232
|
+
const entrypoint = {
|
|
233
|
+
name: source.label || source.repository || 'Hosted Tiinex source',
|
|
234
|
+
label: source.label || source.repository || 'Hosted Tiinex source',
|
|
235
|
+
sourceKind: source.sourceKind || 'github-tree',
|
|
236
|
+
repository: source.repository || source.repo || '',
|
|
237
|
+
ref: source.ref || '',
|
|
238
|
+
rootPath: source.rootPath || '.topics',
|
|
239
|
+
repoFilesDiscovery: source.repoFilesDiscovery || 'on',
|
|
240
|
+
issueDiscovery: source.issueDiscovery || 'off',
|
|
241
|
+
hostedRepoMirrorBaseUrls: source.hostedRepoMirrorBaseUrls || [],
|
|
242
|
+
hostedIssueSnapshotBaseUrls: source.hostedIssueSnapshotBaseUrls || []
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
ok: true,
|
|
246
|
+
targetUrl: target.href,
|
|
247
|
+
configUrl,
|
|
248
|
+
markdown: '',
|
|
249
|
+
config: {
|
|
250
|
+
source: { kind: 'hosted-viewer-source', path: configUrl },
|
|
251
|
+
viewerIdentity: { browserTitle: source.label || source.repository || 'Hosted Tiinex source' },
|
|
252
|
+
workspaceDiscovery: [],
|
|
253
|
+
workspaceEntrypoints: [entrypoint],
|
|
254
|
+
repositoryMirrors: [],
|
|
255
|
+
repositoryTransports: [],
|
|
256
|
+
help: []
|
|
257
|
+
},
|
|
258
|
+
entrypoint,
|
|
259
|
+
diagnostics
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function resolveWorkspaceBootstrapCandidate(candidate = {}, options = {}) {
|
|
264
|
+
const fetchImpl = options.fetchImpl;
|
|
265
|
+
const target = options.target;
|
|
266
|
+
const parseWorkspaceConfig = options.parseWorkspaceConfig;
|
|
267
|
+
const diagnostics = options.diagnostics || {};
|
|
268
|
+
const kind = String(candidate.kind || '').toLowerCase();
|
|
269
|
+
if (kind === 'github-issue-pointer') {
|
|
270
|
+
const pointer = await resolveGithubIssueWorkspacePointer(candidate.url, { fetchImpl, target, diagnostics });
|
|
271
|
+
if (!pointer.ok) return pointer;
|
|
272
|
+
if (pointer.markdown) return successFromMarkdown({ markdown: pointer.markdown, configUrl: pointer.configUrl, target, parseWorkspaceConfig, diagnostics: Object.assign({}, diagnostics, { selectedConvention: 'github-issue-embedded-workspace' }) });
|
|
273
|
+
return await resolveWorkspaceBootstrapCandidate({ kind: 'workspace-url', url: pointer.workspaceUrl, role: candidate.role, source: pointer.source || candidate.source }, options);
|
|
274
|
+
}
|
|
275
|
+
const raw = candidate.path || candidate.url;
|
|
276
|
+
if (!raw) return failure('Empty Tiinex runtime workspace candidate.', { diagnostics });
|
|
277
|
+
const href = toFetchableWorkspaceUrl(new URL(raw, target.href).href);
|
|
278
|
+
const fetched = await tryFetchText(fetchImpl, href, 'text/markdown,text/plain,application/json,*/*');
|
|
279
|
+
if (!fetched.ok || !looksLikeWorkspaceConfig(fetched.text)) return failure(`Runtime workspace candidate was unavailable: ${href}`, { diagnostics, configUrl: href });
|
|
280
|
+
return successFromMarkdown({ markdown: fetched.text, configUrl: href, target, parseWorkspaceConfig, diagnostics: Object.assign({}, diagnostics, { selectedConvention: kind || 'runtime-workspace' }) });
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
async function resolveGithubIssueWorkspacePointer(candidateUrl = '', options = {}) {
|
|
284
|
+
const fetchImpl = options.fetchImpl;
|
|
285
|
+
const target = options.target;
|
|
286
|
+
const spec = parseGithubIssueSpec(candidateUrl);
|
|
287
|
+
if (!spec) return failure(`Workspace pointer is not a GitHub issue URL: ${candidateUrl}`, { diagnostics: options.diagnostics });
|
|
288
|
+
|
|
289
|
+
const hostedBody = await tryFetchHostedIssuePointerBody(spec, { fetchImpl, target });
|
|
290
|
+
if (hostedBody.ok) {
|
|
291
|
+
const resolved = workspacePointerMarkdownResult(hostedBody.text, hostedBody.url || spec.issueUrl);
|
|
292
|
+
if (resolved.ok) return resolved;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const apiUrl = `https://api.github.com/repos/${spec.repo}/issues/${spec.number}`;
|
|
296
|
+
const fetched = await tryFetchText(fetchImpl, apiUrl, 'application/vnd.github+json,application/json,*/*');
|
|
297
|
+
if (!fetched.ok) return failure(`GitHub workspace pointer could not be read: ${spec.issueUrl}`, { diagnostics: options.diagnostics, configUrl: spec.issueUrl });
|
|
298
|
+
try {
|
|
299
|
+
const issue = JSON.parse(fetched.text || '{}');
|
|
300
|
+
const body = String(issue.body || '');
|
|
301
|
+
const resolved = workspacePointerMarkdownResult(body, issue.html_url || spec.issueUrl);
|
|
302
|
+
if (resolved.ok) return resolved;
|
|
303
|
+
} catch (_) {}
|
|
304
|
+
return failure(`GitHub issue ${spec.repo}#${spec.number} did not declare a workspace URL or embed workspace markdown.`, { diagnostics: options.diagnostics, configUrl: spec.issueUrl });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async function tryFetchHostedIssuePointerBody(spec = {}, options = {}) {
|
|
308
|
+
const fetchImpl = options.fetchImpl;
|
|
309
|
+
const target = options.target;
|
|
310
|
+
if (!target) return { ok: false };
|
|
311
|
+
const candidates = [
|
|
312
|
+
`/issues/github.com/${spec.repo}/issues/${spec.number}/issue.md`,
|
|
313
|
+
`/issues/github.com/${spec.owner}/${spec.name}/issues/${spec.number}/issue.md`
|
|
314
|
+
].map((path) => new URL(path, target.origin).href);
|
|
315
|
+
for (const href of [...new Set(candidates)]) {
|
|
316
|
+
const fetched = await tryFetchText(fetchImpl, href, 'text/markdown,text/plain,*/*');
|
|
317
|
+
if (fetched.ok && fetched.text) return { ok: true, text: fetched.text, url: href };
|
|
318
|
+
}
|
|
319
|
+
return { ok: false };
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function workspacePointerMarkdownResult(markdown = '', baseUrl = '') {
|
|
323
|
+
const embedded = extractEmbeddedWorkspaceMarkdowns(markdown, baseUrl).find((item) => looksLikeWorkspaceConfig(item.markdown || ''));
|
|
324
|
+
if (embedded) return { ok: true, markdown: embedded.markdown, configUrl: `${baseUrl || 'github-issue'}#embedded-workspace`, source: baseUrl };
|
|
325
|
+
if (looksLikeWorkspaceConfig(markdown)) return { ok: true, markdown: String(markdown || '').trim(), configUrl: `${baseUrl || 'github-issue'}#workspace-markdown`, source: baseUrl };
|
|
326
|
+
const workspaceUrl = workspaceUrlFromPointerMarkdown(markdown, baseUrl);
|
|
327
|
+
if (workspaceUrl) return { ok: true, workspaceUrl, source: baseUrl, configUrl: workspaceUrl };
|
|
328
|
+
return failure('Workspace pointer did not declare a workspace URL.');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
function firstWorkspaceEntrypoint(config = {}) {
|
|
333
|
+
return Array.isArray(config.workspaceEntrypoints) ? config.workspaceEntrypoints.find(workspaceEntrypointApplies) || null : null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function githubRepositoryFromUrl(value = '') {
|
|
337
|
+
try {
|
|
338
|
+
const url = new URL(String(value || '').trim());
|
|
339
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
340
|
+
if ((url.hostname === 'github.com' || url.hostname.endsWith('.github.com')) && parts.length >= 2) return `${parts[0]}/${parts[1]}`;
|
|
341
|
+
if (url.hostname === 'raw.githubusercontent.com' && parts.length >= 2) return `${parts[0]}/${parts[1]}`;
|
|
342
|
+
} catch (_) {}
|
|
343
|
+
const match = String(value || '').trim().match(/^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)(?:\.git)?$/u);
|
|
344
|
+
return match ? `${match[1]}/${match[2]}` : '';
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function failure(message, extra = {}) {
|
|
348
|
+
return Object.assign({ ok: false, message }, extra);
|
|
349
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { fetchTiinexAppConfigSource, resolveTiinexRuntimeWorkspaceCandidate, tiinexAppConfigSourceToStartupPlan } from './tiinexAppConfigSource.js';
|
|
2
|
+
import { normalizeWorkspaceBootstrapCandidate } from './tiinexHostedWorkspaceConventions.js';
|
|
3
|
+
|
|
4
|
+
export function tiinexAppStartupRequestContext(options = {}) {
|
|
5
|
+
const locationLike = options.locationLike || globalThis.location || { href: '', search: '' };
|
|
6
|
+
let params;
|
|
7
|
+
try { params = new URLSearchParams(locationLike.search || new URL(locationLike.href || '', 'http://localhost/').search || ''); } catch (_) { params = new URLSearchParams(''); }
|
|
8
|
+
const pointer = params.get('workspacePointer') || params.get('issueWorkspace') || params.get('viewerWorkspacePointer') || params.get('workspaceIssue') || '';
|
|
9
|
+
const workspace = params.get('viewerWorkspace') || params.get('workspace') || params.get('viewerConfig') || params.get('config') || params.get('identity') || '';
|
|
10
|
+
return Object.freeze({ explicitQueryRequested: Boolean(pointer || workspace), pointer, workspace });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function tiinexAppStartupCandidates(options = {}) {
|
|
14
|
+
const locationLike = options.locationLike || globalThis.location || { href: '', search: '' };
|
|
15
|
+
const hostInput = options.hostWorkspace !== undefined
|
|
16
|
+
? options.hostWorkspace
|
|
17
|
+
: (options.windowObj?.TiinexWorkspace || options.windowObj?.tiinexWorkspace || options.windowObj?.TIINEX_WORKSPACE || globalThis.TiinexWorkspace || globalThis.tiinexWorkspace || globalThis.TIINEX_WORKSPACE || {});
|
|
18
|
+
const host = typeof hostInput === 'string' ? { defaultWorkspace: hostInput } : (hostInput && typeof hostInput === 'object' ? hostInput : {});
|
|
19
|
+
const candidates = [];
|
|
20
|
+
const add = (input, defaults = {}) => {
|
|
21
|
+
const normalized = normalizeWorkspaceBootstrapCandidate(input, defaults);
|
|
22
|
+
if (normalized) candidates.push(normalized);
|
|
23
|
+
};
|
|
24
|
+
const requestContext = tiinexAppStartupRequestContext({ locationLike });
|
|
25
|
+
if (requestContext.pointer) add({ kind: 'github-issue-pointer', url: requestContext.pointer }, { role: 'query-primary', label: 'Query workspace pointer', source: 'query' });
|
|
26
|
+
if (requestContext.workspace) add({ kind: 'workspace-url', url: requestContext.workspace }, { role: 'query-workspace', label: 'Query workspace', source: 'query' });
|
|
27
|
+
if (Array.isArray(host.candidates)) host.candidates.forEach((candidate, index) => add(candidate, { role: `runtime-${index + 1}`, source: 'window.TiinexWorkspace.candidates' }));
|
|
28
|
+
if (host.pointer) add(host.pointer, { kind: 'github-issue-pointer', role: 'runtime-pointer', label: 'Runtime workspace pointer', source: 'window.TiinexWorkspace.pointer' });
|
|
29
|
+
if (Array.isArray(host.pointers)) host.pointers.forEach((value, index) => add(value, { kind: 'github-issue-pointer', role: `runtime-pointer-${index + 1}`, source: 'window.TiinexWorkspace.pointers' }));
|
|
30
|
+
for (const key of ['defaultWorkspace', 'workspace', 'viewerWorkspace']) if (host[key]) add({ kind: 'workspace-url', url: host[key] }, { role: `runtime-${key}`, label: key, source: `window.TiinexWorkspace.${key}` });
|
|
31
|
+
if (host.fallbackWorkspace) add({ kind: 'workspace-url', url: host.fallbackWorkspace }, { role: 'runtime-fallback', label: 'Runtime fallback workspace', source: 'window.TiinexWorkspace.fallbackWorkspace' });
|
|
32
|
+
if (Array.isArray(host.fallbacks)) host.fallbacks.forEach((value, index) => add(value, { kind: 'workspace-url', role: `runtime-fallback-${index + 1}`, source: 'window.TiinexWorkspace.fallbacks' }));
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
return candidates.filter((candidate) => {
|
|
35
|
+
const key = `${candidate.kind}\n${candidate.url || ''}\n${candidate.path || ''}`;
|
|
36
|
+
if (seen.has(key)) return false;
|
|
37
|
+
seen.add(key);
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function resolveTiinexAppStartupGithubInput(targetUrl = '', options = {}) {
|
|
43
|
+
const fetchImpl = options.fetchImpl || globalThis.fetch;
|
|
44
|
+
const parseWorkspaceConfig = options.parseWorkspaceConfig || ((markdown) => ({ workspaceEntrypoints: [] }));
|
|
45
|
+
const startupCandidates = tiinexAppStartupCandidates(options);
|
|
46
|
+
const requestContext = tiinexAppStartupRequestContext(options);
|
|
47
|
+
const diagnostics = { startupCandidates: startupCandidates.map(compactCandidate), attempts: [], explicitQueryRequested: requestContext.explicitQueryRequested };
|
|
48
|
+
for (const candidate of startupCandidates) {
|
|
49
|
+
const attempt = Object.assign(compactCandidate(candidate), { ok: false });
|
|
50
|
+
diagnostics.attempts.push(attempt);
|
|
51
|
+
const resolved = await resolveTiinexRuntimeWorkspaceCandidate(candidate, { fetchImpl, parseWorkspaceConfig, targetUrl, locationLike: options.locationLike, diagnostics });
|
|
52
|
+
if (!resolved?.ok) { attempt.error = resolved?.message || resolved?.error || 'unavailable'; continue; }
|
|
53
|
+
attempt.ok = true;
|
|
54
|
+
return mapStartupResult(resolved, 'explicit-runtime-config', diagnostics, requestContext);
|
|
55
|
+
}
|
|
56
|
+
const hosted = await fetchTiinexAppConfigSource(targetUrl, { fetchImpl, parseWorkspaceConfig, baseUrl: options.baseUrl });
|
|
57
|
+
if (!hosted?.ok) return Object.assign({}, hosted || { ok: false, message: 'No hosted Tiinex startup config was found.' }, { startupClass: 'unresolved', explicitQueryRequested: requestContext.explicitQueryRequested, diagnostics: Object.assign({}, hosted?.diagnostics || {}, diagnostics) });
|
|
58
|
+
const convention = String(hosted.diagnostics?.selectedConvention || '').toLowerCase();
|
|
59
|
+
const startupClass = /embedded-default-workspace|convention-path/.test(convention) ? 'packaged-fallback-config' : 'hosted-config';
|
|
60
|
+
return mapStartupResult(hosted, startupClass, diagnostics, requestContext);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function mapStartupResult(result = {}, startupClass = '', diagnostics = {}, requestContext = {}) {
|
|
64
|
+
const mapped = tiinexAppConfigSourceToStartupPlan(result);
|
|
65
|
+
if (!mapped.ok) return Object.assign({}, mapped, { startupClass, explicitQueryRequested: Boolean(requestContext.explicitQueryRequested), diagnostics: result.diagnostics, configUrl: result.configUrl });
|
|
66
|
+
return Object.assign({}, mapped, {
|
|
67
|
+
startupClass,
|
|
68
|
+
explicitQueryRequested: Boolean(requestContext.explicitQueryRequested),
|
|
69
|
+
markdown: result.markdown || '',
|
|
70
|
+
config: result.config || {},
|
|
71
|
+
configUrl: result.configUrl || '',
|
|
72
|
+
targetUrl: result.targetUrl || '',
|
|
73
|
+
diagnostics: Object.assign({}, result.diagnostics || {}, diagnostics, { selectedConvention: result.diagnostics?.selectedConvention || '' })
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function compactCandidate(candidate = {}) {
|
|
78
|
+
return { kind: candidate.kind || '', role: candidate.role || '', source: candidate.source || '', url: candidate.url || '', path: candidate.path || '' };
|
|
79
|
+
}
|