@openwop/openwop-conformance 1.125.0 → 1.127.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openwop/openwop-conformance",
3
- "version": "1.125.0",
3
+ "version": "1.127.0",
4
4
  "description": "Production-ready black-box conformance suite for OpenWOP v1.0 compliant servers.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "_comment": "Provenance of this vendored schemas/ copy. See conformance/README.md \u00a7\"Resolving the contract\". Compare against the stamp in your installed @openwop/openwop-conformance to detect a stale hand-copied contract.",
3
- "suiteVersion": "1.125.0",
4
- "corpusCommit": "13ab2a545d4e2a30c8da66354e39d4db7233acae"
3
+ "suiteVersion": "1.127.0",
4
+ "corpusCommit": "5e2aefe837a81b82004c12c308cb1c3973c0233c"
5
5
  }
@@ -53,7 +53,9 @@ async function claims10(): Promise<boolean> {
53
53
  async function jsonrpc10Url(): Promise<string | null> {
54
54
  const caps = await a2a();
55
55
  if (typeof caps?.agentCardUrl !== 'string') return null;
56
- const res = await fetch(caps.agentCardUrl, { headers: { accept: 'application/json' } });
56
+ // S18 (#1028): a header-less card GET returns the 0.3 shape while `a2a-0.3-legacy`
57
+ // is advertised; a 1.0 client asks for the 1.0 card explicitly (a2a-integration.md §C).
58
+ const res = await fetch(caps.agentCardUrl, { headers: { accept: 'application/json', 'A2A-Version': '1.0' } });
57
59
  if (res.status !== 200) return null;
58
60
  const card = (await res.json()) as { supportedInterfaces?: Array<{ url?: string; protocolBinding?: string; protocolVersion?: string }> };
59
61
  const iface = (card.supportedInterfaces ?? []).find((i) => i.protocolBinding === 'JSONRPC' && i.protocolVersion === '1.0');
@@ -21,6 +21,27 @@
21
21
  * otherwise legal unknown server-emitted property, and nothing here reads a
22
22
  * host.
23
23
  *
24
+ * **Canonical-typo leg (RFC 0149 §B, second bullet; UQ2 decided 2026-08-16).** A
25
+ * root key within edit distance ONE of a canonical family, in a discovery-shaped
26
+ * example, that is not itself canonical and not vendor-namespaced, is a typo
27
+ * (`compensaton`, `interupts`) — an implementer copying it advertises nothing.
28
+ * UQ2 asked what rule avoids false positives on legitimate extension names; the
29
+ * answer was measured, not guessed. Over every fenced root object in `spec/v1` +
30
+ * `RFCS/` (218 on 2026-08-16), plain distance-one produced six near-misses —
31
+ * `ts`/`fs`, `agent`/`agents`, `secret`/`secrets`, `context`/`content`,
32
+ * `prompt`/`prompts`, `schemaVersion`/`schemaVersions` — every one of them a key
33
+ * of an EVENT or RUN object, not a discovery document. So the predicate is
34
+ * *discovery-shaped*: every root key is canonical, vendor-namespaced
35
+ * (`host-extensions.md` §"Canonical prefixes"), the legacy `capabilities`
36
+ * wrapper, or within distance one of a canonical family — and at least one key
37
+ * is canonical-or-near. That excludes events (`ts`/`type`/`payload` are none of
38
+ * those) while still catching a typo-only snippet whose single key is misspelt.
39
+ * Scope: `spec/v1` and RFCs numbered >= 0149 (the rule's own RFC); older RFCs
40
+ * are the dated record, on the same boundary logic as the wrapper leg's 0073.
41
+ * Under that predicate and scope the corpus measured 53 discovery-shaped
42
+ * objects and 0 findings; the one out-of-scope near-miss is RFC 0109's
43
+ * `{ "agent": … }` payload fragment.
44
+ *
24
45
  * `spec/v1/` and `RFCS/` ship in the repository, NOT in the published tarball,
25
46
  * so this self-skips under the published layout. That asymmetry has produced
26
47
  * three defects in this corpus — the `CORPUS-STAMP` gate, the link-checker's
@@ -66,6 +87,97 @@ function fencedExamples(dir: string): FencedExample[] {
66
87
  return found;
67
88
  }
68
89
 
90
+ /** RFC 0149 introduced the typo lint; examples in earlier RFCs are historical record. */
91
+ const TYPO_LINT_RFC = 149;
92
+
93
+ const SCHEMA_PATH =
94
+ V1_DIR === null ? null : pathResolve(V1_DIR, '..', '..', 'schemas', 'capabilities.schema.json');
95
+
96
+ /** The canonical families, read from the schema rather than hand-listed. */
97
+ function canonicalFamilies(): Set<string> {
98
+ if (SCHEMA_PATH === null) return new Set();
99
+ const schema = JSON.parse(readFileSync(SCHEMA_PATH, 'utf8')) as { properties?: Record<string, unknown> };
100
+ return new Set(Object.keys(schema.properties ?? {}));
101
+ }
102
+
103
+ /** `host-extensions.md` §"Canonical prefixes". */
104
+ function isVendorKey(key: string): boolean {
105
+ return /^x-host-/.test(key) || /^(vendor|private)\./.test(key);
106
+ }
107
+
108
+ /** Levenshtein distance exactly one (one substitution, insertion, or deletion). */
109
+ export function withinOne(a: string, b: string): boolean {
110
+ if (a === b) return false;
111
+ if (Math.abs(a.length - b.length) > 1) return false;
112
+ if (a.length === b.length) {
113
+ let diff = 0;
114
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i] && ++diff > 1) return false;
115
+ return diff === 1;
116
+ }
117
+ const [short, long] = a.length < b.length ? [a, b] : [b, a];
118
+ let i = 0;
119
+ let j = 0;
120
+ let skipped = false;
121
+ while (i < short.length && j < long.length) {
122
+ if (short[i] === long[j]) {
123
+ i++;
124
+ j++;
125
+ } else if (skipped) {
126
+ return false;
127
+ } else {
128
+ skipped = true;
129
+ j++;
130
+ }
131
+ }
132
+ return true;
133
+ }
134
+
135
+ export interface TypoFinding {
136
+ readonly key: string;
137
+ readonly near: readonly string[];
138
+ }
139
+
140
+ /**
141
+ * The UQ2 rule. Returns the near-miss root keys of a DISCOVERY-SHAPED object, or
142
+ * `null` when the object is not discovery-shaped (and so is out of scope: an
143
+ * event, a run body, a manifest). Exported so the predicate is pinned below.
144
+ */
145
+ export function canonicalTypos(value: unknown, families: Set<string>): TypoFinding[] | null {
146
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return null;
147
+ const keys = Object.keys(value as Record<string, unknown>);
148
+ if (keys.length === 0) return null;
149
+ const near = new Map<string, string[]>();
150
+ for (const k of keys) {
151
+ if (families.has(k) || isVendorKey(k) || k === 'capabilities') continue;
152
+ const n = [...families].filter((f) => withinOne(k, f));
153
+ if (n.length === 0) return null; // a key that is none of the four kinds ⇒ not discovery-shaped
154
+ near.set(k, n);
155
+ }
156
+ if (!keys.some((k) => families.has(k) || near.has(k))) return null;
157
+ return [...near.entries()].map(([key, n]) => ({ key, near: n }));
158
+ }
159
+
160
+ /** Every parseable fenced json/jsonc root object under `dir`, with its source line. */
161
+ function fencedObjects(dir: string): { file: string; line: number; value: unknown }[] {
162
+ const out: { file: string; line: number; value: unknown }[] = [];
163
+ for (const name of readdirSync(dir).filter((f) => f.endsWith('.md')).sort()) {
164
+ const lines = readFileSync(join(dir, name), 'utf8').split('\n');
165
+ for (let i = 0; i < lines.length; i++) {
166
+ if (!/^```(json|jsonc)\s*$/.test(lines[i]!.trim())) continue;
167
+ const body: string[] = [];
168
+ let j = i + 1;
169
+ while (j < lines.length && lines[j]!.trim() !== '```') body.push(lines[j++]!);
170
+ try {
171
+ out.push({ file: name, line: i + 2, value: JSON.parse(body.join('\n')) });
172
+ } catch {
173
+ // Unparseable blocks are RFC 0150 §D's problem, not this gate's.
174
+ }
175
+ i = j;
176
+ }
177
+ }
178
+ return out;
179
+ }
180
+
69
181
  describe.skipIf(V1_DIR === null)('RFC 0149 §B — discovery examples use the document-root layout', () => {
70
182
  const v1Dir = V1_DIR as string;
71
183
 
@@ -110,4 +222,51 @@ describe.skipIf(V1_DIR === null)('RFC 0149 §B — discovery examples use the do
110
222
  late.join('\n '),
111
223
  ).toEqual([]);
112
224
  });
225
+ it('the UQ2 predicate is pinned: a typo-only snippet is flagged, an event object is out of scope, a vendor key is exempt', () => {
226
+ const fams = new Set(['compensation', 'interrupts', 'fs', 'agents', 'content']);
227
+ // A misspelt single-key discovery snippet: all keys near-canonical ⇒ in scope, flagged.
228
+ expect(canonicalTypos({ compensaton: { supported: true } }, fams)).toEqual([{ key: 'compensaton', near: ['compensation'] }]);
229
+ // Canonical + a typo ⇒ flagged.
230
+ expect(canonicalTypos({ compensation: {}, interupts: {} }, fams)).toEqual([{ key: 'interupts', near: ['interrupts'] }]);
231
+ // An event: `ts` is one from `fs` but `type`/`payload` are none of the four kinds ⇒ not discovery-shaped.
232
+ expect(canonicalTypos({ ts: 1, type: 'x', payload: {} }, fams)).toBeNull();
233
+ // Vendor-namespaced keys are exempt (RFC 0149 §B) and the legacy wrapper is the wrapper leg's business.
234
+ expect(canonicalTypos({ compensation: {}, 'x-host-acme-agent': {} }, fams)).toEqual([]);
235
+ expect(canonicalTypos({ capabilities: {} }, fams)).toBeNull();
236
+ // Distance exactly one, both directions.
237
+ expect(withinOne('agent', 'agents')).toBe(true);
238
+ expect(withinOne('agents', 'agent')).toBe(true);
239
+ expect(withinOne('agent', 'agentz')).toBe(true);
240
+ expect(withinOne('agent', 'agenzs')).toBe(false);
241
+ expect(withinOne('agents', 'agents')).toBe(false);
242
+ });
243
+
244
+ it('no discovery-shaped example in spec/v1 or a post-0149 RFC has a root key within one edit of a canonical family', () => {
245
+ const families = canonicalFamilies();
246
+ expect(families.size, 'capabilities.schema.json MUST declare families').toBeGreaterThan(50);
247
+ const findings: string[] = [];
248
+ let shaped = 0;
249
+ const scan = (dir: string, rel: string, minRfc: number | null): void => {
250
+ for (const { file, line, value } of fencedObjects(dir)) {
251
+ if (minRfc !== null) {
252
+ const n = Number.parseInt(file.slice(0, 4), 10);
253
+ if (!Number.isFinite(n) || n < minRfc) continue;
254
+ }
255
+ const typos = canonicalTypos(value, families);
256
+ if (typos === null) continue;
257
+ shaped++;
258
+ for (const t of typos) findings.push(`${rel}/${file}:${line} → \`${t.key}\` (did you mean ${t.near.map((x) => '`' + x + '`').join(' / ')}?)`);
259
+ }
260
+ };
261
+ scan(v1Dir, 'spec/v1', null);
262
+ if (RFCS_DIR !== null && existsSync(RFCS_DIR)) scan(RFCS_DIR, 'RFCS', TYPO_LINT_RFC);
263
+ expect(shaped, 'the scan MUST find discovery-shaped examples, or the leg is vacuous').toBeGreaterThan(20);
264
+ expect(
265
+ findings,
266
+ 'RFC 0149 §B: a root key within one edit of a canonical family, in a discovery-shaped example, is a ' +
267
+ 'typo — an implementer copying it advertises nothing. Vendor surface goes under `x-host-*` / ' +
268
+ '`vendor.*` / `private.*` (host-extensions.md).\n ' +
269
+ findings.join('\n '),
270
+ ).toEqual([]);
271
+ });
113
272
  });
