@warpgogol/werkstatt-shared 0.14.1 → 0.16.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 (451) hide show
  1. package/README.md +23 -15
  2. package/README.uk.md +1 -1
  3. package/package.json +534 -766
  4. package/src/{share/agent → agent}/api-catalog.ts +14 -1
  5. package/src/{share/agent → agent}/ard-catalog.ts +6 -1
  6. package/src/{share/agent → agent}/dns-aid.test.ts +2 -2
  7. package/src/agent/guidance.ts +52 -0
  8. package/src/agent/health.ts +68 -0
  9. package/src/{share/agent → agent}/index.ts +5 -1
  10. package/src/{share/agent → agent}/manifest.ts +83 -6
  11. package/src/{share/agent → agent}/openapi.ts +97 -4
  12. package/src/agent/receipt.ts +123 -0
  13. package/src/{share/agent → agent}/search.test.ts +3 -0
  14. package/src/{share/agent → agent}/search.ts +31 -5
  15. package/src/{share → agent}/tests/api-catalog.test.ts +8 -2
  16. package/src/{share → agent}/tests/ard-catalog.test.ts +11 -2
  17. package/src/{share → agent}/tests/capability.test.ts +1 -1
  18. package/src/{share → agent}/tests/fleet-catalog.test.ts +1 -1
  19. package/src/{share → agent}/tests/knowledge.test.ts +2 -2
  20. package/src/{share → agent}/tests/manifest.test.ts +72 -1
  21. package/src/{share → agent}/tests/mcp-card.test.ts +6 -2
  22. package/src/{share → agent}/tests/openapi.test.ts +119 -2
  23. package/src/{share → agent}/tests/proof.test.ts +1 -1
  24. package/src/{share → attribution}/material-credits.ts +4 -4
  25. package/src/{share → checks}/check-hints.ts +6 -1
  26. package/src/checks/index.ts +4 -1
  27. package/src/checks/lib/astro-site-url.ts +6 -1
  28. package/src/checks/lib/i18n.ts +14 -0
  29. package/src/checks/result-helpers.ts +2 -2
  30. package/src/checks/tests/remediation-auto-populate.test.ts +1 -1
  31. package/src/{share → client-scripts}/counter-utils.ts +6 -2
  32. package/src/{share/scripts → client-scripts}/external-link-qr.ts +11 -16
  33. package/src/{share/scripts → client-scripts}/external-links.ts +12 -1
  34. package/src/{share/scripts → client-scripts}/gsap-counter.ts +8 -3
  35. package/src/client-scripts/index.ts +35 -0
  36. package/src/{share/scripts → client-scripts}/inline-number-animation.ts +1 -1
  37. package/src/{share/scripts → client-scripts}/lenis.ts +6 -1
  38. package/src/{share/scripts → client-scripts}/lordicon.ts +6 -1
  39. package/src/{share/scripts → client-scripts}/orchestrator.ts +10 -1
  40. package/src/{share/scripts → client-scripts}/scheduler.ts +6 -1
  41. package/src/client-scripts/scroll-spy.ts +106 -0
  42. package/src/client-scripts/tests/orchestrator.test.ts +47 -0
  43. package/src/client-scripts/tests/scroll-spy.test.ts +204 -0
  44. package/src/{share/scripts → client-scripts/tests}/video-player.test.ts +51 -31
  45. package/src/component/contracts.ts +206 -0
  46. package/src/component/index.ts +13 -0
  47. package/src/{share → content}/content-reference.ts +3 -3
  48. package/src/{share/content → content}/entity-id.ts +6 -3
  49. package/src/content/index.ts +3 -0
  50. package/src/{share/content → content}/merge.ts +6 -1
  51. package/src/content/system-manifest.test.ts +107 -0
  52. package/src/content/system-manifest.ts +12 -94
  53. package/src/{share → content}/tests/resolve-field-path.test.ts +1 -1
  54. package/src/{share → content}/tests/substitute-deep.test.ts +1 -1
  55. package/src/content-discipline/index.ts +19 -0
  56. package/src/{share/content-discipline → content-discipline}/parsers.ts +2 -2
  57. package/src/{share/env.d.ts → env.d.ts} +6 -3
  58. package/src/fingerprint/canonical-json.ts +731 -0
  59. package/src/fingerprint/index.ts +14 -0
  60. package/src/fingerprint/primitives.ts +72 -0
  61. package/src/{share/i18n → i18n}/localization.ts +6 -2
  62. package/src/integration/adapters.ts +10 -71
  63. package/src/integration/dispatch.ts +1 -1
  64. package/src/integration/funnel.ts +6 -1
  65. package/src/integration/idempotency.ts +88 -0
  66. package/src/integration/index.ts +105 -4
  67. package/src/integration/lagebild-destination-adapter.ts +108 -0
  68. package/src/integration/lagebild-ingress.ts +7 -12
  69. package/src/integration/orchestration.ts +11 -10
  70. package/src/integration/tests/deliver-event.test.ts +1 -1
  71. package/src/integration/tests/dispatch.test.ts +4 -4
  72. package/src/integration/tests/hub-runtime.test.ts +22 -14
  73. package/src/integration/tests/idempotency.test.ts +81 -0
  74. package/src/integration/vitest.config.ts +1 -0
  75. package/src/kernel/desired-state.ts +227 -0
  76. package/src/kernel/diagnostic.ts +289 -0
  77. package/src/kernel/drift-guard.ts +166 -0
  78. package/src/kernel/fs-atomic.ts +131 -0
  79. package/src/kernel/index.ts +22 -0
  80. package/src/kernel/tests/drift-guard.test.ts +112 -0
  81. package/src/kernel/tests/fs-atomic.test.ts +150 -0
  82. package/src/kernel/tests/workpiece-env.test.ts +44 -0
  83. package/src/kernel/tests/workspace-io.test.ts +187 -0
  84. package/src/kernel/types.ts +518 -0
  85. package/src/kernel/workpiece-env.ts +48 -0
  86. package/src/kernel/workspace-io.ts +248 -0
  87. package/src/{share → knowledge}/tests/claim.test.ts +1 -1
  88. package/src/{share → knowledge}/tests/derivation.test.ts +1 -1
  89. package/src/{share → knowledge}/tests/freshness.test.ts +1 -1
  90. package/src/{share → knowledge}/tests/ledger.test.ts +1 -1
  91. package/src/{share → knowledge}/tests/plan.test.ts +1 -1
  92. package/src/{share → knowledge}/tests/source.test.ts +1 -1
  93. package/src/legal/index.ts +15 -0
  94. package/src/{share/middleware → middleware}/access-protection.ts +11 -8
  95. package/src/{share/middleware → middleware}/language-redirect.ts +3 -0
  96. package/src/{share → node}/dev-props-validator.ts +6 -1
  97. package/src/{share → node}/import-scan.ts +23 -3
  98. package/src/{share → node}/semantic/derived-prices-loader.ts +4 -2
  99. package/src/{share → node}/semantic/markdown-twin-provenance.ts +1 -1
  100. package/src/{share/semantic → node}/tests/derived-prices-loader.test.ts +14 -1
  101. package/src/{share/semantic → node}/tests/markdown-twin-provenance.test.ts +1 -1
  102. package/src/observability/env-resolver.ts +6 -1
  103. package/src/observability/index.ts +14 -1
  104. package/src/observability/otlp-converter.ts +6 -1
  105. package/src/observability/otlp-transport.ts +6 -1
  106. package/src/observability/pipeline-log.ts +81 -0
  107. package/src/observability/pusher.ts +6 -1
  108. package/src/observability/redact.ts +6 -1
  109. package/src/observability/typed-refs.ts +6 -2
  110. package/src/observability/vitest.config.ts +1 -0
  111. package/src/{share → offers}/formula-eval.ts +3 -3
  112. package/src/{share → offers}/tests/formula-eval.test.ts +2 -2
  113. package/src/onboarding/index.ts +1 -0
  114. package/src/{share → onboarding}/tests/onboarding-yaml.test.ts +1 -1
  115. package/src/ontology/archetype-registry.ts +6 -1
  116. package/src/ontology/archetypes/index.json +33 -1
  117. package/src/ontology/archetypes/index.yaml +27 -1
  118. package/src/ontology/archetypes/sections/entity-grid.yaml +46 -0
  119. package/src/ontology/archetypes/sections/exit-diagram.yaml +43 -0
  120. package/src/ontology/biome-token-projection.ts +6 -1
  121. package/src/ontology/capabilities/lead.prepare.yaml +44 -0
  122. package/src/ontology/capabilities/lead.submit.yaml +20 -3
  123. package/src/ontology/cosmic/index.ts +6 -1
  124. package/src/ontology/cosmic/moon-catalog.ts +6 -1
  125. package/src/ontology/cosmic/planet-catalog.ts +6 -1
  126. package/src/ontology/cosmic/star-catalog.ts +6 -1
  127. package/src/ontology/enums.ts +6 -1
  128. package/src/ontology/external-surfaces/index.ts +1 -1
  129. package/src/ontology/index.ts +6 -2
  130. package/src/ontology/manifest.ts +7 -4
  131. package/src/ontology/operations/artifact-store.ts +45 -0
  132. package/src/ontology/operations/dht.ts +98 -0
  133. package/src/ontology/operations/handoff.ts +92 -0
  134. package/src/ontology/operations/index.ts +193 -1
  135. package/src/ontology/operations/leitstand.ts +99 -0
  136. package/src/ontology/operations/materialization.ts +90 -0
  137. package/src/ontology/operations/mission.ts +111 -0
  138. package/src/ontology/operations/naming-policy.ts +132 -0
  139. package/src/ontology/operations/notausgang.ts +108 -0
  140. package/src/ontology/operations/release.ts +121 -0
  141. package/src/ontology/operations/sternsystem.ts +192 -0
  142. package/src/ontology/operations/werkstatt.ts +48 -0
  143. package/src/ontology/schemas/biome.ts +7 -2
  144. package/src/ontology/schemas/capability.ts +56 -4
  145. package/src/ontology/schemas/constellation.ts +6 -1
  146. package/src/ontology/schemas/index.ts +6 -2
  147. package/src/ontology/schemas/manifest-resolver.ts +6 -1
  148. package/src/ontology/schemas/page-entry.ts +9 -5
  149. package/src/ontology/schemas/system/growth.ts +6 -1
  150. package/src/ontology/schemas/system/manifest.ts +40 -1
  151. package/src/ontology/schemas/system/page-output.ts +7 -6
  152. package/src/ontology/schemas/system/text.ts +15 -0
  153. package/src/ontology/schemas/system.ts +6 -2
  154. package/src/ontology/shared-section-props/body-fragments.ts +2 -0
  155. package/src/ontology/tests/sternsystem-owner.test.ts +1 -1
  156. package/src/ontology/vitest.config.ts +1 -0
  157. package/src/{share → page}/page.ts +13 -9
  158. package/src/{share → page}/tests/dev-props-validator.test.ts +1 -1
  159. package/src/{share → page}/tests/hero-section-numbering-parity.test.ts +1 -1
  160. package/src/passport/claim-sign.ts +120 -0
  161. package/src/passport/index.ts +9 -1
  162. package/src/passport/key-rotate.ts +10 -2
  163. package/src/passport/schema.ts +6 -1
  164. package/src/passport/sign.ts +8 -3
  165. package/src/passport/vitest.config.ts +1 -0
  166. package/src/pbt/index.test.ts +95 -0
  167. package/src/pbt/index.ts +251 -0
  168. package/src/plugin/plugin-contract.ts +2 -2
  169. package/src/{share → policy}/entitlement.ts +24 -4
  170. package/src/{share → policy}/feature-policy.ts +8 -3
  171. package/src/{share → policy}/visibility.ts +7 -2
  172. package/src/redirects/redirects.ts +117 -0
  173. package/src/{share → redirects/tests}/redirects.test.ts +1 -1
  174. package/src/remediation/remediation-catalog.ts +316 -0
  175. package/src/{share/routes → routes}/template-filter.ts +1 -1
  176. package/src/{share → runtime}/runtime-context.ts +7 -2
  177. package/src/{share → runtime}/shared-context.ts +1 -1
  178. package/src/{share/schemas → schemas}/claims.ts +2 -2
  179. package/src/{share/schemas → schemas}/effects.ts +6 -1
  180. package/src/{share/schemas → schemas}/features.ts +1 -1
  181. package/src/{share/schemas → schemas}/index.ts +3 -3
  182. package/src/{share/schemas → schemas}/navigation.ts +6 -1
  183. package/src/{share/schemas → schemas}/page-base.ts +6 -2
  184. package/src/{share/schemas → schemas}/person.ts +1 -1
  185. package/src/{share/schemas → schemas}/standard-list-item.ts +1 -1
  186. package/src/{share → sections}/rfc0042-utils.ts +1 -1
  187. package/src/{share/semantic → semantic}/block-extractors/index.ts +20 -1
  188. package/src/{share/semantic → semantic}/business-projection.ts +95 -1
  189. package/src/semantic/canonical-uri.ts +74 -0
  190. package/src/{share/semantic → semantic}/extract.ts +100 -1
  191. package/src/semantic/fact-extraction.test.ts +47 -0
  192. package/src/semantic/fact-extraction.ts +46 -0
  193. package/src/semantic/freshness.ts +67 -0
  194. package/src/{share/semantic → semantic}/ids.ts +6 -1
  195. package/src/{share/semantic → semantic}/index.ts +9 -2
  196. package/src/{share/semantic → semantic}/jsonld/breadcrumb.ts +6 -2
  197. package/src/{share/semantic → semantic}/jsonld/context.ts +6 -2
  198. package/src/{share/semantic → semantic}/jsonld/faq.ts +6 -2
  199. package/src/{share/semantic → semantic}/jsonld/initiative.ts +6 -1
  200. package/src/{share/semantic → semantic}/jsonld/organization.ts +6 -1
  201. package/src/{share/semantic → semantic}/jsonld/person.ts +6 -2
  202. package/src/{share/semantic → semantic}/jsonld/service.ts +6 -2
  203. package/src/semantic/jsonld/shared.ts +36 -0
  204. package/src/semantic/jsonld/types.ts +24 -0
  205. package/src/{share/semantic → semantic}/jsonld/webpage.ts +6 -1
  206. package/src/semantic/jsonld/website.ts +32 -0
  207. package/src/{share/semantic → semantic}/jsonld.ts +6 -1
  208. package/src/{share/semantic → semantic}/llms.ts +51 -5
  209. package/src/{share/semantic → semantic}/models.ts +26 -38
  210. package/src/{share/semantic → semantic}/organization-profile.ts +3 -0
  211. package/src/{share/semantic → semantic}/page-builders/markdown-page.ts +6 -3
  212. package/src/{share/semantic → semantic}/page-utils.ts +6 -3
  213. package/src/{share/tests/breadcrumbs.test.ts → semantic/tests/breadcrumbs-0229.test.ts} +1 -1
  214. package/src/{share → semantic}/tests/build-page-price-markers.test.ts +2 -2
  215. package/src/{share/semantic → semantic}/tests/business-projection.test.ts +179 -0
  216. package/src/semantic/tests/canonical-uri.test.ts +68 -0
  217. package/src/{share/semantic → semantic}/tests/extract.test.ts +83 -0
  218. package/src/semantic/tests/freshness.pbt.test.ts +108 -0
  219. package/src/{share/tests/image-sitemap.test.ts → semantic/tests/image-sitemap-0150.test.ts} +1 -1
  220. package/src/{share → semantic}/tests/jsonld-service.test.ts +2 -2
  221. package/src/{share → semantic}/tests/jsonld-video.test.ts +3 -3
  222. package/src/{share → semantic}/tests/jsonld-webpage.test.ts +3 -3
  223. package/src/{share → semantic}/tests/llms-0789.test.ts +2 -2
  224. package/src/{share/semantic → semantic}/tests/llms.test.ts +46 -0
  225. package/src/{share → semantic}/tests/organization-jsonld.test.ts +3 -3
  226. package/src/{share/tests/output-projection.test.ts → semantic/tests/output-projection-0143.test.ts} +1 -1
  227. package/src/{share/tests/price-marker-resolver.test.ts → semantic/tests/price-marker-resolver-0767.test.ts} +2 -2
  228. package/src/{share/semantic → semantic}/tests/price-marker-resolver.test.ts +4 -2
  229. package/src/semantic/tests/project-claims.pbt.test.ts +60 -0
  230. package/src/{share/semantic → semantic}/tests/split-sentences.test.ts +1 -1
  231. package/src/{share → semantic}/tests/twin-path.test.ts +1 -1
  232. package/src/signing/index.ts +15 -0
  233. package/src/signing/key.ts +139 -0
  234. package/src/signing/sign.ts +66 -0
  235. package/src/signing/types.ts +29 -0
  236. package/src/{share/slug → slug}/slug-url.ts +4 -1
  237. package/src/stack/run-tool.ts +106 -0
  238. package/src/stack/stack-checks.ts +124 -0
  239. package/src/stack/tests/run-tool.test.ts +138 -0
  240. package/src/stack/tests/stack-checks.test.ts +141 -0
  241. package/src/stack/tests/walk-files.test.ts +131 -0
  242. package/src/stack/walk-files.ts +114 -0
  243. package/src/surface/blueprint.ts +342 -66
  244. package/src/surface/decision-composer.ts +6 -1
  245. package/src/surface/geo.ts +6 -1
  246. package/src/surface/index.ts +11 -7
  247. package/src/surface/types.ts +2 -2
  248. package/src/surface/vitest.config.ts +1 -0
  249. package/src/tests/signing-core.test.ts +129 -0
  250. package/src/{share → text}/css-value-normalize.ts +6 -1
  251. package/src/text/string-utils.ts +24 -0
  252. package/src/{share → text}/tests/text-normalize.test.ts +5 -0
  253. package/src/{share → text}/text-normalize.ts +4 -3
  254. package/src/{share → text}/wrap-inline-numbers.ts +1 -1
  255. package/src/types/axiom-study.d.ts +36 -0
  256. package/src/types/hls-js-light.d.ts +21 -0
  257. package/src/types/qrcode-browser.d.ts +23 -0
  258. package/src/typography/fix.pbt.test.ts +208 -0
  259. package/src/typography/fix.ts +148 -0
  260. package/src/typography/index.ts +54 -0
  261. package/src/typography/locale-defaults.ts +97 -0
  262. package/src/typography/rules-tier1.test.ts +459 -0
  263. package/src/typography/rules-tier1.ts +925 -0
  264. package/src/typography/rules-tier2-locale.pbt.test.ts +190 -0
  265. package/src/typography/rules-tier2-locale.test.ts +286 -0
  266. package/src/typography/rules-tier2-locale.ts +399 -0
  267. package/src/typography/rules-tier2-structure.test.ts +330 -0
  268. package/src/typography/rules-tier2-structure.ts +378 -0
  269. package/src/typography/rules-tier3-advisory.test.ts +290 -0
  270. package/src/typography/rules-tier3-advisory.ts +239 -0
  271. package/src/typography/text-surface.test.ts +244 -0
  272. package/src/typography/text-surface.ts +448 -0
  273. package/src/index.ts +0 -14
  274. package/src/integration/port-barrel.ts +0 -105
  275. package/src/share/agent/tests/api-catalog.test.ts +0 -8
  276. package/src/share/agent/tests/ard-catalog.test.ts +0 -8
  277. package/src/share/agent/tests/capability.test.ts +0 -14
  278. package/src/share/agent/tests/fleet-catalog.test.ts +0 -15
  279. package/src/share/agent/tests/knowledge.test.ts +0 -20
  280. package/src/share/agent/tests/manifest.test.ts +0 -9
  281. package/src/share/agent/tests/mcp-card.test.ts +0 -8
  282. package/src/share/agent/tests/openapi.test.ts +0 -8
  283. package/src/share/agent/tests/proof.test.ts +0 -15
  284. package/src/share/content/index.ts +0 -16
  285. package/src/share/content-discipline/index.ts +0 -14
  286. package/src/share/index.ts +0 -86
  287. package/src/share/knowledge/tests/claim.test.ts +0 -11
  288. package/src/share/knowledge/tests/derivation.test.ts +0 -30
  289. package/src/share/knowledge/tests/freshness.test.ts +0 -18
  290. package/src/share/knowledge/tests/ledger.test.ts +0 -35
  291. package/src/share/knowledge/tests/plan.test.ts +0 -19
  292. package/src/share/knowledge/tests/source.test.ts +0 -19
  293. package/src/share/legal/index.ts +0 -1
  294. package/src/share/redirects.ts +0 -54
  295. package/src/share/remediation/remediation-catalog.ts +0 -196
  296. package/src/share/scripts/index.ts +0 -26
  297. package/src/share/scripts/tests/orchestrator.test.ts +0 -8
  298. package/src/share/semantic/jsonld/shared.ts +0 -31
  299. package/src/share/semantic/jsonld/types.ts +0 -19
  300. package/src/share/semantic/jsonld/website.ts +0 -27
  301. package/src/share/string-utils.ts +0 -19
  302. package/src/share/types/axiom-study.d.ts +0 -22
  303. package/src/share/types/hls-js-light.d.ts +0 -16
  304. package/src/share/types/qrcode-browser.d.ts +0 -18
  305. package/src/share/utility-registry.yaml +0 -50
  306. package/src/share/vitest.config.ts +0 -8
  307. package/src/surface/blueprint-schema.ts +0 -314
  308. package/src/surface/blueprint-types.ts +0 -256
  309. /package/src/{share/agent → agent}/capability.ts +0 -0
  310. /package/src/{share/agent → agent}/dns-aid.ts +0 -0
  311. /package/src/{share/agent → agent}/fleet-catalog.ts +0 -0
  312. /package/src/{share/agent → agent}/knowledge.ts +0 -0
  313. /package/src/{share/agent → agent}/mcp-card.ts +0 -0
  314. /package/src/{share/agent → agent}/omit-empty.ts +0 -0
  315. /package/src/{share/agent → agent}/proof.ts +0 -0
  316. /package/src/{share/agent → agent}/tests/omit-empty.test.ts +0 -0
  317. /package/src/{share → attribution}/attribution-display.ts +0 -0
  318. /package/src/{share/scripts → client-scripts}/gsap-mountain-journey.ts +0 -0
  319. /package/src/{share/scripts → client-scripts}/gsap-parallax.ts +0 -0
  320. /package/src/{share/scripts → client-scripts}/gsap-reveal.ts +0 -0
  321. /package/src/{share/scripts → client-scripts}/gsap-stagger.ts +0 -0
  322. /package/src/{share/scripts → client-scripts}/live-photos.ts +0 -0
  323. /package/src/{share/scripts → client-scripts}/tests/external-link-qr.test.ts +0 -0
  324. /package/src/{share/scripts → client-scripts}/tests/external-links.test.ts +0 -0
  325. /package/src/{share/scripts → client-scripts}/tests/gsap-counter.test.ts +0 -0
  326. /package/src/{share/scripts → client-scripts}/tests/gsap-mountain-journey.test.ts +0 -0
  327. /package/src/{share/scripts → client-scripts}/tests/gsap-parallax.test.ts +0 -0
  328. /package/src/{share/scripts → client-scripts}/tests/gsap-reveal.test.ts +0 -0
  329. /package/src/{share/scripts → client-scripts}/tests/gsap-stagger.test.ts +0 -0
  330. /package/src/{share/scripts → client-scripts}/tests/inline-number-animation.test.ts +0 -0
  331. /package/src/{share/scripts → client-scripts}/tests/lenis.test.ts +0 -0
  332. /package/src/{share/scripts → client-scripts}/tests/live-photos.test.ts +0 -0
  333. /package/src/{share/scripts → client-scripts}/tests/lordicon.test.ts +0 -0
  334. /package/src/{share/scripts → client-scripts}/tests/scheduler.test.ts +0 -0
  335. /package/src/{share/scripts → client-scripts}/video-player.ts +0 -0
  336. /package/src/{share/content → content}/resolve-field-path.ts +0 -0
  337. /package/src/{share/content → content}/substitute-deep.ts +0 -0
  338. /package/src/{share → content}/tests/content-ref-index.test.ts +0 -0
  339. /package/src/{share/content-discipline → content-discipline}/types.ts +0 -0
  340. /package/src/{share → image-provider}/image-provider.ts +0 -0
  341. /package/src/{share/knowledge → knowledge}/claim.ts +0 -0
  342. /package/src/{share/knowledge → knowledge}/derivation.ts +0 -0
  343. /package/src/{share/knowledge → knowledge}/freshness.ts +0 -0
  344. /package/src/{share/knowledge → knowledge}/index.ts +0 -0
  345. /package/src/{share/knowledge → knowledge}/ledger.ts +0 -0
  346. /package/src/{share/knowledge → knowledge}/plan.ts +0 -0
  347. /package/src/{share/knowledge → knowledge}/source.ts +0 -0
  348. /package/src/{share/legal → legal}/translation-policy.ts +0 -0
  349. /package/src/{share/middleware → middleware}/tests/access-protection.test.ts +0 -0
  350. /package/src/{share → node}/fs/index.ts +0 -0
  351. /package/src/{share/tests/markdown-twin-provenance.test.ts → node/tests/markdown-twin-provenance-0613.test.ts} +0 -0
  352. /package/src/{share → offers}/offer-capacity.ts +0 -0
  353. /package/src/{share/onboarding-yaml/index.ts → onboarding/yaml.ts} +0 -0
  354. /package/src/{share → ontology}/tests/ontology-role-by-cosmic-name.test.ts +0 -0
  355. /package/src/{share/routes → routes}/tests/template-filter.test.ts +0 -0
  356. /package/src/{share/schemas → schemas}/claim-records.ts +0 -0
  357. /package/src/{share/schemas → schemas}/horizontal-align.ts +0 -0
  358. /package/src/{share/schemas → schemas}/icon-color.ts +0 -0
  359. /package/src/{share/schemas → schemas}/live-photo.ts +0 -0
  360. /package/src/{share/schemas → schemas}/material-credit.ts +0 -0
  361. /package/src/{share/schemas → schemas}/media.ts +0 -0
  362. /package/src/{share/schemas → schemas}/participant.ts +0 -0
  363. /package/src/{share/schemas → schemas}/print.ts +0 -0
  364. /package/src/{share/schemas → schemas}/section-background.ts +0 -0
  365. /package/src/{share/schemas → schemas}/section-body.ts +0 -0
  366. /package/src/{share/schemas → schemas}/section-cards.ts +0 -0
  367. /package/src/{share/schemas → schemas}/section-cta.ts +0 -0
  368. /package/src/{share/schemas → schemas}/section-header.ts +0 -0
  369. /package/src/{share/schemas → schemas}/section-image.ts +0 -0
  370. /package/src/{share/schemas → schemas}/section-motion.ts +0 -0
  371. /package/src/{share/schemas → schemas}/section-shell.ts +0 -0
  372. /package/src/{share/schemas → schemas}/section-stats.ts +0 -0
  373. /package/src/{share/schemas → schemas}/site-background.ts +0 -0
  374. /package/src/{share/schemas → schemas}/tests/claim-records.test.ts +0 -0
  375. /package/src/{share/schemas → schemas}/tests/claims.test.ts +0 -0
  376. /package/src/{share/schemas → schemas}/tests/effects.test.ts +0 -0
  377. /package/src/{share/schemas → schemas}/tests/features.test.ts +0 -0
  378. /package/src/{share/schemas → schemas}/tests/horizontal-align.test.ts +0 -0
  379. /package/src/{share/schemas → schemas}/tests/icon-color.test.ts +0 -0
  380. /package/src/{share/schemas → schemas}/tests/live-photo.test.ts +0 -0
  381. /package/src/{share/schemas → schemas}/tests/material-credit.test.ts +0 -0
  382. /package/src/{share/schemas → schemas}/tests/media.test.ts +0 -0
  383. /package/src/{share/schemas → schemas}/tests/navigation.test.ts +0 -0
  384. /package/src/{share/schemas → schemas}/tests/page-base.test.ts +0 -0
  385. /package/src/{share/schemas → schemas}/tests/participant.test.ts +0 -0
  386. /package/src/{share/schemas → schemas}/tests/person.test.ts +0 -0
  387. /package/src/{share/schemas → schemas}/tests/print.test.ts +0 -0
  388. /package/src/{share/schemas → schemas}/tests/section-background.test.ts +0 -0
  389. /package/src/{share/schemas → schemas}/tests/section-body.test.ts +0 -0
  390. /package/src/{share/schemas → schemas}/tests/section-cards.test.ts +0 -0
  391. /package/src/{share/schemas → schemas}/tests/section-cta.test.ts +0 -0
  392. /package/src/{share/schemas → schemas}/tests/section-header.test.ts +0 -0
  393. /package/src/{share/schemas → schemas}/tests/section-image.test.ts +0 -0
  394. /package/src/{share/schemas → schemas}/tests/section-motion.test.ts +0 -0
  395. /package/src/{share/schemas → schemas}/tests/section-shell.test.ts +0 -0
  396. /package/src/{share/schemas → schemas}/tests/section-stats.test.ts +0 -0
  397. /package/src/{share/schemas → schemas}/tests/site-background.test.ts +0 -0
  398. /package/src/{share/schemas → schemas}/tests/standard-list-item.test.ts +0 -0
  399. /package/src/{share/semantic → semantic}/ai.ts +0 -0
  400. /package/src/{share/semantic → semantic}/block-extraction.ts +0 -0
  401. /package/src/{share/semantic → semantic}/breadcrumbs.ts +0 -0
  402. /package/src/{share/semantic → semantic}/build-page.ts +0 -0
  403. /package/src/{share/semantic → semantic}/feed.ts +0 -0
  404. /package/src/{share/semantic → semantic}/image-sitemap.ts +0 -0
  405. /package/src/{share/semantic → semantic}/jsonld/article.ts +0 -0
  406. /package/src/{share/semantic → semantic}/jsonld/collection-list.ts +0 -0
  407. /package/src/{share/semantic → semantic}/jsonld/tests/article.test.ts +0 -0
  408. /package/src/{share/semantic → semantic}/jsonld/tests/breadcrumb.test.ts +0 -0
  409. /package/src/{share/semantic → semantic}/jsonld/tests/collection-list.test.ts +0 -0
  410. /package/src/{share/semantic → semantic}/jsonld/tests/faq.test.ts +0 -0
  411. /package/src/{share/semantic → semantic}/jsonld/tests/initiative.test.ts +0 -0
  412. /package/src/{share/semantic → semantic}/jsonld/tests/organization.test.ts +0 -0
  413. /package/src/{share/semantic → semantic}/jsonld/tests/person.test.ts +0 -0
  414. /package/src/{share/semantic → semantic}/jsonld/tests/service.test.ts +0 -0
  415. /package/src/{share/semantic → semantic}/jsonld/tests/shared.test.ts +0 -0
  416. /package/src/{share/semantic → semantic}/jsonld/tests/video.test.ts +0 -0
  417. /package/src/{share/semantic → semantic}/jsonld/tests/webpage.test.ts +0 -0
  418. /package/src/{share/semantic → semantic}/jsonld/tests/website.test.ts +0 -0
  419. /package/src/{share/semantic → semantic}/jsonld/video.ts +0 -0
  420. /package/src/{share/semantic → semantic}/llms-policy.ts +0 -0
  421. /package/src/{share/semantic → semantic}/markdown-hygiene.ts +0 -0
  422. /package/src/{share/semantic → semantic}/output-projection.ts +0 -0
  423. /package/src/{share/semantic → semantic}/page-markdown.ts +0 -0
  424. /package/src/{share/semantic → semantic}/price-marker-resolver.ts +0 -0
  425. /package/src/{share/semantic → semantic}/robots.ts +0 -0
  426. /package/src/{share/semantic → semantic}/tests/ai.test.ts +0 -0
  427. /package/src/{share/semantic → semantic}/tests/block-extraction.test.ts +0 -0
  428. /package/src/{share/semantic → semantic}/tests/breadcrumbs.test.ts +0 -0
  429. /package/src/{share/semantic → semantic}/tests/build-page.test.ts +0 -0
  430. /package/src/{share/semantic → semantic}/tests/feed.test.ts +0 -0
  431. /package/src/{share/semantic → semantic}/tests/helpers.ts +0 -0
  432. /package/src/{share/semantic → semantic}/tests/ids.test.ts +0 -0
  433. /package/src/{share/semantic → semantic}/tests/image-sitemap.test.ts +0 -0
  434. /package/src/{share/semantic → semantic}/tests/jsonld.test.ts +0 -0
  435. /package/src/{share/semantic → semantic}/tests/llms-policy.test.ts +0 -0
  436. /package/src/{share/semantic → semantic}/tests/markdown-hygiene.test.ts +0 -0
  437. /package/src/{share/semantic → semantic}/tests/markdown-page.test.ts +0 -0
  438. /package/src/{share/semantic → semantic}/tests/organization-profile.test.ts +0 -0
  439. /package/src/{share/semantic → semantic}/tests/output-projection.test.ts +0 -0
  440. /package/src/{share/semantic → semantic}/tests/page-markdown.test.ts +0 -0
  441. /package/src/{share/semantic → semantic}/tests/page-utils.test.ts +0 -0
  442. /package/src/{share/semantic → semantic}/tests/robots.test.ts +0 -0
  443. /package/src/{share/semantic → semantic}/tests/update-stamp.test.ts +0 -0
  444. /package/src/{share/semantic → semantic}/update-stamp.ts +0 -0
  445. /package/src/{share/slug → slug}/heading-slugger.ts +0 -0
  446. /package/src/{share/slug → slug}/index.ts +0 -0
  447. /package/src/{share/slug → slug}/slug-id.ts +0 -0
  448. /package/src/{share/slug → slug}/strategies.ts +0 -0
  449. /package/src/{share/slug → slug}/tests/slug.test.ts +0 -0
  450. /package/src/{share → text}/tests/text-normalize.pbt.test.ts +0 -0
  451. /package/src/{share → text}/text-position.ts +0 -0
