@nebulacomponents/citable 1.6.0 → 1.7.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +11 -6
  3. package/dist/universal/.agents/skills/citable/SKILL.md +12 -2
  4. package/dist/universal/.agents/skills/citable/VERSION +1 -1
  5. package/dist/universal/.agents/skills/citable/commands/measurement.md +15 -0
  6. package/dist/universal/.agents/skills/citable/manifest.json +11 -7
  7. package/dist/universal/.agents/skills/citable/references/evidence-authority.md +43 -0
  8. package/dist/universal/.agents/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  9. package/dist/universal/.agents/skills/citable/schemas/crawler-identity.schema.json +42 -0
  10. package/dist/universal/.agents/skills/citable/schemas/evidence-authority.schema.json +15 -0
  11. package/dist/universal/.agents/skills/citable/schemas/observation.schema.json +3 -2
  12. package/dist/universal/.claude/skills/citable/SKILL.md +12 -2
  13. package/dist/universal/.claude/skills/citable/VERSION +1 -1
  14. package/dist/universal/.claude/skills/citable/commands/measurement.md +15 -0
  15. package/dist/universal/.claude/skills/citable/manifest.json +11 -7
  16. package/dist/universal/.claude/skills/citable/references/evidence-authority.md +43 -0
  17. package/dist/universal/.claude/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  18. package/dist/universal/.claude/skills/citable/schemas/crawler-identity.schema.json +42 -0
  19. package/dist/universal/.claude/skills/citable/schemas/evidence-authority.schema.json +15 -0
  20. package/dist/universal/.claude/skills/citable/schemas/observation.schema.json +3 -2
  21. package/dist/universal/.cursor/skills/citable/SKILL.md +12 -2
  22. package/dist/universal/.cursor/skills/citable/VERSION +1 -1
  23. package/dist/universal/.cursor/skills/citable/commands/measurement.md +15 -0
  24. package/dist/universal/.cursor/skills/citable/manifest.json +11 -7
  25. package/dist/universal/.cursor/skills/citable/references/evidence-authority.md +43 -0
  26. package/dist/universal/.cursor/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  27. package/dist/universal/.cursor/skills/citable/schemas/crawler-identity.schema.json +42 -0
  28. package/dist/universal/.cursor/skills/citable/schemas/evidence-authority.schema.json +15 -0
  29. package/dist/universal/.cursor/skills/citable/schemas/observation.schema.json +3 -2
  30. package/dist/universal/.gemini/skills/citable/SKILL.md +12 -2
  31. package/dist/universal/.gemini/skills/citable/VERSION +1 -1
  32. package/dist/universal/.gemini/skills/citable/commands/measurement.md +15 -0
  33. package/dist/universal/.gemini/skills/citable/manifest.json +11 -7
  34. package/dist/universal/.gemini/skills/citable/references/evidence-authority.md +43 -0
  35. package/dist/universal/.gemini/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  36. package/dist/universal/.gemini/skills/citable/schemas/crawler-identity.schema.json +42 -0
  37. package/dist/universal/.gemini/skills/citable/schemas/evidence-authority.schema.json +15 -0
  38. package/dist/universal/.gemini/skills/citable/schemas/observation.schema.json +3 -2
  39. package/dist/universal/.github/skills/citable/SKILL.md +12 -2
  40. package/dist/universal/.github/skills/citable/VERSION +1 -1
  41. package/dist/universal/.github/skills/citable/commands/measurement.md +15 -0
  42. package/dist/universal/.github/skills/citable/manifest.json +11 -7
  43. package/dist/universal/.github/skills/citable/references/evidence-authority.md +43 -0
  44. package/dist/universal/.github/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  45. package/dist/universal/.github/skills/citable/schemas/crawler-identity.schema.json +42 -0
  46. package/dist/universal/.github/skills/citable/schemas/evidence-authority.schema.json +15 -0
  47. package/dist/universal/.github/skills/citable/schemas/observation.schema.json +3 -2
  48. package/dist/universal/.kiro/skills/citable/SKILL.md +12 -2
  49. package/dist/universal/.kiro/skills/citable/VERSION +1 -1
  50. package/dist/universal/.kiro/skills/citable/commands/measurement.md +15 -0
  51. package/dist/universal/.kiro/skills/citable/manifest.json +11 -7
  52. package/dist/universal/.kiro/skills/citable/references/evidence-authority.md +43 -0
  53. package/dist/universal/.kiro/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  54. package/dist/universal/.kiro/skills/citable/schemas/crawler-identity.schema.json +42 -0
  55. package/dist/universal/.kiro/skills/citable/schemas/evidence-authority.schema.json +15 -0
  56. package/dist/universal/.kiro/skills/citable/schemas/observation.schema.json +3 -2
  57. package/dist/universal/.opencode/skills/citable/SKILL.md +12 -2
  58. package/dist/universal/.opencode/skills/citable/VERSION +1 -1
  59. package/dist/universal/.opencode/skills/citable/commands/measurement.md +15 -0
  60. package/dist/universal/.opencode/skills/citable/manifest.json +11 -7
  61. package/dist/universal/.opencode/skills/citable/references/evidence-authority.md +43 -0
  62. package/dist/universal/.opencode/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  63. package/dist/universal/.opencode/skills/citable/schemas/crawler-identity.schema.json +42 -0
  64. package/dist/universal/.opencode/skills/citable/schemas/evidence-authority.schema.json +15 -0
  65. package/dist/universal/.opencode/skills/citable/schemas/observation.schema.json +3 -2
  66. package/dist/universal/.pi/agent/skills/citable/SKILL.md +12 -2
  67. package/dist/universal/.pi/agent/skills/citable/VERSION +1 -1
  68. package/dist/universal/.pi/agent/skills/citable/commands/measurement.md +15 -0
  69. package/dist/universal/.pi/agent/skills/citable/manifest.json +11 -7
  70. package/dist/universal/.pi/agent/skills/citable/references/evidence-authority.md +43 -0
  71. package/dist/universal/.pi/agent/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  72. package/dist/universal/.pi/agent/skills/citable/schemas/crawler-identity.schema.json +42 -0
  73. package/dist/universal/.pi/agent/skills/citable/schemas/evidence-authority.schema.json +15 -0
  74. package/dist/universal/.pi/agent/skills/citable/schemas/observation.schema.json +3 -2
  75. package/dist/universal/.qoder/skills/citable/SKILL.md +12 -2
  76. package/dist/universal/.qoder/skills/citable/VERSION +1 -1
  77. package/dist/universal/.qoder/skills/citable/commands/measurement.md +15 -0
  78. package/dist/universal/.qoder/skills/citable/manifest.json +11 -7
  79. package/dist/universal/.qoder/skills/citable/references/evidence-authority.md +43 -0
  80. package/dist/universal/.qoder/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  81. package/dist/universal/.qoder/skills/citable/schemas/crawler-identity.schema.json +42 -0
  82. package/dist/universal/.qoder/skills/citable/schemas/evidence-authority.schema.json +15 -0
  83. package/dist/universal/.qoder/skills/citable/schemas/observation.schema.json +3 -2
  84. package/dist/universal/.rovodev/skills/citable/SKILL.md +12 -2
  85. package/dist/universal/.rovodev/skills/citable/VERSION +1 -1
  86. package/dist/universal/.rovodev/skills/citable/commands/measurement.md +15 -0
  87. package/dist/universal/.rovodev/skills/citable/manifest.json +11 -7
  88. package/dist/universal/.rovodev/skills/citable/references/evidence-authority.md +43 -0
  89. package/dist/universal/.rovodev/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  90. package/dist/universal/.rovodev/skills/citable/schemas/crawler-identity.schema.json +42 -0
  91. package/dist/universal/.rovodev/skills/citable/schemas/evidence-authority.schema.json +15 -0
  92. package/dist/universal/.rovodev/skills/citable/schemas/observation.schema.json +3 -2
  93. package/dist/universal/.trae/skills/citable/SKILL.md +12 -2
  94. package/dist/universal/.trae/skills/citable/VERSION +1 -1
  95. package/dist/universal/.trae/skills/citable/commands/measurement.md +15 -0
  96. package/dist/universal/.trae/skills/citable/manifest.json +11 -7
  97. package/dist/universal/.trae/skills/citable/references/evidence-authority.md +43 -0
  98. package/dist/universal/.trae/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  99. package/dist/universal/.trae/skills/citable/schemas/crawler-identity.schema.json +42 -0
  100. package/dist/universal/.trae/skills/citable/schemas/evidence-authority.schema.json +15 -0
  101. package/dist/universal/.trae/skills/citable/schemas/observation.schema.json +3 -2
  102. package/dist/universal/.trae-cn/skills/citable/SKILL.md +12 -2
  103. package/dist/universal/.trae-cn/skills/citable/VERSION +1 -1
  104. package/dist/universal/.trae-cn/skills/citable/commands/measurement.md +15 -0
  105. package/dist/universal/.trae-cn/skills/citable/manifest.json +11 -7
  106. package/dist/universal/.trae-cn/skills/citable/references/evidence-authority.md +43 -0
  107. package/dist/universal/.trae-cn/skills/citable/schemas/bing-webmaster.schema.json +25 -0
  108. package/dist/universal/.trae-cn/skills/citable/schemas/crawler-identity.schema.json +42 -0
  109. package/dist/universal/.trae-cn/skills/citable/schemas/evidence-authority.schema.json +15 -0
  110. package/dist/universal/.trae-cn/skills/citable/schemas/observation.schema.json +3 -2
  111. package/dist/universal/manifest.json +135 -87
  112. package/package.json +1 -1
  113. package/schemas/bing-webmaster.schema.json +25 -0
  114. package/schemas/crawler-identity.schema.json +42 -0
  115. package/schemas/evidence-authority.schema.json +15 -0
  116. package/schemas/observation.schema.json +3 -2
  117. package/skill/SKILL.md +12 -2
  118. package/skill/commands/measurement.md +15 -0
  119. package/skill/references/evidence-authority.md +43 -0
  120. package/src/cli/index.js +3 -1
  121. package/src/commands/observe.js +81 -22
  122. package/src/observations/authority.js +13 -0
  123. package/src/observations/common.js +3 -1
  124. package/src/observations/crawlerIdentity.js +60 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebulacomponents/citable",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Production-grade SEO, AEO, and GEO agent skill with auditable detection, claim governance, evidence validation, and multi-agent installation.",
