@tiinex/core 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 +45 -0
- package/package.json +176 -0
- package/src/actions/record.actions.js +312 -0
- package/src/adapters/adapter.contracts.js +143 -0
- package/src/adapters/archive/archive.adapter.js +502 -0
- package/src/adapters/archive/archive.portableChangeset.js +141 -0
- package/src/adapters/archive/archive.transport.js +124 -0
- package/src/artifacts/artifact.localDraft.js +27 -0
- package/src/artifacts/artifact.normalize.js +28 -0
- package/src/artifacts/artifact.parse.js +207 -0
- package/src/artifacts/artifact.record.js +83 -0
- package/src/audit/audit.run.js +103 -0
- package/src/audit/audit.summary.js +7 -0
- package/src/diagnostics/sourceBoundary.report.js +112 -0
- package/src/export/package.apply.js +349 -0
- package/src/export/package.builder.js +366 -0
- package/src/export/package.bytes.js +164 -0
- package/src/export/package.controlIntegrity.js +42 -0
- package/src/export/package.controlTopology.js +97 -0
- package/src/export/package.fileMap.js +174 -0
- package/src/export/package.manifest.js +401 -0
- package/src/export/package.preflight.js +204 -0
- package/src/export/package.sourceReference.js +81 -0
- package/src/export/package.workspaceContext.js +144 -0
- package/src/export/package.zip.js +128 -0
- package/src/export/tree.bundle.js +278 -0
- package/src/governance/governance.boundary.js +196 -0
- package/src/integrity/integrity.c14nV2.js +190 -0
- package/src/integrity/integrity.methodReference.js +73 -0
- package/src/integrity/integrity.validate.js +56 -0
- package/src/lineage/lineage.candidateResolution.js +46 -0
- package/src/lineage/lineage.githubIssueComment.js +106 -0
- package/src/lineage/lineage.githubIssueLocal.js +196 -0
- package/src/lineage/lineage.githubIssueTarget.js +89 -0
- package/src/lineage/lineage.integrity.js +133 -0
- package/src/lineage/lineage.materialPreference.js +26 -0
- package/src/lineage/lineage.model.js +63 -0
- package/src/lineage/lineage.parentAuthority.js +5 -0
- package/src/lineage/lineage.parentBinding.js +104 -0
- package/src/lineage/lineage.pathBasis.js +47 -0
- package/src/lineage/lineage.resolve.js +388 -0
- package/src/lineage/lineage.sourceScope.js +74 -0
- package/src/lineage/lineage.targetKeys.js +80 -0
- package/src/lineage/lineage.traverse.js +132 -0
- package/src/public/applicationProjection.js +236 -0
- package/src/public/companionResources.js +246 -0
- package/src/public/index.js +16 -0
- package/src/public/node.js +2 -0
- package/src/public/schemaAncestry.js +26 -0
- package/src/publication/publication.contract.js +196 -0
- package/src/publication/publication.preflight.js +159 -0
- package/src/publication/publication.targetContract.js +241 -0
- package/src/reingest/reingest.plan.js +162 -0
- package/src/release/plan.mjs +28 -0
- package/src/release/policy.mjs +100 -0
- package/src/release/run.mjs +74 -0
- package/src/schemas/capability.registry.js +226 -0
- package/src/schemas/companion.js +245 -0
- package/src/schemas/contracts.js +6 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.js +14 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.json +23 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.runtime.json +4283 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.source.js +9 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.js +26 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.json +23 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.runtime.json +1985 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.source.js +9 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.js +14 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.json +24 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.runtime.json +1700 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.capabilities.js +14 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.en.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.findings.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.presenter.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.js +32 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.json +24 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.runtime.json +2184 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.sv.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.transitions.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.validate.js +10 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.js +14 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.json +23 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.runtime.json +1773 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.capabilities.js +11 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.contract.js +40 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.en.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.findings.js +12 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.localMaterialization.js +89 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.presenter.js +8 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.js +34 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.json +23 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.runtime.json +2029 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.sv.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.transitions.js +1 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.validate.js +25 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.capabilities.js +14 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.en.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.findings.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.presenter.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.js +31 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.json +23 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.runtime.json +2033 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.source.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.sv.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.transitions.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.validate.js +10 -0
- package/src/schemas/core/relation/tiinex.relation.v1.capabilities.js +7 -0
- package/src/schemas/core/relation/tiinex.relation.v1.contract.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.findings.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.localMaterialization.js +153 -0
- package/src/schemas/core/relation/tiinex.relation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.js +20 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.json +23 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.runtime.json +1668 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/tiinex.relation.v1.validate.js +36 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.capabilities.js +14 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.contract.js +57 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.findings.js +13 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.js +20 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.json +24 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.runtime.json +3315 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.validate.js +78 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.js +14 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.json +23 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.runtime.json +1733 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.capabilities.js +11 -0
- package/src/schemas/core/task/tiinex.task.v1.contract.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.en.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.findings.js +18 -0
- package/src/schemas/core/task/tiinex.task.v1.localMaterialization.js +148 -0
- package/src/schemas/core/task/tiinex.task.v1.presenter.js +8 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.js +35 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.json +23 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.runtime.json +1708 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.sv.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.transitions.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.validate.js +41 -0
- package/src/schemas/core/topic/tiinex.topic.v1.capabilities.js +14 -0
- package/src/schemas/core/topic/tiinex.topic.v1.creation.js +46 -0
- package/src/schemas/core/topic/tiinex.topic.v1.en.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.findings.js +11 -0
- package/src/schemas/core/topic/tiinex.topic.v1.localMaterialization.js +135 -0
- package/src/schemas/core/topic/tiinex.topic.v1.presenter.js +1 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.js +34 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.json +23 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.runtime.json +1699 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.source.js +9 -0
- package/src/schemas/core/topic/tiinex.topic.v1.sv.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.transitions.js +31 -0
- package/src/schemas/core/topic/tiinex.topic.v1.validate.js +11 -0
- package/src/schemas/creation.capability.js +289 -0
- package/src/schemas/creation.contracts.js +334 -0
- package/src/schemas/creation.executionSnapshot.js +79 -0
- package/src/schemas/creation.factoryQualification.js +73 -0
- package/src/schemas/creation.renderer.js +244 -0
- package/src/schemas/creation.representation.js +279 -0
- package/src/schemas/creation.rootMetadata.js +6 -0
- package/src/schemas/creation.schemaReferences.js +65 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.js +14 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.json +23 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.runtime.json +1873 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.source.js +9 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.js +14 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.json +23 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.runtime.json +1839 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.source.js +9 -0
- package/src/schemas/generic.artifact.module.js +25 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.js +26 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.json +23 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.runtime.json +2249 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.source.js +9 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.js +26 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.json +24 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.runtime.json +2091 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.capabilities.js +14 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.en.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.findings.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.presenter.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.js +29 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.json +21 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.runtime.json +2180 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.sv.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.transitions.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.validate.js +1 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.js +26 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.json +23 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.runtime.json +1733 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.source.js +9 -0
- package/src/schemas/reference.shapes.js +33 -0
- package/src/schemas/registry.js +36 -0
- package/src/schemas/resolver.js +13 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.capabilities.js +14 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.en.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.findings.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.presenter.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.js +29 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.json +21 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.runtime.json +2093 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.source.js +9 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.sv.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.transitions.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.validate.js +1 -0
- package/src/schemas/schema.factory.descriptor.js +104 -0
- package/src/schemas/schema.githubSourceTarget.js +131 -0
- package/src/schemas/schema.identity.js +10 -0
- package/src/schemas/schema.reference.js +133 -0
- package/src/schemas/schema.source.js +239 -0
- package/src/schemas/tiinex.root.v1.capabilities.js +14 -0
- package/src/schemas/tiinex.root.v1.classify.js +55 -0
- package/src/schemas/tiinex.root.v1.en.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.fallback.js +84 -0
- package/src/schemas/tiinex.root.v1.findings.js +19 -0
- package/src/schemas/tiinex.root.v1.presenter.js +5 -0
- package/src/schemas/tiinex.root.v1.schema.js +29 -0
- package/src/schemas/tiinex.root.v1.schema.json +24 -0
- package/src/schemas/tiinex.root.v1.schema.runtime.json +1574 -0
- package/src/schemas/tiinex.root.v1.schema.source.js +9 -0
- package/src/schemas/tiinex.root.v1.sv.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.transitions.js +1 -0
- package/src/schemas/tiinex.root.v1.validate.js +36 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.js +14 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.json +23 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.runtime.json +2027 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.source.js +9 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.js +14 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.json +23 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.runtime.json +1848 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.source.js +9 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.js +14 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.json +23 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.runtime.json +2015 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.capabilities.js +12 -0
- package/src/schemas/workspace/tiinex.workspace.v1.en.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.findings.js +5 -0
- package/src/schemas/workspace/tiinex.workspace.v1.presenter.js +27 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.js +30 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.json +23 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.runtime.json +1596 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.sv.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.transitions.js +10 -0
- package/src/schemas/workspace/tiinex.workspace.v1.validate.js +10 -0
- package/src/sources/github/github.issueTarget.js +127 -0
- package/src/sources/origin.references.js +249 -0
- package/src/sources/source.explicitTargets.js +49 -0
- package/src/sources/transport.levels.js +107 -0
- package/src/tooling/portable/adapters/cli/cli.cold-start-input.js +34 -0
- package/src/tooling/portable/adapters/cli/cli.command-input.js +455 -0
- package/src/tooling/portable/adapters/cli/cli.common-author.js +249 -0
- package/src/tooling/portable/adapters/cli/cli.common-output.js +330 -0
- package/src/tooling/portable/adapters/cli/cli.editor-assistance.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.ground-materialize.js +96 -0
- package/src/tooling/portable/adapters/cli/cli.ground-recovery.js +99 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-manufacture.js +345 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.js +31 -0
- package/src/tooling/portable/adapters/cli/cli.help.js +80 -0
- package/src/tooling/portable/adapters/cli/cli.land.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.local-output.js +72 -0
- package/src/tooling/portable/adapters/cli/cli.material-policy.js +6 -0
- package/src/tooling/portable/adapters/cli/cli.operator-bridge.js +18 -0
- package/src/tooling/portable/adapters/cli/cli.reduction-input.js +14 -0
- package/src/tooling/portable/adapters/cli/cli.run.js +434 -0
- package/src/tooling/portable/adapters/llm/llm.entrypoint.js +34 -0
- package/src/tooling/portable/adapters/node/checkpoint.verify.js +267 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.bootstrap.js +109 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.enumeration.js +94 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.js +193 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.multiRoot.js +49 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.packageParent.js +130 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.requirements.js +353 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.scope.js +147 -0
- package/src/tooling/portable/adapters/node/workspaceCarrier.manufacture.js +62 -0
- package/src/tooling/portable/assets/asset.operations.js +170 -0
- package/src/tooling/portable/audit/audit.capability.js +119 -0
- package/src/tooling/portable/bootstrap/artifact.result.selfverify.mjs +109 -0
- package/src/tooling/portable/bootstrap/bootstrap.case.mjs +43 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.md +814 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.pointer.json +25 -0
- package/src/tooling/portable/checkpoint/portable.checkpoint.js +89 -0
- package/src/tooling/portable/conformance/checkpoint.qualification.js +271 -0
- package/src/tooling/portable/draft/draft.create.js +389 -0
- package/src/tooling/portable/draft/draft.crud.js +175 -0
- package/src/tooling/portable/draft/draft.exact.js +173 -0
- package/src/tooling/portable/draft/draft.operations.js +265 -0
- package/src/tooling/portable/draft/draft.qualification.js +45 -0
- package/src/tooling/portable/draft/draft.set.js +193 -0
- package/src/tooling/portable/draft/draft.validation-context.js +7 -0
- package/src/tooling/portable/editor/authoring.parent.js +37 -0
- package/src/tooling/portable/editor/editor.assistance.js +221 -0
- package/src/tooling/portable/editor/staged.validation.js +96 -0
- package/src/tooling/portable/engine.facade.js +468 -0
- package/src/tooling/portable/findings.js +92 -0
- package/src/tooling/portable/grounding/grounding.capsule.js +128 -0
- package/src/tooling/portable/grounding/grounding.continuity.js +283 -0
- package/src/tooling/portable/grounding/grounding.participantAuthority.js +20 -0
- package/src/tooling/portable/grounding/grounding.planningContext.js +34 -0
- package/src/tooling/portable/grounding/grounding.readiness.authority.js +17 -0
- package/src/tooling/portable/grounding/grounding.readiness.js +316 -0
- package/src/tooling/portable/grounding/grounding.readiness.support.js +245 -0
- package/src/tooling/portable/grounding/grounding.sourceEvidence.js +71 -0
- package/src/tooling/portable/grounding/grounding.workContext.js +72 -0
- package/src/tooling/portable/grounding/grounding.workProvenance.js +153 -0
- package/src/tooling/portable/handoff/carrierLineage.js +214 -0
- package/src/tooling/portable/handoff/carrierProfile.js +54 -0
- package/src/tooling/portable/handoff/carrierProjection.js +193 -0
- package/src/tooling/portable/handoff/carrierProjection.routeQualification.js +228 -0
- package/src/tooling/portable/handoff/carrierProjection.shared.js +7 -0
- package/src/tooling/portable/handoff/carrierProjection.workspaces.js +54 -0
- package/src/tooling/portable/handoff/coldConsumerEntrypoint.js +185 -0
- package/src/tooling/portable/handoff/coldStartQualification.contract.js +184 -0
- package/src/tooling/portable/handoff/coldStartQualification.grounding.js +392 -0
- package/src/tooling/portable/handoff/coldStartQualification.js +22 -0
- package/src/tooling/portable/handoff/coldStartQualification.materials.js +364 -0
- package/src/tooling/portable/handoff/coldStartQualification.observation.js +220 -0
- package/src/tooling/portable/handoff/coldStartQualification.run.js +81 -0
- package/src/tooling/portable/handoff/coldStartQualification.shared.js +57 -0
- package/src/tooling/portable/handoff/coldStartRolePointers.js +39 -0
- package/src/tooling/portable/handoff/contextAudit.js +247 -0
- package/src/tooling/portable/handoff/contracts/tiinex.handoff.package.v1.schema.md +409 -0
- package/src/tooling/portable/handoff/handoffAuthoringPlan.js +35 -0
- package/src/tooling/portable/handoff/handoffEndpointProjection.js +61 -0
- package/src/tooling/portable/handoff/handoffLeafProjection.js +91 -0
- package/src/tooling/portable/handoff/humanOutputPresentation.js +21 -0
- package/src/tooling/portable/handoff/manufacture.js +84 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.binding.js +72 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.direct.js +160 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.indexes.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.js +247 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.projectionProvider.js +44 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.workspace.js +226 -0
- package/src/tooling/portable/handoff/materialClosure.descriptor.js +169 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.js +372 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.support.js +62 -0
- package/src/tooling/portable/handoff/materialClosure.materialized.js +143 -0
- package/src/tooling/portable/handoff/materialClosure.materials.js +116 -0
- package/src/tooling/portable/handoff/materialClosure.package.js +181 -0
- package/src/tooling/portable/handoff/materialClosure.plan.js +204 -0
- package/src/tooling/portable/handoff/materialClosure.readiness.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.requirements.js +137 -0
- package/src/tooling/portable/handoff/operatorContextProjection.js +105 -0
- package/src/tooling/portable/handoff/pointerEntrypoint.js +138 -0
- package/src/tooling/portable/handoff/qualifiedHandoffFixture.js +34 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.build.js +321 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.closure.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.materials.js +207 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.projection.js +69 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.roles.js +166 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.routes.js +113 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.shared.js +87 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.workspaces.js +160 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirstPhase1.js +44 -0
- package/src/tooling/portable/handoff/recipientV2.artifactInspection.js +55 -0
- package/src/tooling/portable/handoff/recipientV2.artifacts.js +174 -0
- package/src/tooling/portable/handoff/recipientV2.coldProjection.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.delivery.js +48 -0
- package/src/tooling/portable/handoff/recipientV2.endpointRolePointers.js +179 -0
- package/src/tooling/portable/handoff/recipientV2.entryContract.js +28 -0
- package/src/tooling/portable/handoff/recipientV2.humanOutput.js +78 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.helpers.js +218 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.pathToken.js +9 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.projection.js +58 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.workspaces.js +177 -0
- package/src/tooling/portable/handoff/recipientV2.lineage.js +142 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +147 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.constants.js +4 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.contract.js +101 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.helpers.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.js +185 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.js +12 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.shared.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.workspaceProjection.js +22 -0
- package/src/tooling/portable/handoff/recipientV2.pointer.js +40 -0
- package/src/tooling/portable/handoff/recipientV2.routeSelection.js +16 -0
- package/src/tooling/portable/handoff/recipientV2.topology.helpers.js +20 -0
- package/src/tooling/portable/handoff/recipientV2.topology.js +320 -0
- package/src/tooling/portable/handoff/recipientV2.topology.materials.js +70 -0
- package/src/tooling/portable/handoff/recipientV2.topology.workspaces.js +193 -0
- package/src/tooling/portable/handoff/recipientV2.transportManifest.js +123 -0
- package/src/tooling/portable/handoff/recipientV2.workspaceRepresentation.js +163 -0
- package/src/tooling/portable/handoff/routeArtifactConformance.js +130 -0
- package/src/tooling/portable/handoff/toolingBootstrap.js +67 -0
- package/src/tooling/portable/handoff/transportCompanion.js +175 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.archive.js +95 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.js +271 -0
- package/src/tooling/portable/handoff/workspaceCarrier.manufacture.js +93 -0
- package/src/tooling/portable/handoff/workspaceLandingPlan.js +142 -0
- package/src/tooling/portable/handoff/workspacePackageSources.js +105 -0
- package/src/tooling/portable/handoff/workspaceQualifiedReference.js +10 -0
- package/src/tooling/portable/handoff/workspaceSourceIdentity.js +52 -0
- package/src/tooling/portable/handoff/workspaceTargetConformance.js +134 -0
- package/src/tooling/portable/host/host.capabilities.js +181 -0
- package/src/tooling/portable/host/tool.bindings.js +357 -0
- package/src/tooling/portable/host/tool.receiptNormalization.js +141 -0
- package/src/tooling/portable/index.js +52 -0
- package/src/tooling/portable/input/node.input.js +184 -0
- package/src/tooling/portable/input/portable.input.js +249 -0
- package/src/tooling/portable/lifecycle/lifecycle.action.js +11 -0
- package/src/tooling/portable/lifecycle/lifecycle.material.js +173 -0
- package/src/tooling/portable/lifecycle/lifecycle.operations.js +34 -0
- package/src/tooling/portable/lifecycle/lifecycle.readiness.js +247 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.audit.js +22 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.evidence.js +36 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.js +306 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.structure.js +178 -0
- package/src/tooling/portable/lineage/lineage.integrity.plan.js +377 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.human.js +82 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.js +349 -0
- package/src/tooling/portable/lineage/lineage.operations.js +32 -0
- package/src/tooling/portable/lineage/lineage.print.js +398 -0
- package/src/tooling/portable/lineage/lineage.print.render.js +88 -0
- package/src/tooling/portable/lineage/lineage.print.utils.js +58 -0
- package/src/tooling/portable/lineage/lineage.publicationProviderReceipts.js +141 -0
- package/src/tooling/portable/lineage/lineage.publicationQualification.js +183 -0
- package/src/tooling/portable/lineage/lineage.search.js +301 -0
- package/src/tooling/portable/live/live.artifact.js +192 -0
- package/src/tooling/portable/live/live.export.js +107 -0
- package/src/tooling/portable/live/live.lineage.closure.js +71 -0
- package/src/tooling/portable/live/live.lineage.js +338 -0
- package/src/tooling/portable/live/live.protocol.js +181 -0
- package/src/tooling/portable/materialization/durable.materialize.js +162 -0
- package/src/tooling/portable/materialization/epistemic.plan.js +239 -0
- package/src/tooling/portable/materialization/loaded.parent.js +54 -0
- package/src/tooling/portable/materialization/materialization.facade.js +30 -0
- package/src/tooling/portable/operation.catalog.js +393 -0
- package/src/tooling/portable/operation.catalog.package.js +183 -0
- package/src/tooling/portable/operation.result.js +25 -0
- package/src/tooling/portable/orchestration/task.prepare.js +191 -0
- package/src/tooling/portable/output/artifact.result.package.js +308 -0
- package/src/tooling/portable/output/deterministic.zip.js +88 -0
- package/src/tooling/portable/output/node.artifact-set.js +223 -0
- package/src/tooling/portable/output/node.draft.js +41 -0
- package/src/tooling/portable/output/node.zip.js +39 -0
- package/src/tooling/portable/output/recipientV2.zip.js +59 -0
- package/src/tooling/portable/overview/blockingCue.js +16 -0
- package/src/tooling/portable/overview/operatingOverview.js +413 -0
- package/src/tooling/portable/package/generation.binding.js +314 -0
- package/src/tooling/portable/package/generation.binding.projection.js +128 -0
- package/src/tooling/portable/package/material.graph.js +236 -0
- package/src/tooling/portable/package/runtime.package.js +321 -0
- package/src/tooling/portable/package/schema.transition.companion.js +196 -0
- package/src/tooling/portable/package/semantic.package.graph.js +272 -0
- package/src/tooling/portable/package/semantic.package.js +203 -0
- package/src/tooling/portable/package/semantic.package.schema-resolution.js +158 -0
- package/src/tooling/portable/package/semantic.package.transition-registry.js +189 -0
- package/src/tooling/portable/package/semantic.package.types.js +18 -0
- package/src/tooling/portable/providers/schema.bootstrap.provenance.js +10 -0
- package/src/tooling/portable/providers/schema.provider.qualification.js +52 -0
- package/src/tooling/portable/providers/schema.providers.js +458 -0
- package/src/tooling/portable/publication/runtime.publication.js +53 -0
- package/src/tooling/portable/qualification.js +150 -0
- package/src/tooling/portable/reduction/reduction.composition.js +229 -0
- package/src/tooling/portable/reduction/reduction.eligibility.helpers.js +258 -0
- package/src/tooling/portable/reduction/reduction.eligibility.js +191 -0
- package/src/tooling/portable/reduction/reduction.operations.js +30 -0
- package/src/tooling/portable/reduction/reduction.preflight.js +85 -0
- package/src/tooling/portable/reduction/reduction.shared.js +173 -0
- package/src/tooling/portable/schema/bootstrap/canonical.pack.js +24 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/party/role/tiinex.party.role.v1.schema.md +289 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/validation/report/tiinex.validation.report.v1.schema.md +300 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.runtime-projection.json +48 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.schema.md +865 -0
- package/src/tooling/portable/schema/contract.compile.js +406 -0
- package/src/tooling/portable/schema/contract.compile.utils.js +9 -0
- package/src/tooling/portable/schema/contract.constraints.js +117 -0
- package/src/tooling/portable/schema/contract.envelope.validate.js +177 -0
- package/src/tooling/portable/schema/contract.field-domain.compile.js +399 -0
- package/src/tooling/portable/schema/contract.field-domain.js +247 -0
- package/src/tooling/portable/schema/contract.field-shape.compile.js +34 -0
- package/src/tooling/portable/schema/contract.inheritance.inline.js +103 -0
- package/src/tooling/portable/schema/contract.inheritance.js +210 -0
- package/src/tooling/portable/schema/contract.inheritance.record.js +76 -0
- package/src/tooling/portable/schema/contract.machine-shape.js +309 -0
- package/src/tooling/portable/schema/contract.project.js +81 -0
- package/src/tooling/portable/schema/contract.semantic-resolution.js +82 -0
- package/src/tooling/portable/schema/contract.validate.js +0 -0
- package/src/tooling/portable/schema/lexical.shape.v1.js +338 -0
- package/src/tooling/portable/schema/llm.companion.js +108 -0
- package/src/tooling/portable/schema/named.declarations.js +162 -0
- package/src/tooling/portable/schema/ordinary.contract.js +193 -0
- package/src/tooling/portable/schema/ordinary.fields.js +205 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.projection.js +70 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.runtime.js +170 -0
- package/src/tooling/portable/schema/schema.contract.js +465 -0
- package/src/tooling/portable/schema/schema.guide.js +326 -0
- package/src/tooling/portable/schema/schema.snapshot.js +119 -0
- package/src/tooling/portable/session/portable.session.js +145 -0
- package/src/tooling/portable/transfer/transfer.plan.js +102 -0
- package/src/transitions/record.transitions.js +484 -0
- package/src/transitions/transition.validate.js +129 -0
- package/src/validation/findings.js +76 -0
- package/src/validation/validateArtifact.js +216 -0
- package/src/workspaces/workspace.entrypointCapability.js +44 -0
- package/src/workspaces/workspace.materialRole.js +242 -0
- package/src/workspaces/workspace.recordPaths.js +426 -0
- package/tools/tiinex-portable.mjs +6 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import binding from './tiinex.workspace.v1.schema.json' with { type: 'json' };
|
|
2
|
+
import projection from './tiinex.workspace.v1.schema.runtime.json' with { type: 'json' };
|
|
3
|
+
import { defineBundledSchemaSource } from '../schema.source.js';
|
|
4
|
+
|
|
5
|
+
export const schemaSource = defineBundledSchemaSource(binding, projection, Object.freeze({
|
|
6
|
+
bundledPath: 'src/schemas/workspace/tiinex.workspace.v1.schema.md',
|
|
7
|
+
sourceLabel: 'Viewer schema registry',
|
|
8
|
+
assetUrl: new URL('./tiinex.workspace.v1.schema.md', import.meta.url).href
|
|
9
|
+
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"label": "Workspace",
|
|
3
|
+
"localBoundary": "Browser-local session state; no source files or GitHub provenance inferred.",
|
|
4
|
+
"emptyResult": "No artifacts yet — add local Markdown to get started. Click + (Add) or drop .md files here. Local files remain local/session only.",
|
|
5
|
+
"legacyEmptyResult": "No nodes match this view.",
|
|
6
|
+
"dropHint": "Add local Markdown via + (Add) or drop .md files here. For source-backed material use Add → GitHub source and provide explicit file paths."
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const workspaceTransitions = Object.freeze({
|
|
2
|
+
createLocal: 'create-workspace',
|
|
3
|
+
addManualFiles: 'add-manual-files',
|
|
4
|
+
addManualFolder: 'add-manual-folder',
|
|
5
|
+
addGitHubSource: 'add-github-source',
|
|
6
|
+
addExplicitUrls: 'add-explicit-urls',
|
|
7
|
+
closeSource: 'close-source',
|
|
8
|
+
closeWorkspace: 'close-workspace',
|
|
9
|
+
restoreFromHash: 'hash-restore'
|
|
10
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function workspaceValidate(artifact = {}) {
|
|
2
|
+
const findings = [];
|
|
3
|
+
if (artifact?.envelope?.current?.schema?.id !== 'tiinex.workspace.v1') {
|
|
4
|
+
findings.push({ severity: 'warning', code: 'workspace.schema.mismatch', message: 'Workspace validator invoked for a non-workspace current schema.', source: 'tiinex.workspace.v1' });
|
|
5
|
+
return findings;
|
|
6
|
+
}
|
|
7
|
+
if (!artifact?.body?.title) findings.push({ severity: 'error', code: 'workspace.title.missing', message: 'Workspace artifact should begin with a human-readable display name.', source: 'tiinex.workspace.v1', fixability: 'safe' });
|
|
8
|
+
if (!String(artifact?.body?.text || '').trim()) findings.push({ severity: 'error', code: 'workspace.body.missing', message: 'Workspace artifact should contain a readable Markdown body.', source: 'tiinex.workspace.v1', fixability: 'manual' });
|
|
9
|
+
return findings;
|
|
10
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export const GITHUB_ISSUE_BODY_TARGET_KIND = 'github.issue.body';
|
|
2
|
+
export const GITHUB_ISSUE_COMMENT_TARGET_KIND = 'github.issue.comment';
|
|
3
|
+
|
|
4
|
+
const SAFE_PATH_SEGMENT = /^[A-Za-z0-9_.-]+$/;
|
|
5
|
+
const WEB_ISSUE_LEXICAL = /^https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/issues\/([1-9]\d*)(\/)?(?:#issuecomment-(\d+))?$/;
|
|
6
|
+
const API_ISSUE_LEXICAL = /^https:\/\/api\.github\.com\/repos\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/issues\/([1-9]\d*)(\/)?$/;
|
|
7
|
+
|
|
8
|
+
export function parseExactGithubIssueTarget(value = '') {
|
|
9
|
+
const raw = String(value || '');
|
|
10
|
+
if (!raw) return failure(raw, 'missing-github-issue-target');
|
|
11
|
+
|
|
12
|
+
const web = raw.match(WEB_ISSUE_LEXICAL);
|
|
13
|
+
if (web) return parseExactWebIssueTarget(raw, web);
|
|
14
|
+
|
|
15
|
+
const api = raw.match(API_ISSUE_LEXICAL);
|
|
16
|
+
if (api) return parseExactApiIssueTarget(raw, api);
|
|
17
|
+
|
|
18
|
+
return failure(raw, 'unsupported-github-issue-target');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function githubIssueCommentIdFromTarget(value = '') {
|
|
22
|
+
const parsed = parseExactGithubIssueTarget(value);
|
|
23
|
+
return parsed.ok && parsed.targetKind === GITHUB_ISSUE_COMMENT_TARGET_KIND ? String(parsed.commentId || '') : '';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function sameGithubRepository(a = '', b = '') {
|
|
27
|
+
const left = normalizeRepository(a);
|
|
28
|
+
const right = normalizeRepository(b);
|
|
29
|
+
return Boolean(left && right && left === right);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function normalizeGithubRepository(value = '') {
|
|
33
|
+
return normalizeRepository(value);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function parseExactWebIssueTarget(raw, match) {
|
|
37
|
+
const owner = match[1];
|
|
38
|
+
const repo = match[2];
|
|
39
|
+
const issueNumber = match[3];
|
|
40
|
+
const trailingSlash = Boolean(match[4]);
|
|
41
|
+
const commentId = match[5] || '';
|
|
42
|
+
if (!validRepositoryParts(owner, repo) || !validIssueNumber(issueNumber)) return failure(raw, 'unsupported-github-issue-target');
|
|
43
|
+
|
|
44
|
+
const number = Number(issueNumber);
|
|
45
|
+
const issueTarget = `https://github.com/${owner}/${repo}/issues/${issueNumber}`;
|
|
46
|
+
return success({
|
|
47
|
+
raw,
|
|
48
|
+
repository: `${owner}/${repo}`,
|
|
49
|
+
owner,
|
|
50
|
+
repo,
|
|
51
|
+
number,
|
|
52
|
+
issueNumber,
|
|
53
|
+
commentId,
|
|
54
|
+
targetKind: commentId ? GITHUB_ISSUE_COMMENT_TARGET_KIND : GITHUB_ISSUE_BODY_TARGET_KIND,
|
|
55
|
+
inputTarget: commentId ? `${issueTarget}#issuecomment-${commentId}` : issueTarget,
|
|
56
|
+
issueTarget,
|
|
57
|
+
normalization: trailingSlash ? 'trailing-slash' : 'none'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function parseExactApiIssueTarget(raw, match) {
|
|
62
|
+
const owner = match[1];
|
|
63
|
+
const repo = match[2];
|
|
64
|
+
const issueNumber = match[3];
|
|
65
|
+
const trailingSlash = Boolean(match[4]);
|
|
66
|
+
if (!validRepositoryParts(owner, repo) || !validIssueNumber(issueNumber)) return failure(raw, 'unsupported-github-issue-target');
|
|
67
|
+
|
|
68
|
+
const number = Number(issueNumber);
|
|
69
|
+
const issueTarget = `https://github.com/${owner}/${repo}/issues/${issueNumber}`;
|
|
70
|
+
return success({
|
|
71
|
+
raw,
|
|
72
|
+
repository: `${owner}/${repo}`,
|
|
73
|
+
owner,
|
|
74
|
+
repo,
|
|
75
|
+
number,
|
|
76
|
+
issueNumber,
|
|
77
|
+
commentId: '',
|
|
78
|
+
targetKind: GITHUB_ISSUE_BODY_TARGET_KIND,
|
|
79
|
+
inputTarget: issueTarget,
|
|
80
|
+
issueTarget,
|
|
81
|
+
normalization: trailingSlash ? 'api-trailing-slash-to-canonical-web-issue' : 'api-issue-to-canonical-web-issue'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function validRepositoryParts(owner, repo) {
|
|
86
|
+
return Boolean(
|
|
87
|
+
owner && repo
|
|
88
|
+
&& owner !== '.' && owner !== '..'
|
|
89
|
+
&& repo !== '.' && repo !== '..'
|
|
90
|
+
&& SAFE_PATH_SEGMENT.test(owner)
|
|
91
|
+
&& SAFE_PATH_SEGMENT.test(repo)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function validIssueNumber(value = '') {
|
|
96
|
+
const lexical = String(value || '');
|
|
97
|
+
if (!/^[1-9]\d*$/.test(lexical)) return false;
|
|
98
|
+
const numeric = Number(lexical);
|
|
99
|
+
return Number.isSafeInteger(numeric) && String(numeric) === lexical;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function success(value = {}) {
|
|
103
|
+
return Object.freeze({
|
|
104
|
+
ok: true,
|
|
105
|
+
provider: 'github',
|
|
106
|
+
repository: value.repository,
|
|
107
|
+
owner: value.owner,
|
|
108
|
+
repo: value.repo,
|
|
109
|
+
number: value.number,
|
|
110
|
+
issueNumber: value.issueNumber,
|
|
111
|
+
commentId: value.commentId,
|
|
112
|
+
targetKind: value.targetKind,
|
|
113
|
+
inputTarget: value.inputTarget,
|
|
114
|
+
issueTarget: value.issueTarget,
|
|
115
|
+
mutable: true,
|
|
116
|
+
normalization: value.normalization || 'none'
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function failure(input, error) {
|
|
121
|
+
return Object.freeze({ ok: false, input, error });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function normalizeRepository(value = '') {
|
|
125
|
+
const parts = String(value || '').trim().toLowerCase().split('/').filter(Boolean);
|
|
126
|
+
return parts.length === 2 ? `${parts[0]}/${parts[1]}` : '';
|
|
127
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
const ORIGIN_REFERENCE_SCHEMA = 'tiinex.origin.reference.v1';
|
|
2
|
+
const ORIGIN_SOURCE_KIND = 'github.origin-reference';
|
|
3
|
+
|
|
4
|
+
export function parseOriginReferenceValue(value = '') {
|
|
5
|
+
return normalizeOriginReference(value, { source: 'explicit-parse' });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function collectOriginReferencesFromMarkdown(markdown = '') {
|
|
9
|
+
const refs = [];
|
|
10
|
+
const blocks = originBlocks(markdown);
|
|
11
|
+
for (const block of blocks) {
|
|
12
|
+
for (const candidate of originCandidatesFromBlock(block)) addOriginReference(refs, candidate, { source: 'continuity-origin' });
|
|
13
|
+
}
|
|
14
|
+
return refs;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function originReferenceSourcesForRecords(records = []) {
|
|
18
|
+
const groups = new Map();
|
|
19
|
+
for (const record of Array.isArray(records) ? records : []) {
|
|
20
|
+
for (const ref of originReferencesForRecord(record)) {
|
|
21
|
+
if (!ref || ref.provider !== 'github' || !ref.repository) continue;
|
|
22
|
+
const key = ref.repository.toLowerCase();
|
|
23
|
+
if (!groups.has(key)) groups.set(key, makeGithubOriginSource(ref));
|
|
24
|
+
const source = groups.get(key);
|
|
25
|
+
source.originReferenceCount = Number(source.originReferenceCount || 0) + 1;
|
|
26
|
+
if (ref.kind === 'github-issue' && ref.url && !source.issueUrls.includes(ref.url)) source.issueUrls.push(ref.url);
|
|
27
|
+
if (ref.kind === 'github-file' && ref.path && !source.fileRefs.includes(ref.path)) source.fileRefs.push(ref.path);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Array.from(groups.values()).map((source) => Object.freeze(Object.assign({}, source, {
|
|
31
|
+
count: 0,
|
|
32
|
+
config: Object.freeze(Object.assign({}, source.config, {
|
|
33
|
+
issueUrls: source.issueUrls.join('\n'),
|
|
34
|
+
fileRefs: source.fileRefs.join('\n')
|
|
35
|
+
}))
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function upsertOriginReferenceSources(workspace = {}, records = []) {
|
|
40
|
+
const sources = originReferenceSourcesForRecords(records);
|
|
41
|
+
if (!sources.length) return [];
|
|
42
|
+
const existing = Array.isArray(workspace.sources) ? workspace.sources.slice() : [];
|
|
43
|
+
for (const source of sources) {
|
|
44
|
+
const index = existing.findIndex((item) => String(item?.id || '') === source.id);
|
|
45
|
+
if (index >= 0) {
|
|
46
|
+
const prior = existing[index];
|
|
47
|
+
const issueUrls = uniqueLines([prior.config?.issueUrls, source.config?.issueUrls].join('\n'));
|
|
48
|
+
const fileRefs = uniqueLines([prior.config?.fileRefs, source.config?.fileRefs].join('\n'));
|
|
49
|
+
existing[index] = Object.assign({}, prior, source, {
|
|
50
|
+
issueUrls,
|
|
51
|
+
fileRefs,
|
|
52
|
+
originReferenceCount: Number(prior.originReferenceCount || 0) + Number(source.originReferenceCount || 0),
|
|
53
|
+
config: Object.assign({}, prior.config || {}, source.config || {}, { issueUrls: issueUrls.join('\n'), fileRefs: fileRefs.join('\n') })
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
existing.push(Object.assign({}, source));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
workspace.sources = existing;
|
|
60
|
+
workspace.sourceOrder = existing.map((item) => item.id);
|
|
61
|
+
return sources;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function originReferencesForRecord(record = {}) {
|
|
65
|
+
const refs = [];
|
|
66
|
+
for (const ref of Array.isArray(record.originReferences) ? record.originReferences : []) addOriginReference(refs, ref.value || ref.url || ref.path || '', { source: ref.source || 'record.originReferences' });
|
|
67
|
+
for (const value of [record.origin, record.parentOrigin, record.sourceTarget?.parentRawUrl, record.sourceTarget?.parentSourceUrl, record.snapshot?.parentRawUrl, record.snapshot?.parentSourceUrl]) addOriginReference(refs, value, { source: 'record.explicit-origin' });
|
|
68
|
+
return refs;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function recoverySourceForRecord(record = {}, workspace = {}) {
|
|
72
|
+
const direct = record?.source || {};
|
|
73
|
+
if (isGithubConfiguredSource(direct)) return Object.assign({}, direct, { ref: direct.ref || direct.config?.ref || '' });
|
|
74
|
+
const refs = originReferencesForRecord(record).filter((ref) => ref.provider === 'github' && ref.repository);
|
|
75
|
+
if (!refs.length) return null;
|
|
76
|
+
const repo = refs[0].repository;
|
|
77
|
+
const workspaceSource = (Array.isArray(workspace?.sources) ? workspace.sources : []).find((source) => {
|
|
78
|
+
const sourceRepo = String(source.repo || source.repository || source.config?.repo || '').trim().toLowerCase();
|
|
79
|
+
return sourceRepo && sourceRepo === repo.toLowerCase() && isGithubConfiguredSource(source);
|
|
80
|
+
});
|
|
81
|
+
if (workspaceSource) return Object.assign({}, workspaceSource, { ref: workspaceSource.ref || workspaceSource.config?.ref || '' });
|
|
82
|
+
return makeGithubOriginSource(refs[0]);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function githubIssueUrlsForRecord(record = {}) {
|
|
86
|
+
return uniqueLines(originReferencesForRecord(record).filter((ref) => ref.kind === 'github-issue').map((ref) => ref.url));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function githubFileRefsForRecord(record = {}) {
|
|
90
|
+
return uniqueLines(originReferencesForRecord(record).filter((ref) => ref.kind === 'github-file').map((ref) => ref.path));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function isOriginReferenceSource(source = {}) {
|
|
94
|
+
return source.originReferenceSource === true || source.sourceKind === ORIGIN_SOURCE_KIND;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function makeGithubOriginSource(ref = {}) {
|
|
98
|
+
const repo = ref.repository || `${ref.owner || 'owner'}/${ref.repo || 'repo'}`;
|
|
99
|
+
const id = `origin:github:${repo.toLowerCase().replace(/[^a-z0-9/_-]+/g, '-').replace(/\//g, ':')}`;
|
|
100
|
+
const sourceRef = String(ref.ref || '').trim();
|
|
101
|
+
return {
|
|
102
|
+
id,
|
|
103
|
+
kind: 'github-tree',
|
|
104
|
+
adapterId: 'github',
|
|
105
|
+
sourceKind: ORIGIN_SOURCE_KIND,
|
|
106
|
+
label: `GitHub origin · ${repo}`,
|
|
107
|
+
roleLabel: 'recovery only',
|
|
108
|
+
countLabel: 'origin refs',
|
|
109
|
+
repo,
|
|
110
|
+
repository: repo,
|
|
111
|
+
ref: sourceRef,
|
|
112
|
+
rootPath: '.topics',
|
|
113
|
+
config: { repo, ref: sourceRef, rootPath: '.topics', issueUrls: '', fileRefs: '' },
|
|
114
|
+
count: 0,
|
|
115
|
+
sourceBacked: false,
|
|
116
|
+
originReferenceSource: true,
|
|
117
|
+
recoveryOnly: true,
|
|
118
|
+
closeable: true,
|
|
119
|
+
discoveryState: 'deferred',
|
|
120
|
+
issueUrls: [],
|
|
121
|
+
fileRefs: [],
|
|
122
|
+
boundary: 'explicit GitHub origin reference recovered from imported artifacts; recovery only for lineage lookup, imported material remains browser-local/session',
|
|
123
|
+
transportLabel: 'Origin recovery only',
|
|
124
|
+
loadable: false,
|
|
125
|
+
transportRefreshTier: 'direct'
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function originBlocks(markdown = '') {
|
|
130
|
+
const lines = String(markdown || '').replace(/\r\n?/g, '\n').split('\n');
|
|
131
|
+
const blocks = [];
|
|
132
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
133
|
+
const match = lines[i].match(/^(\s*)-\s*Origin:\s*(.*)$/i);
|
|
134
|
+
if (!match) continue;
|
|
135
|
+
const indent = match[1].length;
|
|
136
|
+
const inline = match[2].trim();
|
|
137
|
+
const collected = [];
|
|
138
|
+
if (inline) collected.push(inline);
|
|
139
|
+
for (let j = i + 1; j < lines.length; j += 1) {
|
|
140
|
+
const line = lines[j];
|
|
141
|
+
const top = line.match(/^(\s*)-\s+\S/);
|
|
142
|
+
if (top && top[1].length <= indent) break;
|
|
143
|
+
if (line.trim()) collected.push(line.trim());
|
|
144
|
+
}
|
|
145
|
+
if (collected.length) blocks.push(collected.join('\n'));
|
|
146
|
+
}
|
|
147
|
+
return blocks;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function originCandidatesFromBlock(block = '') {
|
|
151
|
+
const out = [];
|
|
152
|
+
for (const line of String(block || '').split('\n')) {
|
|
153
|
+
const item = line.replace(/^[-*]\s+/, '').trim();
|
|
154
|
+
if (!item) continue;
|
|
155
|
+
const labelled = item.match(/^([A-Za-z][A-Za-z0-9 _+-]{0,40}):\s*(.+)$/);
|
|
156
|
+
const value = labelled ? labelled[2].trim() : item;
|
|
157
|
+
out.push(value);
|
|
158
|
+
for (const link of markdownLinks(item)) out.push(link.href || link.label || '');
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function addOriginReference(refs = [], value = '', meta = {}) {
|
|
164
|
+
const normalized = normalizeOriginReference(value, meta);
|
|
165
|
+
if (!normalized) return;
|
|
166
|
+
const key = `${normalized.kind}:${normalized.url || normalized.path || normalized.value}`.toLowerCase();
|
|
167
|
+
if (refs.some((item) => `${item.kind}:${item.url || item.path || item.value}`.toLowerCase() === key)) return;
|
|
168
|
+
refs.push(normalized);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function normalizeOriginReference(value = '', meta = {}) {
|
|
172
|
+
const raw = stripMarkdown(String(value || '').trim());
|
|
173
|
+
if (!raw) return null;
|
|
174
|
+
const github = githubReference(raw);
|
|
175
|
+
if (github) return Object.freeze(Object.assign({ schema: ORIGIN_REFERENCE_SCHEMA, value: raw, explicit: true, source: meta.source || 'origin' }, github));
|
|
176
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(raw)) return Object.freeze({ schema: ORIGIN_REFERENCE_SCHEMA, kind: 'url', value: raw, url: raw, explicit: true, source: meta.source || 'origin' });
|
|
177
|
+
return Object.freeze({ schema: ORIGIN_REFERENCE_SCHEMA, kind: 'relative', value: raw, path: normalizePath(raw), explicit: true, source: meta.source || 'origin' });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function githubReference(value = '') {
|
|
181
|
+
try {
|
|
182
|
+
const url = new URL(value);
|
|
183
|
+
const host = url.hostname.toLowerCase();
|
|
184
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
185
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 4 && ['issues', 'discussions', 'pull'].includes(parts[2])) {
|
|
186
|
+
const commentId = url.hash.match(/(?:issuecomment-|discussioncomment-)(\d+)/i)?.[1] || '';
|
|
187
|
+
return { kind: 'github-issue', provider: 'github', owner: parts[0], repo: parts[1], repository: `${parts[0]}/${parts[1]}`, surface: parts[2], number: parts[3], commentId, url: canonicalGithubIssueUrl(value) };
|
|
188
|
+
}
|
|
189
|
+
if (host === 'raw.githubusercontent.com' && parts.length >= 4) {
|
|
190
|
+
return { kind: 'github-file', provider: 'github', owner: parts[0], repo: parts[1], repository: `${parts[0]}/${parts[1]}`, ref: parts[2], path: normalizePath(parts.slice(3).join('/')), url: value };
|
|
191
|
+
}
|
|
192
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 5 && parts[2] === 'blob') {
|
|
193
|
+
return { kind: 'github-file', provider: 'github', owner: parts[0], repo: parts[1], repository: `${parts[0]}/${parts[1]}`, ref: parts[3], path: normalizePath(parts.slice(4).join('/')), url: value };
|
|
194
|
+
}
|
|
195
|
+
} catch (_) {}
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function canonicalGithubIssueUrl(value = '') {
|
|
200
|
+
try {
|
|
201
|
+
const url = new URL(String(value || '').trim());
|
|
202
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
203
|
+
const hash = url.hash.match(/(?:issuecomment-|discussioncomment-)(\d+)/i)?.[0] || '';
|
|
204
|
+
if ((url.hostname === 'github.com' || url.hostname.endsWith('.github.com')) && parts.length >= 4) return `https://github.com/${parts[0]}/${parts[1]}/${parts[2]}/${parts[3]}${hash ? `#${hash}` : ''}`;
|
|
205
|
+
} catch (_) {}
|
|
206
|
+
return String(value || '').trim();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function markdownLinks(value = '') {
|
|
210
|
+
const out = [];
|
|
211
|
+
const re = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
212
|
+
let match;
|
|
213
|
+
while ((match = re.exec(String(value || '')))) out.push({ label: match[1].trim(), href: match[2].trim() });
|
|
214
|
+
return out;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function stripMarkdown(value = '') {
|
|
218
|
+
const link = String(value || '').trim().match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
219
|
+
return (link ? link[2] : String(value || '')).trim();
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function normalizePath(value = '') {
|
|
223
|
+
const out = [];
|
|
224
|
+
for (const part of String(value || '').replace(/\\/g, '/').split('/')) {
|
|
225
|
+
const clean = part.trim();
|
|
226
|
+
if (!clean || clean === '.') continue;
|
|
227
|
+
if (clean === '..') out.pop();
|
|
228
|
+
else out.push(clean);
|
|
229
|
+
}
|
|
230
|
+
return out.join('/');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function uniqueLines(value = '') {
|
|
234
|
+
const items = Array.isArray(value) ? value : String(value || '').split(/\r?\n|,/);
|
|
235
|
+
const seen = new Set();
|
|
236
|
+
const out = [];
|
|
237
|
+
for (const item of items.map((entry) => String(entry || '').trim()).filter(Boolean)) {
|
|
238
|
+
const key = item.toLowerCase();
|
|
239
|
+
if (seen.has(key)) continue;
|
|
240
|
+
seen.add(key);
|
|
241
|
+
out.push(item);
|
|
242
|
+
}
|
|
243
|
+
return out;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function isGithubConfiguredSource(source = {}) {
|
|
247
|
+
const adapter = String(source.adapterId || source.sourceKind || source.kind || '').toLowerCase();
|
|
248
|
+
return adapter.includes('github') || Boolean(source.repo || source.repository || source.config?.repo);
|
|
249
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function normalizeExplicitFileRefs(value = []) {
|
|
2
|
+
const items = Array.isArray(value) ? value : String(value || '').split(/\r?\n/);
|
|
3
|
+
const out = [];
|
|
4
|
+
const seen = new Set();
|
|
5
|
+
for (const item of items) {
|
|
6
|
+
const ref = String(item?.ref ?? item ?? '').trim();
|
|
7
|
+
if (!ref || seen.has(ref)) continue;
|
|
8
|
+
seen.add(ref);
|
|
9
|
+
out.push(ref);
|
|
10
|
+
}
|
|
11
|
+
return Object.freeze(out);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function explicitFileRefsText(value = []) {
|
|
15
|
+
return normalizeExplicitFileRefs(value).join('\n');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const WEB_MARKDOWN_SOURCE_TARGET_KIND = 'web.markdown';
|
|
19
|
+
|
|
20
|
+
export function normalizeExternalWebArtifactUrl(value = '') {
|
|
21
|
+
const raw = String(value || '').trim();
|
|
22
|
+
if (!raw) return '';
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(raw);
|
|
25
|
+
return /^https?:$/i.test(url.protocol) ? url.href : '';
|
|
26
|
+
} catch (_) { return ''; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function explicitWebArtifactSourceTarget(inputTarget = '', materializedTarget = '') {
|
|
30
|
+
const input = normalizeExternalWebArtifactUrl(inputTarget);
|
|
31
|
+
const raw = normalizeExternalWebArtifactUrl(materializedTarget || inputTarget);
|
|
32
|
+
if (!input || !raw) return null;
|
|
33
|
+
return Object.freeze({ targetKind: WEB_MARKDOWN_SOURCE_TARGET_KIND, inputTarget: input, rawUrl: raw });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function externalWebArtifactUrl(record = {}) {
|
|
37
|
+
const source = record?.source || {};
|
|
38
|
+
const target = record?.sourceTarget || {};
|
|
39
|
+
const mode = String(record?.sourceMode || '').toLowerCase();
|
|
40
|
+
const adapterId = String(source.adapterId || '').toLowerCase();
|
|
41
|
+
const sourceKind = String(source.sourceKind || source.kind || '').toLowerCase();
|
|
42
|
+
const targetKind = String(target.targetKind || '').toLowerCase();
|
|
43
|
+
const webShaped = targetKind === WEB_MARKDOWN_SOURCE_TARGET_KIND
|
|
44
|
+
|| sourceKind === WEB_MARKDOWN_SOURCE_TARGET_KIND
|
|
45
|
+
|| (adapterId === 'web' && sourceKind.includes('web'))
|
|
46
|
+
|| (mode === 'explicit-url' && targetKind === WEB_MARKDOWN_SOURCE_TARGET_KIND);
|
|
47
|
+
if (!webShaped) return '';
|
|
48
|
+
return normalizeExternalWebArtifactUrl(target.inputTarget || source.url || target.rawUrl || '');
|
|
49
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export const TRANSPORT_LEVELS_SCHEMA_ID = 'tiinex.transport.levels.v1';
|
|
2
|
+
export const TRANSPORT_PLAN_SCHEMA_ID = 'tiinex.transport.operationPlan.v1';
|
|
3
|
+
|
|
4
|
+
export const TransportLevel = Object.freeze({
|
|
5
|
+
TL0: 'TL0',
|
|
6
|
+
TL1: 'TL1',
|
|
7
|
+
TL2: 'TL2',
|
|
8
|
+
TL3: 'TL3',
|
|
9
|
+
TL4: 'TL4'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const LEVEL_ORDER = Object.freeze([TransportLevel.TL0, TransportLevel.TL1, TransportLevel.TL2, TransportLevel.TL3, TransportLevel.TL4]);
|
|
13
|
+
const OPERATION_ALIASES = Object.freeze({
|
|
14
|
+
readKnown: 'read-known',
|
|
15
|
+
listScope: 'list-scope',
|
|
16
|
+
readHistory: 'read-history',
|
|
17
|
+
localDownload: 'local-download',
|
|
18
|
+
localImport: 'local-import',
|
|
19
|
+
write: 'write',
|
|
20
|
+
verify: 'verify',
|
|
21
|
+
sync: 'sync'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export function normalizeTransportLevel(value = '') {
|
|
25
|
+
const text = String(value || '').trim().toUpperCase();
|
|
26
|
+
return LEVEL_ORDER.includes(text) ? text : '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function transportLevelRank(level = '') {
|
|
30
|
+
const normalized = normalizeTransportLevel(level);
|
|
31
|
+
return normalized ? LEVEL_ORDER.indexOf(normalized) : -1;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function transportLevelsAtOrBelow(level = '') {
|
|
35
|
+
const rank = transportLevelRank(level);
|
|
36
|
+
if (rank < 0) return Object.freeze([]);
|
|
37
|
+
return Object.freeze(LEVEL_ORDER.slice(0, rank + 1));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function normalizeTransportOperation(value = '') {
|
|
41
|
+
const raw = String(value || '').trim();
|
|
42
|
+
if (!raw) return '';
|
|
43
|
+
return OPERATION_ALIASES[raw] || raw.replace(/[A-Z]/g, (ch) => `-${ch.toLowerCase()}`).replace(/^-/, '').toLowerCase();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function resolveTransportPlan(sourceConfig = {}, operation = '', input = {}) {
|
|
47
|
+
const op = normalizeTransportOperation(operation || input.operation || 'read-known');
|
|
48
|
+
const configured = configuredLevelForOperation(sourceConfig, op) || normalizeTransportLevel(input.defaultLevel || TransportLevel.TL0) || TransportLevel.TL0;
|
|
49
|
+
const requested = normalizeTransportLevel(input.requestedLevel || configured) || configured;
|
|
50
|
+
const maxRank = transportLevelRank(configured);
|
|
51
|
+
const requestedRank = transportLevelRank(requested);
|
|
52
|
+
const selected = requestedRank >= 0 && requestedRank <= maxRank ? requested : configured;
|
|
53
|
+
const fallbackLevels = input.allowFallback === false ? Object.freeze([]) : transportLevelsAtOrBelow(selected).filter((level) => level !== selected).reverse();
|
|
54
|
+
const credentialMaterialIncluded = hasCredentialMaterial(sourceConfig);
|
|
55
|
+
const authRequired = transportLevelRank(selected) >= transportLevelRank(TransportLevel.TL3) || Boolean(sourceConfig.authRequired || input.authRequired);
|
|
56
|
+
return deepFreeze({
|
|
57
|
+
schema: TRANSPORT_PLAN_SCHEMA_ID,
|
|
58
|
+
operation: op,
|
|
59
|
+
selectedLevel: selected,
|
|
60
|
+
configuredLevel: configured,
|
|
61
|
+
fallbackLevels,
|
|
62
|
+
authRequired,
|
|
63
|
+
authProvider: String(sourceConfig.authProvider || input.authProvider || '').trim(),
|
|
64
|
+
credentialMaterialIncluded,
|
|
65
|
+
status: credentialMaterialIncluded ? 'blocked' : 'ready',
|
|
66
|
+
boundary: 'Transport plan describes allowed movement for one operation. It must not infer provenance, mutate sources, or include user secrets in artifacts, source config, or export packages.'
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function configuredLevelForOperation(sourceConfig = {}, operation = '') {
|
|
71
|
+
const candidates = [
|
|
72
|
+
sourceConfig.transportLevels?.[operation],
|
|
73
|
+
sourceConfig.transportLevels?.[operation.replace(/-([a-z])/g, (_, ch) => ch.toUpperCase())],
|
|
74
|
+
sourceConfig.operations?.[operation]?.transportLevel,
|
|
75
|
+
sourceConfig.capabilities?.[operation]?.transportLevel,
|
|
76
|
+
sourceConfig.transportLevel,
|
|
77
|
+
sourceConfig.configuredTransportLevel
|
|
78
|
+
];
|
|
79
|
+
for (const candidate of candidates) {
|
|
80
|
+
const normalized = normalizeTransportLevel(candidate);
|
|
81
|
+
if (normalized) return normalized;
|
|
82
|
+
}
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function hasCredentialMaterial(value = {}) {
|
|
87
|
+
const secretKeys = /(?:token|password|passwd|secret|api[_-]?key|refresh[_-]?token|access[_-]?token|client[_-]?secret)/i;
|
|
88
|
+
const stack = [value];
|
|
89
|
+
const seen = new Set();
|
|
90
|
+
while (stack.length) {
|
|
91
|
+
const item = stack.pop();
|
|
92
|
+
if (!item || typeof item !== 'object' || seen.has(item)) continue;
|
|
93
|
+
seen.add(item);
|
|
94
|
+
for (const [key, child] of Object.entries(item)) {
|
|
95
|
+
if (secretKeys.test(key) && child != null && String(child).trim()) return true;
|
|
96
|
+
if (child && typeof child === 'object') stack.push(child);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function deepFreeze(value) {
|
|
103
|
+
if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value;
|
|
104
|
+
Object.freeze(value);
|
|
105
|
+
for (const child of Object.values(value)) deepFreeze(child);
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { loadNodePortableInput } from '../../input/node.input.js';
|
|
3
|
+
|
|
4
|
+
export async function prepareQualifyColdStartCommandInput(parsed, flags = {}) {
|
|
5
|
+
const evidenceFile = flags.evidence || flags.trace || flags.input || '';
|
|
6
|
+
if (evidenceFile) {
|
|
7
|
+
const evidence = JSON.parse(await readFile(evidenceFile, 'utf8'));
|
|
8
|
+
return { input: { ...evidence, ingressKind: flags.ingress || evidence.ingressKind || evidence.kind || 'routed-handoff-package' }, options: {} };
|
|
9
|
+
}
|
|
10
|
+
const packagePath = String(flags.package || parsed.positionals[0] || '').trim();
|
|
11
|
+
if (!packagePath) throw new Error('portable.cli.cold-start-package-or-evidence.required');
|
|
12
|
+
const material = await loadNodePortableInput([packagePath], { maxFiles: flags['max-files'], maxTextBytes: flags['max-text-bytes'] });
|
|
13
|
+
const interaction = await readOptionalJson(flags.interaction);
|
|
14
|
+
return {
|
|
15
|
+
input: {
|
|
16
|
+
...material,
|
|
17
|
+
bundle: material,
|
|
18
|
+
ingressKind: flags.ingress || flags.kind || 'routed-handoff-package',
|
|
19
|
+
route: flags.route || '',
|
|
20
|
+
packageSourcePath: packagePath,
|
|
21
|
+
preTakeover: flags['pre-takeover'] || 'unverified',
|
|
22
|
+
hostEvidenceSource: flags['evidence-source'] || '',
|
|
23
|
+
interaction: interaction.interaction || interaction,
|
|
24
|
+
holderBinding: { roleLabel: flags['holder-role'] || '', holderId: flags['holder-id'] || '' },
|
|
25
|
+
toolingAvailable: flags['tooling-unavailable'] ? false : true
|
|
26
|
+
},
|
|
27
|
+
options: {}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function readOptionalJson(file) {
|
|
32
|
+
if (!file) return {};
|
|
33
|
+
return JSON.parse(await readFile(file, 'utf8'));
|
|
34
|
+
}
|