Files
plugins/packages/search1api/src/feedback.ts
T
wang2 6a2ade35ef search1api 0.1.1: Magpie attribution, reused OAuth client, send_feedback through Search1API (#424)
search1api 0.1.1 (fatwang2):
- Sign-ins carry utm_source=magpie and API requests send User-Agent search1api-magpie/0.1.1.
- The registered public OAuth client and its loopback port are saved in search1api-oauth-client.json (mode 600) and reused. A busy port, another issuer, or a sign-in that doesn't finish leads to a new registration.
- A send_feedback tool posts to Search1API's own POST /feedback with the caller's credential, on the same request path as the other tools, including the OAuth refresh on 401. Its description lists what is sent (message, intent, category, request_id, model) and says Search1API stores it on agentback.app, linked to the signed-in account. The plugin contacts no other host. A report that can't be sent returns a note and doesn't fail the task.

Run at the reviewed head d48c8c8 (sandbox HOME/TMPDIR, Bun 1.4.2):
- bun test packages/search1api/tests: 23 pass, 0 fail
- bun scripts/check.mjs search1api: ok
- PR CI (test, on-npm): pass
- grep of the package: the only host is api.search1api.com (plus 127.0.0.1 for the callback). No hard-coded keys. agentback.app appears only in the description, the README and a test.
- Drove the built plugin against my own loopback fake API:
  - OAuth access revoked (401): POST /feedback with the old bearer, then /token refresh_token, then POST /feedback with the new bearer. Got "Feedback recorded (fb_1)" and auth.set with the new token.
  - Bad API key: a 401 gives "not recorded ... (401)" with no refresh, and the error body is not echoed.
  - Body is exactly {message, intent, category, request_id, agent:{name:"Magpie", model}}, with UA search1api-magpie/0.1.1.
  - Unknown args and a non-string model are refused before any request.
- An unauthenticated probe of the real api.search1api.com: POST /feedback gives 401, and an unknown path gives 404. So the endpoint exists.
- The OAuth client reuse (unchanged since 95f236f) was run by hand in the previous review.

Not tried: a real Search1API account (none available).
2026-10-27 15:44:05 +08:00

23 lines
1.1 KiB
TypeScript

export const CATEGORIES = ["bug", "feature_request", "docs", "other"];
export const DESCRIPTION =
"Report a problem with Search1API: a wrong, empty or incomplete result, an " +
"error you could not resolve, documentation that did not match behavior, or " +
"a capability you needed but Search1API lacks. The report (message, intent, " +
"category, request_id and model) is sent to Search1API's feedback API, which " +
"stores it in Search1API's feedback inbox on agentback.app, linked to the " +
"signed-in Search1API account. Never include credentials, personal data, " +
"file contents, or the user's conversation. Send one report per distinct " +
"problem, after you have worked around or abandoned the step. Do not report " +
"normal successful results. Reporting is free, optional and must not block " +
"the user's task.";
// Search1API's POST /feedback body; the API attaches the caller's account.
export function feedbackBody(args: Record<string, unknown>) {
const { model, ...report } = args;
return {
...report,
agent: { name: "Magpie", ...(model === undefined ? {} : { model }) },
};
}