@openwop/openwop-conformance 1.10.0 → 1.12.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/CHANGELOG.md +48 -0
- package/README.md +2 -2
- package/api/asyncapi.yaml +70 -0
- package/api/openapi.yaml +268 -1
- package/coverage.md +33 -2
- package/fixtures/oauth-providers/synthetic.json +38 -0
- package/fixtures.md +10 -0
- package/package.json +1 -1
- package/schemas/README.md +12 -0
- package/schemas/agent-deployment-transition.schema.json +49 -0
- package/schemas/agent-deployment.schema.json +54 -0
- package/schemas/agent-eval-suite.schema.json +140 -0
- package/schemas/agent-inventory-response.schema.json +25 -0
- package/schemas/agent-manifest.schema.json +5 -0
- package/schemas/agent-org-chart.schema.json +82 -0
- package/schemas/agent-ref.schema.json +12 -2
- package/schemas/agent-roster-entry.schema.json +81 -0
- package/schemas/agent-roster-response.schema.json +21 -0
- package/schemas/budget-policy.schema.json +18 -0
- package/schemas/capabilities.schema.json +277 -0
- package/schemas/credential-provenance.schema.json +18 -0
- package/schemas/eval-summary.schema.json +92 -0
- package/schemas/node-pack-manifest.schema.json +17 -0
- package/schemas/org-chart-responsibility-view.schema.json +26 -0
- package/schemas/run-event-payloads.schema.json +286 -3
- package/schemas/run-event.schema.json +19 -0
- package/schemas/tool-descriptor.schema.json +63 -0
- package/schemas/trigger-subscription.schema.json +26 -0
- package/src/lib/agentOrgChart.ts +82 -0
- package/src/lib/agentRoster.ts +76 -0
- package/src/lib/liveRuntime.ts +59 -0
- package/src/lib/profiles.ts +157 -0
- package/src/lib/runtimeRequires.ts +38 -0
- package/src/lib/safeFetch.ts +87 -0
- package/src/lib/triggerBridge.ts +74 -0
- package/src/scenarios/agent-deployment-shape.test.ts +139 -0
- package/src/scenarios/agent-eval-suite-shape.test.ts +167 -0
- package/src/scenarios/agent-live-allowlist-enforced.test.ts +53 -0
- package/src/scenarios/agent-live-invocation-bracket.test.ts +98 -0
- package/src/scenarios/agent-live-runtime-shape.test.ts +98 -0
- package/src/scenarios/agent-live-structured-output.test.ts +58 -0
- package/src/scenarios/agent-org-chart-scoping.test.ts +137 -0
- package/src/scenarios/agent-org-chart-shape.test.ts +127 -0
- package/src/scenarios/agent-platform-profile.test.ts +158 -0
- package/src/scenarios/agent-roster-attribution.test.ts +179 -0
- package/src/scenarios/agent-roster-shape.test.ts +146 -0
- package/src/scenarios/budget-policy-shape.test.ts +136 -0
- package/src/scenarios/egress-provenance-shape.test.ts +137 -0
- package/src/scenarios/memory-capability-model-shape.test.ts +186 -0
- package/src/scenarios/oauth-authorization-code-roundtrip.test.ts +145 -0
- package/src/scenarios/org-position-no-authority-escalation.test.ts +78 -0
- package/src/scenarios/runtime-requires-install-gate.test.ts +92 -0
- package/src/scenarios/runtime-requires-shape.test.ts +134 -0
- package/src/scenarios/safefetch-behavior.test.ts +99 -0
- package/src/scenarios/safefetch-live-audit.test.ts +175 -0
- package/src/scenarios/spec-corpus-validity.test.ts +19 -3
- package/src/scenarios/tool-descriptor-shape.test.ts +133 -0
- package/src/scenarios/trigger-bridge-delivery.test.ts +126 -0
- package/src/scenarios/trigger-bridge-shape.test.ts +135 -0
- package/src/scenarios/x-openwop-form-pack-manifest.test.ts +155 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `x-openwop-form` vendor-extension shape validation — `node-packs.md`
|
|
3
|
+
* §"`x-openwop-form` UX hints" (RFC 0066).
|
|
4
|
+
*
|
|
5
|
+
* Server-free, no host-advertisement gate: `x-openwop-form` is a
|
|
6
|
+
* CONSUMER-SIDE rendering hint that a pack author places on `configSchema`
|
|
7
|
+
* properties. Hosts do not advertise it; the contract is purely the shape a
|
|
8
|
+
* pack author targets. This scenario asserts the two shape-level guarantees
|
|
9
|
+
* the RFC's §Conformance pins:
|
|
10
|
+
*
|
|
11
|
+
* 1. A pack `configSchema` carrying `x-openwop-form` annotations remains a
|
|
12
|
+
* VALID JSON Schema 2020-12 document — the annotation is an ignored
|
|
13
|
+
* vendor keyword, so a schema validator (Ajv2020) compiles it without
|
|
14
|
+
* error. This is the load-bearing additive promise: a consumer that
|
|
15
|
+
* doesn't understand the keyword still validates config against the
|
|
16
|
+
* schema unchanged.
|
|
17
|
+
* 2. The annotation OBJECT itself matches the §A vocabulary shape: `kind`
|
|
18
|
+
* is REQUIRED and a string; the documented sub-fields (`dependsOn`,
|
|
19
|
+
* `promptKind`, `provider`, `credentialProvider`) are optional strings.
|
|
20
|
+
*
|
|
21
|
+
* Forward-compat (RFC §A + §B, both `MUST`): an UNKNOWN `kind` value is still
|
|
22
|
+
* a structurally valid annotation — a renderer MUST treat it as if the hint
|
|
23
|
+
* were absent rather than reject it. So the shape schema accepts any string
|
|
24
|
+
* `kind`, NOT a closed enum; the four reserved kinds
|
|
25
|
+
* (`prompt-picker`/`provider-picker`/`model-picker`/`credential-picker`) are
|
|
26
|
+
* a renderer-routing vocabulary, not a validation constraint.
|
|
27
|
+
*
|
|
28
|
+
* NOTE: the renderer behavior matrix (which picker each `kind` produces, the
|
|
29
|
+
* `dependsOn` sibling-resolution + graceful fallback) is a reference-FRONTEND
|
|
30
|
+
* concern unit-tested in the workflow-engine sample, NOT a protocol wire
|
|
31
|
+
* shape — it is intentionally out of scope for this server-free scenario.
|
|
32
|
+
*
|
|
33
|
+
* @see spec/v1/node-packs.md §"`x-openwop-form` UX hints"
|
|
34
|
+
* @see RFCS/0066-x-openwop-form-vendor-extension.md
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
import { describe, it, expect } from 'vitest';
|
|
38
|
+
import Ajv2020 from 'ajv/dist/2020.js';
|
|
39
|
+
import addFormats from 'ajv-formats';
|
|
40
|
+
import type { ErrorObject } from 'ajv';
|
|
41
|
+
|
|
42
|
+
/** The §A `x-openwop-form` annotation shape. `kind` is the only required
|
|
43
|
+
* field; it is an OPEN string (unknown kinds are valid per the forward-compat
|
|
44
|
+
* MUST), with the documented sub-fields typed as optional strings. */
|
|
45
|
+
const X_OPENWOP_FORM_SHAPE = {
|
|
46
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
47
|
+
type: 'object',
|
|
48
|
+
required: ['kind'],
|
|
49
|
+
properties: {
|
|
50
|
+
kind: { type: 'string' },
|
|
51
|
+
dependsOn: { type: 'string' },
|
|
52
|
+
promptKind: { type: 'string' },
|
|
53
|
+
provider: { type: 'string' },
|
|
54
|
+
credentialProvider: { type: 'string' },
|
|
55
|
+
},
|
|
56
|
+
additionalProperties: false,
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
/** A pack `configSchema` annotated for picker UX — the RFC §A positive
|
|
60
|
+
* example (`core.ai.chatCompletion`-style): provider/model/credential/prompt
|
|
61
|
+
* pickers with a `dependsOn` cascade. */
|
|
62
|
+
function annotatedConfigSchema() {
|
|
63
|
+
return {
|
|
64
|
+
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
provider: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
'x-openwop-form': { kind: 'provider-picker' },
|
|
70
|
+
},
|
|
71
|
+
model: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
'x-openwop-form': { kind: 'model-picker', dependsOn: 'provider' },
|
|
74
|
+
},
|
|
75
|
+
credential: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
'x-openwop-form': { kind: 'credential-picker', dependsOn: 'provider' },
|
|
78
|
+
},
|
|
79
|
+
systemPrompt: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
'x-openwop-form': { kind: 'prompt-picker', promptKind: 'system' },
|
|
82
|
+
},
|
|
83
|
+
temperature: { type: 'number', minimum: 0, maximum: 2 },
|
|
84
|
+
},
|
|
85
|
+
additionalProperties: false,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
describe('category: x-openwop-form pack-manifest shape (RFC 0066)', () => {
|
|
90
|
+
const ajv = new Ajv2020({ allErrors: true, strict: false });
|
|
91
|
+
addFormats(ajv);
|
|
92
|
+
const validateShape = ajv.compile<Record<string, unknown>>(X_OPENWOP_FORM_SHAPE);
|
|
93
|
+
|
|
94
|
+
const shapeFailsWith = (annotation: unknown, keyword: string): ErrorObject[] => {
|
|
95
|
+
const ok = validateShape(annotation);
|
|
96
|
+
expect(ok).toBe(false);
|
|
97
|
+
return (validateShape.errors ?? []).filter((e) => e.keyword === keyword);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
it('positive: a configSchema carrying x-openwop-form remains a valid JSON Schema 2020-12 document', () => {
|
|
101
|
+
// The annotation is an ignored vendor keyword — compiling MUST NOT throw,
|
|
102
|
+
// and the schema MUST still validate/reject instance config normally.
|
|
103
|
+
let validateConfig: ReturnType<typeof ajv.compile> | undefined;
|
|
104
|
+
expect(() => {
|
|
105
|
+
validateConfig = ajv.compile(annotatedConfigSchema());
|
|
106
|
+
}, 'node-packs.md §x-openwop-form: an annotated configSchema MUST remain a valid 2020-12 schema').not.toThrow();
|
|
107
|
+
// The annotations do not alter schema semantics: valid config passes…
|
|
108
|
+
expect(
|
|
109
|
+
validateConfig!({ provider: 'anthropic', model: 'claude', temperature: 1 }),
|
|
110
|
+
'x-openwop-form is advisory — it MUST NOT change what the schema accepts',
|
|
111
|
+
).toBe(true);
|
|
112
|
+
// …and a type violation on an annotated field still rejects.
|
|
113
|
+
expect(validateConfig!({ provider: 123 })).toBe(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('positive: each documented x-openwop-form annotation matches the §A shape', () => {
|
|
117
|
+
const cfg = annotatedConfigSchema();
|
|
118
|
+
for (const [name, prop] of Object.entries(cfg.properties)) {
|
|
119
|
+
const ann = (prop as Record<string, unknown>)['x-openwop-form'];
|
|
120
|
+
if (ann === undefined) continue;
|
|
121
|
+
expect(
|
|
122
|
+
validateShape(ann),
|
|
123
|
+
`node-packs.md §x-openwop-form: the annotation on "${name}" MUST match the §A shape. Errors: ${JSON.stringify(validateShape.errors)}`,
|
|
124
|
+
).toBe(true);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('forward-compat: an unknown kind is a structurally valid annotation (renderer falls back per the §A MUST)', () => {
|
|
129
|
+
expect(
|
|
130
|
+
validateShape({ kind: 'unknown-future-picker' }),
|
|
131
|
+
'node-packs.md §x-openwop-form: an unknown kind MUST validate (kind is an open string, not a closed enum) so future vocabulary is forward-compatible',
|
|
132
|
+
).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('negative: an annotation missing kind is rejected', () => {
|
|
136
|
+
expect(
|
|
137
|
+
shapeFailsWith({ dependsOn: 'provider' }, 'required').length,
|
|
138
|
+
'node-packs.md §x-openwop-form: kind is the one REQUIRED sub-field',
|
|
139
|
+
).toBeGreaterThan(0);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('negative: a non-string kind is rejected', () => {
|
|
143
|
+
expect(
|
|
144
|
+
shapeFailsWith({ kind: 42 }, 'type').length,
|
|
145
|
+
'node-packs.md §x-openwop-form: kind MUST be a string',
|
|
146
|
+
).toBeGreaterThan(0);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('negative: a non-string dependsOn is rejected', () => {
|
|
150
|
+
expect(
|
|
151
|
+
shapeFailsWith({ kind: 'model-picker', dependsOn: ['provider'] }, 'type').length,
|
|
152
|
+
'node-packs.md §x-openwop-form: dependsOn names a sibling property — it MUST be a string',
|
|
153
|
+
).toBeGreaterThan(0);
|
|
154
|
+
});
|
|
155
|
+
});
|