5
5
  "keywords": [
6
6
  "seo",
@@ -0,0 +1,25 @@
1
+ {
2
+ "$id": "citable://schemas/bing-webmaster.schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Normalized Bing Webmaster observation",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["dataset", "date", "url", "metrics", "dimensions", "interpretation_boundary"],
8
+ "properties": {
9
+ "dataset": { "type": "string", "enum": ["search_performance", "ai_performance"] },
10
+ "date": { "type": "string", "format": "date" },
11
+ "url": { "type": ["string", "null"], "format": "uri", "pattern": "^https?://" },
12
+ "metrics": { "type": "object", "additionalProperties": { "type": ["number", "null"] } },
13
+ "dimensions": {
14
+ "type": "object", "additionalProperties": false,
15
+ "properties": {
16
+ "query": { "type": ["string", "null"] },
17
+ "grounding_query": { "type": ["string", "null"] },
18
+ "source": { "type": ["string", "null"] },
19
+ "country": { "type": ["string", "null"] },
20
+ "device": { "type": ["string", "null"] }
21
+ }
22
+ },
23
+ "interpretation_boundary": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
24
+ }
25
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$id": "citable://schemas/crawler-identity.schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Crawler identity evidence contract",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["provider", "declared_user_agent", "observed_source_ip", "range_source", "cidr_membership", "dns", "edge", "origin", "region", "collector", "stages", "verification_status"],
8
+ "properties": {
9
+ "provider": { "type": "string", "minLength": 1 },
10
+ "declared_user_agent": { "type": "string", "minLength": 1 },
11
+ "observed_source_ip": { "type": ["string", "null"] },
12
+ "range_source": {
13
+ "type": "object", "additionalProperties": false,
14
+ "required": ["url", "retrieved_at", "authority", "checksum", "checksum_scope", "checksum_valid"],
15
+ "properties": {
16
+ "url": { "type": ["string", "null"], "format": "uri" },
17
+ "retrieved_at": { "type": ["string", "null"], "format": "date-time" },
18
+ "authority": { "type": "string", "enum": ["provider_published", "owner_controlled", "third_party", "unknown"] },
19
+ "checksum": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$" },
20
+ "checksum_scope": { "type": "string", "enum": ["source_snapshot", "not_captured"] },
21
+ "checksum_valid": { "type": "boolean" }
22
+ }
23
+ },
24
+ "cidr_membership": { "type": "string", "enum": ["matched", "not_matched", "not_tested", "invalid"] },
25
+ "dns": {
26
+ "type": "object", "additionalProperties": false, "required": ["status", "method"],
27
+ "properties": { "status": { "type": "string", "enum": ["verified", "failed", "not_tested"] }, "method": { "type": ["string", "null"] } }
28
+ },
29
+ "edge": {
30
+ "type": "object", "additionalProperties": false, "required": ["observed", "decision"],
31
+ "properties": { "observed": { "type": "boolean" }, "decision": { "type": ["string", "null"] } }
32
+ },
33
+ "origin": {
34
+ "type": "object", "additionalProperties": false, "required": ["observed", "status"],
35
+ "properties": { "observed": { "type": "boolean" }, "status": { "type": ["integer", "null"], "minimum": 100, "maximum": 599 } }
36
+ },
37
+ "region": { "type": ["string", "null"] },
38
+ "collector": { "type": "string", "minLength": 1 },
39
+ "stages": { "type": "array", "uniqueItems": true, "items": { "type": "string", "enum": ["declared", "synthetically_observed", "range_matched", "dns_verified", "edge_observed", "origin_observed", "fully_verified", "contradictory", "insufficient_evidence"] } },
40
+ "verification_status": { "type": "string", "enum": ["declared", "synthetically_observed", "range_matched", "dns_verified", "edge_observed", "origin_observed", "fully_verified", "contradictory", "insufficient_evidence"] }
41
+ }
42
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$id": "citable://schemas/evidence-authority.schema.json",
3
+ "$schema": "http://json-schema.org/draft-07/schema#",
4
+ "title": "Multidimensional evidence authority",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": ["source_authority", "collection_authority", "authenticity_status", "representativeness"],
8
+ "properties": {
9
+ "source_authority": { "type": "string", "enum": ["provider_published", "standards_body", "owner_controlled", "independently_controlled", "third_party_commercial", "synthetic", "inferred", "unknown"] },
10
+ "collection_authority": { "type": "string", "enum": ["direct_api", "production_log", "browser_capture", "owner_export", "third_party_export", "manual_entry", "model_generated_inference", "static_analysis", "synthetic_probe"] },
11
+ "authenticity_status": { "type": "string", "enum": ["cryptographically_authenticated", "provider_range_verified", "owner_attested", "transport_authenticated", "checksum_protected_only", "unverified"] },
12
+ "representativeness": { "type": "string", "enum": ["production_population", "complete_export", "statistically_sampled", "controlled_experiment", "convenience_sample", "single_observation", "unknown"] },
13
+ "limitations": { "type": "array", "items": { "type": "string", "minLength": 1 } }
14
+ }
15
+ }
@@ -7,7 +7,7 @@
7
7
  "required": ["observation_id", "kind", "state", "collected_at", "collection_method", "confidence", "source", "evidence_hash", "data"],
8
8
  "properties": {
9
9
  "observation_id": { "type": "string", "minLength": 1 },
10
- "kind": { "type": "string", "enum": ["render", "index", "citation", "citation_review", "crawler_log", "passage", "canonical_freshness", "performance", "corroboration", "metric"] },
10
+ "kind": { "type": "string", "enum": ["render", "index", "citation", "citation_review", "crawler_log", "bing_webmaster", "passage", "canonical_freshness", "performance", "corroboration", "metric"] },
11
11
  "state": { "type": "string", "enum": ["observed", "not_observed", "not_evidenced", "incomplete", "review_required", "failed"] },
12
12
  "collected_at": { "type": "string", "format": "date-time" },
13
13
  "collection_method": { "type": "string", "enum": ["live_api", "browser", "owner_import", "synthetic_fetch", "static_analysis", "human_review"] },
@@ -15,6 +15,7 @@
15
15
  "source": { "type": "string", "minLength": 1 },
16
16
  "evidence_hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
17
17
  "data": { "type": "object" },
18
- "limitations": { "type": "array", "items": { "type": "string" } }
18
+ "limitations": { "type": "array", "items": { "type": "string" } },
19
+ "authority": { "$ref": "citable://schemas/evidence-authority.schema.json" }
19
20
  }
20
21
  }
