@sanctuary-framework/mcp-server 1.1.6 → 1.1.7

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/cli.js CHANGED
@@ -11906,7 +11906,7 @@ async function handleRequest(deps, req, res) {
11906
11906
  writeJSON(res, 200, { ok: true, mode: deps.sources.mode });
11907
11907
  return true;
11908
11908
  }
11909
- if (method === "GET" && (path === "/" || path === "/index.html")) {
11909
+ if (method === "GET" && (path === "/v1.0" || path === "/v1.0/" || path === "/v1.0/index.html")) {
11910
11910
  const snapshot = await getProtectionSnapshot(deps.sources);
11911
11911
  const html = renderDashboardHTML({ snapshot, authToken: deps.authToken });
11912
11912
  writeText(res, 200, html, "text/html; charset=utf-8");
@@ -12792,7 +12792,7 @@ function renderMain() {
12792
12792
  const main = document.getElementById("main");
12793
12793
  if (!main) return;
12794
12794
  switch (state.route) {
12795
- case "dashboard": main.innerHTML = renderChatThread(); break;
12795
+ case "dashboard": main.innerHTML = renderDashboardWelcome(); break;
12796
12796
  case "agents": main.innerHTML = renderAgentsList(); break;
12797
12797
  case "agent-detail": main.innerHTML = renderAgentDetail(); break;
12798
12798
  case "policy": main.innerHTML = renderPolicyCenter(); break;
@@ -12804,48 +12804,32 @@ function renderMain() {
12804
12804
  }
12805
12805
  }
12806
12806
 
12807
- // ── Render: chat thread ────────────────────────────────────────────────
12808
- function renderChatThread() {
12809
- const activeId = state.chatActiveAgentId;
12810
- const agent = activeId ? state.agents.find(function (a) { return a.agent_id === activeId; }) : null;
12811
- const header = '<header style="padding:8px 0;border-bottom:1px solid var(--rule);margin-bottom:8px;">' +
12812
- '<strong>' + escHtml(agent ? agent.agent_id : "Concierge") + '</strong>' +
12813
- ' <span class="muted">' + (agent ? "agent" : "Sanctuary advisory only. Operator-agent direct command via chat lands in v1.2.") + '</span>' +
12814
- '</header>';
12815
-
12816
- // Three message kinds. (1) operator (UI-side suggestions, not backend POST).
12817
- // (2) agent-initiated approvals from inbox filtered by agent_id. (3) activity
12818
- // events filtered by agent_id rendered as system-style.
12819
- const msgs = [];
12820
- if (!agent) {
12821
- msgs.push('<div class="chat-msg system"><strong>Concierge:</strong> Pick an agent in the right pane to scope the thread. Tier 1 actions appear here as approve/deny prompts. Free text is advisory only at v1.1.</div>');
12822
- } else {
12823
- const pending = state.inbox.filter(function (i) { return i.kind === "approval_pending" && i.agent_id === activeId && !i.resolved; });
12824
- pending.forEach(function (i) {
12825
- const text = renderTemplate(i.display_template_id, i.display_template_args);
12826
- msgs.push(
12827
- '<div class="chat-msg agent" data-msg-kind="agent-initiated" data-item-id="' + escHtml(i.item_id) + '">' +
12828
- '<div>' + escHtml(text) + '</div>' +
12829
- '<div style="margin-top:6px;display:flex;gap:6px;">' +
12830
- '<button class="btn btn-primary" data-action="inbox-approve" data-item-id="' + escHtml(i.item_id) + '">Approve</button>' +
12831
- '<button class="btn" data-action="inbox-deny" data-item-id="' + escHtml(i.item_id) + '">Deny</button>' +
12832
- '<button class="btn" data-action="show-details" data-item-id="' + escHtml(i.item_id) + '">Show details</button>' +
12833
- '</div>' +
12834
- '</div>'
12835
- );
12836
- });
12837
- const events = state.activity.filter(function (e) { return e.agent_id === activeId; }).slice(0, 20);
12838
- events.forEach(function (e) {
12839
- const text = renderTemplate(e.display_template_id, e.display_template_args);
12840
- msgs.push('<div class="chat-msg system"><span class="muted">' + escHtml(shortTime(e.emitted_at)) + '</span> ' + escHtml(text) + '</div>');
12841
- });
12842
- }
12843
-
12844
- const composer = '<form class="composer" id="chat-composer">' +
12845
- '<input type="text" placeholder="Suggestion to concierge. (Direct commands land in v1.2.)" id="chat-input" />' +
12846
- '<button type="submit" class="btn">Send</button>' +
12847
- '</form>';
12848
- return header + '<div class="chat-thread">' + (msgs.length ? msgs.join("\n") : '<p class="muted">No messages yet.</p>') + '</div>' + composer;
12807
+ // ── Render: dashboard welcome ──────────────────────────────────────────
12808
+ // v1.1.7: replaces the half-built chat surface that v1.1.6 shipped with
12809
+ // a "What you can do today" summary card mapping each nav target to
12810
+ // the operator action it enables. Direct concierge chat is a v1.2 work
12811
+ // package (WP-V1.2-3 + WP-V1.2-4).
12812
+ function renderDashboardWelcome() {
12813
+ return [
12814
+ '<h1>What you can do today</h1>',
12815
+ '<div class="card">',
12816
+ '<dl class="kv">',
12817
+ '<dt><a href="#agents">Agents</a></dt>',
12818
+ '<dd>Pause, resume, restart, lockdown, or unwrap any wrapped harness.</dd>',
12819
+ '<dt><a href="#policy">Policy</a></dt>',
12820
+ '<dd>Review the active policy bound to each agent.</dd>',
12821
+ '<dt><a href="#privacy">Privacy</a></dt>',
12822
+ '<dd>See what context is flowing to which provider per channel.</dd>',
12823
+ '<dt><a href="#coordination">Coordination</a></dt>',
12824
+ '<dd>Inspect intra-fortress agent coordination state.</dd>',
12825
+ '<dt><a href="#health">Health</a></dt>',
12826
+ '<dd>Check fortress posture, cocoon status, and dashboard refresh.</dd>',
12827
+ '<dt><a href="#exit-drill">Exit drill</a></dt>',
12828
+ '<dd>Snapshot, verify, and prepare a portable exit bundle.</dd>',
12829
+ '</dl>',
12830
+ '</div>',
12831
+ '<p class="muted">Direct chat with the concierge ships in v1.2.</p>'
12832
+ ].join("");
12849
12833
  }
12850
12834
 
12851
12835
  // ── Render: agents list / detail ───────────────────────────────────────
@@ -12884,8 +12868,10 @@ function renderAgentDetail() {
12884
12868
  '<dt>Status</dt><dd><span class="glyph ' + map.glyph + '"></span> ' + escHtml(map.label) + '</dd>' +
12885
12869
  '</dl>' +
12886
12870
  '</div>' +
12887
- '<div class="card"><h3>Timeline</h3>' + timeline + '</div>' +
12888
- '<button class="btn" data-action="set-route" data-route="dashboard">Open chat</button>';
12871
+ '<div class="card"><h3>Timeline</h3>' + timeline + '</div>';
12872
+ // v1.1.7: "Open chat" button removed alongside the half-built chat
12873
+ // surface (Finding EE). The agent-detail timeline + capability buttons
12874
+ // are the operator's interaction surface at v1.1; chat ships in v1.2.
12889
12875
  }
12890
12876
 
12891
12877
  // ── Render: privacy ────────────────────────────────────────────────────
@@ -13055,11 +13041,13 @@ function renderFortress() {
13055
13041
  : "This harness does not support " + mi.label.toLowerCase() + ".";
13056
13042
  return '<button class="btn" data-action="agent-' + mi.action + '" data-agent-id="' + escHtml(a.agent_id) + '"' + (mi.enabled ? '' : ' disabled') + ' title="' + escHtml(tip) + '">' + escHtml(mi.label) + '</button>';
13057
13043
  }).join("");
13058
- return '<div class="row" data-agent-row="' + escHtml(a.agent_id) + '">' +
13059
- '<span class="glyph ' + map.glyph + '" title="' + escHtml(REASON_LABELS[a.status_reason_class] || "") + '"></span>' +
13060
- '<div class="grow"><strong>' + escHtml(a.agent_id) + '</strong></div>' +
13061
- '<span class="pill">' + escHtml(map.label) + '</span>' +
13062
- '<div style="display:flex;gap:4px;flex-wrap:wrap;">' + buttons + '</div>' +
13044
+ return '<div class="row agent-row" data-agent-row="' + escHtml(a.agent_id) + '">' +
13045
+ '<div class="agent-row-head">' +
13046
+ '<span class="glyph ' + map.glyph + '" title="' + escHtml(REASON_LABELS[a.status_reason_class] || "") + '"></span>' +
13047
+ '<div class="grow"><strong>' + escHtml(a.agent_id) + '</strong></div>' +
13048
+ '<span class="pill">' + escHtml(map.label) + '</span>' +
13049
+ '</div>' +
13050
+ '<div class="agent-row-actions">' + buttons + '</div>' +
13063
13051
  '</div>';
13064
13052
  }).join("\n")
13065
13053
  : '<p class="muted">No agents wrapped.</p>';
@@ -13303,19 +13291,10 @@ document.addEventListener("click", function (ev) {
13303
13291
  }
13304
13292
  });
