@awesomate/hosting-mcp 0.16.2 → 0.16.3

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/index.js CHANGED
@@ -39855,12 +39855,13 @@ var HubApiError = class extends Error {
39855
39855
  }
39856
39856
  };
39857
39857
  var REQUEST_TIMEOUT_MS = 15e3;
39858
- async function hubRequest(config3, method, path, jsonBody) {
39858
+ async function hubRequest(config3, method, path, jsonBody, opts = {}) {
39859
39859
  const timeoutMs = method === "GET" ? REQUEST_TIMEOUT_MS : 24e4;
39860
39860
  const controller = new AbortController();
39861
39861
  const timer = setTimeout(() => controller.abort(), timeoutMs);
39862
39862
  const headers = { Authorization: `Bearer ${config3.pat}` };
39863
39863
  if (jsonBody !== void 0) headers["Content-Type"] = "application/json";
39864
+ if (opts.accept) headers.Accept = opts.accept;
39864
39865
  let res;
39865
39866
  try {
39866
39867
  res = await (0, import_undici.fetch)(`${config3.apiBase}${path}`, {
@@ -39907,8 +39908,8 @@ async function hubRequest(config3, method, path, jsonBody) {
39907
39908
  function hubGet(config3, path) {
39908
39909
  return hubRequest(config3, "GET", path);
39909
39910
  }
39910
- function hubPost(config3, path, jsonBody = {}) {
39911
- return hubRequest(config3, "POST", path, jsonBody);
39911
+ function hubPost(config3, path, jsonBody = {}, opts = {}) {
39912
+ return hubRequest(config3, "POST", path, jsonBody, opts);
39912
39913
  }
39913
39914
  function hubPatch(config3, path, jsonBody = {}) {
39914
39915
  return hubRequest(config3, "PATCH", path, jsonBody);
@@ -40072,15 +40073,29 @@ function parseSse(text) {
40072
40073
  }
40073
40074
  return events;
40074
40075
  }
40075
- function renderAnswer(meta, streamedAnswer) {
40076
- const status = typeof meta.status === "string" ? meta.status : streamedAnswer ? "ok" : "error";
40076
+ function renderAnswer(meta, streamedAnswer, streamError = null) {
40077
+ const status = typeof meta.status === "string" ? meta.status : streamError ? "error" : streamedAnswer ? "ok" : "error";
40078
+ const session = typeof meta.session === "string" && meta.session ? { session: meta.session } : {};
40079
+ const fallback = typeof meta.answer_plain === "string" && meta.answer_plain || typeof meta.no_answer_message === "string" && meta.no_answer_message || null;
40080
+ if (status === "error") {
40081
+ return {
40082
+ status: "error",
40083
+ answer: null,
40084
+ platform_error: true,
40085
+ not_in_verified_content: false,
40086
+ detail: streamError ?? (streamedAnswer || null),
40087
+ configured_fallback: fallback,
40088
+ ...session,
40089
+ note: "The knowledge platform failed to answer \u2014 a service problem, NOT a content gap. Do not tell the user their content lacks this. Say the service hit a problem, retry once, and if it persists raise it via awesomate_support. configured_fallback is only what an end customer would have seen meanwhile."
40090
+ };
40091
+ }
40077
40092
  if (status !== "ok") {
40078
- const fallback = typeof meta.answer_plain === "string" && meta.answer_plain || typeof meta.no_answer_message === "string" && meta.no_answer_message || null;
40079
40093
  return {
40080
40094
  status,
40081
40095
  answer: null,
40082
40096
  not_in_verified_content: true,
40083
40097
  configured_fallback: fallback,
40098
+ ...session,
40084
40099
  note: "The knowledge base has no verified answer for this \u2014 relay that honestly (use the configured fallback wording if present). Never fill the gap from memory."
40085
40100
  };
40086
40101
  }
@@ -40097,20 +40112,24 @@ function renderAnswer(meta, streamedAnswer) {
40097
40112
  answer: typeof meta.answer_plain === "string" && meta.answer_plain ? meta.answer_plain : streamedAnswer,
40098
40113
  sources,
40099
40114
  ...typeof meta.score === "number" ? { score: meta.score } : {},
40115
+ ...session,
40100
40116
  note: "Present the answer with its numbered sources \u2014 the citations are the product."
40101
40117
  };
40102
40118
  }
40103
40119
  async function knowledgeAsk(config3, args) {
40104
40120
  try {
40105
- const raw = await hubPost(config3, "/api/knowledge/chat", {
40106
- question: args.question,
40107
- ...args.session ? { session: args.session } : {}
40108
- });
40121
+ const raw = await hubPost(
40122
+ config3,
40123
+ "/api/knowledge/chat",
40124
+ { question: args.question, ...args.session ? { session: args.session } : {} },
40125
+ { accept: "application/json" }
40126
+ );
40109
40127
  if (raw && typeof raw === "object") {
40110
40128
  return renderAnswer(raw, "");
40111
40129
  }
40112
40130
  const events = parseSse(String(raw ?? ""));
40113
40131
  let streamedAnswer = "";
40132
+ let streamError = null;
40114
40133
  let meta = {};
40115
40134
  for (const ev of events) {
40116
40135
  if (ev.event === "answer") streamedAnswer += ev.data;
@@ -40119,9 +40138,16 @@ async function knowledgeAsk(config3, args) {
40119
40138
  meta = { ...meta, ...JSON.parse(ev.data) };
40120
40139
  } catch {
40121
40140
  }
40141
+ } else if (ev.event === "error" && ev.data) {
40142
+ try {
40143
+ const parsed = JSON.parse(ev.data);
40144
+ streamError = typeof parsed.message === "string" ? parsed.message : ev.data;
40145
+ } catch {
40146
+ streamError = ev.data;
40147
+ }
40122
40148
  }
40123
40149
  }
40124
- return renderAnswer(meta, streamedAnswer);
40150
+ return renderAnswer(meta, streamedAnswer, streamError);
40125
40151
  } catch (err) {
40126
40152
  return mapKnowledgeError(err, config3.apiBase);
40127
40153
  }
@@ -41003,7 +41029,7 @@ server.registerTool(
41003
41029
  server.registerTool(
41004
41030
  "awesomate_knowledge_ask",
41005
41031
  {
41006
- description: `Ask the account's knowledge base a question and get the VERIFIED answer with numbered sources (title, locator, url) \u2014 the test surface for 'is my content in there and answering well'. status other than ok means the verified content has no answer: relay that honestly (use the configured fallback wording), never fill the gap from memory \u2014 an honest "it doesn't know" is the feature working. Counts against the monthly answers quota.`,
41032
+ description: `Ask the account's knowledge base a question and get the VERIFIED answer with numbered sources (title, locator, url) \u2014 the test surface for 'is my content in there and answering well'. Read status: ok \u2192 present answer + sources. no_results / failed_validation (not_in_verified_content:true) \u2192 the verified content has no answer: relay that honestly (use configured_fallback), never fill the gap from memory \u2014 an honest "it doesn't know" is the feature working. error (platform_error:true) \u2192 the platform itself failed (model/API/infra): NOT a content gap \u2014 never tell the user their content lacks the answer; retry once, then awesomate_support. Counts against the monthly answers quota.`,
41007
41033
  inputSchema: {
41008
41034
  question: external_exports.string().min(1).max(2e3),
41009
41035
  session: external_exports.string().max(128).optional().describe("Stable id to keep follow-up questions in one conversation thread")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/hosting-mcp",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
4
4
  "description": "Awesomate MCP server \u2014 lets Claude manage your Awesomate WordPress hosting, plan, limits, n8n automations, and build Node/static apps + databases",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -17,8 +17,12 @@ and widgets never see a partial or unvalidated answer.
17
17
  - `status: 'failed_validation'` — the model drafted something that didn't
18
18
  survive the citation gate. The user never sees the draft; treat exactly
19
19
  like no_results.
20
- - `status: 'error'` infrastructure problem; suggest trying again, and
21
- `awesomate_support` if it persists.
20
+ - `status: 'error'` (`platform_error: true`, `not_in_verified_content:
21
+ false`) the platform could not answer at all (model/API/infra outage).
22
+ This says NOTHING about the content: never relay it as "your content
23
+ doesn't cover this". `detail` carries the platform's message when it sent
24
+ one; `configured_fallback` is only what an end customer would have seen
25
+ meanwhile. Retry once; if it persists, `awesomate_support`.
22
26
 
23
27
  ## Rendering citations for humans
24
28