package/skill/SKILL.md CHANGED
@@ -7,12 +7,16 @@ description: >
7
7
  generative engine optimization, structured data governance, claim substantiation,
8
8
  crawler policy, entity consistency, content discoverability, or wants a site audited
9
9
  for how search and AI systems will retrieve, understand, cite, or recommend it.
10
- version: 1.6.0
10
+ version: 1.7.0
11
11
  ---
12
12
 
13
- # Citable — search & generative discoverability governance
13
+ # Citable — evidence and change control for search and AI citation readiness
14
14
 
15
15
  Citable is an operational quality and governance layer, not a content generator.
16
+ It records what a property makes technically available, what its content can
17
+ support, and what external systems have actually been observed doing. It does
18
+ not score visibility; it establishes what is eligible, supportable, observed,
19
+ changed, and still unknown.
16
20
  It treats discoverability as an engineering system: registries as the source of
17
21
  truth, deterministic detectors for observable conditions, rubrics for semantic
18
22
  judgment, evidence packages for every run, and fail-closed behaviour wherever a
@@ -70,6 +74,11 @@ Within retrieval, distinguish `allowed_by_policy`, `synthetic_fetch_succeeded`,
70
74
  citation testing, distinguish mention, citation, material support, canonical
71
75
  source selection, and recommendation. These states are not interchangeable.
