@awesomate/hosting-mcp 0.171.21 → 0.171.28

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
@@ -39886,6 +39886,7 @@ function loadConfig() {
39886
39886
 
39887
39887
  // src/http.ts
39888
39888
  var import_undici = __toESM(require_undici(), 1);
39889
+ import { AsyncLocalStorage } from "node:async_hooks";
39889
39890
 
39890
39891
  // src/scopes.ts
39891
39892
  var R = "hosting:read";
@@ -39991,6 +39992,9 @@ var TOOL_SCOPE = {
39991
39992
  // Support
39992
39993
  awesomate_support: R,
39993
39994
  awesomate_support_change: M,
39995
+ // The account's own help centre: help:write for the reads too (one opt-in permission, HL19).
39996
+ awesomate_help_centre: "help:write",
39997
+ awesomate_help_centre_change: "help:write",
39994
39998
  awesomate_request_build: "requests:write",
39995
39999
  // Knowledge
39996
40000
  awesomate_knowledge_status: KR,
@@ -40449,11 +40453,46 @@ function whoamiPlan(hubPlan, connectPlan) {
40449
40453
  var HUB_HELD_CODES = /* @__PURE__ */ new Set(["browser_only", "owner_sets_url", "owner_sets_access", "owner_sets_number"]);
40450
40454
  var dispatcher = process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy ? new import_undici.EnvHttpProxyAgent() : new import_undici.Agent();
40451
40455
  var clientVersion = "unknown";
40456
+ var clientApp = () => null;
40457
+ var traces = new AsyncLocalStorage();
40452
40458
  function setClientVersion(version2) {
40453
40459
  clientVersion = version2;
40454
40460
  }
40461
+ function setClientApp(fn) {
40462
+ let known = null;
40463
+ clientApp = () => {
40464
+ if (known) return known;
40465
+ const v = fn();
40466
+ if (!v?.name) return null;
40467
+ const name = v.name.trim().toLowerCase().replace(/[^a-z0-9._@+-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64);
40468
+ const version2 = (v.version ?? "").trim().replace(/[^A-Za-z0-9._+-]+/g, "-").slice(0, 32);
40469
+ if (!name || !/^[a-z0-9]/.test(name)) return null;
40470
+ known = `${name}/${version2 && /^[A-Za-z0-9]/.test(version2) ? version2 : "unknown"}`;
40471
+ return known;
40472
+ };
40473
+ }
40474
+ var TRACEPARENT = /^(?:00-(?!0{32})[0-9a-f]{32}-(?!0{16})[0-9a-f]{16}-[0-9a-f]{2}|(?!00|ff)[0-9a-f]{2}-(?!0{32})[0-9a-f]{32}-(?!0{16})[0-9a-f]{16}-[0-9a-f]{2}(?:-.*)?)$/;
40475
+ function traceparentOfCall(args) {
40476
+ const extra = args.length ? args[args.length - 1] : void 0;
40477
+ const meta = extra && typeof extra === "object" ? extra._meta : void 0;
40478
+ return meta && typeof meta === "object" ? meta.traceparent : void 0;
40479
+ }
40480
+ function withTraceparent(traceparent, fn) {
40481
+ const tp = typeof traceparent === "string" ? traceparent.trim().toLowerCase() : "";
40482
+ return TRACEPARENT.test(tp) ? traces.run(tp, fn) : fn();
40483
+ }
40484
+ function currentTraceparent() {
40485
+ return traces.getStore();
40486
+ }
40455
40487
  function authHeaders(config3) {
40456
- return { ...config3.headers, Authorization: `Bearer ${config3.pat}`, "x-awesomate-client": `mcp/${clientVersion}` };
40488
+ const app = clientApp();
40489
+ const trace = currentTraceparent();
40490
+ return {
40491
+ ...config3.headers,
40492
+ Authorization: `Bearer ${config3.pat}`,
40493
+ "x-awesomate-client": app ? `mcp/${clientVersion} ${app}` : `mcp/${clientVersion}`,
40494
+ ...trace ? { traceparent: trace } : {}
40495
+ };
40457
40496
  }
40458
40497
  function retryAfterSeconds(headers, now = Date.now()) {
40459
40498
  const raw = headers.get("retry-after")?.trim();
@@ -40465,6 +40504,7 @@ function retryAfterSeconds(headers, now = Date.now()) {
40465
40504
  const reset = /(?:^|[;,\s])reset=(\d+)/i.exec(headers.get("ratelimit") ?? "");
40466
40505
  return reset ? Number(reset[1]) : null;
40467
40506
  }
40507
+ var SELF_EXPLAINING_CONFLICTS = /* @__PURE__ */ new Set(["needs_documents", "locked"]);
40468
40508
  function inAbout(seconds) {
40469
40509
  if (seconds < 90) return "about a minute";
40470
40510
  if (seconds < 55 * 60) return `about ${Math.round(seconds / 60)} minutes`;
@@ -40574,6 +40614,7 @@ async function hubRequest(config3, method, path, jsonBody, opts = {}) {
40574
40614
  const settingsUrl = body && typeof body === "object" && typeof body.settingsUrl === "string" ? body.settingsUrl : `${chatHub ? hub : "https://hub.awesomate.ai"}/n8n/settings`;
40575
40615
  const instanceUrl = body && typeof body === "object" && typeof body.instanceUrl === "string" ? body.instanceUrl : null;
40576
40616
  hint = ` THIS IS NOT A HUB OUTAGE and not your workflow: the user's own n8n rejected the API key Awesomate has stored. Tell the user to fix it in two steps: (1) in their n8n${instanceUrl ? ` at ${instanceUrl}` : ""}, open Settings \u2192 n8n API and create a new API key; (2) paste it into their Awesomate account at ${settingsUrl} under "New n8n API Key" and save. Then retry. Do not retry before they confirm, and do not investigate hub/Cloudflare status: reads and validation keep working because those never touch their instance.`;
40617
+ } else if (res.status === 409 && typeof code === "string" && SELF_EXPLAINING_CONFLICTS.has(code)) {
40577
40618
  } else if (res.status === 409) {
40578
40619
  hint = " Conflict: the payload carries the specifics (a limit reached, or a prerequisite missing). Read its code field; do not blind-retry.";
40579
40620
  } else if (res.status === 422) {
@@ -40638,11 +40679,156 @@ async function hubUploadFile(config3, path, file) {
40638
40679
  }
40639
40680
  if (!res.ok) {
40640
40681
  const serverMsg = body && typeof body === "object" && "message" in body && typeof body.message === "string" ? body.message : body && typeof body === "object" && "error" in body && typeof body.error === "string" ? body.error : `Upload failed (${res.status})`;
40641
- const hint = res.status === 413 ? " The file exceeds the 100 MB limit. Split it, compress it, or upload it in the hub at Knowledge \u2192 Sources." : res.status === 402 ? " NOTHING was ingested and nothing was purchased: the ingestion allowance is exhausted. State the pack price (1 credit = $100) and let the user decide in the hub." : "";
40682
+ const hint = res.status === 413 ? " The file is over the 100 MB limit. Only video and audio can be bigger (up to 10 GB on Pro). Split or compress it." : res.status === 402 ? " NOTHING was ingested and nothing was purchased: the ingestion allowance is exhausted. State the pack price (1 credit = $100) and let the user decide in the hub." : "";
40642
40683
  throw new HubApiError(`${/[.!?]$/.test(serverMsg) ? serverMsg : `${serverMsg}.`}${hint}`, res.status, body);
40643
40684
  }
40644
40685
  return body;
40645
40686
  }
40687
+ var PartError = class extends Error {
40688
+ constructor(status, message) {
40689
+ super(message);
40690
+ this.status = status;
40691
+ }
40692
+ };
40693
+ var URL_MARGIN_MS = 5 * 6e4;
40694
+ async function putPart(url, localPath, start, end) {
40695
+ const { createReadStream } = await import("node:fs");
40696
+ let res;
40697
+ try {
40698
+ res = await (0, import_undici.fetch)(url, {
40699
+ method: "PUT",
40700
+ headers: { "Content-Length": String(end - start) },
40701
+ body: createReadStream(localPath, { start, end: end - 1 }),
40702
+ duplex: "half",
40703
+ signal: AbortSignal.timeout(20 * 6e4),
40704
+ dispatcher
40705
+ });
40706
+ } catch (err) {
40707
+ throw new PartError(0, err instanceof Error ? err.message : "connection failed");
40708
+ }
40709
+ await res.arrayBuffer().catch(() => void 0);
40710
+ if (!res.ok) throw new PartError(res.status, `storage answered ${res.status}`);
40711
+ }
40712
+ async function sendParts(initial, localPath, refresh) {
40713
+ const { size_bytes: size, part_bytes: partBytes, part_count: partCount } = initial;
40714
+ const urls = new Map(initial.part_urls.map((p) => [p.part, p.url]));
40715
+ let expiresAt = initial.expires_at ? Date.parse(initial.expires_at) : Number.POSITIVE_INFINITY;
40716
+ const stored = new Set(initial.done);
40717
+ const queue = [];
40718
+ for (let p = 1; p <= partCount; p++) if (!stored.has(p)) queue.push(p);
40719
+ let refreshing = null;
40720
+ const fresh = () => refreshing ??= refresh().then((s) => {
40721
+ for (const p of s.part_urls) urls.set(p.part, p.url);
40722
+ for (const p of s.done) stored.add(p);
40723
+ expiresAt = s.expires_at ? Date.parse(s.expires_at) : Number.POSITIVE_INFINITY;
40724
+ }).finally(() => {
40725
+ refreshing = null;
40726
+ });
40727
+ const sendOne = async (part) => {
40728
+ const start = (part - 1) * partBytes;
40729
+ const end = Math.min(size, start + partBytes);
40730
+ for (let attempt = 1; ; attempt++) {
40731
+ if (!urls.has(part) || expiresAt - Date.now() < URL_MARGIN_MS) await fresh();
40732
+ if (stored.has(part)) return;
40733
+ const url = urls.get(part);
40734
+ if (!url) throw new PartError(0, `no address for part ${part}`);
40735
+ try {
40736
+ await putPart(url, localPath, start, end);
40737
+ return;
40738
+ } catch (err) {
40739
+ if (attempt >= 4) throw err;
40740
+ if (err instanceof PartError && err.status === 403) urls.delete(part);
40741
+ else await new Promise((r) => setTimeout(r, 1e3 * 2 ** (attempt - 1)));
40742
+ }
40743
+ }
40744
+ };
40745
+ let stopped = false;
40746
+ const workers = Array.from({ length: Math.max(1, Math.min(initial.concurrency || 3, queue.length)) }, async () => {
40747
+ try {
40748
+ for (let part = queue.shift(); part !== void 0 && !stopped; part = queue.shift()) await sendOne(part);
40749
+ } catch (err) {
40750
+ stopped = true;
40751
+ throw err;
40752
+ }
40753
+ });
40754
+ await Promise.all(workers);
40755
+ }
40756
+ async function readUploadState(file) {
40757
+ try {
40758
+ const { readFile: readFile2 } = await import("node:fs/promises");
40759
+ return JSON.parse(await readFile2(file, "utf8"));
40760
+ } catch {
40761
+ return {};
40762
+ }
40763
+ }
40764
+ async function writeUploadState(file, state) {
40765
+ try {
40766
+ const { mkdir, writeFile } = await import("node:fs/promises");
40767
+ const { dirname: dirname4 } = await import("node:path");
40768
+ await mkdir(dirname4(file), { recursive: true, mode: 448 });
40769
+ await writeFile(file, JSON.stringify(state, null, 2), { mode: 384 });
40770
+ } catch {
40771
+ }
40772
+ }
40773
+ async function hubUploadLargeFile(config3, file, options = {}, opts = {}) {
40774
+ const { homedir: homedir6 } = await import("node:os");
40775
+ const { join: join6 } = await import("node:path");
40776
+ const stateFile = opts.stateFile ?? join6(homedir6(), ".awesomate", "uploads.json");
40777
+ const key = `${config3.apiBase}|${file.localPath}|${file.sizeBytes}|${Math.round(file.mtimeMs)}`;
40778
+ const week = 7 * 24 * 3600 * 1e3;
40779
+ const state = await readUploadState(stateFile);
40780
+ for (const [k, v] of Object.entries(state)) if (!v || Date.now() - v.savedAt > week) delete state[k];
40781
+ let session = null;
40782
+ let resumed = false;
40783
+ if (state[key]) {
40784
+ try {
40785
+ session = await hubPost(config3, "/api/knowledge/uploads/large/resume", {
40786
+ ticket: state[key].ticket,
40787
+ options: {
40788
+ visibility: options.visibility,
40789
+ tags: options.tags,
40790
+ collection_ids: options.collection_ids
40791
+ }
40792
+ });
40793
+ resumed = true;
40794
+ } catch (err) {
40795
+ if (!(err instanceof HubApiError) || ![400, 404, 410].includes(err.status)) throw err;
40796
+ delete state[key];
40797
+ }
40798
+ }
40799
+ if (!session) {
40800
+ session = await hubPost(config3, "/api/knowledge/uploads/large", {
40801
+ ...options,
40802
+ filename: file.filename,
40803
+ mime: file.contentType,
40804
+ size_bytes: file.sizeBytes
40805
+ });
40806
+ state[key] = { ticket: session.ticket, savedAt: Date.now() };
40807
+ await writeUploadState(stateFile, state);
40808
+ }
40809
+ const ticket = session.ticket;
40810
+ const refresh = () => hubPost(config3, "/api/knowledge/uploads/large/resume", { ticket });
40811
+ try {
40812
+ await sendParts(session, file.localPath, refresh);
40813
+ } catch (err) {
40814
+ throw new HubApiError(
40815
+ `The upload stopped part way (${err instanceof Error ? err.message : "connection lost"}). What was sent is kept for 7 days: call this tool again with the same file to carry on.`,
40816
+ 0,
40817
+ null
40818
+ );
40819
+ }
40820
+ let job;
40821
+ try {
40822
+ job = await hubPost(config3, "/api/knowledge/uploads/large/complete", { ticket });
40823
+ } catch (err) {
40824
+ if (!(err instanceof HubApiError) || err.status !== 409) throw err;
40825
+ await sendParts(await refresh(), file.localPath, refresh);
40826
+ job = await hubPost(config3, "/api/knowledge/uploads/large/complete", { ticket });
40827
+ }
40828
+ delete state[key];
40829
+ await writeUploadState(stateFile, state);
40830
+ return { ...job, resumed };
40831
+ }
40646
40832
  function hubGet(config3, path) {
40647
40833
  return hubRequest(config3, "GET", path);
40648
40834
  }
@@ -42069,8 +42255,15 @@ async function knowledgeSearch(config3, args) {
42069
42255
  return mapKnowledgeError(err, config3);
42070
42256
  }
42071
42257
  }
42258
+ function teamScopeNote(audience, scope) {
42259
+ if (audience !== "internal") return null;
42260
+ const s = scope ?? {};
42261
+ if (s.all === true) return null;
42262
+ const narrows = ["source_ids", "tags", "kinds"].some((k) => Array.isArray(s[k]) && s[k].length > 0);
42263
+ return narrows ? null : "This Team agent reads nothing narrower than everything the team can see, so publishing it will be refused (scope_required). Ask the owner which collections it should read and set collectionIds, or, only if they say it should read everything, everything:true.";
42264
+ }
42072
42265
  function touchesScope(args) {
42073
- return Boolean(args.collectionIds || args.kinds || args.sourceIds);
42266
+ return Boolean(args.collectionIds || args.kinds || args.sourceIds || args.everything !== void 0);
42074
42267
  }
42075
42268
  var SCOPE_KEYS = ["source_ids", "tags", "datasets", "kinds", "data_sets", "allow_media", "allow_data"];
42076
42269
  function agentPatchBody(args, currentScope = {}) {
@@ -42083,7 +42276,9 @@ function agentPatchBody(args, currentScope = {}) {
42083
42276
  ...kept,
42084
42277
  ...args.collectionIds ? { tags: [...currentTags.filter((t) => !t.startsWith("collection:")), ...args.collectionIds.map((id) => `collection:${id}`)] } : {},
42085
42278
  ...args.kinds ? { kinds: args.kinds } : {},
42086
- ...args.sourceIds ? { source_ids: args.sourceIds } : {}
42279
+ ...args.sourceIds ? { source_ids: args.sourceIds } : {},
42280
+ // the tick rides in the scope, beside the stored fields (kept above), so it never wipes them
42281
+ ...args.everything !== void 0 ? { all: args.everything } : {}
42087
42282
  };
42088
42283
  }
42089
42284
  return {
@@ -42414,7 +42609,7 @@ async function knowledgeAgents(config3, args) {
42414
42609
  if (!(used.agents ?? []).some((a) => a.agent_id === args.agentId)) {
42415
42610
  return { error: "not_found", detail: "No such agent on this account. Read list for the agent ids." };
42416
42611
  }
42417
- const out2 = await hubDelete(config3, `${base2}/${encodeURIComponent(args.agentId)}`);
42612
+ const out2 = await hubDelete(config3, `${base2}/${encodeURIComponent(args.agentId)}`, { confirm: true });
42418
42613
  return { ...out2, status_note: "Deleted: it no longer answers on any key." };
42419
42614
  }
42420
42615
  if (args.action === "policies") {
@@ -42453,12 +42648,12 @@ async function knowledgeAgents(config3, args) {
42453
42648
  return await hubGet(config3, `/api/knowledge/agents/${encodeURIComponent(args.agentId)}`);
42454
42649
  }
42455
42650
  if (args.action === "create") {
42456
- const scopeArgs = { action: "update", collectionIds: args.collectionIds, kinds: args.kinds, sourceIds: args.sourceIds };
42651
+ const scopeArgs = { action: "update", collectionIds: args.collectionIds, kinds: args.kinds, sourceIds: args.sourceIds, everything: args.everything };
42457
42652
  const withScope = (scope) => {
42458
42653
  const current = scope && typeof scope === "object" && !Array.isArray(scope) ? scope : {};
42459
42654
  return touchesScope(scopeArgs) ? { scope: agentPatchBody(scopeArgs, current).scope } : scope !== void 0 ? { scope } : {};
42460
42655
  };
42461
- const callerFields = agentPatchBody({ ...args, collectionIds: void 0, kinds: void 0, sourceIds: void 0 });
42656
+ const callerFields = agentPatchBody({ ...args, collectionIds: void 0, kinds: void 0, sourceIds: void 0, everything: void 0 });
42462
42657
  let created;
42463
42658
  let sentScope;
42464
42659
  let extra = {};
@@ -42468,7 +42663,10 @@ async function knowledgeAgents(config3, args) {
42468
42663
  const body = { ...draft.proposal, ...callerFields, ...withScope(draft.proposal.scope) };
42469
42664
  sentScope = body.scope;
42470
42665
  created = await hubPost(config3, "/api/knowledge/agents", body);
42471
- extra = { test_questions: draft.test_questions ?? [], status_note: `Created as a private DRAFT serving audience '${args.audience ?? "private"}': test it, then publish when the user approves.` };
42666
+ extra = {
42667
+ test_questions: draft.test_questions ?? [],
42668
+ status_note: `Created as a private DRAFT serving audience '${args.audience ?? "private"}': test it, then publish when the user approves.`
42669
+ };
42472
42670
  } else {
42473
42671
  if (!args.name) return { error: "name (or goal) is required for create" };
42474
42672
  const body = { ...callerFields, name: args.name, ...withScope(void 0) };
@@ -42479,7 +42677,8 @@ async function knowledgeAgents(config3, args) {
42479
42677
  const storedScope = agent.scope && typeof agent.scope === "object" ? agent.scope : sentScope;
42480
42678
  const { collections, byKind } = await libraryShape(config3);
42481
42679
  const warning = draftScopeWarning(String(agent.agent_id ?? ""), storedScope, collections, byKind);
42482
- return { ...created, ...extra, ...warning ? { warning } : {} };
42680
+ const scopeNote = teamScopeNote(agent.audience ?? args.audience, storedScope);
42681
+ return { ...created, ...extra, ...warning ? { warning } : {}, ...scopeNote ? { scope_note: scopeNote } : {} };
42483
42682
  }
42484
42683
  if (args.action === "update") {
42485
42684
  if (!args.agentId) return { error: "agentId is required for update" };
@@ -42488,7 +42687,7 @@ async function knowledgeAgents(config3, args) {
42488
42687
  if (!Object.keys(body).length) {
42489
42688
  return {
42490
42689
  error: "invalid_request",
42491
- note: "update needs at least one of name, description, systemMessage, noAnswerMessage, grounding, audience, collectionIds, kinds, sourceIds, maxSources, temperature"
42690
+ note: "update needs at least one of name, description, systemMessage, noAnswerMessage, grounding, audience, collectionIds, kinds, sourceIds, everything, maxSources, temperature"
42492
42691
  };
42493
42692
  }
42494
42693
  const out2 = await hubPatch(config3, `/api/knowledge/agents/${encodeURIComponent(args.agentId)}`, body);
@@ -42834,9 +43033,9 @@ async function knowledgeFaq(config3, args) {
42834
43033
  }
42835
43034
 
42836
43035
  // src/tools/kit.ts
42837
- import { AsyncLocalStorage } from "node:async_hooks";
43036
+ import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
42838
43037
  var defaultStamp = () => "account: unknown";
42839
- var stamps = new AsyncLocalStorage();
43038
+ var stamps = new AsyncLocalStorage2();
42840
43039
  function setAccountStamp(fn) {
42841
43040
  defaultStamp = fn;
42842
43041
  }
@@ -42927,6 +43126,8 @@ var TITLES = {
42927
43126
  awesomate_tasks_change: "Change your tasks",
42928
43127
  awesomate_support: "Read help and your support tickets",
42929
43128
  awesomate_support_change: "Raise or reply to a support ticket",
43129
+ awesomate_help_centre: "Read your help centre",
43130
+ awesomate_help_centre_change: "Write and publish help centre articles",
42930
43131
  // Destructive: rmSync/writeFileSync under ~/.claude/skills overwrites files
42931
43132
  // on the user's own machine, so it must always prompt.
42932
43133
  awesomate_skill_update: "Update Awesomate skills",
@@ -44017,7 +44218,7 @@ var groups_default = {
44017
44218
  awesomate_knowledge_agent: { group: "knowledge", surface: ["stdio", "chat"] },
44018
44219
  awesomate_knowledge_agent_change: { group: "knowledge", surface: ["stdio"] },
44019
44220
  awesomate_knowledge_agents: { group: "knowledge", surface: ["stdio", "chat"] },
44020
- awesomate_knowledge_agents_change: { group: "knowledge", surface: ["stdio", "chat"], chat: { actions: ["create", "update", "visitor_test"], omit: ["audience"], fixed: { create: { audience: "private" } } } },
44221
+ awesomate_knowledge_agents_change: { group: "knowledge", surface: ["stdio", "chat"], chat: { actions: ["create", "update", "visitor_test"], omit: ["audience", "everything"], fixed: { create: { audience: "private" } } } },
44021
44222
  awesomate_knowledge_ask: { group: "knowledge", surface: ["stdio", "chat"] },
44022
44223
  awesomate_knowledge_collections: { group: "knowledge", surface: ["stdio", "chat"] },
44023
44224
  awesomate_knowledge_collections_change: { group: "knowledge", surface: ["stdio", "chat"], chat: { actions: ["create", "update", "add", "remove"], omit: ["defaultVisibility"], destructive: true, fixed: { create: { defaultVisibility: "private" } }, refuse: { update: ["slug"] } } },
@@ -44075,6 +44276,8 @@ var groups_default = {
44075
44276
  awesomate_snapshot_site: { group: "website", surface: ["stdio"] },
44076
44277
  awesomate_support: { group: "help", surface: ["stdio"] },
44077
44278
  awesomate_support_change: { group: "help", surface: ["stdio"] },
44279
+ awesomate_help_centre: { group: "help", surface: ["stdio"] },
44280
+ awesomate_help_centre_change: { group: "help", surface: ["stdio"] },
44078
44281
  awesomate_support_desk: { group: "contacts", surface: ["stdio"] },
44079
44282
  awesomate_tasks: { group: "account", surface: ["stdio", "chat"] },
44080
44283
  awesomate_tasks_change: { group: "account", surface: ["stdio", "chat"], chat: { actions: ["add", "done", "take", "pass_on", "edit", "drop", "bring_back", "not_now", "cancel_not_now"], whole: true } },
@@ -44342,7 +44545,7 @@ function offeredOn(surface, name) {
44342
44545
  return entry.surface.includes(surface);
44343
44546
  }
44344
44547
  function createRegistrar(server2, surface, config3, stamp, features, opts = {}) {
44345
- const stamped = (cb) => (...args) => withAccountStamp(stamp, () => cb(...args));
44548
+ const stamped = (cb) => (...args) => withAccountStamp(stamp, () => withTraceparent(traceparentOfCall(args), () => cb(...args)));
44346
44549
  const wrap = opts.wrapTool ?? ((h) => h);
44347
44550
  const worded = (def) => surface === "stdio" ? def : wordedForChat(def, (tool, action) => chatOffers(tool, action, opts), (tool) => opts.readOnly || chatSpec(tool)?.whole ? void 0 : chatSpec(tool)?.actions);
44348
44551
  const registerTool = ((name, def, cb) => {
@@ -44380,6 +44583,7 @@ var FILES_ACTIONS = [
44380
44583
  "upload",
44381
44584
  "mkdir",
44382
44585
  "move",
44586
+ "copy",
44383
44587
  "make_public",
44384
44588
  "make_private",
44385
44589
  "delete",
@@ -44424,6 +44628,18 @@ async function localFile(raw) {
44424
44628
  if (!st.isFile()) throw new Error(`${abs} is not a file. Upload one file per call.`);
44425
44629
  return { abs, name: basename2(abs), size: st.size };
44426
44630
  }
44631
+ var FILES_MAX_BATCH = 100;
44632
+ function filesPairs(args) {
44633
+ if (args.items?.length) {
44634
+ if (args.path || args.to) throw new Error("Send either items or path and to, not both: put every move or copy in items.");
44635
+ if (args.items.length > FILES_MAX_BATCH) throw new Error(`At most ${FILES_MAX_BATCH} items in one call; send the rest in another.`);
44636
+ return args.items.map((it, i) => ({ from: filesPath(it.from, `items[${i}].from`), to: filesPath(it.to, `items[${i}].to`) }));
44637
+ }
44638
+ return [{ from: filesPath(args.path, "path"), to: filesPath(args.to, "to") }];
44639
+ }
44640
+ function entersPublic(pair) {
44641
+ return (pair.to === "public" || pair.to.startsWith("public/")) && !pair.from.startsWith("public/");
44642
+ }
44427
44643
  var PUBLIC_NOTE = "A file in public/ can be read by anyone who has its public_url, with no login. Files in private/ and temp/ are never served publicly.";
44428
44644
  async function filesAction(config3, args) {
44429
44645
  switch (args.action) {
@@ -44478,13 +44694,17 @@ async function filesAction(config3, args) {
44478
44694
  }
44479
44695
  case "mkdir":
44480
44696
  return hubPost(config3, "/api/files/mkdir", { path: filesPath(args.path) });
44481
- case "move": {
44482
- const from = filesPath(args.path, "path");
44483
- const to = filesPath(args.to, "to");
44484
- if (to.startsWith("public/") && !from.startsWith("public/") && !args.confirm) {
44485
- throw new Error(`Moving into public/ makes the file readable by anyone with its address. Ask the user first, then call again with confirm: true.`);
44486
- }
44487
- return hubPost(config3, "/api/files/move", { from, to });
44697
+ case "move":
44698
+ case "copy": {
44699
+ const pairs = filesPairs(args);
44700
+ if (pairs.some(entersPublic) && !args.confirm) {
44701
+ const verb = args.action === "copy" ? "Copying" : "Moving";
44702
+ throw new Error(`${verb} into public/ makes the file readable by anyone with its address. Ask the user first, then call again with confirm: true.`);
44703
+ }
44704
+ const route = args.action === "copy" ? "/api/files/copy" : "/api/files/move";
44705
+ const extra = args.action === "copy" && args.overwrite ? { overwrite: true } : {};
44706
+ const body = args.items?.length ? { items: pairs, ...extra } : { ...pairs[0], ...extra };
44707
+ return hubPost(config3, route, body);
44488
44708
  }
44489
44709
  case "make_public": {
44490
44710
  const from = filesPath(args.path);
@@ -46042,6 +46262,7 @@ var KB_UPLOAD_TYPES = {
46042
46262
  ".webp": "image/webp"
46043
46263
  };
46044
46264
  var KB_MAX_UPLOAD_BYTES = 100 * 1024 * 1024;
46265
+ var KB_MAX_MEDIA_BYTES = 10 * 1024 * 1024 * 1024;
46045
46266
  var KB_UNPARSEABLE = /* @__PURE__ */ new Set([".doc", ".docx", ".ppt", ".pptx", ".rtf", ".epub", ".html", ".htm"]);
46046
46267
  var KB_SPREADSHEETS = /* @__PURE__ */ new Set([".csv", ".tsv", ".xls", ".xlsx", ".xlsm", ".json"]);
46047
46268
  var KB_SHEET_KIND_CHOICE = 'Choose with the user, never guess: kind "sheet" makes each row a searchable, citable record, for things a customer asks about (price lists, fee tables, timetables, FAQs, policies, product lists). kind "data-import" builds a reportable dataset for totals and trends (job or invoice history, sales by month), answered by awesomate_knowledge_data; its rows are not searchable passages.';
@@ -46363,7 +46584,7 @@ function registerKnowledge(r) {
46363
46584
  "awesomate_knowledge_agents_change",
46364
46585
  {
46365
46586
  annotations: annotate("awesomate_knowledge_agents_change", DESTRUCTIVE),
46366
- description: "Change the account's knowledge agents (the Knowledge agent builder; a hub agent's actions and skills are drafted with the hub agent tools in Claude Code, not here): 'publish' answers with map (a hint, while the agent is on no role of the business map): build a helper.attach from its map.attach, adding roleId (its suggestedRole, or the role the owner names), declaredLevel and the duty it does, propose it with awesomate_business_map_change, and say it waits for the owner in Tasks. Read them first with awesomate_knowledge_agents (list, get, policies, website_keys), and try a draft there with 'test'. 'create' {goal}: AI drafts the whole setup (instructions, scope, tone, test questions) from the account's own content and saves it as a PRIVATE DRAFT (never live, nothing lost); or {name} for a blank draft. The drafted scope is often too wide: it can come back limited to no collection (so it answers from every business's and every audience's content) or limited to kinds that leave out PDFs (stored as 'book'), FAQs ('faq') or images. Pass collectionIds (and kinds if needed) WITH create to scope it in one step; when the account has collections and the new agent reads none of them, or its kinds skip content the library holds, the result carries a warning listing the collections: fix it with update before testing or publishing. 'update' {agentId, ...fields}: edit the DRAFT config: name, description, systemMessage, noAnswerMessage, grounding, audience, collectionIds (scope to collections from awesomate_knowledge_collections), kinds, sourceIds, maxSources, temperature. Nothing changes for callers until 'publish'. 'visitor_test' {agentId, message (max 2000 chars), sessionId?}: ask the PUBLISHED agent through the real public visitor path, the only way to check what a website visitor actually gets; run it after publishing whenever the agent is public-facing or its scope includes internal/private sources. It works on every plan, and a question it cannot answer lands in the owner's Questions inbox like a real visitor's, so say so before using it. 'publish' {agentId}: makes the draft LIVE immediately for every key bound to the agent: get the user's explicit approval first, and read the version back. 'suspend' / 'resume' {agentId}: stop the agent answering on every key bound to it, or start it again (its last published version); both change what live callers get at once, so get the owner's explicit approval first. 'delete' {agentId, confirm:true}: removes the agent for good and every key bound to it stops answering; tell the owner that and pass confirm:true only after they say yes. 'policy_create' {name, description?, collectionIds?|kinds?|sourceIds?|tags?}: a policy named segment:all or segment:<group> is what an agent's customer groups use, so a person in that group answers only from what it allows; 'policy_update' {policyId, name?|description?|scope fields} (a scope REPLACES the stored one); 'policy_delete', 'policy_suspend', 'policy_resume' {policyId}. Every policy change applies to live callers at once: show the owner what changes and get a yes first. Website chat (owner only; every plan, answers count against the month's Knowledge answers): 'website_key' {agentId, origins, title?, subtitle?, label?, monthlyAnswerCap?, confirm:true}: makes a website key for a PUBLISHED, public-audience agent (refused otherwise, with what to do first) and returns it ONCE with the ready <script> snippet to paste before </body>; anyone on those sites can then ask the agent, and answers count against the account's monthly answers. Each key has its own monthly answer limit (by default half the account's at the time it is made), returned as monthly_answer_cap: tell the user the number. A key's limit cannot be changed later; a different limit is a new key, then revoke the old one. Ask the owner which sites, say what it means, and pass confirm:true only after they say yes. Only https:// sites work. For a site being built on the owner's own computer, pass localPort (the port, 8500 for http://localhost:8500) instead of origins: a separate TEST code for http://localhost and http://127.0.0.1 on that port, never mixed with real sites, that stops by itself after 7 days (stops_at) and counts against the same monthly answers; put it in the local copy only, and make a real key for the live site. 'revoke_website_key' {keyId, confirm:true}: stops the chat on every site using that key at once; ask first. Other keys (for automations and servers) are made in the hub (Knowledge, Agents) and never pass through this tool.",
46587
+ description: `Change the account's knowledge agents (the Knowledge agent builder; a hub agent's actions and skills are drafted with the hub agent tools in Claude Code, not here): 'publish' answers with map (a hint, while the agent is on no role of the business map): build a helper.attach from its map.attach, adding roleId (its suggestedRole, or the role the owner names), declaredLevel and the duty it does, propose it with awesomate_business_map_change, and say it waits for the owner in Tasks. Read them first with awesomate_knowledge_agents (list, get, policies, website_keys), and try a draft there with 'test'. 'create' {goal}: AI drafts the whole setup (instructions, scope, tone, test questions) from the account's own content and saves it as a PRIVATE DRAFT (never live, nothing lost); or {name} for a blank draft. The drafted scope is often too wide: it can come back limited to no collection (so it answers from every business's and every audience's content) or limited to kinds that leave out PDFs (stored as 'book'), FAQs ('faq') or images. Pass collectionIds (and kinds if needed) WITH create to scope it in one step; when the account has collections and the new agent reads none of them, or its kinds skip content the library holds, the result carries a warning listing the collections: fix it with update before testing or publishing. 'update' {agentId, ...fields}: edit the DRAFT config: name, description, systemMessage, noAnswerMessage, grounding, audience, collectionIds (scope to collections from awesomate_knowledge_collections), kinds, sourceIds, everything, maxSources, temperature. A Team ('internal') agent goes live (publish, resume) only with collectionIds, kinds or sourceIds set, or with everything:true, the user's explicit "Everything your team can see" choice (never set it on your own); otherwise publish and resume answer 400 scope_required: ask the owner which collections it should read (or whether it really should read everything the team can see), update, then publish. A create from a goal for a Team agent with no scope says so in scope_note. An agent already live with no scope is not changed: list and get mark it reads_everything; tell the owner and offer to scope it. Nothing changes for callers until 'publish'. 'visitor_test' {agentId, message (max 2000 chars), sessionId?}: ask the PUBLISHED agent through the real public visitor path, the only way to check what a website visitor actually gets; run it after publishing whenever the agent is public-facing or its scope includes internal/private sources. It works on every plan, and a question it cannot answer lands in the owner's Questions inbox like a real visitor's, so say so before using it. 'publish' {agentId}: makes the draft LIVE immediately for every key bound to the agent: get the user's explicit approval first, and read the version back. 'suspend' / 'resume' {agentId}: stop the agent answering on every key bound to it, or start it again (its last published version); both change what live callers get at once, so get the owner's explicit approval first. 'delete' {agentId, confirm:true}: the account owner's alone (their own sign-in or Claude Code key; a team member, staff or a chat connection gets owner_only). Only for an agent that lives in Knowledge alone: it deletes it for good and every key bound to it stops answering; tell the owner that and pass confirm:true only after they say yes. An agent on the Agents page answers use_remove: the owner removes it there instead (Remove on the Agents page, or the hub agent tools' remove in Claude Code), which they can undo for 30 days. 'policy_create' {name, description?, collectionIds?|kinds?|sourceIds?|tags?}: a policy named segment:all or segment:<group> is what an agent's customer groups use, so a person in that group answers only from what it allows; 'policy_update' {policyId, name?|description?|scope fields} (a scope REPLACES the stored one); 'policy_delete', 'policy_suspend', 'policy_resume' {policyId}. Policy changes are the account owner's (a team member gets owner_only). Every policy change applies to live callers at once: show the owner what changes and get a yes first. Website chat (owner only; every plan, answers count against the month's Knowledge answers): 'website_key' {agentId, origins, title?, subtitle?, label?, monthlyAnswerCap?, confirm:true}: makes a website key for a PUBLISHED, public-audience agent (refused otherwise, with what to do first) and returns it ONCE with the ready <script> snippet to paste before </body>; anyone on those sites can then ask the agent, and answers count against the account's monthly answers. Each key has its own monthly answer limit (by default half the account's at the time it is made), returned as monthly_answer_cap: tell the user the number. A key's limit cannot be changed later; a different limit is a new key, then revoke the old one. Ask the owner which sites, say what it means, and pass confirm:true only after they say yes. Only https:// sites work. For a site being built on the owner's own computer, pass localPort (the port, 8500 for http://localhost:8500) instead of origins: a separate TEST code for http://localhost and http://127.0.0.1 on that port, never mixed with real sites, that stops by itself after 7 days (stops_at) and counts against the same monthly answers; put it in the local copy only, and make a real key for the live site. 'revoke_website_key' {keyId, confirm:true}: stops the chat on every site using that key at once; ask first. Other keys (for automations and servers) are made in the hub (Knowledge, Agents) and never pass through this tool.`,
46367
46588
  inputSchema: {
46368
46589
  action: splitActions([...KNOWLEDGE_AGENTS_CHANGES], KNOWLEDGE_AGENTS_READS, "awesomate_knowledge_agents"),
46369
46590
  confirm: external_exports.boolean().optional().describe("delete, website_key, revoke_website_key: true only after the owner said yes"),
@@ -46387,6 +46608,7 @@ function registerKnowledge(r) {
46387
46608
  collectionIds: external_exports.array(external_exports.string().max(64)).max(16).optional().describe("create/update: scope the agent to these collections (collection_id from awesomate_knowledge_collections list); replaces the collection scope only, other scope fields and free-form tags are kept. policy_create/update: the collections the policy allows"),
46388
46609
  kinds: external_exports.array(external_exports.string().max(40)).max(16).optional().describe("create/update: restrict retrieval to source kinds (web, document, video, audio, image, book, faq, dataset; PDFs are stored as 'book'); omit for all kinds. policy_create/update: the kinds the policy allows"),
46389
46610
  sourceIds: external_exports.array(external_exports.string().max(200)).max(500).optional().describe("create/update, policy_create/update: pin the scope to specific sources"),
46611
+ everything: external_exports.boolean().optional().describe(`create/update: a Team ('internal') agent's "Everything your team can see" tick. A Team agent with no collectionIds, kinds or sourceIds is published or resumed only with this true (else 400 scope_required). Anyone who may edit the agent can set it, so set it only when the user has said in words that the agent should read everything the team can see; prefer collections. false clears it`),
46390
46612
  maxSources: external_exports.number().int().min(1).max(10).optional().describe("create/update: how many sources one answer may cite (1-10)"),
46391
46613
  temperature: external_exports.number().min(0).max(1).optional().describe("create/update: 0 is the most literal"),
46392
46614
  message: external_exports.string().max(4e3).optional().describe("visitor_test: the question a visitor asks the published agent (max 2000 characters)"),
@@ -46529,17 +46751,18 @@ function registerKnowledge(r) {
46529
46751
  "awesomate_files",
46530
46752
  {
46531
46753
  annotations: annotate("awesomate_files", DESTRUCTIVE),
46532
- description: "The account's Files: the folders on their automation account (n8n) that workflows read and write, and that the hub shows at Knowledge, Files. Three top folders: public/ (every file has a public_url anyone can open with no login: images for a site or email, downloads, media a workflow made), private/ (only the account, its workflows and the hub) and temp/ (scratch space). Support Plus, Pro and Embedded; the owner must also have switched on \"Open your automation account's file folders\" in Settings, Privacy. Paths are relative to the files folder and start with the top folder, e.g. public/images/logo.png. action 'status': whether Files is on, why not, and storage used against the plan's limit: call this first. 'list' {path?}: one folder (no path = the top folders); files in public/ carry public_url. 'search' {q?, top?, exts?}: find files by name across the folders (first 200 matches; truncated:true means narrow it). 'download' {path, to?, overwrite?}: save a file to THIS computer (to = a local file or folder, default the working directory); never overwrites without overwrite:true. 'upload' {localPath, path, overwrite?}: send a file from this computer (max 50 MB each); path is the target file, or a folder ending in / to keep the name. Upload into public/ only when the user wants it publicly reachable. 'mkdir' {path}. 'move' {path, to}: rename or move; moving into public/ needs confirm:true. 'make_public' {path, confirm:true}: moves private/ or temp/ to the same place under public/ and returns its public_url: ASK the user first, anyone with the address can read it. 'make_private' {path}: moves it out of public/; its public address stops serving it within seconds (the hub clears Cloudflare's copy, and does the same after a delete or a replace), though a browser that already opened it may show its own copy until it expires, and a downloaded copy is not recalled. 'delete' {path, confirm:true}: moves to the trash (not erased); ask first. 'trash': what is in the trash, when each was deleted, and its total size. 'empty_trash' {olderThanDays?, confirm:true}: erases what is in the trash for good (or only what was deleted more than olderThanDays ago): the one thing here that cannot be undone, so show the user what will go and get a clear yes first. Moving or renaming changes the path, so tell the user any workflow, page or app using the old path or address needs the new one. 'extract' {path}: unpack a .zip into a folder beside it, named after it. 'context_scan' {path}: read one file (a brochure, an about-us document) and propose business details from it, saving nothing: `fill` are details not saved yet, `conflict` differ from what is saved; it needs the owner's Learn Business Context from My Files switch in Settings, Privacy. Saving those details is the owner's own click in the hub (Files, the file's menu, Scan for business context), never Claude's. Contents stream between this computer and the hub: never paste a file's contents into the conversation to move it. A 507 files_storage_full means the plan's Files allowance is used: say how much, offer to find large or old files to remove, and leave any plan change to the user.",
46754
+ description: "The account's Files: the folders on their automation account (n8n) that workflows read and write, and that the hub shows at Knowledge, Files. Three top folders: public/ (every file has a public_url anyone can open with no login: images for a site or email, downloads, media a workflow made), private/ (only the account, its workflows and the hub) and temp/ (scratch space). Support Plus, Pro and Embedded; the owner must also have switched on \"Open your automation account's file folders\" in Settings, Privacy. Paths are relative to the files folder and start with the top folder, e.g. public/images/logo.png. action 'status': whether Files is on, why not, and storage used against the plan's limit: call this first. 'list' {path?}: one folder (no path = the top folders); files in public/ carry public_url. 'search' {q?, top?, exts?}: find files by name across the folders (first 200 matches; truncated:true means narrow it). 'download' {path, to?, overwrite?}: save a file to THIS computer (to = a local file or folder, default the working directory); never overwrites without overwrite:true. 'upload' {localPath, path, overwrite?}: send a file from this computer (max 50 MB each); path is the target file, or a folder ending in / to keep the name. Upload into public/ only when the user wants it publicly reachable. 'mkdir' {path}. 'move' {path, to}, or {items:[{from, to}]} for up to 100 at once: rename or move; a to ending in / (or a bare top folder) keeps the name; moving into public/ needs confirm:true. 'copy' {path, to, overwrite?} or {items}: copy files or folders (up to 200 files and 250 MB a call), same rules; copying into public/ needs confirm:true. A list answers each item in results. 'make_public' {path, confirm:true}: moves private/ or temp/ to the same place under public/ and returns its public_url: ASK the user first, anyone with the address can read it. 'make_private' {path}: moves it out of public/; its public address stops serving it within seconds (the hub clears Cloudflare's copy, and does the same after a delete or a replace), though a browser that already opened it may show its own copy until it expires, and a downloaded copy is not recalled. 'delete' {path, confirm:true}: moves to the trash (not erased); ask first. 'trash': what is in the trash, when each was deleted, and its total size. 'empty_trash' {olderThanDays?, confirm:true}: erases what is in the trash for good (or only what was deleted more than olderThanDays ago): the one thing here that cannot be undone, so show the user what will go and get a clear yes first. Moving or renaming changes the path, so tell the user any workflow, page or app using the old path or address needs the new one. 'extract' {path}: unpack a .zip into a folder beside it, named after it. 'context_scan' {path}: read one file (a brochure, an about-us document) and propose business details from it, saving nothing: `fill` are details not saved yet, `conflict` differ from what is saved; it needs the owner's Learn Business Context from My Files switch in Settings, Privacy. Saving those details is the owner's own click in the hub (Files, the file's menu, Scan for business context), never Claude's. Contents stream between this computer and the hub: never paste a file's contents into the conversation to move it. A 507 files_storage_full means the plan's Files allowance is used: say how much, offer to find large or old files to remove, and leave any plan change to the user.",
46533
46755
  inputSchema: {
46534
46756
  action: external_exports.enum(FILES_ACTIONS),
46535
46757
  path: external_exports.string().max(1024).optional().describe("A path in Files, starting public/, private/ or temp/. For upload, the target (a folder ending in / keeps the local name)."),
46536
- to: external_exports.string().max(4096).optional().describe("move: the new Files path. download: where to save on this computer (file or folder; ~ expands)."),
46758
+ to: external_exports.string().max(4096).optional().describe("move, copy: the new Files path, or a folder ending in / to keep the name. download: where to save on this computer (file or folder; ~ expands)."),
46759
+ items: external_exports.array(external_exports.object({ from: external_exports.string().max(1024), to: external_exports.string().max(1024) })).min(1).max(100).optional().describe("move, copy: several at once, each { from, to } with the same rules as path and to."),
46537
46760
  localPath: external_exports.string().max(4096).optional().describe("upload: the file on this computer (~ expands; prefer an absolute path)."),
46538
46761
  q: external_exports.string().max(200).optional().describe("search: part of a file name (* and ? work as wildcards)."),
46539
46762
  top: external_exports.enum(["public", "private", "temp"]).optional().describe("search: only this top folder."),
46540
46763
  exts: external_exports.array(external_exports.string().regex(/^\.[a-z0-9]+$/i)).max(20).optional().describe('search: only these extensions, e.g. [".png", ".jpg"].'),
46541
- overwrite: external_exports.boolean().optional().describe("upload: replace a file already at path. download: replace a local file."),
46542
- confirm: external_exports.boolean().optional().describe("true only after the user agreed: make_public, delete, empty_trash, and a move into public/."),
46764
+ overwrite: external_exports.boolean().optional().describe("upload, copy: replace a file already there. download: replace a local file."),
46765
+ confirm: external_exports.boolean().optional().describe("true only after the user agreed: make_public, delete, empty_trash, and a move or copy into public/."),
46543
46766
  olderThanDays: external_exports.number().int().min(1).max(3650).optional().describe("empty_trash: only what was deleted more than this many days ago. Leave out to empty everything.")
46544
46767
  }
46545
46768
  },
@@ -46697,7 +46920,7 @@ function registerKnowledge(r) {
46697
46920
  "awesomate_knowledge_upload",
46698
46921
  {
46699
46922
  annotations: annotate("awesomate_knowledge_upload", MUTATING),
46700
- description: `Ingest ONE file from the user's own computer into their Knowledge Base. Pass a LOCAL PATH: this server runs on their machine and streams the file to the hub itself, so the file contents never pass through the conversation. Handles documents (pdf, md, txt), spreadsheets (csv, tsv, xls, xlsx, xlsm, json; these NEED kind, see below), audio and video (transcribed, Pro and above), and images (OCR, Pro and above). Word/PowerPoint/RTF/EPUB files are NOT parseable yet: the tool refuses them with the workaround (export to PDF, or save as .md/.txt). Max 100 MB per file; bigger media goes through the hub's Knowledge \u2192 Sources page. SPREADSHEETS: pass kind, or the tool refuses before uploading. kind 'sheet' makes each row a searchable, citable record: price lists, fee tables, timetables, FAQs, policies, product lists, anything a customer asks about. kind 'data-import' builds a reportable dataset for totals and trends: job or invoice history, sales by month, read with awesomate_knowledge_data. If it is not obvious which the user wants, ask them; never guess. The same goes for a spreadsheet in the File Manager (fromFilesPath): pass kind with it. The source's title comes from the filename, slugified (spaces, punctuation and non-ASCII letters become _), even when title is passed; fix it afterwards with awesomate_knowledge_sources_change {action:'rename'}. visibility 'public' publishes the file, so it needs confirm: the account slug, passed only after the user agreed in so many words (the same rule as awesomate_knowledge_sources_change add). INGESTING COSTS MONEY and counts against the monthly allowance, so ALWAYS get explicit approval for the specific file(s) first and say what it will consume. For several files, call once per file and report progress; do not loop silently. Returns a job with its live status; poll awesomate_knowledge_sources {action:'jobs'} until it succeeds (a duplicate upload replays the earlier job, and a response already reading succeeded needs no polling), then probe the content with awesomate_knowledge_ask before building anything on it. RE-UPLOADING an updated file: the platform names a source from the file name, so a changed title that slugifies differently ("Ember & Leaf" against "Ember and Leaf") makes a DUPLICATE beside the old source. It updates in place only when the name slugifies the same, or when you pass replaceSourceId (the old source_id from awesomate_knowledge_sources list): then the hub sends the file under the matching name and the source keeps its id, citations, visibility, tags and collections (a custom title set with rename may need setting again afterwards). When an upload looks like an existing source the response carries a warning and similar_sources: tell the user, and if it is the same document, remove the new duplicate and upload again with replaceSourceId. A pack_required response means the allowance is exhausted: nothing was ingested and nothing was purchased.`,
46923
+ description: `Ingest ONE file from the user's own computer into their Knowledge Base. Pass a LOCAL PATH: this server runs on their machine and streams the file to the hub itself, so the file contents never pass through the conversation. Handles documents (pdf, md, txt), spreadsheets (csv, tsv, xls, xlsx, xlsm, json; these NEED kind, see below), audio and video (transcribed, Pro and above), and images (OCR, Pro and above). Word/PowerPoint/RTF/EPUB files are NOT parseable yet: the tool refuses them with the workaround (export to PDF, or save as .md/.txt). Max 100 MB per file, except video and audio, which can be up to 10 GB (Pro): those are sent in 64 MB parts straight from this machine to storage, and if the upload stops (closed laptop, lost connection) calling the tool again with the same file carries on where it stopped (parts are kept 7 days). A big upload takes a while; tell the user before starting. SPREADSHEETS: pass kind, or the tool refuses before uploading. kind 'sheet' makes each row a searchable, citable record: price lists, fee tables, timetables, FAQs, policies, product lists, anything a customer asks about. kind 'data-import' builds a reportable dataset for totals and trends: job or invoice history, sales by month, read with awesomate_knowledge_data. If it is not obvious which the user wants, ask them; never guess. The same goes for a spreadsheet in the File Manager (fromFilesPath): pass kind with it. The source's title comes from the filename, slugified (spaces, punctuation and non-ASCII letters become _), even when title is passed; fix it afterwards with awesomate_knowledge_sources_change {action:'rename'}. visibility 'public' publishes the file, so it needs confirm: the account slug, passed only after the user agreed in so many words (the same rule as awesomate_knowledge_sources_change add). INGESTING COSTS MONEY and counts against the monthly allowance, so ALWAYS get explicit approval for the specific file(s) first and say what it will consume. For several files, call once per file and report progress; do not loop silently. Returns a job with its live status; poll awesomate_knowledge_sources {action:'jobs'} until it succeeds (a duplicate upload replays the earlier job, and a response already reading succeeded needs no polling), then probe the content with awesomate_knowledge_ask before building anything on it. RE-UPLOADING an updated file: the platform names a source from the file name, so a changed title that slugifies differently ("Ember & Leaf" against "Ember and Leaf") makes a DUPLICATE beside the old source. It updates in place only when the name slugifies the same, or when you pass replaceSourceId (the old source_id from awesomate_knowledge_sources list): then the hub sends the file under the matching name and the source keeps its id, citations, visibility, tags and collections (a custom title set with rename may need setting again afterwards). When an upload looks like an existing source the response carries a warning and similar_sources: tell the user, and if it is the same document, remove the new duplicate and upload again with replaceSourceId. A pack_required response means the allowance is exhausted: nothing was ingested and nothing was purchased.`,
46701
46924
  inputSchema: {
46702
46925
  path: external_exports.string().min(1).max(4096).optional().describe("Path to the file on the user's machine (~ is expanded). Omit when using fromFilesPath."),
46703
46926
  fromFilesPath: external_exports.string().max(1024).optional().describe("Instead of a local file: a path in the account's File Manager (their n8n file system), relative to files/, e.g. 'public/reports/weekly.md'. The hub streams it from their storage: nothing leaves this machine."),
@@ -46760,14 +46983,15 @@ function registerKnowledge(r) {
46760
46983
  }
46761
46984
  if (!st.isFile()) return errorResult(new Error(`${abs} is not a regular file.`));
46762
46985
  if (st.size === 0) return errorResult(new Error(`${abs} is empty: nothing to ingest.`));
46763
- if (st.size > KB_MAX_UPLOAD_BYTES) {
46986
+ const ext = extname(abs).toLowerCase();
46987
+ const isMedia = /^(video|audio)\//.test(KB_UPLOAD_TYPES[ext] ?? "");
46988
+ if (st.size > (isMedia ? KB_MAX_MEDIA_BYTES : KB_MAX_UPLOAD_BYTES)) {
46764
46989
  return errorResult(
46765
46990
  new Error(
46766
- `${basename2(abs)} is ${(st.size / 1024 / 1024).toFixed(1)} MB, over the 100 MB limit. Split or compress it, or have the user upload it in the hub at Knowledge \u2192 Sources.`
46991
+ isMedia ? `${basename2(abs)} is ${(st.size / 1024 ** 3).toFixed(1)} GB, over the 10 GB limit for video and audio. Split the recording into parts and upload each one.` : `${basename2(abs)} is ${(st.size / 1024 / 1024).toFixed(1)} MB, over the 100 MB limit (only video and audio can be bigger, up to 10 GB). Split or compress it.`
46767
46992
  )
46768
46993
  );
46769
46994
  }
46770
- const ext = extname(abs).toLowerCase();
46771
46995
  if (KB_UNPARSEABLE.has(ext)) {
46772
46996
  return errorResult(
46773
46997
  new Error(
@@ -46783,6 +47007,13 @@ function registerKnowledge(r) {
46783
47007
  )
46784
47008
  );
46785
47009
  }
47010
+ if (replaceSourceId && st.size > KB_MAX_UPLOAD_BYTES) {
47011
+ return errorResult(
47012
+ new Error(
47013
+ `replaceSourceId is not supported for recordings over 100 MB: they go up in parts as a new source. Remove the old source first (awesomate_knowledge_sources_change), then upload again without replaceSourceId. Nothing was uploaded.`
47014
+ )
47015
+ );
47016
+ }
46786
47017
  const contentType = KB_UPLOAD_TYPES[ext] ?? "application/octet-stream";
46787
47018
  const filename = title?.trim() ? `${title.trim()}${ext}` : basename2(abs);
46788
47019
  const uploadQuery = new URLSearchParams();
@@ -46793,14 +47024,23 @@ function registerKnowledge(r) {
46793
47024
  for (const c of collectionIds ?? []) uploadQuery.append("collection_ids", c);
46794
47025
  if (replaceSourceId) uploadQuery.set("replace_source_id", replaceSourceId);
46795
47026
  const uploadQs = uploadQuery.toString();
46796
- const result = await hubUploadFile(r.config(), `/api/knowledge/sources${uploadQs ? `?${uploadQs}` : ""}`, {
47027
+ const result = st.size > KB_MAX_UPLOAD_BYTES ? await hubUploadLargeFile(
47028
+ r.config(),
47029
+ { localPath: abs, filename, contentType, sizeBytes: st.size, mtimeMs: st.mtimeMs },
47030
+ {
47031
+ ...visibility ? { visibility } : {},
47032
+ ...visibility === "public" && confirm ? { confirm } : {},
47033
+ ...tags?.length ? { tags } : {},
47034
+ ...collectionIds?.length ? { collection_ids: collectionIds } : {}
47035
+ }
47036
+ ) : await hubUploadFile(r.config(), `/api/knowledge/sources${uploadQs ? `?${uploadQs}` : ""}`, {
46797
47037
  localPath: abs,
46798
47038
  filename,
46799
47039
  contentType
46800
47040
  });
46801
47041
  const body = result;
46802
47042
  const jobStatus = typeof body.status === "string" ? body.status : "queued";
46803
- const replayNote = body.replayed === true ? "This file matched an earlier upload, so the platform replayed that job instead of ingesting it twice. " : "";
47043
+ const replayNote = (body.resumed === true ? "Carried on from where an earlier upload of this file stopped. " : "") + (body.replayed === true ? "This file matched an earlier upload, so the platform replayed that job instead of ingesting it twice. " : "");
46804
47044
  const note = jobStatus === "succeeded" ? `${replayNote}Already ingested: the job has SUCCEEDED, do not poll for it. Verify with awesomate_knowledge_ask before building on it.` : jobStatus === "failed" || jobStatus === "cancelled" ? `${replayNote}The job reports ${jobStatus}: read its error via awesomate_knowledge_sources {action:"jobs"}. A job that fails during processing creates no source row, so summary counts stay clean (only failed_jobs_7d shows it).` : `${replayNote}${jobStatus === "running" ? "Ingesting now" : "Queued"}: NOT yet ingested. Poll awesomate_knowledge_sources {action:"jobs"} and read the job's status AND error: a job that fails during processing creates no source row, so summary counts stay clean (only its failed_jobs_7d field shows it). Big media is transcribed and can take a while. Only after the job reports succeeded, verify with awesomate_knowledge_ask before building on it.`;
46805
47045
  return knowledgeResult({
46806
47046
  ...body,
@@ -48827,6 +49067,101 @@ function registerHelp(r) {
48827
49067
  },
48828
49068
  SUPPORT_CHANGE_HALF.guard(support)
48829
49069
  );
49070
+ const HELP_READS = ["centre", "articles", "article"];
49071
+ const HELP_CHANGES = ["create_topic", "create_article", "update_article", "publish", "unpublish", "archive"];
49072
+ const helpShape = {
49073
+ action: external_exports.enum([...HELP_READS, ...HELP_CHANGES]),
49074
+ id: external_exports.string().uuid().optional().describe("article, update_article, publish, unpublish, archive: the article id from articles"),
49075
+ status: external_exports.enum(["draft", "published", "archived"]).optional().describe("articles: only this status"),
49076
+ q: external_exports.string().max(200).optional().describe("articles: words in the title"),
49077
+ name: external_exports.string().max(200).optional().describe("create_topic: the topic name"),
49078
+ description: external_exports.string().max(500).nullable().optional().describe("create_topic: one line about the topic"),
49079
+ title: external_exports.string().max(200).optional().describe("create_article, update_article: the title"),
49080
+ slug: external_exports.string().max(120).optional().describe("create_article, update_article: the address part; made from the title when left out, fixed once published"),
49081
+ summary: external_exports.string().max(500).nullable().optional().describe("create_article, update_article: one or two sentences shown under the title"),
49082
+ body: external_exports.string().optional().describe('create_article, update_article: the article in Markdown. Leave a "[CHECK: ...]" note wherever a fact needs a person to confirm it: publishing is refused while one is there'),
49083
+ segments: external_exports.array(external_exports.string()).max(8).optional().describe("create_article, update_article: who it is for, ['all'] (default) or names from centre's segments"),
49084
+ topicId: external_exports.string().uuid().nullable().optional().describe("create_article, update_article: the topic id from centre"),
49085
+ confirm: external_exports.boolean().optional().describe("publish, unpublish, archive: true only after the user said yes to that change to the public pages")
49086
+ };
49087
+ const helpCentre = async (a) => {
49088
+ try {
49089
+ const cfg = r.config();
49090
+ const base2 = "/api/my-help/v1";
49091
+ if (a.action === "centre") {
49092
+ const { articles: _a, ...rest } = await hubGet(cfg, `${base2}/?articles=0`);
49093
+ return textResult(rest);
49094
+ }
49095
+ if (a.action === "articles") {
49096
+ const q2 = new URLSearchParams();
49097
+ if (a.status) q2.set("status", a.status);
49098
+ if (a.q) q2.set("q", a.q);
49099
+ const qs = q2.toString();
49100
+ const { articles } = await hubGet(cfg, `${base2}/${qs ? `?${qs}` : ""}`);
49101
+ return textResult({ articles });
49102
+ }
49103
+ if (a.action === "create_topic") {
49104
+ if (!a.name?.trim()) return errorResult(new Error("create_topic needs name."));
49105
+ return textResult(await hubPost(cfg, `${base2}/topics`, { name: a.name, ...a.description !== void 0 ? { description: a.description } : {} }));
49106
+ }
49107
+ const fields = Object.fromEntries(
49108
+ ["title", "slug", "summary", "body", "segments", "topicId"].filter((k) => a[k] !== void 0).map((k) => [k, a[k]])
49109
+ );
49110
+ if (a.action === "create_article") {
49111
+ if (!a.title?.trim() || !a.body?.trim()) return errorResult(new Error("create_article needs title and body. Nothing was sent."));
49112
+ return textResult(await hubPost(cfg, `${base2}/articles`, fields));
49113
+ }
49114
+ if (!a.id) return errorResult(new Error(`${a.action} needs id, the article's id from articles.`));
49115
+ const path = `${base2}/articles/${encodeURIComponent(a.id)}`;
49116
+ if (a.action === "article") return textResult(await hubGet(cfg, path));
49117
+ if (a.action === "update_article") {
49118
+ if (!Object.keys(fields).length) return errorResult(new Error("update_article needs at least one of title, slug, summary, body, segments, topicId."));
49119
+ return textResult(await hubPatch(cfg, path, fields));
49120
+ }
49121
+ if (a.action === "publish") {
49122
+ if (a.confirm !== true) {
49123
+ return errorResult(new Error("publish makes the article public on the help centre and sends it to the business's Knowledge. Show the user the title and what will go live, get an explicit yes, then call again with confirm: true. Nothing was sent."));
49124
+ }
49125
+ return textResult(await hubPost(cfg, `${path}/publish`, {}));
49126
+ }
49127
+ if (a.action === "unpublish" || a.action === "archive") {
49128
+ if (a.confirm !== true) {
49129
+ const what = a.action === "archive" ? "archives the article (restoring it is done in the hub)" : "takes the article off the public help pages";
49130
+ return errorResult(new Error(`${a.action} ${what}. Tell the user which article, get an explicit yes, then call again with confirm: true. Nothing was sent.`));
49131
+ }
49132
+ return textResult(await hubPost(cfg, `${path}/${a.action}`, {}));
49133
+ }
49134
+ return errorResult(new Error(unknownActionSentence(a.action)));
49135
+ } catch (err) {
49136
+ return errorResult(err);
49137
+ }
49138
+ };
49139
+ const HELP_READ_HALF = splitHalf([...HELP_READS], HELP_CHANGES, "awesomate_help_centre_change");
49140
+ r.registerTool(
49141
+ "awesomate_help_centre",
49142
+ {
49143
+ annotations: annotate("awesomate_help_centre", READ_ONLY),
49144
+ description: "Read the business's OWN help centre (its public help pages for its customers): action 'centre' (title, public address, whether its pages are on, the segments an article may name, and its topics), 'articles' {status?, q?} (articles without their bodies, each with where its page stands in Knowledge), 'article' {id} (one article: its working copy and its published copy). Needs a key with help:write, which no plan gives by itself: the account owner switches it on for one key in the hub (Claude Code, Get my code, 'Write, publish and take down your help centre articles'). A 403 with missingScopes ['help:write'] means this key was made without it: say so in one line and stop; never retry. 404 no_help_centre means the account has none. Not Awesomate's own help: questions about Awesomate are awesomate_support 'ask'. Write and publish with awesomate_help_centre_change.",
49145
+ inputSchema: {
49146
+ action: HELP_READ_HALF.action,
49147
+ ...pickShape(helpShape, ["id", "status", "q"])
49148
+ }
49149
+ },
49150
+ HELP_READ_HALF.guard(helpCentre)
49151
+ );
49152
+ const HELP_CHANGE_HALF = splitHalf([...HELP_CHANGES], HELP_READS, "awesomate_help_centre");
49153
+ r.registerTool(
49154
+ "awesomate_help_centre_change",
49155
+ {
49156
+ annotations: annotate("awesomate_help_centre_change", MUTATING),
49157
+ description: "Write the business's OWN help centre: action 'create_topic' {name, description?}, 'create_article' {title, body, summary?, topicId?, segments?, slug?} (always a draft, never public), 'update_article' {id, ...fields} (changes the working copy; a published article's public copy changes only when it is published again), 'publish' {id, confirm: true} (makes the working copy public on the help centre's pages while they are on, and where the centre feeds the business's Knowledge sends the page there: show the user what goes live and get an explicit yes first), 'unpublish' {id, confirm: true} (back to a draft, off the public pages) and 'archive' {id, confirm: true} (restoring is done in the hub); get a yes before each. Bodies are Markdown, in plain words the business's customers use. Leave a '[CHECK: ...]' note wherever a fact needs a person to confirm it: publish is refused (422) while one is there, so the person removes it after checking. A slug another article has answers 409 slug_taken. Needs a key with help:write, chosen by the account owner for one key in the hub; a 403 with missingScopes means this key lacks it: say so and stop. The centre's own settings, its address, topic order and restoring an archived article are done in the hub. Read first with awesomate_help_centre.",
49158
+ inputSchema: {
49159
+ action: HELP_CHANGE_HALF.action,
49160
+ ...pickShape(helpShape, ["id", "name", "description", "title", "slug", "summary", "body", "segments", "topicId", "confirm"])
49161
+ }
49162
+ },
49163
+ HELP_CHANGE_HALF.guard(helpCentre)
49164
+ );
48830
49165
  r.registerTool(
48831
49166
  "awesomate_request_build",
48832
49167
  {
@@ -48989,11 +49324,12 @@ var server = new McpServer(
48989
49324
  },
48990
49325
  { instructions: SERVER_INSTRUCTIONS }
48991
49326
  );
49327
+ setClientApp(() => server.server.getClientVersion());
48992
49328
  var featureCache = createFeatureCache(() => hubGet(requireConfig(), "/api/hosting-access/context"));
48993
49329
  var WHOAMI_CONTEXT_TIMEOUT_MS = 4e3;
48994
49330
  {
48995
49331
  const register = server.registerTool.bind(server);
48996
- server.registerTool = (name, def, cb) => register(name, def, async (...args) => {
49332
+ server.registerTool = (name, def, cb) => register(name, def, async (...args) => withTraceparent(traceparentOfCall(args), async () => {
48997
49333
  const hint = def?.annotations?.readOnlyHint === true;
48998
49334
  if (config2 && !callIsRead(String(name), hint, args[0])) {
48999
49335
  const refusal = fallbackWriteRefusal(config2);
@@ -49006,7 +49342,7 @@ ${refusal}` }], isError: true };
49006
49342
  ${refusal}` }], isError: true };
49007
49343
  }
49008
49344
  return cb(...args);
49009
- });
49345
+ }));
49010
49346
  }
49011
49347
  var registrar = createRegistrar(server, "stdio", requireConfig, accountStamp2, () => featureCache.known());
49012
49348
  setAccountStamp(accountStamp2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awesomate/hosting-mcp",
3
- "version": "0.171.21",
3
+ "version": "0.171.28",
4
4
  "description": "Awesomate MCP server — 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",
@@ -1,5 +1,37 @@
1
1
  {
2
2
  "versions": [
3
+ {"version": "0.171.28", "highlights": ["Behind the scenes: each request now tells the hub which Claude app and version sent it, and passes along a trace id when Claude Code sends one, so your account's history can later show what was done through Claude. Nothing changes in what you can ask for"]},
4
+ {"version": "0.171.27", "highlights": ["New tools awesomate_help_centre and awesomate_help_centre_change: read and write your business's own help centre (topics, and articles as drafts), and publish, take down or archive an article, each only after you say yes. They need a key with help centre writing, which the account owner switches on for one computer in the hub (Claude Code, Get my code)"]},
5
+ {
6
+ "version": "0.171.26",
7
+ "highlights": [
8
+ "Video and audio up to 10 GB can go into Knowledge from Claude Code on Pro, sent in parts straight to storage (when your account has it); an interrupted upload carries on when you ask again with the same file"
9
+ ]
10
+ },
11
+ {
12
+ "version": "0.171.25",
13
+ "highlights": [
14
+ "awesomate_files: new action copy (a file or a folder, up to 200 files and 250 MB a call, leaving the original), and move and copy take items (up to 100 { from, to } at once, each answered in results). A to ending in / (or a bare top folder) keeps the name. A move or copy into public/ needs confirm"
15
+ ]
16
+ },
17
+ {
18
+ "version": "0.171.24",
19
+ "highlights": [
20
+ "awesomate_knowledge_agents_change: a Team (internal) agent is published or resumed only with collectionIds, kinds or sourceIds set, or with the new everything:true (the user's explicit \"Everything your team can see\" choice); otherwise the hub answers 400 scope_required. create returns scope_note for a Team agent made with no scope, and awesomate_knowledge_agents marks an agent live with no scope as reads_everything"
21
+ ]
22
+ },
23
+ {
24
+ "version": "0.171.23",
25
+ "highlights": [
26
+ "awesomate_knowledge_agents_change: deleting an agent and changing access policies are the account owner's (a team member gets owner_only); delete now sends confirm:true, and an agent on the Agents page, a website, a channel or the business map answers use_remove: remove it on the Agents page, which can be undone for 30 days"
27
+ ]
28
+ },
29
+ {
30
+ "version": "0.171.22",
31
+ "highlights": [
32
+ "awesomate_business: a document refused because the ones it builds on are not written reads as one plain sentence ('Write FAQ questions, Brand voice and Products and services first'), with no generic Conflict tail; the same for a locked document. Document 1 is called Business description everywhere, the plan shows its approval time, and a context for a blog includes it"
33
+ ]
34
+ },
3
35
  {
4
36
  "version": "0.171.21",
5
37
  "highlights": [
@@ -79,7 +79,7 @@ platform's answer beats anything you remember.
79
79
  | Instant search with facet counts (find WHAT is in there: moments, pages, datasets; free) | `awesomate_knowledge_search` |
80
80
  | Ask a question → verified answer + numbered sources (accepts the same facet `filters` to ask within a slice) | `awesomate_knowledge_ask` |
81
81
  | Agent persona, fallback message and model tier: get and set (the single workspace default). Every account answers on Gemini Flash (`flash`) until the owner picks another; Claude Sonnet is a choice on any plan, Claude Opus on Embedded. Which model answers ONE live agent is its `effective_model` on `awesomate_knowledge_agents` list/get (absent while it is off, paused or has changes not live yet) | `awesomate_knowledge_agent` (read) · `awesomate_knowledge_agent_change` (change) |
82
- | Agent BUILDER: list / get / create (AI-drafted from their content, saved as a private draft; pass `audience:'public'` for anything customers will talk to; it then answers from sources marked public ONLY; ALWAYS scope it to the right collection with `collectionIds` and check `kinds`, since a drafted scope can read every collection, and relay the `warning` it returns) / update (edit the draft's instructions, grounding, no-answer message, audience and collection scope; nothing changes for callers until publish) / test the draft (ignores audience: NOT what the public sees) / visitor_test (the PUBLISHED agent as a website visitor gets it) / publish, suspend, resume, delete (explicit approval first) / `logs`, `answer_rates`, `where_used` / `ai_key_status`, `models` (read only: the AI key is saved in the hub) / customer-group access policies (`policies`, `policy_create`, `policy_update`, `policy_delete`, `policy_suspend`, `policy_resume`) | `awesomate_knowledge_agents` (read) · `awesomate_knowledge_agents_change` (change) |
82
+ | Agent BUILDER: list / get / create (AI-drafted from their content, saved as a private draft; pass `audience:'public'` for anything customers will talk to; it then answers from sources marked public ONLY; ALWAYS scope it to the right collection with `collectionIds` and check `kinds`, since a drafted scope can read every collection, and relay the `warning` it returns; a TEAM (`internal`) agent is published or resumed only with `collectionIds`/`kinds`/`sourceIds` set or `everything:true`, the user's own "Everything your team can see" choice, else 400 `scope_required`: ask which collections, and set `everything` only when they say in words it should read everything; relay `scope_note` and any `reads_everything` mark) / update (edit the draft's instructions, grounding, no-answer message, audience and collection scope; nothing changes for callers until publish) / test the draft (ignores audience: NOT what the public sees) / visitor_test (the PUBLISHED agent as a website visitor gets it) / publish, suspend, resume, delete (explicit approval first) / `logs`, `answer_rates`, `where_used` / `ai_key_status`, `models` (read only: the AI key is saved in the hub) / customer-group access policies (`policies`, `policy_create`, `policy_update`, `policy_delete`, `policy_suspend`, `policy_resume`) | `awesomate_knowledge_agents` (read) · `awesomate_knowledge_agents_change` (change) |
83
83
  | People, places, topics: list / name / hide / merge / alias suggestions / re-run resolution / look one up by name (`explore`), who appears with it (`related`), open the passage behind a citation (`evidence`) | `awesomate_knowledge_people` (read) · `awesomate_knowledge_people_change` (change) |
84
84
  | Business-data warehouse: `metrics` / `datasets` / `query` / `imports`: answer quantitative questions from their own imported business data (query is free-form but read-only); one `dataset`, `dataset_update` (name, column decisions), one `import`, and `import_action` (approve, reject, withdraw with confirm, reimport, answer), each after the owner's yes | `awesomate_knowledge_data` (read) · `awesomate_knowledge_data_change` (change) |
85
85
  | Refresh these skills from the latest package | `awesomate_skill_update` |
@@ -87,12 +87,14 @@ platform's answer beats anything you remember.
87
87
  Local FILES (PDFs, Markdown, videos on disk) go through
88
88
  `awesomate_knowledge_upload` below, which streams them from disk so their
89
89
  contents never enter the conversation. The owner can also use the hub's
90
- Knowledge → Sources upload page themselves (100 MB per file; bigger media by
91
- URL). Formats + caps: [ingestion-sources.md](references/ingestion-sources.md).
90
+ Knowledge → Sources upload page themselves (100 MB per file; video and audio
91
+ up to 10 GB on Pro). Formats + caps: [ingestion-sources.md](references/ingestion-sources.md).
92
92
 
93
93
  **`awesomate_knowledge_upload {path, title?, kind?}`** — ingest ONE file from the
94
94
  user's own computer. Pass a local path; the server streams it from disk, so
95
- file contents never pass through the conversation. 100 MB max, one call per
95
+ file contents never pass through the conversation. 100 MB max, except video
96
+ and audio up to 10 GB (Pro), sent in parts straight to storage: if a big
97
+ upload stops, call again with the same file and it carries on. One call per
96
98
  file, explicit approval first (it spends allowance). URLs and sitemaps stay on
97
99
  `awesomate_knowledge_sources_change` (`add`). A spreadsheet (csv, tsv, xls, xlsx, xlsm, json)
98
100
  needs `kind`: `sheet` for rows a customer asks about (price lists, fee tables,
@@ -151,8 +153,13 @@ PAT. Rotating the n8n key, buying a pack and deleting the WHOLE knowledge
151
153
  base deliberately have NO tool: they're consequential enough to route
152
154
  through explicit REST calls (or the hub) the user has just approved.
153
155
  Deleting ONE source is `awesomate_knowledge_sources_change {action:'remove'}` and
154
- deleting an agent is `awesomate_knowledge_agents_change {action:'delete',
155
- confirm:true}`, both after the owner's yes.
156
+ deleting an agent that lives in Knowledge alone is
157
+ `awesomate_knowledge_agents_change {action:'delete', confirm:true}`, both after
158
+ the owner's yes. Deleting an agent is the account owner's alone (owner_only for
159
+ anyone else), and an agent on the Agents page answers use_remove: remove it with
160
+ `awesomate_agents_change {action:'remove'}`, which the owner can undo for 30
161
+ days. Policy changes are the account owner's too (a team member gets
162
+ owner_only).
156
163
 
157
164
  | Action | Endpoint |
158
165
  |---|---|
@@ -161,7 +168,7 @@ confirm:true}`, both after the owner's yes.
161
168
  | Whole-library counts | `GET /api/knowledge/sources/summary` — a PATH. **`?action=summary` is NOT a thing:** it returns 200 with a plain source list, so `.total` is `undefined` and any count derived from it silently becomes 0 or NaN. |
162
169
  | Faceted search (what `awesomate_knowledge_search` calls) | `GET /api/knowledge/explore?q=…` + the same facet params. **Add `&include=media` to get `url`/`poster_url` on image/video hits** — without it you get titles with nothing to display. |
163
170
  | Business-data warehouse (what `awesomate_knowledge_data` and `awesomate_knowledge_data_change` call: metrics, datasets, `dataset`, `dataset_update`, imports, `import`, `import_action`, query) | `GET /api/knowledge/data/{metrics,datasets,datasets/:id,imports,imports/:id}` · `PATCH /api/knowledge/data/datasets/:id` · `POST /api/knowledge/data/imports/:id/:action` · `POST /api/knowledge/data/query` (read-only SQL) |
164
- | Agent builder (what `awesomate_knowledge_agents` and `awesomate_knowledge_agents_change` call) | `GET\|POST /api/knowledge/agents` · `GET\|PATCH\|DELETE /api/knowledge/agents/:agent_id` · `POST /api/knowledge/agents/:agent_id/{publish,suspend,resume}` · `GET /api/knowledge/agents/{logs,answer-rates,where-used}` · `GET\|POST /api/knowledge/agents/policies` · `GET\|PATCH\|DELETE /api/knowledge/agents/policies/:policy_id` · `POST /api/knowledge/agents/policies/:policy_id/{suspend,resume}` |
171
+ | Agent builder (what `awesomate_knowledge_agents` and `awesomate_knowledge_agents_change` call) | `GET\|POST /api/knowledge/agents` · `GET\|PATCH /api/knowledge/agents/:agent_id` · `DELETE /api/knowledge/agents/:agent_id` (body `{confirm:true}`, the owner only) · `POST /api/knowledge/agents/:agent_id/{publish,suspend,resume}` · `GET /api/knowledge/agents/{logs,answer-rates,where-used}` · `GET\|POST /api/knowledge/agents/policies` · `GET\|PATCH\|DELETE /api/knowledge/agents/policies/:policy_id` · `POST /api/knowledge/agents/policies/:policy_id/{suspend,resume}` |
165
172
  | **Test a DRAFT agent** (`action:'test'`) | `POST /api/knowledge/agents/:agent_id/chat` `{message, session_id?}`. There is **no** `/test` endpoint — guessing one returns 404. It is not what the public sees (it can quote internal or private sources); a team member gets 403 `owner_only_agent` for an agent whose audience is private. |
166
173
  | **Ask the PUBLISHED agent as a visitor** (`action:'visitor_test'`) | `POST /api/knowledge/agents/:agent_id/visitor-chat` `{message (max 2000), session_id?}`. Every plan; an unanswered question lands in the Questions inbox. |
167
174
  | **Website chat key** (`action:'website_key'`, `website_keys`, `revoke_website_key`; owner only, every plan) | `POST /api/knowledge/agents/keys` `{class:'p', agent_id, allowed_origins (https only, no path or wildcard), label?, request_id?, monthly_answer_cap?}` returns the key ONCE with its `monthly_answer_cap`; with no cap the hub sets half the account's monthly answers at that moment, and a key's cap cannot be changed later (a new limit is a new key). The tool refuses an agent that is not published, not public-audience, or paused. List with `GET /api/knowledge/agents/keys` (class `p`), revoke with `DELETE /api/knowledge/agents/keys/:key_id`. Every one only after the owner's yes. **Testing on the owner's own computer** (a site built locally, e.g. http://localhost:8500): pass `localPort: 8500` instead of `origins`. That makes a separate TEST code for `http://localhost:8500` and `http://127.0.0.1:8500` only, which stops by itself after 7 days (`stops_at`), counts against the same monthly answers, and is marked `test_only` in `website_keys`. Never mix it with real sites, never put it on the live site, and make a real https key for the live site. Any other http:// address is refused. Use this instead of falling back to an n8n Chat Trigger for local testing. |
@@ -33,7 +33,9 @@ contents never pass through the conversation and a 100 MB PDF costs no context.
33
33
 
34
34
  - One call per file. Report progress as you go; never loop silently through
35
35
  twenty files.
36
- - 100 MB per file. Bigger media goes through the hub at Knowledge → Sources.
36
+ - 100 MB per file, except video and audio: up to 10 GB on Pro, sent in parts
37
+ from their machine straight to storage. A big upload takes a while, so say
38
+ so first. If it stops, call again with the same file and it carries on.
37
39
  - A folder path is rejected on purpose — list it, agree the files, then upload.
38
40
  - Public URLs and whole sitemaps stay on `awesomate_knowledge_sources_change`
39
41
  `{action:'add'}`. Use that for their website; use upload for their disk.
@@ -157,8 +159,8 @@ inbox, so say so before using it.
157
159
  Access policies (the customer groups an agent narrows to: a policy named
158
160
  `segment:all` or `segment:<group>`) are `policies` / `policy_create` /
159
161
  `policy_update` / `policy_delete` / `policy_suspend` / `policy_resume` on the
160
- same tool; each change applies to live callers at once, so show the owner
161
- what changes first. API keys stay hub UI only (Knowledge, Agents): a key is
162
+ same tool; only the account owner changes them, and each change applies to
163
+ live callers at once, so show the owner what changes first. API keys stay hub UI only (Knowledge, Agents): a key is
162
164
  shown once there and never passes through a tool.
163
165
 
164
166
  ## 6. Publish only with explicit approval
@@ -15,7 +15,7 @@ estimating BEFORE asking approval.
15
15
  | YouTube link | `add {url}` | Refused on every plan (400): "YouTube links are not supported yet". No upgrade changes that, so never offer one for it. Uploading the business's own video files works on Pro and above, or add the page that embeds the video |
16
16
  | Any other link to a recording (Loom, podcast audio, a file address) | `add {url}` | **Not transcribed.** Read as a web page, which gives at most its title and description; a link straight to an audio or video file has no page to read and fails (`page_unreadable`). Pro and above; below Pro, or in a trial, it is refused (403 `upgrade_required`, `capability: "media_ingest"`). To transcribe the recording, upload the file |
17
17
  | PDF / book / document / markdown | hub upload page | Text layer used; scanned pages OCR'd automatically (`auto` mode, capped at 300 OCR pages per job — over that the job fails BEFORE any vision spend) |
18
- | Video/audio FILES | hub upload page (≤ 100 MB) | Transcribed (Deepgram, language defaults to English). Pro and above, within the month's media hours. A longer recording: split or compress it and upload each part |
18
+ | Video/audio FILES | `awesomate_knowledge_upload {path}` or the hub upload page (up to 10 GB) | Transcribed (Deepgram, language defaults to English). Pro and above, within the month's media hours. Over 100 MB the file goes to storage in 64 MB parts; an interrupted upload carries on when the same file is sent again (parts kept 7 days). Over 10 GB: split the recording and upload each part |
19
19
  | Images | hub upload page | Vision-described, then indexed |
20
20
  | Facebook export | hub upload page | The platform's facebook-export lane |
21
21
  | FAQs | Markdown file via `awesomate_knowledge_upload` | One `##` per question, so each becomes its own citable section. **Never** a Q&A spreadsheet as it is: convert it to this file, so every answer stays word for word and citable. Full recipe: [faqs.md](faqs.md) |
@@ -27,7 +27,7 @@ on with the first payment.
27
27
 
28
28
  Local files go through `awesomate_knowledge_upload`, which streams them from
29
29
  disk so their contents never enter the conversation (the owner can also use
30
- the hub upload page). 100 MB per file.
30
+ the hub upload page). 100 MB per file; video and audio up to 10 GB.
31
31
 
32
32
  ## Job lifecycle
33
33
 
@@ -205,6 +205,33 @@ to the Awesomate team, who scope, build, test, and deliver it.
205
205
  and send them to hub.awesomate.ai/settings?tab=privacy. You cannot flip it
206
206
  for them, and there is deliberately no tool that can.
207
207
 
208
+ ## 5b. Writing the business's own help centre
209
+
210
+ Some accounts have a public help centre: help pages for THEIR customers.
211
+ `awesomate_help_centre` reads it (`centre`, `articles`, `article`) and
212
+ `awesomate_help_centre_change` writes it (`create_topic`, `create_article`,
213
+ `update_article`, `publish`, `unpublish`, `archive`). This is not
214
+ Awesomate's help (that is §1), and not the support inbox.
215
+
216
+ - **It needs a key with `help:write`.** No plan gives it; the account
217
+ owner switches it on for one key in the hub (Claude Code, Get my code,
218
+ "Write, publish and take down your help centre articles"). A 403 naming
219
+ `help:write` means this key lacks it: say so in one line and stop.
220
+ `no_help_centre` means the account has none yet.
221
+ - **Write drafts in the customers' words**, in Markdown, short headings,
222
+ steps as numbered lists. Read `centre` first for the topics and the
223
+ segments an article may name.
224
+ - **Leave a `[CHECK: ...]` note on any fact you could not confirm** (a
225
+ price, a menu name, a time). Publishing is refused while one is there,
226
+ so a person confirms it and removes the note.
227
+ - **Publishing makes it public at once** on the centre's pages (while
228
+ they are switched on). Show the title and what goes live, get an
229
+ explicit yes, then `publish` with `confirm: true`. Taking one down
230
+ (`unpublish`) or archiving it needs a yes and `confirm: true` too. An
231
+ edit to a published article is not public until it is published again.
232
+ - The centre's settings, its address, topic order and restoring an
233
+ archived article stay in the hub.
234
+
208
235
  ## 6. Hard rules
209
236
 
210
237
  - **Never invent policy or pricing.** If the FAQ and tools don't say it,