@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/cli.cjs +146 -50
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +147 -51
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +83 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +83 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -11141,6 +11141,20 @@ async function handleRequest(deps, req, res) {
|
|
|
11141
11141
|
const url = new URL(req.url ?? "/", `http://${host}`);
|
|
11142
11142
|
const method = (req.method ?? "GET").toUpperCase();
|
|
11143
11143
|
const path = url.pathname;
|
|
11144
|
+
if (deps.v11Bindings) {
|
|
11145
|
+
const handled = await dispatchV11Request(
|
|
11146
|
+
{
|
|
11147
|
+
bindings: deps.v11Bindings,
|
|
11148
|
+
...deps.authToken !== void 0 ? { authToken: deps.authToken } : {},
|
|
11149
|
+
loopbackAutoAuth: deps.loopbackAutoAuth ?? false
|
|
11150
|
+
},
|
|
11151
|
+
req,
|
|
11152
|
+
res,
|
|
11153
|
+
url,
|
|
11154
|
+
method
|
|
11155
|
+
);
|
|
11156
|
+
if (handled) return true;
|
|
11157
|
+
}
|
|
11144
11158
|
if (!isAuthorized(deps, req, url)) {
|
|
11145
11159
|
writeJSON(res, 401, { error: "unauthorized" });
|
|
11146
11160
|
return true;
|
|
@@ -12770,6 +12784,47 @@ function handleDashboardV11Route(deps, req, res) {
|
|
|
12770
12784
|
return true;
|
|
12771
12785
|
}
|
|
12772
12786
|
|
|
12787
|
+
// src/dashboard/v1_1/dispatch.ts
|
|
12788
|
+
async function dispatchV11Request(inputs, req, res, url, method) {
|
|
12789
|
+
const { bindings, authToken, loopbackAutoAuth } = inputs;
|
|
12790
|
+
if (method === "GET" && (url.pathname === "/v1.1" || url.pathname === "/v1.1/")) {
|
|
12791
|
+
return handleDashboardV11Route(
|
|
12792
|
+
{
|
|
12793
|
+
identityId: bindings.identityId,
|
|
12794
|
+
fortressId: bindings.fortressId,
|
|
12795
|
+
...authToken !== void 0 ? { authToken } : {}
|
|
12796
|
+
},
|
|
12797
|
+
req,
|
|
12798
|
+
res
|
|
12799
|
+
);
|
|
12800
|
+
}
|
|
12801
|
+
if (url.pathname.startsWith("/api/hub/")) {
|
|
12802
|
+
const authConfig = {
|
|
12803
|
+
loopbackAutoAuth,
|
|
12804
|
+
...authToken !== void 0 ? { authToken } : {}
|
|
12805
|
+
};
|
|
12806
|
+
return handleHubRoute(
|
|
12807
|
+
{ authConfig, service: bindings.hubService },
|
|
12808
|
+
req,
|
|
12809
|
+
res
|
|
12810
|
+
);
|
|
12811
|
+
}
|
|
12812
|
+
if (method === "GET" && url.pathname === "/api/identities") {
|
|
12813
|
+
const authConfig = {
|
|
12814
|
+
loopbackAutoAuth,
|
|
12815
|
+
...authToken !== void 0 ? { authToken } : {}
|
|
12816
|
+
};
|
|
12817
|
+
const aliasReq = Object.create(req);
|
|
12818
|
+
aliasReq.url = "/api/hub/agents" + url.search;
|
|
12819
|
+
return handleHubRoute(
|
|
12820
|
+
{ authConfig, service: bindings.hubService },
|
|
12821
|
+
aliasReq,
|
|
12822
|
+
res
|
|
12823
|
+
);
|
|
12824
|
+
}
|
|
12825
|
+
return false;
|
|
12826
|
+
}
|
|
12827
|
+
|
|
12773
12828
|
// src/principal-policy/dashboard.ts
|
|
12774
12829
|
var SESSION_TTL_REMOTE_MS = 5 * 60 * 1e3;
|
|
12775
12830
|
var SESSION_TTL_LOCAL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -12896,45 +12951,17 @@ var DashboardApprovalChannel = class {
|
|
|
12896
12951
|
*/
|
|
12897
12952
|
async dispatchV11(req, res, url, method) {
|
|
12898
12953
|
if (!this.v11Bindings) return false;
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
|
|
12904
|
-
|
|
12905
|
-
|
|
12906
|
-
|
|
12907
|
-
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
}
|
|
12911
|
-
if (url.pathname.startsWith("/api/hub/")) {
|
|
12912
|
-
const authConfig = {
|
|
12913
|
-
loopbackAutoAuth: this._autoAuthLocalhost,
|
|
12914
|
-
...this.authToken !== void 0 ? { authToken: this.authToken } : {}
|
|
12915
|
-
};
|
|
12916
|
-
const handled = await handleHubRoute(
|
|
12917
|
-
{ authConfig, service: this.v11Bindings.hubService },
|
|
12918
|
-
req,
|
|
12919
|
-
res
|
|
12920
|
-
);
|
|
12921
|
-
return handled;
|
|
12922
|
-
}
|
|
12923
|
-
if (method === "GET" && url.pathname === "/api/identities") {
|
|
12924
|
-
const authConfig = {
|
|
12925
|
-
loopbackAutoAuth: this._autoAuthLocalhost,
|
|
12926
|
-
...this.authToken !== void 0 ? { authToken: this.authToken } : {}
|
|
12927
|
-
};
|
|
12928
|
-
const aliasReq = Object.create(req);
|
|
12929
|
-
aliasReq.url = "/api/hub/agents" + url.search;
|
|
12930
|
-
const handled = await handleHubRoute(
|
|
12931
|
-
{ authConfig, service: this.v11Bindings.hubService },
|
|
12932
|
-
aliasReq,
|
|
12933
|
-
res
|
|
12934
|
-
);
|
|
12935
|
-
return handled;
|
|
12936
|
-
}
|
|
12937
|
-
return false;
|
|
12954
|
+
return dispatchV11Request(
|
|
12955
|
+
{
|
|
12956
|
+
bindings: this.v11Bindings,
|
|
12957
|
+
...this.authToken !== void 0 ? { authToken: this.authToken } : {},
|
|
12958
|
+
loopbackAutoAuth: this._autoAuthLocalhost
|
|
12959
|
+
},
|
|
12960
|
+
req,
|
|
12961
|
+
res,
|
|
12962
|
+
url,
|
|
12963
|
+
method
|
|
12964
|
+
);
|
|
12938
12965
|
}
|
|
12939
12966
|
/**
|
|
12940
12967
|
* v0.10.2: enable (or disable) the loopback auto-auth fast path. See
|
|
@@ -28823,14 +28850,18 @@ async function startDashboardServer(options) {
|
|
|
28823
28850
|
}
|
|
28824
28851
|
}
|
|
28825
28852
|
};
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
authToken: options.authToken,
|
|
28829
|
-
approvals: options.approvals,
|
|
28830
|
-
onEvent
|
|
28831
|
-
};
|
|
28853
|
+
let v11Bindings = null;
|
|
28854
|
+
let v11LoopbackAutoAuth = false;
|
|
28832
28855
|
const server = http.createServer(async (req, res) => {
|
|
28833
28856
|
try {
|
|
28857
|
+
const deps = {
|
|
28858
|
+
sources: options.sources,
|
|
28859
|
+
authToken: options.authToken,
|
|
28860
|
+
approvals: options.approvals,
|
|
28861
|
+
onEvent,
|
|
28862
|
+
v11Bindings,
|
|
28863
|
+
loopbackAutoAuth: v11LoopbackAutoAuth
|
|
28864
|
+
};
|
|
28834
28865
|
const served = await handleRequest(deps, req, res);
|
|
28835
28866
|
if (!served) {
|
|
28836
28867
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
@@ -28868,7 +28899,13 @@ async function startDashboardServer(options) {
|
|
|
28868
28899
|
publishActivity: (entry) => publish({ type: "activity", data: entry }),
|
|
28869
28900
|
publishApproval: (approval) => publish({ type: "approval", data: approval }),
|
|
28870
28901
|
publishInbox: (item) => publish({ type: "inbox", data: item }),
|
|
28871
|
-
publishAgentStatus: (snapshot) => publish({ type: "agent_status", data: snapshot })
|
|
28902
|
+
publishAgentStatus: (snapshot) => publish({ type: "agent_status", data: snapshot }),
|
|
28903
|
+
setV11Bindings: (bindings) => {
|
|
28904
|
+
v11Bindings = bindings;
|
|
28905
|
+
},
|
|
28906
|
+
setV11LoopbackAutoAuth: (enabled) => {
|
|
28907
|
+
v11LoopbackAutoAuth = enabled;
|
|
28908
|
+
}
|
|
28872
28909
|
};
|
|
28873
28910
|
}
|
|
28874
28911
|
|