72
76
 
77
+ Evidence preservation, authority, authenticity, collection method, and
78
+ representativeness are also independent. Follow
79
+ `references/evidence-authority.md`; a checksum or CIDR match alone never proves
80
+ source authenticity, complete coverage, or verified crawler identity.
81
+
73
82
  ## Tooling
74
83
 
75
84
  The `citable` CLI in this repository performs the deterministic work. Always
@@ -86,6 +95,7 @@ citable validate [registries|claims|evidence|schema|links]
86
95
  citable compare-snapshots [runA runB]
87
96
  citable action-plan [run-id] # ordered actions, blockers, semantic gates, verification
88
97
  citable observe <mode> [options] # render/index/citation/log/passage/consensus/performance evidence
98
+ citable observe bing --dataset <search_performance|ai_performance> --input <csv|json>
89
99
  citable apply --input <spec> [--write] # reviewed, hash-locked remediation; dry run by default
90
100
  citable monitor [runA runB] # observation regression alerts
91
101
  citable metrics import --provider <name> --input <csv|json>
@@ -70,6 +70,21 @@ agent × URL × status; flag 403/429/5xx concentrations against declared-allow
70
70
  crawlers; note that user-agent strings are spoofable and IP validation is the
71
71
  confirmation step (crawler registry ip_validation_method). Compare observed
72
72
  access against `crawlers.yaml` decisions (CRAWL-001 logic applied to logs).
73
+ Normalize JSON or CSV edge/origin events into the crawler identity contract.
74
+ Do not label CIDR membership alone verified: preserve range-source provenance,
75
+ DNS, edge, origin, region, collector, stages, and contradiction state.
76
+ Remove credentials, cookies, secrets, and unnecessary personal data before
77
+ import. Citable rejects common sensitive field names but cannot establish that
78
+ arbitrary URL or query values are lawful or appropriately minimized.
79
+
80
+ # Bing owner observations
81
+
82
+ Use `citable observe bing --dataset search_performance|ai_performance --input
83
+ <csv|json>`. This release normalizes owner exports because no supported Bing AI
84
+ Performance API contract has been captured. Citation counts do not indicate
85
+ ranking, authority, placement, page importance, or material support. Grounding
86
+ queries may be sampled. Preserve traffic-source dimensions and never infer
87
+ causation from a temporal change.
73
88
 
74
89
  # monitor-contradictions