@@ -24,7 +24,7 @@
24
24
  */
25
25
 
26
26
  import { describe, it, expect } from 'vitest';
27
- import { readFileSync } from 'node:fs';
27
+ import { readFileSync, existsSync } from 'node:fs';
28
28
  import { join } from 'node:path';
29
29
  import { V1_DIR } from '../lib/paths.js';
30
30
  import { PROFILE_FLOOR_SCENARIOS } from '../lib/profiles.js';
@@ -36,7 +36,7 @@ type Maturity = (typeof MATURITIES)[number];
36
36
  interface Extension {
37
37
  readonly id: string;
38
38
  readonly maturity: Maturity;
39
- readonly owningRfc: string;
39
+ readonly owningRfc: string | null;
40
40
  readonly capabilityPath: string;
41
41
  readonly dependsOn: readonly string[];
42
42
  readonly securityTier: string;
@@ -190,35 +190,61 @@ describe.skipIf(V1_DIR === null)('RFC 0155 §C — extension registry', () => {
190
190
  // either a core predicate field, covered by a record's capabilityPath, or
191
191
  // listed as uncovered — and nothing is in two buckets.
192
192
  const reg = registry as unknown as {
193
- coverage?: { familiesTotal: number; coreFields: string[]; covered: string[]; uncovered: string[] };
193
+ coverage?: {
194
+ familiesTotal: number;
195
+ coreFields: string[];
196
+ metadataFields?: string[];
197
+ metadataRationale?: Record<string, string>;
198
+ covered: string[];
199
+ uncovered: string[];
200
+ };
194
201
  extensions: Extension[];
195
202
  };
196
203
  expect(reg.coverage, 'RFC 0155 §C: the registry MUST carry a derived `coverage` block').toBeDefined();
197
204
  const cov = reg.coverage as NonNullable<typeof reg.coverage>;
205
+ const metadata = cov.metadataFields ?? [];
198
206
  const families = Object.keys((caps().properties as Record<string, unknown>) ?? {}).sort();
199
207
  expect(cov.familiesTotal).toBe(families.length);
200
- const all = [...cov.coreFields, ...cov.covered, ...cov.uncovered].sort();
201
- expect(all, 'core + covered + uncovered MUST partition the family set exactly').toEqual(families);
208
+ const all = [...cov.coreFields, ...metadata, ...cov.covered, ...cov.uncovered].sort();
209
+ expect(all, 'core + metadata + covered + uncovered MUST partition the family set exactly').toEqual(families);
202
210
  expect(new Set(all).size, 'no family may sit in two buckets').toBe(all.length);
203
211
  const reached = new Set(reg.extensions.map((e) => e.capabilityPath.split('.')[0]));
204
212
  for (const f of cov.covered) expect(reached.has(f), `${f} listed as covered MUST be reached by a record`).toBe(true);
205
213
  for (const f of cov.uncovered) expect(reached.has(f), `${f} listed as uncovered MUST NOT be reached by a record`).toBe(false);
214
+ // Metadata is the one bucket a family can be moved INTO by hand, so it is
215
+ // the one that could hide an extension: every entry MUST carry a stated
216
+ // rationale, and no metadata key may carry a `supported` flag — a key that
217
+ // gates behaviour is a family, not a description of the document.
218
+ for (const f of metadata) {
219
+ expect(typeof cov.metadataRationale?.[f], `${f}: a metadata field MUST state why it is not an extension`).toBe('string');
220
+ const props = (caps().properties as Record<string, { properties?: Record<string, unknown> }>)[f]?.properties ?? {};
221
+ expect('supported' in props, `${f} is listed as metadata but carries a \`supported\` flag — that is an extension family`).toBe(false);
222
+ }
206
223
  // The honest number, asserted so it cannot silently shrink by deletion of the
207
224
  // uncovered list rather than by adding records.
208
- expect(cov.uncovered.length + cov.covered.length + cov.coreFields.length).toBe(families.length);
225
+ expect(cov.uncovered.length + cov.covered.length + cov.coreFields.length + metadata.length).toBe(families.length);
209
226
  });
210
227
 
211
- it('every record names the RFC that owns it', () => {
228
+ it('every record names the RFC — or, for a v1 base advertisement, the spec document — that owns it', () => {
212
229
  // Vendor extensions may not use an `openwop-*` id without an accepted RFC
213
- // (§F). The owning RFC is what makes that checkable.
230
+ // (§F). The owning RFC is what makes that checkable. Six advertisements
231
+ // predate the RFC process (they shipped in the v1 base corpus: `secrets`,
232
+ // `webhooks`, `i18n`, `aiProviders`, `envelopeContracts`, `envelopeStrictness`);
233
+ // those carry `owningRfc: null` and an `owningDoc` under spec/v1/ that MUST
234
+ // exist — the steward's own corpus is the RFC-equivalent authority for them.
214
235
  for (const e of (registry as NonNullable<typeof registry>).extensions) {
215
- expect(e.owningRfc, `${e.id} MUST name an owning RFC`).toMatch(/^\d{4}$/);
216
- if (e.id.startsWith('openwop-')) {
217
- expect(
218
- e.owningRfc.length,
219
- `${e.id}: an \`openwop-*\` id requires an accepted RFC (§F)`,
220
- ).toBeGreaterThan(0);
236
+ const rec = e as Extension & { owningDoc?: string; securityTier?: string };
237
+ if (rec.owningRfc === null) {
238
+ expect(typeof rec.owningDoc, `${e.id}: \`owningRfc: null\` requires an \`owningDoc\``).toBe('string');
239
+ expect(rec.owningDoc, `${e.id}: owningDoc MUST be a spec/v1 document`).toMatch(/^spec\/v1\/[a-z0-9-]+\.md$/);
240
+ if (V1_DIR !== null) {
241
+ const file = join(V1_DIR, (rec.owningDoc as string).replace(/^spec\/v1\//, ''));
242
+ expect(existsSync(file), `${e.id}: owningDoc ${rec.owningDoc} MUST exist`).toBe(true);
243
+ }
244
+ } else {
245
+ expect(e.owningRfc, `${e.id} MUST name an owning RFC`).toMatch(/^\d{4}$/);
221
246
  }
247
+ expect(['high', 'medium', 'low'], `${e.id}: securityTier is a closed enum`).toContain(rec.securityTier);
222
248
  }
223
249
  });
224
250
  });