@apilift/cli 1.8.10-dev.1794166910.ed2ebe92e1a2bc9a191cc1a5f9977c4fb8a31538 → 1.8.11
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/apilift-collector.js +4 -2
- package/dist/apilift-native-host.js +13 -4
- package/dist/apilift.js +119 -24
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/skills/discover/references/operation-contract.md +6 -4
- package/package.json +2 -2
|
@@ -28285,7 +28285,7 @@ var init_schema = __esm({
|
|
|
28285
28285
|
credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v2) => !/[\r\n]/.test(v2)).optional() });
|
|
28286
28286
|
basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v2) => ![...v2].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
28287
28287
|
httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v2) => Object.values(v2).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
28288
|
-
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v2) => !v2.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28288
|
+
probeSchema = external_exports.strictObject({ expectedStatus: external_exports.number().int().min(200).max(499).optional(), effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v2) => !v2.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28289
28289
|
transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v2, ctx) => {
|
|
28290
28290
|
if (new Set(v2.allowedOrigins).size !== v2.allowedOrigins.length)
|
|
28291
28291
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -28337,6 +28337,8 @@ var init_schema = __esm({
|
|
|
28337
28337
|
for (const [origin, probe] of Object.entries(v2.probes)) {
|
|
28338
28338
|
if (!v2.allowedOrigins.includes(origin))
|
|
28339
28339
|
ctx.addIssue({ code: "custom", path: ["probes", origin], message: "Probe origin must be allowed" });
|
|
28340
|
+
if (probe.expectedStatus !== void 0 && probe.expectedStatus >= 300 && (!probe.request.anonymous || ![401, 403, 404].includes(probe.expectedStatus) || !["GET", "HEAD"].includes(probe.request.method) || probe.request.prepare))
|
|
28341
|
+
ctx.addIssue({ code: "custom", path: ["probes", origin, "expectedStatus"], message: "A denied-origin probe must be an anonymous GET/HEAD with observed status 401, 403 or 404 and no preparation; it proves reachability, not upload permission" });
|
|
28340
28342
|
const probeUrl = parseUrl(probe.request.url);
|
|
28341
28343
|
if (!probe.effect && !["GET", "HEAD"].includes(probe.request.method))
|
|
28342
28344
|
ctx.addIssue({ code: "custom", path: ["probes", origin, "request", "method"], message: "Non-GET/HEAD read probes require effect: read" });
|
|
@@ -164349,7 +164351,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
164349
164351
|
const transport = async (input2, init) => {
|
|
164350
164352
|
const method = init?.method ?? "GET";
|
|
164351
164353
|
const headers = new Headers(init?.headers);
|
|
164352
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
164354
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2,structured-wire-v1");
|
|
164353
164355
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
164354
164356
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
164355
164357
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -29234,7 +29234,7 @@ var injectSchema = external_exports.strictObject({ from: external_exports.union(
|
|
|
29234
29234
|
var credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v) => !/[\r\n]/.test(v)).optional() });
|
|
29235
29235
|
var basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v) => ![...v].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
29236
29236
|
var httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v) => Object.values(v).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
29237
|
-
var probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
29237
|
+
var probeSchema = external_exports.strictObject({ expectedStatus: external_exports.number().int().min(200).max(499).optional(), effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
29238
29238
|
var transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v, ctx) => {
|
|
29239
29239
|
if (new Set(v.allowedOrigins).size !== v.allowedOrigins.length)
|
|
29240
29240
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -29286,6 +29286,8 @@ var transportDefinitionSchema = external_exports.strictObject({ title, descripti
|
|
|
29286
29286
|
for (const [origin, probe] of Object.entries(v.probes)) {
|
|
29287
29287
|
if (!v.allowedOrigins.includes(origin))
|
|
29288
29288
|
ctx.addIssue({ code: "custom", path: ["probes", origin], message: "Probe origin must be allowed" });
|
|
29289
|
+
if (probe.expectedStatus !== void 0 && probe.expectedStatus >= 300 && (!probe.request.anonymous || ![401, 403, 404].includes(probe.expectedStatus) || !["GET", "HEAD"].includes(probe.request.method) || probe.request.prepare))
|
|
29290
|
+
ctx.addIssue({ code: "custom", path: ["probes", origin, "expectedStatus"], message: "A denied-origin probe must be an anonymous GET/HEAD with observed status 401, 403 or 404 and no preparation; it proves reachability, not upload permission" });
|
|
29289
29291
|
const probeUrl = parseUrl(probe.request.url);
|
|
29290
29292
|
if (!probe.effect && !["GET", "HEAD"].includes(probe.request.method))
|
|
29291
29293
|
ctx.addIssue({ code: "custom", path: ["probes", origin, "request", "method"], message: "Non-GET/HEAD read probes require effect: read" });
|
|
@@ -29485,10 +29487,17 @@ function inspectRequest(request2, inputs, generated, proof, base2, issues) {
|
|
|
29485
29487
|
if (entries.length !== 1)
|
|
29486
29488
|
issues.push({ path: path2, message: "Binding must contain exactly one key" });
|
|
29487
29489
|
const [key, ref] = entries[0] ?? [];
|
|
29490
|
+
if (key === "$json" && entries.length === 1) {
|
|
29491
|
+
walk(ref, `${path2}/$json`);
|
|
29492
|
+
return;
|
|
29493
|
+
}
|
|
29488
29494
|
if (key === "$input" && typeof ref === "string" && inputs.has(ref))
|
|
29489
29495
|
return;
|
|
29490
|
-
if (key === "$prepared" && typeof ref === "string" && request2.prepare && pointerSchema.safeParse(ref).success)
|
|
29496
|
+
if (key === "$prepared" && typeof ref === "string" && request2.prepare && pointerSchema.safeParse(ref).success) {
|
|
29497
|
+
if (request2.prepare.private && (path2.includes("/$json") || /\/multipart\/\d+\/value\//u.test(path2)))
|
|
29498
|
+
issues.push({ path: path2, message: "Private preparation requires a direct scalar $prepared binding; JSON serialization and repeated arrays require ordinary preparation" });
|
|
29491
29499
|
return;
|
|
29500
|
+
}
|
|
29492
29501
|
if (key === "$generated" && typeof ref === "string" && generated.has(ref))
|
|
29493
29502
|
return;
|
|
29494
29503
|
if (proof && key === "$result" && typeof ref === "string" && pointerSchema.safeParse(ref).success)
|
|
@@ -29497,7 +29506,7 @@ function inspectRequest(request2, inputs, generated, proof, base2, issues) {
|
|
|
29497
29506
|
return;
|
|
29498
29507
|
}
|
|
29499
29508
|
for (const [key, child] of entries) {
|
|
29500
|
-
if ((path2 === `${base2}/body` || path2.startsWith(`${base2}/body/`)) && /\{(?:input|generated|result|unresolved)\./u.test(key))
|
|
29509
|
+
if ((path2 === `${base2}/body` || path2.startsWith(`${base2}/body/`) || path2.includes("/$json")) && /\{(?:input|generated|result|unresolved)\./u.test(key))
|
|
29501
29510
|
inspectText(key, `${path2}/${key}`);
|
|
29502
29511
|
else if (/\{(?:input|generated|result)\./u.test(key))
|
|
29503
29512
|
issues.push({ path: `${path2}/${key}`, message: "Dynamic keys are supported only in JSON request bodies" });
|
|
@@ -30085,7 +30094,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
30085
30094
|
const transport = async (input2, init) => {
|
|
30086
30095
|
const method = init?.method ?? "GET";
|
|
30087
30096
|
const headers = new Headers(init?.headers);
|
|
30088
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
30097
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2,structured-wire-v1");
|
|
30089
30098
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
30090
30099
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
30091
30100
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
package/dist/apilift.js
CHANGED
|
@@ -28404,7 +28404,7 @@ var init_schema = __esm({
|
|
|
28404
28404
|
credentialSchema = external_exports.strictObject({ name: generatedNameSchema, header: external_exports.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/), prefix: external_exports.string().max(80).refine((v) => !/[\r\n]/.test(v)).optional() });
|
|
28405
28405
|
basicComponent = external_exports.union([generatedNameSchema, external_exports.strictObject({ literal: external_exports.string().max(128).refine((v) => ![...v].some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127), "Control characters are not allowed") })]);
|
|
28406
28406
|
httpBasicSchema = external_exports.strictObject({ username: basicComponent.optional(), password: basicComponent.optional() }).refine((v) => Object.values(v).some((value) => typeof value === "string"), "Name at least one saved credential field; the omitted component is empty");
|
|
28407
|
-
probeSchema = external_exports.strictObject({ effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28407
|
+
probeSchema = external_exports.strictObject({ expectedStatus: external_exports.number().int().min(200).max(499).optional(), effect: external_exports.literal("read").optional(), request: requestSchema, response: responseSchema.refine((v) => !v.prepared, "Prepared results are only valid on the primary upload response"), inputs: jsonSchema.optional() });
|
|
28408
28408
|
transportDefinitionSchema = external_exports.strictObject({ title, description: requiredDescription, mode: external_exports.enum(["direct", "browser"]), baseUrl: requestUrlSchema.optional(), allowedOrigins: external_exports.array(originSchema).min(1).max(100), browserContext: segmentSchema.optional(), credentials: external_exports.array(credentialSchema).max(16).optional(), httpBasic: httpBasicSchema.optional(), inject: external_exports.array(injectSchema).optional(), identity: readPreparationSchema.extend({ paths: external_exports.array(pointerSchema).min(1).max(8) }).optional(), probes: external_exports.record(external_exports.string(), probeSchema) }).superRefine((v, ctx) => {
|
|
28409
28409
|
if (new Set(v.allowedOrigins).size !== v.allowedOrigins.length)
|
|
28410
28410
|
ctx.addIssue({ code: "custom", path: ["allowedOrigins"], message: "Origins must be distinct" });
|
|
@@ -28456,6 +28456,8 @@ var init_schema = __esm({
|
|
|
28456
28456
|
for (const [origin, probe] of Object.entries(v.probes)) {
|
|
28457
28457
|
if (!v.allowedOrigins.includes(origin))
|
|
28458
28458
|
ctx.addIssue({ code: "custom", path: ["probes", origin], message: "Probe origin must be allowed" });
|
|
28459
|
+
if (probe.expectedStatus !== void 0 && probe.expectedStatus >= 300 && (!probe.request.anonymous || ![401, 403, 404].includes(probe.expectedStatus) || !["GET", "HEAD"].includes(probe.request.method) || probe.request.prepare))
|
|
28460
|
+
ctx.addIssue({ code: "custom", path: ["probes", origin, "expectedStatus"], message: "A denied-origin probe must be an anonymous GET/HEAD with observed status 401, 403 or 404 and no preparation; it proves reachability, not upload permission" });
|
|
28459
28461
|
const probeUrl = parseUrl(probe.request.url);
|
|
28460
28462
|
if (!probe.effect && !["GET", "HEAD"].includes(probe.request.method))
|
|
28461
28463
|
ctx.addIssue({ code: "custom", path: ["probes", origin, "request", "method"], message: "Non-GET/HEAD read probes require effect: read" });
|
|
@@ -28768,10 +28770,17 @@ function inspectRequest(request2, inputs, generated, proof, base2, issues) {
|
|
|
28768
28770
|
if (entries.length !== 1)
|
|
28769
28771
|
issues.push({ path: path2, message: "Binding must contain exactly one key" });
|
|
28770
28772
|
const [key, ref] = entries[0] ?? [];
|
|
28773
|
+
if (key === "$json" && entries.length === 1) {
|
|
28774
|
+
walk(ref, `${path2}/$json`);
|
|
28775
|
+
return;
|
|
28776
|
+
}
|
|
28771
28777
|
if (key === "$input" && typeof ref === "string" && inputs.has(ref))
|
|
28772
28778
|
return;
|
|
28773
|
-
if (key === "$prepared" && typeof ref === "string" && request2.prepare && pointerSchema.safeParse(ref).success)
|
|
28779
|
+
if (key === "$prepared" && typeof ref === "string" && request2.prepare && pointerSchema.safeParse(ref).success) {
|
|
28780
|
+
if (request2.prepare.private && (path2.includes("/$json") || /\/multipart\/\d+\/value\//u.test(path2)))
|
|
28781
|
+
issues.push({ path: path2, message: "Private preparation requires a direct scalar $prepared binding; JSON serialization and repeated arrays require ordinary preparation" });
|
|
28774
28782
|
return;
|
|
28783
|
+
}
|
|
28775
28784
|
if (key === "$generated" && typeof ref === "string" && generated.has(ref))
|
|
28776
28785
|
return;
|
|
28777
28786
|
if (proof && key === "$result" && typeof ref === "string" && pointerSchema.safeParse(ref).success)
|
|
@@ -28780,7 +28789,7 @@ function inspectRequest(request2, inputs, generated, proof, base2, issues) {
|
|
|
28780
28789
|
return;
|
|
28781
28790
|
}
|
|
28782
28791
|
for (const [key, child2] of entries) {
|
|
28783
|
-
if ((path2 === `${base2}/body` || path2.startsWith(`${base2}/body/`)) && /\{(?:input|generated|result|unresolved)\./u.test(key))
|
|
28792
|
+
if ((path2 === `${base2}/body` || path2.startsWith(`${base2}/body/`) || path2.includes("/$json")) && /\{(?:input|generated|result|unresolved)\./u.test(key))
|
|
28784
28793
|
inspectText(key, `${path2}/${key}`);
|
|
28785
28794
|
else if (/\{(?:input|generated|result)\./u.test(key))
|
|
28786
28795
|
issues.push({ path: `${path2}/${key}`, message: "Dynamic keys are supported only in JSON request bodies" });
|
|
@@ -29096,7 +29105,11 @@ function sourceAssignable(schema, pointer11, target, targetRoot = target) {
|
|
|
29096
29105
|
const selected = schema === void 0 ? void 0 : selectSchema(schema, pointer11);
|
|
29097
29106
|
if (selected === void 0)
|
|
29098
29107
|
return false;
|
|
29099
|
-
|
|
29108
|
+
let normalized = resolveLocalSchema(targetRoot, target);
|
|
29109
|
+
if (normalized !== void 0 && assignable(selected, normalized))
|
|
29110
|
+
return true;
|
|
29111
|
+
if (normalized && typeof normalized === "object" && normalized.type === "string" && normalized.contentMediaType === "application/json" && normalized.contentSchema !== void 0)
|
|
29112
|
+
normalized = resolveLocalSchema(targetRoot, normalized.contentSchema);
|
|
29100
29113
|
if (normalized === void 0)
|
|
29101
29114
|
return false;
|
|
29102
29115
|
if (!pointer11.split("/").includes("*"))
|
|
@@ -31650,6 +31663,7 @@ var init_drafts = __esm({
|
|
|
31650
31663
|
/** Invocation-local evidence capacity for one bounded documented read batch. */
|
|
31651
31664
|
apiReadCaseDraftId;
|
|
31652
31665
|
localEntities = /* @__PURE__ */ new Set();
|
|
31666
|
+
localSourceSchemas = /* @__PURE__ */ new Map();
|
|
31653
31667
|
documentedApi(draftId) {
|
|
31654
31668
|
return this.hasTable("discovery_api_member") && Boolean(this.state.db.prepare("SELECT 1 FROM discovery_api_member m JOIN discovery_api_set s ON s.id=m.set_id WHERE m.draft_id=? AND s.state='selected'").get(draftId));
|
|
31655
31669
|
}
|
|
@@ -32048,7 +32062,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
|
|
|
32048
32062
|
const transport = async (input2, init) => {
|
|
32049
32063
|
const method = init?.method ?? "GET";
|
|
32050
32064
|
const headers = new Headers(init?.headers);
|
|
32051
|
-
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2");
|
|
32065
|
+
headers.set("Apilift-Capabilities", "distributed-rollouts-v1,discovery-proof-v2,dynamic-bindings-v1,collection-proof-v3,web-responses-v1,bounded-catalog-v1,http-basic-v1,api-contracts-v1,string-bindings-v1,file-transfers-v1,file-workflows-v2,structured-wire-v1");
|
|
32052
32066
|
headers.set("Apilift-Client", `cli/${cliVersion}`);
|
|
32053
32067
|
if (token) headers.set("Authorization", `Bearer ${token}`);
|
|
32054
32068
|
if (sessionId) headers.set("Apilift-Session", sessionId);
|
|
@@ -32435,13 +32449,18 @@ var init_file_artifacts = __esm({
|
|
|
32435
32449
|
});
|
|
32436
32450
|
|
|
32437
32451
|
// src/execution/prepared-fields.ts
|
|
32452
|
+
function publicSecurityMetadata(name, value) {
|
|
32453
|
+
if (typeof value !== "number" && typeof value !== "boolean") return false;
|
|
32454
|
+
const normalized = String(name).replace(/([a-z0-9])([A-Z])/g, "$1-$2");
|
|
32455
|
+
return /(?:^|[-_])(?:password|token|session|authentication)(?:[-_]|$)/i.test(normalized) && /(?:^|[-_])(?:expires?|expiry|expiration|retries|attempts|length|minimum|maximum|required|enabled|timeout|age|count|policy|limit)(?:[-_]|$)/i.test(normalized);
|
|
32456
|
+
}
|
|
32438
32457
|
function preparationSecrets(value, credentials = []) {
|
|
32439
|
-
const sensitive2 = /auth|cookie|token|secret|session|credential|password|policy|signature|nonce|csrf|xsrf|api[_
|
|
32458
|
+
const sensitive2 = /(?:^|[-_])auth(?:orization|entication)?(?:[-_]|$)|cookie|token|secret|session|credential|password|policy|signature|nonce|csrf|xsrf|api[-_]?key|hmac|digest/iu;
|
|
32440
32459
|
const secrets = [...credentials];
|
|
32441
32460
|
const visit4 = (node2, protectedField = false) => {
|
|
32442
32461
|
if (node2 && typeof node2 === "object") {
|
|
32443
32462
|
const named = node2;
|
|
32444
|
-
for (const [key, child2] of Object.entries(node2)) visit4(child2, protectedField || sensitive2.test(key) || key === "value" && typeof named.name === "string" && sensitive2.test(named.name));
|
|
32463
|
+
for (const [key, child2] of Object.entries(node2)) visit4(child2, protectedField || sensitive2.test(key.replace(/([a-z0-9])([A-Z])/g, "$1-$2")) && !publicSecurityMetadata(key, child2) || key === "value" && typeof named.name === "string" && sensitive2.test(named.name.replace(/([a-z0-9])([A-Z])/g, "$1-$2")) && !publicSecurityMetadata(named.name, child2));
|
|
32445
32464
|
} else if (protectedField && node2 != null) secrets.push(String(node2));
|
|
32446
32465
|
};
|
|
32447
32466
|
visit4(value);
|
|
@@ -41113,6 +41132,10 @@ function bind(value, inputs, generated, output2, preserveEmptyObject = false, pr
|
|
|
41113
41132
|
if (typeof value === "object" && value !== null) {
|
|
41114
41133
|
const object28 = value;
|
|
41115
41134
|
if (Object.keys(object28).length === 1) {
|
|
41135
|
+
if (Object.hasOwn(object28, "$json")) {
|
|
41136
|
+
const resolved = bind(object28.$json, inputs, generated, output2, true, preparedValues);
|
|
41137
|
+
return resolved === omit2 ? omit2 : JSON.stringify(resolved);
|
|
41138
|
+
}
|
|
41116
41139
|
if (typeof object28.$prepared === "string") return preparedValues === void 0 ? omit2 : pointer4(preparedValues, object28.$prepared);
|
|
41117
41140
|
if (typeof object28.$input === "string") return Object.hasOwn(inputs, object28.$input) ? inputs[object28.$input] : omit2;
|
|
41118
41141
|
if (typeof object28.$generated === "string") return generated[object28.$generated];
|
|
@@ -41148,6 +41171,31 @@ function urlTemplate(value, inputs, generated, output2) {
|
|
|
41148
41171
|
return encodeURIComponent(String(selected));
|
|
41149
41172
|
});
|
|
41150
41173
|
}
|
|
41174
|
+
function requestInputIssues(action, samples) {
|
|
41175
|
+
const issues = [];
|
|
41176
|
+
let inputs;
|
|
41177
|
+
try {
|
|
41178
|
+
inputs = effectiveInputs(action.inputs ?? { type: "object", properties: {} }, samples, {}, true).values;
|
|
41179
|
+
} catch {
|
|
41180
|
+
return issues;
|
|
41181
|
+
}
|
|
41182
|
+
const generated = Object.fromEntries(Object.keys(action.generated ?? {}).map((name) => [name, "generated-example"]));
|
|
41183
|
+
const deferred = (value) => !!value && typeof value === "object" && (Object.hasOwn(value, "$prepared") || Object.hasOwn(value, "$result") || Object.values(value).some(deferred));
|
|
41184
|
+
const inspect2 = (request2, base2) => {
|
|
41185
|
+
for (const [path2, raw] of [...Object.entries(request2.form ?? {}).map(([name, value]) => [`${base2}/form/${name}`, value]), ...(request2.multipart ?? []).flatMap((part, index2) => "value" in part ? [[`${base2}/multipart/${index2}/value`, part.value]] : [])]) {
|
|
41186
|
+
if (deferred(raw)) continue;
|
|
41187
|
+
try {
|
|
41188
|
+
const value = bind(raw, inputs, generated);
|
|
41189
|
+
if (value !== omit2 && (Array.isArray(value) ? value : [value]).some((item) => !["string", "number", "boolean"].includes(typeof item))) issues.push({ path: path2, message: 'Wire fields need scalars or arrays of scalars; use {"$json":...} for structured JSON text' });
|
|
41190
|
+
} catch (error62) {
|
|
41191
|
+
issues.push({ path: path2, message: error62 instanceof Error ? error62.message : "Invalid wire value" });
|
|
41192
|
+
}
|
|
41193
|
+
}
|
|
41194
|
+
if (request2.prepare) inspect2(request2.prepare.request, `${base2}/prepare/request`);
|
|
41195
|
+
};
|
|
41196
|
+
inspect2(action.request, "/definition/request");
|
|
41197
|
+
return issues;
|
|
41198
|
+
}
|
|
41151
41199
|
function prepareRequest(request2, transport, inputs, generated, output2, preparedValues) {
|
|
41152
41200
|
if ([request2.body, request2.form, request2.multipart].filter((value) => value !== void 0).length > 1) throw new Error("form and JSON body are mutually exclusive");
|
|
41153
41201
|
if ((request2.body !== void 0 || request2.form !== void 0 || request2.multipart !== void 0) && ["GET", "HEAD"].includes(request2.method)) throw new Error("GET/HEAD cannot have a body");
|
|
@@ -41231,7 +41279,7 @@ function prepareRequest(request2, transport, inputs, generated, output2, prepare
|
|
|
41231
41279
|
encoded = form.toString();
|
|
41232
41280
|
}
|
|
41233
41281
|
const files2 = [];
|
|
41234
|
-
const multipart2 = request2.multipart?.
|
|
41282
|
+
const multipart2 = request2.multipart?.flatMap((part) => {
|
|
41235
41283
|
if ("file" in part) {
|
|
41236
41284
|
const file2 = inputFile(inputs[part.file.input]);
|
|
41237
41285
|
files2.push(file2);
|
|
@@ -41240,15 +41288,19 @@ function prepareRequest(request2, transport, inputs, generated, output2, prepare
|
|
|
41240
41288
|
}
|
|
41241
41289
|
const resolved = bind(part.value, inputs, generated, output2, false, preparedValues);
|
|
41242
41290
|
const pending = request2.prepare?.private && preparedValues === void 0 && part.value && typeof part.value === "object" && !Array.isArray(part.value) && typeof part.value.$prepared === "string" ? { $prepared: part.value.$prepared } : void 0;
|
|
41243
|
-
if (
|
|
41244
|
-
|
|
41291
|
+
if (pending) return [{ name: part.name, value: pending }];
|
|
41292
|
+
if (resolved === omit2) return [];
|
|
41293
|
+
const values = Array.isArray(resolved) ? resolved : [resolved];
|
|
41294
|
+
if (values.some((value) => !["string", "number", "boolean"].includes(typeof value))) throw new Error("Multipart fields need scalar values or arrays of scalars; use $json for structured JSON text");
|
|
41295
|
+
return values.map((value) => ({ name: part.name, value }));
|
|
41245
41296
|
});
|
|
41297
|
+
if (multipart2 && multipart2.length > 64) throw new Error("Expanded multipart request exceeds 64 parts");
|
|
41246
41298
|
let formData;
|
|
41247
41299
|
if (multipart2) {
|
|
41248
41300
|
if (headers.has("content-type")) throw new Error("Multipart Content-Type is runtime-owned");
|
|
41249
41301
|
formData = new FormData();
|
|
41250
41302
|
for (const part of multipart2) {
|
|
41251
|
-
if (part
|
|
41303
|
+
if ("file" in part) {
|
|
41252
41304
|
const file2 = files2.find((file3) => file3.sha256 === part.file.sha256);
|
|
41253
41305
|
formData.append(part.name, new Blob([Buffer.from(file2.dataBase64, "base64")], { type: part.file.contentType }), part.file.name);
|
|
41254
41306
|
} else if (typeof part.value !== "object") formData.append(part.name, String(part.value));
|
|
@@ -41310,14 +41362,14 @@ function writeOutput(path2, content) {
|
|
|
41310
41362
|
throw error62;
|
|
41311
41363
|
}
|
|
41312
41364
|
}
|
|
41313
|
-
function projected(body, action, generated) {
|
|
41365
|
+
function projected(body, action, generated, maskedExample = false) {
|
|
41314
41366
|
try {
|
|
41315
|
-
return projectResponse(body, action, generated);
|
|
41367
|
+
return projectResponse(body, action, generated, maskedExample);
|
|
41316
41368
|
} catch (error62) {
|
|
41317
41369
|
throw new ResponseContractFailure(error62 instanceof Error ? error62.message : "The app response did not match the action contract");
|
|
41318
41370
|
}
|
|
41319
41371
|
}
|
|
41320
|
-
function projectResponse(body, action, generated) {
|
|
41372
|
+
function projectResponse(body, action, generated, maskedExample = false) {
|
|
41321
41373
|
const response = action.response;
|
|
41322
41374
|
if (response?.generated) return generated[response.generated];
|
|
41323
41375
|
const selected = response?.path !== void 0 ? pointer4(body, response.path) : body;
|
|
@@ -41329,7 +41381,17 @@ function projectResponse(body, action, generated) {
|
|
|
41329
41381
|
if (response?.schema) {
|
|
41330
41382
|
const validate2 = ajv3.compile(response.schema);
|
|
41331
41383
|
if (!validate2(value)) {
|
|
41332
|
-
const
|
|
41384
|
+
const errors = (validate2.errors ?? []).filter((error62) => {
|
|
41385
|
+
if (!maskedExample) return true;
|
|
41386
|
+
try {
|
|
41387
|
+
const sample = pointer4(value, error62.instancePath);
|
|
41388
|
+
return sample !== "<redacted>" && sample !== "[REDACTED]";
|
|
41389
|
+
} catch {
|
|
41390
|
+
return true;
|
|
41391
|
+
}
|
|
41392
|
+
});
|
|
41393
|
+
if (!errors.length) return value;
|
|
41394
|
+
const issues = errors.slice(0, 5).map((error62) => {
|
|
41333
41395
|
let actual;
|
|
41334
41396
|
try {
|
|
41335
41397
|
actual = pointer4(value, error62.instancePath);
|
|
@@ -41861,11 +41923,11 @@ async function prepareWithRead(request2, transport, inputs, generated, sendRead,
|
|
|
41861
41923
|
function effectiveEvidenceStatus(evidence) {
|
|
41862
41924
|
return evidence.hops?.at(-1)?.status ?? evidence.status;
|
|
41863
41925
|
}
|
|
41864
|
-
function checkSavedResponse(action, evidence) {
|
|
41926
|
+
function checkSavedResponse(action, evidence, maskedExample = false) {
|
|
41865
41927
|
const saved = evidence.hops?.at(-1) ?? evidence;
|
|
41866
41928
|
const response = new Response(null, { status: saved.status, headers: saved.contentType ? { "content-type": saved.contentType } : {} });
|
|
41867
41929
|
const decoded = decodeResponse({ response, body: saved.body, preparedFields: evidence.preparedFields, rawText: saved.rawText, finalUrl: saved.finalUrl }, action.response);
|
|
41868
|
-
return projected(decoded, action, evidence.generated);
|
|
41930
|
+
return projected(decoded, action, evidence.generated, maskedExample);
|
|
41869
41931
|
}
|
|
41870
41932
|
function checkSavedProof(action, body, primary, inputs) {
|
|
41871
41933
|
if (!action.proof) return void 0;
|
|
@@ -41919,7 +41981,16 @@ function privateEvidence(value, credentials) {
|
|
|
41919
41981
|
return text4;
|
|
41920
41982
|
};
|
|
41921
41983
|
const visit4 = (child2) => {
|
|
41922
|
-
if (typeof child2 === "string")
|
|
41984
|
+
if (typeof child2 === "string") {
|
|
41985
|
+
if (/^\s*[[{]/u.test(child2)) {
|
|
41986
|
+
try {
|
|
41987
|
+
const parsed = JSON.parse(child2), clean = JSON.stringify(visit4(parsed));
|
|
41988
|
+
return clean === JSON.stringify(parsed) ? child2 : clean;
|
|
41989
|
+
} catch {
|
|
41990
|
+
}
|
|
41991
|
+
}
|
|
41992
|
+
return hide2(child2);
|
|
41993
|
+
}
|
|
41923
41994
|
if (typeof child2 === "number" && secrets.has(String(child2))) {
|
|
41924
41995
|
redacted = true;
|
|
41925
41996
|
return "[REDACTED]";
|
|
@@ -42093,7 +42164,7 @@ async function executeDraftVerification(input2) {
|
|
|
42093
42164
|
hops.push({ status: hop.response.status, body: hop.body, rawText: hop.rawText, contentType: hop.response.headers.get("content-type") ?? void 0, finalUrl: hop.finalUrl });
|
|
42094
42165
|
save();
|
|
42095
42166
|
}, hops.map((hop) => hop.finalUrl).filter((url3) => Boolean(url3)));
|
|
42096
|
-
if (!primary.response.ok) return { ok: false, message: `The app returned HTTP ${primary.response.status}${input2.kind === "transport" || action && "effect" in action && action.effect === "read" ? "" : ". Inspect its state before retrying a mutation"}`, exitCode: 4, dispatched, clientRejected: initial.response.status >= 400 && initial.response.status < 500 };
|
|
42167
|
+
if (probe?.expectedStatus !== void 0 ? primary.response.status !== probe.expectedStatus : !primary.response.ok) return { ok: false, message: `The app returned HTTP ${primary.response.status}${input2.kind === "transport" || action && "effect" in action && action.effect === "read" ? "" : ". Inspect its state before retrying a mutation"}`, exitCode: 4, dispatched, clientRejected: initial.response.status >= 400 && initial.response.status < 500 };
|
|
42097
42168
|
const decoded = input2.primaryEvidence?.decoderHash === decoderHash && Object.hasOwn(input2.primaryEvidence, "decoded") ? input2.primaryEvidence.decoded : decodeResponse(primary, contract);
|
|
42098
42169
|
if (input2.primaryEvidence?.redacted && JSON.stringify(decoded)?.includes("[REDACTED]")) throw new ResponseContractFailure("Saved response lacks unredacted source for this extraction; inspect the intended state through a read");
|
|
42099
42170
|
save(decoded);
|
|
@@ -46070,6 +46141,7 @@ Edit: ${set2.filePath}
|
|
|
46070
46141
|
} finally {
|
|
46071
46142
|
store.alternativeCase = false;
|
|
46072
46143
|
store.localEntities.clear();
|
|
46144
|
+
store.localSourceSchemas.clear();
|
|
46073
46145
|
if (sets.selected(session.id)) sets.restoreSelection(set2);
|
|
46074
46146
|
}
|
|
46075
46147
|
}
|
|
@@ -46144,6 +46216,7 @@ ${run2.stdout.split("\n").filter((line) => line.startsWith("Resolved query encod
|
|
|
46144
46216
|
} finally {
|
|
46145
46217
|
c.store.alternativeCase = false;
|
|
46146
46218
|
c.store.localEntities.clear();
|
|
46219
|
+
c.store.localSourceSchemas.clear();
|
|
46147
46220
|
if (c.sets.selected(c.session.id)) c.sets.restoreSelection(set2);
|
|
46148
46221
|
}
|
|
46149
46222
|
}
|
|
@@ -46202,7 +46275,11 @@ ${complete ? "Selection published. Discovery can close." : `Remaining drafts ret
|
|
|
46202
46275
|
`, 2);
|
|
46203
46276
|
sets.pinSources(set2, plan);
|
|
46204
46277
|
const envelopes = new Map(Object.entries(compiled.entities).map(([name, e]) => [`entity:${name}`, e]));
|
|
46205
|
-
for (const action of compiled.actions)
|
|
46278
|
+
for (const action of compiled.actions) {
|
|
46279
|
+
envelopes.set(`action:${action.name}`, action.envelope);
|
|
46280
|
+
const response = action.envelope.definition.response;
|
|
46281
|
+
if (response?.schema !== void 0) store.localSourceSchemas.set(action.name, response.schema);
|
|
46282
|
+
}
|
|
46206
46283
|
const additions = [];
|
|
46207
46284
|
for (const key of currentKeys.filter((k) => !selectedKeys.has(k))) {
|
|
46208
46285
|
const [kind, name] = key.split(":");
|
|
@@ -46564,7 +46641,11 @@ Selection and independent evidence remain retained; repair the failure before re
|
|
|
46564
46641
|
} catch {
|
|
46565
46642
|
}
|
|
46566
46643
|
}
|
|
46567
|
-
for (const action of compiled.actions)
|
|
46644
|
+
for (const action of compiled.actions) {
|
|
46645
|
+
envelopes.set(`action:${action.name}`, action.envelope);
|
|
46646
|
+
const response = action.envelope.definition.response;
|
|
46647
|
+
if (response?.schema !== void 0) store.localSourceSchemas.set(action.name, response.schema);
|
|
46648
|
+
}
|
|
46568
46649
|
for (const [name, envelope] of Object.entries(compiled.entities)) if (!publishableDefinition("entity", envelope, name).issues.length) store.localEntities.add(name);
|
|
46569
46650
|
const dependencies = /* @__PURE__ */ new Map();
|
|
46570
46651
|
for (const member of pending) {
|
|
@@ -47926,6 +48007,19 @@ async function checkDraft(store, sessionId, api, documentation = true, state, me
|
|
|
47926
48007
|
const translated = publishableDefinition(draft.kind, parsed.envelope, draft.name, metadata);
|
|
47927
48008
|
const issues = [...parsed.issues, ...translated.issues];
|
|
47928
48009
|
if (metadata && translated.definition) issues.push(...documentationIssues(backendKind(draft.kind), translated.definition).map((issue2) => ({ path: `/definition${issue2.path}`, message: issue2.message })));
|
|
48010
|
+
if (draft.kind === "action" && draft.appId && translated.definition && "request" in translated.definition) {
|
|
48011
|
+
const inputs = translated.definition.inputs;
|
|
48012
|
+
const properties = inputs && typeof inputs === "object" ? inputs.properties : void 0;
|
|
48013
|
+
const producers = /* @__PURE__ */ new Map();
|
|
48014
|
+
for (const [name, property] of Object.entries(properties ?? {})) {
|
|
48015
|
+
if (!property || typeof property !== "object") continue;
|
|
48016
|
+
const source2 = property["x-source"];
|
|
48017
|
+
if (!source2 || typeof source2.action !== "string" || typeof source2.path !== "string") continue;
|
|
48018
|
+
if (!store.localSourceSchemas.has(source2.action) && source2.action !== draft.name && !producers.has(source2.action)) producers.set(source2.action, await currentResource(api, draft.appId, "action", source2.action));
|
|
48019
|
+
const producer = producers.get(source2.action)?.definition;
|
|
48020
|
+
if (!sourceAssignable(store.localSourceSchemas.get(source2.action) ?? (source2.action === draft.name ? translated.definition.response?.schema : producer?.response?.schema), source2.path, property, inputs)) issues.push({ path: `/definition/inputs/properties/${name}/x-source`, message: `Source ${source2.action}${source2.path} is not assignable to this input; repair its typed source contract before dispatch.` });
|
|
48021
|
+
}
|
|
48022
|
+
}
|
|
47929
48023
|
if (documentation && translated.definition && draft.appId && draft.baseVersion && (draft.kind === "transport" || draft.kind === "action" && "request" in translated.definition) && !store.evidence(draft.id) && !mutationDispatched(store, draft.id)) {
|
|
47930
48024
|
const current = await currentResource(api, draft.appId, draft.kind, draft.name);
|
|
47931
48025
|
if (current?.version === draft.baseVersion && current.executableHash && current.verification) {
|
|
@@ -47952,6 +48046,7 @@ async function checkDraft(store, sessionId, api, documentation = true, state, me
|
|
|
47952
48046
|
const executable = draft.kind === "action" && definition2 && "request" in definition2 ? definition2 : void 0;
|
|
47953
48047
|
const probe = draft.kind === "transport" && definition2 && "probes" in definition2 ? definition2.probes[parsed.envelope.verification?.probeOrigin ?? ""] : void 0;
|
|
47954
48048
|
if (executable || probe) issues.push(...verificationInputIssues((executable ?? probe).inputs ?? { type: "object", properties: {}, additionalProperties: false }, parsed.envelope.verification?.inputs ?? {}));
|
|
48049
|
+
if (executable) issues.push(...requestInputIssues(executable, parsed.envelope.verification?.inputs ?? {}));
|
|
47955
48050
|
if (executable && metadata) issues.push(...outcomeIssues(executable, parsed.envelope.verification?.outcome, [], "declaration"));
|
|
47956
48051
|
if (executable && !store.alternativeCase) issues.push(...defaultVerificationIssues(executable.inputs, parsed.envelope.verification?.inputs ?? {}));
|
|
47957
48052
|
if (executable && parsed.envelope.verification?.boundary) {
|
|
@@ -47973,7 +48068,7 @@ async function checkDraft(store, sessionId, api, documentation = true, state, me
|
|
|
47973
48068
|
if (executable) {
|
|
47974
48069
|
try {
|
|
47975
48070
|
checked.examples = checkResponseExamples(store, sessionId, exampleBinding(draft.name, executable), (value) => {
|
|
47976
|
-
checkSavedResponse(executable, value);
|
|
48071
|
+
checkSavedResponse(executable, value, true);
|
|
47977
48072
|
});
|
|
47978
48073
|
} catch (error62) {
|
|
47979
48074
|
issues.push({ path: "/definition/response", message: error62 instanceof Error ? error62.message : "Saved response check failed" });
|
|
@@ -49244,7 +49339,7 @@ ${authFieldPointers(entry2).length ? `Authentication field candidates: ${authFie
|
|
|
49244
49339
|
function sensitiveValues(value, found = /* @__PURE__ */ new Set()) {
|
|
49245
49340
|
if (Array.isArray(value)) value.forEach((item) => sensitiveValues(item, found));
|
|
49246
49341
|
else if (value && typeof value === "object") for (const [key, item] of Object.entries(value)) {
|
|
49247
|
-
if (sensitiveName.test(key) && ["string", "number", "boolean"].includes(typeof item)) {
|
|
49342
|
+
if (sensitiveName.test(key) && !publicSecurityMetadata(key, item) && ["string", "number", "boolean"].includes(typeof item)) {
|
|
49248
49343
|
found.add(String(item));
|
|
49249
49344
|
if (typeof item === "string" && /^(Bearer|Basic) /i.test(item)) found.add(item.replace(/^(Bearer|Basic) /i, ""));
|
|
49250
49345
|
} else sensitiveValues(item, found);
|
|
@@ -49253,7 +49348,7 @@ function sensitiveValues(value, found = /* @__PURE__ */ new Set()) {
|
|
|
49253
49348
|
}
|
|
49254
49349
|
function protectedBody(value, values = sensitiveValues(value)) {
|
|
49255
49350
|
if (Array.isArray(value)) return value.map((item) => protectedBody(item, values));
|
|
49256
|
-
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, sensitiveName.test(key) ? "<redacted>" : protectedBody(item, values)]));
|
|
49351
|
+
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, sensitiveName.test(key) && !publicSecurityMetadata(key, item) ? "<redacted>" : protectedBody(item, values)]));
|
|
49257
49352
|
return values.has(String(value)) ? "<redacted>" : value;
|
|
49258
49353
|
}
|
|
49259
49354
|
async function refreshCandidate(item, scopeId, root2, deadline, waitForResponse) {
|
|
@@ -20,7 +20,7 @@ Before the action test, declare `verification.outcome: {kind,path?,fields?,ident
|
|
|
20
20
|
- `execution`: declare `identity` and at least one distinct actual state or output field in `fields`; require saved readback and `proof.equals` comparisons for both. Use `states` for allowed observed lifecycle states. Verify the promised usable terminal result through read-only proof; a request acknowledgement does not establish execution success. Do not infer state semantics from a field name.
|
|
21
21
|
- `usage`: declare the fields to reconcile and compare each with independent saved JSON evidence. Literals, input echoes and the same saved output do not reconcile actual usage or cost. If reconciliation is unavailable, publish a raw counter only as a `record` with clear limits, and report the actual-cost gap.
|
|
22
22
|
|
|
23
|
-
For read cases, `verification.expect` compares saved output with exactly one expected source: input, literal value or independent saved JSON file. Each `path` selects saved output; `from` selects a file subtree and defaults to its root. For example, a complete ticket collection can use `[{path:"",file:"/absolute/independent-tickets.json"}]`; a record can compare both `[{path:"/id",input:"ticket_id"},{path:"/active",value:false}]`. Derive expectations from the intended outcome, documentation, UI or independent evidence, never by copying the actual response. Mutation record `proof.equals` comparisons supply their existing proof; do not duplicate them. Run, local check and publication use the same applicable definition and saved-evidence checks. Local check and publication check expectations locally without app calls; their success does not accept semantic review. Use `discover check` after local response projection or schema repairs; it rechecks the retained raw response and current expectations without another app request. Otherwise follow the returned recovery command, not a routine check step. Stop dependent commands after failure; apply the skill’s resource-level batch recovery without tracebacks or false success.
|
|
23
|
+
For read cases, `verification.expect` compares saved output with exactly one expected source: input, literal value or independent saved JSON file. Each `path` selects saved output; `from` selects a file subtree and defaults to its root. For example, a complete ticket collection can use `[{path:"",file:"/absolute/independent-tickets.json"}]`; a record can compare both `[{path:"/id",input:"ticket_id"},{path:"/active",value:false}]`. Derive expectations from the intended outcome, documentation, UI or independent evidence, never by copying the actual response. Mutation record `proof.equals` comparisons supply their existing proof; do not duplicate them. Run, local check and publication use the same applicable definition and saved-evidence checks. Local check and publication check expectations locally without app calls; their success does not accept semantic review. Masked leaves in retained capture examples are unknown values, not evidence against a typed response schema; they never establish a successful execution or mutation outcome. Use `discover check` after local response projection or schema repairs; it rechecks the retained raw response and current expectations without another app request. Otherwise follow the returned recovery command, not a routine check step. Stop dependent commands after failure; apply the skill’s resource-level batch recovery without tracebacks or false success.
|
|
24
24
|
|
|
25
25
|
When independent responses differ only in an observed volatile scalar, add a narrow exclusion to that comparison: `{path:"",file:"/absolute/independent-articles.json",ignore:[{path:"/*/score",reason:"The app recalculates this ranking score per request."}]}`. Exclusion paths are relative to the selected comparison; `*` traverses array members. Keep identifiers, stable fields, membership and ordering compared. Each excluded field must remain present, and records or arrays cannot be excluded. The raw response and full response-schema validation remain intact. Do not exclude a field that establishes the promised outcome. Use `unordered:true` separately only for a genuinely unordered collection.
|
|
26
26
|
|
|
@@ -42,7 +42,7 @@ A genuinely terminal, command-scoped unavailable boundary may be documented only
|
|
|
42
42
|
|
|
43
43
|
For returned HTML, declare `response.format: "html"` and `response.html: {marker:"#observed-page",fields:{title:{selector:"h1",read:"text"}}}`. Replace selectors with observed structure. The marker must match exactly once and distinguish the signed-in page from login. Fields support `read` values `text`, `attribute` with `attribute`, `value`, `checked`, or `json` for embedded JSON; `fields` nests objects and `many:true` returns records. Use explicit `type` conversion for numbers or booleans, and `optional:true` only for observed optional fields. Extraction produces JSON before existing `path`, `fields` and `schema` validation. Declare `html.errors` for observed form-validation messages. Scripts never run; rendered-only data needs an observed structured request. Capture show accepts `--selector <CSS-selector>` for bounded retained HTML inspection; capture select writes an incomplete contract for review.
|
|
44
44
|
|
|
45
|
-
Use `request.form` for observed `application/x-www-form-urlencoded` submissions, excluding `body`. Arrays become repeated fields; empty strings remain present and absent optional inputs are omitted. Represent checkbox wire values, omitted controls and the selected submit button explicitly; do not map caller booleans to browser behavior by assumption. One optional `request.prepare: {request:{method:"GET",url:"/settings/edit"},response:{...}}` extracts fresh internal values. Bind them with `{"$prepared":"/csrf"}` or a preservation path. Prepared values are refreshed per submission and never caller inputs. Declare unrelated non-default fields that a complete-form replacement must preserve. Transport form authentication uses `to:{in:"form",name:"csrf"}` on form submissions; read requests omit that form-only injection. Use the multipart contract below for uploads. A single action dispatches one primary mutation; publish multiple-write workflows as separate independently verified actions.
|
|
45
|
+
Use `request.form` for observed `application/x-www-form-urlencoded` submissions, excluding `body`. Arrays become repeated fields; empty strings remain present and absent optional inputs are omitted. For a structured value that the app expects as JSON text, use `{"$json":{"$input":"settings"}}` to serialize a typed object or array once; the same binding works in multipart scalar parts. Keep `x-source` on the typed input so consumers can read, modify and resubmit the complete state. A string input with `contentMediaType: "application/json"` and an explicit `contentSchema` can reference a compatible structured source, but its caller must serialize that input; ordinary strings do not imply JSON conversion. Local check validates source compatibility and supplied wire values before preparation or mutation. Represent checkbox wire values, omitted controls and the selected submit button explicitly; do not map caller booleans to browser behavior by assumption. One optional `request.prepare: {request:{method:"GET",url:"/settings/edit"},response:{...}}` extracts fresh internal values. Bind them with `{"$prepared":"/csrf"}` or a preservation path. Prepared values are refreshed per submission and never caller inputs. Declare unrelated non-default fields that a complete-form replacement must preserve. Transport form authentication uses `to:{in:"form",name:"csrf"}` on form submissions; read requests omit that form-only injection. Use the multipart contract below for uploads. A single action dispatches one primary mutation; publish multiple-write workflows as separate independently verified actions.
|
|
46
46
|
|
|
47
47
|
Follow app navigation only when observed and declared: `response.continue:[{statuses:[200],format:"json",path:"/next"}]`, or an HTML rule with `selector` and `attribute`. Rules perform GET on the selected origin, resolve against the actual response URL, and share a five-read/20-second budget. A read may declare a non-2xx continuation; a rejected write cannot. Final responses use the result contract above. Never guess semantics from names such as redirectUrl or execute navigation scripts. Failed navigation retains the primary and completed reads for proof-only recovery.
|
|
48
48
|
|
|
@@ -50,9 +50,11 @@ For recovery through another tab, configure a browser transport `identity` befor
|
|
|
50
50
|
|
|
51
51
|
## File uploads and exports
|
|
52
52
|
|
|
53
|
-
Use `request.multipart` for ordered multipart parts, including scalar-only bodies without a file: `{ "name": "label", "value": "" }` preserves an empty scalar, and repeated names remain separate ordered parts. Complete scalar-only captures derive this structure; unavailable scalar data does not imply a file. `{ "name": "file", "file": { "input": "file_path", "contentType": "image/png" } }` reads an explicitly supplied absolute local file, and `{ "name": "policy", "value": { "$prepared": "/policy" } }` binds a fresh signing field. File inputs must be required strings without defaults; saved context cannot select a file. The runtime snapshots regular files, rejects symlinks and devices, limits combined file bytes to 16 MiB, sets the multipart boundary, and preserves part order. Put the file last when the observed app requires it. Never copy a captured upload policy or file bytes into a definition.
|
|
53
|
+
Use `request.multipart` for ordered multipart parts, including scalar-only bodies without a file: `{ "name": "label", "value": "" }` preserves an empty scalar, and repeated names remain separate ordered parts. A scalar part bound to an array emits one part per member in order, including duplicates; an empty array or absent optional input emits none. Nested objects require explicit `$json` serialization. The expanded request is limited to 64 parts. Complete scalar-only captures derive this structure; unavailable scalar data does not imply a file. `{ "name": "file", "file": { "input": "file_path", "contentType": "image/png" } }` reads an explicitly supplied absolute local file, and `{ "name": "policy", "value": { "$prepared": "/policy" } }` binds a fresh signing field. File inputs must be required strings without defaults; saved context cannot select a file. The runtime snapshots regular files, rejects symlinks and devices, limits combined file bytes to 16 MiB, sets the multipart boundary, and preserves part order. Put the file last when the observed app requires it. Never copy a captured upload policy or file bytes into a definition.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
An upload-only origin need not provide an unrelated successful public read. For an observed anonymous root denial, its transport probe can declare `expectedStatus: 403` with `request: {method:"HEAD",url:"https://uploads.example/",anonymous:true}` and `response:{}`. Exact observed 401, 403 or 404 statuses are allowed only for anonymous GET/HEAD probes without preparation. This proves origin reachability, not authentication or permission to upload; keep the origin allowlist, private signing preparation and independent upload readback. Without `expectedStatus`, probes still require a successful 2xx response.
|
|
56
|
+
|
|
57
|
+
For signing fields, attachment nonces or protected download links, use `request.prepare: { "private": true, "request": { "method": "GET", "url": "/attachments/prepare" }, "response": { "path": "/upload" } }`. Private browser preparation selects JSON `path`/`fields`; it does not accept a response schema, HTML decoder or continuation. Signing values remain inside the browser and bind scalar multipart fields, query parameters or headers through direct `$prepared` bindings. Private preparation does not support wrapping those bindings in `$json` or arrays; structured preservation uses ordinary preparation. `request.urlFrom: "/url"` selects a prepared destination within the transport's explicit allowed origins. Cross-origin prepared destinations require `request.anonymous: true`, which omits browser cookies and transport authentication from the final request. Preparation retains the app's authentication. It shares the request deadline, refuses redirects, and fails before the primary request if a required field or approved destination is missing.
|
|
56
58
|
|
|
57
59
|
For a signed upload that returns no body, declare `response: { "prepared": { "asset_key": "/fields/key" } }` to retain a resource identifier selected from the prepared result. The pointer addresses the value after preparation `path`/`fields`. Only one to eight bounded scalar identifiers are allowed; signing fields, credentials, copied secrets and URLs are refused before upload. Bind `{result./asset_key}` in the independent proof request, and compare the returned key and usable state. The verified result can supply a later action's input. This requires a private multipart mutation and independent proof. Primary evidence retains only the selected identifiers with the actual HTTP status/body before proof; repair proof or projection against saved evidence without another preparation or upload. Changing a pointer to a field absent from saved evidence remains blocked.
|
|
58
60
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apilift/cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=24.16.0 <27"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1677f5a46094cd0d33d40117e3137dad7017996c",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/egor-sergeev/apilift.git",
|