13305
13293
 
13306
- document.addEventListener("submit", function (ev) {
13307
- if (ev.target && ev.target.id === "chat-composer") {
13308
- ev.preventDefault();
13309
- const inp = document.getElementById("chat-input");
13310
- if (!inp) return;
13311
- const txt = inp.value.trim();
13312
- inp.value = "";
13313
- if (!txt) return;
13314
- // Concierge suggestion engine, NOT a backend command POST.
13315
- // Operator-typed direct commands land in v1.2.
13316
- toast("Concierge: I cannot run that as a command at v1.1. Use the inbox or the Agents view to take action.");
13317
- }
13318
- });
13294
+ // v1.1.7: chat composer submit handler removed alongside the half-built
13295
+ // chat surface (Finding EE). Direct concierge chat ships in v1.2; until
13296
+ // then the dashboard view renders a static welcome card with no form
13297
+ // inputs that could be confused for a working command surface.
13319
13298
 
13320
13299
  // Theme: system preference only at v1.1.
13321
13300
  const mq = window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)") : null;
@@ -13515,6 +13494,10 @@ body {
13515
13494
  .row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
13516
13495
  .row:last-child { border-bottom: 0; }
13517
13496
  .row .grow { flex: 1; min-width: 0; }
13497
+ .agent-row { flex-direction: column; align-items: stretch; gap: 6px; }
13498
+ .agent-row-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
13499
+ .agent-row-head .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
13500
+ .agent-row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
13518
13501
  .kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 12px; }
