humanish 0.32.0 → 0.34.0

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/dist/run.js CHANGED
@@ -4625,6 +4625,9 @@ function isRunBundle(value) {
4625
4625
  // Optional, adapter-namespaced product score (the extension seam). When present, validate only
4626
4626
  // its SHAPE; core never reads the adapter's `data` payload.
4627
4627
  && (value.adapterScore === undefined || isRunAdapterScore(value.adapterScore))
4628
+ // Optional + additive scorer provenance (#316). Tolerated-absent so pre-#316 and library-caller
4629
+ // bundles still verify; when present it must be well-shaped.
4630
+ && (value.scorerProvenance === undefined || isRunScorerProvenance(value.scorerProvenance))
4628
4631
  && (value.adapterArtifacts === undefined
4629
4632
  || (Array.isArray(value.adapterArtifacts) && value.adapterArtifacts.every(isRunAdapterArtifact)))
4630
4633
  && (value.providerResources === undefined
@@ -4711,6 +4714,23 @@ function isDesktopBrowserEvidence(value) {
4711
4714
  && (value.requested === "default" || value.requested === "chrome" || value.requested === "chromium" || value.requested === "firefox")
4712
4715
  && (value.resolved === undefined || typeof value.resolved === "string");
4713
4716
  }
4717
+ /** Short lowercase-hex content digest (digestText default is 12 chars; tolerate longer future digests). */
4718
+ const SCORER_DIGEST_PATTERN = /^[a-f0-9]{12,64}$/;
4719
+ /** Shape guard for RunScorerProvenance (#316), mirroring isRunSubjectProvenance: tolerated-absent in
4720
+ * isRunBundle, well-shaped when present. Semantics (does the digest still match the file) are not a
4721
+ * verify concern — the block is core-stamped evidence of what was loaded, not a re-execution proof. */
4722
+ function isRunScorerProvenance(value) {
4723
+ return isRecord(value)
4724
+ && value.schema === "humanish.scorer-provenance.v1"
4725
+ && typeof value.ref === "string"
4726
+ && value.ref.trim().length > 0
4727
+ && typeof value.digest === "string"
4728
+ && SCORER_DIGEST_PATTERN.test(value.digest)
4729
+ && (value.source === "manifest" || value.source === "cli-flag")
4730
+ && Array.isArray(value.exports)
4731
+ && value.exports.length > 0
4732
+ && value.exports.every((name) => name === "score" || name === "deriveFeedback" || name === "deriveArtifacts");
4733
+ }
4714
4734
  function isRunAdapterScore(value) {
4715
4735
  return isRecord(value)
4716
4736
  && value.schema === "humanish.adapter-score.v1"