@vibe-engineer/adapter-pi 0.1.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/dist/capabilities/index.d.ts +12 -0
- package/dist/capabilities/index.js +21 -0
- package/dist/chunk-PJHJYGIJ.js +392 -0
- package/dist/chunk-RC3EILIE.js +243 -0
- package/dist/chunk-VXZJPOEE.js +751 -0
- package/dist/create-consumption/index.d.ts +56 -0
- package/dist/create-consumption/index.js +14 -0
- package/dist/generated-file-manifest/index.d.ts +10 -0
- package/dist/generated-file-manifest/index.js +24 -0
- package/dist/schema/index.d.ts +214 -0
- package/dist/schema/index.js +28 -0
- package/package.json +61 -0
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
// src/schema/index.ts
|
|
2
|
+
var EVIDENCE_STATES = ["known", "unknown", "deferred", "blocked"];
|
|
3
|
+
var READINESS_STATES = ["ready", "unknown", "deferred", "blocked"];
|
|
4
|
+
var SKILL_IDS = ["brainstorm", "grill-me", "task", "plan", "build", "ship"];
|
|
5
|
+
var GENERATED_FILE_FAMILY_IDS = [
|
|
6
|
+
"pi-skill-files",
|
|
7
|
+
"pi-prompt-templates",
|
|
8
|
+
"pi-extensions",
|
|
9
|
+
"pi-package-manifest",
|
|
10
|
+
"context-files",
|
|
11
|
+
"harness-config"
|
|
12
|
+
];
|
|
13
|
+
var SANDBOX_CAPABILITY_STATES = ["proven", "not_provided", "unknown", "blocked", "pending-live"];
|
|
14
|
+
var I14A_RUNTIME_EXECUTION_CLAIMS = ["not-claimed", "pending-live", "blocked"];
|
|
15
|
+
var I14A_OUT_OF_SCOPE_RUNTIME_EXECUTION_CLAIMS = ["proven", "live-proven", "runtime-proven", "loaded", "executed"];
|
|
16
|
+
var GENERATED_FILE_PRODUCER_LANE_IDS = [
|
|
17
|
+
"I-14B-pi-adapter-runtime-skill-consumption",
|
|
18
|
+
"I-15A-create-import-cli-ux-selected-harness"
|
|
19
|
+
];
|
|
20
|
+
var GENERATED_FILE_CONSUMER_LANE_IDS = [
|
|
21
|
+
"I-08-context-graph-index-drift",
|
|
22
|
+
"I-14B-pi-adapter-runtime-skill-consumption",
|
|
23
|
+
"I-15A-create-import-cli-ux-selected-harness",
|
|
24
|
+
"I-15B-starter-template-harness-consumption",
|
|
25
|
+
"I-18-security-safety-hooks-policy",
|
|
26
|
+
"I-21-build-skill-orchestration"
|
|
27
|
+
];
|
|
28
|
+
var hasOwn = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
29
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
30
|
+
var addIssue = (issues, path, code, message) => {
|
|
31
|
+
issues.push({ path, code, message });
|
|
32
|
+
};
|
|
33
|
+
var checkExactObject = (value, path, requiredKeys, issues) => {
|
|
34
|
+
if (!isRecord(value)) {
|
|
35
|
+
addIssue(issues, path, "expected_object", "Expected a JSON object.");
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
for (const key of requiredKeys) {
|
|
39
|
+
if (!hasOwn(value, key)) {
|
|
40
|
+
addIssue(issues, `${path}.${key}`, "missing_required", "Required field is missing.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const key of Object.keys(value)) {
|
|
44
|
+
if (!requiredKeys.includes(key)) {
|
|
45
|
+
addIssue(issues, `${path}.${key}`, "unknown_field", "Unknown fields fail closed.");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
var checkString = (value, path, issues) => {
|
|
51
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
52
|
+
addIssue(issues, path, "expected_non_empty_string", "Expected a non-empty string.");
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
};
|
|
57
|
+
var checkBoolean = (value, path, issues) => {
|
|
58
|
+
if (typeof value !== "boolean") {
|
|
59
|
+
addIssue(issues, path, "expected_boolean", "Expected a boolean.");
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
};
|
|
64
|
+
var checkArray = (value, path, issues) => {
|
|
65
|
+
if (!Array.isArray(value)) {
|
|
66
|
+
addIssue(issues, path, "expected_array", "Expected an array.");
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
71
|
+
var checkStringArray = (value, path, issues, nonEmpty) => {
|
|
72
|
+
if (!checkArray(value, path, issues)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (nonEmpty && value.length === 0) {
|
|
76
|
+
addIssue(issues, path, "empty_array", "Array must not be empty.");
|
|
77
|
+
}
|
|
78
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
79
|
+
checkString(value[index], `${path}[${index}]`, issues);
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
};
|
|
83
|
+
var checkLiteral = (value, allowed, path, issues) => {
|
|
84
|
+
if (typeof value !== "string" || !allowed.includes(value)) {
|
|
85
|
+
addIssue(issues, path, "unsupported_value", `Expected one of: ${allowed.join(", ")}.`);
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
var sameStringSet = (actual, expected) => {
|
|
91
|
+
if (actual.length !== expected.length) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const actualSet = new Set(actual);
|
|
95
|
+
if (actualSet.size !== actual.length) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
return expected.every((expectedValue) => actualSet.has(expectedValue));
|
|
99
|
+
};
|
|
100
|
+
var checkExactStringSet = (value, expected, path, code, issues, message) => {
|
|
101
|
+
if (!checkStringArray(value, path, issues, true)) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
if (!sameStringSet(value, expected)) {
|
|
105
|
+
addIssue(issues, path, code, message);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
};
|
|
110
|
+
var validateI14ARuntimeExecutionClaim = (value, path, issues) => {
|
|
111
|
+
if (typeof value === "string" && I14A_OUT_OF_SCOPE_RUNTIME_EXECUTION_CLAIMS.includes(value)) {
|
|
112
|
+
addIssue(issues, path, "i14a_runtime_claim_out_of_scope", "I-14A cannot claim live pi runtime execution; live-runtime proof belongs to I-14B.");
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return checkLiteral(value, I14A_RUNTIME_EXECUTION_CLAIMS, path, issues);
|
|
116
|
+
};
|
|
117
|
+
var GENERATED_FILE_FAMILY_CONTRACTS = {
|
|
118
|
+
"pi-skill-files": {
|
|
119
|
+
pathPatterns: [".pi/skills/<skill>/SKILL.md", ".agents/skills/<skill>/SKILL.md"],
|
|
120
|
+
producerLane: "I-14B-pi-adapter-runtime-skill-consumption",
|
|
121
|
+
consumedByLanes: ["I-14B-pi-adapter-runtime-skill-consumption", "I-15A-create-import-cli-ux-selected-harness", "I-21-build-skill-orchestration"],
|
|
122
|
+
ownerKind: "lane",
|
|
123
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
124
|
+
trustClassification: "project-instruction",
|
|
125
|
+
projectTrustRequired: true,
|
|
126
|
+
executesCode: false,
|
|
127
|
+
commandPolicy: "not-applicable",
|
|
128
|
+
sandboxCapability: "not_provided",
|
|
129
|
+
credentialPolicy: "no-credentials-required",
|
|
130
|
+
externalIntegration: "disabled-by-default",
|
|
131
|
+
destructiveOperationPolicy: "forbidden",
|
|
132
|
+
formatName: "Agent Skills SKILL.md",
|
|
133
|
+
formatVersion: "v1",
|
|
134
|
+
readinessState: "ready"
|
|
135
|
+
},
|
|
136
|
+
"pi-prompt-templates": {
|
|
137
|
+
pathPatterns: [".pi/prompts/<name>.md"],
|
|
138
|
+
producerLane: "I-14B-pi-adapter-runtime-skill-consumption",
|
|
139
|
+
consumedByLanes: ["I-14B-pi-adapter-runtime-skill-consumption", "I-15A-create-import-cli-ux-selected-harness"],
|
|
140
|
+
ownerKind: "lane",
|
|
141
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
142
|
+
trustClassification: "project-instruction",
|
|
143
|
+
projectTrustRequired: true,
|
|
144
|
+
executesCode: false,
|
|
145
|
+
commandPolicy: "not-applicable",
|
|
146
|
+
sandboxCapability: "not_provided",
|
|
147
|
+
credentialPolicy: "no-credentials-required",
|
|
148
|
+
externalIntegration: "disabled-by-default",
|
|
149
|
+
destructiveOperationPolicy: "forbidden",
|
|
150
|
+
formatName: "Pi prompt template markdown",
|
|
151
|
+
formatVersion: "v1",
|
|
152
|
+
readinessState: "ready"
|
|
153
|
+
},
|
|
154
|
+
"pi-extensions": {
|
|
155
|
+
pathPatterns: [".pi/extensions/<name>.ts", ".pi/extensions/<name>/index.ts"],
|
|
156
|
+
producerLane: "I-14B-pi-adapter-runtime-skill-consumption",
|
|
157
|
+
consumedByLanes: ["I-14B-pi-adapter-runtime-skill-consumption", "I-18-security-safety-hooks-policy", "I-21-build-skill-orchestration"],
|
|
158
|
+
ownerKind: "lane",
|
|
159
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
160
|
+
trustClassification: "executable-extension",
|
|
161
|
+
projectTrustRequired: true,
|
|
162
|
+
executesCode: true,
|
|
163
|
+
commandPolicy: "default-deny",
|
|
164
|
+
sandboxCapability: "not_provided",
|
|
165
|
+
credentialPolicy: "operator-supplied-only",
|
|
166
|
+
externalIntegration: "disabled-by-default",
|
|
167
|
+
destructiveOperationPolicy: "approval-required",
|
|
168
|
+
formatName: "Pi TypeScript extension",
|
|
169
|
+
formatVersion: "v1",
|
|
170
|
+
readinessState: "blocked"
|
|
171
|
+
},
|
|
172
|
+
"pi-package-manifest": {
|
|
173
|
+
pathPatterns: ["package.json#pi"],
|
|
174
|
+
producerLane: "I-14B-pi-adapter-runtime-skill-consumption",
|
|
175
|
+
consumedByLanes: ["I-14B-pi-adapter-runtime-skill-consumption", "I-15B-starter-template-harness-consumption"],
|
|
176
|
+
ownerKind: "lane",
|
|
177
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
178
|
+
trustClassification: "package-manifest",
|
|
179
|
+
projectTrustRequired: true,
|
|
180
|
+
executesCode: true,
|
|
181
|
+
commandPolicy: "default-deny",
|
|
182
|
+
sandboxCapability: "not_provided",
|
|
183
|
+
credentialPolicy: "operator-supplied-only",
|
|
184
|
+
externalIntegration: "disabled-by-default",
|
|
185
|
+
destructiveOperationPolicy: "approval-required",
|
|
186
|
+
formatName: "Pi package manifest key",
|
|
187
|
+
formatVersion: "v1",
|
|
188
|
+
readinessState: "deferred"
|
|
189
|
+
},
|
|
190
|
+
"context-files": {
|
|
191
|
+
pathPatterns: ["AGENTS.md", "CLAUDE.md"],
|
|
192
|
+
producerLane: "I-15A-create-import-cli-ux-selected-harness",
|
|
193
|
+
consumedByLanes: ["I-15A-create-import-cli-ux-selected-harness", "I-08-context-graph-index-drift", "I-21-build-skill-orchestration"],
|
|
194
|
+
ownerKind: "lane",
|
|
195
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
196
|
+
trustClassification: "project-instruction",
|
|
197
|
+
projectTrustRequired: true,
|
|
198
|
+
executesCode: false,
|
|
199
|
+
commandPolicy: "not-applicable",
|
|
200
|
+
sandboxCapability: "not_provided",
|
|
201
|
+
credentialPolicy: "no-credentials-required",
|
|
202
|
+
externalIntegration: "disabled-by-default",
|
|
203
|
+
destructiveOperationPolicy: "forbidden",
|
|
204
|
+
formatName: "Pi context file",
|
|
205
|
+
formatVersion: "v1",
|
|
206
|
+
readinessState: "ready"
|
|
207
|
+
},
|
|
208
|
+
"harness-config": {
|
|
209
|
+
pathPatterns: ["generated harness config field: agenticHarness=pi", "generated harness config field: adapterCapabilityVersion", "generated harness config field: generatedFileManifestVersion"],
|
|
210
|
+
producerLane: "I-15A-create-import-cli-ux-selected-harness",
|
|
211
|
+
consumedByLanes: ["I-15A-create-import-cli-ux-selected-harness", "I-15B-starter-template-harness-consumption", "I-21-build-skill-orchestration"],
|
|
212
|
+
ownerKind: "lane",
|
|
213
|
+
allowedOperations: ["generate-in-later-lane", "validate"],
|
|
214
|
+
trustClassification: "configuration",
|
|
215
|
+
projectTrustRequired: false,
|
|
216
|
+
executesCode: false,
|
|
217
|
+
commandPolicy: "not-applicable",
|
|
218
|
+
sandboxCapability: "not_provided",
|
|
219
|
+
credentialPolicy: "no-credentials-required",
|
|
220
|
+
externalIntegration: "disabled-by-default",
|
|
221
|
+
destructiveOperationPolicy: "forbidden",
|
|
222
|
+
formatName: "vibe-engineer harness adapter config",
|
|
223
|
+
formatVersion: "v1",
|
|
224
|
+
readinessState: "ready"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var validateEvidenceRecord = (value, path, issues) => {
|
|
228
|
+
if (!checkExactObject(value, path, ["state", "source", "notes"], issues)) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
checkLiteral(value.state, EVIDENCE_STATES, `${path}.state`, issues);
|
|
232
|
+
checkString(value.source, `${path}.source`, issues);
|
|
233
|
+
checkString(value.notes, `${path}.notes`, issues);
|
|
234
|
+
};
|
|
235
|
+
var validateCapabilitySurface = (value, path, issues) => {
|
|
236
|
+
if (!checkExactObject(value, path, ["evidence", "support", "details", "downstreamConsequence"], issues)) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
240
|
+
checkLiteral(value.support, READINESS_STATES, `${path}.support`, issues);
|
|
241
|
+
checkString(value.details, `${path}.details`, issues);
|
|
242
|
+
checkString(value.downstreamConsequence, `${path}.downstreamConsequence`, issues);
|
|
243
|
+
};
|
|
244
|
+
var validateVersionCompatibility = (value, path, issues) => {
|
|
245
|
+
if (!checkExactObject(value, path, ["harnessName", "harnessVersionRange", "resourceFormatVersion", "runtimeRequirements", "compatibilityEvidence"], issues)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
checkString(value.harnessName, `${path}.harnessName`, issues);
|
|
249
|
+
checkString(value.harnessVersionRange, `${path}.harnessVersionRange`, issues);
|
|
250
|
+
checkString(value.resourceFormatVersion, `${path}.resourceFormatVersion`, issues);
|
|
251
|
+
checkStringArray(value.runtimeRequirements, `${path}.runtimeRequirements`, issues, true);
|
|
252
|
+
validateEvidenceRecord(value.compatibilityEvidence, `${path}.compatibilityEvidence`, issues);
|
|
253
|
+
};
|
|
254
|
+
var validateSkillCapability = (value, path, issues) => {
|
|
255
|
+
if (!checkExactObject(value, path, ["skillId", "nativeCommand", "resourceFamily", "evidence", "readiness", "protocolSource"], issues)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
checkLiteral(value.skillId, SKILL_IDS, `${path}.skillId`, issues);
|
|
259
|
+
checkString(value.nativeCommand, `${path}.nativeCommand`, issues);
|
|
260
|
+
checkLiteral(value.resourceFamily, GENERATED_FILE_FAMILY_IDS, `${path}.resourceFamily`, issues);
|
|
261
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
262
|
+
checkLiteral(value.readiness, READINESS_STATES, `${path}.readiness`, issues);
|
|
263
|
+
checkString(value.protocolSource, `${path}.protocolSource`, issues);
|
|
264
|
+
};
|
|
265
|
+
var validateSkillsCommandsSurface = (value, path, issues) => {
|
|
266
|
+
if (!checkExactObject(value, path, ["evidence", "support", "details", "downstreamConsequence", "nativeFormat", "autoloadDiscovery", "skills"], issues)) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
270
|
+
checkLiteral(value.support, READINESS_STATES, `${path}.support`, issues);
|
|
271
|
+
checkString(value.details, `${path}.details`, issues);
|
|
272
|
+
checkString(value.downstreamConsequence, `${path}.downstreamConsequence`, issues);
|
|
273
|
+
checkString(value.nativeFormat, `${path}.nativeFormat`, issues);
|
|
274
|
+
checkStringArray(value.autoloadDiscovery, `${path}.autoloadDiscovery`, issues, true);
|
|
275
|
+
if (checkArray(value.skills, `${path}.skills`, issues)) {
|
|
276
|
+
for (let index = 0; index < value.skills.length; index += 1) {
|
|
277
|
+
validateSkillCapability(value.skills[index], `${path}.skills[${index}]`, issues);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
var validateSubagentOrPlanCapability = (value, path, issues) => {
|
|
282
|
+
if (!checkExactObject(value, path, ["evidence", "support", "details", "downstreamConsequence", "implementationKind", "requiresGeneratedExtension"], issues)) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
286
|
+
checkLiteral(value.support, READINESS_STATES, `${path}.support`, issues);
|
|
287
|
+
checkString(value.details, `${path}.details`, issues);
|
|
288
|
+
checkString(value.downstreamConsequence, `${path}.downstreamConsequence`, issues);
|
|
289
|
+
checkLiteral(value.implementationKind, ["built-in", "extension-built", "external", "unsupported"], `${path}.implementationKind`, issues);
|
|
290
|
+
checkBoolean(value.requiresGeneratedExtension, `${path}.requiresGeneratedExtension`, issues);
|
|
291
|
+
};
|
|
292
|
+
var validateCommandInvocationModel = (value, path, issues) => {
|
|
293
|
+
if (!checkExactObject(value, path, ["interactive", "printMode", "jsonMode", "rpcMode", "sdk", "shellCommandPolicy"], issues)) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
validateCapabilitySurface(value.interactive, `${path}.interactive`, issues);
|
|
297
|
+
validateCapabilitySurface(value.printMode, `${path}.printMode`, issues);
|
|
298
|
+
validateCapabilitySurface(value.jsonMode, `${path}.jsonMode`, issues);
|
|
299
|
+
validateCapabilitySurface(value.rpcMode, `${path}.rpcMode`, issues);
|
|
300
|
+
validateCapabilitySurface(value.sdk, `${path}.sdk`, issues);
|
|
301
|
+
checkLiteral(value.shellCommandPolicy, ["not-required", "default-deny", "blocked"], `${path}.shellCommandPolicy`, issues);
|
|
302
|
+
};
|
|
303
|
+
var validateGeneratedFilesCapability = (value, path, issues) => {
|
|
304
|
+
if (!checkExactObject(value, path, ["evidence", "manifestSchemaVersion", "families", "downstreamConsequence"], issues)) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
308
|
+
checkString(value.manifestSchemaVersion, `${path}.manifestSchemaVersion`, issues);
|
|
309
|
+
if (checkArray(value.families, `${path}.families`, issues)) {
|
|
310
|
+
for (let index = 0; index < value.families.length; index += 1) {
|
|
311
|
+
checkLiteral(value.families[index], GENERATED_FILE_FAMILY_IDS, `${path}.families[${index}]`, issues);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
checkString(value.downstreamConsequence, `${path}.downstreamConsequence`, issues);
|
|
315
|
+
};
|
|
316
|
+
var validatePackageDistributionCapability = (value, path, issues) => {
|
|
317
|
+
if (!checkExactObject(value, path, ["evidence", "support", "details", "downstreamConsequence", "distributionKinds", "trustUpdatePolicy"], issues)) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
321
|
+
checkLiteral(value.support, READINESS_STATES, `${path}.support`, issues);
|
|
322
|
+
checkString(value.details, `${path}.details`, issues);
|
|
323
|
+
checkString(value.downstreamConsequence, `${path}.downstreamConsequence`, issues);
|
|
324
|
+
if (checkArray(value.distributionKinds, `${path}.distributionKinds`, issues)) {
|
|
325
|
+
for (let index = 0; index < value.distributionKinds.length; index += 1) {
|
|
326
|
+
checkLiteral(value.distributionKinds[index], ["project-local-files", "pi-package", "npm-package", "global-install"], `${path}.distributionKinds[${index}]`, issues);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
checkString(value.trustUpdatePolicy, `${path}.trustUpdatePolicy`, issues);
|
|
330
|
+
};
|
|
331
|
+
var validateSecurityTrustCapability = (value, path, issues) => {
|
|
332
|
+
if (!checkExactObject(value, path, ["evidence", "projectTrustRequired", "extensionExecution", "commandPolicy", "sandboxCapability", "credentialPolicy", "destructiveOperations", "externalIntegration", "trustBoundary"], issues)) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
336
|
+
checkBoolean(value.projectTrustRequired, `${path}.projectTrustRequired`, issues);
|
|
337
|
+
checkLiteral(value.extensionExecution, ["none", "typescript-extension", "package-extension"], `${path}.extensionExecution`, issues);
|
|
338
|
+
checkLiteral(value.commandPolicy, ["default-deny", "not-applicable"], `${path}.commandPolicy`, issues);
|
|
339
|
+
checkLiteral(value.sandboxCapability, SANDBOX_CAPABILITY_STATES, `${path}.sandboxCapability`, issues);
|
|
340
|
+
checkLiteral(value.credentialPolicy, ["no-credentials-required", "operator-supplied-only", "unknown-blocked"], `${path}.credentialPolicy`, issues);
|
|
341
|
+
checkLiteral(value.destructiveOperations, ["forbidden", "approval-required", "not-applicable"], `${path}.destructiveOperations`, issues);
|
|
342
|
+
checkLiteral(value.externalIntegration, ["disabled-by-default", "read-only", "unknown-blocked"], `${path}.externalIntegration`, issues);
|
|
343
|
+
checkString(value.trustBoundary, `${path}.trustBoundary`, issues);
|
|
344
|
+
};
|
|
345
|
+
var validateCapabilityFlags = (value, path, issues) => {
|
|
346
|
+
if (!checkExactObject(value, path, ["skills", "prompts", "hooks", "extensions", "subagents", "planMode", "contextFiles", "rpc", "sdk", "jsonMode", "packages", "ui", "unsupportedFeaturePolicy"], issues)) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
for (const key of ["skills", "prompts", "hooks", "extensions", "subagents", "planMode", "contextFiles", "rpc", "sdk", "jsonMode", "packages", "ui"]) {
|
|
350
|
+
checkBoolean(value[key], `${path}.${key}`, issues);
|
|
351
|
+
}
|
|
352
|
+
checkLiteral(value.unsupportedFeaturePolicy, ["block", "defer", "unknown-block"], `${path}.unsupportedFeaturePolicy`, issues);
|
|
353
|
+
};
|
|
354
|
+
var validateRealBoundaryWitness = (value, path, issues) => {
|
|
355
|
+
if (!checkExactObject(value, path, ["evidence", "boundaryStatus", "producer", "carrier", "consumer", "evidencePath", "runtimeExecutionClaim"], issues)) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
359
|
+
checkLiteral(value.boundaryStatus, ["implemented", "pending-live", "blocked", "deferred", "unknown"], `${path}.boundaryStatus`, issues);
|
|
360
|
+
checkString(value.producer, `${path}.producer`, issues);
|
|
361
|
+
checkString(value.carrier, `${path}.carrier`, issues);
|
|
362
|
+
checkString(value.consumer, `${path}.consumer`, issues);
|
|
363
|
+
checkString(value.evidencePath, `${path}.evidencePath`, issues);
|
|
364
|
+
validateI14ARuntimeExecutionClaim(value.runtimeExecutionClaim, `${path}.runtimeExecutionClaim`, issues);
|
|
365
|
+
};
|
|
366
|
+
var validateSelection = (value, path, issues) => {
|
|
367
|
+
if (!checkExactObject(value, path, ["manifestSelectable", "createImportSelectable", "readiness", "reason"], issues)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
checkBoolean(value.manifestSelectable, `${path}.manifestSelectable`, issues);
|
|
371
|
+
checkBoolean(value.createImportSelectable, `${path}.createImportSelectable`, issues);
|
|
372
|
+
checkLiteral(value.readiness, READINESS_STATES, `${path}.readiness`, issues);
|
|
373
|
+
checkString(value.reason, `${path}.reason`, issues);
|
|
374
|
+
};
|
|
375
|
+
var validateAdapterCapability = (value, path, issues) => {
|
|
376
|
+
if (!checkExactObject(value, path, [
|
|
377
|
+
"adapterId",
|
|
378
|
+
"displayName",
|
|
379
|
+
"evidenceStatus",
|
|
380
|
+
"versionCompatibility",
|
|
381
|
+
"skillsCommandsSurface",
|
|
382
|
+
"promptTemplateSurface",
|
|
383
|
+
"hookEventSupport",
|
|
384
|
+
"subagentCapability",
|
|
385
|
+
"planModeCapability",
|
|
386
|
+
"contextFileConventions",
|
|
387
|
+
"commandInvocationModel",
|
|
388
|
+
"generatedFiles",
|
|
389
|
+
"packageDistribution",
|
|
390
|
+
"securityTrust",
|
|
391
|
+
"capabilityFlags",
|
|
392
|
+
"realBoundaryWitness",
|
|
393
|
+
"selection"
|
|
394
|
+
], issues)) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
checkString(value.adapterId, `${path}.adapterId`, issues);
|
|
398
|
+
checkString(value.displayName, `${path}.displayName`, issues);
|
|
399
|
+
validateEvidenceRecord(value.evidenceStatus, `${path}.evidenceStatus`, issues);
|
|
400
|
+
validateVersionCompatibility(value.versionCompatibility, `${path}.versionCompatibility`, issues);
|
|
401
|
+
validateSkillsCommandsSurface(value.skillsCommandsSurface, `${path}.skillsCommandsSurface`, issues);
|
|
402
|
+
validateCapabilitySurface(value.promptTemplateSurface, `${path}.promptTemplateSurface`, issues);
|
|
403
|
+
validateCapabilitySurface(value.hookEventSupport, `${path}.hookEventSupport`, issues);
|
|
404
|
+
validateSubagentOrPlanCapability(value.subagentCapability, `${path}.subagentCapability`, issues);
|
|
405
|
+
validateSubagentOrPlanCapability(value.planModeCapability, `${path}.planModeCapability`, issues);
|
|
406
|
+
validateCapabilitySurface(value.contextFileConventions, `${path}.contextFileConventions`, issues);
|
|
407
|
+
validateCommandInvocationModel(value.commandInvocationModel, `${path}.commandInvocationModel`, issues);
|
|
408
|
+
validateGeneratedFilesCapability(value.generatedFiles, `${path}.generatedFiles`, issues);
|
|
409
|
+
validatePackageDistributionCapability(value.packageDistribution, `${path}.packageDistribution`, issues);
|
|
410
|
+
validateSecurityTrustCapability(value.securityTrust, `${path}.securityTrust`, issues);
|
|
411
|
+
validateCapabilityFlags(value.capabilityFlags, `${path}.capabilityFlags`, issues);
|
|
412
|
+
validateRealBoundaryWitness(value.realBoundaryWitness, `${path}.realBoundaryWitness`, issues);
|
|
413
|
+
validateSelection(value.selection, `${path}.selection`, issues);
|
|
414
|
+
};
|
|
415
|
+
var validateGeneratedFileOwner = (value, path, issues) => {
|
|
416
|
+
if (!checkExactObject(value, path, ["ownerKind", "ownerId", "writePathScope", "allowedOperations"], issues)) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
checkLiteral(value.ownerKind, ["lane", "package"], `${path}.ownerKind`, issues);
|
|
420
|
+
checkLiteral(value.ownerId, GENERATED_FILE_PRODUCER_LANE_IDS, `${path}.ownerId`, issues);
|
|
421
|
+
checkStringArray(value.writePathScope, `${path}.writePathScope`, issues, true);
|
|
422
|
+
if (checkArray(value.allowedOperations, `${path}.allowedOperations`, issues)) {
|
|
423
|
+
for (let index = 0; index < value.allowedOperations.length; index += 1) {
|
|
424
|
+
checkLiteral(value.allowedOperations[index], ["declare", "validate", "generate-in-later-lane"], `${path}.allowedOperations[${index}]`, issues);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var validateGeneratedFileTrustSecurity = (value, path, issues) => {
|
|
429
|
+
if (!checkExactObject(value, path, ["classification", "trustBoundary", "projectTrustRequired", "executesCode", "commandPolicy", "sandboxCapability", "credentialPolicy", "externalIntegration", "destructiveOperationPolicy", "evidence"], issues)) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
checkLiteral(value.classification, ["project-instruction", "executable-extension", "package-manifest", "configuration"], `${path}.classification`, issues);
|
|
433
|
+
checkString(value.trustBoundary, `${path}.trustBoundary`, issues);
|
|
434
|
+
checkBoolean(value.projectTrustRequired, `${path}.projectTrustRequired`, issues);
|
|
435
|
+
checkBoolean(value.executesCode, `${path}.executesCode`, issues);
|
|
436
|
+
checkLiteral(value.commandPolicy, ["default-deny", "not-applicable"], `${path}.commandPolicy`, issues);
|
|
437
|
+
checkLiteral(value.sandboxCapability, SANDBOX_CAPABILITY_STATES, `${path}.sandboxCapability`, issues);
|
|
438
|
+
checkLiteral(value.credentialPolicy, ["no-credentials-required", "operator-supplied-only", "unknown-blocked"], `${path}.credentialPolicy`, issues);
|
|
439
|
+
checkLiteral(value.externalIntegration, ["disabled-by-default", "read-only", "unknown-blocked"], `${path}.externalIntegration`, issues);
|
|
440
|
+
checkLiteral(value.destructiveOperationPolicy, ["forbidden", "approval-required", "not-applicable"], `${path}.destructiveOperationPolicy`, issues);
|
|
441
|
+
validateEvidenceRecord(value.evidence, `${path}.evidence`, issues);
|
|
442
|
+
};
|
|
443
|
+
var validateGeneratedFileVersion = (value, path, issues) => {
|
|
444
|
+
if (!checkExactObject(value, path, ["formatName", "formatVersion", "schemaVersion", "adapterCapabilityVersion"], issues)) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
checkString(value.formatName, `${path}.formatName`, issues);
|
|
448
|
+
checkString(value.formatVersion, `${path}.formatVersion`, issues);
|
|
449
|
+
checkLiteral(value.schemaVersion, ["pi-generated-file-manifest/v1"], `${path}.schemaVersion`, issues);
|
|
450
|
+
checkLiteral(value.adapterCapabilityVersion, ["pi-adapter-capability-matrix/v1"], `${path}.adapterCapabilityVersion`, issues);
|
|
451
|
+
};
|
|
452
|
+
var validateGeneratedFileReadiness = (value, path, issues) => {
|
|
453
|
+
if (!checkExactObject(value, path, ["state", "reason"], issues)) {
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
checkLiteral(value.state, READINESS_STATES, `${path}.state`, issues);
|
|
457
|
+
checkString(value.reason, `${path}.reason`, issues);
|
|
458
|
+
};
|
|
459
|
+
var validateGeneratedFileFamily = (value, path, issues) => {
|
|
460
|
+
if (!checkExactObject(value, path, ["familyId", "description", "pathPatterns", "owner", "producedByLane", "consumedByLanes", "trustSecurity", "version", "readiness"], issues)) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
checkLiteral(value.familyId, GENERATED_FILE_FAMILY_IDS, `${path}.familyId`, issues);
|
|
464
|
+
checkString(value.description, `${path}.description`, issues);
|
|
465
|
+
checkStringArray(value.pathPatterns, `${path}.pathPatterns`, issues, true);
|
|
466
|
+
validateGeneratedFileOwner(value.owner, `${path}.owner`, issues);
|
|
467
|
+
checkLiteral(value.producedByLane, GENERATED_FILE_PRODUCER_LANE_IDS, `${path}.producedByLane`, issues);
|
|
468
|
+
if (checkArray(value.consumedByLanes, `${path}.consumedByLanes`, issues)) {
|
|
469
|
+
if (value.consumedByLanes.length === 0) {
|
|
470
|
+
addIssue(issues, `${path}.consumedByLanes`, "empty_array", "Array must not be empty.");
|
|
471
|
+
}
|
|
472
|
+
for (let index = 0; index < value.consumedByLanes.length; index += 1) {
|
|
473
|
+
checkLiteral(value.consumedByLanes[index], GENERATED_FILE_CONSUMER_LANE_IDS, `${path}.consumedByLanes[${index}]`, issues);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
validateGeneratedFileTrustSecurity(value.trustSecurity, `${path}.trustSecurity`, issues);
|
|
477
|
+
validateGeneratedFileVersion(value.version, `${path}.version`, issues);
|
|
478
|
+
validateGeneratedFileReadiness(value.readiness, `${path}.readiness`, issues);
|
|
479
|
+
};
|
|
480
|
+
var collectDuplicateStrings = (values) => {
|
|
481
|
+
const seen = /* @__PURE__ */ new Set();
|
|
482
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
483
|
+
for (const value of values) {
|
|
484
|
+
if (seen.has(value)) {
|
|
485
|
+
duplicates.add(value);
|
|
486
|
+
}
|
|
487
|
+
seen.add(value);
|
|
488
|
+
}
|
|
489
|
+
return [...duplicates].sort();
|
|
490
|
+
};
|
|
491
|
+
var getRecordArray = (value) => {
|
|
492
|
+
if (!Array.isArray(value)) {
|
|
493
|
+
return [];
|
|
494
|
+
}
|
|
495
|
+
return value.filter(isRecord);
|
|
496
|
+
};
|
|
497
|
+
var validateCapabilityMatrix = (value) => {
|
|
498
|
+
const issues = [];
|
|
499
|
+
if (!checkExactObject(value, "$", ["schemaVersion", "producedByLane", "adapterPackage", "adapters"], issues)) {
|
|
500
|
+
return { valid: false, issues };
|
|
501
|
+
}
|
|
502
|
+
checkLiteral(value.schemaVersion, ["pi-adapter-capability-matrix/v1"], "$.schemaVersion", issues);
|
|
503
|
+
checkLiteral(value.producedByLane, ["I-14A-pi-adapter-capability-generated-file-manifest"], "$.producedByLane", issues);
|
|
504
|
+
checkLiteral(value.adapterPackage, ["@vibe-engineer/adapter-pi"], "$.adapterPackage", issues);
|
|
505
|
+
if (checkArray(value.adapters, "$.adapters", issues)) {
|
|
506
|
+
if (value.adapters.length === 0) {
|
|
507
|
+
addIssue(issues, "$.adapters", "empty_adapters", "Capability matrix must contain adapter rows.");
|
|
508
|
+
}
|
|
509
|
+
for (let index = 0; index < value.adapters.length; index += 1) {
|
|
510
|
+
validateAdapterCapability(value.adapters[index], `$.adapters[${index}]`, issues);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
const adapters = getRecordArray(value.adapters);
|
|
514
|
+
const ids = adapters.map((adapter) => typeof adapter.adapterId === "string" ? adapter.adapterId : "");
|
|
515
|
+
for (const duplicate of collectDuplicateStrings(ids.filter((id) => id.length > 0))) {
|
|
516
|
+
addIssue(issues, "$.adapters", "duplicate_adapter_id", `Duplicate adapter id '${duplicate}'.`);
|
|
517
|
+
}
|
|
518
|
+
const piAdapter = adapters.find((adapter) => adapter.adapterId === "pi");
|
|
519
|
+
if (piAdapter === void 0) {
|
|
520
|
+
addIssue(issues, "$.adapters", "missing_pi_adapter", "Capability matrix must include stable adapter id 'pi'.");
|
|
521
|
+
}
|
|
522
|
+
for (const [index, adapter] of adapters.entries()) {
|
|
523
|
+
const adapterPath = `$.adapters[${index}]`;
|
|
524
|
+
const selection = isRecord(adapter.selection) ? adapter.selection : void 0;
|
|
525
|
+
const flags = isRecord(adapter.capabilityFlags) ? adapter.capabilityFlags : void 0;
|
|
526
|
+
const evidenceStatus = isRecord(adapter.evidenceStatus) ? adapter.evidenceStatus : void 0;
|
|
527
|
+
const skillsSurface = isRecord(adapter.skillsCommandsSurface) ? adapter.skillsCommandsSurface : void 0;
|
|
528
|
+
const adapterId = typeof adapter.adapterId === "string" ? adapter.adapterId : "";
|
|
529
|
+
if (flags?.unsupportedFeaturePolicy !== "block") {
|
|
530
|
+
addIssue(issues, `${adapterPath}.capabilityFlags.unsupportedFeaturePolicy`, "unsupported_feature_policy_not_blocking", "Unsupported features must block instead of silently no-oping.");
|
|
531
|
+
}
|
|
532
|
+
if (adapterId !== "pi") {
|
|
533
|
+
if (selection?.manifestSelectable === true || selection?.createImportSelectable === true || selection?.readiness === "ready") {
|
|
534
|
+
addIssue(issues, `${adapterPath}.selection`, "non_pi_selectable", "Non-pi adapter rows must never be selectable or ready.");
|
|
535
|
+
}
|
|
536
|
+
if (evidenceStatus?.state === "known") {
|
|
537
|
+
addIssue(issues, `${adapterPath}.evidenceStatus.state`, "non_pi_known_claim", "Non-pi adapter rows must remain explicit unknown/deferred/blocked until future evidence-backed decisions.");
|
|
538
|
+
}
|
|
539
|
+
for (const flagKey of ["skills", "prompts", "hooks", "extensions", "subagents", "planMode", "contextFiles", "rpc", "sdk", "jsonMode", "packages", "ui"]) {
|
|
540
|
+
if (flags?.[flagKey] === true) {
|
|
541
|
+
addIssue(issues, `${adapterPath}.capabilityFlags.${flagKey}`, "non_pi_enabled_flag", "Non-pi capability flags cannot be enabled in v1.");
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (adapterId === "pi") {
|
|
546
|
+
if (selection?.manifestSelectable !== true) {
|
|
547
|
+
addIssue(issues, `${adapterPath}.selection.manifestSelectable`, "pi_manifest_not_selectable", "The pi manifest contract must be selectable for downstream manifest consumers.");
|
|
548
|
+
}
|
|
549
|
+
if (selection?.createImportSelectable !== false) {
|
|
550
|
+
addIssue(issues, `${adapterPath}.selection.createImportSelectable`, "create_import_claim_out_of_scope", "I-14A must not claim create/import selectable behavior.");
|
|
551
|
+
}
|
|
552
|
+
if (evidenceStatus?.state !== "known") {
|
|
553
|
+
addIssue(issues, `${adapterPath}.evidenceStatus.state`, "pi_evidence_not_known", "The pi adapter row must carry known design evidence for this contract.");
|
|
554
|
+
}
|
|
555
|
+
const skills = Array.isArray(skillsSurface?.skills) ? skillsSurface.skills : [];
|
|
556
|
+
const skillIds = skills.map((skill) => isRecord(skill) && typeof skill.skillId === "string" ? skill.skillId : "");
|
|
557
|
+
for (const expectedSkill of SKILL_IDS) {
|
|
558
|
+
if (!skillIds.includes(expectedSkill)) {
|
|
559
|
+
addIssue(issues, `${adapterPath}.skillsCommandsSurface.skills`, "missing_skill_mapping", `Missing required six-skill mapping '${expectedSkill}'.`);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
for (const duplicate of collectDuplicateStrings(skillIds.filter((id) => id.length > 0))) {
|
|
563
|
+
addIssue(issues, `${adapterPath}.skillsCommandsSurface.skills`, "duplicate_skill_mapping", `Duplicate skill mapping '${duplicate}'.`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (flags?.skills === true && skillsSurface?.evidence !== void 0 && isRecord(skillsSurface.evidence) && skillsSurface.evidence.state !== "known") {
|
|
567
|
+
addIssue(issues, `${adapterPath}.capabilityFlags.skills`, "flag_without_known_evidence", "Enabled skill capability requires known evidence.");
|
|
568
|
+
}
|
|
569
|
+
if (flags?.prompts === true && isRecord(adapter.promptTemplateSurface) && isRecord(adapter.promptTemplateSurface.evidence) && adapter.promptTemplateSurface.evidence.state !== "known") {
|
|
570
|
+
addIssue(issues, `${adapterPath}.capabilityFlags.prompts`, "flag_without_known_evidence", "Enabled prompt capability requires known evidence.");
|
|
571
|
+
}
|
|
572
|
+
if (flags?.hooks === true && isRecord(adapter.hookEventSupport) && isRecord(adapter.hookEventSupport.evidence) && adapter.hookEventSupport.evidence.state !== "known") {
|
|
573
|
+
addIssue(issues, `${adapterPath}.capabilityFlags.hooks`, "flag_without_known_evidence", "Enabled hook capability requires known evidence.");
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (issues.length > 0) {
|
|
577
|
+
return { valid: false, issues };
|
|
578
|
+
}
|
|
579
|
+
return { valid: true, value, issues: [] };
|
|
580
|
+
};
|
|
581
|
+
var validateGeneratedFileManifest = (value) => {
|
|
582
|
+
const issues = [];
|
|
583
|
+
if (!checkExactObject(value, "$", ["schemaVersion", "adapterId", "adapterCapabilityVersion", "producedByLane", "families"], issues)) {
|
|
584
|
+
return { valid: false, issues };
|
|
585
|
+
}
|
|
586
|
+
checkLiteral(value.schemaVersion, ["pi-generated-file-manifest/v1"], "$.schemaVersion", issues);
|
|
587
|
+
checkLiteral(value.adapterId, ["pi"], "$.adapterId", issues);
|
|
588
|
+
checkLiteral(value.adapterCapabilityVersion, ["pi-adapter-capability-matrix/v1"], "$.adapterCapabilityVersion", issues);
|
|
589
|
+
checkLiteral(value.producedByLane, ["I-14A-pi-adapter-capability-generated-file-manifest"], "$.producedByLane", issues);
|
|
590
|
+
if (checkArray(value.families, "$.families", issues)) {
|
|
591
|
+
if (value.families.length === 0) {
|
|
592
|
+
addIssue(issues, "$.families", "empty_families", "Generated-file manifest must enumerate file families.");
|
|
593
|
+
}
|
|
594
|
+
for (let index = 0; index < value.families.length; index += 1) {
|
|
595
|
+
validateGeneratedFileFamily(value.families[index], `$.families[${index}]`, issues);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const families = getRecordArray(value.families);
|
|
599
|
+
const familyIds = families.map((family) => typeof family.familyId === "string" ? family.familyId : "");
|
|
600
|
+
for (const expectedFamily of GENERATED_FILE_FAMILY_IDS) {
|
|
601
|
+
if (!familyIds.includes(expectedFamily)) {
|
|
602
|
+
addIssue(issues, "$.families", "missing_generated_file_family", `Missing generated-file family '${expectedFamily}'.`);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
for (const duplicate of collectDuplicateStrings(familyIds.filter((id) => id.length > 0))) {
|
|
606
|
+
addIssue(issues, "$.families", "duplicate_generated_file_family", `Duplicate generated-file family '${duplicate}'.`);
|
|
607
|
+
}
|
|
608
|
+
for (const [index, family] of families.entries()) {
|
|
609
|
+
const familyPath = `$.families[${index}]`;
|
|
610
|
+
const owner = isRecord(family.owner) ? family.owner : void 0;
|
|
611
|
+
const trustSecurity = isRecord(family.trustSecurity) ? family.trustSecurity : void 0;
|
|
612
|
+
const version = isRecord(family.version) ? family.version : void 0;
|
|
613
|
+
const readiness = isRecord(family.readiness) ? family.readiness : void 0;
|
|
614
|
+
const consumedByLanes = Array.isArray(family.consumedByLanes) ? family.consumedByLanes : [];
|
|
615
|
+
if (!owner || !trustSecurity || !version || !readiness || consumedByLanes.length === 0) {
|
|
616
|
+
addIssue(issues, familyPath, "missing_fail_closed_metadata", "Owner, security/trust, version, readiness, and consumer data are mandatory.");
|
|
617
|
+
}
|
|
618
|
+
if (typeof family.familyId === "string" && GENERATED_FILE_FAMILY_IDS.includes(family.familyId)) {
|
|
619
|
+
const contract = GENERATED_FILE_FAMILY_CONTRACTS[family.familyId];
|
|
620
|
+
checkExactStringSet(
|
|
621
|
+
family.pathPatterns,
|
|
622
|
+
contract.pathPatterns,
|
|
623
|
+
`${familyPath}.pathPatterns`,
|
|
624
|
+
"missing_required_path_pattern",
|
|
625
|
+
issues,
|
|
626
|
+
`Generated-file family '${family.familyId}' must declare exactly the required path patterns: ${contract.pathPatterns.join(", ")}.`
|
|
627
|
+
);
|
|
628
|
+
if (family.producedByLane !== contract.producerLane) {
|
|
629
|
+
addIssue(issues, `${familyPath}.producedByLane`, "unsupported_value", `Generated-file family '${family.familyId}' must be produced by '${contract.producerLane}'.`);
|
|
630
|
+
}
|
|
631
|
+
checkExactStringSet(
|
|
632
|
+
family.consumedByLanes,
|
|
633
|
+
contract.consumedByLanes,
|
|
634
|
+
`${familyPath}.consumedByLanes`,
|
|
635
|
+
"unsupported_value",
|
|
636
|
+
issues,
|
|
637
|
+
`Generated-file family '${family.familyId}' must declare exactly the typed consumer lanes: ${contract.consumedByLanes.join(", ")}.`
|
|
638
|
+
);
|
|
639
|
+
if (owner !== void 0) {
|
|
640
|
+
if (owner.ownerKind !== contract.ownerKind) {
|
|
641
|
+
addIssue(issues, `${familyPath}.owner.ownerKind`, "unsupported_value", `Generated-file family '${family.familyId}' must be owned by a lane.`);
|
|
642
|
+
}
|
|
643
|
+
if (owner.ownerId !== contract.producerLane) {
|
|
644
|
+
addIssue(issues, `${familyPath}.owner.ownerId`, "unsupported_value", `Generated-file family '${family.familyId}' owner lane must be '${contract.producerLane}'.`);
|
|
645
|
+
}
|
|
646
|
+
checkExactStringSet(
|
|
647
|
+
owner.writePathScope,
|
|
648
|
+
contract.pathPatterns,
|
|
649
|
+
`${familyPath}.owner.writePathScope`,
|
|
650
|
+
"missing_required_path_pattern",
|
|
651
|
+
issues,
|
|
652
|
+
`Generated-file family '${family.familyId}' owner write scope must exactly match required path patterns.`
|
|
653
|
+
);
|
|
654
|
+
checkExactStringSet(
|
|
655
|
+
owner.allowedOperations,
|
|
656
|
+
contract.allowedOperations,
|
|
657
|
+
`${familyPath}.owner.allowedOperations`,
|
|
658
|
+
"unsupported_value",
|
|
659
|
+
issues,
|
|
660
|
+
`Generated-file family '${family.familyId}' owner operations must be typed and exact.`
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
if (trustSecurity !== void 0) {
|
|
664
|
+
if (trustSecurity.classification !== contract.trustClassification) {
|
|
665
|
+
addIssue(issues, `${familyPath}.trustSecurity.classification`, "unsupported_value", `Generated-file family '${family.familyId}' must use trust classification '${contract.trustClassification}'.`);
|
|
666
|
+
}
|
|
667
|
+
if (trustSecurity.projectTrustRequired !== contract.projectTrustRequired) {
|
|
668
|
+
addIssue(issues, `${familyPath}.trustSecurity.projectTrustRequired`, "unsupported_value", `Generated-file family '${family.familyId}' project-trust metadata must be exact.`);
|
|
669
|
+
}
|
|
670
|
+
if (trustSecurity.executesCode !== contract.executesCode) {
|
|
671
|
+
addIssue(issues, `${familyPath}.trustSecurity.executesCode`, "unsupported_value", `Generated-file family '${family.familyId}' executable-code metadata must be exact.`);
|
|
672
|
+
}
|
|
673
|
+
if (trustSecurity.commandPolicy !== contract.commandPolicy) {
|
|
674
|
+
addIssue(issues, `${familyPath}.trustSecurity.commandPolicy`, "unsupported_value", `Generated-file family '${family.familyId}' command policy must be '${contract.commandPolicy}'.`);
|
|
675
|
+
}
|
|
676
|
+
if (trustSecurity.sandboxCapability !== contract.sandboxCapability) {
|
|
677
|
+
addIssue(issues, `${familyPath}.trustSecurity.sandboxCapability`, "unsupported_value", `Generated-file family '${family.familyId}' sandbox metadata must be '${contract.sandboxCapability}'.`);
|
|
678
|
+
}
|
|
679
|
+
if (trustSecurity.credentialPolicy !== contract.credentialPolicy) {
|
|
680
|
+
addIssue(issues, `${familyPath}.trustSecurity.credentialPolicy`, "unsupported_value", `Generated-file family '${family.familyId}' credential policy must be '${contract.credentialPolicy}'.`);
|
|
681
|
+
}
|
|
682
|
+
if (trustSecurity.externalIntegration !== contract.externalIntegration) {
|
|
683
|
+
addIssue(issues, `${familyPath}.trustSecurity.externalIntegration`, "unsupported_value", `Generated-file family '${family.familyId}' external-integration policy must be '${contract.externalIntegration}'.`);
|
|
684
|
+
}
|
|
685
|
+
if (trustSecurity.destructiveOperationPolicy !== contract.destructiveOperationPolicy) {
|
|
686
|
+
addIssue(issues, `${familyPath}.trustSecurity.destructiveOperationPolicy`, "unsupported_value", `Generated-file family '${family.familyId}' destructive-operation policy must be '${contract.destructiveOperationPolicy}'.`);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
if (version !== void 0) {
|
|
690
|
+
if (version.formatName !== contract.formatName) {
|
|
691
|
+
addIssue(issues, `${familyPath}.version.formatName`, "unsupported_value", `Generated-file family '${family.familyId}' format name must be '${contract.formatName}'.`);
|
|
692
|
+
}
|
|
693
|
+
if (version.formatVersion !== contract.formatVersion) {
|
|
694
|
+
addIssue(issues, `${familyPath}.version.formatVersion`, "unsupported_value", `Generated-file family '${family.familyId}' format version must be '${contract.formatVersion}'.`);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (readiness !== void 0 && readiness.state !== contract.readinessState) {
|
|
698
|
+
addIssue(issues, `${familyPath}.readiness.state`, "unsupported_value", `Generated-file family '${family.familyId}' readiness state must be '${contract.readinessState}'.`);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
if (family.familyId === "pi-extensions" && trustSecurity?.executesCode !== true) {
|
|
702
|
+
addIssue(issues, `${familyPath}.trustSecurity.executesCode`, "extension_execution_not_declared", "Pi extensions execute TypeScript and must declare executable trust/security implications.");
|
|
703
|
+
}
|
|
704
|
+
if (family.familyId !== "pi-extensions" && trustSecurity?.executesCode === true && trustSecurity.classification !== "package-manifest") {
|
|
705
|
+
addIssue(issues, `${familyPath}.trustSecurity.executesCode`, "unexpected_executable_family", "Only extension/package manifest families may declare executable behavior in this manifest.");
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
if (issues.length > 0) {
|
|
709
|
+
return { valid: false, issues };
|
|
710
|
+
}
|
|
711
|
+
return { valid: true, value, issues: [] };
|
|
712
|
+
};
|
|
713
|
+
var createDownstreamManifestSummary = (capabilityMatrix, generatedFileManifest) => {
|
|
714
|
+
const capabilityValidation = validateCapabilityMatrix(capabilityMatrix);
|
|
715
|
+
if (!capabilityValidation.valid) {
|
|
716
|
+
throw new Error(`Capability matrix failed validation: ${capabilityValidation.issues.map((issue) => issue.code).join(",")}`);
|
|
717
|
+
}
|
|
718
|
+
const manifestValidation = validateGeneratedFileManifest(generatedFileManifest);
|
|
719
|
+
if (!manifestValidation.valid) {
|
|
720
|
+
throw new Error(`Generated-file manifest failed validation: ${manifestValidation.issues.map((issue) => issue.code).join(",")}`);
|
|
721
|
+
}
|
|
722
|
+
const piAdapter = capabilityMatrix.adapters.find((adapter) => adapter.adapterId === "pi");
|
|
723
|
+
if (piAdapter === void 0) {
|
|
724
|
+
throw new Error("Validated matrix unexpectedly lacks pi adapter.");
|
|
725
|
+
}
|
|
726
|
+
return {
|
|
727
|
+
schemaVersion: "pi-adapter-downstream-summary/v1",
|
|
728
|
+
adapterId: "pi",
|
|
729
|
+
sixSkills: [...SKILL_IDS],
|
|
730
|
+
generatedFamilies: generatedFileManifest.families.map((family) => family.familyId),
|
|
731
|
+
manifestReady: piAdapter.selection.manifestSelectable,
|
|
732
|
+
createImportReady: false,
|
|
733
|
+
runtimeExecutionClaim: piAdapter.realBoundaryWitness.runtimeExecutionClaim,
|
|
734
|
+
blockedNonPiAdapters: capabilityMatrix.adapters.filter((adapter) => adapter.adapterId !== "pi").map((adapter) => adapter.adapterId)
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
export {
|
|
739
|
+
EVIDENCE_STATES,
|
|
740
|
+
READINESS_STATES,
|
|
741
|
+
SKILL_IDS,
|
|
742
|
+
GENERATED_FILE_FAMILY_IDS,
|
|
743
|
+
SANDBOX_CAPABILITY_STATES,
|
|
744
|
+
I14A_RUNTIME_EXECUTION_CLAIMS,
|
|
745
|
+
I14A_OUT_OF_SCOPE_RUNTIME_EXECUTION_CLAIMS,
|
|
746
|
+
GENERATED_FILE_PRODUCER_LANE_IDS,
|
|
747
|
+
GENERATED_FILE_CONSUMER_LANE_IDS,
|
|
748
|
+
validateCapabilityMatrix,
|
|
749
|
+
validateGeneratedFileManifest,
|
|
750
|
+
createDownstreamManifestSummary
|
|
751
|
+
};
|