13519
13502
  .kv dt { color: var(--ink-3); }
13520
13503
  .kv dd { margin: 0; color: var(--ink); }
@@ -13565,12 +13548,8 @@ body {
13565
13548
 
13566
13549
  // src/dashboard/v1_1/routes.ts
13567
13550
  function handleDashboardV11Route(deps, req, res) {
13568
- const routePath = deps.routePath ?? "/v1.1";
13569
- const host = req.headers.host || "localhost";
13570
- const url = new URL(req.url ?? "/", `http://${host}`);
13571
13551
  const method = (req.method ?? "GET").toUpperCase();
13572
13552
  if (method !== "GET") return false;
13573
- if (url.pathname !== routePath && url.pathname !== `${routePath}/`) return false;
13574
13553
  const html = renderDashboardV11Html(deps);
13575
13554
  res.writeHead(200, {
13576
13555
  "Content-Type": "text/html; charset=utf-8",
@@ -13618,7 +13597,7 @@ var init_v1_1 = __esm({
13618
13597
  // src/dashboard/v1_1/dispatch.ts
13619
13598
  async function dispatchV11Request(inputs, req, res, url, method) {
13620
13599
  const { bindings, authToken, loopbackAutoAuth } = inputs;
13621
- if (method === "GET" && (url.pathname === "/v1.1" || url.pathname === "/v1.1/")) {
13600
+ if (method === "GET" && (url.pathname === "/" || url.pathname === "/dashboard" || url.pathname === "/v1.1" || url.pathname === "/v1.1/")) {
13622
13601
  return handleDashboardV11Route(
13623
13602
  {
13624
13603
  identityId: bindings.identityId,
@@ -13663,7 +13642,7 @@ var init_dispatch = __esm({
13663
13642
  });
13664
13643
  function isDashboardViewRoute(method, path) {
13665
13644
  if (method !== "GET") return false;
13666
- return path === "/" || path === "/dashboard" || path === "/fortress" || path === "/events";
13645
+ return path === "/" || path === "/dashboard" || path === "/v1.0" || path === "/fortress" || path === "/events";
13667
13646
  }
13668
13647
  var SESSION_TTL_REMOTE_MS, SESSION_TTL_LOCAL_MS, MAX_SESSIONS, RATE_LIMIT_WINDOW_MS, RATE_LIMIT_GENERAL, RATE_LIMIT_DECISIONS, MAX_RATE_LIMIT_ENTRIES, DashboardApprovalChannel;
13669
13648
  var init_dashboard = __esm({
@@ -14183,7 +14162,7 @@ var init_dashboard = __esm({
14183
14162
  }
14184
14163
  return;
14185
14164
  }
14186
- if (method === "GET" && url.pathname === "/" && this.authToken) {
14165
+ if (method === "GET" && url.pathname === "/v1.0" && this.authToken) {
14187
14166
  if (!this.isAuthenticated(req, url)) {
14188
14167
  this.serveLoginPage(res);
14189
14168
  return;
@@ -14196,7 +14175,7 @@ var init_dashboard = __esm({
14196
14175
  try {
14197
14176
  if (method === "GET" && url.pathname === "/fortress") {
14198
14177
  this.serveFortressView(res);
14199
- } else if (method === "GET" && (url.pathname === "/" || url.pathname === "/dashboard")) {
14178
+ } else if (method === "GET" && url.pathname === "/v1.0") {
14200
14179
  if (this.fortressHTML) {
14201
14180
  this.serveFortressView(res);
14202
14181
  } else {