@guren/server 2.31.1 → 2.32.0

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.
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
2
  import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
3
- import { a as MCP_ENDPOINT_PATH, n as RUNTIME_ERRORS_PATH, o as createMcpAccessGuard, s as isMcpEndpointEnabled, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-BclelWhA.js";
3
+ import { a as DEV_CENTER_FEEDBACK_ROUTE, l as isMcpEndpointEnabled, n as RUNTIME_ERRORS_PATH, o as MCP_ENDPOINT_PATH, s as createMcpAccessGuard, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-DzllKc0d.js";
4
4
  //#region src/mcp/McpServiceProvider.ts
5
5
  var McpServiceProvider_exports = /* @__PURE__ */ __exportAll({
6
6
  DEV_MCP_CLI_TOO_OLD: () => DEV_MCP_CLI_TOO_OLD,
@@ -39,11 +39,29 @@ var McpServiceProvider = class extends ServiceProvider {
39
39
  for (const path of [
40
40
  "/_guren",
41
41
  "/_guren/",
42
- "/_guren/graph.json"
42
+ "/_guren/graph.json",
43
+ "/_guren/plans.json",
44
+ "/_guren/plans/:slug",
45
+ "/_guren/plans/:slug/review",
46
+ "/_guren/plans/:slug/evidence",
47
+ "/_guren/plans/:slug/readiness/:decision",
48
+ "/_guren/browser/:run/screenshots/:sha256",
49
+ DEV_CENTER_FEEDBACK_ROUTE
43
50
  ]) {
44
51
  hono.use(path, createMcpAccessGuard());
45
52
  hono.get(path, (ctx) => isMcpEndpointEnabled() ? center.fetch(ctx.req.raw) : ctx.notFound());
46
53
  }
54
+ hono.post(DEV_CENTER_FEEDBACK_ROUTE, (ctx) => {
55
+ if (!isMcpEndpointEnabled()) return ctx.notFound();
56
+ if (ctx.req.header("origin") !== new URL(ctx.req.url).origin) return ctx.json({
57
+ schemaVersion: 1,
58
+ error: {
59
+ code: "origin",
60
+ message: "Feedback is accepted from the Dev Center page only."
61
+ }
62
+ }, 403);
63
+ return center.fetch(ctx.req.raw);
64
+ });
47
65
  }
48
66
  const buffer = this.container.makeOptional(RUNTIME_ERRORS_BINDING);
49
67
  const runtimeErrors = buffer ? (query) => isMcpEndpointEnabled() ? buffer.read(query) : {
@@ -4,7 +4,7 @@ import chalk from "chalk";
4
4
  import figlet from "figlet";
5
5
  import standard from "figlet/importable-fonts/Standard.js";
6
6
  //#region package.json
7
- var version = "2.31.1";
7
+ var version = "2.32.0";
8
8
  //#endregion
9
9
  //#region src/http/dev-banner.ts
10
10
  var dev_banner_exports = /* @__PURE__ */ __exportAll({
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import { _ as verifyApiToken, a as getApiToken, c as hasBearerHeader, d as revok
20
20
  import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
21
21
  import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-Bi5U8N5P.js";
22
22
  import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
23
- import { i as loadRuntimeErrorsModule, r as captureRuntimeError, s as isMcpEndpointEnabled, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-BclelWhA.js";
23
+ import { c as isDevCenterFeedbackRequest, i as loadRuntimeErrorsModule, l as isMcpEndpointEnabled, r as captureRuntimeError, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-DzllKc0d.js";
24
24
  import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
25
25
  import { a as setBroadcastManager, c as PresenceChannel, d as createWebSocketOriginGuard, i as getBroadcastManager, l as PrivateChannel, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster, u as Channel } from "./broadcasting-CcevVE5Y.js";
26
26
  import { c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "./i18n-BShPpJZa.js";
@@ -1418,7 +1418,7 @@ function createCsrfMiddleware(options = {}, cookielessAuthEndpoints) {
1418
1418
  settleCookie(ctx);
1419
1419
  return;
1420
1420
  }
1421
- if (isExcluded$1(path, exclude) || isMcpEndpointRequest(path) || isCookielessAuthEndpoint(path, cookielessAuthEndpoints) || isBearerRequestWithoutCookies(ctx) || isSeamPrincipalRequest(ctx)) {
1421
+ if (isExcluded$1(path, exclude) || isMcpEndpointRequest(path) || isDevCenterFeedbackRequest(path) || isCookielessAuthEndpoint(path, cookielessAuthEndpoints) || isBearerRequestWithoutCookies(ctx) || isSeamPrincipalRequest(ctx)) {
1422
1422
  await next();
1423
1423
  settleCookie(ctx);
1424
1424
  return;
@@ -3565,7 +3565,7 @@ let devBanner;
3565
3565
  */
3566
3566
  async function loadDevBanner() {
3567
3567
  if (typeof process === "undefined") return devBanner;
3568
- if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-DZkJZ1X-.js").then((n) => n.n);
3568
+ if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-BGRan2PN.js").then((n) => n.n);
3569
3569
  return devBanner;
3570
3570
  }
3571
3571
  /**
@@ -3801,7 +3801,7 @@ var Application = class {
3801
3801
  this.bootSequence ??= new BootSequence([
3802
3802
  () => this.options.boot?.(this.hono),
3803
3803
  () => this.mountRoutes(),
3804
- () => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-CvFExxdJ.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?"),
3804
+ () => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-DwIbM1zn.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?"),
3805
3805
  () => this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-BVPZjwQp.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?"),
3806
3806
  () => this.providerManager.bootAll(),
3807
3807
  () => this.warnOnUnconfiguredAuth()
@@ -6,6 +6,14 @@
6
6
  import type { MiddlewareHandler } from 'hono';
7
7
  export { isLoopbackAddress, isLoopbackOrigin } from '../http/middleware/loopback-guard.js';
8
8
  export declare const MCP_ENDPOINT_PATH = "/_guren/mcp";
9
+ /** Where the Dev Center saves a plan review's feedback (RFC 0030 §8), its one write route. */
10
+ export declare const DEV_CENTER_FEEDBACK_ROUTE = "/_guren/plans/:slug/feedback";
11
+ /**
12
+ * The page posts without an `XSRF-TOKEN`: an app with no auth issues none. The CLI handler
13
+ * requires the request's own `Origin` instead, behind the loopback guard, and the route
14
+ * exists only while {@link isMcpEndpointEnabled} holds.
15
+ */
16
+ export declare function isDevCenterFeedbackRequest(path: string): boolean;
9
17
  /**
10
18
  * Whether the MCP endpoint is mounted: opt-in via `GUREN_MCP=1`, never in
11
19
  * production (it exposes project introspection and code generation). The env
package/dist/mcp/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as McpServiceProvider } from "../McpServiceProvider-CvFExxdJ.js";
1
+ import { t as McpServiceProvider } from "../McpServiceProvider-DwIbM1zn.js";
2
2
  export { McpServiceProvider };
@@ -2,7 +2,7 @@ import { a as trimTrailingSlashes, n as isRealPathWithin, t as isPathWithin } fr
2
2
  import { n as parseImportMap } from "../inertia-defaults-BjrcT7za.js";
3
3
  import { n as hash } from "../Hash-D2DFd8xX.js";
4
4
  import { a as getManifestCss, c as isViteProduction, d as startViteDevServer, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-DO0pU1vm.js";
5
- import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-DZkJZ1X-.js";
5
+ import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-BGRan2PN.js";
6
6
  import { createRequire } from "node:module";
7
7
  import { dirname, extname, join, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
@@ -2,6 +2,17 @@ import { t as createLoopbackGuard } from "./loopback-guard-CG8xB4v0.js";
2
2
  import { r as tryGetRequestContainer } from "./request-container-BbuH0JJy.js";
3
3
  //#region src/mcp/endpoint.ts
4
4
  const MCP_ENDPOINT_PATH = "/_guren/mcp";
5
+ /** Where the Dev Center saves a plan review's feedback (RFC 0030 §8), its one write route. */
6
+ const DEV_CENTER_FEEDBACK_ROUTE = "/_guren/plans/:slug/feedback";
7
+ const DEV_CENTER_FEEDBACK_PATH = /^\/_guren\/plans\/[^/]+\/feedback$/;
8
+ /**
9
+ * The page posts without an `XSRF-TOKEN`: an app with no auth issues none. The CLI handler
10
+ * requires the request's own `Origin` instead, behind the loopback guard, and the route
11
+ * exists only while {@link isMcpEndpointEnabled} holds.
12
+ */
13
+ function isDevCenterFeedbackRequest(path) {
14
+ return DEV_CENTER_FEEDBACK_PATH.test(path) && isMcpEndpointEnabled();
15
+ }
5
16
  /**
6
17
  * Whether the MCP endpoint is mounted: opt-in via `GUREN_MCP=1`, never in
7
18
  * production (it exposes project introspection and code generation). The env
@@ -35,7 +46,7 @@ let loading;
35
46
  * a call no define can settle. `tests/mcp/runtime-errors.test.ts` pins the form.
36
47
  */
37
48
  function loadRuntimeErrorsModule() {
38
- if (typeof process !== "undefined" && process.env.NODE_ENV !== "production" && isMcpEndpointEnabled()) return loading ??= import("./runtime-errors-DOPBX0Ox.js");
49
+ if (typeof process !== "undefined" && process.env.NODE_ENV !== "production" && isMcpEndpointEnabled()) return loading ??= import("./runtime-errors-D229wyoc.js");
39
50
  }
40
51
  /** Only ExceptionHandler calls this, after applying its dontReport policy. */
41
52
  function captureRuntimeError(error, ctx, status) {
@@ -45,4 +56,4 @@ function captureRuntimeError(error, ctx, status) {
45
56
  } catch {}
46
57
  }
47
58
  //#endregion
48
- export { MCP_ENDPOINT_PATH as a, loadRuntimeErrorsModule as i, RUNTIME_ERRORS_PATH as n, createMcpAccessGuard as o, captureRuntimeError as r, isMcpEndpointEnabled as s, RUNTIME_ERRORS_BINDING as t };
59
+ export { DEV_CENTER_FEEDBACK_ROUTE as a, isDevCenterFeedbackRequest as c, loadRuntimeErrorsModule as i, isMcpEndpointEnabled as l, RUNTIME_ERRORS_PATH as n, MCP_ENDPOINT_PATH as o, captureRuntimeError as r, createMcpAccessGuard as s, RUNTIME_ERRORS_BINDING as t };
@@ -1,4 +1,4 @@
1
- import { n as RUNTIME_ERRORS_PATH, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-BclelWhA.js";
1
+ import { n as RUNTIME_ERRORS_PATH, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-DzllKc0d.js";
2
2
  import { r as tryGetRequestContainer } from "./request-container-BbuH0JJy.js";
3
3
  import { realpathSync, statSync } from "node:fs";
4
4
  import { routePath } from "hono/route";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "2.31.1",
3
+ "version": "2.32.0",
4
4
  "description": "HTTP layer of the Guren framework, on Hono: routing, controllers, middleware, auth, sessions, queues and the AWS Lambda adapter. Applications import it through @guren/core.",
5
5
  "keywords": [
6
6
  "guren",