@forgeintel/sdk 0.5.0-alpha.legacy030.b13 → 0.5.0-alpha.legacy030nested.b13
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/core.js +9 -9
- package/dist/openapi.js +18 -11
- package/dist/x402.js +1 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -8,7 +8,7 @@ import { agentContextAsk, contextIssues, parseAgentContext, takeFromBody, takeFr
|
|
|
8
8
|
import { EventReporter } from "./reporter.js";
|
|
9
9
|
import { captureClientHeaders } from "./client-signals.js";
|
|
10
10
|
import { ISSUES, NOTE_MAX_LENGTH, OUTCOMES, PROTOCOL, parseSubmission } from "./values.js";
|
|
11
|
-
import { challengeOrigin, describeChallenge, describeChallengeBody, describeReceipt, feedbackExtension, paymentOrigin, readPaymentHeader, readReceipt, receiptExtension } from "./x402.js";
|
|
11
|
+
import { FEEDBACK_FIELD, challengeOrigin, describeChallenge, describeChallengeBody, describeReceipt, feedbackExtension, paymentOrigin, readPaymentHeader, readReceipt, receiptExtension } from "./x402.js";
|
|
12
12
|
export const FEEDBACK_HEADERS = { "Cache-Control": "no-store", "X-Robots-Tag": "noindex" };
|
|
13
13
|
/** Max JSON body for POST {basePath}. */
|
|
14
14
|
export const BODY_LIMIT = 8 * 1024;
|
|
@@ -276,7 +276,7 @@ function enabledCore(options, configWarnings) {
|
|
|
276
276
|
protocol: PROTOCOL,
|
|
277
277
|
cost: "free",
|
|
278
278
|
ratings_are_public_at: links.summary,
|
|
279
|
-
feedback_id:
|
|
279
|
+
feedback_id: `Returned by paid responses in the ${FEEDBACK_FIELD} body object (feedback_id) and the Forge-Feedback-Id header.`,
|
|
280
280
|
quick: { method: "GET", url: `${links.rate}?feedback_id=FEEDBACK_ID&outcome=OUTCOME`, optional_param: "issue=ISSUE" },
|
|
281
281
|
detailed: {
|
|
282
282
|
method: "POST",
|
|
@@ -499,16 +499,16 @@ function enabledCore(options, configWarnings) {
|
|
|
499
499
|
body !== null &&
|
|
500
500
|
typeof body === "object" &&
|
|
501
501
|
Object.getPrototypeOf(body) === Object.prototype &&
|
|
502
|
-
!(
|
|
503
|
-
!("feedback_url" in body) &&
|
|
504
|
-
!(rateHint && "rate_this_call" in body) &&
|
|
502
|
+
!(FEEDBACK_FIELD in body) &&
|
|
505
503
|
(allowInjection?.(request.method, request.path, status) ?? true)) {
|
|
506
|
-
//
|
|
504
|
+
// One namespaced object, so the merchant's own fields stay recognizably theirs.
|
|
507
505
|
return {
|
|
508
506
|
...body,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
507
|
+
[FEEDBACK_FIELD]: {
|
|
508
|
+
feedback_id: feedbackId,
|
|
509
|
+
feedback_url: feedbackUrl,
|
|
510
|
+
...(rateHint ? { rate_this_call: rateHint.replaceAll("{feedback_url}", feedbackUrl).replaceAll("{summary_url}", callLinks.summary) } : {}),
|
|
511
|
+
},
|
|
512
512
|
};
|
|
513
513
|
}
|
|
514
514
|
}
|
package/dist/openapi.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// and on any unexpected input return the original document unchanged.
|
|
4
4
|
import { CONTEXT_FIELD, agentContextParameters, agentContextSchema } from "./context.js";
|
|
5
5
|
import { FEEDBACK_ID_PATTERN } from "./id.js";
|
|
6
|
+
import { FEEDBACK_FIELD } from "./x402.js";
|
|
6
7
|
import { ISSUES, NOTE_MAX_LENGTH, OUTCOMES, PROTOCOL } from "./values.js";
|
|
7
8
|
const METHODS = ["get", "put", "post", "delete", "options", "head", "patch", "trace"];
|
|
8
9
|
const ANNOTATIONS = new Set(["$ref", "description", "title", "summary", "example", "examples", "deprecated", "readOnly", "writeOnly", "$comment"]);
|
|
@@ -37,18 +38,24 @@ function resolveRef(doc, ref) {
|
|
|
37
38
|
return undefined;
|
|
38
39
|
}
|
|
39
40
|
function feedbackProperties(rateUrl, hintField = false) {
|
|
40
|
-
// Legacy 0.3.0 shape: flat fields, as in the paid body.
|
|
41
41
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
[FEEDBACK_FIELD]: {
|
|
43
|
+
type: "object",
|
|
44
|
+
description: "Added by Forge to paid responses: how to rate this call. See x-forge-feedback.",
|
|
45
|
+
required: ["feedback_id", "feedback_url"],
|
|
46
|
+
properties: {
|
|
47
|
+
feedback_id: {
|
|
48
|
+
type: "string",
|
|
49
|
+
pattern: FEEDBACK_ID_PATTERN.source,
|
|
50
|
+
description: "Rating ID for this paid call (also sent as the Forge-Feedback-Id header).",
|
|
51
|
+
},
|
|
52
|
+
feedback_url: {
|
|
53
|
+
type: "string",
|
|
54
|
+
format: "uri-reference",
|
|
55
|
+
description: `Quick-rating URL with outcome left blank; outcome values: ${Object.keys(OUTCOMES).join(", ")}. Base: ${rateUrl}`,
|
|
56
|
+
},
|
|
57
|
+
...(hintField ? { rate_this_call: { type: "string", description: "How to rate this paid call in one free request." } } : {}),
|
|
58
|
+
},
|
|
52
59
|
},
|
|
53
60
|
};
|
|
54
61
|
}
|
package/dist/x402.js
CHANGED
|
@@ -50,7 +50,7 @@ export function feedbackExtension(rateUrl, tone = "soft") {
|
|
|
50
50
|
...ASK[tone].extensionExtras,
|
|
51
51
|
rate: `GET ${rateUrl}?feedback_id=FEEDBACK_ID&outcome=fully`,
|
|
52
52
|
outcome: ["fully", "partially", "no"],
|
|
53
|
-
feedback_id:
|
|
53
|
+
feedback_id: `In the paid response body (${FEEDBACK_FIELD}.feedback_id) and the Forge-Feedback-Id header.`,
|
|
54
54
|
payment: "None. Plain GET, not an x402 endpoint.",
|
|
55
55
|
},
|
|
56
56
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeintel/sdk",
|
|
3
|
-
"version": "0.5.0-alpha.
|
|
3
|
+
"version": "0.5.0-alpha.legacy030nested.b13",
|
|
4
4
|
"description": "The Forge SDK for x402 paid APIs: agent feedback, agent context, OpenAPI and challenge enrichment, and passive call signals. Express, Hono, Next.js and fetch handlers. No Forge network request on the merchant response path.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|