@redditech/agent-protocol 0.0.0-stage → 0.2.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 (55) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +21 -0
  3. package/README.md +394 -2
  4. package/dist/adl.d.ts +141 -0
  5. package/dist/adl.js +3601 -0
  6. package/dist/agent-stack-fixtures.d.ts +743 -0
  7. package/dist/agent-stack-fixtures.js +1554 -0
  8. package/dist/ai-catalog.d.ts +128 -0
  9. package/dist/ai-catalog.js +373 -0
  10. package/dist/attestation-reputation.d.ts +102 -0
  11. package/dist/attestation-reputation.js +279 -0
  12. package/dist/audd-rail-config.d.ts +102 -0
  13. package/dist/audd-rail-config.js +294 -0
  14. package/dist/browser-wallet-approval.d.ts +293 -0
  15. package/dist/browser-wallet-approval.js +1201 -0
  16. package/dist/discovery-source.d.ts +115 -0
  17. package/dist/discovery-source.js +251 -0
  18. package/dist/evidence-archive.d.ts +73 -0
  19. package/dist/evidence-archive.js +238 -0
  20. package/dist/index.d.ts +23 -0
  21. package/dist/index.js +23 -0
  22. package/dist/mpp-tempo-receipt-shapes.d.ts +201 -0
  23. package/dist/mpp-tempo-receipt-shapes.js +330 -0
  24. package/dist/okf-adapter.d.ts +229 -0
  25. package/dist/okf-adapter.js +556 -0
  26. package/dist/okf-conformance.d.ts +208 -0
  27. package/dist/okf-conformance.js +651 -0
  28. package/dist/okf-instruction-safety.d.ts +192 -0
  29. package/dist/okf-instruction-safety.js +509 -0
  30. package/dist/onboarding-analyser-handoff.d.ts +391 -0
  31. package/dist/onboarding-analyser-handoff.js +959 -0
  32. package/dist/onboarding-state-machine.d.ts +228 -0
  33. package/dist/onboarding-state-machine.js +432 -0
  34. package/dist/payment-records.d.ts +181 -0
  35. package/dist/payment-records.js +599 -0
  36. package/dist/policy.d.ts +33 -0
  37. package/dist/policy.js +45 -0
  38. package/dist/provider-trust.d.ts +113 -0
  39. package/dist/provider-trust.js +346 -0
  40. package/dist/quasar-registry-compatibility.d.ts +113 -0
  41. package/dist/quasar-registry-compatibility.js +214 -0
  42. package/dist/ranking-explainability.d.ts +202 -0
  43. package/dist/ranking-explainability.js +302 -0
  44. package/dist/receipt-v2.d.ts +202 -0
  45. package/dist/receipt-v2.js +418 -0
  46. package/dist/repo-explorer-evidence-manifest.d.ts +387 -0
  47. package/dist/repo-explorer-evidence-manifest.js +1187 -0
  48. package/dist/source-diagnostics.d.ts +84 -0
  49. package/dist/source-diagnostics.js +193 -0
  50. package/dist/source-trust-conformance-matrix.d.ts +207 -0
  51. package/dist/source-trust-conformance-matrix.js +672 -0
  52. package/examples/ard-no-spend-ai-catalog.json +51 -0
  53. package/examples/ard-no-spend-demo.mjs +355 -0
  54. package/examples/interpretation-guide-scenarios.mjs +302 -0
  55. package/package.json +144 -4
