capable-kit 0.0.1-alpha.1 → 0.0.1-alpha.3
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/README.md +32 -0
- package/dist/ai-sdk.d.mts +1 -1
- package/dist/app.d.mts +1 -1
- package/dist/bin.mjs +179 -18
- package/dist/bin.mjs.map +1 -1
- package/dist/cli.d.mts +1 -1
- package/dist/eve.d.mts +3 -3
- package/dist/eve.mjs.map +1 -1
- package/dist/http.d.mts +1 -1
- package/dist/http.mjs +1 -1
- package/dist/{index-Dp-D73pf.d.mts → index-AqKbVZ8Z.d.mts} +2 -2
- package/dist/{index-CThfifn8.d.mts → index-B2ru1zGQ.d.mts} +3 -3
- package/dist/{index-BxJhwhKm.d.mts → index-B_I9n6gN.d.mts} +4 -5
- package/dist/index.d.mts +1 -1
- package/dist/mcp.d.mts +2 -2
- package/dist/runtime-support.d.mts +2 -3
- package/dist/runtime-support.mjs +278 -24
- package/dist/runtime-support.mjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +1 -1
- package/dist/src-3UaBqI8H.mjs.map +1 -1
- package/dist/src-B53ZbNtC.mjs.map +1 -1
- package/dist/src-BjBxOv7x.mjs.map +1 -1
- package/dist/{src-XRJ9hgYX.mjs → src-DX2xrplP.mjs} +18 -2
- package/dist/src-DX2xrplP.mjs.map +1 -0
- package/dist/{src-DpSA-hBO.mjs → src-DtSY5fzY.mjs} +2 -2
- package/dist/{src-DpSA-hBO.mjs.map → src-DtSY5fzY.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/src-XRJ9hgYX.mjs.map +0 -1
package/dist/runtime-support.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createHttpHandler } from "./src-
|
|
1
|
+
import { t as createHttpHandler } from "./src-DX2xrplP.mjs";
|
|
2
2
|
import { t as mcp } from "./mount--YHrgRHJ.mjs";
|
|
3
|
-
import { n as http, r as standard, t as createServer } from "./src-
|
|
3
|
+
import { n as http, r as standard, t as createServer } from "./src-DtSY5fzY.mjs";
|
|
4
4
|
//#region packages/nitro-host/src/dev-index.ts
|
|
5
5
|
function devIndex() {
|
|
6
6
|
return {
|
|
@@ -39,21 +39,21 @@ function renderDevIndex(app) {
|
|
|
39
39
|
<article class="capability">
|
|
40
40
|
<div class="capability-head">
|
|
41
41
|
<div class="capability-title">
|
|
42
|
-
<h3>${escapeHtml(capability.title ?? entry.path.at(-1))}</h3>
|
|
43
|
-
<span class="effect ${escapeHtml(capability.effect ?? "unspecified")}">${escapeHtml(capability.effect ?? "unspecified")}</span>
|
|
44
|
-
${badges.map((badge) => `<span class="badge">${escapeHtml(badge)}</span>`).join("")}
|
|
42
|
+
<h3>${escapeHtml$1(capability.title ?? entry.path.at(-1))}</h3>
|
|
43
|
+
<span class="effect ${escapeHtml$1(capability.effect ?? "unspecified")}">${escapeHtml$1(capability.effect ?? "unspecified")}</span>
|
|
44
|
+
${badges.map((badge) => `<span class="badge">${escapeHtml$1(badge)}</span>`).join("")}
|
|
45
45
|
</div>
|
|
46
|
-
${canOpen ? `<a class="open" href="${escapeHtml(route.path)}">Open <span aria-hidden="true">↗</span></a>` : ""}
|
|
46
|
+
${canOpen ? `<a class="open" href="${escapeHtml$1(route.path)}">Open <span aria-hidden="true">↗</span></a>` : ""}
|
|
47
47
|
</div>
|
|
48
|
-
${capability.description ? `<p class="capability-description">${escapeHtml(capability.description)}</p>` : ""}
|
|
48
|
+
${capability.description ? `<p class="capability-description">${escapeHtml$1(capability.description)}</p>` : ""}
|
|
49
49
|
${command ? command_(command) : ""}
|
|
50
50
|
<div class="identity">
|
|
51
|
-
<span class="method">${escapeHtml(route?.method ?? "OP")}</span>
|
|
51
|
+
<span class="method">${escapeHtml$1(route?.method ?? "OP")}</span>
|
|
52
52
|
${[
|
|
53
53
|
route?.path ?? entry.path.join("."),
|
|
54
54
|
entry.path.join("."),
|
|
55
55
|
capability.id
|
|
56
|
-
].filter((value, index, all) => all.indexOf(value) === index).map((value) => `<code>${escapeHtml(value)}</code>`).join(`<span class="identity-sep" aria-hidden="true">·</span>`)}
|
|
56
|
+
].filter((value, index, all) => all.indexOf(value) === index).map((value) => `<code>${escapeHtml$1(value)}</code>`).join(`<span class="identity-sep" aria-hidden="true">·</span>`)}
|
|
57
57
|
</div>
|
|
58
58
|
</article>`;
|
|
59
59
|
}).join("");
|
|
@@ -63,8 +63,8 @@ function renderDevIndex(app) {
|
|
|
63
63
|
<meta charset="utf-8">
|
|
64
64
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
65
65
|
<meta name="color-scheme" content="light dark">
|
|
66
|
-
<title>${escapeHtml(app.name)} · Capable</title>
|
|
67
|
-
<style>${styles}</style>
|
|
66
|
+
<title>${escapeHtml$1(app.name)} · Capable</title>
|
|
67
|
+
<style>${styles$1}</style>
|
|
68
68
|
</head>
|
|
69
69
|
<body>
|
|
70
70
|
<header class="topbar">
|
|
@@ -80,10 +80,10 @@ function renderDevIndex(app) {
|
|
|
80
80
|
<main class="shell">
|
|
81
81
|
<section class="hero">
|
|
82
82
|
<div class="title-row">
|
|
83
|
-
<h1>${escapeHtml(app.name)}</h1>
|
|
84
|
-
<span class="version">v${escapeHtml(app.version)}</span>
|
|
83
|
+
<h1>${escapeHtml$1(app.name)}</h1>
|
|
84
|
+
<span class="version">v${escapeHtml$1(app.version)}</span>
|
|
85
85
|
</div>
|
|
86
|
-
<p>${escapeHtml(app.description ?? "A capability application powered by Capable.")}</p>
|
|
86
|
+
<p>${escapeHtml$1(app.description ?? "A capability application powered by Capable.")}</p>
|
|
87
87
|
</section>
|
|
88
88
|
|
|
89
89
|
<section class="cli" aria-label="Command line">
|
|
@@ -126,11 +126,11 @@ function renderDevIndex(app) {
|
|
|
126
126
|
function command_(command, label) {
|
|
127
127
|
const full = `cap cli ${command}`;
|
|
128
128
|
return `<div class="command">
|
|
129
|
-
${label ? `<span class="command-label">${escapeHtml(label)}</span>` : ""}
|
|
129
|
+
${label ? `<span class="command-label">${escapeHtml$1(label)}</span>` : ""}
|
|
130
130
|
<div class="command-line">
|
|
131
131
|
<span class="prompt" aria-hidden="true">$</span>
|
|
132
|
-
<code>${escapeHtml(full)}</code>
|
|
133
|
-
<button type="button" class="copy" data-copy="${escapeHtml(full)}" aria-label="Copy command">Copy</button>
|
|
132
|
+
<code>${escapeHtml$1(full)}</code>
|
|
133
|
+
<button type="button" class="copy" data-copy="${escapeHtml$1(full)}" aria-label="Copy command">Copy</button>
|
|
134
134
|
</div>
|
|
135
135
|
</div>`;
|
|
136
136
|
}
|
|
@@ -149,12 +149,12 @@ function cliCommand(entry) {
|
|
|
149
149
|
}
|
|
150
150
|
function protocolLink(name, path, navigable) {
|
|
151
151
|
const content = `
|
|
152
|
-
<span>${escapeHtml(name)}</span>
|
|
153
|
-
<code>${escapeHtml(path)}</code>
|
|
152
|
+
<span>${escapeHtml$1(name)}</span>
|
|
153
|
+
<code>${escapeHtml$1(path)}</code>
|
|
154
154
|
<span class="protocol-arrow" aria-hidden="true">${navigable ? "↗" : "●"}</span>`;
|
|
155
|
-
return navigable ? `<a class="protocol" href="${escapeHtml(path)}">${content}</a>` : `<div class="protocol protocol-static">${content}</div>`;
|
|
155
|
+
return navigable ? `<a class="protocol" href="${escapeHtml$1(path)}">${content}</a>` : `<div class="protocol protocol-static">${content}</div>`;
|
|
156
156
|
}
|
|
157
|
-
function escapeHtml(value) {
|
|
157
|
+
function escapeHtml$1(value) {
|
|
158
158
|
return value.replace(/[&<>"']/g, (character) => ({
|
|
159
159
|
"&": "&",
|
|
160
160
|
"<": "<",
|
|
@@ -163,7 +163,7 @@ function escapeHtml(value) {
|
|
|
163
163
|
"'": "'"
|
|
164
164
|
})[character]);
|
|
165
165
|
}
|
|
166
|
-
const styles = String.raw`
|
|
166
|
+
const styles$1 = String.raw`
|
|
167
167
|
:root {
|
|
168
168
|
color-scheme: light;
|
|
169
169
|
--background: #fff;
|
|
@@ -300,6 +300,247 @@ const script = String.raw`
|
|
|
300
300
|
});
|
|
301
301
|
`;
|
|
302
302
|
//#endregion
|
|
303
|
+
//#region packages/nitro-host/src/production-splash.ts
|
|
304
|
+
const DEPLOYMENT_URL_PLACEHOLDER = "{{DEPLOYMENT_URL}}";
|
|
305
|
+
function productionSplash() {
|
|
306
|
+
return {
|
|
307
|
+
kind: "capable.server.mount",
|
|
308
|
+
compile(app) {
|
|
309
|
+
const html = renderProductionSplash(app);
|
|
310
|
+
return {
|
|
311
|
+
name: "production-splash",
|
|
312
|
+
fetch(request) {
|
|
313
|
+
const url = new URL(request.url);
|
|
314
|
+
if (request.method !== "GET" || url.pathname !== "/") return;
|
|
315
|
+
return productionSplashResponse(html, request);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function withProductionSplash(server, app) {
|
|
322
|
+
const splash = productionSplash().compile(app, void 0);
|
|
323
|
+
return Object.freeze({ async fetch(request) {
|
|
324
|
+
return await splash.fetch(request) ?? server.fetch(request);
|
|
325
|
+
} });
|
|
326
|
+
}
|
|
327
|
+
function renderProductionSplash(app) {
|
|
328
|
+
return `<!doctype html>
|
|
329
|
+
<html lang="en">
|
|
330
|
+
<head>
|
|
331
|
+
<meta charset="utf-8">
|
|
332
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
333
|
+
<meta name="color-scheme" content="light dark">
|
|
334
|
+
<meta name="robots" content="noindex">
|
|
335
|
+
<meta name="referrer" content="no-referrer">
|
|
336
|
+
<title>${escapeHtml(app.name)} · Capable</title>
|
|
337
|
+
<style>${styles}</style>
|
|
338
|
+
</head>
|
|
339
|
+
<body>
|
|
340
|
+
<main>
|
|
341
|
+
<section class="card" aria-label="Deployment status">
|
|
342
|
+
<header>
|
|
343
|
+
<h1>${escapeHtml(app.name)}</h1>
|
|
344
|
+
<p class="status">
|
|
345
|
+
<span class="status-state"><span class="status-dot" aria-hidden="true"></span>Ready</span>
|
|
346
|
+
<span class="status-separator" aria-hidden="true">·</span>
|
|
347
|
+
<span>Production</span>
|
|
348
|
+
</p>
|
|
349
|
+
</header>
|
|
350
|
+
<div class="command" role="group" aria-label="Inspect from your terminal">
|
|
351
|
+
<div class="command-line">
|
|
352
|
+
<span class="command-prompt" aria-hidden="true">$</span>
|
|
353
|
+
<code>capable cli --app ${DEPLOYMENT_URL_PLACEHOLDER} --help</code>
|
|
354
|
+
</div>
|
|
355
|
+
</div>
|
|
356
|
+
<section class="endpoints" aria-label="Deployment endpoints">
|
|
357
|
+
<a href="/openapi.json">
|
|
358
|
+
<span class="endpoint-name">OpenAPI</span>
|
|
359
|
+
<code class="endpoint-path">/openapi.json</code>
|
|
360
|
+
</a>
|
|
361
|
+
<a href="/_capable/manifest">
|
|
362
|
+
<span class="endpoint-name">Manifest</span>
|
|
363
|
+
<code class="endpoint-path">/_capable/manifest</code>
|
|
364
|
+
</a>
|
|
365
|
+
<div class="endpoint">
|
|
366
|
+
<span class="endpoint-name">MCP</span>
|
|
367
|
+
<code class="endpoint-path">/mcp</code>
|
|
368
|
+
</div>
|
|
369
|
+
</section>
|
|
370
|
+
</section>
|
|
371
|
+
</main>
|
|
372
|
+
</body>
|
|
373
|
+
</html>`;
|
|
374
|
+
}
|
|
375
|
+
function productionSplashResponse(html, request) {
|
|
376
|
+
return new Response(html.replace(DEPLOYMENT_URL_PLACEHOLDER, () => escapeHtml(resolveDeploymentUrl(request))), { headers: {
|
|
377
|
+
"cache-control": "no-store",
|
|
378
|
+
"content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'",
|
|
379
|
+
"content-type": "text/html; charset=utf-8",
|
|
380
|
+
"referrer-policy": "no-referrer",
|
|
381
|
+
"x-content-type-options": "nosniff",
|
|
382
|
+
"x-robots-tag": "noindex"
|
|
383
|
+
} });
|
|
384
|
+
}
|
|
385
|
+
function resolveDeploymentUrl(request) {
|
|
386
|
+
const url = new URL(request.url);
|
|
387
|
+
const host = firstForwardedValue(request.headers.get("x-forwarded-host")) ?? request.headers.get("host") ?? url.host;
|
|
388
|
+
return `${firstForwardedValue(request.headers.get("x-forwarded-proto")) ?? url.protocol.slice(0, -1)}://${host}`;
|
|
389
|
+
}
|
|
390
|
+
function firstForwardedValue(value) {
|
|
391
|
+
return value?.split(",")[0]?.trim() || void 0;
|
|
392
|
+
}
|
|
393
|
+
function escapeHtml(value) {
|
|
394
|
+
return value.replace(/[&<>"']/g, (character) => ({
|
|
395
|
+
"&": "&",
|
|
396
|
+
"<": "<",
|
|
397
|
+
">": ">",
|
|
398
|
+
"\"": """,
|
|
399
|
+
"'": "'"
|
|
400
|
+
})[character]);
|
|
401
|
+
}
|
|
402
|
+
const styles = String.raw`
|
|
403
|
+
:root {
|
|
404
|
+
color-scheme: light dark;
|
|
405
|
+
--background: #ffffff;
|
|
406
|
+
--foreground: #0a0a0a;
|
|
407
|
+
--muted: #575757;
|
|
408
|
+
--faint: #737373;
|
|
409
|
+
--border: rgba(0, 0, 0, .1);
|
|
410
|
+
--surface: #fafafa;
|
|
411
|
+
--accent: #087a4f;
|
|
412
|
+
--sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
413
|
+
--mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
|
|
414
|
+
}
|
|
415
|
+
@media (prefers-color-scheme: dark) {
|
|
416
|
+
:root {
|
|
417
|
+
--background: #0a0a0a;
|
|
418
|
+
--foreground: #ededed;
|
|
419
|
+
--muted: #a1a1a1;
|
|
420
|
+
--faint: #8a8a8a;
|
|
421
|
+
--border: rgba(255, 255, 255, .12);
|
|
422
|
+
--surface: #131313;
|
|
423
|
+
--accent: #3ecf8e;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
* { box-sizing: border-box; }
|
|
427
|
+
html, body { margin: 0; }
|
|
428
|
+
body {
|
|
429
|
+
min-height: 100vh;
|
|
430
|
+
min-height: 100dvh;
|
|
431
|
+
display: grid;
|
|
432
|
+
place-items: center;
|
|
433
|
+
padding: 2rem;
|
|
434
|
+
background: var(--background);
|
|
435
|
+
color: var(--foreground);
|
|
436
|
+
font: 15px/1.55 var(--sans);
|
|
437
|
+
font-feature-settings: "cv11", "ss01";
|
|
438
|
+
-webkit-font-smoothing: antialiased;
|
|
439
|
+
-moz-osx-font-smoothing: grayscale;
|
|
440
|
+
text-rendering: optimizeLegibility;
|
|
441
|
+
}
|
|
442
|
+
main {
|
|
443
|
+
width: min(100%, 27rem);
|
|
444
|
+
}
|
|
445
|
+
.card { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
|
|
446
|
+
header { display: flex; flex-direction: column; gap: .5rem; }
|
|
447
|
+
h1 {
|
|
448
|
+
margin: 0;
|
|
449
|
+
overflow-wrap: anywhere;
|
|
450
|
+
font-size: 1.25rem;
|
|
451
|
+
font-weight: 600;
|
|
452
|
+
letter-spacing: -.021em;
|
|
453
|
+
line-height: 1.3;
|
|
454
|
+
}
|
|
455
|
+
.status {
|
|
456
|
+
display: flex;
|
|
457
|
+
flex-wrap: wrap;
|
|
458
|
+
align-items: center;
|
|
459
|
+
gap: .25rem .5rem;
|
|
460
|
+
margin: 0;
|
|
461
|
+
color: var(--muted);
|
|
462
|
+
font-size: .875rem;
|
|
463
|
+
line-height: 1.5;
|
|
464
|
+
}
|
|
465
|
+
.status-state {
|
|
466
|
+
display: inline-flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
gap: .5rem;
|
|
469
|
+
color: var(--accent);
|
|
470
|
+
font-weight: 500;
|
|
471
|
+
line-height: inherit;
|
|
472
|
+
}
|
|
473
|
+
.status-dot {
|
|
474
|
+
width: 6px;
|
|
475
|
+
height: 6px;
|
|
476
|
+
flex: none;
|
|
477
|
+
border-radius: 50%;
|
|
478
|
+
background: currentColor;
|
|
479
|
+
}
|
|
480
|
+
.status-separator { color: var(--faint); }
|
|
481
|
+
.command {
|
|
482
|
+
display: flex;
|
|
483
|
+
flex-direction: column;
|
|
484
|
+
gap: .5rem;
|
|
485
|
+
padding: 1rem 1.0625rem;
|
|
486
|
+
border: 1px solid var(--border);
|
|
487
|
+
border-radius: .5rem;
|
|
488
|
+
background: var(--surface);
|
|
489
|
+
}
|
|
490
|
+
.command-line {
|
|
491
|
+
display: flex;
|
|
492
|
+
align-items: center;
|
|
493
|
+
gap: .5rem;
|
|
494
|
+
min-width: 0;
|
|
495
|
+
}
|
|
496
|
+
.command-prompt { color: var(--faint); user-select: none; }
|
|
497
|
+
code {
|
|
498
|
+
color: var(--foreground);
|
|
499
|
+
font: .8125rem/1.6 var(--mono);
|
|
500
|
+
font-feature-settings: "zero", "ss01";
|
|
501
|
+
overflow-wrap: anywhere;
|
|
502
|
+
}
|
|
503
|
+
.endpoints {
|
|
504
|
+
display: flex;
|
|
505
|
+
flex-direction: column;
|
|
506
|
+
border-top: 1px solid var(--border);
|
|
507
|
+
}
|
|
508
|
+
.endpoints a, .endpoint {
|
|
509
|
+
display: flex;
|
|
510
|
+
align-items: baseline;
|
|
511
|
+
justify-content: space-between;
|
|
512
|
+
gap: 1rem;
|
|
513
|
+
padding: .6875rem .125rem;
|
|
514
|
+
border-bottom: 1px solid var(--border);
|
|
515
|
+
color: var(--foreground);
|
|
516
|
+
font-size: .8125rem;
|
|
517
|
+
}
|
|
518
|
+
.endpoints a {
|
|
519
|
+
text-decoration: none;
|
|
520
|
+
}
|
|
521
|
+
.endpoint-name {
|
|
522
|
+
font-weight: 500;
|
|
523
|
+
}
|
|
524
|
+
.endpoint-path {
|
|
525
|
+
color: var(--faint);
|
|
526
|
+
font-size: .75rem;
|
|
527
|
+
text-align: right;
|
|
528
|
+
transition: color .15s ease;
|
|
529
|
+
}
|
|
530
|
+
.endpoints a:hover .endpoint-path { color: var(--foreground); }
|
|
531
|
+
.endpoints a:focus-visible {
|
|
532
|
+
border-radius: 3px;
|
|
533
|
+
outline: 2px solid var(--foreground);
|
|
534
|
+
outline-offset: 2px;
|
|
535
|
+
}
|
|
536
|
+
@media (max-width: 30rem) {
|
|
537
|
+
body { align-items: start; padding: 3rem 1.5rem 2rem; }
|
|
538
|
+
}
|
|
539
|
+
@media (prefers-reduced-motion: reduce) {
|
|
540
|
+
* { transition: none !important; }
|
|
541
|
+
}
|
|
542
|
+
`;
|
|
543
|
+
//#endregion
|
|
303
544
|
//#region packages/nitro-host/src/runtime-support.ts
|
|
304
545
|
/**
|
|
305
546
|
* Build the server Nitro hosts. The generated entry in the project supplies the
|
|
@@ -307,17 +548,30 @@ const script = String.raw`
|
|
|
307
548
|
*/
|
|
308
549
|
function createCapableNitroEntry(options) {
|
|
309
550
|
const definition = options.definition;
|
|
310
|
-
if (options.server) return options.dev ? withDevIndex(options.server, definition) : options.server;
|
|
311
|
-
|
|
551
|
+
if (options.server) return options.dev ? withDevIndex(options.server, definition) : withProductionSplash(options.server, definition);
|
|
552
|
+
const server = createServer(definition, { mounts: options.dev ? [
|
|
312
553
|
devIndex(),
|
|
313
554
|
standard(),
|
|
314
555
|
http(),
|
|
315
556
|
mcp()
|
|
316
557
|
] : [
|
|
558
|
+
productionSplash(),
|
|
317
559
|
standard(),
|
|
318
560
|
http(),
|
|
319
561
|
mcp()
|
|
320
562
|
] });
|
|
563
|
+
return options.dev ? server : withProductionMetadataCache(server);
|
|
564
|
+
}
|
|
565
|
+
const productionMetadataPaths = /* @__PURE__ */ new Set(["/_capable/manifest", "/openapi.json"]);
|
|
566
|
+
function withProductionMetadataCache(server) {
|
|
567
|
+
return { async fetch(request) {
|
|
568
|
+
const response = await server.fetch(request);
|
|
569
|
+
if (request.method === "GET" && response.ok && productionMetadataPaths.has(new URL(request.url).pathname)) {
|
|
570
|
+
response.headers.set("cache-control", "public, max-age=0, must-revalidate");
|
|
571
|
+
response.headers.set("vercel-cdn-cache-control", "public, max-age=31536000");
|
|
572
|
+
}
|
|
573
|
+
return response;
|
|
574
|
+
} };
|
|
321
575
|
}
|
|
322
576
|
//#endregion
|
|
323
577
|
export { createCapableNitroEntry };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-support.mjs","names":[],"sources":["../../nitro-host/src/dev-index.ts","../../nitro-host/src/runtime-support.ts"],"sourcesContent":["import type {\n AppDefinition,\n LocatedCapability,\n} from \"@capable/core\";\nimport { createHttpHandler } from \"@capable/fetch\";\nimport type {\n CapableServer,\n ServerMount,\n} from \"@capable/server\";\n\nexport function devIndex(): ServerMount<any> {\n return {\n kind: \"capable.server.mount\",\n compile(app) {\n const html = renderDevIndex(app);\n return {\n name: \"dev-index\",\n fetch(request) {\n const url = new URL(request.url);\n if (request.method !== \"GET\" || url.pathname !== \"/\") {\n return undefined;\n }\n return new Response(html, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n });\n },\n };\n },\n };\n}\n\nexport function withDevIndex(\n server: CapableServer,\n app: AppDefinition<any, any>,\n): CapableServer {\n const index = devIndex().compile(app, undefined);\n return Object.freeze({\n async fetch(request) {\n return await index.fetch(request) ?? server.fetch(request);\n },\n });\n}\n\nexport function renderDevIndex(app: AppDefinition<any, any>): string {\n const routes = createHttpHandler(app).routes;\n const routeByCapability = new Map(\n routes.map((route) => [route.capability.capability, route]),\n );\n const capabilityCount = app.locatedCapabilities.length;\n const firstCommand = app.locatedCapabilities\n .map((entry) => cliCommand(entry))\n .find((command): command is string => command !== undefined);\n const capabilities = app.locatedCapabilities.map((entry) => {\n const capability = entry.capability;\n const route = routeByCapability.get(capability);\n const command = cliCommand(entry);\n const canOpen = route?.method === \"GET\" && capability.input === undefined;\n const badges = [\n capability.toMarkdown ? \"Markdown\" : undefined,\n capability.deprecated ? \"Deprecated\" : undefined,\n ].filter(Boolean) as string[];\n\n return `\n <article class=\"capability\">\n <div class=\"capability-head\">\n <div class=\"capability-title\">\n <h3>${escapeHtml(capability.title ?? entry.path.at(-1)!)}</h3>\n <span class=\"effect ${escapeHtml(capability.effect ?? \"unspecified\")}\">${escapeHtml(capability.effect ?? \"unspecified\")}</span>\n ${badges.map((badge) => `<span class=\"badge\">${escapeHtml(badge)}</span>`).join(\"\")}\n </div>\n ${canOpen\n ? `<a class=\"open\" href=\"${escapeHtml(route.path)}\">Open <span aria-hidden=\"true\">↗</span></a>`\n : \"\"}\n </div>\n ${capability.description\n ? `<p class=\"capability-description\">${escapeHtml(capability.description)}</p>`\n : \"\"}\n ${command ? command_(command) : \"\"}\n <div class=\"identity\">\n <span class=\"method\">${escapeHtml(route?.method ?? \"OP\")}</span>\n ${[\n route?.path ?? entry.path.join(\".\"),\n entry.path.join(\".\"),\n capability.id,\n ]\n .filter((value, index, all) => all.indexOf(value) === index)\n .map((value) => `<code>${escapeHtml(value)}</code>`)\n .join(`<span class=\"identity-sep\" aria-hidden=\"true\">·</span>`)}\n </div>\n </article>`;\n }).join(\"\");\n\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"color-scheme\" content=\"light dark\">\n <title>${escapeHtml(app.name)} · Capable</title>\n <style>${styles}</style>\n </head>\n <body>\n <header class=\"topbar\">\n <div class=\"shell nav\">\n <a class=\"brand\" href=\"/\" aria-label=\"Capable development home\">\n <span class=\"brand-mark\" aria-hidden=\"true\">C</span>\n <span>Capable</span>\n </a>\n <span class=\"environment\"><span aria-hidden=\"true\"></span>Development</span>\n </div>\n </header>\n\n <main class=\"shell\">\n <section class=\"hero\">\n <div class=\"title-row\">\n <h1>${escapeHtml(app.name)}</h1>\n <span class=\"version\">v${escapeHtml(app.version)}</span>\n </div>\n <p>${escapeHtml(app.description ?? \"A capability application powered by Capable.\")}</p>\n </section>\n\n <section class=\"cli\" aria-label=\"Command line\">\n <div class=\"cli-copy\">\n <h2>Run it from your terminal</h2>\n <p>Every capability below is already a command. No client, no URL, no code generation.</p>\n </div>\n <div class=\"cli-commands\">\n ${command_(\"--help\", \"List every command\")}\n ${firstCommand ? command_(firstCommand, \"Call a capability\") : \"\"}\n </div>\n </section>\n\n <section class=\"protocols\" aria-label=\"Application surfaces\">\n ${protocolLink(\"OpenAPI\", \"/openapi.json\", true)}\n ${protocolLink(\"Manifest\", \"/_capable/manifest\", true)}\n ${protocolLink(\"MCP\", \"/mcp\", false)}\n </section>\n\n <section class=\"capabilities-section\">\n <div class=\"section-heading\">\n <h2>Capabilities</h2>\n <span class=\"count\">${capabilityCount}</span>\n </div>\n <div class=\"capabilities\">\n ${capabilities || `<div class=\"empty\">No capabilities have been defined yet.</div>`}\n </div>\n </section>\n </main>\n\n <footer class=\"shell\">\n <span>Generated from the application definition</span>\n <a href=\"/_capable/manifest\">Application manifest <span aria-hidden=\"true\">→</span></a>\n </footer>\n <script>${script}</script>\n </body>\n</html>`;\n}\n\n/** A copyable `cap cli` invocation. Paths are relative, so no URL is needed. */\nfunction command_(command: string, label?: string): string {\n const full = `cap cli ${command}`;\n return `<div class=\"command\">\n ${label ? `<span class=\"command-label\">${escapeHtml(label)}</span>` : \"\"}\n <div class=\"command-line\">\n <span class=\"prompt\" aria-hidden=\"true\">$</span>\n <code>${escapeHtml(full)}</code>\n <button type=\"button\" class=\"copy\" data-copy=\"${escapeHtml(full)}\" aria-label=\"Copy command\">Copy</button>\n </div>\n </div>`;\n}\n\nfunction cliCommand(entry: LocatedCapability): string | undefined {\n const capabilityMeta = entry.capability.meta.cli as\n | false\n | {\n readonly name?: string;\n readonly command?: readonly string[];\n readonly positional?: readonly string[];\n }\n | undefined;\n if (capabilityMeta === false) return undefined;\n\n const command = [...entry.path];\n for (let index = 0; index < entry.groups.length; index++) {\n const groupMeta = entry.groups[index]?.meta.cli as\n | { readonly name?: string }\n | undefined;\n const groupPath = entry.groupPaths[index];\n if (groupMeta?.name && groupPath) {\n command[groupPath.length - 1] = groupMeta.name;\n }\n }\n if (capabilityMeta?.command) {\n command.splice(0, command.length, ...capabilityMeta.command);\n } else if (capabilityMeta?.name) {\n command[command.length - 1] = capabilityMeta.name;\n }\n return [...command, ...(capabilityMeta?.positional ?? []).map((name) =>\n `<${name}>`\n )].join(\" \");\n}\n\nfunction protocolLink(name: string, path: string, navigable: boolean): string {\n const content = `\n <span>${escapeHtml(name)}</span>\n <code>${escapeHtml(path)}</code>\n <span class=\"protocol-arrow\" aria-hidden=\"true\">${navigable ? \"↗\" : \"●\"}</span>`;\n return navigable\n ? `<a class=\"protocol\" href=\"${escapeHtml(path)}\">${content}</a>`\n : `<div class=\"protocol protocol-static\">${content}</div>`;\n}\n\nfunction escapeHtml(value: string): string {\n return value.replace(/[&<>\"']/g, (character) => ({\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n })[character]!);\n}\n\nconst styles = String.raw`\n :root {\n color-scheme: light;\n --background: #fff;\n --foreground: #0a0a0a;\n --secondary: #666;\n --muted: #8f8f8f;\n --border: #ebebeb;\n --border-strong: #dcdcdc;\n --subtle: #fafafa;\n --hover: #f5f5f5;\n --mark-bg: #0a0a0a;\n --mark-fg: #fff;\n --accent: #0070f3;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n --background: #000;\n --foreground: #ededed;\n --secondary: #a1a1a1;\n --muted: #737373;\n --border: #1f1f1f;\n --border-strong: #2e2e2e;\n --subtle: #0a0a0a;\n --hover: #141414;\n --mark-bg: #ededed;\n --mark-fg: #000;\n --accent: #3291ff;\n }\n }\n * { box-sizing: border-box; }\n body {\n margin: 0;\n min-height: 100vh;\n background: var(--background);\n color: var(--foreground);\n font: 14px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Inter, sans-serif;\n -webkit-font-smoothing: antialiased;\n }\n a { color: inherit; text-decoration: none; }\n code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }\n h1, h2, h3, p { margin: 0; }\n .shell { width: min(880px, calc(100% - 48px)); margin: 0 auto; }\n\n .topbar { position: sticky; top: 0; z-index: 10; height: 60px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: saturate(180%) blur(12px); }\n .nav { height: 100%; display: flex; align-items: center; justify-content: space-between; }\n .brand { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }\n .brand-mark { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 6px; background: var(--mark-bg); color: var(--mark-fg); font-size: 12px; font-weight: 700; }\n .environment { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; }\n .environment > span { width: 6px; height: 6px; border-radius: 999px; background: #45a557; box-shadow: 0 0 0 3px color-mix(in srgb, #45a557 16%, transparent); }\n\n .hero { padding: 72px 0 40px; }\n .title-row { display: flex; align-items: baseline; gap: 12px; }\n h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 600; letter-spacing: -.045em; line-height: 1.1; }\n .version { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }\n .hero > p { max-width: 600px; margin-top: 14px; color: var(--secondary); font-size: 16px; line-height: 1.6; }\n\n .cli { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--subtle); }\n .cli-copy h2 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }\n .cli-copy p { margin-top: 6px; color: var(--secondary); font-size: 13px; line-height: 1.6; }\n .cli-commands { display: grid; gap: 10px; }\n\n .command { display: grid; gap: 6px; min-width: 0; }\n .command-label { color: var(--muted); font-size: 11px; letter-spacing: .02em; }\n .command-line { display: flex; align-items: center; gap: 9px; padding: 9px 9px 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--background); }\n .prompt { color: var(--muted); user-select: none; }\n .command-line code { flex: 1; overflow-x: auto; color: var(--foreground); font-size: 12.5px; white-space: nowrap; scrollbar-width: none; }\n .command-line code::-webkit-scrollbar { display: none; }\n .copy { flex: none; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; transition: color 120ms ease, background 120ms ease; }\n .copy:hover { background: var(--hover); color: var(--foreground); }\n .copy[data-copied=\"true\"] { color: #45a557; }\n\n .protocols { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }\n .protocol { position: relative; display: flex; min-width: 0; flex-direction: column; gap: 7px; padding: 16px 18px; border-right: 1px solid var(--border); transition: background 120ms ease; }\n .protocol:last-child { border-right: 0; }\n a.protocol:hover { background: var(--hover); }\n .protocol > span:first-child { font-size: 13px; font-weight: 550; }\n .protocol code { overflow: hidden; color: var(--secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }\n .protocol-arrow { position: absolute; top: 16px; right: 16px; color: var(--muted); font-size: 11px; }\n .protocol-static .protocol-arrow { color: #45a557; font-size: 8px; }\n\n .capabilities-section { padding: 64px 0 40px; }\n .section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }\n h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }\n .count, .badge, .effect { border: 1px solid var(--border); border-radius: 999px; color: var(--secondary); font-size: 11px; line-height: 1; }\n .count { padding: 5px 8px; font-variant-numeric: tabular-nums; }\n .capabilities { display: grid; gap: 10px; }\n .capability { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; transition: border-color 120ms ease; }\n .capability:hover { border-color: var(--border-strong); }\n .capability-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }\n .capability-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }\n h3 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }\n .effect, .badge { padding: 4px 7px; text-transform: capitalize; }\n .effect.read { color: #27833d; border-color: color-mix(in srgb, #27833d 28%, transparent); }\n .effect.write { color: #a16207; border-color: color-mix(in srgb, #a16207 28%, transparent); }\n .effect.destructive { color: #c03a36; border-color: color-mix(in srgb, #c03a36 28%, transparent); }\n .open { flex: none; color: var(--secondary); font-size: 12px; white-space: nowrap; }\n .open:hover { color: var(--foreground); }\n .capability-description { max-width: 640px; margin-top: -4px; color: var(--secondary); line-height: 1.55; }\n .identity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; }\n .identity code { color: var(--secondary); }\n .method { color: var(--foreground); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; font-weight: 650; }\n .identity-sep { color: var(--border-strong); }\n .empty { padding: 40px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--secondary); text-align: center; }\n\n footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }\n footer a:hover { color: var(--foreground); }\n\n @media (max-width: 720px) {\n .shell { width: min(100% - 32px, 880px); }\n .hero { padding: 48px 0 32px; }\n .title-row { align-items: flex-start; flex-direction: column; gap: 8px; }\n .cli { grid-template-columns: 1fr; gap: 18px; }\n .protocols { grid-template-columns: 1fr; }\n .protocol { border-right: 0; border-bottom: 1px solid var(--border); }\n .protocol:last-child { border-bottom: 0; }\n .capabilities-section { padding-top: 48px; }\n .capability-head { align-items: flex-start; flex-direction: column; gap: 10px; }\n footer { align-items: flex-start; flex-direction: column; }\n }\n`;\n\nconst script = String.raw`\n document.addEventListener(\"click\", (event) => {\n const button = event.target.closest(\"button.copy\");\n if (!button) return;\n navigator.clipboard?.writeText(button.dataset.copy ?? \"\").then(() => {\n button.textContent = \"Copied\";\n button.dataset.copied = \"true\";\n setTimeout(() => {\n button.textContent = \"Copy\";\n delete button.dataset.copied;\n }, 1400);\n });\n });\n`;\n","import { mcp } from \"@capable/mcp/mount\";\nimport { createServer, http, standard } from \"@capable/server\";\nimport type { AppDefinition } from \"@capable/core\";\nimport { devIndex, withDevIndex } from \"./dev-index.ts\";\n\nexport type CapableNitroEntryOptions = {\n /** The default export of the project's `capable.app.*`. */\n readonly definition: unknown;\n /** The default export of `capable.server.*`, when the project has one. */\n readonly server?: { readonly fetch: (request: Request) => unknown } | undefined;\n readonly dev: boolean;\n};\n\n/**\n * Build the server Nitro hosts. The generated entry in the project supplies the\n * project's own modules, so nothing here depends on how they were resolved.\n */\nexport function createCapableNitroEntry(options: CapableNitroEntryOptions) {\n const definition = options.definition as AppDefinition<any, undefined>;\n if (options.server) {\n return options.dev\n ? withDevIndex(options.server as never, definition)\n : options.server;\n }\n return createServer(definition, {\n mounts: options.dev\n ? [devIndex(), standard(), http(), mcp()]\n : [standard(), http(), mcp()],\n });\n}\n"],"mappings":";;;;AAUA,SAAgB,WAA6B;CAC3C,OAAO;EACL,MAAM;EACN,QAAQ,KAAK;GACX,MAAM,OAAO,eAAe,GAAG;GAC/B,OAAO;IACL,MAAM;IACN,MAAM,SAAS;KACb,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;KAC/B,IAAI,QAAQ,WAAW,SAAS,IAAI,aAAa,KAC/C;KAEF,OAAO,IAAI,SAAS,MAAM,EACxB,SAAS,EAAE,gBAAgB,2BAA2B,EACxD,CAAC;IACH;GACF;EACF;CACF;AACF;AAEA,SAAgB,aACd,QACA,KACe;CACf,MAAM,QAAQ,SAAS,CAAC,CAAC,QAAQ,KAAK,KAAA,CAAS;CAC/C,OAAO,OAAO,OAAO,EACnB,MAAM,MAAM,SAAS;EACnB,OAAO,MAAM,MAAM,MAAM,OAAO,KAAK,OAAO,MAAM,OAAO;CAC3D,EACF,CAAC;AACH;AAEA,SAAgB,eAAe,KAAsC;CACnE,MAAM,SAAS,kBAAkB,GAAG,CAAC,CAAC;CACtC,MAAM,oBAAoB,IAAI,IAC5B,OAAO,KAAK,UAAU,CAAC,MAAM,WAAW,YAAY,KAAK,CAAC,CAC5D;CACA,MAAM,kBAAkB,IAAI,oBAAoB;CAChD,MAAM,eAAe,IAAI,oBACtB,KAAK,UAAU,WAAW,KAAK,CAAC,CAAC,CACjC,MAAM,YAA+B,YAAY,KAAA,CAAS;CAC7D,MAAM,eAAe,IAAI,oBAAoB,KAAK,UAAU;EAC1D,MAAM,aAAa,MAAM;EACzB,MAAM,Q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,OAAuB;CACzC,OAAO,MAAM,QAAQ,aAAa,eAAe;EAC/C,KAAK;EACL,KAAK;EACL,KAAK;EACL,MAAK;EACL,KAAK;CACP,EAAA,CAAG,UAAW;AAChB;AAEA,MAAM,SAAS,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HzB,MAAM,SAAS,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;ACxUzB,SAAgB,wBAAwB,SAAmC;CACzE,MAAM,aAAa,QAAQ;CAC3B,IAAI,QAAQ,QACV,OAAO,QAAQ,MACX,aAAa,QAAQ,QAAiB,UAAU,IAChD,QAAQ;CAEd,OAAO,aAAa,YAAY,EAC9B,QAAQ,QAAQ,MACZ;EAAC,SAAS;EAAG,SAAS;EAAG,KAAK;EAAG,IAAI;CAAC,IACtC;EAAC,SAAS;EAAG,KAAK;EAAG,IAAI;CAAC,EAChC,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"runtime-support.mjs","names":["escapeHtml","styles"],"sources":["../../nitro-host/src/dev-index.ts","../../nitro-host/src/production-splash.ts","../../nitro-host/src/runtime-support.ts"],"sourcesContent":["import type {\n AppDefinition,\n LocatedCapability,\n} from \"@capable/core\";\nimport { createHttpHandler } from \"@capable/fetch\";\nimport type {\n CapableServer,\n ServerMount,\n} from \"@capable/server\";\n\nexport function devIndex(): ServerMount<any> {\n return {\n kind: \"capable.server.mount\",\n compile(app) {\n const html = renderDevIndex(app);\n return {\n name: \"dev-index\",\n fetch(request) {\n const url = new URL(request.url);\n if (request.method !== \"GET\" || url.pathname !== \"/\") {\n return undefined;\n }\n return new Response(html, {\n headers: { \"content-type\": \"text/html; charset=utf-8\" },\n });\n },\n };\n },\n };\n}\n\nexport function withDevIndex(\n server: CapableServer,\n app: AppDefinition<any, any>,\n): CapableServer {\n const index = devIndex().compile(app, undefined);\n return Object.freeze({\n async fetch(request) {\n return await index.fetch(request) ?? server.fetch(request);\n },\n });\n}\n\nexport function renderDevIndex(app: AppDefinition<any, any>): string {\n const routes = createHttpHandler(app).routes;\n const routeByCapability = new Map(\n routes.map((route) => [route.capability.capability, route]),\n );\n const capabilityCount = app.locatedCapabilities.length;\n const firstCommand = app.locatedCapabilities\n .map((entry) => cliCommand(entry))\n .find((command): command is string => command !== undefined);\n const capabilities = app.locatedCapabilities.map((entry) => {\n const capability = entry.capability;\n const route = routeByCapability.get(capability);\n const command = cliCommand(entry);\n const canOpen = route?.method === \"GET\" && capability.input === undefined;\n const badges = [\n capability.toMarkdown ? \"Markdown\" : undefined,\n capability.deprecated ? \"Deprecated\" : undefined,\n ].filter(Boolean) as string[];\n\n return `\n <article class=\"capability\">\n <div class=\"capability-head\">\n <div class=\"capability-title\">\n <h3>${escapeHtml(capability.title ?? entry.path.at(-1)!)}</h3>\n <span class=\"effect ${escapeHtml(capability.effect ?? \"unspecified\")}\">${escapeHtml(capability.effect ?? \"unspecified\")}</span>\n ${badges.map((badge) => `<span class=\"badge\">${escapeHtml(badge)}</span>`).join(\"\")}\n </div>\n ${canOpen\n ? `<a class=\"open\" href=\"${escapeHtml(route.path)}\">Open <span aria-hidden=\"true\">↗</span></a>`\n : \"\"}\n </div>\n ${capability.description\n ? `<p class=\"capability-description\">${escapeHtml(capability.description)}</p>`\n : \"\"}\n ${command ? command_(command) : \"\"}\n <div class=\"identity\">\n <span class=\"method\">${escapeHtml(route?.method ?? \"OP\")}</span>\n ${[\n route?.path ?? entry.path.join(\".\"),\n entry.path.join(\".\"),\n capability.id,\n ]\n .filter((value, index, all) => all.indexOf(value) === index)\n .map((value) => `<code>${escapeHtml(value)}</code>`)\n .join(`<span class=\"identity-sep\" aria-hidden=\"true\">·</span>`)}\n </div>\n </article>`;\n }).join(\"\");\n\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"color-scheme\" content=\"light dark\">\n <title>${escapeHtml(app.name)} · Capable</title>\n <style>${styles}</style>\n </head>\n <body>\n <header class=\"topbar\">\n <div class=\"shell nav\">\n <a class=\"brand\" href=\"/\" aria-label=\"Capable development home\">\n <span class=\"brand-mark\" aria-hidden=\"true\">C</span>\n <span>Capable</span>\n </a>\n <span class=\"environment\"><span aria-hidden=\"true\"></span>Development</span>\n </div>\n </header>\n\n <main class=\"shell\">\n <section class=\"hero\">\n <div class=\"title-row\">\n <h1>${escapeHtml(app.name)}</h1>\n <span class=\"version\">v${escapeHtml(app.version)}</span>\n </div>\n <p>${escapeHtml(app.description ?? \"A capability application powered by Capable.\")}</p>\n </section>\n\n <section class=\"cli\" aria-label=\"Command line\">\n <div class=\"cli-copy\">\n <h2>Run it from your terminal</h2>\n <p>Every capability below is already a command. No client, no URL, no code generation.</p>\n </div>\n <div class=\"cli-commands\">\n ${command_(\"--help\", \"List every command\")}\n ${firstCommand ? command_(firstCommand, \"Call a capability\") : \"\"}\n </div>\n </section>\n\n <section class=\"protocols\" aria-label=\"Application surfaces\">\n ${protocolLink(\"OpenAPI\", \"/openapi.json\", true)}\n ${protocolLink(\"Manifest\", \"/_capable/manifest\", true)}\n ${protocolLink(\"MCP\", \"/mcp\", false)}\n </section>\n\n <section class=\"capabilities-section\">\n <div class=\"section-heading\">\n <h2>Capabilities</h2>\n <span class=\"count\">${capabilityCount}</span>\n </div>\n <div class=\"capabilities\">\n ${capabilities || `<div class=\"empty\">No capabilities have been defined yet.</div>`}\n </div>\n </section>\n </main>\n\n <footer class=\"shell\">\n <span>Generated from the application definition</span>\n <a href=\"/_capable/manifest\">Application manifest <span aria-hidden=\"true\">→</span></a>\n </footer>\n <script>${script}</script>\n </body>\n</html>`;\n}\n\n/** A copyable `cap cli` invocation. Paths are relative, so no URL is needed. */\nfunction command_(command: string, label?: string): string {\n const full = `cap cli ${command}`;\n return `<div class=\"command\">\n ${label ? `<span class=\"command-label\">${escapeHtml(label)}</span>` : \"\"}\n <div class=\"command-line\">\n <span class=\"prompt\" aria-hidden=\"true\">$</span>\n <code>${escapeHtml(full)}</code>\n <button type=\"button\" class=\"copy\" data-copy=\"${escapeHtml(full)}\" aria-label=\"Copy command\">Copy</button>\n </div>\n </div>`;\n}\n\nfunction cliCommand(entry: LocatedCapability): string | undefined {\n const capabilityMeta = entry.capability.meta.cli as\n | false\n | {\n readonly name?: string;\n readonly command?: readonly string[];\n readonly positional?: readonly string[];\n }\n | undefined;\n if (capabilityMeta === false) return undefined;\n\n const command = [...entry.path];\n for (let index = 0; index < entry.groups.length; index++) {\n const groupMeta = entry.groups[index]?.meta.cli as\n | { readonly name?: string }\n | undefined;\n const groupPath = entry.groupPaths[index];\n if (groupMeta?.name && groupPath) {\n command[groupPath.length - 1] = groupMeta.name;\n }\n }\n if (capabilityMeta?.command) {\n command.splice(0, command.length, ...capabilityMeta.command);\n } else if (capabilityMeta?.name) {\n command[command.length - 1] = capabilityMeta.name;\n }\n return [...command, ...(capabilityMeta?.positional ?? []).map((name) =>\n `<${name}>`\n )].join(\" \");\n}\n\nfunction protocolLink(name: string, path: string, navigable: boolean): string {\n const content = `\n <span>${escapeHtml(name)}</span>\n <code>${escapeHtml(path)}</code>\n <span class=\"protocol-arrow\" aria-hidden=\"true\">${navigable ? \"↗\" : \"●\"}</span>`;\n return navigable\n ? `<a class=\"protocol\" href=\"${escapeHtml(path)}\">${content}</a>`\n : `<div class=\"protocol protocol-static\">${content}</div>`;\n}\n\nfunction escapeHtml(value: string): string {\n return value.replace(/[&<>\"']/g, (character) => ({\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n })[character]!);\n}\n\nconst styles = String.raw`\n :root {\n color-scheme: light;\n --background: #fff;\n --foreground: #0a0a0a;\n --secondary: #666;\n --muted: #8f8f8f;\n --border: #ebebeb;\n --border-strong: #dcdcdc;\n --subtle: #fafafa;\n --hover: #f5f5f5;\n --mark-bg: #0a0a0a;\n --mark-fg: #fff;\n --accent: #0070f3;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n --background: #000;\n --foreground: #ededed;\n --secondary: #a1a1a1;\n --muted: #737373;\n --border: #1f1f1f;\n --border-strong: #2e2e2e;\n --subtle: #0a0a0a;\n --hover: #141414;\n --mark-bg: #ededed;\n --mark-fg: #000;\n --accent: #3291ff;\n }\n }\n * { box-sizing: border-box; }\n body {\n margin: 0;\n min-height: 100vh;\n background: var(--background);\n color: var(--foreground);\n font: 14px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Inter, sans-serif;\n -webkit-font-smoothing: antialiased;\n }\n a { color: inherit; text-decoration: none; }\n code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }\n h1, h2, h3, p { margin: 0; }\n .shell { width: min(880px, calc(100% - 48px)); margin: 0 auto; }\n\n .topbar { position: sticky; top: 0; z-index: 10; height: 60px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: saturate(180%) blur(12px); }\n .nav { height: 100%; display: flex; align-items: center; justify-content: space-between; }\n .brand { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }\n .brand-mark { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 6px; background: var(--mark-bg); color: var(--mark-fg); font-size: 12px; font-weight: 700; }\n .environment { display: inline-flex; align-items: center; gap: 7px; color: var(--secondary); font-size: 12px; }\n .environment > span { width: 6px; height: 6px; border-radius: 999px; background: #45a557; box-shadow: 0 0 0 3px color-mix(in srgb, #45a557 16%, transparent); }\n\n .hero { padding: 72px 0 40px; }\n .title-row { display: flex; align-items: baseline; gap: 12px; }\n h1 { font-size: clamp(30px, 5vw, 44px); font-weight: 600; letter-spacing: -.045em; line-height: 1.1; }\n .version { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }\n .hero > p { max-width: 600px; margin-top: 14px; color: var(--secondary); font-size: 16px; line-height: 1.6; }\n\n .cli { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--subtle); }\n .cli-copy h2 { font-size: 16px; font-weight: 600; letter-spacing: -.02em; }\n .cli-copy p { margin-top: 6px; color: var(--secondary); font-size: 13px; line-height: 1.6; }\n .cli-commands { display: grid; gap: 10px; }\n\n .command { display: grid; gap: 6px; min-width: 0; }\n .command-label { color: var(--muted); font-size: 11px; letter-spacing: .02em; }\n .command-line { display: flex; align-items: center; gap: 9px; padding: 9px 9px 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--background); }\n .prompt { color: var(--muted); user-select: none; }\n .command-line code { flex: 1; overflow-x: auto; color: var(--foreground); font-size: 12.5px; white-space: nowrap; scrollbar-width: none; }\n .command-line code::-webkit-scrollbar { display: none; }\n .copy { flex: none; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; transition: color 120ms ease, background 120ms ease; }\n .copy:hover { background: var(--hover); color: var(--foreground); }\n .copy[data-copied=\"true\"] { color: #45a557; }\n\n .protocols { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }\n .protocol { position: relative; display: flex; min-width: 0; flex-direction: column; gap: 7px; padding: 16px 18px; border-right: 1px solid var(--border); transition: background 120ms ease; }\n .protocol:last-child { border-right: 0; }\n a.protocol:hover { background: var(--hover); }\n .protocol > span:first-child { font-size: 13px; font-weight: 550; }\n .protocol code { overflow: hidden; color: var(--secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }\n .protocol-arrow { position: absolute; top: 16px; right: 16px; color: var(--muted); font-size: 11px; }\n .protocol-static .protocol-arrow { color: #45a557; font-size: 8px; }\n\n .capabilities-section { padding: 64px 0 40px; }\n .section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }\n h2 { font-size: 15px; font-weight: 600; letter-spacing: -.02em; }\n .count, .badge, .effect { border: 1px solid var(--border); border-radius: 999px; color: var(--secondary); font-size: 11px; line-height: 1; }\n .count { padding: 5px 8px; font-variant-numeric: tabular-nums; }\n .capabilities { display: grid; gap: 10px; }\n .capability { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 12px; transition: border-color 120ms ease; }\n .capability:hover { border-color: var(--border-strong); }\n .capability-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }\n .capability-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }\n h3 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }\n .effect, .badge { padding: 4px 7px; text-transform: capitalize; }\n .effect.read { color: #27833d; border-color: color-mix(in srgb, #27833d 28%, transparent); }\n .effect.write { color: #a16207; border-color: color-mix(in srgb, #a16207 28%, transparent); }\n .effect.destructive { color: #c03a36; border-color: color-mix(in srgb, #c03a36 28%, transparent); }\n .open { flex: none; color: var(--secondary); font-size: 12px; white-space: nowrap; }\n .open:hover { color: var(--foreground); }\n .capability-description { max-width: 640px; margin-top: -4px; color: var(--secondary); line-height: 1.55; }\n .identity { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; }\n .identity code { color: var(--secondary); }\n .method { color: var(--foreground); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; font-weight: 650; }\n .identity-sep { color: var(--border-strong); }\n .empty { padding: 40px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--secondary); text-align: center; }\n\n footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 0 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }\n footer a:hover { color: var(--foreground); }\n\n @media (max-width: 720px) {\n .shell { width: min(100% - 32px, 880px); }\n .hero { padding: 48px 0 32px; }\n .title-row { align-items: flex-start; flex-direction: column; gap: 8px; }\n .cli { grid-template-columns: 1fr; gap: 18px; }\n .protocols { grid-template-columns: 1fr; }\n .protocol { border-right: 0; border-bottom: 1px solid var(--border); }\n .protocol:last-child { border-bottom: 0; }\n .capabilities-section { padding-top: 48px; }\n .capability-head { align-items: flex-start; flex-direction: column; gap: 10px; }\n footer { align-items: flex-start; flex-direction: column; }\n }\n`;\n\nconst script = String.raw`\n document.addEventListener(\"click\", (event) => {\n const button = event.target.closest(\"button.copy\");\n if (!button) return;\n navigator.clipboard?.writeText(button.dataset.copy ?? \"\").then(() => {\n button.textContent = \"Copied\";\n button.dataset.copied = \"true\";\n setTimeout(() => {\n button.textContent = \"Copy\";\n delete button.dataset.copied;\n }, 1400);\n });\n });\n`;\n","import type { AppDefinition } from \"@capable/core\";\nimport type {\n CapableServer,\n ServerMount,\n} from \"@capable/server\";\n\nconst DEPLOYMENT_URL_PLACEHOLDER = \"{{DEPLOYMENT_URL}}\";\n\nexport function productionSplash(): ServerMount<any> {\n return {\n kind: \"capable.server.mount\",\n compile(app) {\n const html = renderProductionSplash(app);\n return {\n name: \"production-splash\",\n fetch(request) {\n const url = new URL(request.url);\n if (request.method !== \"GET\" || url.pathname !== \"/\") {\n return undefined;\n }\n return productionSplashResponse(html, request);\n },\n };\n },\n };\n}\n\nexport function withProductionSplash(\n server: CapableServer,\n app: AppDefinition<any, any>,\n): CapableServer {\n const splash = productionSplash().compile(app, undefined);\n return Object.freeze({\n async fetch(request) {\n return await splash.fetch(request) ?? server.fetch(request);\n },\n });\n}\n\nexport function renderProductionSplash(app: AppDefinition<any, any>): string {\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <meta name=\"color-scheme\" content=\"light dark\">\n <meta name=\"robots\" content=\"noindex\">\n <meta name=\"referrer\" content=\"no-referrer\">\n <title>${escapeHtml(app.name)} · Capable</title>\n <style>${styles}</style>\n </head>\n <body>\n <main>\n <section class=\"card\" aria-label=\"Deployment status\">\n <header>\n <h1>${escapeHtml(app.name)}</h1>\n <p class=\"status\">\n <span class=\"status-state\"><span class=\"status-dot\" aria-hidden=\"true\"></span>Ready</span>\n <span class=\"status-separator\" aria-hidden=\"true\">·</span>\n <span>Production</span>\n </p>\n </header>\n <div class=\"command\" role=\"group\" aria-label=\"Inspect from your terminal\">\n <div class=\"command-line\">\n <span class=\"command-prompt\" aria-hidden=\"true\">$</span>\n <code>capable cli --app ${DEPLOYMENT_URL_PLACEHOLDER} --help</code>\n </div>\n </div>\n <section class=\"endpoints\" aria-label=\"Deployment endpoints\">\n <a href=\"/openapi.json\">\n <span class=\"endpoint-name\">OpenAPI</span>\n <code class=\"endpoint-path\">/openapi.json</code>\n </a>\n <a href=\"/_capable/manifest\">\n <span class=\"endpoint-name\">Manifest</span>\n <code class=\"endpoint-path\">/_capable/manifest</code>\n </a>\n <div class=\"endpoint\">\n <span class=\"endpoint-name\">MCP</span>\n <code class=\"endpoint-path\">/mcp</code>\n </div>\n </section>\n </section>\n </main>\n </body>\n</html>`;\n}\n\nfunction productionSplashResponse(html: string, request: Request): Response {\n return new Response(\n html.replace(\n DEPLOYMENT_URL_PLACEHOLDER,\n () => escapeHtml(resolveDeploymentUrl(request)),\n ),\n {\n headers: {\n \"cache-control\": \"no-store\",\n \"content-security-policy\":\n \"default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'\",\n \"content-type\": \"text/html; charset=utf-8\",\n \"referrer-policy\": \"no-referrer\",\n \"x-content-type-options\": \"nosniff\",\n \"x-robots-tag\": \"noindex\",\n },\n },\n );\n}\n\nfunction resolveDeploymentUrl(request: Request): string {\n const url = new URL(request.url);\n const host = firstForwardedValue(request.headers.get(\"x-forwarded-host\")) ??\n request.headers.get(\"host\") ??\n url.host;\n const protocol =\n firstForwardedValue(request.headers.get(\"x-forwarded-proto\")) ??\n url.protocol.slice(0, -1);\n return `${protocol}://${host}`;\n}\n\nfunction firstForwardedValue(value: string | null): string | undefined {\n const first = value?.split(\",\")[0]?.trim();\n return first || undefined;\n}\n\nfunction escapeHtml(value: string): string {\n return value.replace(/[&<>\"']/g, (character) => ({\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n })[character]!);\n}\n\nconst styles = String.raw`\n :root {\n color-scheme: light dark;\n --background: #ffffff;\n --foreground: #0a0a0a;\n --muted: #575757;\n --faint: #737373;\n --border: rgba(0, 0, 0, .1);\n --surface: #fafafa;\n --accent: #087a4f;\n --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --mono: ui-monospace, \"SF Mono\", Menlo, Monaco, Consolas, monospace;\n }\n @media (prefers-color-scheme: dark) {\n :root {\n --background: #0a0a0a;\n --foreground: #ededed;\n --muted: #a1a1a1;\n --faint: #8a8a8a;\n --border: rgba(255, 255, 255, .12);\n --surface: #131313;\n --accent: #3ecf8e;\n }\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; }\n body {\n min-height: 100vh;\n min-height: 100dvh;\n display: grid;\n place-items: center;\n padding: 2rem;\n background: var(--background);\n color: var(--foreground);\n font: 15px/1.55 var(--sans);\n font-feature-settings: \"cv11\", \"ss01\";\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n text-rendering: optimizeLegibility;\n }\n main {\n width: min(100%, 27rem);\n }\n .card { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }\n header { display: flex; flex-direction: column; gap: .5rem; }\n h1 {\n margin: 0;\n overflow-wrap: anywhere;\n font-size: 1.25rem;\n font-weight: 600;\n letter-spacing: -.021em;\n line-height: 1.3;\n }\n .status {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: .25rem .5rem;\n margin: 0;\n color: var(--muted);\n font-size: .875rem;\n line-height: 1.5;\n }\n .status-state {\n display: inline-flex;\n align-items: center;\n gap: .5rem;\n color: var(--accent);\n font-weight: 500;\n line-height: inherit;\n }\n .status-dot {\n width: 6px;\n height: 6px;\n flex: none;\n border-radius: 50%;\n background: currentColor;\n }\n .status-separator { color: var(--faint); }\n .command {\n display: flex;\n flex-direction: column;\n gap: .5rem;\n padding: 1rem 1.0625rem;\n border: 1px solid var(--border);\n border-radius: .5rem;\n background: var(--surface);\n }\n .command-line {\n display: flex;\n align-items: center;\n gap: .5rem;\n min-width: 0;\n }\n .command-prompt { color: var(--faint); user-select: none; }\n code {\n color: var(--foreground);\n font: .8125rem/1.6 var(--mono);\n font-feature-settings: \"zero\", \"ss01\";\n overflow-wrap: anywhere;\n }\n .endpoints {\n display: flex;\n flex-direction: column;\n border-top: 1px solid var(--border);\n }\n .endpoints a, .endpoint {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 1rem;\n padding: .6875rem .125rem;\n border-bottom: 1px solid var(--border);\n color: var(--foreground);\n font-size: .8125rem;\n }\n .endpoints a {\n text-decoration: none;\n }\n .endpoint-name {\n font-weight: 500;\n }\n .endpoint-path {\n color: var(--faint);\n font-size: .75rem;\n text-align: right;\n transition: color .15s ease;\n }\n .endpoints a:hover .endpoint-path { color: var(--foreground); }\n .endpoints a:focus-visible {\n border-radius: 3px;\n outline: 2px solid var(--foreground);\n outline-offset: 2px;\n }\n @media (max-width: 30rem) {\n body { align-items: start; padding: 3rem 1.5rem 2rem; }\n }\n @media (prefers-reduced-motion: reduce) {\n * { transition: none !important; }\n }\n`;\n","import { mcp } from \"@capable/mcp/mount\";\nimport {\n createServer,\n http,\n standard,\n type CapableServer,\n} from \"@capable/server\";\nimport type { AppDefinition } from \"@capable/core\";\nimport { devIndex, withDevIndex } from \"./dev-index.ts\";\nimport {\n productionSplash,\n withProductionSplash,\n} from \"./production-splash.ts\";\n\nexport type CapableNitroEntryOptions = {\n /** The default export of the project's `capable.app.*`. */\n readonly definition: unknown;\n /** The default export of `capable.server.*`, when the project has one. */\n readonly server?: { readonly fetch: (request: Request) => unknown } | undefined;\n readonly dev: boolean;\n};\n\n/**\n * Build the server Nitro hosts. The generated entry in the project supplies the\n * project's own modules, so nothing here depends on how they were resolved.\n */\nexport function createCapableNitroEntry(\n options: CapableNitroEntryOptions,\n): CapableServer {\n const definition = options.definition as AppDefinition<any, undefined>;\n if (options.server) {\n return options.dev\n ? withDevIndex(options.server as never, definition)\n : withProductionSplash(options.server as never, definition);\n }\n const server = createServer(definition, {\n mounts: options.dev\n ? [devIndex(), standard(), http(), mcp()]\n : [productionSplash(), standard(), http(), mcp()],\n });\n return options.dev ? server : withProductionMetadataCache(server);\n}\n\nconst productionMetadataPaths = new Set([\n \"/_capable/manifest\",\n \"/openapi.json\",\n]);\n\nfunction withProductionMetadataCache(server: {\n readonly fetch: (request: Request) => Promise<Response>;\n}) {\n return {\n async fetch(request: Request): Promise<Response> {\n const response = await server.fetch(request);\n if (\n request.method === \"GET\" &&\n response.ok &&\n productionMetadataPaths.has(new URL(request.url).pathname)\n ) {\n response.headers.set(\n \"cache-control\",\n \"public, max-age=0, must-revalidate\",\n );\n response.headers.set(\n \"vercel-cdn-cache-control\",\n \"public, max-age=31536000\",\n );\n }\n return response;\n },\n };\n}\n"],"mappings":";;;;AAUA,SAAgB,WAA6B;CAC3C,OAAO;EACL,MAAM;EACN,QAAQ,KAAK;GACX,MAAM,OAAO,eAAe,GAAG;GAC/B,OAAO;IACL,MAAM;IACN,MAAM,SAAS;KACb,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;KAC/B,IAAI,QAAQ,WAAW,SAAS,IAAI,aAAa,KAC/C;KAEF,OAAO,IAAI,SAAS,MAAM,EACxB,SAAS,EAAE,gBAAgB,2BAA2B,EACxD,CAAC;IACH;GACF;EACF;CACF;AACF;AAEA,SAAgB,aACd,QACA,KACe;CACf,MAAM,QAAQ,SAAS,CAAC,CAAC,QAAQ,KAAK,KAAA,CAAS;CAC/C,OAAO,OAAO,OAAO,EACnB,MAAM,MAAM,SAAS;EACnB,OAAO,MAAM,MAAM,MAAM,OAAO,KAAK,OAAO,MAAM,OAAO;CA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;;;;;;;;;;;;;;;;;;;;;;;AC5GzB,SAAgB,wBACd,SACe;CACf,MAAM,aAAa,QAAQ;CAC3B,IAAI,QAAQ,QACV,OAAO,QAAQ,MACX,aAAa,QAAQ,QAAiB,UAAU,IAChD,qBAAqB,QAAQ,QAAiB,UAAU;CAE9D,MAAM,SAAS,aAAa,YAAY,EACtC,QAAQ,QAAQ,MACZ;EAAC,SAAS;EAAG,SAAS;EAAG,KAAK;EAAG,IAAI;CAAC,IACtC;EAAC,iBAAiB;EAAG,SAAS;EAAG,KAAK;EAAG,IAAI;CAAC,EACpD,CAAC;CACD,OAAO,QAAQ,MAAM,SAAS,4BAA4B,MAAM;AAClE;AAEA,MAAM,0CAA0B,IAAI,IAAI,CACtC,sBACA,eACF,CAAC;AAED,SAAS,4BAA4B,QAElC;CACD,OAAO,EACL,MAAM,MAAM,SAAqC;EAC/C,MAAM,WAAW,MAAM,OAAO,MAAM,OAAO;EAC3C,IACE,QAAQ,WAAW,SACnB,SAAS,MACT,wBAAwB,IAAI,IAAI,IAAI,QAAQ,GAAG,CAAC,CAAC,QAAQ,GACzD;GACA,SAAS,QAAQ,IACf,iBACA,oCACF;GACA,SAAS,QAAQ,IACf,4BACA,0BACF;EACF;EACA,OAAO;CACT,EACF;AACF"}
|
package/dist/server.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createServer, i as ServerMount, n as CompiledServerMount, o as http, r as ServerMiddleware, s as standard, t as CapableServer } from "./index-
|
|
1
|
+
import { a as createServer, i as ServerMount, n as CompiledServerMount, o as http, r as ServerMiddleware, s as standard, t as CapableServer } from "./index-B2ru1zGQ.mjs";
|
|
2
2
|
export { CapableServer, CompiledServerMount, ServerMiddleware, ServerMount, createServer, http, standard };
|
package/dist/server.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as http, r as standard, t as createServer } from "./src-
|
|
1
|
+
import { n as http, r as standard, t as createServer } from "./src-DtSY5fzY.mjs";
|
|
2
2
|
export { createServer, http, standard };
|