@sanctuary-framework/mcp-server 1.1.1 → 1.1.2

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.d.cts CHANGED
@@ -5495,6 +5495,23 @@ interface DashboardHandle {
5495
5495
  * `agent_id`.
5496
5496
  */
5497
5497
  publishAgentStatus: (snapshot: unknown) => void;
5498
+ /**
5499
+ * v1.1.2 hotfix (Finding V): bind v1.1 hub bindings to this dashboard
5500
+ * instance so /v1.1, /api/hub/*, and /api/identities serve the v1.1
5501
+ * surface. Pass null to detach. PR #82 wired these routes only on the
5502
+ * principal-policy DashboardApprovalChannel; the wrap-auto operator
5503
+ * dashboard (this server) needed the same wiring for the wrap-emitted
5504
+ * URL to expose the v1.1 surfaces the v1.1.1 release notes claim.
5505
+ */
5506
+ setV11Bindings: (bindings: V11Bindings | null) => void;
5507
+ /**
5508
+ * v1.1.2: enable loopback auto-auth for /api/hub/* + /api/identities.
5509
+ * When true, requests from 127.0.0.1 / ::1 bypass the bearer-token
5510
+ * check (mirrors the principal-policy dashboard's _autoAuthLocalhost
5511
+ * flag). Set true when the dashboard binds to a loopback host and the
5512
+ * caller has independently authenticated the operator.
5513
+ */
5514
+ setV11LoopbackAutoAuth: (enabled: boolean) => void;
5498
5515
  }
5499
5516
  declare function startDashboardServer(options: DashboardServerOptions): Promise<DashboardHandle>;
5500
5517
 
package/dist/index.d.ts CHANGED
@@ -5495,6 +5495,23 @@ interface DashboardHandle {
5495
5495
  * `agent_id`.
5496
5496
  */
5497
5497
  publishAgentStatus: (snapshot: unknown) => void;
5498
+ /**
5499
+ * v1.1.2 hotfix (Finding V): bind v1.1 hub bindings to this dashboard
5500
+ * instance so /v1.1, /api/hub/*, and /api/identities serve the v1.1
5501
+ * surface. Pass null to detach. PR #82 wired these routes only on the
5502
+ * principal-policy DashboardApprovalChannel; the wrap-auto operator
5503
+ * dashboard (this server) needed the same wiring for the wrap-emitted
5504
+ * URL to expose the v1.1 surfaces the v1.1.1 release notes claim.
5505
+ */
5506
+ setV11Bindings: (bindings: V11Bindings | null) => void;
5507
+ /**
5508
+ * v1.1.2: enable loopback auto-auth for /api/hub/* + /api/identities.
5509
+ * When true, requests from 127.0.0.1 / ::1 bypass the bearer-token
5510
+ * check (mirrors the principal-policy dashboard's _autoAuthLocalhost
5511
+ * flag). Set true when the dashboard binds to a loopback host and the
5512
+ * caller has independently authenticated the operator.
5513
+ */
5514
+ setV11LoopbackAutoAuth: (enabled: boolean) => void;
5498
5515
  }
5499
5516
  declare function startDashboardServer(options: DashboardServerOptions): Promise<DashboardHandle>;
5500
5517
 