@@ -0,0 +1,1554 @@
1
+ export const AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION = 'reddi.agent-stack-fixture-corpus.v1';
2
+ export const STATIC_AGENT_STACK_INGESTION_RESULT_SCHEMA_VERSION = 'reddi.static-agent-stack-ingestion-result.v1';
3
+ export const STATIC_AGENT_STACK_CAPABILITY_INVENTORY_SCHEMA_VERSION = 'reddi.static-agent-stack-capability-inventory.v1';
4
+ export const STATIC_AGENT_STACK_DRAFT_PAYLOADS_SCHEMA_VERSION = 'reddi.static-agent-stack-draft-payloads.v1';
5
+ export const STATIC_AGENT_STACK_OPERATOR_REVIEW_PAYLOAD_SCHEMA_VERSION = 'reddi.static-agent-stack-operator-review-payload.v1';
6
+ const COMMIT_SHA_PATTERN = /^[a-f0-9]{40}$/i;
7
+ const RFC3339_UTC_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/;
8
+ const SAFE_PATH_PATTERN = /^[A-Za-z0-9._~@:/+*{}[\], -]+$/;
9
+ const SECRET_KEY_PATTERN = /(^|[_-])(api[_-]?key|access[_-]?token|refresh[_-]?token|private[_-]?key|client[_-]?secret|authorization|bearer|cookie|password|secret|seed|session[_-]?token|signature|sig|token)($|[_-])|apiKey|accessToken|refreshToken|sessionToken|privateKey|X-Goog-Signature|X-Amz-Signature/i;
10
+ const SECRET_VALUE_PATTERN = /(authorization:\s*bearer\s+|bearer\s+[a-z0-9._-]{8,}|sk-[a-z0-9_-]{8,}|xox[baprs]-|-----BEGIN [A-Z ]*PRIVATE KEY-----)/i;
11
+ const SUPPORTED_SURFACE_KINDS = [
12
+ 'repo-marketplace-metadata',
13
+ 'claude-plugin',
14
+ 'managed-agent-cookbook',
15
+ 'mcp-connector-config',
16
+ 'skill',
17
+ 'command',
18
+ 'subagent',
19
+ 'partner-plugin',
20
+ 'vertical-plugin',
21
+ 'validation-warning',
22
+ ];
23
+ const WARNING_SEVERITIES = ['info', 'warning', 'blocked'];
24
+ const STATIC_RISK_CODE_MAP = {
25
+ deploy_capable_commands: {
26
+ category: 'deploy_capable_command',
27
+ severity: 'blocked',
28
+ blocksDraftPayload: true,
29
+ message: 'Deploy-capable command metadata must be reviewed before draft publication.',
30
+ },
31
+ wallet_rpc_adjacent_commands: {
32
+ category: 'wallet_rpc_capable_metadata',
33
+ severity: 'blocked',
34
+ blocksDraftPayload: true,
35
+ message: 'Wallet, signing, or RPC-capable command metadata must be reviewed before draft publication.',
36
+ },
37
+ npx_mcp_execution: {
38
+ category: 'mcp_launcher_execution',
39
+ severity: 'warning',
40
+ blocksDraftPayload: true,
41
+ message: 'npx-launched MCP metadata must be reviewed before draft publication.',
42
+ },
43
+ env_required_connector: {
44
+ category: 'env_required_connector',
45
+ severity: 'warning',
46
+ blocksDraftPayload: true,
47
+ message: 'Environment-required connector metadata must be reviewed before draft publication.',
48
+ },
49
+ local_binary_required: {
50
+ category: 'local_binary_requirement',
51
+ severity: 'warning',
52
+ blocksDraftPayload: true,
53
+ message: 'Local-binary connector metadata must be reviewed before draft publication.',
54
+ },
55
+ executable_hooks: {
56
+ category: 'executable_hook',
57
+ severity: 'blocked',
58
+ blocksDraftPayload: true,
59
+ message: 'Executable hook metadata must be reviewed before draft publication.',
60
+ },
61
+ mainnet_deploy_guard_required: {
62
+ category: 'deploy_capable_command',
63
+ severity: 'blocked',
64
+ blocksDraftPayload: true,
65
+ message: 'Mainnet deploy guard metadata must be reviewed before draft publication.',
66
+ },
67
+ permission_policy: {
68
+ category: 'permission_policy',
69
+ severity: 'warning',
70
+ blocksDraftPayload: false,
71
+ message: 'Permission policy metadata requires operator review before enablement.',
72
+ },
73
+ private_path_denylist: {
74
+ category: 'permission_policy',
75
+ severity: 'warning',
76
+ blocksDraftPayload: false,
77
+ message: 'Private-path denylist metadata requires operator review before enablement.',
78
+ },
79
+ external_submodules_declared: {
80
+ category: 'external_submodule',
81
+ severity: 'blocked',
82
+ blocksDraftPayload: true,
83
+ message: 'External submodule declarations must be reviewed before draft publication.',
84
+ },
85
+ installer_script_non_executable_fixture: {
86
+ category: 'installer_or_update_script',
87
+ severity: 'blocked',
88
+ blocksDraftPayload: true,
89
+ message: 'Installer, update, or test script metadata must be reviewed before draft publication.',
90
+ },
91
+ mcp_connector_requires_operator_review: {
92
+ category: 'env_required_connector',
93
+ severity: 'warning',
94
+ blocksDraftPayload: true,
95
+ message: 'Connector metadata that requires credentials, hosted services, or local binaries must be reviewed before draft publication.',
96
+ },
97
+ executable_hooks_require_operator_review: {
98
+ category: 'executable_hook',
99
+ severity: 'blocked',
100
+ blocksDraftPayload: true,
101
+ message: 'Executable hook metadata must be reviewed before draft publication.',
102
+ },
103
+ solana_deploy_command_requires_operator_review: {
104
+ category: 'deploy_capable_command',
105
+ severity: 'blocked',
106
+ blocksDraftPayload: true,
107
+ message: 'Deploy-capable Solana command metadata must be reviewed before draft publication.',
108
+ },
109
+ external_submodules_not_initialized: {
110
+ category: 'external_submodule',
111
+ severity: 'warning',
112
+ blocksDraftPayload: true,
113
+ message: 'External submodule declarations must be reviewed before draft publication.',
114
+ },
115
+ };
116
+ function error(code, path, message) {
117
+ return { code, path, message };
118
+ }
119
+ function isPlainObject(value) {
120
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
121
+ return false;
122
+ const prototype = Object.getPrototypeOf(value);
123
+ return prototype === Object.prototype || prototype === null;
124
+ }
125
+ function isNonEmptyString(value) {
126
+ return typeof value === 'string' && value.trim().length > 0;
127
+ }
128
+ function isStringArray(value) {
129
+ return Array.isArray(value) && value.every((item) => typeof item === 'string');
130
+ }
131
+ function byteLength(value) {
132
+ try {
133
+ return new TextEncoder().encode(JSON.stringify(value)).length;
134
+ }
135
+ catch {
136
+ return undefined;
137
+ }
138
+ }
139
+ function findCredentialMaterial(value, path = '$') {
140
+ if (typeof value === 'string')
141
+ return SECRET_VALUE_PATTERN.test(value) ? path : undefined;
142
+ if (!value || typeof value !== 'object')
143
+ return undefined;
144
+ if (Array.isArray(value)) {
145
+ for (let index = 0; index < value.length; index += 1) {
146
+ const found = findCredentialMaterial(value[index], `${path}[${index}]`);
147
+ if (found)
148
+ return found;
149
+ }
150
+ return undefined;
151
+ }
152
+ for (const [key, child] of Object.entries(value)) {
153
+ const childPath = `${path}.${key}`;
154
+ if (SECRET_KEY_PATTERN.test(key))
155
+ return childPath;
156
+ const found = findCredentialMaterial(child, childPath);
157
+ if (found)
158
+ return found;
159
+ }
160
+ return undefined;
161
+ }
162
+ function validateSafeUrl(value, path, errors) {
163
+ if (!isNonEmptyString(value)) {
164
+ errors.push(error('invalid_source_reference', path, 'source URL must be a non-empty string'));
165
+ return;
166
+ }
167
+ let parsed;
168
+ try {
169
+ parsed = new URL(value);
170
+ }
171
+ catch {
172
+ errors.push(error('invalid_source_reference', path, 'source URL must be a valid URL'));
173
+ return;
174
+ }
175
+ if (parsed.protocol !== 'https:') {
176
+ errors.push(error('unsafe_url', path, 'source URL must use HTTPS'));
177
+ }
178
+ if (parsed.username || parsed.password) {
179
+ errors.push(error('unsafe_url', path, 'source URL must not embed credentials'));
180
+ }
181
+ for (const key of parsed.searchParams.keys()) {
182
+ if (SECRET_KEY_PATTERN.test(key)) {
183
+ errors.push(error('credential_leakage_rejected', `${path}.${key}`, 'source URL must not include credential-shaped query keys'));
184
+ }
185
+ }
186
+ for (const queryValue of parsed.searchParams.values()) {
187
+ if (SECRET_VALUE_PATTERN.test(queryValue)) {
188
+ errors.push(error('credential_leakage_rejected', path, 'source URL must not include credential-shaped query values'));
189
+ }
190
+ }
191
+ }
192
+ function validateTimestamp(value, path, errors) {
193
+ if (!isNonEmptyString(value) || !RFC3339_UTC_PATTERN.test(value)) {
194
+ errors.push(error('invalid_timestamp', path, 'crawlTimestamp must be an ISO timestamp'));
195
+ return;
196
+ }
197
+ const parsed = new Date(value);
198
+ const normalized = value.includes('.') ? value : value.replace('Z', '.000Z');
199
+ if (Number.isNaN(parsed.getTime()) || parsed.toISOString() !== normalized) {
200
+ errors.push(error('invalid_timestamp', path, 'crawlTimestamp must be a valid ISO timestamp'));
201
+ }
202
+ }
203
+ function validateStringArray(value, path, errors) {
204
+ if (!isStringArray(value) || value.length === 0 || value.some((item) => !item.trim())) {
205
+ errors.push(error('malformed_fixture_corpus', path, 'field must be a non-empty string array'));
206
+ }
207
+ }
208
+ function validateOptionalString(value, path, errors) {
209
+ if (value !== undefined && !isNonEmptyString(value)) {
210
+ errors.push(error('malformed_fixture_corpus', path, 'field must be a non-empty string when present'));
211
+ }
212
+ }
213
+ function validateOptionalStringArray(value, path, errors) {
214
+ if (value !== undefined && (!isStringArray(value) || value.some((item) => !item.trim()))) {
215
+ errors.push(error('malformed_fixture_corpus', path, 'field must be a string array when present'));
216
+ }
217
+ }
218
+ function validateOptionalBoolean(value, path, errors) {
219
+ if (value !== undefined && typeof value !== 'boolean') {
220
+ errors.push(error('malformed_fixture_corpus', path, 'field must be a boolean when present'));
221
+ }
222
+ }
223
+ function validatePath(value, path, errors) {
224
+ if (!isNonEmptyString(value) || !SAFE_PATH_PATTERN.test(value)) {
225
+ errors.push(error('invalid_source_reference', path, 'path must be a safe static source path'));
226
+ return;
227
+ }
228
+ if (value.startsWith('/')) {
229
+ errors.push(error('invalid_source_reference', path, 'path must be relative to the static fixture root'));
230
+ }
231
+ if (/^[A-Za-z]:\//.test(value)) {
232
+ errors.push(error('invalid_source_reference', path, 'path must not use a drive-letter prefix'));
233
+ }
234
+ if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(value)) {
235
+ errors.push(error('invalid_source_reference', path, 'path must not use a URI scheme'));
236
+ }
237
+ const segments = value.split(/[/:]+/);
238
+ if (segments.includes('..')) {
239
+ errors.push(error('invalid_source_reference', path, 'path must not include traversal segments'));
240
+ }
241
+ }
242
+ function validateSurface(value, path, errors) {
243
+ if (!isPlainObject(value)) {
244
+ errors.push(error('malformed_fixture_corpus', path, 'surface must be an object'));
245
+ return;
246
+ }
247
+ for (const key of ['id', 'name', 'kind', 'path']) {
248
+ if (!isNonEmptyString(value[key])) {
249
+ errors.push(error('malformed_fixture_corpus', `${path}.${key}`, 'surface field must be a non-empty string'));
250
+ }
251
+ }
252
+ if (isNonEmptyString(value.kind) && !SUPPORTED_SURFACE_KINDS.includes(value.kind)) {
253
+ errors.push(error('malformed_fixture_corpus', `${path}.kind`, 'surface kind is unsupported'));
254
+ }
255
+ validatePath(value.path, `${path}.path`, errors);
256
+ if (!['untrusted_public_text', 'metadata_only'].includes(String(value.contentTrustBoundary))) {
257
+ errors.push(error('malformed_fixture_corpus', `${path}.contentTrustBoundary`, 'surface must declare its content trust boundary'));
258
+ }
259
+ validateOptionalString(value.category, `${path}.category`, errors);
260
+ validateOptionalString(value.runtimeSurface, `${path}.runtimeSurface`, errors);
261
+ validateOptionalStringArray(value.commands, `${path}.commands`, errors);
262
+ validateOptionalStringArray(value.skills, `${path}.skills`, errors);
263
+ validateOptionalStringArray(value.toolGrants, `${path}.toolGrants`, errors);
264
+ validateOptionalStringArray(value.authDependencies, `${path}.authDependencies`, errors);
265
+ validateOptionalStringArray(value.dataDependencies, `${path}.dataDependencies`, errors);
266
+ validateOptionalStringArray(value.safetyHints, `${path}.safetyHints`, errors);
267
+ validateOptionalStringArray(value.humanReviewHints, `${path}.humanReviewHints`, errors);
268
+ validateOptionalBoolean(value.writeCapable, `${path}.writeCapable`, errors);
269
+ validateOptionalStringArray(value.notes, `${path}.notes`, errors);
270
+ }
271
+ function validateFile(value, path, errors) {
272
+ if (!isPlainObject(value)) {
273
+ errors.push(error('malformed_fixture_corpus', path, 'file entry must be an object'));
274
+ return;
275
+ }
276
+ validatePath(value.path, `${path}.path`, errors);
277
+ if (!isNonEmptyString(value.kind)) {
278
+ errors.push(error('malformed_fixture_corpus', `${path}.kind`, 'file kind must be a non-empty string'));
279
+ }
280
+ else if (!SUPPORTED_SURFACE_KINDS.includes(value.kind)) {
281
+ errors.push(error('malformed_fixture_corpus', `${path}.kind`, 'file kind is unsupported'));
282
+ }
283
+ if (typeof value.present !== 'boolean') {
284
+ errors.push(error('malformed_fixture_corpus', `${path}.present`, 'file present must be a boolean'));
285
+ }
286
+ if (!['valid', 'malformed', 'not_parsed', 'missing'].includes(String(value.parseStatus))) {
287
+ errors.push(error('malformed_fixture_corpus', `${path}.parseStatus`, 'file parseStatus is unsupported'));
288
+ }
289
+ validateOptionalString(value.parseErrorLocation, `${path}.parseErrorLocation`, errors);
290
+ validateOptionalString(value.mediaType, `${path}.mediaType`, errors);
291
+ validateOptionalString(value.summary, `${path}.summary`, errors);
292
+ validateOptionalStringArray(value.warningCodes, `${path}.warningCodes`, errors);
293
+ }
294
+ function validateWarning(value, path, errors) {
295
+ if (!isPlainObject(value)) {
296
+ errors.push(error('malformed_fixture_corpus', path, 'validation warning must be an object'));
297
+ return;
298
+ }
299
+ if (!isNonEmptyString(value.code)) {
300
+ errors.push(error('malformed_fixture_corpus', `${path}.code`, 'warning code must be a non-empty string'));
301
+ }
302
+ if (!WARNING_SEVERITIES.includes(value.severity)) {
303
+ errors.push(error('malformed_fixture_corpus', `${path}.severity`, 'warning severity is unsupported'));
304
+ }
305
+ validatePath(value.path, `${path}.path`, errors);
306
+ if (!isNonEmptyString(value.message)) {
307
+ errors.push(error('malformed_fixture_corpus', `${path}.message`, 'warning message must be a non-empty string'));
308
+ }
309
+ }
310
+ export function validateAgentStackFixtureCorpus(input, options = {}) {
311
+ const maxBytes = options.maxBytes ?? 96_000;
312
+ const errors = [];
313
+ if (!isPlainObject(input)) {
314
+ return { ok: false, errors: [error('malformed_fixture_corpus', '$', 'agent-stack fixture corpus must be a plain object')] };
315
+ }
316
+ const size = byteLength(input);
317
+ if (size === undefined) {
318
+ return { ok: false, errors: [error('malformed_fixture_corpus', '$', 'fixture corpus must be JSON-serializable')] };
319
+ }
320
+ if (size > maxBytes) {
321
+ return { ok: false, errors: [error('corpus_too_large', '$', `fixture corpus exceeds ${maxBytes} bytes`)] };
322
+ }
323
+ const credentialPath = findCredentialMaterial(input);
324
+ if (credentialPath) {
325
+ return {
326
+ ok: false,
327
+ errors: [error('credential_leakage_rejected', credentialPath, 'fixture corpus must not contain credential-shaped material')],
328
+ };
329
+ }
330
+ if (input.schemaVersion !== AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION) {
331
+ errors.push(error('malformed_fixture_corpus', '$.schemaVersion', `expected ${AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION}`));
332
+ }
333
+ if (!isNonEmptyString(input.id))
334
+ errors.push(error('malformed_fixture_corpus', '$.id', 'id must be a non-empty string'));
335
+ if (!isNonEmptyString(input.title))
336
+ errors.push(error('malformed_fixture_corpus', '$.title', 'title must be a non-empty string'));
337
+ if (input.staticOnly !== true)
338
+ errors.push(error('malformed_fixture_corpus', '$.staticOnly', 'fixture corpus must be staticOnly=true'));
339
+ validateStringArray(input.nonGoals, '$.nonGoals', errors);
340
+ if (!isPlainObject(input.source)) {
341
+ errors.push(error('malformed_fixture_corpus', '$.source', 'source must be an object'));
342
+ }
343
+ else {
344
+ validateSafeUrl(input.source.sourceUrl, '$.source.sourceUrl', errors);
345
+ if (!isNonEmptyString(input.source.checkedCommit) || !COMMIT_SHA_PATTERN.test(input.source.checkedCommit)) {
346
+ errors.push(error('invalid_commit_ref', '$.source.checkedCommit', 'checkedCommit must be a 40-character commit SHA'));
347
+ }
348
+ validateOptionalString(input.source.checkedRef, '$.source.checkedRef', errors);
349
+ validateOptionalString(input.source.license, '$.source.license', errors);
350
+ validateStringArray(input.source.sourceNotes, '$.source.sourceNotes', errors);
351
+ validateStringArray(input.source.authenticityNotes, '$.source.authenticityNotes', errors);
352
+ validateTimestamp(input.source.crawlTimestamp, '$.source.crawlTimestamp', errors);
353
+ if (input.source.localResearchArtifactPath !== undefined) {
354
+ validatePath(input.source.localResearchArtifactPath, '$.source.localResearchArtifactPath', errors);
355
+ }
356
+ }
357
+ if (!Array.isArray(input.surfaces) || input.surfaces.length === 0) {
358
+ errors.push(error('malformed_fixture_corpus', '$.surfaces', 'surfaces must be a non-empty array'));
359
+ }
360
+ else {
361
+ input.surfaces.forEach((surface, index) => validateSurface(surface, `$.surfaces[${index}]`, errors));
362
+ }
363
+ if (!Array.isArray(input.files) || input.files.length === 0) {
364
+ errors.push(error('malformed_fixture_corpus', '$.files', 'files must be a non-empty array'));
365
+ }
366
+ else {
367
+ input.files.forEach((file, index) => validateFile(file, `$.files[${index}]`, errors));
368
+ }
369
+ if (!Array.isArray(input.validationWarnings)) {
370
+ errors.push(error('malformed_fixture_corpus', '$.validationWarnings', 'validationWarnings must be an array'));
371
+ }
372
+ else {
373
+ input.validationWarnings.forEach((warning, index) => validateWarning(warning, `$.validationWarnings[${index}]`, errors));
374
+ }
375
+ return errors.length === 0
376
+ ? {
377
+ ok: true,
378
+ corpus: input,
379
+ warnings: input.validationWarnings,
380
+ }
381
+ : { ok: false, errors };
382
+ }
383
+ export function createAgentStackFixtureCorpus(input, options = {}) {
384
+ const result = validateAgentStackFixtureCorpus(input, options);
385
+ if (!result.ok) {
386
+ throw new Error(`invalid_agent_stack_fixture_corpus:${result.errors.map((item) => item.code).join(',')}`);
387
+ }
388
+ return result.corpus;
389
+ }
390
+ function connectorMessage(file, warning) {
391
+ if (warning?.message)
392
+ return warning.message;
393
+ switch (file.parseStatus) {
394
+ case 'valid':
395
+ return 'Connector metadata is statically valid.';
396
+ case 'malformed':
397
+ return 'Connector metadata is malformed and must be diagnosed before draft publication.';
398
+ case 'missing':
399
+ return 'Connector metadata file is missing.';
400
+ case 'not_parsed':
401
+ default:
402
+ return 'Connector metadata is recorded but not parsed yet.';
403
+ }
404
+ }
405
+ function connectorBlocksDraftPayload(diagnostic) {
406
+ return diagnostic.parseStatus === 'malformed' || diagnostic.parseStatus === 'missing';
407
+ }
408
+ function connectorRequiresOperatorReview(file, warning) {
409
+ return file.parseStatus !== 'valid' || (file.warningCodes?.length ?? 0) > 0 || warning !== undefined;
410
+ }
411
+ function maxSeverity(left, right) {
412
+ if (left === 'blocked' || right === 'blocked')
413
+ return 'blocked';
414
+ if (left === 'warning' || right === 'warning')
415
+ return 'warning';
416
+ return 'info';
417
+ }
418
+ function createRiskDiagnostics(corpus) {
419
+ const byPathAndCategory = new Map();
420
+ const addRisk = (path, sourceKind, code, severityOverride) => {
421
+ const mapped = STATIC_RISK_CODE_MAP[code];
422
+ if (!mapped)
423
+ return;
424
+ const key = `${path}:${mapped.category}`;
425
+ const severity = severityOverride ? maxSeverity(mapped.severity, severityOverride) : mapped.severity;
426
+ const existing = byPathAndCategory.get(key);
427
+ if (existing) {
428
+ byPathAndCategory.set(key, {
429
+ ...existing,
430
+ severity: maxSeverity(existing.severity, severity),
431
+ warningCodes: existing.warningCodes.includes(code) ? existing.warningCodes : [...existing.warningCodes, code],
432
+ blocksDraftPayload: existing.blocksDraftPayload || mapped.blocksDraftPayload,
433
+ operatorReviewRequired: true,
434
+ });
435
+ return;
436
+ }
437
+ byPathAndCategory.set(key, {
438
+ path,
439
+ sourceKind,
440
+ diagnosticLane: 'static_fixture_risk_taxonomy',
441
+ category: mapped.category,
442
+ severity,
443
+ warningCodes: [code],
444
+ blocksDraftPayload: mapped.blocksDraftPayload,
445
+ operatorReviewRequired: true,
446
+ message: mapped.message,
447
+ });
448
+ };
449
+ for (const file of corpus.files) {
450
+ for (const code of file.warningCodes ?? []) {
451
+ addRisk(file.path, file.kind, code);
452
+ }
453
+ }
454
+ for (const warning of corpus.validationWarnings) {
455
+ addRisk(warning.path, 'validation-warning', warning.code, warning.severity);
456
+ }
457
+ return [...byPathAndCategory.values()].sort((left, right) => (left.path.localeCompare(right.path)
458
+ || left.category.localeCompare(right.category)));
459
+ }
460
+ function sideEffectRiskFromSurface(surface) {
461
+ const combinedHints = [
462
+ ...(surface.commands ?? []),
463
+ ...(surface.toolGrants ?? []),
464
+ ...(surface.safetyHints ?? []),
465
+ surface.runtimeSurface ?? '',
466
+ ].join(' ').toLowerCase();
467
+ if (combinedHints.includes('hook')
468
+ || combinedHints.includes('bash')
469
+ || combinedHints.includes('shell')
470
+ || combinedHints.includes('deploy')
471
+ || combinedHints.includes('install')
472
+ || combinedHints.includes('npx')) {
473
+ return 'execute';
474
+ }
475
+ if (surface.writeCapable)
476
+ return 'write';
477
+ if (combinedHints.includes('rpc') || combinedHints.includes('browser') || combinedHints.includes('api'))
478
+ return 'read';
479
+ return 'none';
480
+ }
481
+ function createCapabilityInventoryBundle(corpus, inventory, rejectedEntries) {
482
+ const inventoryById = new Map(inventory.map((entry) => [entry.id, entry]));
483
+ const entries = corpus.surfaces
484
+ .filter((surface) => surface.kind !== 'validation-warning')
485
+ .map((surface) => {
486
+ const inventoryEntry = inventoryById.get(surface.id);
487
+ return {
488
+ capabilityId: surface.id,
489
+ capabilityName: surface.name,
490
+ sourceKind: surface.kind,
491
+ sourcePath: surface.path,
492
+ runtimeSurface: surface.runtimeSurface,
493
+ category: surface.category,
494
+ commands: inventoryEntry?.commands ?? [],
495
+ skills: inventoryEntry?.skills ?? [],
496
+ toolGrants: inventoryEntry?.toolGrants ?? [],
497
+ authDependencies: inventoryEntry?.authDependencies ?? [],
498
+ dataDependencies: inventoryEntry?.dataDependencies ?? [],
499
+ safetyHints: inventoryEntry?.safetyHints ?? [],
500
+ humanReviewHints: inventoryEntry?.humanReviewHints ?? [],
501
+ writeCapable: inventoryEntry?.writeCapable ?? false,
502
+ sideEffectRisk: sideEffectRiskFromSurface(surface),
503
+ contentTrustBoundary: surface.contentTrustBoundary,
504
+ provenance: {
505
+ corpusId: corpus.id,
506
+ sourceUrl: corpus.source.sourceUrl,
507
+ checkedCommit: corpus.source.checkedCommit,
508
+ checkedRef: corpus.source.checkedRef,
509
+ license: corpus.source.license,
510
+ },
511
+ };
512
+ });
513
+ const malformedFileDiagnostics = corpus.files
514
+ .filter((file) => file.parseStatus === 'malformed')
515
+ .map((file) => ({
516
+ path: file.path,
517
+ sourceKind: file.kind,
518
+ severity: 'blocked',
519
+ code: 'malformed_static_metadata',
520
+ message: file.parseErrorLocation
521
+ ? `Static metadata is malformed at ${file.parseErrorLocation}.`
522
+ : 'Static metadata is malformed.',
523
+ }));
524
+ const warningDiagnostics = corpus.validationWarnings.map((warning) => ({
525
+ path: warning.path,
526
+ sourceKind: 'validation-warning',
527
+ severity: warning.severity,
528
+ code: warning.code,
529
+ message: warning.message,
530
+ }));
531
+ return {
532
+ schemaVersion: STATIC_AGENT_STACK_CAPABILITY_INVENTORY_SCHEMA_VERSION,
533
+ corpusId: corpus.id,
534
+ source: corpus.source,
535
+ entries,
536
+ parserDiagnostics: [...malformedFileDiagnostics, ...warningDiagnostics].sort((left, right) => (left.path.localeCompare(right.path)
537
+ || left.code.localeCompare(right.code))),
538
+ rejectedEntries,
539
+ };
540
+ }
541
+ function readinessFromCorpus(corpus, connectorDiagnostics, riskDiagnostics, rejectedEntries) {
542
+ const blockers = [
543
+ ...rejectedEntries.map((entry) => entry.reasonCode),
544
+ ...riskDiagnostics
545
+ .filter((diagnostic) => diagnostic.blocksDraftPayload)
546
+ .map((diagnostic) => `static_risk:${diagnostic.category}:${diagnostic.path}`),
547
+ ...connectorDiagnostics
548
+ .filter((diagnostic) => diagnostic.parseStatus === 'malformed')
549
+ .map((diagnostic) => `malformed_connector:${diagnostic.path}`),
550
+ ...connectorDiagnostics
551
+ .filter((diagnostic) => diagnostic.parseStatus === 'missing')
552
+ .map((diagnostic) => `missing_connector:${diagnostic.path}`),
553
+ ];
554
+ if (blockers.length > 0) {
555
+ return { status: 'blocked', blockers, payloadRefs: [] };
556
+ }
557
+ if (corpus.validationWarnings.length > 0
558
+ || connectorDiagnostics.some((diagnostic) => diagnostic.parseStatus !== 'valid')
559
+ || riskDiagnostics.some((diagnostic) => diagnostic.operatorReviewRequired)) {
560
+ return {
561
+ status: 'needs_review',
562
+ blockers: ['operator_review_required'],
563
+ payloadRefs: [],
564
+ };
565
+ }
566
+ return {
567
+ status: 'ready',
568
+ blockers: [],
569
+ payloadRefs: [`static-ingestion:${corpus.id}:draft-profile`, `static-ingestion:${corpus.id}:draft-listing`],
570
+ };
571
+ }
572
+ function draftStateSeverityFromReadiness(status) {
573
+ if (status === 'blocked')
574
+ return 'blocked';
575
+ if (status === 'needs_review')
576
+ return 'needs_review';
577
+ return 'draft';
578
+ }
579
+ function rawSnapshotRefsForCorpus(corpus) {
580
+ return [
581
+ `source:${corpus.source.sourceUrl}#${corpus.source.checkedCommit}`,
582
+ ...(corpus.source.localResearchArtifactPath ? [`local:${corpus.source.localResearchArtifactPath}`] : []),
583
+ ];
584
+ }
585
+ function createDraftPayloads(corpus, capabilityInventory, connectorDiagnostics, riskDiagnostics, rejectedEntries, warnings, draftPayloadReadiness) {
586
+ const draftStates = [
587
+ {
588
+ code: 'listing_draft',
589
+ severity: 'info',
590
+ message: 'Imported static fixture is a draft only until operator approval and readiness gates pass.',
591
+ },
592
+ {
593
+ code: 'missing_payment',
594
+ severity: 'warning',
595
+ message: 'Imported static fixture has no payment setup; payment activation is disabled.',
596
+ },
597
+ {
598
+ code: 'missing_endpoint',
599
+ severity: 'warning',
600
+ message: 'Imported static fixture has no invocation endpoint; endpoint binding must be supplied before publication.',
601
+ },
602
+ ...connectorDiagnostics
603
+ .filter((diagnostic) => diagnostic.parseStatus === 'malformed' || diagnostic.parseStatus === 'missing')
604
+ .map((diagnostic) => ({
605
+ code: diagnostic.parseStatus === 'missing' ? 'missing_connector' : 'malformed_connector',
606
+ severity: 'blocked',
607
+ path: diagnostic.path,
608
+ message: diagnostic.message,
609
+ })),
610
+ ...riskDiagnostics
611
+ .filter((diagnostic) => diagnostic.operatorReviewRequired)
612
+ .map((diagnostic) => ({
613
+ code: 'static_risk_review_required',
614
+ severity: diagnostic.blocksDraftPayload ? 'blocked' : diagnostic.severity,
615
+ path: diagnostic.path,
616
+ message: diagnostic.message,
617
+ })),
618
+ ...rejectedEntries.map((entry) => ({
619
+ code: 'rejected_entry',
620
+ severity: 'blocked',
621
+ path: entry.path,
622
+ message: entry.message,
623
+ })),
624
+ ...warnings
625
+ .filter((warning) => warning.severity !== 'blocked')
626
+ .map((warning) => ({
627
+ code: 'unsafe_metadata_warning',
628
+ severity: warning.severity,
629
+ path: warning.path,
630
+ message: warning.message,
631
+ })),
632
+ ];
633
+ const profileId = `draft-profile:${corpus.id}`;
634
+ const listingId = `draft-listing:${corpus.id}`;
635
+ const capabilityLabels = capabilityInventory.entries.flatMap((entry) => [
636
+ entry.capabilityName,
637
+ ...entry.commands,
638
+ ...entry.skills,
639
+ ]);
640
+ return {
641
+ schemaVersion: STATIC_AGENT_STACK_DRAFT_PAYLOADS_SCHEMA_VERSION,
642
+ profile: {
643
+ schemaVersion: 'reddi.agent-profile.draft.v1',
644
+ profileId,
645
+ displayName: corpus.title,
646
+ sourceType: 'static-agent-stack-fixture',
647
+ source: corpus.source,
648
+ capabilities: capabilityInventory.entries,
649
+ invocation: {
650
+ endpointType: 'static-fixture-only',
651
+ missingEndpoint: true,
652
+ },
653
+ payment: {
654
+ status: 'missing_payment_setup',
655
+ activation: 'disabled',
656
+ },
657
+ trust: {
658
+ sourceAuthenticity: 'verified_source_snapshot',
659
+ contentTrust: 'untrusted_imported_content',
660
+ verifiedProviderTrust: false,
661
+ },
662
+ policyRequirements: [
663
+ 'operator_review_required',
664
+ 'payment_setup_required',
665
+ 'endpoint_binding_required',
666
+ ],
667
+ evidenceExpectations: [
668
+ 'source_snapshot_reference',
669
+ 'operator_review_record',
670
+ 'readiness_gate_result',
671
+ ],
672
+ rawSnapshotRefs: rawSnapshotRefsForCorpus(corpus),
673
+ },
674
+ aiCatalogFragment: {
675
+ specVersion: '1.0',
676
+ resources: [{
677
+ id: `urn:reddi:agent-stack-draft:${corpus.id}`,
678
+ type: 'agent-stack-draft',
679
+ mediaType: 'application/vnd.reddi.agent-profile+json',
680
+ name: corpus.title,
681
+ description: 'Draft RAP profile generated from an untrusted static agent-stack fixture.',
682
+ capabilities: [...new Set(capabilityLabels)].sort(),
683
+ source: {
684
+ url: corpus.source.sourceUrl,
685
+ checkedCommit: corpus.source.checkedCommit,
686
+ checkedRef: corpus.source.checkedRef,
687
+ },
688
+ trust: {
689
+ status: 'unverified',
690
+ note: 'Source snapshot is recorded, but imported content and provider trust are unverified until RAP review.',
691
+ },
692
+ payment: {
693
+ status: 'missing_payment_setup',
694
+ },
695
+ }],
696
+ },
697
+ listing: {
698
+ schemaVersion: 'reddi.registry-listing.draft.v1',
699
+ listingId,
700
+ status: draftStateSeverityFromReadiness(draftPayloadReadiness.status),
701
+ profileRef: profileId,
702
+ publicationDisabled: true,
703
+ operatorReviewRequired: true,
704
+ states: draftStates,
705
+ },
706
+ };
707
+ }
708
+ function reviewItemId(corpusId, state, path) {
709
+ return `operator-review:${corpusId}:${state}${path ? `:${path}` : ''}`;
710
+ }
711
+ function statusFromReviewItems(reviewItems) {
712
+ if (reviewItems.some((item) => item.state === 'suspended_imported_listing'))
713
+ return 'suspended';
714
+ if (reviewItems.some((item) => item.state === 'rejected_malformed_connector' || item.state === 'static_risk_blocker'))
715
+ return 'rejected';
716
+ if (reviewItems.some((item) => item.state === 'request_changes_missing_payment' || item.state === 'unsafe_metadata_warning')) {
717
+ return 'request_changes';
718
+ }
719
+ return 'approve_ready';
720
+ }
721
+ function createOperatorReviewPayload(corpus, capabilityInventory, connectorDiagnostics, riskDiagnostics, rejectedEntries, warnings, draftPayloads) {
722
+ const rawSnapshotRefs = rawSnapshotRefsForCorpus(corpus);
723
+ const reviewItems = [
724
+ {
725
+ id: reviewItemId(corpus.id, 'approve_ready_draft'),
726
+ state: 'approve_ready_draft',
727
+ severity: 'info',
728
+ source: 'draft_payload',
729
+ reasonCodes: ['operator_approval_required', 'readiness_gates_required'],
730
+ message: 'Draft listing cannot become public until operator approval and readiness gates pass.',
731
+ blocksPublication: true,
732
+ recommendedAction: 'approve_after_readiness_gates',
733
+ },
734
+ {
735
+ id: reviewItemId(corpus.id, 'request_changes_missing_payment'),
736
+ state: 'request_changes_missing_payment',
737
+ severity: 'warning',
738
+ source: 'draft_payload',
739
+ reasonCodes: ['missing_payment_setup'],
740
+ message: 'Payment setup is missing; payment activation remains disabled.',
741
+ blocksPublication: true,
742
+ recommendedAction: 'request_payment_setup',
743
+ },
744
+ {
745
+ id: reviewItemId(corpus.id, 'request_changes_missing_payment', 'invocation-endpoint'),
746
+ state: 'request_changes_missing_payment',
747
+ severity: 'warning',
748
+ path: 'invocation-endpoint',
749
+ source: 'draft_payload',
750
+ reasonCodes: ['missing_endpoint_binding'],
751
+ message: 'Invocation endpoint binding is missing and must be supplied before publication.',
752
+ blocksPublication: true,
753
+ recommendedAction: 'request_endpoint_binding',
754
+ },
755
+ ...connectorDiagnostics
756
+ .filter((diagnostic) => diagnostic.parseStatus === 'malformed' || diagnostic.parseStatus === 'missing')
757
+ .map((diagnostic) => ({
758
+ id: reviewItemId(corpus.id, 'rejected_malformed_connector', diagnostic.path),
759
+ state: 'rejected_malformed_connector',
760
+ severity: 'blocked',
761
+ path: diagnostic.path,
762
+ source: 'connector_diagnostic',
763
+ reasonCodes: diagnostic.warningCodes,
764
+ message: diagnostic.message,
765
+ blocksPublication: true,
766
+ recommendedAction: 'reject_or_fix_malformed_connector',
767
+ })),
768
+ ...riskDiagnostics
769
+ .filter((diagnostic) => diagnostic.operatorReviewRequired)
770
+ .map((diagnostic) => ({
771
+ id: reviewItemId(corpus.id, 'static_risk_blocker', diagnostic.path),
772
+ state: 'static_risk_blocker',
773
+ severity: diagnostic.blocksDraftPayload ? 'blocked' : diagnostic.severity,
774
+ path: diagnostic.path,
775
+ source: 'risk_diagnostic',
776
+ reasonCodes: diagnostic.warningCodes,
777
+ message: diagnostic.message,
778
+ blocksPublication: true,
779
+ recommendedAction: 'review_static_risk',
780
+ })),
781
+ ...rejectedEntries.map((entry) => ({
782
+ id: reviewItemId(corpus.id, 'suspended_imported_listing', entry.path),
783
+ state: 'suspended_imported_listing',
784
+ severity: 'blocked',
785
+ path: entry.path,
786
+ source: 'rejected_entry',
787
+ reasonCodes: [entry.reasonCode],
788
+ message: entry.message,
789
+ blocksPublication: true,
790
+ recommendedAction: 'keep_suspended',
791
+ })),
792
+ ...warnings
793
+ .filter((warning) => warning.severity !== 'blocked')
794
+ .map((warning) => ({
795
+ id: reviewItemId(corpus.id, 'unsafe_metadata_warning', warning.path),
796
+ state: 'unsafe_metadata_warning',
797
+ severity: warning.severity,
798
+ path: warning.path,
799
+ source: 'validation_warning',
800
+ reasonCodes: [warning.code],
801
+ message: warning.message,
802
+ blocksPublication: warning.severity === 'warning',
803
+ recommendedAction: 'review_unsafe_metadata',
804
+ })),
805
+ ];
806
+ return {
807
+ schemaVersion: STATIC_AGENT_STACK_OPERATOR_REVIEW_PAYLOAD_SCHEMA_VERSION,
808
+ reviewId: `operator-review:${corpus.id}`,
809
+ corpusId: corpus.id,
810
+ status: statusFromReviewItems(reviewItems),
811
+ source: {
812
+ sourceUrl: corpus.source.sourceUrl,
813
+ checkedCommit: corpus.source.checkedCommit,
814
+ checkedRef: corpus.source.checkedRef,
815
+ sourceAuthenticity: 'source_snapshot_recorded',
816
+ providerTrust: 'unverified',
817
+ importedContentTrust: 'untrusted',
818
+ },
819
+ publication: {
820
+ disabled: true,
821
+ requiresOperatorApproval: true,
822
+ readinessGateRefs: ['#373', '#377'],
823
+ },
824
+ payment: {
825
+ status: 'missing_payment_setup',
826
+ activation: 'disabled',
827
+ operatorAction: 'request_payment_setup',
828
+ },
829
+ groups: capabilityInventory.entries.map((entry) => ({
830
+ groupId: `operator-review-group:${entry.capabilityId}`,
831
+ name: entry.capabilityName,
832
+ sourceKind: entry.sourceKind,
833
+ sourcePath: entry.sourcePath,
834
+ runtimeSurface: entry.runtimeSurface,
835
+ capabilityRefs: [entry.capabilityId, ...entry.commands, ...entry.skills],
836
+ writeCapable: entry.writeCapable,
837
+ humanReviewRequired: (entry.humanReviewHints.length > 0
838
+ || entry.writeCapable
839
+ || entry.sideEffectRisk === 'write'
840
+ || entry.sideEffectRisk === 'execute'),
841
+ rawSnapshotRefs,
842
+ })),
843
+ reviewItems,
844
+ buyerPreview: {
845
+ capabilityRelevance: 'static_capability_inventory_only',
846
+ sourceAuthenticity: 'snapshot_recorded_not_provider_trust',
847
+ trustEvidence: 'unverified_until_operator_review',
848
+ paymentReadiness: 'missing_payment_setup',
849
+ safetyRisk: 'operator_review_required',
850
+ reputation: 'none_for_imported_fixture',
851
+ },
852
+ rawSnapshotRefs: draftPayloads.profile.rawSnapshotRefs,
853
+ };
854
+ }
855
+ export function createStaticAgentStackIngestionResult(input, options = {}) {
856
+ const corpus = createAgentStackFixtureCorpus(input, options);
857
+ const warningByPath = new Map(corpus.validationWarnings.map((warning) => [warning.path, warning]));
858
+ const connectorFilesByPath = new Map(corpus.files
859
+ .filter((file) => file.kind === 'mcp-connector-config')
860
+ .map((file) => [file.path, file]));
861
+ const connectorDiagnostics = corpus.files
862
+ .filter((file) => file.kind === 'mcp-connector-config')
863
+ .map((file) => {
864
+ const warning = warningByPath.get(file.path);
865
+ return {
866
+ path: file.path,
867
+ sourceKind: 'mcp-connector-config',
868
+ diagnosticLane: 'mcp_connector_metadata',
869
+ parseStatus: file.parseStatus,
870
+ ...(file.parseStatus === 'malformed' && file.parseErrorLocation ? { parseErrorLocation: file.parseErrorLocation } : {}),
871
+ severity: warning?.severity ?? (file.parseStatus === 'valid' ? 'info' : 'warning'),
872
+ warningCodes: file.warningCodes ?? [],
873
+ blocksDraftPayload: connectorBlocksDraftPayload(file),
874
+ operatorReviewRequired: connectorRequiresOperatorReview(file, warning),
875
+ message: connectorMessage(file, warning),
876
+ };
877
+ })
878
+ .concat(corpus.surfaces
879
+ .filter((surface) => surface.kind === 'mcp-connector-config' && !connectorFilesByPath.has(surface.path))
880
+ .map((surface) => ({
881
+ path: surface.path,
882
+ sourceKind: 'mcp-connector-config',
883
+ diagnosticLane: 'mcp_connector_metadata',
884
+ parseStatus: 'missing',
885
+ severity: 'blocked',
886
+ warningCodes: ['missing_mcp_connector_config'],
887
+ blocksDraftPayload: true,
888
+ operatorReviewRequired: true,
889
+ message: 'MCP connector surface has no matching static connector metadata file.',
890
+ })));
891
+ const riskDiagnostics = createRiskDiagnostics(corpus);
892
+ const rejectedEntries = corpus.validationWarnings
893
+ .filter((warning) => warning.severity === 'blocked')
894
+ .map((warning) => ({
895
+ path: warning.path,
896
+ reasonCode: warning.code,
897
+ message: warning.message,
898
+ }));
899
+ const inventory = corpus.surfaces
900
+ .filter((surface) => surface.kind !== 'validation-warning')
901
+ .map((surface) => ({
902
+ id: surface.id,
903
+ name: surface.name,
904
+ kind: surface.kind,
905
+ sourcePath: surface.path,
906
+ runtimeSurface: surface.runtimeSurface,
907
+ category: surface.category,
908
+ commands: surface.commands ?? [],
909
+ skills: surface.skills ?? [],
910
+ toolGrants: surface.toolGrants ?? [],
911
+ authDependencies: surface.authDependencies ?? [],
912
+ dataDependencies: surface.dataDependencies ?? [],
913
+ safetyHints: surface.safetyHints ?? [],
914
+ humanReviewHints: surface.humanReviewHints ?? [],
915
+ writeCapable: surface.writeCapable ?? false,
916
+ contentTrustBoundary: surface.contentTrustBoundary,
917
+ }));
918
+ const capabilityInventory = createCapabilityInventoryBundle(corpus, inventory, rejectedEntries);
919
+ const draftPayloadReadiness = readinessFromCorpus(corpus, connectorDiagnostics, riskDiagnostics, rejectedEntries);
920
+ const draftPayloads = createDraftPayloads(corpus, capabilityInventory, connectorDiagnostics, riskDiagnostics, rejectedEntries, corpus.validationWarnings, draftPayloadReadiness);
921
+ const operatorReviewPayload = createOperatorReviewPayload(corpus, capabilityInventory, connectorDiagnostics, riskDiagnostics, rejectedEntries, corpus.validationWarnings, draftPayloads);
922
+ const status = rejectedEntries.length > 0
923
+ ? 'blocked'
924
+ : draftPayloadReadiness.status !== 'ready'
925
+ ? 'partial_success'
926
+ : 'ready_for_draft';
927
+ return {
928
+ schemaVersion: STATIC_AGENT_STACK_INGESTION_RESULT_SCHEMA_VERSION,
929
+ corpusId: corpus.id,
930
+ title: corpus.title,
931
+ source: corpus.source,
932
+ status,
933
+ inventory,
934
+ capabilityInventory,
935
+ connectorDiagnostics,
936
+ riskDiagnostics,
937
+ rejectedEntries,
938
+ warnings: corpus.validationWarnings,
939
+ draftPayloadReadiness,
940
+ draftPayloads,
941
+ operatorReviewPayload,
942
+ staticOnly: true,
943
+ nonGoals: corpus.nonGoals,
944
+ };
945
+ }
946
+ export const agentStackFixtureCorpora = {
947
+ anthropicFinancialServices: {
948
+ schemaVersion: AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION,
949
+ id: 'agent-stack-fixture:anthropic-financial-services:2026-06-18',
950
+ title: 'Anthropic financial-services agent stack public fixture',
951
+ source: {
952
+ sourceUrl: 'https://github.com/anthropics/financial-services',
953
+ checkedCommit: '4bbabc7cd1a474c1667fa05a2bfe58e411dcf9c1',
954
+ checkedRef: 'main',
955
+ license: 'Apache-2.0',
956
+ sourceNotes: [
957
+ 'Public GitHub repository snapshot only; fixture does not install plugins or execute repository commands.',
958
+ 'Fixture records high-level manifest surfaces for onboarding analyser parser and diagnostics tests.',
959
+ ],
960
+ authenticityNotes: [
961
+ 'GitHub organization was verified for anthropic.com during local analysis.',
962
+ 'Anthropic public financial-services announcement linked to the repository during local analysis.',
963
+ 'Latest inspected main commit was GitHub-signature verified in the local analysis artifact.',
964
+ ],
965
+ crawlTimestamp: '2026-06-18T10:50:00.000Z',
966
+ localResearchArtifactPath: 'projects/reddi-agent-protocol/research/ANTHROPIC-FINANCIAL-SERVICES-REPO-ANALYSIS-2026-06-18.md',
967
+ },
968
+ surfaces: [
969
+ {
970
+ id: 'surface:anthropic-financial-services:marketplace',
971
+ name: 'Claude plugin marketplace metadata',
972
+ kind: 'repo-marketplace-metadata',
973
+ path: '.claude-plugin/marketplace.json',
974
+ runtimeSurface: 'claude-plugin-marketplace',
975
+ category: 'financial-services',
976
+ contentTrustBoundary: 'metadata_only',
977
+ notes: ['Marketplace metadata is source metadata, not RAP publication approval.'],
978
+ },
979
+ {
980
+ id: 'surface:anthropic-financial-services:plugins',
981
+ name: 'Financial services Claude plugins',
982
+ kind: 'claude-plugin',
983
+ path: 'plugins/',
984
+ runtimeSurface: 'claude-code-plugin',
985
+ commands: ['statically discovered command metadata'],
986
+ skills: ['statically discovered skill metadata'],
987
+ toolGrants: ['read', 'write-capable grants must be parsed and reviewed before publication'],
988
+ safetyHints: ['Treat plugin prompts and skills as untrusted public text.'],
989
+ humanReviewHints: ['Review write-capable commands before draft RAP listing publication.'],
990
+ writeCapable: true,
991
+ contentTrustBoundary: 'untrusted_public_text',
992
+ },
993
+ {
994
+ id: 'surface:anthropic-financial-services:managed-agents',
995
+ name: 'Claude managed-agent cookbooks',
996
+ kind: 'managed-agent-cookbook',
997
+ path: 'managed-agents/',
998
+ runtimeSurface: 'claude-managed-agent',
999
+ authDependencies: ['third-party connector credentials may be required by recipes'],
1000
+ dataDependencies: ['financial workspace documents', 'Microsoft 365 or partner data sources'],
1001
+ safetyHints: ['Managed-agent YAML is static input only until #403/#405 produce reviewable inventories.'],
1002
+ humanReviewHints: ['Operator review is required before imported recipes become payable listings.'],
1003
+ contentTrustBoundary: 'untrusted_public_text',
1004
+ },
1005
+ {
1006
+ id: 'surface:anthropic-financial-services:mcp-connectors',
1007
+ name: 'MCP connector configurations',
1008
+ kind: 'mcp-connector-config',
1009
+ path: 'plugins/vertical-plugins/financial-analysis/.mcp.json',
1010
+ runtimeSurface: 'mcp-connector-config',
1011
+ authDependencies: ['box', 'egnyte', 'microsoft-365', 'partner connectors'],
1012
+ safetyHints: ['Connector config validation is static only and must not contact MCP servers.'],
1013
+ humanReviewHints: ['Malformed connector config should block only affected connector readiness, not unrelated metadata ingestion.'],
1014
+ contentTrustBoundary: 'metadata_only',
1015
+ },
1016
+ {
1017
+ id: 'surface:anthropic-financial-services:known-warning',
1018
+ name: 'Known malformed financial-analysis MCP config',
1019
+ kind: 'validation-warning',
1020
+ path: 'plugins/vertical-plugins/financial-analysis/.mcp.json',
1021
+ safetyHints: ['Known invalid JSON is preserved as a regression fixture for #404.'],
1022
+ contentTrustBoundary: 'metadata_only',
1023
+ },
1024
+ ],
1025
+ files: [
1026
+ {
1027
+ path: '.claude-plugin/marketplace.json',
1028
+ kind: 'repo-marketplace-metadata',
1029
+ present: true,
1030
+ parseStatus: 'not_parsed',
1031
+ mediaType: 'application/json',
1032
+ summary: 'Repository-level marketplace metadata for Claude plugin distribution.',
1033
+ },
1034
+ {
1035
+ path: 'plugins/**/plugin.json',
1036
+ kind: 'claude-plugin',
1037
+ present: true,
1038
+ parseStatus: 'not_parsed',
1039
+ mediaType: 'application/json',
1040
+ summary: 'Plugin manifests for horizontal, vertical, and partner packages.',
1041
+ },
1042
+ {
1043
+ path: 'managed-agents/**/agent.yaml',
1044
+ kind: 'managed-agent-cookbook',
1045
+ present: true,
1046
+ parseStatus: 'not_parsed',
1047
+ mediaType: 'application/yaml',
1048
+ summary: 'Managed-agent cookbook metadata; parser support belongs to #403.',
1049
+ },
1050
+ {
1051
+ path: 'plugins/vertical-plugins/financial-analysis/.mcp.json',
1052
+ kind: 'mcp-connector-config',
1053
+ present: true,
1054
+ parseStatus: 'malformed',
1055
+ parseErrorLocation: 'line 1 column 1',
1056
+ mediaType: 'application/json',
1057
+ warningCodes: ['malformed_mcp_json'],
1058
+ summary: 'Known malformed connector manifest from local analysis; full diagnostics belong to #404.',
1059
+ },
1060
+ ],
1061
+ validationWarnings: [
1062
+ {
1063
+ code: 'malformed_mcp_json',
1064
+ severity: 'warning',
1065
+ path: 'plugins/vertical-plugins/financial-analysis/.mcp.json',
1066
+ message: 'Known malformed JSON should fail closed for connector diagnostics while preserving partial static ingestion.',
1067
+ },
1068
+ {
1069
+ code: 'untrusted_prompt_text',
1070
+ severity: 'info',
1071
+ path: 'plugins/',
1072
+ message: 'Public prompt, skill, and command text is untrusted fixture content and cannot alter analyser behavior.',
1073
+ },
1074
+ ],
1075
+ staticOnly: true,
1076
+ nonGoals: [
1077
+ 'Do not install Claude plugins.',
1078
+ 'Do not execute repository scripts, commands, managed agents, or MCP servers.',
1079
+ 'Do not fetch paid/provider data or require credentials.',
1080
+ 'Do not publish imported surfaces as payable RAP listings without operator review.',
1081
+ ],
1082
+ },
1083
+ solanaAiKit: {
1084
+ schemaVersion: AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION,
1085
+ id: 'agent-stack-fixture:solanabr-solana-ai-kit:2026-06-19',
1086
+ title: 'Solana AI Kit public agent-stack fixture',
1087
+ source: {
1088
+ sourceUrl: 'https://github.com/solanabr/solana-ai-kit',
1089
+ checkedCommit: '4fb9d3d619467e068c1cf3120d3933aa933aeb21',
1090
+ checkedRef: 'main',
1091
+ license: 'MIT',
1092
+ sourceNotes: [
1093
+ 'Public GitHub repository snapshot only; fixture does not install the kit, plugins, submodules, hooks, or MCP servers.',
1094
+ 'Fixture records high-level Solana agent-stack surfaces for onboarding analyser parser, connector diagnostics, and operator-review tests.',
1095
+ ],
1096
+ authenticityNotes: [
1097
+ 'GitHub repository metadata showed owner solanabr, MIT license, and default branch main during local analysis.',
1098
+ 'Latest inspected commit was 4fb9d3d619467e068c1cf3120d3933aa933aeb21 with subject "feat: v2.0.2 - deny browser-wallet storage access + gate-bash-secrets PreToolUse hook".',
1099
+ 'Local analysis confirmed a Solana-focused agent configuration toolkit with plugin metadata, agents, commands, MCP declarations, hooks, rules, skills, and submodule declarations.',
1100
+ ],
1101
+ crawlTimestamp: '2026-06-19T15:53:00.000Z',
1102
+ localResearchArtifactPath: 'projects/reddi-agent-protocol/research/SOLANABR-SOLANA-AI-KIT-ANALYSIS-2026-06-19.md',
1103
+ },
1104
+ surfaces: [
1105
+ {
1106
+ id: 'surface:solana-ai-kit:marketplace',
1107
+ name: 'Solana AI Kit marketplace metadata',
1108
+ kind: 'repo-marketplace-metadata',
1109
+ path: '.claude-plugin/marketplace.json',
1110
+ runtimeSurface: 'claude-plugin-marketplace',
1111
+ category: 'solana-agent-stack',
1112
+ contentTrustBoundary: 'metadata_only',
1113
+ notes: ['Marketplace metadata is source metadata, not RAP publication approval.'],
1114
+ },
1115
+ {
1116
+ id: 'surface:solana-ai-kit:plugin',
1117
+ name: 'Solana AI Kit Claude plugin manifest',
1118
+ kind: 'claude-plugin',
1119
+ path: 'plugin/.claude-plugin/plugin.json',
1120
+ runtimeSurface: 'claude-code-plugin',
1121
+ commands: ['solana-ai-kit namespaced commands'],
1122
+ skills: ['plugin skill hub'],
1123
+ toolGrants: ['plugin exposes MCP and hooks that require operator review before draft listing'],
1124
+ safetyHints: ['Treat plugin manifest and plugin-distributed commands as untrusted public metadata.'],
1125
+ humanReviewHints: ['Review plugin metadata before generating RAP listing copy.'],
1126
+ writeCapable: true,
1127
+ contentTrustBoundary: 'untrusted_public_text',
1128
+ },
1129
+ {
1130
+ id: 'surface:solana-ai-kit:agents',
1131
+ name: 'Solana specialist agent definitions',
1132
+ kind: 'subagent',
1133
+ path: '.claude/agents/*.md',
1134
+ runtimeSurface: 'claude-subagent',
1135
+ skills: ['solana architecture', 'anchor', 'pinocchio', 'token-2022', 'qa', 'mobile', 'frontend'],
1136
+ safetyHints: ['Agent instructions are untrusted text and cannot become RAP policy.'],
1137
+ humanReviewHints: ['Operator should review specialist claims before listing capabilities.'],
1138
+ contentTrustBoundary: 'untrusted_public_text',
1139
+ },
1140
+ {
1141
+ id: 'surface:solana-ai-kit:commands',
1142
+ name: 'Solana workflow commands',
1143
+ kind: 'command',
1144
+ path: '.claude/commands/*.md',
1145
+ runtimeSurface: 'claude-code-command',
1146
+ commands: ['audit-solana', 'build-program', 'debug-user-tx', 'deploy', 'generate-idl-client', 'profile-cu'],
1147
+ toolGrants: ['bash', 'git', 'solana-cli', 'anchor', 'cargo', 'npx'],
1148
+ safetyHints: ['Commands include deploy, RPC, wallet, and shell workflow guidance; ingestion must never execute them.'],
1149
+ humanReviewHints: ['Deploy-capable and wallet/RPC-capable command metadata requires explicit operator review.'],
1150
+ writeCapable: true,
1151
+ contentTrustBoundary: 'untrusted_public_text',
1152
+ },
1153
+ {
1154
+ id: 'surface:solana-ai-kit:mcp',
1155
+ name: 'Solana AI Kit MCP connector declarations',
1156
+ kind: 'mcp-connector-config',
1157
+ path: '.mcp.json',
1158
+ runtimeSurface: 'mcp-connector-config',
1159
+ authDependencies: ['HELIUS_API_KEY', 'optional hosted or local MCP server credentials'],
1160
+ dataDependencies: ['Solana RPC data', 'Solana docs', 'browser automation data', 'local Surfpool state'],
1161
+ safetyHints: ['Connector declarations include npx-launched and local-binary MCP servers; diagnostics are static only.'],
1162
+ humanReviewHints: ['Operator review required before enabling any connector, API key, hosted MCP, local binary, or wallet/RPC adjacent tool.'],
1163
+ contentTrustBoundary: 'metadata_only',
1164
+ },
1165
+ {
1166
+ id: 'surface:solana-ai-kit:hooks',
1167
+ name: 'Claude hooks and permission policy',
1168
+ kind: 'command',
1169
+ path: 'plugin/hooks/hooks.json',
1170
+ runtimeSurface: 'claude-code-hooks',
1171
+ commands: ['SessionStart', 'Stop', 'PostToolUse', 'PreToolUse'],
1172
+ toolGrants: ['bash', 'pre-commit hooks', 'pre-deploy hooks'],
1173
+ safetyHints: ['Hooks are executable shell metadata and must be review-gated before any draft publication.'],
1174
+ humanReviewHints: ['Review hook behavior, private-path deny rules, formatting hooks, commit hooks, and deploy hooks.'],
1175
+ writeCapable: true,
1176
+ contentTrustBoundary: 'untrusted_public_text',
1177
+ },
1178
+ {
1179
+ id: 'surface:solana-ai-kit:rules-skills',
1180
+ name: 'Solana rules and skill hub',
1181
+ kind: 'skill',
1182
+ path: '.claude/skills/*.md',
1183
+ runtimeSurface: 'claude-skill',
1184
+ skills: ['Anchor rules', 'Pinocchio rules', 'Rust rules', 'TypeScript rules', 'Token-2022 guide'],
1185
+ safetyHints: ['Rules and skill markdown are untrusted checklist/reference text.'],
1186
+ humanReviewHints: ['Use as acceptance-criteria inspiration only; do not copy claims into listing without review.'],
1187
+ contentTrustBoundary: 'untrusted_public_text',
1188
+ },
1189
+ {
1190
+ id: 'surface:solana-ai-kit:external-submodules',
1191
+ name: 'External skill submodule declarations',
1192
+ kind: 'skill',
1193
+ path: '.gitmodules',
1194
+ runtimeSurface: 'git-submodule-declarations',
1195
+ dataDependencies: ['18 external skill repositories declared but not initialized in the static fixture'],
1196
+ safetyHints: ['Submodule declarations are inventory only; ingestion must not clone or update them.'],
1197
+ humanReviewHints: ['Review external source, license, and install risk before any derived listing.'],
1198
+ contentTrustBoundary: 'metadata_only',
1199
+ },
1200
+ {
1201
+ id: 'surface:solana-ai-kit:operator-review-warning',
1202
+ name: 'Solana AI Kit operator-review blockers',
1203
+ kind: 'validation-warning',
1204
+ path: 'plugin/hooks/hooks.json',
1205
+ safetyHints: ['Executable hooks and deploy-capable commands are preserved as review blockers.'],
1206
+ contentTrustBoundary: 'metadata_only',
1207
+ },
1208
+ ],
1209
+ files: [
1210
+ {
1211
+ path: '.claude-plugin/marketplace.json',
1212
+ kind: 'repo-marketplace-metadata',
1213
+ present: true,
1214
+ parseStatus: 'not_parsed',
1215
+ mediaType: 'application/json',
1216
+ summary: 'Repository-level marketplace metadata for the Solana AI Kit plugin.',
1217
+ },
1218
+ {
1219
+ path: 'plugin/.claude-plugin/plugin.json',
1220
+ kind: 'claude-plugin',
1221
+ present: true,
1222
+ parseStatus: 'not_parsed',
1223
+ mediaType: 'application/json',
1224
+ summary: 'Plugin manifest declaring package metadata, MCP server config, hooks, license, and keywords.',
1225
+ },
1226
+ {
1227
+ path: '.claude/agents/*.md',
1228
+ kind: 'subagent',
1229
+ present: true,
1230
+ parseStatus: 'not_parsed',
1231
+ mediaType: 'text/markdown',
1232
+ summary: 'Fifteen Solana-focused agent definitions represented as untrusted static metadata.',
1233
+ },
1234
+ {
1235
+ path: '.claude/commands/*.md',
1236
+ kind: 'command',
1237
+ present: true,
1238
+ parseStatus: 'not_parsed',
1239
+ mediaType: 'text/markdown',
1240
+ warningCodes: ['deploy_capable_commands', 'wallet_rpc_adjacent_commands'],
1241
+ summary: 'Twenty-nine workflow command definitions including deploy, debug-user-tx, audit, and IDL/client generation.',
1242
+ },
1243
+ {
1244
+ path: '.mcp.json',
1245
+ kind: 'mcp-connector-config',
1246
+ present: true,
1247
+ parseStatus: 'valid',
1248
+ mediaType: 'application/json',
1249
+ warningCodes: ['npx_mcp_execution', 'env_required_connector', 'local_binary_required'],
1250
+ summary: 'Seven MCP server declarations: Helius, solana-dev, Context7, Playwright, context-mode, memsearch, and Surfpool.',
1251
+ },
1252
+ {
1253
+ path: 'plugin/hooks/hooks.json',
1254
+ kind: 'command',
1255
+ present: true,
1256
+ parseStatus: 'not_parsed',
1257
+ mediaType: 'application/json',
1258
+ warningCodes: ['executable_hooks', 'mainnet_deploy_guard_required'],
1259
+ summary: 'Claude Code hook metadata with shell commands for session, formatting, commit, and deploy gates.',
1260
+ },
1261
+ {
1262
+ path: '.claude/settings.json',
1263
+ kind: 'command',
1264
+ present: true,
1265
+ parseStatus: 'not_parsed',
1266
+ mediaType: 'application/json',
1267
+ warningCodes: ['permission_policy', 'private_path_denylist'],
1268
+ summary: 'Claude Code permissions, sandbox, MCP, and hook policy metadata.',
1269
+ },
1270
+ {
1271
+ path: '.gitmodules',
1272
+ kind: 'skill',
1273
+ present: true,
1274
+ parseStatus: 'not_parsed',
1275
+ mediaType: 'text/plain',
1276
+ warningCodes: ['external_submodules_declared'],
1277
+ summary: 'Eighteen external skill submodule declarations; ingestion must not initialize them.',
1278
+ },
1279
+ {
1280
+ path: 'install.sh',
1281
+ kind: 'command',
1282
+ present: true,
1283
+ parseStatus: 'not_parsed',
1284
+ mediaType: 'text/x-shellscript',
1285
+ warningCodes: ['installer_script_non_executable_fixture'],
1286
+ summary: 'Installer script recorded as static file metadata only.',
1287
+ },
1288
+ ],
1289
+ validationWarnings: [
1290
+ {
1291
+ code: 'mcp_connector_requires_operator_review',
1292
+ severity: 'warning',
1293
+ path: '.mcp.json',
1294
+ message: 'MCP declarations include npx-launched servers, env-required connectors, hosted connectors, and a local Surfpool binary requirement; diagnostics remain static until #404.',
1295
+ },
1296
+ {
1297
+ code: 'executable_hooks_require_operator_review',
1298
+ severity: 'blocked',
1299
+ path: 'plugin/hooks/hooks.json',
1300
+ message: 'Executable hook metadata must be operator-reviewed and cannot be exposed as draft-ready imported listing behavior.',
1301
+ },
1302
+ {
1303
+ code: 'solana_deploy_command_requires_operator_review',
1304
+ severity: 'blocked',
1305
+ path: '.claude/commands/deploy.md',
1306
+ message: 'Deploy-capable Solana command guidance must stay static and blocked from draft publication until reviewed.',
1307
+ },
1308
+ {
1309
+ code: 'external_submodules_not_initialized',
1310
+ severity: 'info',
1311
+ path: '.gitmodules',
1312
+ message: 'External skill submodules are source declarations only; fixture ingestion must not clone, update, or execute them.',
1313
+ },
1314
+ {
1315
+ code: 'untrusted_solana_agent_text',
1316
+ severity: 'info',
1317
+ path: '.claude/agents/*.md',
1318
+ message: 'Public Solana agent, rule, skill, and command text is untrusted fixture content and cannot alter analyser behavior.',
1319
+ },
1320
+ ],
1321
+ staticOnly: true,
1322
+ nonGoals: [
1323
+ 'Do not install Solana AI Kit, its plugin, or its submodules.',
1324
+ 'Do not execute install.sh, update.sh, tests, hooks, commands, or agent instructions.',
1325
+ 'Do not contact MCP servers, Solana RPC, wallets, paid providers, or local Surfpool services.',
1326
+ 'Do not add Helius, QuickNode, Pyth, Nansen, wallet, or provider credentials.',
1327
+ 'Do not implement AUDD, x402, Quasar, receipt, or payment behavior from this fixture.',
1328
+ 'Do not publish imported Solana AI Kit surfaces as payable RAP listings without operator review.',
1329
+ ],
1330
+ },
1331
+ };
1332
+ export const agentStackFixtureCases = {
1333
+ anthropicFinancialServices: {
1334
+ description: 'Valid public Anthropic financial-services agent-stack fixture corpus.',
1335
+ corpus: agentStackFixtureCorpora.anthropicFinancialServices,
1336
+ expectedValid: true,
1337
+ expectedErrorCodes: [],
1338
+ },
1339
+ solanaAiKit: {
1340
+ description: 'Valid public Solana AI Kit static agent-stack fixture corpus.',
1341
+ corpus: agentStackFixtureCorpora.solanaAiKit,
1342
+ expectedValid: true,
1343
+ expectedErrorCodes: [],
1344
+ },
1345
+ malformedCorpus: {
1346
+ description: 'Missing source, files, and surfaces fails closed.',
1347
+ corpus: {
1348
+ schemaVersion: AGENT_STACK_FIXTURE_CORPUS_SCHEMA_VERSION,
1349
+ id: 'agent-stack-fixture:malformed',
1350
+ title: 'Malformed fixture',
1351
+ staticOnly: true,
1352
+ nonGoals: ['no execution'],
1353
+ },
1354
+ expectedValid: false,
1355
+ expectedErrorCodes: ['malformed_fixture_corpus'],
1356
+ },
1357
+ invalidCommit: {
1358
+ description: 'Fixture source must include an exact checked commit SHA.',
1359
+ corpus: {
1360
+ ...agentStackFixtureCorpora.anthropicFinancialServices,
1361
+ source: {
1362
+ ...agentStackFixtureCorpora.anthropicFinancialServices.source,
1363
+ checkedCommit: 'main',
1364
+ },
1365
+ },
1366
+ expectedValid: false,
1367
+ expectedErrorCodes: ['invalid_commit_ref'],
1368
+ },
1369
+ unsafeSourceUrl: {
1370
+ description: 'Fixture source URL must be HTTPS without embedded credentials.',
1371
+ corpus: {
1372
+ ...agentStackFixtureCorpora.anthropicFinancialServices,
1373
+ source: {
1374
+ ...agentStackFixtureCorpora.anthropicFinancialServices.source,
1375
+ sourceUrl: 'http://github.com/anthropics/financial-services',
1376
+ },
1377
+ },
1378
+ expectedValid: false,
1379
+ expectedErrorCodes: ['unsafe_url'],
1380
+ },
1381
+ credentialLeakage: {
1382
+ description: 'Credential-shaped metadata is rejected before fixture persistence.',
1383
+ corpus: {
1384
+ ...agentStackFixtureCorpora.anthropicFinancialServices,
1385
+ surfaces: [
1386
+ ...agentStackFixtureCorpora.anthropicFinancialServices.surfaces,
1387
+ {
1388
+ id: 'surface:leaky',
1389
+ name: 'Leaky Connector',
1390
+ kind: 'mcp-connector-config',
1391
+ path: 'plugins/leaky/.mcp.json',
1392
+ contentTrustBoundary: 'metadata_only',
1393
+ notes: ['authorization: bearer should-not-be-stored'],
1394
+ },
1395
+ ],
1396
+ },
1397
+ expectedValid: false,
1398
+ expectedErrorCodes: ['credential_leakage_rejected'],
1399
+ },
1400
+ };
1401
+ const operatorReviewFixtureGuardrails = [
1402
+ 'Static fixture only: do not execute imported hooks, commands, skills, installers, tests, or agent instructions.',
1403
+ 'Do not fetch repositories, submodules, MCP servers, RPC endpoints, wallets, paid providers, or payment rails.',
1404
+ 'Do not store secrets, private operational metadata, credential-shaped values, wallet keys, or provider tokens.',
1405
+ 'Do not activate live payment, publication, provider trust, reputation, registry listing, or endpoint binding from this fixture.',
1406
+ ];
1407
+ const operatorReviewViewportCoverage = (requiredStates, requiredGroupKinds) => [
1408
+ {
1409
+ name: 'mobile',
1410
+ width: 390,
1411
+ height: 844,
1412
+ requiredStates,
1413
+ requiredGroupKinds,
1414
+ },
1415
+ {
1416
+ name: 'tablet',
1417
+ width: 834,
1418
+ height: 1112,
1419
+ requiredStates,
1420
+ requiredGroupKinds,
1421
+ },
1422
+ {
1423
+ name: 'desktop',
1424
+ width: 1440,
1425
+ height: 900,
1426
+ requiredStates,
1427
+ requiredGroupKinds,
1428
+ },
1429
+ ];
1430
+ const createReadyAnthropicOperatorReviewPayload = () => (createStaticAgentStackIngestionResult({
1431
+ ...agentStackFixtureCorpora.anthropicFinancialServices,
1432
+ files: agentStackFixtureCorpora.anthropicFinancialServices.files.map((file) => file.kind === 'mcp-connector-config'
1433
+ ? {
1434
+ ...file,
1435
+ parseStatus: 'valid',
1436
+ parseErrorLocation: undefined,
1437
+ warningCodes: [],
1438
+ }
1439
+ : file),
1440
+ validationWarnings: [],
1441
+ }).operatorReviewPayload);
1442
+ const createSuspendedAnthropicOperatorReviewPayload = () => (createStaticAgentStackIngestionResult({
1443
+ ...agentStackFixtureCorpora.anthropicFinancialServices,
1444
+ validationWarnings: [
1445
+ ...agentStackFixtureCorpora.anthropicFinancialServices.validationWarnings,
1446
+ {
1447
+ code: 'unsafe_metadata',
1448
+ severity: 'blocked',
1449
+ path: 'plugins/partner-plugins/example/plugin.json',
1450
+ message: 'Unsafe imported metadata must stay suspended until operator review replaces or removes it.',
1451
+ },
1452
+ ],
1453
+ }).operatorReviewPayload);
1454
+ const approveReadyDraftPayload = createReadyAnthropicOperatorReviewPayload();
1455
+ const rejectedDraftPayload = createStaticAgentStackIngestionResult(agentStackFixtureCorpora.anthropicFinancialServices).operatorReviewPayload;
1456
+ const suspendedDraftPayload = createSuspendedAnthropicOperatorReviewPayload();
1457
+ const solanaBlockedPayload = createStaticAgentStackIngestionResult(agentStackFixtureCorpora.solanaAiKit).operatorReviewPayload;
1458
+ export const agentStackOperatorReviewFixtureStates = {
1459
+ approveReadyDraft: {
1460
+ fixtureId: 'agent-stack-operator-review-fixture:approve-ready-draft',
1461
+ description: 'Approve-ready draft review frame for imported repo and plugin groups; publication and payment stay disabled.',
1462
+ fixtureState: 'approve_ready_draft',
1463
+ queueState: approveReadyDraftPayload.status,
1464
+ uiTestRefs: [
1465
+ 'storybook:agent-stack/operator-review/approve-ready-draft',
1466
+ 'playwright:agent-stack-operator-review-approve-ready-draft',
1467
+ ],
1468
+ operatorReviewPayload: approveReadyDraftPayload,
1469
+ requiredReviewItemStates: ['approve_ready_draft'],
1470
+ requiredGroupKinds: ['repo-marketplace-metadata', 'claude-plugin'],
1471
+ requiredRiskCategories: [],
1472
+ viewportCoverage: operatorReviewViewportCoverage(['approve_ready_draft'], ['repo-marketplace-metadata', 'claude-plugin']),
1473
+ staticOnly: true,
1474
+ guardrails: operatorReviewFixtureGuardrails,
1475
+ },
1476
+ requestChangesMissingPayment: {
1477
+ fixtureId: 'agent-stack-operator-review-fixture:request-changes-missing-payment',
1478
+ description: 'Request-changes draft review frame for missing payment and endpoint setup.',
1479
+ fixtureState: 'request_changes_draft',
1480
+ queueState: approveReadyDraftPayload.status,
1481
+ uiTestRefs: [
1482
+ 'storybook:agent-stack/operator-review/request-changes-missing-payment',
1483
+ 'playwright:agent-stack-operator-review-request-changes-missing-payment',
1484
+ ],
1485
+ operatorReviewPayload: approveReadyDraftPayload,
1486
+ requiredReviewItemStates: ['request_changes_missing_payment'],
1487
+ requiredGroupKinds: ['repo-marketplace-metadata', 'claude-plugin'],
1488
+ requiredRiskCategories: [],
1489
+ viewportCoverage: operatorReviewViewportCoverage(['request_changes_missing_payment'], ['repo-marketplace-metadata', 'claude-plugin']),
1490
+ staticOnly: true,
1491
+ guardrails: operatorReviewFixtureGuardrails,
1492
+ },
1493
+ rejectedMalformedConnector: {
1494
+ fixtureId: 'agent-stack-operator-review-fixture:rejected-malformed-connector',
1495
+ description: 'Rejected draft review frame for malformed connector and unsafe metadata warnings.',
1496
+ fixtureState: 'rejected_draft',
1497
+ queueState: rejectedDraftPayload.status,
1498
+ uiTestRefs: [
1499
+ 'storybook:agent-stack/operator-review/rejected-malformed-connector',
1500
+ 'playwright:agent-stack-operator-review-rejected-malformed-connector',
1501
+ ],
1502
+ operatorReviewPayload: rejectedDraftPayload,
1503
+ requiredReviewItemStates: [
1504
+ 'rejected_malformed_connector',
1505
+ 'unsafe_metadata_warning',
1506
+ 'request_changes_missing_payment',
1507
+ ],
1508
+ requiredGroupKinds: ['repo-marketplace-metadata', 'claude-plugin', 'mcp-connector-config'],
1509
+ requiredRiskCategories: [],
1510
+ viewportCoverage: operatorReviewViewportCoverage(['rejected_malformed_connector', 'unsafe_metadata_warning', 'request_changes_missing_payment'], ['repo-marketplace-metadata', 'claude-plugin', 'mcp-connector-config']),
1511
+ staticOnly: true,
1512
+ guardrails: operatorReviewFixtureGuardrails,
1513
+ },
1514
+ suspendedUnsafeMetadata: {
1515
+ fixtureId: 'agent-stack-operator-review-fixture:suspended-unsafe-metadata',
1516
+ description: 'Suspended draft review frame for blocked unsafe imported metadata.',
1517
+ fixtureState: 'suspended_draft',
1518
+ queueState: suspendedDraftPayload.status,
1519
+ uiTestRefs: [
1520
+ 'storybook:agent-stack/operator-review/suspended-unsafe-metadata',
1521
+ 'playwright:agent-stack-operator-review-suspended-unsafe-metadata',
1522
+ ],
1523
+ operatorReviewPayload: suspendedDraftPayload,
1524
+ requiredReviewItemStates: ['suspended_imported_listing', 'unsafe_metadata_warning'],
1525
+ requiredGroupKinds: ['repo-marketplace-metadata', 'claude-plugin', 'mcp-connector-config'],
1526
+ requiredRiskCategories: [],
1527
+ viewportCoverage: operatorReviewViewportCoverage(['suspended_imported_listing', 'unsafe_metadata_warning'], ['repo-marketplace-metadata', 'claude-plugin', 'mcp-connector-config']),
1528
+ staticOnly: true,
1529
+ guardrails: operatorReviewFixtureGuardrails,
1530
+ },
1531
+ solanaAiKitBlocked: {
1532
+ fixtureId: 'agent-stack-operator-review-fixture:solana-ai-kit-blocked',
1533
+ description: 'Solana AI Kit blocked review frame for hooks, deploy commands, env-required MCPs, local binaries, and submodules.',
1534
+ fixtureState: 'suspended_draft',
1535
+ queueState: solanaBlockedPayload.status,
1536
+ uiTestRefs: [
1537
+ 'storybook:agent-stack/operator-review/solana-ai-kit-blocked',
1538
+ 'playwright:agent-stack-operator-review-solana-ai-kit-blocked',
1539
+ ],
1540
+ operatorReviewPayload: solanaBlockedPayload,
1541
+ requiredReviewItemStates: ['static_risk_blocker', 'suspended_imported_listing'],
1542
+ requiredGroupKinds: ['repo-marketplace-metadata', 'claude-plugin', 'command', 'mcp-connector-config', 'skill'],
1543
+ requiredRiskCategories: [
1544
+ 'executable_hook',
1545
+ 'deploy_capable_command',
1546
+ 'env_required_connector',
1547
+ 'local_binary_requirement',
1548
+ 'external_submodule',
1549
+ ],
1550
+ viewportCoverage: operatorReviewViewportCoverage(['static_risk_blocker', 'suspended_imported_listing'], ['repo-marketplace-metadata', 'claude-plugin', 'command', 'mcp-connector-config', 'skill']),
1551
+ staticOnly: true,
1552
+ guardrails: operatorReviewFixtureGuardrails,
1553
+ },
1554
+ };