repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs"; |
| #2 | import { dirname, join } from "node:path"; |
| #3 | import { fileURLToPath } from "node:url"; |
| #4 | const __dirname = dirname(fileURLToPath(import.meta.url)); |
| #5 | const JOURNAL_PATH = join(__dirname, "journal", "ticks.jsonl"); |
| #6 | export function appendTick(entry) { |
| #7 | mkdirSync(dirname(JOURNAL_PATH), { recursive: true }); |
| #8 | appendFileSync(JOURNAL_PATH, `${JSON.stringify(entry)}\n`, "utf8"); |
| #9 | } |
| #10 | export function readLastEntries(n = 3) { |
| #11 | if (!existsSync(JOURNAL_PATH)) |
| #12 | return []; |
| #13 | return readFileSync(JOURNAL_PATH, "utf8") |
| #14 | .split("\n") |
| #15 | .filter(Boolean) |
| #16 | .slice(-n) |
| #17 | .map((line) => JSON.parse(line)); |
| #18 | } |
| #19 | export function clearJournal() { |
| #20 | mkdirSync(dirname(JOURNAL_PATH), { recursive: true }); |
| #21 | writeFileSync(JOURNAL_PATH, "", "utf8"); |
| #22 | } |
| #23 | export function journalPath() { |
| #24 | return JOURNAL_PATH; |
| #25 | } |
| #26 | //# sourceMappingURL=journal.js.map |