@@ -13,6 +13,8 @@ No I/O — the kernel command loads the manifest and passes it here.
13
13
  <CHANGE_SUMMARY>
14
14
  <item>RFC-0783: initial API Catalog linkset+json projection.</item>
15
15
  <item>RFC-0954: add search endpoint link when interfaces.search is non-null.</item>
16
+ <item>RFC-1114: link agent-card.json (service-desc) + a2a endpoint (service) when interfaces.a2a is non-null.</item>
17
+ <item>RFC-1114: minimal real A2A endpoint + honest agent card</item>
16
18
  </CHANGE_SUMMARY>
17
19
  */
18
20
 
@@ -63,13 +65,24 @@ export function buildApiCatalog(manifest: AgentSurfaceManifest): ApiCatalog {
63
65
  if (manifest.interfaces.mcp) {
64
66
  serviceDesc.push({ href: "/.well-known/mcp/server-card.json", type: "application/json" });
65
67
  }
68
+ if (manifest.interfaces.a2a) {
69
+ serviceDesc.push({ href: "/.well-known/agent-card.json", type: "application/json" });
70
+ }
66
71
  if (serviceDesc.length > 0) {
67
72
  serviceDesc.sort((a, b) => a.href.localeCompare(b.href));
68
73
  entry["service-desc"] = serviceDesc;
69
74
  }
70
75
 
76
+ const service: ApiCatalogLink[] = [];
71
77
  if (manifest.interfaces.mcp) {
72
- entry["service"] = [{ href: manifest.interfaces.mcp.url, type: "application/json" }];
78
+ service.push({ href: manifest.interfaces.mcp.url, type: "application/json" });
79
+ }
80
+ if (manifest.interfaces.a2a) {
81
+ service.push({ href: manifest.interfaces.a2a.url, type: "application/json" });
82
+ }
83
+ if (service.length > 0) {
84
+ service.sort((a, b) => a.href.localeCompare(b.href));
85
+ entry["service"] = service;
73
86
  }
74
87
 
75
88
  if (manifest.interfaces.search) {
@@ -12,7 +12,12 @@ passes it here.
12
12
  </non-goals>
13
13
  </MODULE_CONTRACT>
14
14
  <CHANGE_SUMMARY>
15
- <item>Initial ARD ai-catalog.json projection for isitagentready.com ARD check.</item>
15
+ <item>RFC-1097: step 6 — compass.migrate codemod run
16
+
17
+ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
18
+ <item>RFC-1097: sweep — werkstatt-engine clean
19
+
20
+ Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
16
21
  </CHANGE_SUMMARY>
17
22
  */
18
23
 
@@ -11,8 +11,8 @@ Verifies determinism, domain extraction, and content URL construction.
11
11
  */
12
12
 
13
13
  import { describe, it, expect } from "vitest";
14
- import { buildDnsAidRecord } from "@warpgogol/werkstatt-shared/share/agent";
15
- import type { AgentSurfaceManifest } from "@warpgogol/werkstatt-shared/share/agent";
14
+ import { buildDnsAidRecord } from "@warpgogol/werkstatt-shared/agent";
15
+ import type { AgentSurfaceManifest } from "@warpgogol/werkstatt-shared/agent";
16
16
 
17
17
  function makeManifest(baseUrl: string): AgentSurfaceManifest {
18
18
  return {
@@ -0,0 +1,52 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ RFC-1115: single rendering point for model-oriented capability descriptions.
5
+ Composes the authored base description with the optional agentGuidance block
6
+ (whenToUse, whenNotToUse, sideEffect, retrySemantics) into a multi-sentence
7
+ description consumed verbatim by MCP tools/list and OpenAPI operation docs.
8
+ </purpose>
9
+ <non-goals>
10
+ <item>Do not restate the RFC-1112 Idempotency-Key mechanism — retrySemantics
11
+ text is authored in capability YAMLs and passed through unchanged.</item>
12
+ <item>Do not localize — callers pick the base description language; guidance
13
+ fields are authored in English by design (capability YAMLs are global,
14
+ not per-site) — English is the model-facing lingua franca.</item>
15
+ </non-goals>
16
+ </MODULE_CONTRACT>
17
+ <CHANGE_SUMMARY>
18
+ <item>RFC-1115: initial — renderAgentGuidanceDescription composer.</item>
19
+ </CHANGE_SUMMARY>
20
+ */
21
+
22
+ import type { CapabilityRecord } from "@warpgogol/werkstatt-shared/ontology";
23
+
24
+ /** The optional agentGuidance block on a capability record (RFC-1115). */
25
+ export type CapabilityAgentGuidance = NonNullable<CapabilityRecord["agentGuidance"]>;
26
+
27
+ /**
28
+ * Compose a tool/operation description from the base description and the
29
+ * optional agentGuidance block. Guidance absent → the base description is
30
+ * returned unchanged (AC-5 fallback).
31
+ */
32
+ export function renderAgentGuidanceDescription(
33
+ base: string,
34
+ guidance: CapabilityAgentGuidance | undefined,
35
+ ): string {
36
+ if (!guidance) return base;
37
+
38
+ const sentences: string[] = [base];
39
+ sentences.push(`Use this when ${guidance.whenToUse}`);
40
+ if (guidance.whenNotToUse) {
41
+ sentences.push(`Do not use this when ${guidance.whenNotToUse}`);
42
+ }
43
+ sentences.push(
44
+ guidance.sideEffect === "write"
45
+ ? "This action has side effects — it submits a write to the business."
46
+ : "This action is side-effect free — it validates input and returns a preview without dispatching anything.",
47
+ );
48
+ if (guidance.retrySemantics) {
49
+ sentences.push(`Retry semantics: ${guidance.retrySemantics}`);
50
+ }
51
+ return sentences.join(" ");
52
+ }
@@ -0,0 +1,68 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ RFC-1116: contracts for the agent surface health endpoint and the external
5
+ contract check. AgentHealth is the runtime response of GET /api/agent/health;
6
+ AgentContractCheckResult is the diagnostics payload of the
7
+ agent.surface.contract.check kernel command. The probe-id union is the closed
8
+ vocabulary both sides share — the route emits "health", the command emits the
9
+ full golden-journey list.
10
+ </purpose>
11
+ <non-goals>
12
+ <item>Do not implement probe logic here — the command lives in
13
+ @warpgogol/werkstatt-site/checks, the route factory in
14
+ @warpgogol/werkstatt-engine/agent-gate.</item>
15
+ </non-goals>
16
+ </MODULE_CONTRACT>
17
+ <CHANGE_SUMMARY>
18
+ <item>RFC-1116: initial contracts — AgentHealth, AgentContractCheckResult, AgentContractProbeId.</item>
19
+ </CHANGE_SUMMARY>
20
+ */
21
+
22
+ /** Response of GET /api/agent/health (RFC-1116). */
23
+ export interface AgentHealth {
24
+ status: "ok" | "degraded";
25
+ /** AGENT_SURFACE_VERSION constant. */
26
+ surfaceVersion: string;
27
+ /** distTreeHash self-fetched from /.well-known/build-identity.json; "" when unavailable. */
28
+ contentHash: string;
29
+ checks: {
30
+ manifest: "ok" | "missing";
31
+ knowledge: "ok" | "missing";
32
+ /** QStash publish token present? */
33
+ dispatch: "configured" | "unconfigured";
34
+ search: "available" | "unavailable";
35
+ };
36
+ }
37
+
38
+ /**
39
+ * Closed probe-id vocabulary for the golden journey (RFC-1116). The command
40
+ * derives the active subset from the deployed agent.json — capabilities absent
41
+ * from the manifest yield `skipped` probes, not failures.
42
+ */
43
+ export type AgentContractProbeId =
44
+ | "discovery.agent-json"
45
+ | "discovery.api-catalog"
46
+ | "discovery.llms"
47
+ | "knowledge.fetch"
48
+ | "mcp.initialize"
49
+ | "mcp.tools-list"
50
+ | "action.lead-prepare"
51
+ | "action.error-shape"
52
+ | "health";
53
+
54
+ export interface AgentContractProbe {
55
+ id: AgentContractProbeId;
56
+ ok: boolean;
57
+ /** Capability absent from deployed agent.json, or agent.enabled: false. */
58
+ skipped?: boolean;
59
+ detail?: string;
60
+ }
61
+
62
+ /** Diagnostics payload of agent.surface.contract.check (RFC-1116, DNA-82). */
63
+ export interface AgentContractCheckResult {
64
+ command: "agent.surface.contract.check";
65
+ status: "pass" | "fail";
66
+ url: string;
67
+ probes: AgentContractProbe[];
68
+ }
@@ -10,11 +10,12 @@ here (knowledge, capability, openapi, proof) and re-export them from this barrel
10
10
  </non-goals>
11
11
  </MODULE_CONTRACT>
12
12
  <CHANGE_SUMMARY>
13
- <item>RFC-0286: initial barrel exporting the manifest module.</item>
14
13
  <item>RFC-0292: re-export fleet-catalog module.</item>
15
14
  <item>RFC-0783: re-export api-catalog and mcp-card modules.</item>
16
15
  <item>RFC-0786: re-export dns-aid module.</item>
17
16
  <item>RFC-0954: re-export search module.</item>
17
+ <item>RFC-1112: re-export receipt module (ActionReceipt, AgentProblemDetails, deriveActionEventId).</item>
18
+ <history>RFC-0286</history>
18
19
  </CHANGE_SUMMARY>
19
20
  */
20
21
 
@@ -30,3 +31,6 @@ export * from "./mcp-card.ts";
30
31
  export * from "./dns-aid.ts";
31
32
  export * from "./ard-catalog.ts";
32
33
  export * from "./search.ts";
34
+ export * from "./receipt.ts";
35
+ export * from "./guidance.ts";
36
+ export * from "./health.ts";
@@ -13,8 +13,13 @@ two runs on unchanged input are byte-identical (AS-7).
13
13
  </non-goals>
14
14
  </MODULE_CONTRACT>
15
15
  <CHANGE_SUMMARY>
16
- <item>RFC-0286: initial manifest contract and pure builder.</item>
17
- <item>RFC-0954: add search interface to AgentSurfaceManifest.interfaces.</item>
16
+ <item>RFC-1112: bump AGENT_SURFACE_VERSION to 2.0.0 — action responses become ActionReceipt + problem+json.</item>
17
+ <item>RFC-1113: add $schema, generatedAt (excluded from contentHash), supportedProtocols; AgentProtocol closed vocabulary.</item>
18
+ <item>RFC-1113: align agent discovery surface with RFC 9727 and MCP 2026-07-28 stateless era</item>
19
+ <item>RFC-1114: add "a2a" to AgentProtocol and interfaces.a2a (url + protocolVersion).</item>
20
+ <item>RFC-1114: minimal real A2A endpoint + honest agent card</item>
21
+ <item>RFC-1115: search results flattened to citation shape (title, canonicalUrl, updatedAt, lang, type, score, text) under the existing 2.0.0 surface; capability agentGuidance rendered into tool/operation descriptions.</item>
22
+ <history>RFC-0286, RFC-0954, RFC-1076</history>
18
23
  </CHANGE_SUMMARY>
19
24
  */
20
25
 
@@ -22,7 +27,28 @@ import { createHash } from "node:crypto";
22
27
  import type { AgentSurfaceProof } from "./proof.ts";
23
28
 
24
29
  /** Semver of THIS manifest schema. Bump only via an RFC amending RFC-0286 (AS-7). */
25
- export const AGENT_SURFACE_VERSION = "1.0.0";
30
+ export const AGENT_SURFACE_VERSION = "2.0.0";
31
+
32
+ /** RFC-1113: $schema identifier for the Agent Surface Manifest document. */
33
+ export const AGENT_SURFACE_SCHEMA_ID = "gogol.agent.surface/2";
34
+
35
+ /**
36
+ * RFC-1113: closed vocabulary for AgentSurfaceManifest.supportedProtocols.
37
+ * Every value MUST correspond to a discovery artifact or interface the surface
38
+ * actually emits — agent.surface.validate enforces the honesty invariant
39
+ * (AGS-DISCOVERY-01).
40
+ */
41
+ export type AgentProtocol =
42
+ | "mcp"
43
+ | "a2a"
44
+ | "openapi"
45
+ | "linkset"
46
+ | "llms"
47
+ | "twins"
48
+ | "ard"
49
+ | "dns-aid"
50
+ | "agent-skills"
51
+ | "search";
26
52
 
27
53
  export interface AgentKnowledgeRef {
28
54
  /** A BusinessDomain with visibility "public" (RFC-0287). */
@@ -41,20 +67,38 @@ export interface AgentActionRef {
41
67
  entitlement: "agent.actions";
42
68
  }
43
69
 
70
+ export interface AgentClaimRef {
71
+ id: string;
72
+ claimClass: string;
73
+ statement: string;
74
+ verificationLevel?: string;
75
+ evidenceCount: number;
76
+ }
77
+
44
78
  export interface AgentSurfaceManifest {
79
+ /** RFC-1113: schema identifier — "gogol.agent.surface/2". */
80
+ $schema: string;
45
81
  surfaceVersion: string;
46
82
  site: string;
47
83
  baseUrl: string;
48
84
  languages: { default: string; supported: string[] };
49
- /** sha256 hex over sorted-key JSON of this document minus contentHash + proof. */
85
+ /** RFC-1113: ISO 8601 build timestamp — excluded from contentHash + signing payload. */
86
+ generatedAt: string;
87
+ /** RFC-1113: closed vocabulary — only the protocols this surface actually emits. */
88
+ supportedProtocols: AgentProtocol[];
89
+ /** sha256 hex over sorted-key JSON of this document minus contentHash + proof + generatedAt. */
50
90
  contentHash: string;
51
91
  knowledge: AgentKnowledgeRef[];
52
92
  actions: AgentActionRef[];
93
+ /** RFC-1076: claim provenance chain — claims with their evidence references. */
94
+ claims: AgentClaimRef[];
53
95
  interfaces: {
54
96
  llms: string;
55
97
  twins: { pattern: string } | null;
56
98
  openapi: string | null;
57
99
  mcp: { url: string; protocolVersion: string } | null;
100
+ /** RFC-1114: the A2A endpoint — null when the surface ships no A2A route. */
101
+ a2a: { url: string; protocolVersion: string } | null;
58
102
  search: { url: string; model: string; dimensions: number } | null;
59
103
  };
60
104
  /** Null until agent.surface.sign signs it (RFC-0308) or when no key material exists. */
@@ -65,11 +109,17 @@ export interface AgentSurfaceManifestInput {
65
109
  site: string;
66
110
  baseUrl: string;
67
111
  languages: { default: string; supported: string[] };
112
+ /** RFC-1113: ISO 8601 build timestamp supplied by the caller (the builder stays pure). */
113
+ generatedAt: string;
68
114
  knowledge?: AgentKnowledgeRef[];
69
115
  actions?: AgentActionRef[];
116
+ /** RFC-1076: claim provenance summaries for the manifest. */
117
+ claims?: AgentClaimRef[];
70
118
  hasTwins?: boolean;
71
119
  openapiUrl?: string | null;
72
120
  mcp?: { url: string; protocolVersion: string } | null;
121
+ /** RFC-1114: the A2A endpoint descriptor — omit/null when no A2A route exists. */
122
+ a2a?: { url: string; protocolVersion: string } | null;
73
123
  search?: { url: string; model: string; dimensions: number } | null;
74
124
  }
75
125
 
@@ -114,9 +164,13 @@ export function computeSignedContentHash(
114
164
  return createHash("sha256").update(canonicalJson(rest), "utf8").digest("hex");
115
165
  }
116
166
 
117
- /** sha256 hex over the canonical JSON of `doc` with `contentHash` and `proof` removed. */
167
+ /**
168
+ * sha256 hex over the canonical JSON of `doc` with `contentHash`, `proof`, and
169
+ * `generatedAt` removed. RFC-1113: `generatedAt` is a build timestamp — including
170
+ * it would produce a spurious hash (and signature) change on every rebuild.
171
+ */
118
172
  export function computeAgentManifestContentHash(doc: Record<string, unknown>): string {
119
- return computeSignedContentHash(doc);
173
+ return computeSignedContentHash(doc, ["generatedAt"]);
120
174
  }
121
175
 
122
176
  // ---------------------------------------------------------------------------
@@ -125,21 +179,44 @@ export function computeAgentManifestContentHash(doc: Record<string, unknown>): s
125
179
 
126
180
  /** Pure: assemble + hash the manifest. Deterministic — sorts refs and languages. */
127
181
  export function buildAgentSurfaceManifest(input: AgentSurfaceManifestInput): AgentSurfaceManifest {
182
+ // RFC-1113: honesty invariant — supportedProtocols lists only what the surface
183
+ // emits. The unconditional entries are the artifacts every enabled agent
184
+ // surface generates (llms.txt, api-catalog linkset, ai-catalog ARD document,
185
+ // DNS-AID record, agent-skills index); the conditional ones follow interfaces.
186
+ const supportedProtocols: AgentProtocol[] = (
187
+ [
188
+ "agent-skills",
189
+ "ard",
190
+ "dns-aid",
191
+ "linkset",
192
+ "llms",
193
+ ...(input.mcp ? ["mcp"] : []),
194
+ ...(input.a2a ? ["a2a"] : []),
195
+ ...(input.openapiUrl ? ["openapi"] : []),
196
+ ...(input.search ? ["search"] : []),
197
+ ...(input.hasTwins ? ["twins"] : []),
198
+ ] as AgentProtocol[]
199
+ ).sort();
128
200
  const base: Omit<AgentSurfaceManifest, "contentHash"> = {
201
+ $schema: AGENT_SURFACE_SCHEMA_ID,
129
202
  surfaceVersion: AGENT_SURFACE_VERSION,
130
203
  site: input.site,
131
204
  baseUrl: input.baseUrl.replace(/\/+$/, ""),
205
+ generatedAt: input.generatedAt,
206
+ supportedProtocols,
132
207
  languages: {
133
208
  default: input.languages.default,
134
209
  supported: [...input.languages.supported].sort(),
135
210
  },
136
211
  knowledge: [...(input.knowledge ?? [])].sort((a, b) => a.domain.localeCompare(b.domain)),
137
212
  actions: [...(input.actions ?? [])].sort((a, b) => a.id.localeCompare(b.id)),
213
+ claims: [...(input.claims ?? [])].sort((a, b) => a.id.localeCompare(b.id)),
138
214
  interfaces: {
139
215
  llms: "/llms.txt",
140
216
  twins: input.hasTwins ? { pattern: "/**.md" } : null,
141
217
  openapi: input.openapiUrl ?? null,
142
218
  mcp: input.mcp ?? null,
219
+ a2a: input.a2a ?? null,
143
220
  search: input.search ?? null,
144
221
  },
145
222
  proof: null,
@@ -16,11 +16,14 @@ copied verbatim (AGO-04 enforces this).
16
16
  <CHANGE_SUMMARY>
17
17
  <item>RFC-0289: initial OpenAPI projection.</item>
18
18
  <item>RFC-0954: add /api/agent/search path with dynamic lang enum from manifest.languages.supported.</item>
19
+ <item>RFC-1112: Idempotency-Key header param + application/problem+json error responses on action paths.</item>
20
+ <item>RFC-1115: agentGuidance rendered into operation descriptions; search-response schema matches the flattened citation shape.</item>
19
21
  </CHANGE_SUMMARY>
20
22
  */
21
23
 
22
24
  import type { AgentSurfaceManifest } from "./manifest.ts";
23
25
  import type { CapabilityInputOutputSchema } from "@warpgogol/werkstatt-shared/ontology";
26
+ import { renderAgentGuidanceDescription, type CapabilityAgentGuidance } from "./guidance.ts";
24
27
 
25
28
  export interface OpenApiSchemaObject {
26
29
  type: string;
@@ -33,6 +36,7 @@ export interface OpenApiSchemaObject {
33
36
  export interface OpenApiOperation {
34
37
  operationId: string;
35
38
  summary?: string;
39
+ description?: string;
36
40
  tags: string[];
37
41
  parameters?: Array<{
38
42
  name: string;
@@ -47,7 +51,12 @@ export interface OpenApiOperation {
47
51
  };
48
52
  responses: Record<
49
53
  string,
50
- { description: string; content?: { "application/json": { schema: unknown } } }
54
+ {
55
+ description: string;
56
+ content?: Partial<
57
+ Record<"application/json" | "application/problem+json", { schema: unknown }>
58
+ >;
59
+ }
51
60
  >;
52
61
  }
53
62
 
@@ -67,6 +76,66 @@ export interface CapabilitySchemaInput {
67
76
  id: string;
68
77
  input: CapabilityInputOutputSchema;
69
78
  output: CapabilityInputOutputSchema;
79
+ /** RFC-1115: localized base description for operation docs. */
80
+ description?: Record<string, string>;
81
+ /** RFC-1115: model-oriented guidance rendered into the operation description. */
82
+ agentGuidance?: CapabilityAgentGuidance;
83
+ }
84
+
85
+ /** RFC-1112: shared RFC 9457 problem-details schema referenced by every action error response. */
86
+ function problemDetailsSchema(): Record<string, unknown> {
87
+ return {
88
+ type: "object",
89
+ required: ["type", "title", "status", "code", "retryable"],
90
+ properties: {
91
+ type: { type: "string" },
92
+ title: { type: "string" },
93
+ status: { type: "integer" },
94
+ detail: { type: "string" },
95
+ code: {
96
+ type: "string",
97
+ enum: [
98
+ "invalid-json",
99
+ "schema-violation",
100
+ "unknown-capability",
101
+ "payload-too-large",
102
+ "rate-limited",
103
+ "dispatch-failed",
104
+ "idempotency-key-reuse",
105
+ ],
106
+ },
107
+ retryable: { type: "boolean" },
108
+ errors: {
109
+ type: "array",
110
+ items: {
111
+ type: "object",
112
+ properties: { path: { type: "string" }, message: { type: "string" } },
113
+ },
114
+ },
115
+ schemaRef: { type: "string" },
116
+ retryAfterSeconds: { type: "integer" },
117
+ },
118
+ };
119
+ }
120
+
121
+ /** RFC-1112: the standard error responses every action path declares. */
122
+ function actionErrorResponses(): OpenApiOperation["responses"] {
123
+ const problem = {
124
+ "application/problem+json": {
125
+ schema: { $ref: "#/components/schemas/problem-details" },
126
+ },
127
+ };
128
+ return {
129
+ "400": { description: "Request body is not valid JSON", content: problem },
130
+ "409": {
131
+ description: "Idempotency-Key was used with a different payload",
132
+ content: problem,
133
+ },
134
+ "413": { description: "Payload exceeds the capability limit", content: problem },
135
+ "422": { description: "Input failed schema validation", content: problem },
136
+ "429": { description: "Rate limit exceeded", content: problem },
137
+ "502": { description: "Delivery substrate rejected the event", content: problem },
138
+ };
70
139
  }
71
140
 
72
141
  /** Generic envelope schema — every knowledge domain shares this wrapper shape (RFC-0287); only `data`'s inner shape varies by domain and is intentionally left untyped here. */
@@ -118,16 +187,35 @@ export function formatAgentOpenApi(
118
187
  };
119
188
  }
120
189
 
190
+ componentSchemas["problem-details"] = problemDetailsSchema();
191
+
121
192
  for (const ref of manifest.actions) {
122
193
  const schemas = schemasById.get(ref.id);
123
194
  if (!schemas) continue; // defensive — AGO-04-checked at validate time
124
195
  componentSchemas[`${ref.id}-input`] = schemas.input;
125
196
  componentSchemas[`${ref.id}-output`] = schemas.output;
197
+ // RFC-1115: agentGuidance composes a model-oriented operation description;
198
+ // absent guidance falls back to the base capability description.
199
+ const baseDescription =
200
+ schemas.description?.[manifest.languages.default] ??
201
+ ref.title[manifest.languages.default] ??
202
+ ref.id;
126
203
  paths[ref.url] = {
127
204
  post: {
128
205
  operationId: `action.${ref.id}`,
129
206
  summary: ref.title[manifest.languages.default] ?? ref.id,
207
+ description: renderAgentGuidanceDescription(baseDescription, schemas.agentGuidance),
130
208
  tags: ["actions"],
209
+ parameters: [
210
+ {
211
+ name: "Idempotency-Key",
212
+ in: "header",
213
+ required: false,
214
+ schema: { type: "string", maxLength: 255 },
215
+ description:
216
+ "Optional dedup key. Repeating a request with the same key and body returns the original receipt; the same key with a different body is rejected with 409.",
217
+ },
218
+ ],
131
219
  requestBody: {
132
220
  required: true,
133
221
  content: { "application/json": { schema: schemas.input } },
@@ -137,8 +225,7 @@ export function formatAgentOpenApi(
137
225
  description: `${ref.id} accepted`,
138
226
  content: { "application/json": { schema: schemas.output } },
139
227
  },
140
- "400": { description: "Schema violation" },
141
- "429": { description: "Rate limit exceeded" },
228
+ ...actionErrorResponses(),
142
229
  },
143
230
  },
144
231
  };
@@ -154,9 +241,15 @@ export function formatAgentOpenApi(
154
241
  type: "array",
155
242
  items: {
156
243
  type: "object",
244
+ required: ["title", "canonicalUrl", "updatedAt", "lang", "type", "score", "text"],
157
245
  properties: {
158
- chunk: { type: "object" },
246
+ title: { type: ["string", "null"] },
247
+ canonicalUrl: { type: "string" },
248
+ updatedAt: { type: ["string", "null"] },
249
+ lang: { type: "string" },
250
+ type: { type: "string", enum: ["page", "knowledge", "faq", "prose"] },
159
251
  score: { type: "number" },
252
+ text: { type: "string" },
160
253
  },
161
254
  },
162
255
  },
@@ -0,0 +1,123 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ RFC-1112: canonical agent-action receipt + RFC 9457 problem-details contracts.
5
+ One shape for both invocation surfaces (HTTP POST /api/agent/actions/{id} and
6
+ MCP tools/call) — the receipt is the final v1 answer; errors carry a stable
7
+ machine `code` so agents can branch without parsing prose.
8
+ </purpose>
9
+ <non-goals>
10
+ <item>Do not store or transport lead payload fields — receipts carry
11
+ identifiers and timestamps only (no PII at rest).</item>
12
+ <item>Do not add transport logic — HTTP/MCP mapping lives in the engine
13
+ (action-pipeline.ts, mcp/handler.ts).</item>
14
+ </non-goals>
15
+ </MODULE_CONTRACT>
16
+ <CHANGE_SUMMARY>
17
+ <item>RFC-1112: initial receipt/problem-details contracts + deterministic eventId derivation.</item>
18
+ </CHANGE_SUMMARY>
19
+ */
20
+
21
+ import { byteHash } from "@warpgogol/werkstatt-shared/fingerprint";
22
+
23
+ /**
24
+ * The single response shape for a successful agent action invocation (RFC-1112).
25
+ * `receiptId` equals `IntegrationEvent.eventId` — deterministic when the caller
26
+ * supplied an Idempotency-Key, random otherwise.
27
+ */
28
+ export interface ActionReceipt {
29
+ receiptId: string;
30
+ status: "accepted" | "duplicate";
31
+ duplicate: boolean;
32
+ /** ISO 8601 — stamped by the dispatch adapter at publish time. */
33
+ submittedAt: string;
34
+ }
35
+
36
+ /** Stable machine codes for agent-action failures (RFC-1112). Closed set. */
37
+ export type AgentErrorCode =
38
+ | "invalid-json"
39
+ | "schema-violation"
40
+ | "unknown-capability"
41
+ | "payload-too-large"
42
+ | "rate-limited"
43
+ | "dispatch-failed"
44
+ | "idempotency-key-reuse";
45
+
46
+ /** RFC 9457 problem details with platform extension members (`code`, `retryable`, …). */
47
+ export interface AgentProblemDetails {
48
+ type: string;
49
+ title: string;
50
+ status: number;
51
+ detail?: string;
52
+ code: AgentErrorCode;
53
+ retryable: boolean;
54
+ /** Per-field violations for schema-violation. */
55
+ errors?: { path: string; message: string }[];
56
+ /** Pointer into agent.openapi.json for schema-violation. */
57
+ schemaRef?: string;
58
+ /** Seconds until the rate-limit window resets (rate-limited only). */
59
+ retryAfterSeconds?: number;
60
+ }
61
+
62
+ export const AGENT_ERROR_STATUS: Record<AgentErrorCode, number> = {
63
+ "invalid-json": 400,
64
+ "schema-violation": 422,
65
+ "unknown-capability": 404,
66
+ "payload-too-large": 413,
67
+ "rate-limited": 429,
68
+ "dispatch-failed": 502,
69
+ "idempotency-key-reuse": 409,
70
+ };
71
+
72
+ export const AGENT_ERROR_RETRYABLE: Record<AgentErrorCode, boolean> = {
73
+ "invalid-json": false,
74
+ "schema-violation": false,
75
+ "unknown-capability": false,
76
+ "payload-too-large": false,
77
+ "rate-limited": true,
78
+ "dispatch-failed": true,
79
+ "idempotency-key-reuse": false,
80
+ };
81
+
82
+ const AGENT_ERROR_TITLE: Record<AgentErrorCode, string> = {
83
+ "invalid-json": "Request body is not valid JSON",
84
+ "schema-violation": "Input failed schema validation",
85
+ "unknown-capability": "Unknown capability",
86
+ "payload-too-large": "Payload exceeds the capability limit",
87
+ "rate-limited": "Rate limit exceeded",
88
+ "dispatch-failed": "Delivery substrate rejected the event",
89
+ "idempotency-key-reuse": "Idempotency-Key was used with a different payload",
90
+ };
91
+
92
+ /** Build a problem-details object for `code`; status/title/retryable derive from the closed tables. */
93
+ export function buildAgentProblem(
94
+ code: AgentErrorCode,
95
+ init?: Partial<Omit<AgentProblemDetails, "type" | "status" | "code" | "retryable">>,
96
+ ): AgentProblemDetails {
97
+ return {
98
+ type: "about:blank",
99
+ title: AGENT_ERROR_TITLE[code],
100
+ status: AGENT_ERROR_STATUS[code],
101
+ code,
102
+ retryable: AGENT_ERROR_RETRYABLE[code],
103
+ ...(init?.detail !== undefined ? { detail: init.detail } : {}),
104
+ ...(init?.errors !== undefined ? { errors: init.errors } : {}),
105
+ ...(init?.schemaRef !== undefined ? { schemaRef: init.schemaRef } : {}),
106
+ ...(init?.retryAfterSeconds !== undefined
107
+ ? { retryAfterSeconds: init.retryAfterSeconds }
108
+ : {}),
109
+ };
110
+ }
111
+
112
+ /**
113
+ * RFC-1112: deterministic eventId/receiptId from an Idempotency-Key.
114
+ * sha256("gogol-agent-action:" + capabilityId + ":" + key), first 32 hex chars
115
+ * formatted as a UUID. Same key + same capability → same eventId, so QStash
116
+ * deduplication and the receipt store agree on identity.
117
+ */
118
+ export function deriveActionEventId(capabilityId: string, idempotencyKey: string): string {
119
+ const hex = byteHash(`gogol-agent-action:${capabilityId}:${idempotencyKey}`).slice(
120
+ "sha256:".length,
121
+ );
122
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
123
+ }
@@ -19,6 +19,9 @@ const baseChunk: SearchChunk = {
19
19
  blockId: "block-intro",
20
20
  heading: "About",
21
21
  text: "About the company",
22
+ title: "About",
23
+ canonicalUrl: "https://example.example/about",
24
+ updatedAt: "2026-08-20",
22
25
  };
23
26
 
24
27
  describe("buildSearchManifest", () => {