75
90
  Compare approved entity + claim records against: owned pages (automated, via
@@ -0,0 +1,43 @@
1
+ # Evidence authority and crawler identity
2
+
3
+ An evidence checksum establishes preservation only. It does not establish that
4
+ the source was authentic, the collection was complete, or the observation was
5
+ representative. Report four axes independently on every new observation:
6
+
7
+ 1. `source_authority`: provider-published, standards-body, owner-controlled,
8
+ independently controlled, third-party commercial, synthetic, inferred, or
9
+ unknown.
10
+ 2. `collection_authority`: direct API, production log, browser capture, owner
11
+ export, third-party export, manual entry, model-generated inference, static
12
+ analysis, or synthetic probe.
13
+ 3. `authenticity_status`: cryptographically authenticated, provider-range
14
+ verified, owner-attested, transport-authenticated, checksum-protected only,
15
+ or unverified.
16
+ 4. `representativeness`: production population, complete export,
17
+ statistically sampled, controlled experiment, convenience sample, single
18
+ observation, or unknown.
19
+
20
+ Never convert these axes into one authority score.
21
+
22
+ ## Crawler identity
23
+
24
+ Contract support and verified observations are different outcomes. The
25
+ `crawler-identity` schema can exist without any production event satisfying it.
26
+ A user-agent match is `declared`. A synthetic request is
27
+ `synthetically_observed`. An observed IP in an imported range is only
28
+ `range_matched`.
29
+
30
+ `fully_verified` requires all of:
31
+
32
+ - a provider and declared user agent;
33
+ - observed source IP matching the captured CIDR set;
34
+ - provider-published range source URL, retrieval time, captured source snapshot,
35
+ and valid snapshot checksum;
36
+ - documented forward/reverse DNS verification where applicable;
37
+ - an explicit edge observation and decision;
38
+ - a correlated origin observation and status;
39
+ - region and collector identity.
40
+
41
+ A failed range or DNS check, or a claimed verification without the required
42
+ chain, is `contradictory`. Missing links are `insufficient_evidence`. Verification
43
+ applies only to the captured event; it does not establish all crawler traffic.
package/src/cli/index.js CHANGED
@@ -39,7 +39,7 @@ Commands
39
39
  validate [mode] registries (default) | claims | evidence | schema | links
40
40
  compare-snapshots [a b] Regression diff between two audit runs
41
41
  action-plan [run] Turn audit findings into ordered remediation work
42
- observe <mode> Collect render, index, citation, log, passage,
42
+ observe <mode> Collect render, index, citation, log, Bing, passage,
43
43
  consensus, performance, or corroboration evidence
44
44
  apply Apply a reviewed, hash-locked remediation spec
45
45
  monitor [runA runB] Compare observation runs and emit regression alerts
@@ -61,6 +61,7 @@ Options
61
61
  --ref-date <YYYY-MM-DD> Reference date for expiry/staleness checks (default: today)
62
62
  --input <file> Import file or remediation specification
63
63
  --provider <name> Provider label for imported observations
64
+ --dataset <name> Provider export dataset (for example ai_performance)
64
65
  --connection-id <id> Connection registry identifier
65
66
  --property-id <id> Provider property or site identifier
66
67
  --credential-env <name> Environment variable containing the access token
@@ -88,6 +89,7 @@ function parseArgs(argv) {
88
89
  else if (a === '--ref-date') args.refDate = argv[++i];
89
90
  else if (a === '--input') args.input = argv[++i];
90
91
  else if (a === '--provider') args.provider = argv[++i];
92
+ else if (a === '--dataset') args.dataset = argv[++i];
91
93
  else if (a === '--connection-id') args.connectionId = argv[++i];
92
94
  else if (a === '--property-id') args.propertyId = argv[++i];
93
95
  else if (a === '--credential-env') args.credentialEnv = argv[++i];
@@ -2,10 +2,15 @@ import { buildContext } from './context.js';
2
2
  import { envelope, observationRun, readInput } from '../observations/common.js';
3
3
  import { sha256 } from '../shared/io.js';
4
4
  import { fetchUrl } from '../crawler/fetch.js';
5
- import net from 'node:net';
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { parse as parseCsv } from 'csv-parse/sync';
8
+ import { crawlerIdentity } from '../observations/crawlerIdentity.js';
9
+ import { validateAgainst } from '../shared/schemaValidator.js';
6
10
 
7
11
  const originOf = (value) => { try { return new URL(value).origin; } catch { return null; } };
8
12
  const words = (text) => String(text || '').trim().split(/\s+/).filter(Boolean);
13
+ const strictDate = (value) => /^\d{4}-\d{2}-\d{2}$/.test(value || '') && new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) === value;
9
14
 
10
15
  function canonicalReview(raw, targetOrigin) {
11
16
  const citations = raw.citations || [];
@@ -125,32 +130,85 @@ async function observeCitations(root, options) {
125
130
  }
126
131
 
127
132
  function observeLogs(root, options) {
128
- const input = readInput(options.input);
129
- const rows = Array.isArray(input.value) ? input.value : input.value.requests || [];
130
- const ranges = input.value.provider_ranges || {};
131
- const verify = (row) => {
132
- const cidrs = ranges[row.user_agent] || [];
133
- if (!row.source_ip || !cidrs.length) return { verified: false, method: null };
134
- const family = net.isIP(row.source_ip);
135
- if (!family) return { verified: false, method: 'invalid source IP' };
136
- const block = new net.BlockList();
137
- for (const cidr of cidrs) {
138
- const [network, prefix] = cidr.split('/');
139
- const rangeFamily = net.isIP(network);
140
- if (rangeFamily === family && Number.isInteger(Number(prefix))) block.addSubnet(network, Number(prefix), family === 4 ? 'ipv4' : 'ipv6');
141
- }
142
- return { verified: block.check(row.source_ip, family === 4 ? 'ipv4' : 'ipv6'), method: `matched imported ${row.user_agent} CIDR set` };
143
- };
133
+ if (!options.input || !fs.existsSync(options.input)) throw new Error('logs requires --input <json|csv>');
134
+ const raw = fs.readFileSync(options.input, 'utf8'), ext = path.extname(options.input).toLowerCase();
135
+ const value = ext === '.csv' ? { requests: parseCsv(raw, { columns: true, skip_empty_lines: true, trim: true }) } : JSON.parse(raw);
136
+ const input = { raw, value, file: path.resolve(options.input) };
137
+ const rows = (Array.isArray(value) ? value : value.requests || []).map((row) => ({
138
+ ...row,
139
+ timestamp: row.timestamp || row.datetime || row.date,
140
+ url: row.url || row.request_url || row['cs-uri-stem'],
141
+ user_agent: row.user_agent || row.userAgent || row['cs(User-Agent)'],
142
+ source_ip: row.source_ip || row.clientIP || row['c-ip'],
143
+ status: Number(row.status || row.status_code || row['sc-status']),
144
+ bytes: row.bytes == null ? null : Number(row.bytes),
145
+ latency_ms: row.latency_ms == null ? null : Number(row.latency_ms),
146
+ edge_observed: row.edge_observed === true || row.edge_observed === 'true',
147
+ origin_observed: row.origin_observed === true || row.origin_observed === 'true',
148
+ origin_status: row.origin_status == null || row.origin_status === '' ? null : Number(row.origin_status),
149
+ claimed_verified: row.claimed_verified === true || row.claimed_verified === 'true',
150
+ }));
151
+ const sensitive = (Array.isArray(value) ? value : value.requests || []).flatMap((row) => Object.keys(row).filter((key) => /(^|[-_])(authorization|cookie|set-cookie|access[-_]?token|refresh[-_]?token|api[-_]?key|password|secret)($|[-_])/i.test(key)));
152
+ if (sensitive.length) throw new Error(`log import contains sensitive fields that must be removed before collection: ${[...new Set(sensitive)].join(', ')}`);
153
+ const ranges = value.provider_ranges || {}, rangeSources = value.range_sources || {}, metadata = value.metadata || {};
144
154
  const observations = rows.map((row) => {
145
- const identity = verify(row);
155
+ if (!row.timestamp || Number.isNaN(Date.parse(row.timestamp)) || !row.url || !row.user_agent || !Number.isInteger(row.status)) throw new Error('each log row requires valid timestamp, url, user_agent, and integer status');
156
+ const identity = crawlerIdentity(row, { ranges, rangeSources, collector: metadata.collector || 'owner_import' });
157
+ const fullyVerified = identity.verification_status === 'fully_verified';
146
158
  return envelope('crawler_log', {
147
159
  timestamp: row.timestamp, url: row.url, user_agent: row.user_agent, source_ip: row.source_ip,
148
160
  status: row.status, bytes: row.bytes ?? null, latency_ms: row.latency_ms ?? null,
149
161
  cache_status: row.cache_status ?? null, region: row.region ?? null,
150
- identity_verified: identity.verified, verification_method: identity.method,
151
- }, { method: 'owner_import', source: input.file, raw: JSON.stringify(row), confidence: identity.verified ? 'high' : 'low', limitations: identity.verified ? ['CIDR ranges were imported with the log evidence; their provider currency must be established by source metadata.'] : ['User-agent strings alone do not verify crawler identity.'] });
162
+ crawler_identity: identity,
163
+ }, { method: 'owner_import', source: input.file, raw: JSON.stringify(row), confidence: fullyVerified ? 'confirmed' : identity.verification_status === 'contradictory' ? 'high' : 'low',
164
+ authority: { collection_authority: 'production_log', authenticity_status: fullyVerified ? 'provider_range_verified' : 'checksum_protected_only', representativeness: metadata.representativeness || 'unknown' },
165
+ limitations: fullyVerified ? ['Verification applies only to this imported production event and captured verification chain.'] : ['The crawler identity chain is incomplete or contradictory; user agent and CIDR matching alone are insufficient.'] });
166
+ });
167
+ return observationRun(root, 'observe logs', input.file, observations, { rawInputs: { server_logs: input.raw }, incomplete: observations.some((o) => o.data.crawler_identity.verification_status !== 'fully_verified') ? ['Some crawler identities are not fully verified.'] : [] });
168
+ }
169
+
170
+ function observeBing(root, options) {
171
+ if (!options.input || !fs.existsSync(options.input)) throw new Error('bing requires --input <json|csv> --dataset <search_performance|ai_performance>');
172
+ if (!['search_performance', 'ai_performance'].includes(options.dataset)) throw new Error('bing dataset must be search_performance or ai_performance');
173
+ const raw = fs.readFileSync(options.input, 'utf8'), ext = path.extname(options.input).toLowerCase();
174
+ const value = ext === '.csv' ? parseCsv(raw, { columns: true, skip_empty_lines: true, trim: true }) : JSON.parse(raw);
175
+ const document = Array.isArray(value) ? { rows: value } : value;
176
+ const rows = document.rows || document.items || [];
177
+ if (!rows.length) throw new Error('Bing owner export contains no rows');
178
+ const numeric = (row, ...names) => {
179
+ const rawValue = names.map((name) => row[name]).find((item) => item !== '' && item != null);
180
+ if (rawValue == null) return null;
181
+ const result = Number(String(rawValue).replace(/%$/, ''));
182
+ if (!Number.isFinite(result)) throw new Error(`Bing metric ${names[0]} must be numeric`);
183
+ return String(rawValue).endsWith('%') ? result / 100 : result;
184
+ };
185
+ const observations = rows.map((row) => {
186
+ const date = row.date || row.Date;
187
+ if (!strictDate(date)) throw new Error('each Bing row requires a valid date in YYYY-MM-DD format');
188
+ const metrics = options.dataset === 'ai_performance' ? {
189
+ total_citations: numeric(row, 'total_citations', 'Total Citations', 'citations'),
190
+ average_cited_pages: numeric(row, 'average_cited_pages', 'Average Cited Pages'),
191
+ } : {
192
+ clicks: numeric(row, 'clicks', 'Clicks'), impressions: numeric(row, 'impressions', 'Impressions'),
193
+ ctr: numeric(row, 'ctr', 'CTR', 'Average CTR'), position: numeric(row, 'position', 'Average Position'),
194
+ crawl_requests: numeric(row, 'crawl_requests', 'Crawl Requests'), crawl_errors: numeric(row, 'crawl_errors', 'Crawl Errors'),
195
+ indexed_pages: numeric(row, 'indexed_pages', 'Indexed Pages'),
196
+ };
197
+ const boundaries = options.dataset === 'ai_performance'
198
+ ? ['Citation counts do not indicate ranking, authority, placement, page importance, or material support.', 'Grounding queries are sampled and the dashboard aggregates supported Microsoft AI surfaces.']
199
+ : ['Bing search performance can combine traffic sources; source dimensions must be preserved.', 'Observed performance does not establish that an intervention caused a change.'];
200
+ if (!Object.values(metrics).some((value) => value != null)) throw new Error(`Bing ${options.dataset} row contains no recognized metrics`);
201
+ const data = {
202
+ dataset: options.dataset, date, url: row.url || row.URL || row.page || null, metrics,
203
+ dimensions: { query: row.query || row.Query || null, grounding_query: row.grounding_query || row['Grounding Query'] || null, source: row.source || row.Source || null, country: row.country || row.Country || null, device: row.device || row.Device || null },
204
+ interpretation_boundary: boundaries,
205
+ };
206
+ const check = validateAgainst('bing-webmaster.schema.json', data);
207
+ if (!check.valid) throw new Error(`Bing observation violates contract: ${check.errors.join('; ')}`);
208
+ return envelope('bing_webmaster', data, { method: 'owner_import', source: path.resolve(options.input), raw: JSON.stringify(row),
209
+ authority: { representativeness: document.metadata?.representativeness || 'unknown' }, limitations: boundaries });
152
210
  });
153
- return observationRun(root, 'observe logs', input.file, observations, { rawInputs: { server_logs: input.raw }, incomplete: observations.some((o) => !o.data.identity_verified) ? ['Some crawler identities are not IP-verified.'] : [] });
211
+ return observationRun(root, 'observe bing', path.resolve(options.input), observations, { rawInputs: { bing_owner_export: raw }, warnings: ['Bing AI Performance has no supported API contract captured by this release; this evidence is an owner export.'] });
154
212
  }