package/dist/index.js CHANGED
@@ -11138,6 +11138,20 @@ async function handleRequest(deps, req, res) {
11138
11138
  const url = new URL(req.url ?? "/", `http://${host}`);
11139
11139
  const method = (req.method ?? "GET").toUpperCase();
11140
11140
  const path = url.pathname;
11141
+ if (deps.v11Bindings) {
11142
+ const handled = await dispatchV11Request(
11143
+ {
11144
+ bindings: deps.v11Bindings,
11145
+ ...deps.authToken !== void 0 ? { authToken: deps.authToken } : {},
11146
+ loopbackAutoAuth: deps.loopbackAutoAuth ?? false
11147
+ },
11148
+ req,
11149
+ res,
11150
+ url,
11151
+ method
11152
+ );
11153
+ if (handled) return true;
11154
+ }
11141
11155
  if (!isAuthorized(deps, req, url)) {
11142
11156
  writeJSON(res, 401, { error: "unauthorized" });
11143
11157
  return true;
@@ -12767,6 +12781,47 @@ function handleDashboardV11Route(deps, req, res) {
12767
12781
  return true;
12768
12782
  }
12769
12783
 
12784
+ // src/dashboard/v1_1/dispatch.ts
12785
+ async function dispatchV11Request(inputs, req, res, url, method) {
12786
+ const { bindings, authToken, loopbackAutoAuth } = inputs;
12787
+ if (method === "GET" && (url.pathname === "/v1.1" || url.pathname === "/v1.1/")) {
12788
+ return handleDashboardV11Route(
12789
+ {
12790
+ identityId: bindings.identityId,
12791
+ fortressId: bindings.fortressId,
12792
+ ...authToken !== void 0 ? { authToken } : {}
12793
+ },
12794
+ req,
12795
+ res
12796
+ );
12797
+ }
12798
+ if (url.pathname.startsWith("/api/hub/")) {
12799
+ const authConfig = {
12800
+ loopbackAutoAuth,
12801
+ ...authToken !== void 0 ? { authToken } : {}
12802
+ };
12803
+ return handleHubRoute(
12804
+ { authConfig, service: bindings.hubService },
12805
+ req,
12806
+ res
12807
+ );
12808
+ }
12809
+ if (method === "GET" && url.pathname === "/api/identities") {
12810
+ const authConfig = {
12811
+ loopbackAutoAuth,
12812
+ ...authToken !== void 0 ? { authToken } : {}
12813
+ };
12814
+ const aliasReq = Object.create(req);
12815
+ aliasReq.url = "/api/hub/agents" + url.search;
12816
+ return handleHubRoute(
12817
+ { authConfig, service: bindings.hubService },
12818
+ aliasReq,
12819
+ res
12820
+ );
12821
+ }
12822
+ return false;
12823
+ }
12824
+
12770
12825
  // src/principal-policy/dashboard.ts
12771
12826
  var SESSION_TTL_REMOTE_MS = 5 * 60 * 1e3;
12772
12827
  var SESSION_TTL_LOCAL_MS = 24 * 60 * 60 * 1e3;
@@ -12893,45 +12948,17 @@ var DashboardApprovalChannel = class {
12893
12948
  */
12894
12949
  async dispatchV11(req, res, url, method) {
12895
12950
  if (!this.v11Bindings) return false;
12896
- if (method === "GET" && (url.pathname === "/v1.1" || url.pathname === "/v1.1/")) {
12897
- const handled = handleDashboardV11Route(
12898
- {
12899
- identityId: this.v11Bindings.identityId,
12900
- fortressId: this.v11Bindings.fortressId,
12901
- ...this.authToken !== void 0 ? { authToken: this.authToken } : {}
12902
- },
12903
- req,
12904
- res
12905
- );
12906
- return handled;
12907
- }
12908
- if (url.pathname.startsWith("/api/hub/")) {
12909
- const authConfig = {
12910
- loopbackAutoAuth: this._autoAuthLocalhost,
12911
- ...this.authToken !== void 0 ? { authToken: this.authToken } : {}
12912
- };
12913
- const handled = await handleHubRoute(
12914
- { authConfig, service: this.v11Bindings.hubService },
12915
- req,
12916
- res
12917
- );
12918
- return handled;
12919
- }
12920
- if (method === "GET" && url.pathname === "/api/identities") {
12921
- const authConfig = {
12922
- loopbackAutoAuth: this._autoAuthLocalhost,
12923
- ...this.authToken !== void 0 ? { authToken: this.authToken } : {}
12924
- };
12925
- const aliasReq = Object.create(req);
12926
- aliasReq.url = "/api/hub/agents" + url.search;
12927
- const handled = await handleHubRoute(
12928
- { authConfig, service: this.v11Bindings.hubService },
12929
- aliasReq,
12930
- res
12931
- );
12932
- return handled;
12933
- }
12934
- return false;
12951
+ return dispatchV11Request(
12952
+ {
12953
+ bindings: this.v11Bindings,
12954
+ ...this.authToken !== void 0 ? { authToken: this.authToken } : {},
12955
+ loopbackAutoAuth: this._autoAuthLocalhost
12956
+ },
12957
+ req,
12958
+ res,
12959
+ url,
12960
+ method
12961
+ );
12935
12962
  }
12936
12963
  /**
12937
12964
  * v0.10.2: enable (or disable) the loopback auto-auth fast path. See
@@ -28820,14 +28847,18 @@ async function startDashboardServer(options) {
28820
28847
  }
28821
28848
  }
28822
28849
  };
28823
- const deps = {
28824
- sources: options.sources,
28825
- authToken: options.authToken,
28826
- approvals: options.approvals,
28827
- onEvent
28828
- };
28850
+ let v11Bindings = null;
28851
+ let v11LoopbackAutoAuth = false;
28829
28852
  const server = createServer$2(async (req, res) => {
28830
28853
  try {
28854
+ const deps = {
28855
+ sources: options.sources,
28856
+ authToken: options.authToken,
28857
+ approvals: options.approvals,
28858
+ onEvent,
28859
+ v11Bindings,
28860
+ loopbackAutoAuth: v11LoopbackAutoAuth
28861
+ };
28831
28862
  const served = await handleRequest(deps, req, res);
28832
28863
  if (!served) {
28833
28864
  res.writeHead(404, { "Content-Type": "application/json" });
@@ -28865,7 +28896,13 @@ async function startDashboardServer(options) {
28865
28896
  publishActivity: (entry) => publish({ type: "activity", data: entry }),
28866
28897
  publishApproval: (approval) => publish({ type: "approval", data: approval }),
28867
28898
  publishInbox: (item) => publish({ type: "inbox", data: item }),
28868
- publishAgentStatus: (snapshot) => publish({ type: "agent_status", data: snapshot })
28899
+ publishAgentStatus: (snapshot) => publish({ type: "agent_status", data: snapshot }),
28900
+ setV11Bindings: (bindings) => {
28901
+ v11Bindings = bindings;
28902
+ },
28903
+ setV11LoopbackAutoAuth: (enabled) => {
28904
+ v11LoopbackAutoAuth = enabled;
28905
+ }
28869
28906
  };
28870
28907
  }
28871
28908