mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 08:18:10 +01:00
* feat(loki): chatkit 0.10 — the row under an answer is the fleet's, read in the studio voice Copy · Listen · Share · Try again · Bad answer under every answer are chatkit's AnswerActions now (0.10.0): Listen reads the answer in the studio voice (createServerSpeaker, made inside the tap so a phone does not mute it, the phone's own voice as the fallback) and the row becomes a small player — Stop and the time so far — while it reads. Loki's own copy of the flattening (speech-text) and the browser-voice hook are gone; the path re-exports chatkit's for the voice modules. The composer's placeholder is one row on the narrowest phone, from the same release. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * chore(deps): chatkit 0.10.0 pinned to main Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * feat(loki): temporary chat — never listed, gone when you leave "Temporary chat" in the start screen's menu (and a thread's): the next conversation is created `ephemeral` (conversations.ephemeral, drizzle 0126). It is never in the rail, the start screen or an export — every list reads ephemeral = false — and it is deleted the moment the person leaves it: a new chat, a switch to another thread, a closed tab (the delete goes with keepalive). The daily sweep (crons/sweep-temporary-chats, 04:40 UTC) takes any left behind by a dead phone. The header says "Not saved — gone when you leave" while one is open or armed. lib/loki/temporary-chat.ts holds the leave rule, pure and tested (scripts/test/loki-temporary-chat.ts). The workspace's two drawers moved to WorkspaceDrawers to stay under the line cap. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * chore(drizzle): format the generated 0126 meta Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE * fix(crons): the temporary-chat sweep writes its outcome down cron-outcome-persistence: every cron-authed route records what it did with logDebug, since the journal holds about a day. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE --------- Co-authored-by: Claude <noreply@anthropic.com>
44 lines
2.3 KiB
TypeScript
44 lines
2.3 KiB
TypeScript
/**
|
|
* A temporary chat is gone when the person leaves it, and never listed.
|
|
*
|
|
* The leave rule is pure (lib/loki/temporary-chat.ts); the rest is pinned by
|
|
* reading the files that carry the promise: the create route accepts the
|
|
* flag, the list query hides the flag, the sweep exists and has its timer.
|
|
*/
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import { leavesTemporary, TEMPORARY_CHAT_MAX_AGE_MS } from "../../src/lib/loki/temporary-chat";
|
|
|
|
assert.equal(leavesTemporary("t", null, "t"), true, "new chat leaves it");
|
|
assert.equal(leavesTemporary("t", "other", "t"), true, "switching leaves it");
|
|
assert.equal(leavesTemporary(null, "t", "t"), false, "entering is not leaving");
|
|
assert.equal(leavesTemporary("t", "t", "t"), false, "staying is not leaving");
|
|
assert.equal(leavesTemporary("a", "b", null), false, "no temporary chat, nothing to delete");
|
|
assert.equal(leavesTemporary("a", null, "t"), false, "leaving another thread deletes nothing");
|
|
assert.equal(TEMPORARY_CHAT_MAX_AGE_MS, 24 * 60 * 60 * 1000);
|
|
|
|
const route = readFileSync("src/app/api/conversations/route.ts", "utf8");
|
|
assert.match(
|
|
route,
|
|
/ephemeral: z\.boolean\(\)\.default\(false\)/,
|
|
"the create route takes the flag",
|
|
);
|
|
const queries = readFileSync("src/db/queries/conversations.ts", "utf8");
|
|
assert.match(queries, /eq\(conversations\.ephemeral, false\)/, "the list hides temporary chats");
|
|
assert.match(queries, /deleteStaleEphemeralConversations/, "the sweep's query exists");
|
|
const exportRoute = readFileSync("src/app/api/me/export/route.ts", "utf8");
|
|
assert.match(exportRoute, /eq\(conversations\.ephemeral, false\)/, "an export leaves them out");
|
|
const crons = readFileSync("scripts/install-hetzner-crons.sh", "utf8");
|
|
assert.match(crons, /\[sweep-temporary-chats\]=/, "the sweep has its timer");
|
|
const hook = readFileSync("src/hooks/use-temporary-chat.ts", "utf8");
|
|
assert.match(hook, /keepalive: true/, "a closed tab still sends the delete");
|
|
const workspace = readFileSync("src/components/loki/LokiWorkspace.tsx", "utf8");
|
|
assert.match(workspace, /ephemeral: temporary\.armed/, "the toggle reaches the create call");
|
|
assert.match(
|
|
workspace,
|
|
/temporary\.claim\(conversation\.id\)/,
|
|
"a temporary thread never joins the rail",
|
|
);
|
|
|
|
console.log("loki-temporary-chat: ok");
|