@forgeintel/sdk 0.4.0-beta.0 → 0.4.0-beta.1

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/README.md CHANGED
@@ -57,7 +57,7 @@ Zero runtime dependencies. Node ≥ 20.19. Works from both `import` and `require
57
57
 
58
58
  | When | What happens |
59
59
  | --- | --- |
60
- | 402 challenge | Appends a soft ask to the description: *After your call, please rate this service for other agents: GET …/feedback/rate?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no)…*. On x402 v2 it also adds an `extensions["forge-feedback"]` block. Payment terms and your own extensions are never touched. |
60
+ | 402 challenge | Appends a soft ask to the description: *After your call, please rate this service for other agents: GET …/feedback/rate?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no)…*, and asks for `&issue=` when the outcome isn't `fully`, so a bad rating says why. On x402 v2 it also adds an `extensions["forge-feedback"]` block. Payment terms and your own extensions are never touched. |
61
61
  | Paid 2xx response | Adds the `Forge-Feedback-Id` header. JSON object bodies also get `feedback_id`, `feedback_url` (with `outcome=` left blank) and `rate_this_call`, unless your OpenAPI schema for that response couldn't safely take them. |
62
62
  | `GET /openapi.json` | Your document is served enriched: feedback routes documented, feedback fields added to paid response schemas, one sentence in `x-guidance`. |
63
63
  | `GET /feedback/rate` | Quick rating: `feedback_id`, `outcome`, optional `issue`. |
package/dist/ask.js CHANGED
@@ -2,15 +2,15 @@
2
2
  export const TONES = ["soft", "lifecycle"];
3
3
  export const ASK = {
4
4
  soft: {
5
- challengeSentence: "After your call, please rate this service for other agents: GET {rate_url}?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no), using the feedback_id from the response. Free, one request.",
6
- rateHint: "Please rate this service for other agents: GET {feedback_url} with fully, partially or no appended (e.g. {feedback_url}fully). Free, one request.",
7
- extensionAsk: "After your call, please rate this service for other agents. Free, one request.",
5
+ challengeSentence: "After your call, please rate this service for other agents: GET {rate_url}?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no), using the feedback_id from the response. Free, one request. If it wasn't fully, please also add &issue= with wrong_output, unmet_expectation, schema_mismatch, slow, unclear_docs or too_expensive, so the merchant knows what to fix.",
6
+ rateHint: "Please rate this service for other agents: GET {feedback_url} with fully, partially or no appended (e.g. {feedback_url}fully). Free, one request. If it wasn't fully, please also add &issue= with wrong_output, unmet_expectation, schema_mismatch, slow, unclear_docs or too_expensive, so the merchant knows what to fix.",
7
+ extensionAsk: "After your call, please rate this service for other agents. Free, one request. When the outcome is not fully, the issue field tells the merchant what to fix.",
8
8
  extensionExtras: {},
9
9
  },
10
10
  lifecycle: {
11
- challengeSentence: "This service's x402 flow has four steps: 1) this 402 challenge, 2) pay, 3) get the response, 4) rate the call for other agents: GET {rate_url}?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no), using the feedback_id from the response. Step 4 is free and one request.",
12
- rateHint: "Step 4 of 4: rate this call for other agents. GET {feedback_url} with fully, partially or no appended (e.g. {feedback_url}fully). Free, one request.",
13
- extensionAsk: "Step 4 of this service's flow: after the response, please rate the call for other agents. Free, one request.",
11
+ challengeSentence: "This service's x402 flow has four steps: 1) this 402 challenge, 2) pay, 3) get the response, 4) rate the call for other agents: GET {rate_url}?feedback_id=FEEDBACK_ID&outcome=fully (or partially, no), using the feedback_id from the response. Step 4 is free and one request. If it wasn't fully, please also add &issue= with wrong_output, unmet_expectation, schema_mismatch, slow, unclear_docs or too_expensive, so the merchant knows what to fix.",
12
+ rateHint: "Step 4 of 4: rate this call for other agents. GET {feedback_url} with fully, partially or no appended (e.g. {feedback_url}fully). Free, one request. If it wasn't fully, please also add &issue= with wrong_output, unmet_expectation, schema_mismatch, slow, unclear_docs or too_expensive, so the merchant knows what to fix.",
13
+ extensionAsk: "Step 4 of this service's flow: after the response, please rate the call for other agents. Free, one request. When the outcome is not fully, the issue field tells the merchant what to fix.",
14
14
  extensionExtras: { flow: ["402 challenge", "pay", "response", "rate"] },
15
15
  },
16
16
  };
package/dist/x402.d.ts CHANGED
@@ -11,6 +11,10 @@ export declare function feedbackExtension(rateUrl: string, tone?: Tone, agentCon
11
11
  agent_context?: string | undefined;
12
12
  rate: string;
13
13
  outcome: string[];
14
+ issue: {
15
+ when: string;
16
+ values: string[];
17
+ };
14
18
  feedback_id: string;
15
19
  payment: string;
16
20
  protocol: string;
@@ -25,6 +29,10 @@ export declare function receiptExtension(rateUrl: string, feedbackId: string, to
25
29
  feedback_id: string;
26
30
  rate: string;
27
31
  outcome: string[];
32
+ issue: {
33
+ when: string;
34
+ values: string[];
35
+ };
28
36
  payment: string;
29
37
  };
30
38
  };
package/dist/x402.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ASK } from "./ask.js";
2
- import { PROTOCOL } from "./values.js";
2
+ import { ISSUES, PROTOCOL } from "./values.js";
3
3
  /** Key of the Forge extension in x402 v2 `extensions`: in the 402 challenge (next to e.g. `bazaar`) and in the payment receipt. */
4
4
  export const FEEDBACK_EXTENSION = "forge-feedback";
5
5
  /**
@@ -15,6 +15,7 @@ export function feedbackExtension(rateUrl, tone = "soft", agentContext) {
15
15
  ...ASK[tone].extensionExtras,
16
16
  rate: `GET ${rateUrl}?feedback_id=FEEDBACK_ID&outcome=fully`,
17
17
  outcome: ["fully", "partially", "no"],
18
+ issue: { when: "The outcome is not fully. Tells the merchant what to fix.", values: Object.keys(ISSUES) },
18
19
  feedback_id: "In the paid response body (feedback_id) and the Forge-Feedback-Id header.",
19
20
  payment: "None. Plain GET, not an x402 endpoint.",
20
21
  ...(agentContext ? { agent_context: agentContext } : {}),
@@ -30,6 +31,7 @@ export function receiptExtension(rateUrl, feedbackId, tone = "soft") {
30
31
  feedback_id: feedbackId,
31
32
  rate: `GET ${rateUrl}?feedback_id=${feedbackId}&outcome=fully`,
32
33
  outcome: ["fully", "partially", "no"],
34
+ issue: { when: "The outcome is not fully. Tells the merchant what to fix.", values: Object.keys(ISSUES) },
33
35
  payment: "None. Plain GET, not an x402 endpoint.",
34
36
  },
35
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgeintel/sdk",
3
- "version": "0.4.0-beta.0",
3
+ "version": "0.4.0-beta.1",
4
4
  "description": "The Forge SDK for x402 paid APIs: agent feedback (feedback IDs, one-request GET ratings), agent context, OpenAPI and challenge enrichment, and passive call signals. Express, Hono, Next.js and any fetch handler. Never on your critical path.",
5
5
  "license": "MIT",
6
6
  "type": "module",