155
213
 
156
214
  async function observePassages(root, options) {
@@ -226,10 +284,11 @@ export async function observe(root, mode, options = {}) {
226
284
  case 'index': return observeIndex(root, options);
227
285
  case 'citations': return observeCitations(root, options);
228
286
  case 'logs': return observeLogs(root, options);
287
+ case 'bing': return observeBing(root, options);
229
288
  case 'passages': return observePassages(root, options);
230
289
  case 'consensus': return observeConsensus(root, options);
231
290
  case 'performance': return observePerformance(root, options);
232
291
  case 'corroboration': return observeCorroboration(root, options);
233
- default: throw new Error('observe mode must be render, index, citations, logs, passages, consensus, performance, or corroboration');
292
+ default: throw new Error('observe mode must be render, index, citations, logs, bing, passages, consensus, performance, or corroboration');
234
293
  }
235
294
  }
@@ -0,0 +1,13 @@
1
+ const DEFAULTS = {
2
+ live_api: ['provider_published', 'direct_api', 'transport_authenticated', 'unknown'],
3
+ browser: ['synthetic', 'browser_capture', 'checksum_protected_only', 'single_observation'],
4
+ owner_import: ['owner_controlled', 'owner_export', 'checksum_protected_only', 'unknown'],
5
+ synthetic_fetch: ['synthetic', 'synthetic_probe', 'checksum_protected_only', 'single_observation'],
6
+ static_analysis: ['inferred', 'static_analysis', 'checksum_protected_only', 'single_observation'],
7
+ human_review: ['owner_controlled', 'manual_entry', 'owner_attested', 'single_observation'],
8
+ };
9
+
10
+ export function evidenceAuthority(method, overrides = {}) {
11
+ const [source_authority, collection_authority, authenticity_status, representativeness] = DEFAULTS[method] || DEFAULTS.static_analysis;
12
+ return { source_authority, collection_authority, authenticity_status, representativeness, ...overrides };
13
+ }
@@ -3,6 +3,7 @@ import path from 'node:path';
3
3
  import { createRun } from '../evidence/run.js';
