@tool-bridge/server 0.26.1 → 0.26.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/admin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  BootstrapStateStore,
4
4
  package_default
5
- } from "./chunk-6F7TBJQ2.js";
5
+ } from "./chunk-KTWFYFDL.js";
6
6
  import {
7
7
  httpsReleaseUrl,
8
8
  pluginImageSchema
@@ -216,7 +216,7 @@ var BootstrapStateStore = class {
216
216
  // package.json
217
217
  var package_default = {
218
218
  name: "@tool-bridge/server",
219
- version: "0.26.1",
219
+ version: "0.26.2",
220
220
  description: "Self-hosted Tool Bridge Node server with PostgreSQL, S3 object storage and WebSocket device channels",
221
221
  type: "module",
222
222
  license: "MIT",
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  BootstrapStateStore,
12
12
  package_default
13
- } from "./chunk-6F7TBJQ2.js";
13
+ } from "./chunk-KTWFYFDL.js";
14
14
  import {
15
15
  createGuardedFetch
16
16
  } from "./chunk-NXLE6ZEK.js";
@@ -21153,7 +21153,7 @@ function consentPage(action, redirectUri, invalidKey = false) {
21153
21153
  }
21154
21154
 
21155
21155
  // src/mcpOAuth.ts
21156
- var AUTHORIZE = "/~oauth/mcp/authorize";
21156
+ var MCP_AUTHORIZE_PATH = "/~oauth/mcp/authorize";
21157
21157
  var TOKEN = "/~oauth/mcp/token";
21158
21158
  var FORM_TYPE = "application/x-www-form-urlencoded";
21159
21159
  var MAX_REQUEST = 8192;
@@ -21280,7 +21280,7 @@ function createMcpOAuth(state, canonicalOrigin, fetchClientMetadata) {
21280
21280
  scopesSupported: [MCP_OAUTH_SCOPE],
21281
21281
  oauthMetadata: {
21282
21282
  issuer,
21283
- authorization_endpoint: issuer + AUTHORIZE,
21283
+ authorization_endpoint: issuer + MCP_AUTHORIZE_PATH,
21284
21284
  token_endpoint: issuer + TOKEN,
21285
21285
  scopes_supported: [MCP_OAUTH_SCOPE],
21286
21286
  response_types_supported: ["code"],
@@ -21307,7 +21307,7 @@ function createMcpOAuth(state, canonicalOrigin, fetchClientMetadata) {
21307
21307
  }
21308
21308
  return Response.json({ error: "server_error" }, { status: 500, headers: noStore });
21309
21309
  });
21310
- routes.all(AUTHORIZE, async (c) => {
21310
+ routes.all(MCP_AUTHORIZE_PATH, async (c) => {
21311
21311
  const request2 = c.req.raw;
21312
21312
  if (!["GET", "POST"].includes(request2.method)) return methodError("GET, POST");
21313
21313
  if (request2.method === "POST" && request2.headers.get("origin") !== issuer) {
@@ -21321,7 +21321,7 @@ function createMcpOAuth(state, canonicalOrigin, fetchClientMetadata) {
21321
21321
  throw new EndpointError("invalid_request");
21322
21322
  }
21323
21323
  if (params.has("state") && !/^[\x20-\x7e]+$/.test(params.get("state"))) throw new EndpointError("invalid_request");
21324
- const action = issuer + AUTHORIZE + "?" + params.toString();
21324
+ const action = issuer + MCP_AUTHORIZE_PATH + "?" + params.toString();
21325
21325
  if (request2.method === "GET") return consentPage(action, MCP_OAUTH_REDIRECT_URI);
21326
21326
  const body = await form(request2, ["sk", "decision"]);
21327
21327
  if (body.get("decision") === "deny") return authorizationResponse(issuer, params, { error: "access_denied" });
@@ -21358,7 +21358,7 @@ function createMcpOAuth(state, canonicalOrigin, fetchClientMetadata) {
21358
21358
  resourceMetadataUrl: getOAuthProtectedResourceMetadataUrl(resourceServerUrl),
21359
21359
  async handlePublic(request2) {
21360
21360
  const path = new URL(request2.url).pathname;
21361
- if (path === AUTHORIZE || path === TOKEN) return routes.fetch(request2);
21361
+ if (path === MCP_AUTHORIZE_PATH || path === TOKEN) return routes.fetch(request2);
21362
21362
  return oauthMetadataResponse(request2, metadata);
21363
21363
  },
21364
21364
  identify: (authorization, now) => identifyMcpToken(state, issuer, authorization, now)
@@ -22144,7 +22144,9 @@ async function createManagedServer(options) {
22144
22144
  const replicaId = randomUUID11();
22145
22145
  const assets = resolveUiAssets(options.uiDir);
22146
22146
  const app = new Hono5();
22147
- app.use("*", secureHeaders());
22147
+ const defaults = secureHeaders();
22148
+ const consent = secureHeaders({ referrerPolicy: "same-origin" });
22149
+ app.use("*", (c, next) => c.req.path === MCP_AUTHORIZE_PATH ? consent(c, next) : defaults(c, next));
22148
22150
  app.use("/~setup/*", bodyLimit({ maxSize: 65536 }));
22149
22151
  app.use("/~setup/*", async (c, next) => {
22150
22152
  c.header("Cache-Control", "no-store");
@@ -22367,19 +22369,19 @@ async function createManagedServer(options) {
22367
22369
  c.req.header("x-tb-setup-token"),
22368
22370
  phase === "recovery" ? "recovery" : "setup"
22369
22371
  );
22370
- const defaults = await store.defaults();
22372
+ const defaults2 = await store.defaults();
22371
22373
  return c.json({
22372
- databaseConfigured: Boolean(defaults?.databaseUrl),
22373
- storageConfigured: Boolean(defaults?.storage),
22374
- ...defaults?.databaseUrl ? { databaseHost: new URL(defaults.databaseUrl).hostname } : {},
22375
- ...defaults?.storage ? {
22374
+ databaseConfigured: Boolean(defaults2?.databaseUrl),
22375
+ storageConfigured: Boolean(defaults2?.storage),
22376
+ ...defaults2?.databaseUrl ? { databaseHost: new URL(defaults2.databaseUrl).hostname } : {},
22377
+ ...defaults2?.storage ? {
22376
22378
  storage: {
22377
- endpoint: defaults.storage.endpoint,
22378
- bucket: defaults.storage.bucket,
22379
- region: defaults.storage.region
22379
+ endpoint: defaults2.storage.endpoint,
22380
+ bucket: defaults2.storage.bucket,
22381
+ region: defaults2.storage.region
22380
22382
  }
22381
22383
  } : {},
22382
- redisConfigured: Boolean(defaults?.redisUrl)
22384
+ redisConfigured: Boolean(defaults2?.redisUrl)
22383
22385
  });
22384
22386
  });
22385
22387
  const configure = async (request2, recovery) => store.exclusive(async () => {
@@ -22416,12 +22418,12 @@ async function createManagedServer(options) {
22416
22418
  ...backup.signingRetireAfter ? { signingRetireAfter: backup.signingRetireAfter } : {}
22417
22419
  };
22418
22420
  }
22419
- const defaults = await store.defaults();
22421
+ const defaults2 = await store.defaults();
22420
22422
  const input = {
22421
- ...defaults,
22423
+ ...defaults2,
22422
22424
  ...body,
22423
- databaseUrl: body.databaseUrl ?? defaults?.databaseUrl,
22424
- storage: body.storage ?? defaults?.storage
22425
+ databaseUrl: body.databaseUrl ?? defaults2?.databaseUrl,
22426
+ storage: body.storage ?? defaults2?.storage
22425
22427
  };
22426
22428
  if (!input.databaseUrl || !recovery && !input.storage) {
22427
22429
  throw new TBError(
@@ -22435,7 +22437,7 @@ async function createManagedServer(options) {
22435
22437
  databaseUrl: input.databaseUrl,
22436
22438
  redisUrl: input.redisUrl,
22437
22439
  // Trust comes only from the local installer defaults, never from the web form.
22438
- internalS3Origin: defaults?.storage ? new URL(defaults.storage.endpoint).origin : current.internalS3Origin,
22440
+ internalS3Origin: defaults2?.storage ? new URL(defaults2.storage.endpoint).origin : current.internalS3Origin,
22439
22441
  revision: current.revision + 1
22440
22442
  };
22441
22443
  phase = "installing";
package/dist/index.js CHANGED
@@ -19,11 +19,11 @@ import {
19
19
  createTbServer,
20
20
  probeS3ObjectStore,
21
21
  runtimeAppSettings
22
- } from "./chunk-FH7ST6SW.js";
22
+ } from "./chunk-VKZYPURU.js";
23
23
  import "./chunk-U7PTOA3U.js";
24
24
  import {
25
25
  BootstrapStateStore
26
- } from "./chunk-6F7TBJQ2.js";
26
+ } from "./chunk-KTWFYFDL.js";
27
27
  import "./chunk-NXLE6ZEK.js";
28
28
  import "./chunk-6W5WJCKR.js";
29
29
  import "./chunk-4WDQGEOC.js";
package/dist/main.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createManagedServer
4
- } from "./chunk-FH7ST6SW.js";
4
+ } from "./chunk-VKZYPURU.js";
5
5
  import "./chunk-U7PTOA3U.js";
6
6
  import {
7
7
  package_default
8
- } from "./chunk-6F7TBJQ2.js";
8
+ } from "./chunk-KTWFYFDL.js";
9
9
  import "./chunk-NXLE6ZEK.js";
10
10
  import "./chunk-6W5WJCKR.js";
11
11
  import "./chunk-4WDQGEOC.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tool-bridge/server",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "description": "Self-hosted Tool Bridge Node server with PostgreSQL, S3 object storage and WebSocket device channels",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,8 +61,8 @@
61
61
  "@types/proper-lockfile": "^4.1.4",
62
62
  "@types/negotiator": "^0.6.4",
63
63
  "@tool-bridge/app": "0.25.0",
64
- "@tool-bridge/core": "0.1.0",
65
- "@tool-bridge/plugins": "0.1.0"
64
+ "@tool-bridge/plugins": "0.1.0",
65
+ "@tool-bridge/core": "0.1.0"
66
66
  },
67
67
  "repository": {
68
68
  "type": "git",