dissentry 0.7.0 → 0.8.1
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 +23 -8
- package/dist/server.js +52 -4
- package/dist/web/assets/index-5nVo2SEq.js +219 -0
- package/dist/web/assets/index-BeU0HU7s.css +2 -0
- package/dist/web/index.html +18 -2
- package/dist/web/llms.txt +2 -1
- package/package.json +1 -1
- package/dist/web/assets/index-Bd45X4_w.js +0 -219
- package/dist/web/assets/index-Dp1G4cqG.css +0 -2
package/README.md
CHANGED
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
<p align="center"><b>Don’t take one AI’s word for it.</b><br/>Ask one model. The others fact-check it, and add a note only when it’s wrong.</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<a href="https://dissentry.lihaila.com"><
|
|
10
|
-
|
|
11
|
-
<a href="https://
|
|
12
|
-
|
|
9
|
+
<a href="https://dissentry.lihaila.com"><strong>Try Live App →</strong></a>
|
|
10
|
+
·
|
|
11
|
+
<a href="https://dissentry.lihaila.com/welcome">Overview</a>
|
|
12
|
+
·
|
|
13
|
+
<a href="https://www.npmjs.com/package/dissentry"><code>npx dissentry</code></a>
|
|
14
|
+
·
|
|
15
|
+
<a href="https://github.com/Lihaila/dissentry/releases">Releases</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://www.npmjs.com/package/dissentry"><img src="https://img.shields.io/npm/v/dissentry?label=npm&color=2563eb&style=flat" alt="npm version" /></a>
|
|
20
|
+
<a href="https://github.com/Lihaila/dissentry/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Lihaila/dissentry/ci.yml?branch=main&label=CI&style=flat" alt="CI status" /></a>
|
|
21
|
+
<a href="https://github.com/Lihaila/dissentry/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-f59e0b?style=flat" alt="MIT license" /></a>
|
|
13
22
|
</p>
|
|
14
23
|
|
|
15
24
|
---
|
|
@@ -18,7 +27,7 @@ Dissentry is an X-style timeline for AI models. You `@mention` a model to ask it
|
|
|
18
27
|
|
|
19
28
|
You decide whether each note is right, and the **Trust** page shows which models get corrected and whose notes hold up, on *your* questions.
|
|
20
29
|
|
|
21
|
-
|
|
30
|
+
https://github.com/user-attachments/assets/0a38fb4d-9615-4770-bb28-a1867de8e7e5
|
|
22
31
|
|
|
23
32
|
## Features
|
|
24
33
|
|
|
@@ -30,7 +39,8 @@ You decide whether each note is right, and the **Trust** page shows which models
|
|
|
30
39
|
- **Or bring your own keys**: OpenAI, Anthropic, Gemini, DeepSeek, Qwen (with 1-click regional & Coding Plan endpoints), xAI, Mistral, Groq, any OpenAI-compatible endpoint, plus **Ollama** and **LM Studio** for local models — with a searchable model picker.
|
|
31
40
|
- **Share as image**: turn any answer and its notes into a polished card for X, in one click.
|
|
32
41
|
- **Token usage & personal trust scores**: tokens and estimated cost per answer and per model, plus trust stats built from your own verdicts.
|
|
33
|
-
- **
|
|
42
|
+
- **Local vs. Cloud clarity & Local-only thread lock**: every model is clearly labeled **Local** or **Cloud**, the composer shows before sending whether a post stays on your device or shares context with cloud checkers, and a 1-click **Local only** lock enforces a hard privacy boundary across the entire thread (including replies, quotes, and checks).
|
|
43
|
+
- **Private & persistent by design**: keys, chats, attachments, generated media, and your custom profile avatar stay on your device. Running `npx dissentry` automatically syncs to `~/.dissentry/data.json` (`0600` owner-only permissions) and auto-restores if browser data is cleared; the hosted web app requests browser persistent storage and supports 1-click local JSON file auto-backup. No accounts, no telemetry.
|
|
34
44
|
- **Four languages**: English, 简体中文, 日本語, 한국어.
|
|
35
45
|
- **Works behind proxies**: HTTP, HTTPS and SOCKS5 with a bypass list (local version).
|
|
36
46
|
|
|
@@ -52,10 +62,15 @@ You decide whether each note is right, and the **Trust** page shows which models
|
|
|
52
62
|
**Local** (recommended for local models and maximum privacy; needs Node.js 20+):
|
|
53
63
|
|
|
54
64
|
```bash
|
|
65
|
+
# Run immediately (no install required)
|
|
55
66
|
npx dissentry
|
|
67
|
+
|
|
68
|
+
# Or install globally so you can run `dissentry` anywhere
|
|
69
|
+
npm i -g dissentry
|
|
70
|
+
dissentry
|
|
56
71
|
```
|
|
57
72
|
|
|
58
|
-
This opens http://localhost:4317. The local version adds a built-in pass-through proxy
|
|
73
|
+
This opens http://localhost:4317. The local version adds a built-in pass-through proxy (so every provider works and local models need no CORS setup) and automatically persists your models, API keys, and threads to `~/.dissentry/data.json` (`0600`).
|
|
59
74
|
|
|
60
75
|
**Docker:**
|
|
61
76
|
|
|
@@ -97,7 +112,7 @@ DISSENTRY_LIVE=1 OPENAI_API_KEY=… npx vitest run tests/live.test.ts # option
|
|
|
97
112
|
|---|---|
|
|
98
113
|
| `src/lib/engine.ts` | posting, parallel streaming replies, media dispatch, checkers, note merging, usage |
|
|
99
114
|
| `src/lib/context.ts` | shared thread memory → multimodal model messages; checker prompt |
|
|
100
|
-
| `src/lib/media.ts`, `src/lib/files.ts` | image/audio/video generation
|
|
115
|
+
| `src/lib/media.ts`, `src/lib/files.ts`, `src/lib/persistence.ts` | image/audio/video generation; local attachment & avatar processing; disk & file persistence |
|
|
101
116
|
| `src/lib/notes.ts`, `src/lib/claims.ts` | checker JSON parsing, note merging, disputed-claim highlighting |
|
|
102
117
|
| `src/lib/providers.ts`, `src/lib/openrouter.ts` | provider adapters (web search, DeepThink, model picker), OpenRouter sign-in (OAuth PKCE) |
|
|
103
118
|
| `src/i18n/` | UI strings in four languages |
|
package/dist/server.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { serve } from "@hono/node-server";
|
|
3
3
|
import { spawn } from "child_process";
|
|
4
4
|
import { existsSync } from "fs";
|
|
5
|
+
import { homedir } from "os";
|
|
5
6
|
import { dirname, join as join2 } from "path";
|
|
6
7
|
import { fileURLToPath } from "url";
|
|
7
8
|
|
|
@@ -79,7 +80,7 @@ function dispatcherFor(target, mode, bypass = "") {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
// server/app.ts
|
|
82
|
-
import { readFile, stat } from "fs/promises";
|
|
83
|
+
import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
|
|
83
84
|
import { extname, join, normalize, sep } from "path";
|
|
84
85
|
var TARGET_HEADER = "x-dissentry-target";
|
|
85
86
|
var upstreamFetch = (url, init, dispatcher) => dispatcher ? undiciFetch(url, { ...init, dispatcher }) : fetch(url, init);
|
|
@@ -142,7 +143,47 @@ function createApp(opts) {
|
|
|
142
143
|
}
|
|
143
144
|
await next();
|
|
144
145
|
});
|
|
145
|
-
|
|
146
|
+
const dataFile = opts.dataDir ? join(opts.dataDir, "data.json") : void 0;
|
|
147
|
+
app2.get("/api/health", (c) => c.json({
|
|
148
|
+
ok: true,
|
|
149
|
+
proxy: true,
|
|
150
|
+
systemProxy: describeProxy(envProxyUrl()) ?? null,
|
|
151
|
+
storage: Boolean(dataFile),
|
|
152
|
+
dataFile: dataFile ? opts.dataFileDisplay ?? dataFile : null
|
|
153
|
+
}));
|
|
154
|
+
if (opts.dataDir && dataFile) {
|
|
155
|
+
const dir = opts.dataDir;
|
|
156
|
+
const file = dataFile;
|
|
157
|
+
app2.get("/api/storage", async (c) => {
|
|
158
|
+
try {
|
|
159
|
+
const raw = await readFile(file, "utf8");
|
|
160
|
+
return c.body(raw, 200, { "content-type": "application/json; charset=utf-8", "cache-control": "no-store" });
|
|
161
|
+
} catch (e) {
|
|
162
|
+
if (e.code === "ENOENT") return c.json({ empty: true }, 200);
|
|
163
|
+
return c.json({ error: e.message }, 500);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
app2.put("/api/storage", async (c) => {
|
|
167
|
+
const raw = await c.req.text();
|
|
168
|
+
if (raw.length > 100 * 1024 * 1024) return c.json({ error: "Payload too large" }, 413);
|
|
169
|
+
let parsed;
|
|
170
|
+
try {
|
|
171
|
+
parsed = JSON.parse(raw);
|
|
172
|
+
} catch {
|
|
173
|
+
return c.json({ error: "Invalid JSON" }, 400);
|
|
174
|
+
}
|
|
175
|
+
if (parsed?.app !== "dissentry") return c.json({ error: "Not a Dissentry snapshot" }, 400);
|
|
176
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
177
|
+
const tmp = `${file}.${process.pid}.${Date.now()}.tmp`;
|
|
178
|
+
await writeFile(tmp, raw, { encoding: "utf8", mode: 384 });
|
|
179
|
+
await rename(tmp, file);
|
|
180
|
+
return c.json({ ok: true, savedAt: Date.now() });
|
|
181
|
+
});
|
|
182
|
+
app2.delete("/api/storage", async (c) => {
|
|
183
|
+
await rm(file, { force: true });
|
|
184
|
+
return c.json({ ok: true });
|
|
185
|
+
});
|
|
186
|
+
}
|
|
146
187
|
app2.all("/api/proxy", async (c) => {
|
|
147
188
|
const target = c.req.header(TARGET_HEADER);
|
|
148
189
|
let url;
|
|
@@ -236,6 +277,8 @@ Usage: npx dissentry [options]
|
|
|
236
277
|
--port <n> Port to listen on (default 4317, env PORT)
|
|
237
278
|
--host <addr> Address to bind (default 127.0.0.1, env HOST)
|
|
238
279
|
--allow-host <h> Extra Host header to accept, comma separated (env DISSENTRY_ALLOWED_HOSTS)
|
|
280
|
+
--data-dir <dir> Directory for local disk persistence (default ~/.dissentry, env DISSENTRY_DATA_DIR)
|
|
281
|
+
--no-disk Disable automatic local disk persistence
|
|
239
282
|
--no-open Do not open the browser
|
|
240
283
|
`);
|
|
241
284
|
process.exit(0);
|
|
@@ -243,6 +286,9 @@ Usage: npx dissentry [options]
|
|
|
243
286
|
var port = Number(opt("port") ?? process.env.PORT ?? 4317);
|
|
244
287
|
var host = opt("host") ?? process.env.HOST ?? "127.0.0.1";
|
|
245
288
|
var extraHosts = (opt("allow-host") ?? process.env.DISSENTRY_ALLOWED_HOSTS ?? "").split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
289
|
+
var home = homedir();
|
|
290
|
+
var dataDir = flag("no-disk") ? void 0 : opt("data-dir") ?? process.env.DISSENTRY_DATA_DIR ?? join2(home, ".dissentry");
|
|
291
|
+
var dataFileDisplay = dataDir ? join2(dataDir, "data.json").replace(home, "~") : void 0;
|
|
246
292
|
var here = dirname(fileURLToPath(import.meta.url));
|
|
247
293
|
var webDir = join2(here, "web");
|
|
248
294
|
if (!existsSync(join2(webDir, "index.html"))) {
|
|
@@ -252,13 +298,15 @@ if (!existsSync(join2(webDir, "index.html"))) {
|
|
|
252
298
|
if (host !== "127.0.0.1" && host !== "localhost" && host !== "::1" && extraHosts.length === 0) {
|
|
253
299
|
console.warn(`! Binding to ${host}. Requests are still only accepted with a localhost Host header; pass --allow-host <your-hostname> to reach it from other machines (and put it behind auth).`);
|
|
254
300
|
}
|
|
255
|
-
var app = createApp({ allowedHosts: ["localhost", "127.0.0.1", "[::1]", ...extraHosts], webDir });
|
|
301
|
+
var app = createApp({ allowedHosts: ["localhost", "127.0.0.1", "[::1]", ...extraHosts], webDir, dataDir, dataFileDisplay });
|
|
256
302
|
serve({ fetch: app.fetch, port, hostname: host }, (info) => {
|
|
257
303
|
const url = `http://localhost:${info.port}`;
|
|
258
304
|
console.log(`
|
|
259
305
|
Dissentry is running at ${url}
|
|
260
|
-
|
|
306
|
+
API keys never leave this machine except to the provider you call.
|
|
261
307
|
Press Ctrl+C to stop.
|
|
308
|
+
`);
|
|
309
|
+
if (dataFileDisplay) console.log(` Local disk persistence: ${dataFileDisplay} (owner-only permissions, auto-restores if browser data is cleared).
|
|
262
310
|
`);
|
|
263
311
|
if (envProxyUrl()) console.log(` System proxy detected: ${describeProxy(envProxyUrl())} (used when Settings \u2192 Network proxy is "System").
|
|
264
312
|
`);
|