4
4
  import { nowIso, readJson, sha256 } from '../shared/io.js';
5
5
  import { validateAgainst } from '../shared/schemaValidator.js';
6
+ import { evidenceAuthority } from './authority.js';
6
7
 
7
8
  export function readInput(input) {
8
9
  if (!input) throw new Error('--input <json> is required for this collector');
@@ -10,12 +11,13 @@ export function readInput(input) {
10
11
  return { raw: fs.readFileSync(input, 'utf8'), value: readJson(input), file: path.resolve(input) };
11
12
  }
12
13
 
13
- export function envelope(kind, data, { method, source, state = 'observed', confidence = 'confirmed', limitations = [], raw } = {}) {
14
+ export function envelope(kind, data, { method, source, state = 'observed', confidence = 'confirmed', limitations = [], authority, raw } = {}) {
14
15
  const evidence = raw ?? JSON.stringify(data);
15
16
  const item = {
16
17
  observation_id: `OBS-${kind.toUpperCase()}-${sha256(evidence).slice(0, 16)}`,
17
18
  kind, state, collected_at: nowIso(), collection_method: method,
18
19
  confidence, source, evidence_hash: sha256(evidence), data, limitations,
20
+ authority: evidenceAuthority(method, authority),
19
21
  };
20
22
  const check = validateAgainst('observation.schema.json', item);
21
23
  if (!check.valid) throw new Error(`observation violates contract: ${check.errors.join('; ')}`);
@@ -0,0 +1,60 @@
1
+ import net from 'node:net';
2
+ import { sha256 } from '../shared/io.js';
3
+ import { validateAgainst } from '../shared/schemaValidator.js';
4
+
5
+ function cidrMembership(sourceIp, cidrs) {
6
+ if (!sourceIp) return 'not_tested';
7
+ const family = net.isIP(sourceIp);
8
+ if (!family) return 'invalid';
9
+ const block = new net.BlockList();
10
+ for (const cidr of cidrs || []) {
11
+ const [network, prefixText] = String(cidr).split('/');
12
+ const prefix = Number(prefixText), rangeFamily = net.isIP(network);
13
+ if (rangeFamily === family && Number.isInteger(prefix)) block.addSubnet(network, prefix, family === 4 ? 'ipv4' : 'ipv6');
14
+ }
15
+ return block.check(sourceIp, family === 4 ? 'ipv4' : 'ipv6') ? 'matched' : 'not_matched';
16
+ }
17
+
18
+ export function crawlerIdentity(row, { ranges = {}, rangeSources = {}, collector = 'owner_import' } = {}) {
19
+ const ua = row.user_agent, cidrs = ranges[ua] || [], source = rangeSources[ua] || {};
20
+ const sourceSnapshot = source.source_snapshot;
21
+ const expectedChecksum = sourceSnapshot == null ? null : sha256(typeof sourceSnapshot === 'string' ? sourceSnapshot : JSON.stringify(sourceSnapshot));
22
+ const rangeSource = {
23
+ url: source.url || null,
24
+ retrieved_at: source.retrieved_at || null,
25
+ authority: source.authority || 'unknown',
26
+ checksum: source.checksum || null,
27
+ checksum_scope: sourceSnapshot == null ? 'not_captured' : 'source_snapshot',
28
+ checksum_valid: Boolean(source.checksum && expectedChecksum && source.checksum === expectedChecksum),
29
+ };
30
+ const membership = cidrMembership(row.source_ip, cidrs);
31
+ const dns = { status: row.dns_status || 'not_tested', method: row.dns_method || null };
32
+ const edge = { observed: row.edge_observed === true, decision: row.edge_decision || null };
33
+ const origin = { observed: row.origin_observed === true, status: row.origin_status ?? null };
34
+ const stages = ['declared'];
35
+ if (row.synthetic === true) stages.push('synthetically_observed');
36
+ if (membership === 'matched') stages.push('range_matched');
37
+ if (dns.status === 'verified') stages.push('dns_verified');
38
+ if (edge.observed) stages.push('edge_observed');
39
+ if (origin.observed) stages.push('origin_observed');
40
+ const contradictory = membership === 'not_matched' || dns.status === 'failed' || (row.claimed_verified === true && (!rangeSource.checksum_valid || membership !== 'matched'));
41
+ const complete = identityProvider(row, source) !== 'unknown' && row.synthetic !== true && rangeSource.url && rangeSource.retrieved_at && rangeSource.authority === 'provider_published' && rangeSource.checksum_scope === 'source_snapshot' && rangeSource.checksum_valid && membership === 'matched' && dns.status === 'verified' && edge.observed && origin.observed;
42
+ if (contradictory) stages.push('contradictory');
43
+ else if (complete) stages.push('fully_verified');
44
+ else stages.push('insufficient_evidence');
45
+ const precedence = ['contradictory', 'fully_verified', 'origin_observed', 'edge_observed', 'dns_verified', 'range_matched', 'synthetically_observed', 'declared'];
46
+ const verificationStatus = precedence.find((state) => stages.includes(state));
47
+ const identity = {
48
+ provider: identityProvider(row, source), declared_user_agent: ua,
49
+ observed_source_ip: row.source_ip || null, range_source: rangeSource,
50
+ cidr_membership: membership, dns, edge, origin, region: row.region || null,
51
+ collector, stages, verification_status: verificationStatus,
52
+ };
53
+ const check = validateAgainst('crawler-identity.schema.json', identity);
54
+ if (!check.valid) throw new Error(`crawler identity violates contract: ${check.errors.join('; ')}`);
55
+ return identity;
56
+ }
57
+
58
+ function identityProvider(row, source) {
59
+ return row.provider || source.provider || 'unknown';
60
+ }