mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 23:07:29 +00:00
Add LogicSRC standards MCP server
This commit is contained in:
parent
4e4c78140d
commit
dd150f391a
26 changed files with 2250 additions and 15 deletions
14
apps/logicsrc-web/index.html
Normal file
14
apps/logicsrc-web/index.html
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#101418" />
|
||||
<link rel="manifest" href="/manifest.webmanifest" />
|
||||
<title>LogicSRC</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
16
apps/logicsrc-web/package.json
Normal file
16
apps/logicsrc-web/package.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "@logicsrc/web",
|
||||
"version": "0.1.0",
|
||||
"description": "LogicSRC standards and open specification PWA.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node scripts/check-assets.js && vite build",
|
||||
"dev": "vite --host 0.0.0.0",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@logicsrc/commandboard-api": "file:../commandboard-api",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^7.2.6"
|
||||
}
|
||||
}
|
||||
5
apps/logicsrc-web/public/icon.svg
Normal file
5
apps/logicsrc-web/public/icon.svg
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="LogicSRC">
|
||||
<rect width="512" height="512" rx="72" fill="#101418"/>
|
||||
<path fill="#5ac8a6" d="M96 126h96v96H96zM224 126h192v48H224zM224 198h144v48H224z"/>
|
||||
<path fill="#f0c56a" d="M96 290h320v48H96zM96 362h240v48H96z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 314 B |
18
apps/logicsrc-web/public/manifest.webmanifest
Normal file
18
apps/logicsrc-web/public/manifest.webmanifest
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "LogicSRC",
|
||||
"short_name": "LogicSRC",
|
||||
"description": "Open standards and schemas for human and AI agent coordination.",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#f6f7f4",
|
||||
"theme_color": "#101418",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icon.svg",
|
||||
"sizes": "any",
|
||||
"type": "image/svg+xml",
|
||||
"purpose": "any maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
32
apps/logicsrc-web/public/service-worker.js
Normal file
32
apps/logicsrc-web/public/service-worker.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const CACHE_NAME = "logicsrc-standards-v1";
|
||||
const SHELL_ASSETS = ["/", "/manifest.webmanifest", "/icon.svg"];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL_ASSETS)));
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
if (event.request.method !== "GET") {
|
||||
return;
|
||||
}
|
||||
|
||||
event.respondWith(
|
||||
fetch(event.request)
|
||||
.then((response) => {
|
||||
if (response.ok && new URL(event.request.url).origin === self.location.origin) {
|
||||
const clone = response.clone();
|
||||
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(event.request).then((cached) => cached || caches.match("/")))
|
||||
);
|
||||
});
|
||||
7
apps/logicsrc-web/scripts/check-assets.js
Normal file
7
apps/logicsrc-web/scripts/check-assets.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { accessSync } from "node:fs";
|
||||
|
||||
for (const file of ["index.html", "public/manifest.webmanifest", "public/icon.svg", "public/service-worker.js", "src/main.ts", "src/styles.css"]) {
|
||||
accessSync(new URL(`../${file}`, import.meta.url));
|
||||
}
|
||||
|
||||
console.log("logicsrc-web assets verified");
|
||||
89
apps/logicsrc-web/server.js
Normal file
89
apps/logicsrc-web/server.js
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
import { createReadStream, existsSync, statSync } from "node:fs";
|
||||
import { createServer } from "node:http";
|
||||
import { extname, join, normalize, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { createCommandBoardServer } from "../commandboard-api/dist/index.js";
|
||||
|
||||
const appDirectory = fileURLToPath(new URL(".", import.meta.url));
|
||||
const distDirectory = resolve(appDirectory, "dist");
|
||||
const indexFile = join(distDirectory, "index.html");
|
||||
const apiServer = createCommandBoardServer();
|
||||
const port = Number(process.env.PORT ?? 4174);
|
||||
|
||||
const mimeTypes = {
|
||||
".css": "text/css; charset=utf-8",
|
||||
".html": "text/html; charset=utf-8",
|
||||
".ico": "image/x-icon",
|
||||
".js": "text/javascript; charset=utf-8",
|
||||
".json": "application/json; charset=utf-8",
|
||||
".png": "image/png",
|
||||
".svg": "image/svg+xml",
|
||||
".webmanifest": "application/manifest+json; charset=utf-8"
|
||||
};
|
||||
|
||||
createServer((request, response) => {
|
||||
const url = new URL(request.url ?? "/", `http://${request.headers.host ?? "localhost"}`);
|
||||
|
||||
if (url.pathname === "/health" || url.pathname.startsWith("/api/")) {
|
||||
apiServer.emit("request", request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (request.method !== "GET" && request.method !== "HEAD") {
|
||||
response.writeHead(405, { allow: "GET, HEAD" });
|
||||
response.end("Method not allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
const file = resolveStaticPath(url.pathname);
|
||||
if (!file) {
|
||||
response.writeHead(403);
|
||||
response.end("Forbidden");
|
||||
return;
|
||||
}
|
||||
|
||||
sendFile(file, request.method === "HEAD", response);
|
||||
}).listen(port, () => {
|
||||
console.log(`LogicSRC standards PWA listening on http://localhost:${port}`);
|
||||
});
|
||||
|
||||
function resolveStaticPath(pathname) {
|
||||
const decodedPath = decodeURIComponent(pathname);
|
||||
const normalizedPath = normalize(decodedPath).replace(/^(\.\.[/\\])+/, "");
|
||||
let candidate = join(distDirectory, normalizedPath);
|
||||
|
||||
if (!candidate.startsWith(distDirectory)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (existsSync(candidate) && statSync(candidate).isDirectory()) {
|
||||
candidate = join(candidate, "index.html");
|
||||
}
|
||||
|
||||
if (existsSync(candidate) && statSync(candidate).isFile()) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
return indexFile;
|
||||
}
|
||||
|
||||
function sendFile(file, headOnly, response) {
|
||||
if (!existsSync(file)) {
|
||||
response.writeHead(500, { "content-type": "text/plain; charset=utf-8" });
|
||||
response.end("Build output missing. Run `npm run build` before `npm start`.");
|
||||
return;
|
||||
}
|
||||
|
||||
const extension = extname(file);
|
||||
response.writeHead(200, {
|
||||
"cache-control": extension === ".html" ? "no-store" : "public, max-age=31536000, immutable",
|
||||
"content-type": mimeTypes[extension] ?? "application/octet-stream"
|
||||
});
|
||||
|
||||
if (headOnly) {
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
|
||||
createReadStream(file).pipe(response);
|
||||
}
|
||||
121
apps/logicsrc-web/src/main.ts
Normal file
121
apps/logicsrc-web/src/main.ts
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
import "./styles.css";
|
||||
|
||||
const primitives = [
|
||||
{ name: "Identity", detail: "DIDs, OAuth accounts, profiles, and organization membership." },
|
||||
{ name: "Coordination", detail: "Boards, posts, threads, comments, tasks, bids, and submissions." },
|
||||
{ name: "Agents", detail: "Agent profiles, capabilities, runs, logs, permissions, and audit trails." },
|
||||
{ name: "Value", detail: "Payments, escrow, wallets, reputation events, and settlement hooks." },
|
||||
{ name: "Events", detail: "Event streams, webhooks, schema versions, and integration audit logs." }
|
||||
];
|
||||
|
||||
const schemas = [
|
||||
{ name: "logicsrc-task", path: "packages/schemas/schemas/logicsrc-task.schema.json" },
|
||||
{ name: "logicsrc-agent", path: "packages/schemas/schemas/logicsrc-agent.schema.json" },
|
||||
{ name: "logicsrc-run", path: "packages/schemas/schemas/logicsrc-run.schema.json" },
|
||||
{ name: "logicsrc-event", path: "packages/schemas/schemas/logicsrc-event.schema.json" },
|
||||
{ name: "logicsrc-plugin", path: "packages/schemas/schemas/logicsrc-plugin.schema.json" }
|
||||
];
|
||||
|
||||
const implementations = [
|
||||
{ name: "CommandBoard.run", detail: "Hosted reference product implementing the LogicSRC primitives." },
|
||||
{ name: "CLI and TUI", detail: "`commandboard` and `cb` clients for standards-compatible workflows." },
|
||||
{ name: "Reference API", detail: "Sample REST API available under `/api/*` for contract testing." },
|
||||
{ name: "Plugins", detail: "CoinPay, uGig, and sh1pt adapters prove the plugin manifest shape." }
|
||||
];
|
||||
|
||||
document.querySelector<HTMLDivElement>("#app")!.innerHTML = `
|
||||
<main class="shell">
|
||||
<aside class="rail">
|
||||
<div class="brand">
|
||||
<span class="mark">LS</span>
|
||||
<div>
|
||||
<strong>LogicSRC</strong>
|
||||
<small>Open coordination standards</small>
|
||||
</div>
|
||||
</div>
|
||||
<nav aria-label="LogicSRC sections">
|
||||
<a class="active" href="#overview">Overview</a>
|
||||
<a href="#schemas">Schemas</a>
|
||||
<a href="#cli">CLI</a>
|
||||
<a href="#reference">Reference</a>
|
||||
</nav>
|
||||
</aside>
|
||||
<section class="workspace">
|
||||
<header id="overview" class="hero">
|
||||
<div>
|
||||
<p class="eyebrow">Profullstack open spec project</p>
|
||||
<h1>LogicSRC</h1>
|
||||
<p class="lede">Open schemas, primitives, and conventions for coordination between humans, AI agents, plugins, payment systems, and hosted products.</p>
|
||||
</div>
|
||||
<div class="status-grid" aria-label="Project status">
|
||||
<span><strong>0.1</strong>draft spec</span>
|
||||
<span><strong>5</strong>schemas</span>
|
||||
<span><strong>3</strong>reference plugins</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="band">
|
||||
<div class="section-head">
|
||||
<h2>Standards Surface</h2>
|
||||
<p>LogicSRC defines the shared language; products can implement it without owning the standard.</p>
|
||||
</div>
|
||||
<div class="primitive-grid">
|
||||
${primitives.map((item) => `
|
||||
<article class="tile">
|
||||
<h3>${item.name}</h3>
|
||||
<p>${item.detail}</p>
|
||||
</article>
|
||||
`).join("")}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="schemas" class="band two-col">
|
||||
<div>
|
||||
<div class="section-head">
|
||||
<h2>Open Schemas</h2>
|
||||
<p>Versioned JSON Schema files are the contract source for tasks, agents, runs, events, and plugins.</p>
|
||||
</div>
|
||||
<div class="schema-list">
|
||||
${schemas.map((schema) => `
|
||||
<article>
|
||||
<strong>${schema.name}</strong>
|
||||
<code>${schema.path}</code>
|
||||
</article>
|
||||
`).join("")}
|
||||
</div>
|
||||
</div>
|
||||
<div id="cli" class="cli-panel">
|
||||
<h2>CLI Validation</h2>
|
||||
<pre><code>npm install
|
||||
npm run schemas:validate
|
||||
npm --workspace @logicsrc/cli run dev -- task validate ./task.yaml</code></pre>
|
||||
<p>The CLI belongs here as standards tooling: validate schemas, inspect objects, and exercise compatible implementations.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="reference" class="band">
|
||||
<div class="section-head">
|
||||
<h2>Reference Implementations</h2>
|
||||
<p>These prove the standard, but they are not the LogicSRC identity.</p>
|
||||
</div>
|
||||
<div class="implementation-list">
|
||||
${implementations.map((item) => `
|
||||
<article>
|
||||
<span></span>
|
||||
<div>
|
||||
<h3>${item.name}</h3>
|
||||
<p>${item.detail}</p>
|
||||
</div>
|
||||
</article>
|
||||
`).join("")}
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</main>
|
||||
`;
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
window.addEventListener("load", () => {
|
||||
navigator.serviceWorker.register("/service-worker.js").catch(() => undefined);
|
||||
});
|
||||
}
|
||||
315
apps/logicsrc-web/src/styles.css
Normal file
315
apps/logicsrc-web/src/styles.css
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
:root {
|
||||
color: #101418;
|
||||
background: #f6f7f4;
|
||||
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
font-size: 16px;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.shell {
|
||||
display: grid;
|
||||
grid-template-columns: 16rem minmax(0, 1fr);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.rail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
padding: 1rem;
|
||||
border-right: 1px solid #d9ded4;
|
||||
background: #101418;
|
||||
color: #f6f7f4;
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.brand small {
|
||||
display: block;
|
||||
margin-top: 0.15rem;
|
||||
color: #b5beb2;
|
||||
}
|
||||
|
||||
.mark {
|
||||
display: grid;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
place-items: center;
|
||||
border: 1px solid #5ac8a6;
|
||||
border-radius: 6px;
|
||||
color: #5ac8a6;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
nav a {
|
||||
min-height: 2.35rem;
|
||||
padding: 0.55rem 0.75rem;
|
||||
border: 1px solid #263039;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
nav a.active,
|
||||
nav a:hover {
|
||||
border-color: #3f5049;
|
||||
background: #1b2329;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.hero,
|
||||
.band {
|
||||
width: 100%;
|
||||
max-width: 72rem;
|
||||
margin: 0 auto 1rem;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
|
||||
gap: 1rem;
|
||||
align-items: end;
|
||||
padding: 1.25rem 0 0.25rem;
|
||||
}
|
||||
|
||||
.eyebrow,
|
||||
.section-head p,
|
||||
.tile p,
|
||||
.implementation-list p,
|
||||
.cli-panel p {
|
||||
color: #58615b;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 0.4rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom: 0.45rem;
|
||||
font-size: 3rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.lede {
|
||||
max-width: 52rem;
|
||||
margin-bottom: 0;
|
||||
font-size: 1.12rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.status-grid span {
|
||||
min-height: 5rem;
|
||||
padding: 0.75rem;
|
||||
border: 1px solid #d6ddd2;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
color: #58615b;
|
||||
}
|
||||
|
||||
.status-grid strong {
|
||||
display: block;
|
||||
color: #101418;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.band {
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: end;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.8rem;
|
||||
}
|
||||
|
||||
.section-head h2,
|
||||
.cli-panel h2 {
|
||||
margin-bottom: 0;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
|
||||
.section-head p {
|
||||
max-width: 34rem;
|
||||
margin-bottom: 0;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.primitive-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.tile,
|
||||
.schema-list article,
|
||||
.cli-panel,
|
||||
.implementation-list article {
|
||||
border: 1px solid #d6ddd2;
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.tile {
|
||||
min-height: 10rem;
|
||||
padding: 0.85rem;
|
||||
}
|
||||
|
||||
.tile h3,
|
||||
.implementation-list h3 {
|
||||
margin-bottom: 0.35rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.tile p,
|
||||
.implementation-list p,
|
||||
.cli-panel p {
|
||||
margin-bottom: 0;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.two-col {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.1fr) minmax(20rem, 0.9fr);
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.schema-list {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.schema-list article {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
min-height: 4.2rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
code {
|
||||
overflow-wrap: anywhere;
|
||||
color: #2d6f60;
|
||||
}
|
||||
|
||||
.cli-panel {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
pre {
|
||||
overflow-x: auto;
|
||||
margin: 0.75rem 0;
|
||||
padding: 0.85rem;
|
||||
border-radius: 6px;
|
||||
background: #101418;
|
||||
color: #f6f7f4;
|
||||
}
|
||||
|
||||
.implementation-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.implementation-list article {
|
||||
display: grid;
|
||||
grid-template-columns: 0.7rem 1fr;
|
||||
gap: 0.65rem;
|
||||
min-height: 9rem;
|
||||
padding: 0.85rem;
|
||||
}
|
||||
|
||||
.implementation-list span {
|
||||
width: 0.7rem;
|
||||
height: 0.7rem;
|
||||
margin-top: 0.25rem;
|
||||
border-radius: 999px;
|
||||
background: #f0c56a;
|
||||
}
|
||||
|
||||
@media (max-width: 980px) {
|
||||
.primitive-grid,
|
||||
.implementation-list {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.hero,
|
||||
.two-col {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.shell {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.rail {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
nav {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
nav a {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
padding: 0.9rem;
|
||||
}
|
||||
|
||||
.section-head,
|
||||
.hero {
|
||||
align-items: start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.status-grid,
|
||||
.primitive-grid,
|
||||
.implementation-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.4rem;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue