@mneme-ai/gephyra 2.85.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.
- package/README.md +40 -0
- package/dist/bin.d.ts +11 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +64 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @mneme-ai/gephyra
|
|
2
|
+
|
|
3
|
+
**GEPHYRA** (γέφυρα, "bridge") — the living bridge / **Toll Booth of Truth** for AI agents.
|
|
4
|
+
|
|
5
|
+
Every router/gateway/bridge in history forwards bytes without caring whether they're true. GEPHYRA is the first bridge that **inspects the truth of what crosses it in real time** and stamps a tamper-evident receipt. It is the deployable **surface** of [Mneme](https://github.com/patsa2561-art/mneme-ai): Mneme is the brain; GEPHYRA is the face the agent world plugs into.
|
|
6
|
+
|
|
7
|
+
A single crossing runs through **truth-customs**, composing Mneme's organs:
|
|
8
|
+
|
|
9
|
+
1. **IMMUNE** — injection/collusion is quarantined (never crosses).
|
|
10
|
+
2. **TOLL** — the sender's honesty band sets scrutiny.
|
|
11
|
+
3. **TRUTH-CUSTOMS** — Mneme's 7-layer ACGV verifies the claim; a refuted claim is **corrected before delivery** (plus a deterministic arithmetic backstop).
|
|
12
|
+
4. **CONSCIENCE** — an overconfident claim gets a nudge back to the sender.
|
|
13
|
+
5. **BLACK BOX** — the crossing is recorded as a signed, chained frame.
|
|
14
|
+
6. **STAMP** — an Ed25519 NOTARY receipt that anyone verifies **offline**.
|
|
15
|
+
|
|
16
|
+
Resilient by design: every organ degrades gracefully; the bridge **never throws** and never drops traffic (truth engine down ⇒ crosses flagged `UNVERIFIED`).
|
|
17
|
+
|
|
18
|
+
## Use
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @mneme-ai/gephyra serve --port 17742
|
|
22
|
+
# POST /cross {"claim":"...","fromAgent":"grok"} → truth-customs + signed crossing
|
|
23
|
+
# GET /status → crossings + hallucinations caught
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { startServer, crossBridge, gephyra } from "@mneme-ai/gephyra";
|
|
28
|
+
|
|
29
|
+
const bridge = await startServer({ port: 17742 });
|
|
30
|
+
|
|
31
|
+
const r = await crossBridge(process.cwd(),
|
|
32
|
+
{ claim: "the body has 400 blood vessels", fromAgent: "grok" },
|
|
33
|
+
{ verify: gephyra.apoptosisTruthCustoms(process.cwd()) },
|
|
34
|
+
);
|
|
35
|
+
// r.disposition: "CORRECTED" — r.deliveredClaim is the fixed claim; r.receipt verifies offline
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The truth-customs engine lives in `@mneme-ai/core`; this package re-exports it and adds the deployable HTTP server + the `gephyra` bin.
|
|
39
|
+
|
|
40
|
+
**License:** MIT.
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `gephyra` — standalone CLI for the GEPHYRA bridge (zero extra deps).
|
|
4
|
+
*
|
|
5
|
+
* gephyra serve [--port 17742] [--repo PATH] run the Toll Booth as an HTTP endpoint
|
|
6
|
+
* gephyra cross --claim "..." --from AGENT one-shot crossing (prints JSON)
|
|
7
|
+
* gephyra status [--repo PATH] live bridge status
|
|
8
|
+
* gephyra --version
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `gephyra` — standalone CLI for the GEPHYRA bridge (zero extra deps).
|
|
4
|
+
*
|
|
5
|
+
* gephyra serve [--port 17742] [--repo PATH] run the Toll Booth as an HTTP endpoint
|
|
6
|
+
* gephyra cross --claim "..." --from AGENT one-shot crossing (prints JSON)
|
|
7
|
+
* gephyra status [--repo PATH] live bridge status
|
|
8
|
+
* gephyra --version
|
|
9
|
+
*/
|
|
10
|
+
import { startServer, gephyra, GEPHYRA_DEFAULT_PORT } from "./index.js";
|
|
11
|
+
function flag(args, name) {
|
|
12
|
+
const i = args.indexOf(name);
|
|
13
|
+
return i >= 0 && i + 1 < args.length ? args[i + 1] : undefined;
|
|
14
|
+
}
|
|
15
|
+
function out(s) { process.stdout.write(s + "\n"); }
|
|
16
|
+
async function main() {
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
const cmd = args[0];
|
|
19
|
+
const repoRoot = flag(args, "--repo") ?? process.cwd();
|
|
20
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
21
|
+
// Version is injected at build from package.json import is avoided; read lazily.
|
|
22
|
+
try {
|
|
23
|
+
const { readFileSync } = await import("node:fs");
|
|
24
|
+
const { fileURLToPath } = await import("node:url");
|
|
25
|
+
const { dirname, join } = await import("node:path");
|
|
26
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
27
|
+
const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8"));
|
|
28
|
+
out(pkg.version ?? "unknown");
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
out("unknown");
|
|
32
|
+
}
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
if (cmd === "serve") {
|
|
36
|
+
const port = flag(args, "--port") ? Number(flag(args, "--port")) : GEPHYRA_DEFAULT_PORT;
|
|
37
|
+
const handle = await startServer({ repoRoot, port });
|
|
38
|
+
out(`🌉 GEPHYRA serving on http://127.0.0.1:${handle.port} | POST /cross {claim, fromAgent} · GET /status`);
|
|
39
|
+
out(` (Ctrl-C to stop. Real-time truth-customs; every crossing recorded + Ed25519-stamped.)`);
|
|
40
|
+
// Keep the process alive until killed.
|
|
41
|
+
await new Promise(() => { });
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
if (cmd === "cross") {
|
|
45
|
+
const claim = flag(args, "--claim");
|
|
46
|
+
const from = flag(args, "--from");
|
|
47
|
+
if (!claim || !from) {
|
|
48
|
+
out("✗ gephyra cross requires --claim and --from");
|
|
49
|
+
return 2;
|
|
50
|
+
}
|
|
51
|
+
const r = await gephyra.crossBridge(repoRoot, { claim, fromAgent: from }, { verify: gephyra.apoptosisTruthCustoms(repoRoot) });
|
|
52
|
+
out(JSON.stringify({ disposition: r.disposition, verdict: r.verdict, deliveredClaim: r.deliveredClaim, nudges: r.nudges, receiptId: r.receipt?.receiptId }, null, 2));
|
|
53
|
+
return r.disposition === "QUARANTINED" ? 1 : 0;
|
|
54
|
+
}
|
|
55
|
+
if (cmd === "status") {
|
|
56
|
+
out(JSON.stringify(gephyra.bridgeStatus(repoRoot), null, 2));
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
out("GEPHYRA — the Toll Booth of Truth");
|
|
60
|
+
out("usage: gephyra serve [--port N] | cross --claim \"...\" --from AGENT | status | --version");
|
|
61
|
+
return cmd ? 2 : 0;
|
|
62
|
+
}
|
|
63
|
+
main().then((code) => process.exit(code)).catch((e) => { process.stderr.write(`gephyra: ${e.message}\n`); process.exit(1); });
|
|
64
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAExE,SAAS,IAAI,CAAC,IAAc,EAAE,IAAY;IACxC,MAAM,CAAC,GAAG,IAAI,CA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AC,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtK,OAAO,CAAC,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7D,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACzC,GAAG,CAAC,2FAA2F,CAAC,CAAC;IACjG,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mneme-ai/gephyra — GEPHYRA, the living bridge / Toll Booth of Truth.
|
|
3
|
+
*
|
|
4
|
+
* The deployable SURFACE of Mneme. The truth-customs engine lives in
|
|
5
|
+
* @mneme-ai/core (where it is tested + composed from every Mneme organ); this
|
|
6
|
+
* package re-exports it and adds the deployable HTTP server + `gephyra` bin, so
|
|
7
|
+
* GEPHYRA can run standalone in front of any agent/protocol without pulling in
|
|
8
|
+
* the full Mneme CLI. Mneme = the brain; GEPHYRA = the face.
|
|
9
|
+
*
|
|
10
|
+
* import { startServer, crossBridge } from "@mneme-ai/gephyra";
|
|
11
|
+
* const bridge = await startServer({ port: 17742 }); // POST /cross
|
|
12
|
+
*/
|
|
13
|
+
import { type Server } from "node:http";
|
|
14
|
+
import { gephyra } from "@mneme-ai/core";
|
|
15
|
+
export { gephyra };
|
|
16
|
+
export declare const crossBridge: typeof gephyra.crossBridge;
|
|
17
|
+
export declare const handleCrossRequest: typeof gephyra.handleCrossRequest;
|
|
18
|
+
export declare const bridgeStatus: typeof gephyra.bridgeStatus;
|
|
19
|
+
export declare const bridgeReplay: typeof gephyra.bridgeReplay;
|
|
20
|
+
export declare const verifyCrossing: typeof gephyra.verifyCrossing;
|
|
21
|
+
export declare const apoptosisTruthCustoms: typeof gephyra.apoptosisTruthCustoms;
|
|
22
|
+
export declare const gephyraAdvertisement: typeof gephyra.gephyraAdvertisement;
|
|
23
|
+
export declare const newCapabilitiesSince: typeof gephyra.newCapabilitiesSince;
|
|
24
|
+
export declare const GEPHYRA_DEFAULT_PORT = 17742;
|
|
25
|
+
export interface ServeHandle {
|
|
26
|
+
server: Server;
|
|
27
|
+
/** The actual bound port (resolved even when you pass 0 for an ephemeral port). */
|
|
28
|
+
port: number;
|
|
29
|
+
/** Graceful shutdown. */
|
|
30
|
+
close: () => Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Start GEPHYRA as a standalone HTTP endpoint. `POST /cross` with
|
|
34
|
+
* `{ claim, fromAgent, toAgent?, action? }` runs the crossing through real-time
|
|
35
|
+
* truth-customs (7-layer ACGV) and returns the signed result. `GET /status`
|
|
36
|
+
* returns the live bridge status. Never crashes on a bad request (400 JSON).
|
|
37
|
+
* Resolves once the server is listening (port 0 ⇒ OS-assigned ephemeral port).
|
|
38
|
+
*/
|
|
39
|
+
export declare function startServer(opts?: {
|
|
40
|
+
repoRoot?: string;
|
|
41
|
+
port?: number;
|
|
42
|
+
host?: string;
|
|
43
|
+
}): Promise<ServeHandle>;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,eAAO,MAAM,WAAW,4BAAsB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,mCAA6B,CAAC;AAC7D,eAAO,MAAM,YAAY,6BAAuB,CAAC;AACjD,eAAO,MAAM,YAAY,6BAAuB,CAAC;AACjD,eAAO,MAAM,cAAc,+BAAyB,CAAC;AACrD,eAAO,MAAM,qBAAqB,sCAAgC,CAAC;AACnE,eAAO,MAAM,oBAAoB,qCAA+B,CAAC;AACjE,eAAO,MAAM,oBAAoB,qCAA+B,CAAC;AAEjE,eAAO,MAAM,oBAAoB,QAAQ,CAAC;AAE1C,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAoChH"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mneme-ai/gephyra — GEPHYRA, the living bridge / Toll Booth of Truth.
|
|
3
|
+
*
|
|
4
|
+
* The deployable SURFACE of Mneme. The truth-customs engine lives in
|
|
5
|
+
* @mneme-ai/core (where it is tested + composed from every Mneme organ); this
|
|
6
|
+
* package re-exports it and adds the deployable HTTP server + `gephyra` bin, so
|
|
7
|
+
* GEPHYRA can run standalone in front of any agent/protocol without pulling in
|
|
8
|
+
* the full Mneme CLI. Mneme = the brain; GEPHYRA = the face.
|
|
9
|
+
*
|
|
10
|
+
* import { startServer, crossBridge } from "@mneme-ai/gephyra";
|
|
11
|
+
* const bridge = await startServer({ port: 17742 }); // POST /cross
|
|
12
|
+
*/
|
|
13
|
+
import { createServer } from "node:http";
|
|
14
|
+
import { gephyra } from "@mneme-ai/core";
|
|
15
|
+
// ── Re-export the engine (the truth-customs primitives live in core) ──
|
|
16
|
+
export { gephyra };
|
|
17
|
+
export const crossBridge = gephyra.crossBridge;
|
|
18
|
+
export const handleCrossRequest = gephyra.handleCrossRequest;
|
|
19
|
+
export const bridgeStatus = gephyra.bridgeStatus;
|
|
20
|
+
export const bridgeReplay = gephyra.bridgeReplay;
|
|
21
|
+
export const verifyCrossing = gephyra.verifyCrossing;
|
|
22
|
+
export const apoptosisTruthCustoms = gephyra.apoptosisTruthCustoms;
|
|
23
|
+
export const gephyraAdvertisement = gephyra.gephyraAdvertisement;
|
|
24
|
+
export const newCapabilitiesSince = gephyra.newCapabilitiesSince;
|
|
25
|
+
export const GEPHYRA_DEFAULT_PORT = 17742;
|
|
26
|
+
/**
|
|
27
|
+
* Start GEPHYRA as a standalone HTTP endpoint. `POST /cross` with
|
|
28
|
+
* `{ claim, fromAgent, toAgent?, action? }` runs the crossing through real-time
|
|
29
|
+
* truth-customs (7-layer ACGV) and returns the signed result. `GET /status`
|
|
30
|
+
* returns the live bridge status. Never crashes on a bad request (400 JSON).
|
|
31
|
+
* Resolves once the server is listening (port 0 ⇒ OS-assigned ephemeral port).
|
|
32
|
+
*/
|
|
33
|
+
export function startServer(opts = {}) {
|
|
34
|
+
const repoRoot = opts.repoRoot ?? process.cwd();
|
|
35
|
+
const port = typeof opts.port === "number" ? opts.port : GEPHYRA_DEFAULT_PORT;
|
|
36
|
+
return new Promise((resolveP, rejectP) => {
|
|
37
|
+
const server = createServer((req, res) => {
|
|
38
|
+
const url = req.url ?? "";
|
|
39
|
+
if (req.method === "GET" && url.startsWith("/status")) {
|
|
40
|
+
const s = gephyra.bridgeStatus(repoRoot);
|
|
41
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
42
|
+
res.end(JSON.stringify(s));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (req.method !== "POST" || !url.startsWith("/cross")) {
|
|
46
|
+
res.writeHead(404, { "content-type": "application/json" });
|
|
47
|
+
res.end(JSON.stringify({ error: "POST /cross {claim, fromAgent} | GET /status" }));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let body = "";
|
|
51
|
+
req.on("data", (c) => { body += c; if (body.length > 1_000_000)
|
|
52
|
+
req.destroy(); });
|
|
53
|
+
req.on("end", () => {
|
|
54
|
+
void gephyra.handleCrossRequest(repoRoot, body)
|
|
55
|
+
.then((r) => { res.writeHead(r.status, { "content-type": "application/json" }); res.end(JSON.stringify(r.body)); })
|
|
56
|
+
.catch((e) => { res.writeHead(500, { "content-type": "application/json" }); res.end(JSON.stringify({ error: e.message })); });
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
server.once("error", rejectP);
|
|
60
|
+
server.listen(port, opts.host ?? "127.0.0.1", () => {
|
|
61
|
+
const addr = server.address();
|
|
62
|
+
const boundPort = typeof addr === "object" && addr ? addr.port : port;
|
|
63
|
+
resolveP({
|
|
64
|
+
server,
|
|
65
|
+
port: boundPort,
|
|
66
|
+
close: () => new Promise((r) => server.close(() => r())),
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
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AAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;qBAClH,KAAK,CAAC,CAAC,CAAQ,EAAE,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACzI,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,WAAW,EAAE,GAAG,EAAE;YACjD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YAC9B,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;YACtE,QAAQ,CAAC;gBACP,MAAM;gBACN,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;aAC/D,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mneme-ai/gephyra",
|
|
3
|
+
"version": "2.85.0",
|
|
4
|
+
"description": "GEPHYRA — the living bridge / Toll Booth of Truth for AI agents. Real-time semantic truth-customs (verify · quarantine injection · honesty toll · conscience nudge · signed crossing) on top of any protocol. The deployable surface of Mneme.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"gephyra": "./dist/bin.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/patsa2561-art/mneme-ai.git",
|
|
20
|
+
"directory": "packages/gephyra"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/patsa2561-art/mneme-ai#readme",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/patsa2561-art/mneme-ai/issues"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -b",
|
|
33
|
+
"clean": "tsc -b --clean"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"ai",
|
|
37
|
+
"bridge",
|
|
38
|
+
"truth",
|
|
39
|
+
"verification",
|
|
40
|
+
"mcp",
|
|
41
|
+
"a2a",
|
|
42
|
+
"agent",
|
|
43
|
+
"notary",
|
|
44
|
+
"toll-booth-of-truth",
|
|
45
|
+
"gephyra"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@mneme-ai/core": "2.85.0"
|
|
49
|
+
},
|
|
50
|
+
"engines": {
|
|
51
|
+
"node": ">=22.13.0 <25.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|