Skip to content
Python

fix: restore public MemHub CI tooling (#12)

feitianxiang1aed8d750765
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 74b8d80..e5da1f4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,4 +59,30 @@ jobs:
- run: corepack enable
- run: pnpm install --frozen-lockfile
- run: uv sync --directory apps/core --all-groups --locked
- - run: pnpm check
+ - name: Verify public source structure and privacy boundaries
+ run: |
+ python3 scripts/verify_structure.py
+ python3 scripts/generate_core_test_index.py --check
+ python3 scripts/verify_zero_collection.py
+ python3 scripts/verify_zero_collection.py --self-test
+ - name: Lint Node workspaces
+ run: pnpm lint
+ - name: Typecheck Node workspaces
+ run: pnpm typecheck
+ - name: Test Node workspaces
+ run: pnpm test
+ - name: Test release tooling
+ run: pnpm test:release-scripts
+ - name: Fetch and verify the pinned embedding model
+ run: |
+ pnpm fetch:embedding-model
+ uv run --directory apps/core python -c \
+ "from one_memory.embedding_assets import assets_present, verify_assets; assert assets_present(); verify_assets()"
+ - name: Test public Core smoke suite
+ run: >-
+ bash scripts/run-tests-isolated.sh core-pr
+ tests/test_core_test_reporting.py
+ tests/test_import_api.py
+ tests/test_recent_first_import.py
+ tests/test_source_session_count_api.py
+ tests/test_schema_migrations.py
diff --git a/memhub/apps/cli/scripts/prepare-publish-manifest.mjs b/memhub/apps/cli/scripts/prepare-publish-manifest.mjs
index 06017b9..b4bc4ef 100644
--- a/memhub/apps/cli/scripts/prepare-publish-manifest.mjs
+++ b/memhub/apps/cli/scripts/prepare-publish-manifest.mjs
@@ -13,8 +13,8 @@
* the real package.json and only strips what is provably not needed at runtime.
*/
import { execFileSync } from "node:child_process";
+import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { createRequire } from "node:module";
-import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
@@ -27,10 +27,7 @@ const releaseVersion = resolveBuildVersion(process.env, repositoryRoot);
const pkgPath = resolve(root, "package.json");
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
const publishName = process.env.MEMHUB_NPM_PACKAGE?.trim();
-if (
- !publishName ||
- !/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(publishName)
-) {
+if (!publishName || !/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(publishName)) {
throw new Error(
"MEMHUB_NPM_PACKAGE must name the explicit npm publish identity",
);
@@ -38,8 +35,12 @@ if (
const bundle = resolve(root, "dist/one-memory.cjs");
const source = readFileSync(bundle, "utf8");
-const runtimeRequires = [...source.matchAll(/require\(["']([^"']+)["']\)/g)].map((m) => m[1]);
-const workspaceLeaked = runtimeRequires.filter((name) => name.startsWith("@one-memory/"));
+const runtimeRequires = [
+ ...source.matchAll(/require\(["']([^"']+)["']\)/g),
+].map((m) => m[1]);
+const workspaceLeaked = runtimeRequires.filter((name) =>
+ name.startsWith("@one-memory/"),
+);
if (workspaceLeaked.length > 0) {
throw new Error(
`bundle still requires workspace packages at runtime: ${workspaceLeaked.join(", ")}. ` +
@@ -61,9 +62,7 @@ for (const section of ["dependencies", "devDependencies", "peerDependencies"]) {
// else is build-time only. The bundle is inlined (tsup noExternal), so
// in practice only Node builtins remain — but compute it rather than
// assume, so a future non-inlined dep is not silently dropped.
- runtimeRequires.some(
- (req) => req === name || req.startsWith(`${name}/`),
- ),
+ runtimeRequires.some((req) => req === name || req.startsWith(`${name}/`)),
),
);
if (Object.keys(published[section]).length === 0) delete published[section];
@@ -77,8 +76,15 @@ published.files = ["dist", "scripts", "package.json"];
// in the staging dir overrides that and makes the manifest authoritative.
writeFileSync(
resolve(outDir, ".npmignore"),
- ["# Ship the built bundle: the repo root .gitignore excludes dist/.", "!dist/", ""].join("\n"),
+ [
+ "# Ship the built bundle: the repo root .gitignore excludes dist/.",
+ "!dist/",
+ "",
+ ].join("\n"),
);
-writeFileSync(resolve(outDir, "package.json"), `${JSON.stringify(published, null, 2)}\n`);
+writeFileSync(
+ resolve(outDir, "package.json"),
+ `${JSON.stringify(published, null, 2)}\n`,
+);
console.log("wrote", resolve(outDir, "package.json"));
diff --git a/memhub/apps/cli/scripts/verify-package-matrix.mjs b/memhub/apps/cli/scripts/verify-package-matrix.mjs
index bfd6252..aa3066d 100644
--- a/memhub/apps/cli/scripts/verify-package-matrix.mjs
+++ b/memhub/apps/cli/scripts/verify-package-matrix.mjs
@@ -20,11 +20,7 @@ import { pathToFileURL } from "node:url";
const REQUIRED_ALIASES = {
daemon: ["start", "stop", "restart", "status"],
- "startup-service": [
- "service-plan",
- "service-install",
- "service-uninstall",
- ],
+ "startup-service": ["service-plan", "service-install", "service-uninstall"],
};
const REQUIRED_COMMAND_SURFACE = [
@@ -112,19 +108,85 @@ const REQUIRED_SUBCOMMANDS = [
* These run without `--lifecycle`, so they are safe against any package.
*/
const STOPPED_DESTRUCTIVE_PROBES = [
- { name: "calls_clear_preview", args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111"] },
- { name: "calls_clear_apply", args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111", "--confirm"] },
- { name: "calls_clear_all_apply", args: ["calls", "clear", "--all", "--confirm"] },
- { name: "import_file_commit_apply", args: ["import-file", "commit", "22222222-2222-4222-8222-222222222222", "--confirm"] },
- { name: "import_file_discard_apply", args: ["import-file", "discard", "22222222-2222-4222-8222-222222222222", "--confirm"] },
- { name: "notes_process_apply", args: ["notes", "process", "33333333-3333-4333-8333-333333333333", "--confirm"] },
+ {
+ name: "calls_clear_preview",
+ args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111"],
+ },
+ {
+ name: "calls_clear_apply",
+ args: [
+ "calls",
+ "clear",
+ "--event",
+ "11111111-1111-4111-8111-111111111111",
+ "--confirm",
+ ],
+ },
+ {
+ name: "calls_clear_all_apply",
+ args: ["calls", "clear", "--all", "--confirm"],
+ },
+ {
+ name: "import_file_commit_apply",
+ args: [
+ "import-file",
+ "commit",
+ "22222222-2222-4222-8222-222222222222",
+ "--confirm",
+ ],
+ },
+ {
+ name: "import_file_discard_apply",
+ args: [
+ "import-file",
+ "discard",
+ "22222222-2222-4222-8222-222222222222",
+ "--confirm",
+ ],
+ },
+ {
+ name: "notes_process_apply",
+ args: [
+ "notes",
+ "process",
+ "33333333-3333-4333-8333-333333333333",
+ "--confirm",
+ ],
+ },
{ name: "permission_allow", args: ["permission", "allow"] },
{ name: "permission_deny", args: ["permission", "deny"] },
- { name: "extraction_set_apply", args: ["extraction", "set", "--window", "6m", "--confirm"] },
- { name: "graph_width_apply", args: ["graph", "width", "--decision", "keep_existing", "--confirm"] },
- { name: "processing_extract_apply", args: ["processing", "extract", "--confirm"] },
- { name: "models_activate_apply", args: ["models", "activate", "44444444-4444-4444-8444-444444444444", "--confirm"] },
- { name: "models_edit_apply", args: ["models", "edit", "44444444-4444-4444-8444-444444444444", "--config-file", "/nonexistent/patch.json", "--confirm"] },
+ {
+ name: "extraction_set_apply",
+ args: ["extraction", "set", "--window", "6m", "--confirm"],
+ },
+ {
+ name: "graph_width_apply",
+ args: ["graph", "width", "--decision", "keep_existing", "--confirm"],
+ },
+ {
+ name: "processing_extract_apply",
+ args: ["processing", "extract", "--confirm"],
+ },
+ {
+ name: "models_activate_apply",
+ args: [
+ "models",
+ "activate",
+ "44444444-4444-4444-8444-444444444444",
+ "--confirm",
+ ],
+ },
+ {
+ name: "models_edit_apply",
+ args: [
+ "models",
+ "edit",
+ "44444444-4444-4444-8444-444444444444",
+ "--config-file",
+ "/nonexistent/patch.json",
+ "--confirm",
+ ],
+ },
];
export function validateCatalog(document) {
@@ -201,7 +263,9 @@ export async function runPackageMatrix(runtimeDist, options = {}) {
const markers = REQUIRED_MARKERS.filter(
(marker) => !bundle.toString("utf8").includes(marker),
);
- const isolatedRoot = await mkdtemp(path.join(tmpdir(), "memhub-package-matrix-"));
+ const isolatedRoot = await mkdtemp(
+ path.join(tmpdir(), "memhub-package-matrix-"),
+ );
const home = path.join(isolatedRoot, "home");
const dataDir = path.join(isolatedRoot, "data");
const hostHome = path.join(isolatedRoot, "host-home");
@@ -343,7 +407,10 @@ async function runStoppedDestructive(node, cli, environment) {
`${probe.name} exit ${result.code}, expected 3 while Runtime is stopped`,
);
}
- if (document?.state !== "unknown" || document?.code !== "runtime_not_running") {
+ if (
+ document?.state !== "unknown" ||
+ document?.code !== "runtime_not_running"
+ ) {
failures.push(
`${probe.name} did not fail closed with unknown/runtime_not_running`,
);
@@ -451,8 +518,7 @@ async function main() {
}
const asJson = rest.includes("--json");
const expectShaIndex = rest.indexOf("--expect-sha");
- const expectSha =
- expectShaIndex >= 0 ? rest[expectShaIndex + 1] : undefined;
+ const expectSha = expectShaIndex >= 0 ? rest[expectShaIndex + 1] : undefined;
if (expectSha !== undefined && !/^[0-9a-fA-F]{64}$/.test(expectSha)) {
process.stderr.write("--expect-sha must be a 64-character SHA-256\n");
process.exitCode = 2;
diff --git a/memhub/apps/cli/src/backup-restore.test.ts b/memhub/apps/cli/src/backup-restore.test.ts
index 6117c78..5eb2bda 100644
--- a/memhub/apps/cli/src/backup-restore.test.ts
+++ b/memhub/apps/cli/src/backup-restore.test.ts
@@ -30,12 +30,16 @@ describe("managed restore over HTTP", { timeout: 15_000 }, () => {
}
if (request.headers.authorization === "Bearer r409") {
response.statusCode = 409;
- response.end(JSON.stringify({ detail: "backup_restore_runtime_running" }));
+ response.end(
+ JSON.stringify({ detail: "backup_restore_runtime_running" }),
+ );
return;
}
if (request.headers.authorization === "Bearer r422") {
response.statusCode = 422;
- response.end(JSON.stringify({ detail: "backup_restore_source_outside_home" }));
+ response.end(
+ JSON.stringify({ detail: "backup_restore_source_outside_home" }),
+ );
return;
}
response.end(
@@ -48,9 +52,12 @@ describe("managed restore over HTTP", { timeout: 15_000 }, () => {
}),
);
});
- await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
+ await new Promise<void>((resolve) =>
+ server.listen(0, "127.0.0.1", resolve),
+ );
const address = server.address();
- if (address === null || typeof address === "string") throw new Error("no port");
+ if (address === null || typeof address === "string")
+ throw new Error("no port");
port = address.port;
});
@@ -137,8 +144,18 @@ describe("maintenance Core identity", { timeout: 15_000 }, () => {
it("rejects a squatter, wrong service, wrong instance, and non-200", async () => {
const cases = [
- { status: 200, data: { status: "ok", service: "other", instance_id: "x" } },
- { status: 200, data: { status: "ok", service: "one-memory-core", instance_id: "wrong" } },
+ {
+ status: 200,
+ data: { status: "ok", service: "other", instance_id: "x" },
+ },
+ {
+ status: 200,
+ data: {
+ status: "ok",
+ service: "one-memory-core",
+ instance_id: "wrong",
+ },
+ },
{ status: 503, data: {} },
{ status: 200, data: null },
];
diff --git a/memhub/apps/cli/src/backup-restore.ts b/memhub/apps/cli/src/backup-restore.ts
index afe656e..f43dc3b 100644
--- a/memhub/apps/cli/src/backup-restore.ts
+++ b/memhub/apps/cli/src/backup-restore.ts
@@ -91,7 +91,8 @@ export async function callRestore(
source: string,
request: typeof defaultPost = defaultPost,
): Promise<
- { state: "restored"; result: RestoreResult } | { state: "rejected"; code: string }
+ | { state: "restored"; result: RestoreResult }
+ | { state: "rejected"; code: string }
> {
const response = await request(
`http://${options.host}:${options.port}/api/v1/backup/restore`,
diff --git a/memhub/apps/cli/src/batch-import-flow.test.ts b/memhub/apps/cli/src/batch-import-flow.test.ts
index 21c070e..bdbde89 100644
--- a/memhub/apps/cli/src/batch-import-flow.test.ts
+++ b/memhub/apps/cli/src/batch-import-flow.test.ts
@@ -1,19 +1,21 @@
import { describe, expect, it, vi } from "vitest";
-
-import type { CoreReader, ReadOutcome } from "./core-client.js";
-import type { CoreOperations } from "./core-operations.js";
import {
batchScanExitCode,
executeBatchImport,
planBatchImport,
renderBatchScanText,
} from "./batch-import-flow.js";
+import type { CoreReader, ReadOutcome } from "./core-client.js";
+import type { CoreOperations } from "./core-operations.js";
function readerFor(catalog: unknown): CoreReader {
return (async (path: string) =>
path === "/api/v1/sources"
? ({ state: "ok", data: catalog } as ReadOutcome<unknown>)
- : ({ state: "not_found", code: "http_404" } as ReadOutcome<unknown>)) as CoreReader;
+ : ({
+ state: "not_found",
+ code: "http_404",
+ } as ReadOutcome<unknown>)) as CoreReader;
}
function found(source_id: string, extra: Record<string, unknown> = {}) {
@@ -81,18 +83,36 @@ describe("A19 batch execution", () => {
readerFor([found("codex"), found("cursor")]),
);
if (planned.state !== "preview") throw new Error("expected preview");
- const post = vi.fn(async (_path: string, body: Record<string, unknown>) => ({
- state: "committed" as const,
- data: {
- request_id: body.request_id,
- accepted_source_ids: ["codex", "cursor"],
- failed_sources: {},
- jobs: [
- { job_id: "j1", source_id: "codex", status: "pending", discovered: 3, stored: 3, errors: 0, operation: "history" },
- { job_id: "j2", source_id: "cursor", status: "pending", discovered: 5, stored: 5, errors: 0, operation: "history" },
- ],
- },
- }));
+ const post = vi.fn(
+ async (_path: string, body: Record<string, unknown>) => ({
+ state: "committed" as const,
+ data: {
+ request_id: body.request_id,
+ accepted_source_ids: ["codex", "cursor"],
+ failed_sources: {},
+ jobs: [
+ {
+ job_id: "j1",
+ source_id: "codex",
+ status: "pending",
+ discovered: 3,
+ stored: 3,
+ errors: 0,
+ operation: "history",
+ },
+ {
+ job_id: "j2",
+ source_id: "cursor",
+ status: "pending",
+ discovered: 5,
+ stored: 5,
+ errors: 0,
+ operation: "history",
+ },
+ ],
+ },
+ }),
+ );
const operations = { post } as unknown as CoreOperations;
const document = await executeBatchImport(
planned.candidates,
@@ -127,7 +147,15 @@ describe("A19 batch execution", () => {
accepted_source_ids: ["codex"],
failed_sources: { cursor: "source_identity_changed" },
jobs: [
- { job_id: "j1", source_id: "codex", status: "pending", discovered: 1, stored: 1, errors: 0, operation: "history" },
+ {
+ job_id: "j1",
+ source_id: "codex",
+ status: "pending",
+ discovered: 1,
+ stored: 1,
+ errors: 0,
+ operation: "history",
+ },
],
},
})),
@@ -242,7 +270,15 @@ describe("A19 batch execution", () => {
accepted_source_ids: ["codex"],
failed_sources: {},
jobs: [
- { job_id: "j1", source_id: "codex", status: "pending", discovered: 1, stored: 1, errors: 0, operation: "history" },
+ {
+ job_id: "j1",
+ source_id: "codex",
+ status: "pending",
+ discovered: 1,
+ stored: 1,
+ errors: 0,
+ operation: "history",
+ },
],
},
})),
diff --git a/memhub/apps/cli/src/batch-import-flow.ts b/memhub/apps/cli/src/batch-import-flow.ts
index d534f74..97205ed 100644
--- a/memhub/apps/cli/src/batch-import-flow.ts
+++ b/memhub/apps/cli/src/batch-import-flow.ts
@@ -14,15 +14,14 @@
*/
import { randomUUID } from "node:crypto";
-import { buildSourceImportRequest } from "@one-memory/operations";
-
import type { ImportJob } from "@one-memory/contracts";
+import { buildSourceImportRequest } from "@one-memory/operations";
+import type { CoreReader } from "./core-client.js";
+import type { CoreOperations } from "./core-operations.js";
import {
type SourceConnectionCandidate,
validateSourceConnectionCandidates,
} from "./core-responses.js";
-import type { CoreReader } from "./core-client.js";
-import type { CoreOperations } from "./core-operations.js";
import { PRODUCT } from "./version.js";
export interface BatchSourceRow {
@@ -57,19 +56,34 @@ export function detectedSourceIds(
return candidates.map((candidate) => candidate.source_id);
}
-export async function planBatchImport(
- reader: CoreReader,
-): Promise<
- | { state: "preview"; candidates: SourceConnectionCandidate[]; rows: BatchSourceRow[]; notFound: string[] }
- | { state: "rejected" | "unknown" | "no_sources"; code: string; notFound: string[] }
+export async function planBatchImport(reader: CoreReader): Promise<
+ | {
+ state: "preview";
+ candidates: SourceConnectionCandidate[];
+ rows: BatchSourceRow[];
+ notFound: string[];
+ }
+ | {
+ state: "rejected" | "unknown" | "no_sources";
+ code: string;
+ notFound: string[];
+ }
> {
const outcome = await reader<unknown>("/api/v1/sources");
if (outcome.state !== "ok") {
- return { state: outcome.state === "unavailable" ? "unknown" : "rejected", code: outcome.code, notFound: [] };
+ return {
+ state: outcome.state === "unavailable" ? "unknown" : "rejected",
+ code: outcome.code,
+ notFound: [],
+ };
}
const catalog = outcome.data;
if (!Array.isArray(catalog) || catalog.length > SOURCE_LIST_LIMIT) {
- return { state: "rejected", code: "sources_response_invalid", notFound: [] };
+ return {
+ state: "rejected",
+ code: "sources_response_invalid",
+ notFound: [],
+ };
}
const candidates = validateSourceConnectionCandidates(catalog);
if (!candidates) {
@@ -165,9 +179,7 @@ export async function executeBatchImport(
receipt.failed_sources && typeof receipt.failed_sources === "object"
? (receipt.failed_sources as Record<string, string>)
: {};
- const jobs = Array.isArray(receipt.jobs)
- ? (receipt.jobs as ImportJob[])
- : [];
+ const jobs = Array.isArray(receipt.jobs) ? (receipt.jobs as ImportJob[]) : [];
const firstSeen = jobs.map((job) => ({
source_id: job.source_id,
discovered: job.discovered,
@@ -262,7 +274,8 @@ export async function executeBatchImport(
}
export function batchScanExitCode(document: BatchScanDocument): number {
- if (document.state === "committed" || document.state === "no_sources") return 0;
+ if (document.state === "committed" || document.state === "no_sources")
+ return 0;
if (document.state === "partial") return 1;
return 1;
}
diff --git a/memhub/apps/cli/src/command-catalog.ts b/memhub/apps/cli/src/command-catalog.ts
index 5ab2cc4..57827e3 100644
--- a/memhub/apps/cli/src/command-catalog.ts
+++ b/memhub/apps/cli/src/command-catalog.ts
@@ -282,11 +282,7 @@ export const COMMANDS: readonly CommandDescriptor[] = [
summary: "列出来源、执行已确认的导入计划。",
usage:
"memhub sources list [--json]\n memhub sources import --plan-file <path> --confirm [--json]\n memhub sources receipt <request-id> [--json]",
- options: [
- PLAN_FILE_OPTION,
- EXPLICIT_CONFIRM_OPTION,
- JSON_OPTION,
- ],
+ options: [PLAN_FILE_OPTION, EXPLICIT_CONFIRM_OPTION, JSON_OPTION],
exit_codes: [EXIT_OK, EXIT_FAILED, EXIT_USAGE, EXIT_RUNTIME_STOPPED],
},
{
diff --git a/memhub/apps/cli/src/command-contract.test.ts b/memhub/apps/cli/src/command-contract.test.ts
index 39157c9..2c49b7e 100644
--- a/memhub/apps/cli/src/command-contract.test.ts
+++ b/memhub/apps/cli/src/command-contract.test.ts
@@ -300,11 +300,7 @@ describe("CLI-22 shared output contract", () => {
`${PRODUCT} sync`,
],
[
- [
- "sync",
- "receipt",
- "123e4567-e89b-12d3-a456-426614174000",
- ],
+ ["sync", "receipt", "123e4567-e89b-12d3-a456-426614174000"],
`${PRODUCT} sync`,
],
[["sync", "pause", "--source"], `${PRODUCT} sync`],
@@ -555,12 +551,7 @@ describe("documented commands", () => {
// Source processing is one Freeze/Thaw switch under `sync`; the obsolete
// independent read/write `sources access` command must not return here.
sources: ["list", "import", "receipt"],
- jobs: [
- "list",
- "show",
- "start",
- "<pause|resume|cancel>",
- ],
+ jobs: ["list", "show", "start", "<pause|resume|cancel>"],
// `sync <pause|resume>` is documented as one alternation, so it is
// checked as an entry rather than as two literal subcommands.
sync: ["status", "<pause|resume>"],
diff --git a/memhub/apps/cli/src/context-search.test.ts b/memhub/apps/cli/src/context-search.test.ts
index bd31d49..3e7a30f 100644
--- a/memhub/apps/cli/src/context-search.test.ts
+++ b/memhub/apps/cli/src/context-search.test.ts
@@ -342,17 +342,20 @@ describe("unified context search", () => {
["--limit", "1", "2"],
["--character-budget", "200", "300"],
["--timeout-ms", "100", "200"],
- ])("rejects a repeated %s before Runtime attach", async (flag, first, second) => {
- const streams = captureStreams();
- try {
- expect(
- await run(["recall", "q", flag, first, flag, second, "--json"], {}),
- ).toBe(2);
- } finally {
- streams.restore();
- }
- expect(streams.stdout()).toBe("");
- });
+ ])(
+ "rejects a repeated %s before Runtime attach",
+ async (flag, first, second) => {
+ const streams = captureStreams();
+ try {
+ expect(
+ await run(["recall", "q", flag, first, flag, second, "--json"], {}),
+ ).toBe(2);
+ } finally {
+ streams.restore();
+ }
+ expect(streams.stdout()).toBe("");
+ },
+ );
it("refuses malformed success bodies instead of leaking nested values", async () => {
transport.post.mockResolvedValue({
diff --git a/memhub/apps/cli/src/core-client.ts b/memhub/apps/cli/src/core-client.ts
index 83ff656..8fdcc46 100644
--- a/memhub/apps/cli/src/core-client.ts
+++ b/memhub/apps/cli/src/core-client.ts
@@ -1,5 +1,5 @@
-import axios from "axios";
import { classifyModelRemove } from "@one-memory/operations";
+import axios from "axios";
/**
* Only paths proven side-effect free by reading the Core handlers belong here.
@@ -56,7 +56,10 @@ export function createUiSessionRequest(attachment: {
return { state: "ok" as const, data: response.data };
}
if (response.status === 503) {
- return { state: "unavailable" as const, code: "ui_web_assets_unavailable" };
+ return {
+ state: "unavailable" as const,
+ code: "ui_web_assets_unavailable",
+ };
}
return { state: "unavailable" as const, code: `http_${response.status}` };
};
@@ -397,18 +400,23 @@ export async function readMemoryWrite(
export async function readScanRoots(
attachment: RuntimeAttachmentLike,
-): Promise<{ schema_version: number; revision: number; roots: unknown[] } | null> {
+): Promise<{
+ schema_version: number;
+ revision: number;
+ roots: unknown[];
+} | null> {
try {
- const response = await axios.get<{ schema_version: number; revision: number; roots: unknown[] }>(
- `${baseUrlOf(attachment)}/api/v1/scan-roots`,
- {
- headers: { Authorization: `Bearer ${attachment.apiToken}` },
- timeout: 10_000,
- proxy: false,
- maxRedirects: 0,
- maxContentLength: MAX_RESPONSE_BYTES,
- },
- );
+ const response = await axios.get<{
+ schema_version: number;
+ revision: number;
+ roots: unknown[];
+ }>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, {
+ headers: { Authorization: `Bearer ${attachment.apiToken}` },
+ timeout: 10_000,
+ proxy: false,
+ maxRedirects: 0,
+ maxContentLength: MAX_RESPONSE_BYTES,
+ });
return response.data;
} catch {
return null;
@@ -420,13 +428,17 @@ export async function addScanRoot(
body: { root: string; source?: string; recursive?: boolean },
): Promise<unknown | null> {
try {
- const response = await axios.post<unknown>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, body, {
- headers: { Authorization: `Bearer ${attachment.apiToken}` },
- timeout: 10_000,
- proxy: false,
- maxRedirects: 0,
- maxContentLength: MAX_RESPONSE_BYTES,
- });
+ const response = await axios.post<unknown>(
+ `${baseUrlOf(attachment)}/api/v1/scan-roots`,
+ body,
+ {
+ headers: { Authorization: `Bearer ${attachment.apiToken}` },
+ timeout: 10_000,
+ proxy: false,
+ maxRedirects: 0,
+ maxContentLength: MAX_RESPONSE_BYTES,
+ },
+ );
return response.data;
} catch (error) {
return { _error: error instanceof Error ? error.message : String(error) };
@@ -438,14 +450,17 @@ export async function removeScanRoot(
body: { root: string },
): Promise<unknown | null> {
try {
- const response = await axios.delete<unknown>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, {
- headers: { Authorization: `Bearer ${attachment.apiToken}` },
- data: body,
- timeout: 10_000,
- proxy: false,
- maxRedirects: 0,
- maxContentLength: MAX_RESPONSE_BYTES,
- });
+ const response = await axios.delete<unknown>(
+ `${baseUrlOf(attachment)}/api/v1/scan-roots`,
+ {
+ headers: { Authorization: `Bearer ${attachment.apiToken}` },
+ data: body,
+ timeout: 10_000,
+ proxy: false,
+ maxRedirects: 0,
+ maxContentLength: MAX_RESPONSE_BYTES,
+ },
+ );
return response.data;
} catch (error) {
return { _error: error instanceof Error ? error.message : String(error) };
@@ -456,16 +471,16 @@ export async function readAdapters(
attachment: RuntimeAttachmentLike,
): Promise<{ schema_version: number; adapters: unknown[] } | null> {
try {
- const response = await axios.get<{ schema_version: number; adapters: unknown[] }>(
- `${baseUrlOf(attachment)}/api/v1/adapters`,
- {
- headers: { Authorization: `Bearer ${attachment.apiToken}` },
- timeout: 10_000,
- proxy: false,
- maxRedirects: 0,
- maxContentLength: MAX_RESPONSE_BYTES,
- },
- );
+ const response = await axios.get<{
+ schema_version: number;
+ adapters: unknown[];
+ }>(`${baseUrlOf(attachment)}/api/v1/adapters`, {
+ headers: { Authorization: `Bearer ${attachment.apiToken}` },
+ timeout: 10_000,
+ proxy: false,
+ maxRedirects: 0,
+ maxContentLength: MAX_RESPONSE_BYTES,
+ });
return response.data;
} catch {
return null;
diff --git a/memhub/apps/cli/src/data-deletion.test.ts b/memhub/apps/cli/src/data-deletion.test.ts
index 44ce4ad..8954706 100644
--- a/memhub/apps/cli/src/data-deletion.test.ts
+++ b/memhub/apps/cli/src/data-deletion.test.ts
@@ -1,4 +1,4 @@
-import { mkdtemp, mkdir, readFile, stat, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, readFile, stat, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
@@ -23,14 +23,22 @@ describe("explicit data deletion", () => {
"one-memory.sqlite3": "db",
"runtime-service.json": "{}",
});
- const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
+ const plan = await planDataDeletion({
+ dataDir,
+ home,
+ runtimeRunning: false,
+ });
expect(plan.state).toBe("preview");
expect(plan.entries).toContain(path.join(dataDir, "one-memory.sqlite3"));
});
it("refuses while the Runtime is still running", async () => {
const { home, dataDir } = await homeWith();
- const plan = await planDataDeletion({ dataDir, home, runtimeRunning: true });
+ const plan = await planDataDeletion({
+ dataDir,
+ home,
+ runtimeRunning: true,
+ });
expect(plan).toMatchObject({
state: "blocked",
code: "runtime_still_running",
@@ -66,16 +74,23 @@ describe("explicit data deletion", () => {
home,
runtimeRunning: false,
});
- expect(plan).toMatchObject({ state: "blocked", code: "data_dir_refused" });
+ expect(plan).toMatchObject({
+ state: "blocked",
+ code: "data_dir_refused",
+ });
}
});
it("requires the second confirmation to name the exact directory", async () => {
const { home, dataDir } = await homeWith();
- const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
- await expect(applyDataDeletion(plan, path.join(home, "other"))).rejects.toThrow(
- "data_deletion_confirmation_mismatch",
- );
+ const plan = await planDataDeletion({
+ dataDir,
+ home,
+ runtimeRunning: false,
+ });
+ await expect(
+ applyDataDeletion(plan, path.join(home, "other")),
+ ).rejects.toThrow("data_deletion_confirmation_mismatch");
// The data survived a mismatched confirmation.
await expect(
stat(path.join(dataDir, "one-memory.sqlite3")),
@@ -84,7 +99,11 @@ describe("explicit data deletion", () => {
it("deletes an owned Home only when both confirmations match", async () => {
const { home, dataDir } = await homeWith({ "one-memory.sqlite3": "db" });
- const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
+ const plan = await planDataDeletion({
+ dataDir,
+ home,
+ runtimeRunning: false,
+ });
const receipt = await applyDataDeletion(plan, dataDir);
expect(receipt.state).toBe("deleted");
await expect(stat(dataDir)).rejects.toMatchObject({ code: "ENOENT" });
diff --git a/memhub/apps/cli/src/doctor-report.ts b/memhub/apps/cli/src/doctor-report.ts
index 9601e73..c00f588 100644
--- a/memhub/apps/cli/src/doctor-report.ts
+++ b/memhub/apps/cli/src/doctor-report.ts
@@ -68,7 +68,8 @@ export function renderDoctorText(document: DoctorDocument): string {
return [
`MemHub 检查:${doctorState(document.state)}`,
...document.checks.map(
- (check) => `${symbol(check.state)} ${labels[check.id]}:${checkState(check.state)}`,
+ (check) =>
+ `${symbol(check.state)} ${labels[check.id]}:${checkState(check.state)}`,
),
...(document.state === "healthy"
? []
diff --git a/memhub/apps/cli/src/entry-diagnostics.ts b/memhub/apps/cli/src/entry-diagnostics.ts
index 6f3aab2..cf2a6b9 100644
--- a/memhub/apps/cli/src/entry-diagnostics.ts
+++ b/memhub/apps/cli/src/entry-diagnostics.ts
@@ -28,11 +28,7 @@ export function resolveEntryDiagnostics(input: {
// comparison would misread that as isolated and silently drop diagnostics.
const home = resolve(input.home);
const accountHome = resolve(input.accountHome);
- if (
- home === undefined ||
- accountHome === undefined ||
- home === accountHome
- ) {
+ if (home === undefined || accountHome === undefined || home === accountHome) {
return { kind: "log" };
}
// Isolated HOME with no explicit data dir: the fallback path would write
diff --git a/memhub/apps/cli/src/entry.ts b/memhub/apps/cli/src/entry.ts
index 5be618a..8c8309f 100644
--- a/memhub/apps/cli/src/entry.ts
+++ b/memhub/apps/cli/src/entry.ts
@@ -9,8 +9,8 @@ import {
resolveRuntimeCliConfig,
} from "@one-memory/runtime-control";
import { run } from "./cli.js";
-import { resolveDiagnosticsDataDir } from "./install-receipt.js";
import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
+import { resolveDiagnosticsDataDir } from "./install-receipt.js";
function accountHomeDirectory(): string | undefined {
try {
diff --git a/memhub/apps/cli/src/headless-flows.ts b/memhub/apps/cli/src/headless-flows.ts
index a2645e7..2ff1ebf 100644
--- a/memhub/apps/cli/src/headless-flows.ts
+++ b/memhub/apps/cli/src/headless-flows.ts
@@ -1,12 +1,12 @@
import { createHash, randomUUID } from "node:crypto";
+import type { ImportJob, ModelProfile } from "@one-memory/contracts";
import {
- ModelProfileInputError,
- SourceImportInputError,
buildModelProfileCreateRequest,
buildSourceImportRequest,
+ ModelProfileInputError,
parseModelProfileReceipt,
+ SourceImportInputError,
} from "@one-memory/operations";
-import type { ImportJob, ModelProfile } from "@one-memory/contracts";
import type { CoreReader, ReadOutcome } from "./core-client.js";
import type { CoreOperations } from "./core-operations.js";
import {
@@ -117,9 +117,7 @@ function classifySourceImport(
product: PRODUCT,
state: "rejected",
operation_id: operationId,
- code: onlyBusy
- ? "source_import_all_busy"
- : "source_import_all_rejected",
+ code: onlyBusy ? "source_import_all_busy" : "source_import_all_rejected",
receipt,
};
}
diff --git a/memhub/apps/cli/src/host-flow.ts b/memhub/apps/cli/src/host-flow.ts
index 8e8156d..52fed9e 100644
--- a/memhub/apps/cli/src/host-flow.ts
+++ b/memhub/apps/cli/src/host-flow.ts
@@ -266,7 +266,9 @@ export function renderHostText(document: HostFlowDocument): string {
}
if (review.length > 12) lines.push(` … 另有 ${review.length - 12} 处`);
lines.push("");
- lines.push("这些不是我们安装的内容,卸载不会替你删除;需自行处理后才能卸载。");
+ lines.push(
+ "这些不是我们安装的内容,卸载不会替你删除;需自行处理后才能卸载。",
+ );
}
}
return `${lines.join("\n")}\n`;
diff --git a/memhub/apps/cli/src/init-wizard.test.ts b/memhub/apps/cli/src/init-wizard.test.ts
index a95cced..3ba8978 100644
--- a/memhub/apps/cli/src/init-wizard.test.ts
+++ b/memhub/apps/cli/src/init-wizard.test.ts
@@ -7,7 +7,9 @@ import {
type WizardPrompter,
} from "./init-wizard.js";
-function scripted(lines: string[]): WizardPrompter & { asked: string[]; wrote: string[] } {
+function scripted(
+ lines: string[],
+): WizardPrompter & { asked: string[]; wrote: string[] } {
let index = 0;
const asked: string[] = [];
const wrote: string[] = [];
diff --git a/memhub/apps/cli/src/init-wizard.ts b/memhub/apps/cli/src/init-wizard.ts
index 8385e6d..81a1811 100644
--- a/memhub/apps/cli/src/init-wizard.ts
+++ b/memhub/apps/cli/src/init-wizard.ts
@@ -99,8 +99,7 @@ export async function runInitWizard(
"开启处理?开启后会处理历史未完成会话并持续接收新会话;输入 n 保持冻结。[Y/n]: ",
);
const processing = parseYesNo(processingAnswer, true);
- if (processing === null)
- return { state: "invalid", code: "invalid_answer" };
+ if (processing === null) return { state: "invalid", code: "invalid_answer" };
return {
state: "answered",
diff --git a/memhub/apps/cli/src/install-receipt.test.ts b/memhub/apps/cli/src/install-receipt.test.ts
index d1a5552..e8da3f5 100644
--- a/memhub/apps/cli/src/install-receipt.test.ts
+++ b/memhub/apps/cli/src/install-receipt.test.ts
@@ -1,15 +1,15 @@
import {
mkdir,
mkdtemp,
- readFile,
readdir,
+ readFile,
rm,
writeFile,
} from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
-
+import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
import {
defaultInstallReceiptPath,
readInstallReceipt,
@@ -18,7 +18,6 @@ import {
resolveInstalledDataDir,
writeInstallReceipt,
} from "./install-receipt.js";
-import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
async function root(): Promise<string> {
return mkdtemp(path.join(tmpdir(), "memhub-install-receipt-"));
@@ -230,9 +229,9 @@ describe("managed install receipt", () => {
}),
).toBe("/tmp/env data");
// Receipt beats default.
- expect(
- await resolveDiagnosticsDataDir(["install"], { HOME: home }),
- ).toBe(path.join(home, "receipt data"));
+ expect(await resolveDiagnosticsDataDir(["install"], { HOME: home })).toBe(
+ path.join(home, "receipt data"),
+ );
// Invalid explicit flag must not silently fall back to the receipt.
expect(
await resolveDiagnosticsDataDir(
diff --git a/memhub/apps/cli/src/interactive-model-setup.test.ts b/memhub/apps/cli/src/interactive-model-setup.test.ts
index 1ddfc9f..4c6d6bf 100644
--- a/memhub/apps/cli/src/interactive-model-setup.test.ts
+++ b/memhub/apps/cli/src/interactive-model-setup.test.ts
@@ -184,10 +184,9 @@ describe("interactive model setup", () => {
embedding_provider_kind: "local_onnx",
}),
);
- expect(api.post).toHaveBeenCalledWith(
- "/api/v1/model-content-permission",
- { allowed: true },
- );
+ expect(api.post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
+ allowed: true,
+ });
expect(prompt.written.join("\n")).not.toContain("sk-do-not-print");
});
diff --git a/memhub/apps/cli/src/interactive-model-setup.ts b/memhub/apps/cli/src/interactive-model-setup.ts
index cfc2b92..d831bc8 100644
--- a/memhub/apps/cli/src/interactive-model-setup.ts
+++ b/memhub/apps/cli/src/interactive-model-setup.ts
@@ -11,12 +11,12 @@ import {
} from "./headless-flows.js";
import { approvalFingerprint, listHosts, readHost } from "./host-flow.js";
import { parseSelection, type WizardPrompter } from "./init-wizard.js";
+import { setModelContentPermission } from "./model-content-permission-flow.js";
import { executeModelProbe, planModelProbe } from "./model-probe-flow.js";
import {
executeModelProfileActivate,
planModelProfileActivate,
} from "./model-write-flows.js";
-import { setModelContentPermission } from "./model-content-permission-flow.js";
type ProviderPreset = {
id: string;
diff --git a/memhub/apps/cli/src/job-flow.test.ts b/memhub/apps/cli/src/job-flow.test.ts
index 3335466..15fdbb7 100644
--- a/memhub/apps/cli/src/job-flow.test.ts
+++ b/memhub/apps/cli/src/job-flow.test.ts
@@ -17,6 +17,7 @@ vi.mock("axios", () => ({
default: { create: vi.fn(() => transport), get: vi.fn() },
}));
+import type { CoreOperations } from "./core-operations.js";
import { createCoreOperations } from "./core-operations.js";
import {
executeJobAction,
@@ -25,7 +26,6 @@ import {
planJobAction,
planJobStart,
} from "./job-flow.js";
-import type { CoreOperations } from "./core-operations.js";
function operations(
post: (path: string, body: Record<string, unknown>) => Promise<unknown>,
diff --git a/memhub/apps/cli/src/job-flow.ts b/memhub/apps/cli/src/job-flow.ts
index 693b56d..d4f3e8f 100644
--- a/memhub/apps/cli/src/job-flow.ts
+++ b/memhub/apps/cli/src/job-flow.ts
@@ -145,9 +145,7 @@ function jobMutationResult(
export function jobExitCode(document: JobFlowDocument): number {
if (document.state === "preview" || document.state === "committed") return 0;
if (document.state === "recovered") return 0;
- return document.state === "rejected" || document.state === "unknown"
- ? 1
- : 2;
+ return document.state === "rejected" || document.state === "unknown" ? 1 : 2;
}
function invalid(code: string): JobFlowDocument {
diff --git a/memhub/apps/cli/src/jobs-command.test.ts b/memhub/apps/cli/src/jobs-command.test.ts
index 5b3f693..6a67865 100644
--- a/memhub/apps/cli/src/jobs-command.test.ts
+++ b/memhub/apps/cli/src/jobs-command.test.ts
@@ -105,10 +105,7 @@ describe("memhub jobs", () => {
const output = captureStdout();
let code: number;
try {
- code = await run(
- ["jobs", "start", "--source", "codex", "--json"],
- {},
- );
+ code = await run(["jobs", "start", "--source", "codex", "--json"], {});
} finally {
output.restore();
}
@@ -154,10 +151,7 @@ describe("memhub jobs", () => {
const output = captureStdout();
let code: number;
try {
- code = await run(
- ["jobs", action, "--job", "job-1", "--json"],
- {},
- );
+ code = await run(["jobs", action, "--job", "job-1", "--json"], {});
} finally {
output.restore();
}
diff --git a/memhub/apps/cli/src/log-report.ts b/memhub/apps/cli/src/log-report.ts
index 5ba7456..0e5fbe8 100644
--- a/memhub/apps/cli/src/log-report.ts
+++ b/memhub/apps/cli/src/log-report.ts
@@ -1,7 +1,10 @@
-import type { DiagnosticEventV1 } from "@one-memory/runtime-control";
-import { diagnosticLogFiles, readDiagnosticEvents } from "@one-memory/runtime-control";
import { lstat } from "node:fs/promises";
import path from "node:path";
+import type { DiagnosticEventV1 } from "@one-memory/runtime-control";
+import {
+ diagnosticLogFiles,
+ readDiagnosticEvents,
+} from "@one-memory/runtime-control";
export interface LogQuery {
since?: Date;
@@ -160,10 +163,21 @@ export async function readLogReport(
const logsDirectory = path.join(path.resolve(dataDir), "logs");
const info = await lstat(logsDirectory).catch(() => null);
if (info !== null && (!info.isDirectory() || info.isSymbolicLink())) {
- return { events: [], invalid_lines: 0, failure: "log_directory_unreadable" };
+ return {
+ events: [],
+ invalid_lines: 0,
+ failure: "log_directory_unreadable",
+ };
}
- if (info !== null && (await diagnosticLogFiles(dataDir).catch(() => null)) === null) {
- return { events: [], invalid_lines: 0, failure: "log_directory_unreadable" };
+ if (
+ info !== null &&
+ (await diagnosticLogFiles(dataDir).catch(() => null)) === null
+ ) {
+ return {
+ events: [],
+ invalid_lines: 0,
+ failure: "log_directory_unreadable",
+ };
}
const explicit =
query.since ||
@@ -239,15 +253,27 @@ export function redactDiagnosticEvent(
outcome: event.outcome,
session_id: event.session_id,
...(event.trace_id === undefined ? {} : { trace_id: event.trace_id }),
- ...(event.incident_id === undefined ? {} : { incident_id: event.incident_id }),
- ...(event.instance_id === undefined ? {} : { instance_id: event.instance_id }),
- ...(event.operation_id === undefined ? {} : { operation_id: event.operation_id }),
+ ...(event.incident_id === undefined
+ ? {}
+ : { incident_id: event.incident_id }),
+ ...(event.instance_id === undefined
+ ? {}
+ : { instance_id: event.instance_id }),
+ ...(event.operation_id === undefined
+ ? {}
+ : { operation_id: event.operation_id }),
...(event.request_id === undefined ? {} : { request_id: event.request_id }),
...(event.job_id === undefined ? {} : { job_id: event.job_id }),
...(event.task_id === undefined ? {} : { task_id: event.task_id }),
- ...(event.duration_ms === undefined ? {} : { duration_ms: event.duration_ms }),
- ...(event.state_before === undefined ? {} : { state_before: event.state_before }),
- ...(event.state_after === undefined ? {} : { state_after: event.state_after }),
+ ...(event.duration_ms === undefined
+ ? {}
+ : { duration_ms: event.duration_ms }),
+ ...(event.state_before === undefined
+ ? {}
+ : { state_before: event.state_before }),
+ ...(event.state_after === undefined
+ ? {}
+ : { state_after: event.state_after }),
...(event.error_code === undefined ? {} : { error_code: event.error_code }),
...(event.error_type === undefined ? {} : { error_type: event.error_type }),
...(event.safe_stack === undefined
diff --git a/memhub/apps/cli/src/managed-cli-link.test.ts b/memhub/apps/cli/src/managed-cli-link.test.ts
index 72d4cee..3a69083 100644
--- a/memhub/apps/cli/src/managed-cli-link.test.ts
+++ b/memhub/apps/cli/src/managed-cli-link.test.ts
@@ -11,9 +11,8 @@ import {
} from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
-import { describe, expect, it } from "vitest";
-
import type { CliLinkPlan } from "@one-memory/runtime-control";
+import { describe, expect, it } from "vitest";
import {
installManagedCliAlias,
installManagedCliLink,
@@ -107,7 +106,9 @@ describe("managed memhub CLI alias", () => {
await installManagedCliAlias(plan);
await expect(removeManagedCliAlias(plan)).resolves.toBe("removed");
- await expect(lstat(plan.link_path)).rejects.toMatchObject({ code: "ENOENT" });
+ await expect(lstat(plan.link_path)).rejects.toMatchObject({
+ code: "ENOENT",
+ });
});
// C8 P1 (2026-09-29): `runtime-control.applyLocalUninstall` deletes
@@ -156,7 +157,10 @@ describe("managed memhub CLI alias", () => {
it("manages the one-memory companion when memhub is already present", async () => {
if (process.platform === "win32") return;
const f = await fixture();
- const primary = { ...f.base, link_path: path.join(f.base.bin_directory, "memhub") };
+ const primary = {
+ ...f.base,
+ link_path: path.join(f.base.bin_directory, "memhub"),
+ };
await mkdir(f.base.bin_directory, { recursive: true, mode: 0o700 });
await (await import("node:fs/promises")).chmod(f.base.bin_directory, 0o700);
await (await import("node:fs/promises")).symlink(
@@ -168,7 +172,10 @@ describe("managed memhub CLI alias", () => {
const plan = await planManagedCliLink(f.base, "one-memory");
// The companion does not exist yet, so it is ours to create; crucially it
// targets the compat name, not the package's `memhub`.
- expect(plan).toMatchObject({ status: "create", link_path: f.base.link_path });
+ expect(plan).toMatchObject({
+ status: "create",
+ link_path: f.base.link_path,
+ });
// The package's memhub link is untouched.
expect(await readlink(primary.link_path)).toBe(f.target);
diff --git a/memhub/apps/cli/src/managed-cli-link.ts b/memhub/apps/cli/src/managed-cli-link.ts
index 3661a82..7654d1a 100644
--- a/memhub/apps/cli/src/managed-cli-link.ts
+++ b/memhub/apps/cli/src/managed-cli-link.ts
@@ -1,4 +1,12 @@
-import { access, chmod, lstat, mkdir, readlink, rm, symlink } from "node:fs/promises";
+import {
+ access,
+ chmod,
+ lstat,
+ mkdir,
+ readlink,
+ rm,
+ symlink,
+} from "node:fs/promises";
import path from "node:path";
import type { CliLinkPlan, CliLinkReceipt } from "@one-memory/runtime-control";
diff --git a/memhub/apps/cli/src/model-content-permission-cli.test.ts b/memhub/apps/cli/src/model-content-permission-cli.test.ts
index 3a2320a..69a1196 100644
--- a/memhub/apps/cli/src/model-content-permission-cli.test.ts
+++ b/memhub/apps/cli/src/model-content-permission-cli.test.ts
@@ -53,7 +53,9 @@ describe("model content permission CLI", () => {
expect(permission.code).toBe(0);
expect(permission.stdout).toContain("memhub permission allow");
expect(permission.stdout).toContain("memhub permission deny");
- expect(permission.stdout).not.toMatch(/\b(preview|confirm|process|revoke)\b/);
+ expect(permission.stdout).not.toMatch(
+ /\b(preview|confirm|process|revoke)\b/,
+ );
expect(permission.stdout).not.toContain("revision");
expect(permission.stdout).not.toContain("receipt");
diff --git a/memhub/apps/cli/src/model-content-permission-flow.test.ts b/memhub/apps/cli/src/model-content-permission-flow.test.ts
index 6365f34..458e792 100644
--- a/memhub/apps/cli/src/model-content-permission-flow.test.ts
+++ b/memhub/apps/cli/src/model-content-permission-flow.test.ts
@@ -23,19 +23,22 @@ describe("model content permission flow", () => {
it.each([
["allow", true],
["deny", false],
- ] as const)("sets %s directly without revision or receipt fields", async (_, allowed) => {
- const post = vi.fn().mockResolvedValue({
- state: "committed",
- data: { allowed },
- });
+ ] as const)(
+ "sets %s directly without revision or receipt fields",
+ async (_, allowed) => {
+ const post = vi.fn().mockResolvedValue({
+ state: "committed",
+ data: { allowed },
+ });
- await expect(
- setModelContentPermission({ post } as CoreOperations, allowed),
- ).resolves.toMatchObject({ state: "ok", allowed });
- expect(post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
- allowed,
- });
- });
+ await expect(
+ setModelContentPermission({ post } as CoreOperations, allowed),
+ ).resolves.toMatchObject({ state: "ok", allowed });
+ expect(post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
+ allowed,
+ });
+ },
+ );
it("does not accept a malformed or mismatched success response", async () => {
const malformed = vi.fn().mockResolvedValue({
diff --git a/memhub/apps/cli/src/model-content-permission-flow.ts b/memhub/apps/cli/src/model-content-permission-flow.ts
index 2910bc6..39a146e 100644
--- a/memhub/apps/cli/src/model-content-permission-flow.ts
+++ b/memhub/apps/cli/src/model-content-permission-flow.ts
@@ -23,7 +23,10 @@ export async function readModelContentPermission(
if (outcome.state !== "ok") {
return failure("unknown", outcome.code);
}
- return permissionState(outcome.data, "model_content_permission_response_invalid");
+ return permissionState(
+ outcome.data,
+ "model_content_permission_response_invalid",
+ );
}
export async function setModelContentPermission(
diff --git a/memhub/apps/cli/src/model-write-flows.ts b/memhub/apps/cli/src/model-write-flows.ts
index 0d91b9e..02e8e05 100644
--- a/memhub/apps/cli/src/model-write-flows.ts
+++ b/memhub/apps/cli/src/model-write-flows.ts
@@ -13,8 +13,8 @@
import { createHash, randomUUID } from "node:crypto";
import type { ModelProfile } from "@one-memory/contracts";
import {
- ModelProfileInputError,
buildModelProfileUpdateRequest,
+ ModelProfileInputError,
parseModelProfileReceipt,
} from "@one-memory/operations";
import type { CoreOperations, CorePatchOperations } from "./core-operations.js";
@@ -78,7 +78,10 @@ function digestOf(value: unknown): string {
function preview(
plan:
- | Omit<Extract<ModelWritePlan, { kind: "model_profile_activate" }>, "digest">
+ | Omit<
+ Extract<ModelWritePlan, { kind: "model_profile_activate" }>,
+ "digest"
+ >
| Omit<Extract<ModelWritePlan, { kind: "model_profile_edit" }>, "digest">,
): ModelWriteDocument {
return {
@@ -198,9 +201,9 @@ export async function executeModelProfileEdit(
let request: ReturnType<typeof buildModelProfileUpdateRequest>;
try {
request = buildModelProfileUpdateRequest(plan.profile_id, {
- ...plan.patch,
- expected_revision: plan.expected_revision,
- ...(apiKey === undefined ? {} : { api_key: apiKey }),
+ ...plan.patch,
+ expected_revision: plan.expected_revision,
+ ...(apiKey === undefined ? {} : { api_key: apiKey }),
});
} catch (error) {
if (error instanceof ModelProfileInputError) {
diff --git a/memhub/apps/cli/src/package-matrix.test.ts b/memhub/apps/cli/src/package-matrix.test.ts
index 60cd9a5..db76eba 100644
--- a/memhub/apps/cli/src/package-matrix.test.ts
+++ b/memhub/apps/cli/src/package-matrix.test.ts
@@ -1,7 +1,7 @@
import { execFile } from "node:child_process";
import { createHash } from "node:crypto";
import { mkdtemp, readFile, writeFile } from "node:fs/promises";
-import { tmpdir, homedir } from "node:os";
+import { homedir, tmpdir } from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { promisify } from "node:util";
diff --git a/memhub/apps/cli/src/product-command-contract.test.ts b/memhub/apps/cli/src/product-command-contract.test.ts
index 819e21e..9505706 100644
--- a/memhub/apps/cli/src/product-command-contract.test.ts
+++ b/memhub/apps/cli/src/product-command-contract.test.ts
@@ -1,6 +1,6 @@
import { execFileSync } from "node:child_process";
import { existsSync } from "node:fs";
-import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
+import { mkdtemp, readdir, readFile, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
diff --git a/memhub/apps/cli/src/product-flows.test.ts b/memhub/apps/cli/src/product-flows.test.ts
index 01b8cda..ed9dbd2 100644
--- a/memhub/apps/cli/src/product-flows.test.ts
+++ b/memhub/apps/cli/src/product-flows.test.ts
@@ -103,26 +103,45 @@ describe("unknown flags are rejected", () => {
});
it("still accepts the documented verbless scan", () => {
- expect(parseProductCommand("scan", ["--all", "--yes"])?.plan.all).toBe(true);
- expect(parseProductCommand("scan", ["--source", "codex"])?.plan.sourceId).toBe(
- "codex",
+ expect(parseProductCommand("scan", ["--all", "--yes"])?.plan.all).toBe(
+ true,
);
+ expect(
+ parseProductCommand("scan", ["--source", "codex"])?.plan.sourceId,
+ ).toBe("codex");
});
it("rejects flags that the named verb does not consume", () => {
// These were accepted and then silently dropped. An operator who typed
// `path remove --source codex` would believe the source filter applied.
expect(
- parseProductCommand("path", ["remove", "--root", "/tmp/x", "--source", "codex"]),
+ parseProductCommand("path", [
+ "remove",
+ "--root",
+ "/tmp/x",
+ "--source",
+ "codex",
+ ]),
).toBeNull();
expect(
- parseProductCommand("path", ["remove", "--root", "/tmp/x", "--no-recursive"]),
+ parseProductCommand("path", [
+ "remove",
+ "--root",
+ "/tmp/x",
+ "--no-recursive",
+ ]),
).toBeNull();
expect(
parseProductCommand("path", ["add", "--root", "/tmp/x", "--full"]),
).toBeNull();
expect(
- parseProductCommand("backup", ["create", "--target", "/tmp/b", "--source", "/tmp/s"]),
+ parseProductCommand("backup", [
+ "create",
+ "--target",
+ "/tmp/b",
+ "--source",
+ "/tmp/s",
+ ]),
).toBeNull();
expect(
parseProductCommand("backup", [
@@ -163,9 +182,7 @@ describe("unknown flags are rejected", () => {
});
it("rejects repeated boolean flags instead of treating them as idempotent", () => {
- expect(
- parseProductCommand("scan", ["--all", "--all", "--yes"]),
- ).toBeNull();
+ expect(parseProductCommand("scan", ["--all", "--all", "--yes"])).toBeNull();
expect(
parseProductCommand("scan", ["--full", "--full", "--yes"]),
).toBeNull();
@@ -179,7 +196,13 @@ describe("unknown flags are rejected", () => {
]),
).toBeNull();
expect(
- parseProductCommand("backup", ["create", "--target", "/tmp/a", "--yes", "--yes"]),
+ parseProductCommand("backup", [
+ "create",
+ "--target",
+ "/tmp/a",
+ "--yes",
+ "--yes",
+ ]),
).toBeNull();
});
@@ -215,12 +238,12 @@ describe("unknown flags are rejected", () => {
]);
expect(parsed).not.toBeNull();
expect(parsed?.confirmPath).toBe("/tmp/backups/a.sqlite3");
- expect(restoreConfirmationMatches("/tmp/backups/a.sqlite3", parsed?.confirmPath)).toBe(
- true,
- );
- expect(restoreConfirmationMatches("/tmp/backups/a.sqlite3", undefined)).toBe(
- false,
- );
+ expect(
+ restoreConfirmationMatches("/tmp/backups/a.sqlite3", parsed?.confirmPath),
+ ).toBe(true);
+ expect(
+ restoreConfirmationMatches("/tmp/backups/a.sqlite3", undefined),
+ ).toBe(false);
expect(
restoreConfirmationMatches(
"/tmp/backups/a.sqlite3",
@@ -365,7 +388,11 @@ describe("path add and remove carry what the endpoint needs", () => {
});
it("distinguishes remove from add", () => {
- const parsed = parseProductCommand("path", ["remove", "--root", "/tmp/scanme"]);
+ const parsed = parseProductCommand("path", [
+ "remove",
+ "--root",
+ "/tmp/scanme",
+ ]);
if (parsed === null) {
throw new Error("path remove must parse");
}
@@ -375,7 +402,12 @@ describe("path add and remove carry what the endpoint needs", () => {
});
it("does not silently drop --yes", () => {
- const parsed = parseProductCommand("path", ["add", "--root", "/tmp/a", "--yes"]);
+ const parsed = parseProductCommand("path", [
+ "add",
+ "--root",
+ "/tmp/a",
+ "--yes",
+ ]);
expect(parsed?.confirmed).toBe(true);
// Without this, a typo'd `--yes` would fall through to a plan and the user
// would believe the change had been made.
diff --git a/memhub/apps/cli/src/publish-manifest.test.ts b/memhub/apps/cli/src/publish-manifest.test.ts
index d0700b7..35f012a 100644
--- a/memhub/apps/cli/src/publish-manifest.test.ts
+++ b/memhub/apps/cli/src/publish-manifest.test.ts
@@ -6,10 +6,7 @@ import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
/** The app root (one level above this test's `src/`). */
-const root = path.resolve(
- path.dirname(fileURLToPath(import.meta.url)),
- "..",
-);
+const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const bundle = path.join(root, "dist", "one-memory.cjs");
// The published npm package must be self-contained. The bundle inlines
@@ -20,9 +17,10 @@ const bundle = path.join(root, "dist", "one-memory.cjs");
describe("publish manifest is production-safe", () => {
it("declares no npm runtime dependency once dependencies are inlined", () => {
// `test` builds with tsup first, so a missing bundle is a real failure.
- expect(existsSync(bundle), "run `pnpm --filter @one-memory/cli build`").toBe(
- true,
- );
+ expect(
+ existsSync(bundle),
+ "run `pnpm --filter @one-memory/cli build`",
+ ).toBe(true);
const source = readFileSync(bundle, "utf8");
const external = [
...new Set(
@@ -37,16 +35,15 @@ describe("publish manifest is production-safe", () => {
),
];
// Every one of these must be a Node builtin, i.e. no npm package.
- const npmDeps = external.filter(
- (name) => !builtinModules.includes(name),
- );
+ const npmDeps = external.filter((name) => !builtinModules.includes(name));
expect(npmDeps).toEqual([]);
});
it("strip-out rule keeps only what the bundle requires", () => {
- expect(existsSync(bundle), "run `pnpm --filter @one-memory/cli build`").toBe(
- true,
- );
+ expect(
+ existsSync(bundle),
+ "run `pnpm --filter @one-memory/cli build`",
+ ).toBe(true);
// Run the real generator, then inspect its output manifest.
execFileSync("node", ["scripts/prepare-publish-manifest.mjs"], {
cwd: root,
diff --git a/memhub/apps/cli/src/runtime-lock-guard.test.ts b/memhub/apps/cli/src/runtime-lock-guard.test.ts
index de6d6ed..594ba82 100644
--- a/memhub/apps/cli/src/runtime-lock-guard.test.ts
+++ b/memhub/apps/cli/src/runtime-lock-guard.test.ts
@@ -49,9 +49,9 @@ describe("runtime service lock guard", () => {
JSON.stringify({ pid: 4321 }),
{ mode: 0o600 },
);
- await expect(
- inspectRuntimeServiceLock(dataDir, () => false),
- ).resolves.toBe("clear");
+ await expect(inspectRuntimeServiceLock(dataDir, () => false)).resolves.toBe(
+ "clear",
+ );
});
it("fails closed on a malformed lease", async () => {
diff --git a/memhub/apps/cli/src/service-session.test.ts b/memhub/apps/cli/src/service-session.test.ts
index c9d9636..c732a1c 100644
--- a/memhub/apps/cli/src/service-session.test.ts
+++ b/memhub/apps/cli/src/service-session.test.ts
@@ -1,15 +1,15 @@
-import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import {
+ type CommandResult,
inspectLaunchdService,
restartManagedService,
+ type ServiceCommandRunner,
startManagedService,
stopManagedService,
- type CommandResult,
- type ServiceCommandRunner,
} from "./service-session.js";
const SERVICE_ID = "com.tencent.onememory.runtime";
@@ -35,7 +35,11 @@ describe("service-aware launchd session", () => {
it("reports running with the launchd pid and plist", async () => {
const run = vi.fn<ServiceCommandRunner>(async () => running(84237));
await expect(
- inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ inspectLaunchdService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toEqual({
state: "running",
pid: 84237,
@@ -46,7 +50,11 @@ describe("service-aware launchd session", () => {
it("treats 'could not find service' as absent", async () => {
const run = vi.fn<ServiceCommandRunner>(async () => absent());
await expect(
- inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ inspectLaunchdService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toEqual({ state: "absent" });
});
@@ -57,7 +65,11 @@ describe("service-aware launchd session", () => {
stderr: "Input/output error",
}));
await expect(
- inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ inspectLaunchdService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toEqual({ state: "unknown", code: "launchd_inspection_failed" });
});
@@ -146,13 +158,21 @@ describe("service-aware launchd session", () => {
if (command[1] === "print") {
printed += 1;
return printed === 1
- ? { code: 0, stdout: `path = /tmp/x.plist\nstate = not running\n`, stderr: "" }
+ ? {
+ code: 0,
+ stdout: `path = /tmp/x.plist\nstate = not running\n`,
+ stderr: "",
+ }
: running(84237);
}
return running(84237);
});
await expect(
- startManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ startManagedService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toBe("started");
expect(calls).toContainEqual([
"launchctl",
@@ -169,7 +189,11 @@ describe("service-aware launchd session", () => {
return running(84237);
});
await expect(
- startManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ startManagedService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toBe("started");
// Already running -> no kickstart needed.
expect(calls.some((c) => c[1] === "kickstart")).toBe(false);
@@ -214,7 +238,11 @@ describe("service-aware launchd session", () => {
stderr: "",
}));
await expect(
- inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ inspectLaunchdService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toEqual({ state: "loaded", plistPath: "/tmp/x.plist" });
});
@@ -225,7 +253,11 @@ describe("service-aware launchd session", () => {
return running(101);
});
await expect(
- restartManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
+ restartManagedService({
+ serviceId: SERVICE_ID,
+ uid: UID,
+ runCaptured: run,
+ }),
).resolves.toBe("restarted");
expect(calls).toContainEqual([
"launchctl",
@@ -286,7 +318,9 @@ describe("service-aware launchd session", () => {
stdout: JSON.stringify({
Label: SERVICE_ID,
ProgramArguments: ["/tmp/node", "/tmp/runtime.cjs", "serve"],
- EnvironmentVariables: { ONE_MEMORY_DATA_DIR: "/tmp/this-install/data" },
+ EnvironmentVariables: {
+ ONE_MEMORY_DATA_DIR: "/tmp/this-install/data",
+ },
}),
stderr: "",
};
diff --git a/memhub/apps/cli/src/service-session.ts b/memhub/apps/cli/src/service-session.ts
index 56c4d34..78153fc 100644
--- a/memhub/apps/cli/src/service-session.ts
+++ b/memhub/apps/cli/src/service-session.ts
@@ -49,7 +49,10 @@ function launchdDomain(uid: number): string {
/** Deterministic location of the managed LaunchAgent plist. Needed because
* after `bootout` launchd no longer reports a path, yet `start` must be able to
* bootstrap the very same service back. */
-export function defaultLaunchAgentPath(home: string, serviceId: string): string {
+export function defaultLaunchAgentPath(
+ home: string,
+ serviceId: string,
+): string {
return path.posix.join(home, "Library", "LaunchAgents", `${serviceId}.plist`);
}
@@ -162,7 +165,10 @@ export async function stopManagedService(options: {
? (["launchctl", "bootout", domain, before.plistPath] as const)
: (["launchctl", "bootout", `${domain}/${options.serviceId}`] as const);
const result = await options.runCaptured([...target]);
- if (result.code !== 0 && !/could not find service|service not found/i.test(result.stderr)) {
+ if (
+ result.code !== 0 &&
+ !/could not find service|service not found/i.test(result.stderr)
+ ) {
throw new Error("launchd_bootout_failed");
}
// "Stopped" must mean the label stays gone, not that we saw it gone once.
@@ -295,9 +301,7 @@ export async function runLaunchctlCaptured(
stderr += String(chunk);
});
child.once("error", () => reject(new Error("launchd_command_failed")));
- child.once("close", (code) =>
- resolve({ code: code ?? 1, stdout, stderr }),
- );
+ child.once("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
});
}
diff --git a/memhub/apps/cli/src/shell-path.test.ts b/memhub/apps/cli/src/shell-path.test.ts
index 05202d9..21a4e66 100644
--- a/memhub/apps/cli/src/shell-path.test.ts
+++ b/memhub/apps/cli/src/shell-path.test.ts
@@ -3,7 +3,11 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
-import { applyShellPath, planShellPath, removeShellPath } from "./shell-path.js";
+import {
+ applyShellPath,
+ planShellPath,
+ removeShellPath,
+} from "./shell-path.js";
async function home(): Promise<string> {
return mkdtemp(path.join(tmpdir(), "memhub-shell-path-"));
diff --git a/memhub/apps/cli/src/shell-path.ts b/memhub/apps/cli/src/shell-path.ts
index 7d8b3fe..3378c30 100644
--- a/memhub/apps/cli/src/shell-path.ts
+++ b/memhub/apps/cli/src/shell-path.ts
@@ -72,9 +72,7 @@ function blockFor(binDirectory: string): string {
* original file byte-for-byte regardless of the original's trailing newline. */
function ownedBlock(existing: string | null, binDirectory: string): string {
const separator =
- existing === null || existing === "" || existing.endsWith("\n")
- ? ""
- : "\n";
+ existing === null || existing === "" || existing.endsWith("\n") ? "" : "\n";
return `${separator}${blockFor(binDirectory)}`;
}
@@ -104,10 +102,7 @@ export async function planShellPath(options: {
disabled: true,
};
}
- const blocked = (
- reason: string,
- target: string,
- ): ShellPathPlan => ({
+ const blocked = (reason: string, target: string): ShellPathPlan => ({
schema_version: 1,
status: "blocked",
blocked_reason: reason,
@@ -229,11 +224,12 @@ async function writeProfileAtomically(
// A fresh `--home` may not exist yet; create it (owner-only) before writing
// the temp profile, otherwise the write fails with a raw ENOENT. Surface a
// structured code for any other failure.
- await mkdir(path.dirname(profilePath), { recursive: true, mode: 0o700 }).catch(
- () => {
- throw new Error("shell_path_home_unwritable");
- },
- );
+ await mkdir(path.dirname(profilePath), {
+ recursive: true,
+ mode: 0o700,
+ }).catch(() => {
+ throw new Error("shell_path_home_unwritable");
+ });
const temporary = `${profilePath}.memhub.${process.pid}.tmp`;
try {
await writeFile(temporary, content, { encoding: "utf8", mode: 0o644 });
diff --git a/memhub/apps/cli/src/source-progress.test.ts b/memhub/apps/cli/src/source-progress.test.ts
index c32fea9..5ea0278 100644
--- a/memhub/apps/cli/src/source-progress.test.ts
+++ b/memhub/apps/cli/src/source-progress.test.ts
@@ -468,7 +468,9 @@ describe("CLI-19 progress and issue reads", () => {
);
expect(output).toContain("[15:04:05.067] progress #1");
expect(output).toContain("[15:04:05.067] progress #2");
- expect(output.match(/\x1b\[2J\x1b\[H/g)).toHaveLength(2);
+ expect(output.match(new RegExp("\\x1b\\[2J\\x1b\\[H", "g"))).toHaveLength(
+ 2,
+ );
});
it("keeps non-terminal watch output append-only", async () => {
diff --git a/memhub/apps/cli/src/source-sync-flow.test.ts b/memhub/apps/cli/src/source-sync-flow.test.ts
index ed46a6d..1d16b14 100644
--- a/memhub/apps/cli/src/source-sync-flow.test.ts
+++ b/memhub/apps/cli/src/source-sync-flow.test.ts
@@ -1,9 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { CoreReader, ReadOutcome } from "./core-client.js";
-import type {
- CoreOperations,
- OperationOutcome,
-} from "./core-operations.js";
+import type { CoreOperations, OperationOutcome } from "./core-operations.js";
import {
renderSourceSyncText,
setSourceSync,
@@ -320,4 +317,3 @@ describe("setSourceSync", () => {
expect(renderSourceSyncText(invalid)).toBe("未变更:invalid_source_id\n");
});
});
-
diff --git a/memhub/apps/cli/src/source-sync-flow.ts b/memhub/apps/cli/src/source-sync-flow.ts
index 91cd38c..71da92d 100644
--- a/memhub/apps/cli/src/source-sync-flow.ts
+++ b/memhub/apps/cli/src/source-sync-flow.ts
@@ -1,7 +1,7 @@
import {
- SourceSyncInputError,
buildSourceSyncRequest,
hasSourceSyncTarget,
+ SourceSyncInputError,
} from "@one-memory/operations";
import type { CoreReader } from "./core-client.js";
import type { CoreOperations } from "./core-operations.js";
@@ -36,7 +36,10 @@ async function current(
reader: CoreReader,
sourceId: string,
): Promise<
- | { state: "ok"; source: NonNullable<ReturnType<typeof validateSources>>[number] }
+ | {
+ state: "ok";
+ source: NonNullable<ReturnType<typeof validateSources>>[number];
+ }
| { state: "invalid" | "unknown"; code: string }
> {
const outcome = await reader<unknown>("/api/v1/sources");
diff --git a/memhub/apps/cli/src/status-report.test.ts b/memhub/apps/cli/src/status-report.test.ts
index cf27454..ecdc361 100644
--- a/memhub/apps/cli/src/status-report.test.ts
+++ b/memhub/apps/cli/src/status-report.test.ts
@@ -30,6 +30,8 @@ describe("status default output", () => {
expect(text).not.toContain("[object Object]");
expect(text).toContain("卡住 类型 整理对话/原因 等待模型/数量 2");
expect(text).not.toMatch(/background_verified|additions_only|error_codes=/);
- expect(text).not.toMatch(/provider_kind|has_api_key|credential_state|observed_at/);
+ expect(text).not.toMatch(
+ /provider_kind|has_api_key|credential_state|observed_at/,
+ );
});
});
diff --git a/memhub/apps/cli/src/ui-command.test.ts b/memhub/apps/cli/src/ui-command.test.ts
index fc62a83..236c59f 100644
--- a/memhub/apps/cli/src/ui-command.test.ts
+++ b/memhub/apps/cli/src/ui-command.test.ts
@@ -85,12 +85,16 @@ describe("memhub ui command wiring", () => {
const output = capture();
let code: number;
try {
- code = await run(["ui", "--json"], {}, {
- openBrowser: async (url) => {
- opened.push(url);
- return true;
+ code = await run(
+ ["ui", "--json"],
+ {},
+ {
+ openBrowser: async (url) => {
+ opened.push(url);
+ return true;
+ },
},
- });
+ );
} finally {
output.restore();
}
@@ -102,7 +106,9 @@ describe("memhub ui command wiring", () => {
state: "opened",
url: "http://127.0.0.1:8765/ui/login?code=one-time-code",
});
- expect(opened).toEqual(["http://127.0.0.1:8765/ui/login?code=one-time-code"]);
+ expect(opened).toEqual([
+ "http://127.0.0.1:8765/ui/login?code=one-time-code",
+ ]);
// The bearer token was sent to Core in the request header, never in output.
expect(output.value()).not.toMatch(/synthetic-runtime-token/);
});
@@ -159,7 +165,11 @@ describe("memhub ui command wiring", () => {
const output = capture();
let code: number;
try {
- code = await run(["ui", "--json"], {}, { openBrowser: async () => false });
+ code = await run(
+ ["ui", "--json"],
+ {},
+ { openBrowser: async () => false },
+ );
} finally {
output.restore();
}
@@ -185,7 +195,11 @@ describe("memhub ui command wiring", () => {
const output = capture();
let code: number;
try {
- code = await run(["ui", "--json"], {}, { openBrowser: async () => true });
+ code = await run(
+ ["ui", "--json"],
+ {},
+ { openBrowser: async () => true },
+ );
} finally {
output.restore();
}
diff --git a/memhub/apps/cli/src/ui-session-http.test.ts b/memhub/apps/cli/src/ui-session-http.test.ts
index bf5389a..71a2a14 100644
--- a/memhub/apps/cli/src/ui-session-http.test.ts
+++ b/memhub/apps/cli/src/ui-session-http.test.ts
@@ -9,7 +9,8 @@ import { parseUiSessionExchange } from "./ui-session.js";
describe("ui session exchange over HTTP", () => {
let server: Server;
let port: number;
- const seen: Array<{ authorization?: string; method?: string; url?: string }> = [];
+ const seen: Array<{ authorization?: string; method?: string; url?: string }> =
+ [];
let status = 200;
beforeAll(async () => {
diff --git a/memhub/apps/cli/src/ui-session.test.ts b/memhub/apps/cli/src/ui-session.test.ts
index 1db3e69..4ea5c91 100644
--- a/memhub/apps/cli/src/ui-session.test.ts
+++ b/memhub/apps/cli/src/ui-session.test.ts
@@ -45,11 +45,31 @@ describe("memhub ui session wiring", () => {
for (const doc of [
null,
{},
- { schema_version: 2, exchange_code: "x", expires_in_seconds: 60, url: "http://127.0.0.1:1/ui/login?code=x" },
+ {
+ schema_version: 2,
+ exchange_code: "x",
+ expires_in_seconds: 60,
+ url: "http://127.0.0.1:1/ui/login?code=x",
+ },
{ schema_version: 1, exchange_code: "x", expires_in_seconds: 60 },
- { schema_version: 1, exchange_code: "", expires_in_seconds: 60, url: "http://127.0.0.1:1/ui/login?code=x" },
- { schema_version: 1, exchange_code: "x", expires_in_seconds: 0, url: "http://127.0.0.1:1/ui/login?code=x" },
- { schema_version: 1, exchange_code: "x", expires_in_seconds: 60, url: "http://127.0.0.1:1/" },
+ {
+ schema_version: 1,
+ exchange_code: "",
+ expires_in_seconds: 60,
+ url: "http://127.0.0.1:1/ui/login?code=x",
+ },
+ {
+ schema_version: 1,
+ exchange_code: "x",
+ expires_in_seconds: 0,
+ url: "http://127.0.0.1:1/ui/login?code=x",
+ },
+ {
+ schema_version: 1,
+ exchange_code: "x",
+ expires_in_seconds: 60,
+ url: "http://127.0.0.1:1/",
+ },
]) {
expect(parseUiSessionExchange(doc)).toBeNull();
}
@@ -59,9 +79,18 @@ describe("memhub ui session wiring", () => {
expect(uiSessionFailure("ui_web_assets_unavailable")).toMatchObject({
code: "ui_web_assets_unavailable",
});
- expect(uiExitCode({ state: "opened", url: "http://127.0.0.1:1/ui/login?code=x" })).toBe(0);
- expect(uiExitCode({ state: "blocked", code: "ui_session_contract_unavailable" })).toBe(4);
- expect(uiExitCode({ state: "failed", code: "ui_session_code_invalid" })).toBe(1);
+ expect(
+ uiExitCode({
+ state: "opened",
+ url: "http://127.0.0.1:1/ui/login?code=x",
+ }),
+ ).toBe(0);
+ expect(
+ uiExitCode({ state: "blocked", code: "ui_session_contract_unavailable" }),
+ ).toBe(4);
+ expect(
+ uiExitCode({ state: "failed", code: "ui_session_code_invalid" }),
+ ).toBe(1);
});
it("uses a platform-appropriate opener and reports missing openers", async () => {
diff --git a/memhub/apps/cli/src/ui-session.ts b/memhub/apps/cli/src/ui-session.ts
index 0f37997..59b3db4 100644
--- a/memhub/apps/cli/src/ui-session.ts
+++ b/memhub/apps/cli/src/ui-session.ts
@@ -42,7 +42,12 @@ function isLoopbackHttpUrl(value: string): boolean {
}
if (parsed.protocol !== "http:") return false;
const host = parsed.hostname.toLowerCase();
- return host === "localhost" || host === "127.0.0.1" || host === "[::1]" || host === "::1";
+ return (
+ host === "localhost" ||
+ host === "127.0.0.1" ||
+ host === "[::1]" ||
+ host === "::1"
+ );
}
/** Validate the Core exchange document; return null when it does not match the
diff --git a/memhub/apps/cli/src/ui-write-cli.test.ts b/memhub/apps/cli/src/ui-write-cli.test.ts
index 633ae14..293c65b 100644
--- a/memhub/apps/cli/src/ui-write-cli.test.ts
+++ b/memhub/apps/cli/src/ui-write-cli.test.ts
@@ -80,7 +80,13 @@ describe("calls clear", () => {
});
it("previews without contacting Core", async () => {
- const result = await capturedRun(["calls", "clear", "--event", EVENT, "--json"]);
+ const result = await capturedRun([
+ "calls",
+ "clear",
+ "--event",
+ EVENT,
+ "--json",
+ ]);
expect(result.code).toBe(0);
const document = JSON.parse(result.stdout);
expect(document.state).toBe("preview");
@@ -341,7 +347,10 @@ describe("notes / extraction / graph / manual extract", () => {
"--json",
]);
expect(applied.code).toBe(0);
- const body = transport.post.mock.calls.at(-1)?.[1] as Record<string, unknown>;
+ const body = transport.post.mock.calls.at(-1)?.[1] as Record<
+ string,
+ unknown
+ >;
expect(body.text).toBe("记住这个决定");
expect(body.scope).toBe("all-apps");
expect(JSON.parse(applied.stdout).state).toBe("committed");
diff --git a/memhub/apps/cli/src/ui-write-flows-extended.ts b/memhub/apps/cli/src/ui-write-flows-extended.ts
index 0dd8e9e..4e3fdd6 100644
--- a/memhub/apps/cli/src/ui-write-flows-extended.ts
+++ b/memhub/apps/cli/src/ui-write-flows-extended.ts
@@ -10,18 +10,17 @@
import { createHash, randomUUID } from "node:crypto";
import {
- MemoryNoteInputError,
buildMemoryNoteSaveRequest,
- parseMemoryNoteReceipt,
+ MemoryNoteInputError,
parseExtractionSettingsReceipt,
parseGraphWidthDecisionReceipt,
parseManualExtractReceipt,
+ parseMemoryNoteReceipt,
} from "@one-memory/operations";
import type { CoreOperations, CorePutOperations } from "./core-operations.js";
import { PRODUCT } from "./version.js";
-const UUID =
- /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
+const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
const DIGEST = /^[0-9a-f]{64}$/;
const NOTE_MAX_CHARACTERS = 12_000;
const EXTRACTION_PRESETS = ["3m", "6m", "1y", "all"] as const;
@@ -117,7 +116,10 @@ function digestOf(value: unknown): string {
type Draft =
| Omit<Extract<ExtendedWritePlan, { kind: "memory_note_add" }>, "digest">
| Omit<Extract<ExtendedWritePlan, { kind: "memory_note_process" }>, "digest">
- | Omit<Extract<ExtendedWritePlan, { kind: "extraction_window_set" }>, "digest">
+ | Omit<
+ Extract<ExtendedWritePlan, { kind: "extraction_window_set" }>,
+ "digest"
+ >
| Omit<Extract<ExtendedWritePlan, { kind: "graph_width_decide" }>, "digest">
| Omit<Extract<ExtendedWritePlan, { kind: "manual_extract" }>, "digest">;
@@ -148,7 +150,10 @@ function committed(
};
}
-function rejected(operationId: string | undefined, code: string): ExtendedWriteOutcome {
+function rejected(
+ operationId: string | undefined,
+ code: string,
+): ExtendedWriteOutcome {
return {
schema_version: 1,
product: PRODUCT,
@@ -158,7 +163,10 @@ function rejected(operationId: string | undefined, code: string): ExtendedWriteO
};
}
-function unknown(operationId: string | undefined, code: string): ExtendedWriteOutcome {
+function unknown(
+ operationId: string | undefined,
+ code: string,
+): ExtendedWriteOutcome {
return {
schema_version: 1,
product: PRODUCT,
@@ -197,7 +205,9 @@ export function validNoteText(text: string): boolean {
);
}
-export function planMemoryNoteProcess(evidenceId: string): ExtendedWriteOutcome {
+export function planMemoryNoteProcess(
+ evidenceId: string,
+): ExtendedWriteOutcome {
return UUID.test(evidenceId)
? preview({
schema_version: 1,
@@ -313,8 +323,7 @@ export function planGraphWidthDecide(decision: string): ExtendedWriteOutcome {
export function planManualExtract(evidenceIds: string[]): ExtendedWriteOutcome {
const ids = [...new Set(evidenceIds)];
- return ids.length === evidenceIds.length &&
- ids.every((id) => UUID.test(id))
+ return ids.length === evidenceIds.length && ids.every((id) => UUID.test(id))
? preview({
schema_version: 1,
kind: "manual_extract",
@@ -455,12 +464,12 @@ export function validateExtendedWritePlan(
}
export function extendedWriteExitCode(document: ExtendedWriteOutcome): number {
- return ["preview", "committed", "recovered"].includes(document.state)
- ? 0
- : 1;
+ return ["preview", "committed", "recovered"].includes(document.state) ? 0 : 1;
}
-export function renderExtendedWriteText(document: ExtendedWriteOutcome): string {
+export function renderExtendedWriteText(
+ document: ExtendedWriteOutcome,
+): string {
if (document.state === "preview") {
const lines = ["以下操作尚未执行;加 --confirm 后才会写入:"];
const plan = document.plan;
diff --git a/memhub/apps/cli/src/ui-write-flows.test.ts b/memhub/apps/cli/src/ui-write-flows.test.ts
index d646aff..c217c3b 100644
--- a/memhub/apps/cli/src/ui-write-flows.test.ts
+++ b/memhub/apps/cli/src/ui-write-flows.test.ts
@@ -61,10 +61,9 @@ describe("UI write execution", () => {
}));
const plan = planOf(planCallEventsClear([EVENT]));
if (plan.kind !== "call_events_clear") throw new Error("kind");
- const result = await executeCallEventsClear(
- plan,
- { post } as unknown as CoreOperations,
- );
+ const result = await executeCallEventsClear(plan, {
+ post,
+ } as unknown as CoreOperations);
expect(result.state).toBe("committed");
expect(post).toHaveBeenCalledWith("/api/v1/call-events/clear", {
event_ids: [EVENT],
@@ -79,10 +78,9 @@ describe("UI write execution", () => {
}));
const plan = planOf(planCallEventsClearAll());
if (plan.kind !== "call_events_clear_all") throw new Error("kind");
- await executeCallEventsClearAll(
- plan,
- { post } as unknown as CoreOperations,
- );
+ await executeCallEventsClearAll(plan, {
+ post,
+ } as unknown as CoreOperations);
expect(post).toHaveBeenCalledWith("/api/v1/call-events/clear-all", {
user_confirmed: true,
});
@@ -107,7 +105,7 @@ describe("UI write execution", () => {
committed: true,
},
}));
- const del = vi.fn(async <T,>() => ({
+ const del = vi.fn(async <T>() => ({
state: "committed" as const,
data: {} as T,
}));
@@ -118,10 +116,9 @@ describe("UI write execution", () => {
const commit = planOf(planImportFileCommit(UPLOAD));
if (commit.kind !== "import_file_commit") throw new Error("kind");
await executeImportFileCommit(commit, operations);
- expect(post).toHaveBeenCalledWith(
- `/api/v1/import-files/${UPLOAD}/commit`,
- { confirmed: true },
- );
+ expect(post).toHaveBeenCalledWith(`/api/v1/import-files/${UPLOAD}/commit`, {
+ confirmed: true,
+ });
const discard = planOf(planImportFileDiscard(UPLOAD));
if (discard.kind !== "import_file_discard") throw new Error("kind");
expect((await executeImportFileDiscard(discard, operations)).state).toBe(
@@ -133,15 +130,12 @@ describe("UI write execution", () => {
it("treats a malformed success receipt as unknown", async () => {
const plan = planOf(planCallEventsClear([EVENT]));
if (plan.kind !== "call_events_clear") throw new Error("kind");
- const result = await executeCallEventsClear(
- plan,
- {
- post: vi.fn(async () => ({
- state: "committed" as const,
- data: { wrong: true },
- })),
- } as unknown as CoreOperations,
- );
+ const result = await executeCallEventsClear(plan, {
+ post: vi.fn(async () => ({
+ state: "committed" as const,
+ data: { wrong: true },
+ })),
+ } as unknown as CoreOperations);
expect(result).toMatchObject({
state: "unknown",
code: "ui_write_receipt_invalid",
diff --git a/memhub/apps/cli/src/ui-write-flows.ts b/memhub/apps/cli/src/ui-write-flows.ts
index 069ab6e..f3d9492 100644
--- a/memhub/apps/cli/src/ui-write-flows.ts
+++ b/memhub/apps/cli/src/ui-write-flows.ts
@@ -14,8 +14,7 @@ import type {
} from "./core-operations.js";
import { PRODUCT } from "./version.js";
-const UUID =
- /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
+const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
const INPUT_KINDS = ["raw_conversation", "memory_content"] as const;
const MAX_UPLOAD_BYTES = 128 * 1024 * 1024;
@@ -139,7 +138,11 @@ export function planCallEventsClear(
) {
return invalid("call_event_ids_invalid");
}
- return preview({ schema_version: 1, kind: "call_events_clear", event_ids: [...eventIds] });
+ return preview({
+ schema_version: 1,
+ kind: "call_events_clear",
+ event_ids: [...eventIds],
+ });
}
export function planCallEventsClearAll(): UiWriteOutcome {
@@ -224,11 +227,7 @@ export async function readImportFileUpload(
}
try {
const stats = await handle.stat();
- if (
- !stats.isFile() ||
- stats.nlink !== 1 ||
- stats.size > MAX_UPLOAD_BYTES
- ) {
+ if (!stats.isFile() || stats.nlink !== 1 || stats.size > MAX_UPLOAD_BYTES) {
return null;
}
const buffer = Buffer.alloc(Number(stats.size));
@@ -273,9 +272,7 @@ function fileUploadOperationId(
checksum: string,
): string {
const hex = createHash("sha256")
- .update(
- JSON.stringify([filename, inputKind, checksum]),
- )
+ .update(JSON.stringify([filename, inputKind, checksum]))
.digest("hex");
return [
hex.slice(0, 8),
@@ -325,8 +322,7 @@ export function validateUiWritePlan(value: unknown): UiWritePlan | null {
UUID.test(candidate.operation_id) &&
typeof candidate.path === "string" &&
typeof candidate.filename === "string" &&
- candidate.filename ===
- candidate.path.split(/[/\\]/).pop() &&
+ candidate.filename === candidate.path.split(/[/\\]/).pop() &&
/^[0-9a-f]{64}$/.test(String(candidate.sha256)) &&
INPUT_KINDS.includes(
candidate.input_kind as (typeof INPUT_KINDS)[number],
@@ -364,9 +360,7 @@ export async function executeCallEventsClear(
event_ids: plan.event_ids,
user_confirmed: true,
});
- return outcome(result, plan.event_ids.join(","), [
- "removed",
- ]);
+ return outcome(result, plan.event_ids.join(","), ["removed"]);
}
export async function executeCallEventsClearAll(
@@ -543,7 +537,9 @@ function outcome(
return committed(operationId, {});
}
const data =
- result.data !== null && typeof result.data === "object" && !Array.isArray(result.data)
+ result.data !== null &&
+ typeof result.data === "object" &&
+ !Array.isArray(result.data)
? (result.data as Record<string, unknown>)
: null;
if (data === null || required.some((key) => !Object.hasOwn(data, key))) {
diff --git a/memhub/apps/cli/tsup.config.ts b/memhub/apps/cli/tsup.config.ts
index 15d1d8f..4d39638 100644
--- a/memhub/apps/cli/tsup.config.ts
+++ b/memhub/apps/cli/tsup.config.ts
@@ -1,10 +1,11 @@
-import { defineConfig } from "tsup";
import { createRequire } from "node:module";
+import { defineConfig } from "tsup";
const require = createRequire(import.meta.url);
-const { resolveBuildVersion } = require("../../scripts/release-version.cjs") as {
- resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
-};
+const { resolveBuildVersion } =
+ require("../../scripts/release-version.cjs") as {
+ resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
+ };
const releaseVersion = resolveBuildVersion(process.env);
export default defineConfig({
@@ -18,7 +19,9 @@ export default defineConfig({
__ONE_MEMORY_BUILD_NUMBER__: JSON.stringify(
process.env.ONE_MEMORY_BUILD_NUMBER ?? "unknown",
),
- __ONE_MEMORY_COMMIT__: JSON.stringify(process.env.ONE_MEMORY_COMMIT ?? "unknown"),
+ __ONE_MEMORY_COMMIT__: JSON.stringify(
+ process.env.ONE_MEMORY_COMMIT ?? "unknown",
+ ),
__MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE__: JSON.stringify(
process.env.MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE ?? "",
),
diff --git a/memhub/apps/cli/vitest.config.ts b/memhub/apps/cli/vitest.config.ts
index cb3a98a..51cde87 100644
--- a/memhub/apps/cli/vitest.config.ts
+++ b/memhub/apps/cli/vitest.config.ts
@@ -1,8 +1,9 @@
-import { defineConfig } from "vitest/config";
import { readFileSync } from "node:fs";
+import { defineConfig } from "vitest/config";
-const version = JSON.parse(readFileSync(new URL("package.json", import.meta.url), "utf8"))
- .version as string;
+const version = JSON.parse(
+ readFileSync(new URL("package.json", import.meta.url), "utf8"),
+).version as string;
export default defineConfig({
define: {
diff --git a/memhub/apps/core/tests/TEST_INDEX.md b/memhub/apps/core/tests/TEST_INDEX.md
index 25f4c77..9f03083 100644
--- a/memhub/apps/core/tests/TEST_INDEX.md
+++ b/memhub/apps/core/tests/TEST_INDEX.md
@@ -13,9 +13,9 @@
| `test_archive_extract.py` | `contract` | Unpacking an archive a stranger sent, onto this user's disk. |
| `test_ask_workspace_path.py` | `contract` | Ask must honour the same workspace_path expansion recall uses. |
| `test_async_bridge.py` | `contract` | 覆盖 reader rejects parallel workers that could close during next、cancelling a read stops the worker before the batch finishes、starting a read does not stop the app answering 等 10 个场景。 |
-| `test_async_dispatch_checks.py` | `contract` | 覆盖 quiet arrival guard is off loop and 5000 events coalesce、live preparation cancel joins thread without late dispatch、quiet preparation rechecks permission before credentials or durable work 等 6 个场景。 |
+| `test_async_dispatch_checks.py` | `contract` | 覆盖 cancelling quiet timer does not start any permission reader、dispatch check does not queue work after shutdown、dispatch permission check denies before queue after classification 等 6 个场景。 |
| `test_auth.py` | `integration` | 覆盖 local api requires bearer token、browser origin is checked in addition to token 场景。 |
-| `test_backfill_acceptance_lifecycle.py` | `integration` | A processing acknowledgement belongs to one consent revision and live worker. |
+| `test_backfill_acceptance_lifecycle.py` | `contract` | A processing acknowledgement belongs to one consent revision and live worker. |
| `test_backfill_conversation_isolation.py` | `contract` | One stale conversation cannot invalidate an entire backfill scan. |
| `test_background_work.py` | `contract` | 覆盖 a request does not wait behind a catch up、bulk work is kept to a few threads at a time、the pool outlives one hand off 等 4 个场景。 |
| `test_backup_destroy_restore_reconciliation.py` | `contract` | Backup -> destroy -> restore, reconciled row for row. |
@@ -25,7 +25,6 @@
| `test_bug01_workbuddy_root.py` | `contract` | 3925a kernel item 2 (BUG-01, backend half): WorkBuddy import root. |
| `test_bug03_identity_key.py` | `contract` | BUG-03: the hook lane and the file scan must share one identity for one message. |
| `test_bug04_thinking_strip.py` | `contract` | BUG-04: Cursor thinking text must not be stored as the assistant's answer. |
-| `test_bulk_import_experience.py` | `contract` | A-6:大数据量导入的自动检查。 |
| `test_c1_append_per_source.py` | `contract` | Append, per source, including the SQLite-backed ones. |
| `test_c1_attribution_per_source.py` | `contract` | Attribution per source, asserted on stored Evidence, not just on parsed events. |
| `test_c1_conversation_identity_scope.py` | `contract` | Same-named source sessions must stay separate through the read path. |
@@ -66,33 +65,23 @@
| `test_cli_restore.py` | `contract` | 覆盖 restore requires a source、restore refuses while the runtime is running、restore previews without confirmation 等 4 个场景。 |
| `test_codex_header_provenance.py` | `contract` | 覆盖 header workspace versions and native ids reach file origin、new adapter rereads header after a real checkpoint、machine and unknown session sources do not establish human or agent sender 等 14 个场景。 |
| `test_compact_model_content.py` | `contract` | Server-held previews preserve exact grants without round-tripping all refs. |
-| `test_concurrent_import_processing.py` | `integration` | Four real source formats/Core scheduling, with a blocked failing model boundary. |
| `test_connection_lifetime.py` | `integration` | Every SQLite connection a request opens must be closed when the request ends. |
| `test_context_access.py` | `contract` | 覆盖 memory only never reads raw authority、raw permission does not grant memory and removes revoked sources、raw requires all apps and source 等 13 个场景。 |
| `test_context_api.py` | `integration` | 覆盖 no model local query returns real raw and governed items、existing single lane authorization never runs denied reader、authentication and origin remain required 等 14 个场景。 |
-| `test_context_auto_recall.py` | `contract` | 覆盖 needed history queries trigger without excluding recent turns、ordinary messages do not trigger、auto recall respects disable permission and satisfied state 等 7 个场景。 |
| `test_context_endpoint_guard.py` | `contract` | 覆盖 composite route accepts existing read capabilities for later body validation、other capabilities do not enable composite read、composite read does not open other routes 等 5 个场景。 |
-| `test_context_expand.py` | `contract` | 覆盖 signed expansion returns only bounded same conversation、expansion uses source order not database insertion order、reference is bound to runtime host scope and revision 等 11 个场景。 |
-| `test_context_feedback.py` | `contract` | 覆盖 explicit feedback contains only offline label and versioned refs、click copy injection and assistant claims are not feedback、feedback cannot be unversioned duplicated or retained forever by omission 等 6 个场景。 |
-| `test_context_host_artifact.py` | `unit` | 覆盖 each priority host gets an independent artifact、host deadline drops content but preserves source coverage receipt、host character budget omits whole group and never truncates a citation 等 12 个场景。 |
| `test_context_hy_primary.py` | `contract` | MemHub_context memory lane: HY decides the order, keywords only when HY does not answer. |
| `test_context_memory.py` | `contract` | 覆盖 permissions precede candidate limit and do not leak counts、scope user status and active source isolation、denied scope does not open database 等 60 个场景。 |
-| `test_context_memory_scale_benchmark.py` | `contract` | 覆盖 memory scale probe covers the required layers and target、memory scale rows preserve governed memory schema shape、memory scale builds the candidate index before measuring 等 9 个场景。 |
-| `test_context_mutations.py` | `contract` | 覆盖 raw candidate never survives update delete or revoke、memory candidate never survives update delete revoke or lifecycle、denied memory never consumes candidate limit before return 等 5 个场景。 |
-| `test_context_query_planner.py` | `contract` | 覆盖 local mode performs zero authorization and network calls、authorization precedes exactly one audited transport call、denied or expired budget never calls transport 等 6 个场景。 |
| `test_context_raw.py` | `contract` | 覆盖 empty authority and unrequested path do not open database、permissions precede candidate limit and no model needed、explicit source filter never broadens authority 等 37 个场景。 |
-| `test_context_raw_scale_benchmark.py` | `performance` | 覆盖 raw scale probe uses fts and has a nonzero positive control、object scale probe has exact positive control and plan 场景。 |
-| `test_context_resume.py` | `contract` | 覆盖 resume packet keeps literal sources and missing fields、agent report and tool output are not system acceptance、only trusted receipt identity marks system acceptance 等 9 个场景。 |
+| `test_context_raw_scale_benchmark.py` | `contract` | 覆盖 object scale probe has exact positive control and plan、raw scale probe uses fts and has a nonzero positive control 场景。 |
| `test_context_search.py` | `contract` | 覆盖 authorization and requested paths never invoke other lane、empty partial zero unavailable and safe failures、parallel common deadline and finalizers wait for both reads 等 24 个场景。 |
| `test_context_search_both_paths.py` | `integration` | The objective names 'recall' and requires BOTH paths: raw and memory. |
| `test_context_v2_contract_parity.py` | `unit` | Mechanical parity checks for the shared v2 coverage receipt contract. |
-| `test_context_v2_coordinator.py` | `contract` | 覆盖 no model path returns raw and memory with exact evidence、semantic failure is not recast as empty、empty lexical with incomplete semantic index is not complete no hit 等 52 个场景。 |
| `test_continuous_completed_input_review.py` | `contract` | Independent review of completed-input reuse; real stores and controlled HY only. |
-| `test_continuous_coordinator.py` | `contract` | 覆盖 restart replays lost callback into same durable task queue、new journal event and source regrant wake replay without legacy request、activation hook and startup recovery start single monitor then stop 等 6 个场景。 |
-| `test_continuous_outcome_unknown.py` | `contract` | 覆盖 crashed continuous send is not replayed but new event progresses、legacy running recovery remains pending and no continuous table、a timed out non continuous task also becomes unknown 等 8 个场景。 |
-| `test_continuous_policy.py` | `contract` | 覆盖 explicit policy never upgrades legacy or sends or creates tasks、backlog snapshot over one hundred thousand is compact、legacy backlog receipt remains readable 等 19 个场景。 |
-| `test_continuous_processing_bridge.py` | `contract` | 覆盖 continuous prepare lease ingest has no legacy receipt or old context、continuous inactive never falls back to legacy、revocation rechecked at runner and publication boundaries 等 17 个场景。 |
-| `test_continuous_processing_integration.py` | `integration` | Real temporary Core/stores with controlled probe and HY boundaries, never real data. |
+| `test_continuous_coordinator.py` | `contract` | 覆盖 activation hook and startup recovery start single monitor then stop、failed preparation does not advance observed watermark、new journal event and source regrant wake replay without legacy request 等 6 个场景。 |
+| `test_continuous_outcome_unknown.py` | `contract` | 覆盖 a timed out continuous task becomes unknown not pending、a timed out non continuous task also becomes unknown、an unsettled continuous send becomes unknown not failed 等 8 个场景。 |
+| `test_continuous_policy.py` | `contract` | 覆盖 backlog snapshot over one hundred thousand is compact、caller rollback includes policy and backlog、enable idempotence rejects changed payload and superseded operation 等 19 个场景。 |
+| `test_continuous_processing_bridge.py` | `contract` | 覆盖 bound source regrant refuses old task、continuous inactive never falls back to legacy、continuous prepare lease ingest has no legacy receipt or old context 等 17 个场景。 |
+| `test_continuous_processing_integration.py` | `contract` | Real temporary Core/stores with controlled probe and HY boundaries, never real data. |
| `test_contract_parity.py` | `contract` | Python 的枚举和 TypeScript 里那份手写的联合类型必须一致。 |
| `test_conversation_search.py` | `integration` | Searching imported conversations before any generation model is configured. |
| `test_conversation_seed_ids.py` | `contract` | 覆盖 seed ids read metadata only without hydrating、seed eligibility keeps person and memory content only、latest activity includes nonseed turns and import time fallback 等 13 个场景。 |
@@ -105,9 +94,9 @@
| `test_daemon_contract.py` | `unit` | A5-01/A5-03: process ownership, and the three grants kept apart. |
| `test_daemon_scheduler.py` | `contract` | A5-02/A5-04: the daemon's scan scheduler and composed health. |
| `test_data_safety.py` | `contract` | A5-05: backup usability/rotation, crash recovery, log retention. |
-| `test_database_contention.py` | `integration` | Writers meet in this one file, and the loser used to lose data. |
+| `test_database_contention.py` | `contract` | Writers meet in this one file, and the loser used to lose data. |
| `test_database_file_permissions.py` | `contract` | 覆盖 a new main database is readable by its owner alone、the wal sidecars are not left world readable、a database from an older build is tightened on open 场景。 |
-| `test_db_session_utc.py` | `live` | The MySQL session must be pinned to UTC. |
+| `test_db_session_utc.py` | `contract` | The MySQL session must be pinned to UTC. |
| `test_delete_no_conversation_freeze.py` | `contract` | 删掉一条记忆,不得让同一对话之后的新 turn 停止沉淀(RC10)。 |
| `test_delivery_board.py` | `contract` | 覆盖 parses only the marked structured record、verified requires evidence with a positive control、rejects unknown dependency 等 5 个场景。 |
| `test_derived_echo.py` | `contract` | A host that saves our injection back must not mint a new user decision. |
@@ -147,7 +136,7 @@
| `test_graph_width_export.py` | `unit` | EXPORT_FIRST has to actually export. |
| `test_graph_width_guard.py` | `unit` | Graph width mismatch must ask, never silently archive. |
| `test_harness_contract_suite.py` | `contract` | A4-09: one contract, ten harnesses. |
-| `test_health.py` | `integration` | 覆盖 health reports the single core、core refuses to start a database written by a newer build、core stays ready when legacy policy upgrade cannot read keychain 等 15 个场景。 |
+| `test_health.py` | `contract` | 覆盖 a backfill that fails says so rather than disappearing、a failed catch up leaves a traceback behind、configured model without content consent does not start backfill 等 15 个场景。 |
| `test_history_listing_rotation.py` | `contract` | 覆盖 history listing alternates started and untouched files、history listing drains whichever cohort is longer 场景。 |
| `test_home_summary.py` | `integration` | 覆盖 summary counts beyond page limit and excludes ineligible rows、summary revocation excludes whole mixed memory not only citation、latest is bounded and other users revocations do not hide local data 等 6 个场景。 |
| `test_home_summary_permissions.py` | `contract` | 覆盖 bad active link excludes whole latest memory、bad inactive link does not hide memory or enter source set、other user memory and grant are isolated 等 10 个场景。 |
@@ -158,7 +147,7 @@
| `test_hy_coding_lease.py` | `contract` | HY's own coding/working route under the permission lease, on the pinned SDK. |
| `test_hy_coding_reply.py` | `contract` | R-07: HY's coding-shaped replies read as "no memories at all". |
| `test_hy_lease_responsiveness.py` | `contract` | Blocked lease checks, local failing doubles only; no network or credentials. |
-| `test_hy_lifecycle_sync.py` | `contract` | HY decides deletions; the ledger mirrors them. |
+| `test_hy_lifecycle_sync.py` | `contract` | HY decides deletions; the ledger mirrors them. Pinned SDK, scripted HTTP. |
| `test_hy_log_privacy.py` | `contract` | HY SDK records are not rewritten by One Memory's logging setup. |
| `test_hy_memory_bridge.py` | `contract` | 覆盖 hy client initialization is serial across bridges、native hy clients share one runtime per data directory、ollama profile ignores ambient remote storage and models 等 41 个场景。 |
| `test_hy_metrics_lifecycle.py` | `contract` | What the pinned public SDK's MetricsCollector does, and what that costs us. |
@@ -178,7 +167,7 @@
| `test_hy_state_source.py` | `contract` | RC4:记忆生命周期(有效 / 被取代 / 去重隐藏 / 过期)直接读 HY,产品账本不再逐类镜像。 |
| `test_hy_step_timing.py` | `contract` | Where an HY write spends the time that is not a model call. |
| `test_hy_step_trace_switch.py` | `contract` | Rule 15: the per-step HY trace is off unless the debug tier asks for it. |
-| `test_hy_supersede_sync.py` | `contract` | HY decides supersessions; the ledger mirrors them. |
+| `test_hy_supersede_sync.py` | `contract` | HY decides supersessions; the ledger mirrors them. Pinned SDK, scripted HTTP. |
| `test_hy_trial_budget.py` | `contract` | Offline proofs for the real-model acceptance budget (no network, no Keychain). |
| `test_hy_turn_input.py` | `contract` | HY gets one turn at a time, exactly as it happened, and picks its own route. |
| `test_hy_writeback.py` | `integration` | HY 的结果只有一扇门进治理表,而且每次进门都带着调用开始时的证据快照。 |
@@ -190,9 +179,9 @@
| `test_import_snapshots.py` | `contract` | Atomic snapshot publication plus frozen manifest, path, mode, and per-file checksum guards. |
| `test_import_supervisor.py` | `contract` | 覆盖 supervisor starts all granted sources together、supervisor runs enqueued job in background、harness freeze keeps pending job and thaw runs the same row 等 11 个场景。 |
| `test_import_three_scenarios.py` | `contract` | The three import scenarios a user actually meets. |
-| `test_import_three_scenarios_real.py` | `performance` | The three import scenarios, on a real Core at a real volume. |
+| `test_import_three_scenarios_real.py` | `contract` | The three import scenarios, on a real Core at a real volume. |
| `test_imported_index_background.py` | `contract` | The ordering index is built off the startup path. |
-| `test_incremental_memory_backfill.py` | `contract` | 覆盖 accept backfill returns after first batch while later history is still read、first task is dispatched before later conversation is prepared、cancellation joins the preparation thread before return 等 18 个场景。 |
+| `test_incremental_memory_backfill.py` | `contract` | 覆盖 accept backfill returns after first batch while later history is still read、backfill budget yields between rounds and resumes same cursor、backfill holds an unanswered raw turn until its reply arrives 等 18 个场景。 |
| `test_ingest_journal.py` | `contract` | 覆盖 baseline and empty initialize are explicit transactional and idempotent、old date new import and revise noop and rollbacks、import metadata changes invalidate without authorizing content 等 12 个场景。 |
| `test_input_sanitization.py` | `unit` | 覆盖 redacts cli and assignment secrets without removing context、redacts bearer known tokens urls and private keys、redacts quoted json assignments and basic authorization 等 8 个场景。 |
| `test_installer.py` | `contract` | 覆盖 installer create verify and rollback is transactional、installer updates owned file and restores backup、installer refuses unowned or changed target 场景。 |
@@ -220,7 +209,7 @@
| `test_main_database_fairness.py` | `contract` | Waiting for the one database has to be a queue, not a scramble. |
| `test_main_database_isolation.py` | `contract` | What one checkout of the main database can do, and what it leaves for the next. |
| `test_managed_restore.py` | `contract` | 覆盖 restore rejects a source outside the managed backup directory、restore rejects a symlinked source、restore rejects a non one memory database 等 9 个场景。 |
-| `test_manual_memory_via_hy.py` | `integration` | T04: what the person explicitly asks to remember is written through HY's import path. |
+| `test_manual_memory_via_hy.py` | `contract` | T04: what the person explicitly asks to remember is written through HY's import path. |
| `test_manual_transcript_import.py` | `integration` | 覆盖 manual json keeps authors unknown time and exact text、marked text keeps code fences and never invents timestamps、ambiguous partial or invalid manual data never leaves partial import 等 4 个场景。 |
| `test_matter_collection.py` | `integration` | 覆盖 hy windows cover every turn including leading and boundary assistants、oversize turn is split without silently dropping content、partial timestamps preserve source sequence 等 8 个场景。 |
| `test_matter_discovery.py` | `contract` | 覆盖 synthesis materializes only known verbatim citations、duplicate claims keep all governed refs and distinct states、synthesis cannot echo the original sixty claim list 等 27 个场景。 |
@@ -247,7 +236,7 @@
| `test_memory_governance_api.py` | `integration` | 覆盖 memory governance api preserves evidence and reports cleanup、memory validation does not echo content 场景。 |
| `test_memory_graph_api.py` | `integration` | 覆盖 graph labels where every edge came from、a created memory is on the map with its source links、drawing the map does not stop the app answering 等 12 个场景。 |
| `test_memory_language.py` | `contract` | R-03: memory language follows the message, so Kristin's gets written in English. |
-| `test_memory_library.py` | `performance` | 覆盖 full library is reachable in stable pages、permission filter precedes count search source and page、query filters before expensive freshness 等 26 个场景。 |
+| `test_memory_library.py` | `contract` | 覆盖 full library is reachable in stable pages、permission filter precedes count search source and page、query filters before expensive freshness 等 26 个场景。 |
| `test_memory_library_api.py` | `integration` | 覆盖 auth and external policy reject before reading、invalid parameters are 422 before projection、empty unknown source and query boundary are success not failure 等 12 个场景。 |
| `test_memory_mutation_receipts.py` | `integration` | Read-only mutation receipts from real governance history, without model calls. |
| `test_memory_no_candidate.py` | `integration` | 新记忆一经创建即有效;「待确认」「已拒绝」只作为旧库迁移的输入存在。 |
@@ -288,8 +277,8 @@
| `test_model_creation_api.py` | `integration` | Normal protected model creation routes with temporary data and in-memory secrets. |
| `test_model_creation_operations.py` | `contract` | 覆盖 lookup without table is read only and legacy create does not initialize、operation commits with profile and version without autoactivation、any replay conflicts before secret put 等 21 个场景。 |
| `test_model_creation_validation_boundary.py` | `integration` | Real ASGI validation must precede creation reservation and secret writes. |
-| `test_model_policy_activation.py` | `contract` | 覆盖 current is read only without policy tables、switch and policy commit together without old activate、policy append failure rolls back active and initialization 等 21 个场景。 |
-| `test_model_policy_routes.py` | `contract` | 覆盖 get does not initialize and capability defaults false、all routes require auth、factory refuses no auth dependency 等 10 个场景。 |
+| `test_model_policy_activation.py` | `contract` | 覆盖 activation helper is transactional and restores row factory、backlog scan does not hold the single writer、cloud credential is checked without keychain write 等 21 个场景。 |
+| `test_model_policy_routes.py` | `contract` | 覆盖 all routes require auth、backlog is required not defaulted、enable and transition safe shape and callback once after commit 等 10 个场景。 |
| `test_model_probe.py` | `contract` | 覆盖 probe still measures embedding when structured output fails、probe records the real embedding width on the profile、openai compatible probe checks model and structured output 等 23 个场景。 |
| `test_model_probe_input_revision.py` | `contract` | 覆盖 input revision precedes measured width update、concurrent update still rejects width or capability cas、early returns record the actual starting revision 等 6 个场景。 |
| `test_model_probe_operations.py` | `integration` | Persisted probe identity, real SQLite/API and synthetic transport only. |
@@ -300,7 +289,7 @@
| `test_model_profile_queue_handover.py` | `contract` | Queued work when the model changes or its configuration is deleted (D75). |
| `test_model_profiles.py` | `contract` | 覆盖 profile uses one model and keeps key out of database、api key updates reuse one stable secret reference、startup cleanup removes only secrets not referenced by current profiles 等 15 个场景。 |
| `test_model_request_budget.py` | `contract` | 覆盖 persists failed request reservations without content、parallel leases cannot exceed request limit、unknown or excessive output and body are denied 等 6 个场景。 |
-| `test_model_request_budget_integration.py` | `integration` | Real HY leaf retries plus durable budget accounting; no network or provider. |
+| `test_model_request_budget_integration.py` | `contract` | Real HY leaf retries plus durable budget accounting; no network or provider. |
| `test_model_scope_lifecycle.py` | `contract` | Bound derived/temporary data without changing consent or original history. |
| `test_mysql_lifecycle.py` | `contract` | A1-07: the decisions Runtime makes around the bundled MySQL. |
| `test_mysql_platform.py` | `contract` | A1-07: the machine-facing half of managing the bundled MySQL. |
@@ -310,7 +299,7 @@
| `test_oversized_file_guard.py` | `contract` | One pass over a source file is bounded by a byte budget, not skipped. |
| `test_parent_watchdog.py` | `integration` | A Core that outlives its launcher makes the next launch impossible. |
| `test_policy_api_wiring.py` | `integration` | 覆盖 global model permission off does not backfill、backfill puts history on write jobs without scheduling memory tasks、source pause skips history until the source is reenabled 场景。 |
-| `test_policy_operation_lookup.py` | `contract` | 覆盖 missing table returns not found without initializing or reading secrets、current operation uses safe receipt without callback or writes、superseded operation preserves historical receipt not current activation 等 12 个场景。 |
+| `test_policy_operation_lookup.py` | `contract` | 覆盖 corrupt current row cannot make history or missing operation look safe、current operation uses safe receipt without callback or writes、lookup connection rejects writes and preserves database 等 12 个场景。 |
| `test_policy_production_entry.py` | `contract` | 覆盖 production serve passes only supported app options、maintenance serve does not own the runtime 场景。 |
| `test_precipitation_concurrency_setting.py` | `contract` | Rule 2/9: precipitation concurrency is configurable, not hardcoded to 1. |
| `test_primary_source_adapters.py` | `contract` | 覆盖 pipeline json is host generated even when truncated、workbuddy record parsing never blocks the event loop、cursor store user info envelope is not attributed to the person 等 34 个场景。 |
@@ -318,20 +307,18 @@
| `test_probe_payment_required.py` | `contract` | 覆盖 http 402 without a useful body is still understood as unpaid、a wrong address is still a missing model not an unpaid one 场景。 |
| `test_processing_coordinator.py` | `contract` | 覆盖 monitor is retained and observes config plus tasks 场景。 |
| `test_processing_merged_context.py` | `contract` | 覆盖 new chunk omits known memory with changed support but keeps original history 场景。 |
-| `test_processing_requests.py` | `contract` | 覆盖 receipt is small frozen and persistent、grant deduplication never retriggers or changes profile、concurrent create same grant has one id and profile 等 14 个场景。 |
-| `test_product_contract_coverage.py` | `contract` | 覆盖 full app contract is part of the existing acceptance manifest、core visual phase has its own contract without erasing full product scope 场景。 |
+| `test_processing_requests.py` | `contract` | 覆盖 concurrent claim only one snapshot wins、concurrent create same grant has one id and profile、concurrent different profile never reuses another scope 等 14 个场景。 |
| `test_quality_acceptance.py` | `contract` | 覆盖 acceptance pack is deterministic and scores personal boundary、acceptance score fails missing personal memory 场景。 |
| `test_raw_search_without_model.py` | `integration` | Search imported conversations with no generative model configured at all. |
-| `test_raw_vector_scale_benchmark.py` | `performance` | 覆盖 vector scale probe uses real 512 dimension filtered search 场景。 |
+| `test_raw_vector_scale_benchmark.py` | `contract` | 覆盖 vector scale probe uses real 512 dimension filtered search 场景。 |
| `test_read_path_freshness_batch.py` | `contract` | The row-by-row read check must not scale its query count with the page. |
| `test_reader_app.py` | `integration` | The Reader process stays read-only and never blocks a read on its side effects. |
| `test_reader_conversation_hit.py` | `contract` | A search hit carries who wrote the row it matched. |
-| `test_real_load_metrics.py` | `performance` | Run the real access layer under a production-like combined load. |
-| `test_real_model_prereq_guards.py` | `contract` | Real-model first-run preconditions must fail closed before any egress. |
+| `test_real_load_metrics.py` | `contract` | Run the real access layer under a production-like combined load. |
| `test_recall.py` | `contract` | 覆盖 recall is confirmed only grounded and scope bound、wildcard scope means every scope just like it does in qa、recall returns empty instead of unrelated fallback 等 10 个场景。 |
| `test_recall_during_import_probe_contract.py` | `contract` | Guard the source-level recall-during-import probe's sampling semantics. |
| `test_recall_excluded_sources.py` | `contract` | D94: an empty result names the sources this host may not read. |
-| `test_recall_fusion_live.py` | `live` | RCL-04 against a real HY instance instead of a stand-in. |
+| `test_recall_fusion_live.py` | `integration` | RCL-04 against a real HY instance instead of a stand-in. |
| `test_recall_hy_primary.py` | `integration` | Host recall: HY search decides the order, the ledger only filters. |
| `test_recall_library_scale.py` | `contract` | 覆盖 recall reaches a memory that is not among the newest 500、semantic recall reaches a memory outside the newest 500、recall still works just below the boundary 等 5 个场景。 |
| `test_recall_log_probe_exclusion.py` | `contract` | A-21:R-10 一旦引入召回日志,「探针不污染」必须自动变红而不是静默失效。 |
@@ -343,14 +330,13 @@
| `test_recall_scope_off_loop.py` | `contract` | The workspace lookup behind an external recall must not run on the loop. |
| `test_recent_first_import.py` | `contract` | Recent-file priority survives restart through a selection-bound frozen copy. |
| `test_retrieval_chunking.py` | `contract` | 覆盖 default 384 body 64 overlap and exact source slices、all prefix and special tokens count toward strict 512 budget、real tokenizer covers long chinese middle and tail object locations 等 20 个场景。 |
-| `test_retrieval_eligibility_benchmark.py` | `performance` | 覆盖 scale probe proves composite authority index changes the plan 场景。 |
+| `test_retrieval_eligibility_benchmark.py` | `contract` | 覆盖 scale probe proves composite authority index changes the plan 场景。 |
| `test_retrieval_index_store.py` | `contract` | 覆盖 constructor and reads do not create database or schema、explicit initialization rolls back and never grants model policy、consumer and jobs commit together 等 19 个场景。 |
| `test_retrieval_index_supervisor.py` | `contract` | 覆盖 stop waits for native exit and does not close resources、async cancellation repeatedly waits for native thread、idle no trigger no spin and duplicate start rejected 等 14 个场景。 |
| `test_retrieval_index_worker.py` | `contract` | 覆盖 tick indexes complete original and reopen can search、change during native encoding never publishes、cancel after encode does not publish and is reclaimable 等 10 个场景。 |
| `test_retrieval_lifespan.py` | `integration` | 覆盖 retrieval defaults off and does not create index、enabling retrieval requires runtime ownership、index enabled serve imports without building an unmanaged app 等 6 个场景。 |
| `test_retrieval_mapped_content.py` | `contract` | 覆盖 raw authors keep exact body and do not mutate evidence、raw and author qualification rejects without tokenizing、ambiguous generated and body hygiene are not admitted 等 22 个场景。 |
| `test_retrieval_mapped_integration.py` | `contract` | 覆盖 empty materialization rechecks excluded map、completed excluded missing active binding is not empty success、old empty completion is invalidated when a new indexed record arrives 等 24 个场景。 |
-| `test_retrieval_models.py` | `unit` | RCL v2 wire contracts only; no service, model or database is initialized. |
| `test_retrieval_provisioning.py` | `contract` | The index has to come up through the product, not through a test helper. |
| `test_retrieval_query_plan.py` | `contract` | Local QueryPlan: extract URL/path objects. |
| `test_retrieval_raw_candidates.py` | `contract` | 覆盖 positive only current authorized published chunks are searched、empty authority never reads database or vector、unapproved source never enters vector query 等 15 个场景。 |
@@ -384,7 +370,7 @@
| `test_secret_store_error_codes.py` | `integration` | 3925a kernel item 3: keychain failure classification and backoff that heals. |
| `test_secure_storage.py` | `integration` | 覆盖 isolated keychain service namespace、custom keychain service is refused outside isolated tests、packaged keychain budget covers loaded process startup 等 20 个场景。 |
| `test_sedimentation_concurrency.py` | `contract` | Sedimentation runs several harnesses at once, but one harness at a time. |
-| `test_service_level_pressure_acceptance.py` | `performance` | 覆盖 workbuddy recall remains available during 100k import 场景。 |
+| `test_service_level_pressure_acceptance.py` | `contract` | 覆盖 workbuddy recall remains available during 100k import 场景。 |
| `test_service_levels.py` | `contract` | 覆盖 background never consumes the realtime reservation、realtime is next for the same source after background yields、import history gets one slice after nine realtime admissions 等 8 个场景。 |
| `test_session_inbox.py` | `contract` | A session inbox is not a shared mailbox and a pull is not adoption. |
| `test_session_lease.py` | `contract` | A session file on disk is not proof that the session is online. |
@@ -393,7 +379,7 @@
| `test_simplified_model_permission_migrations.py` | `contract` | 覆盖 fresh schema omits removed permission state machines 场景。 |
| `test_snapshot_adapter.py` | `contract` | Selection-only binding reopens checksum-verified frozen copies. |
| `test_snapshot_pool.py` | `contract` | A whole-directory snapshot must not hold a thread everything else is waiting for. |
-| `test_soak_probe_effectiveness.py` | `contract` | The soak probe must observe the load it reports on. |
+| `test_soak_probe_effectiveness.py` | `integration` | The soak probe must observe the load it reports on. |
| `test_source_access.py` | `contract` | 覆盖 source root requires explicit user grant、sensitive home directory is rejected without requesting os access、authorized file cannot escape root through a symlink 等 24 个场景。 |
| `test_source_candidate_api.py` | `integration` | Candidate location changes must not implicitly grant or import anything. |
| `test_source_candidate_connections.py` | `contract` | 覆盖 empty candidate revisions preserve default fingerprint、persisted candidate requires exact revision、connection resolves candidate in transaction and prior replay never regrants 等 7 个场景。 |
@@ -420,7 +406,7 @@
| `test_source_write_switch.py` | `contract` | A frozen Harness produces no extraction tasks. |
| `test_sql_compat.py` | `contract` | The shared compatibility layer, especially 'rowcount'. |
| `test_sqlite_semantics_gate.py` | `contract` | D56: prevent SQLite implementation details spreading outside the data layer. |
-| `test_sqlite_write_contention.py` | `performance` | Measure whether SQLite's single writer actually blocks us. |
+| `test_sqlite_write_contention.py` | `contract` | Measure whether SQLite's single writer actually blocks us. |
| `test_storage_ingest_journal.py` | `contract` | 覆盖 legacy put and reopen never initialize journal、initialized put records final origins create revision and noop、attribution propagation journals old rows as maintenance only 等 11 个场景。 |
| `test_store_binding.py` | `contract` | A2: which store is in force, and honest reporting of it. |
| `test_store_binding_ratchet.py` | `contract` | D56: ratchet the retired dual-engine 'store_for' seam out of the Core. |
@@ -432,7 +418,6 @@
| `test_tail_metadata_lane.py` | `contract` | Post-response metadata retries must be bounded and never block the route. |
| `test_terminal_payload_reaping.py` | `contract` | Rule 14: dead-end payloads are actually reaped, not just reapable. |
| `test_tool_evidence_hy_turns.py` | `contract` | Every adapter's tool records reach HY inside the turn they happened in. |
-| `test_training_extraction_and_baseline.py` | `contract` | R-17:抽取结果落盘成训练数据,评测基线冻结成可复跑产物。 |
| `test_two_level_discovery.py` | `contract` | 3925a kernel item 1: two-level discovery. |
| `test_ui_session.py` | `contract` | 覆盖 exchange is single use and creates a session、expired exchange cannot create a session、exchange is bound to the core instance 等 5 个场景。 |
| `test_ui_session_api.py` | `integration` | 覆盖 ui session exchange sets httponly strict cookie、ui session requires bearer for exchange、ui session reports missing web assets 场景。 |
@@ -448,4 +433,4 @@
| `test_workspace_recall.py` | `contract` | Workspace memories were unreachable from every host; these pin the way in. |
| `test_write_queue_lease_renewal.py` | `contract` | Rule 8: a lease must outlive the work it covers, and be renewed while it runs. |
-共 443 个测试文件。
+共 428 个测试文件。
diff --git a/memhub/apps/core/tests/core_test_classification.py b/memhub/apps/core/tests/core_test_classification.py
index c3226ba..53a6a11 100644
--- a/memhub/apps/core/tests/core_test_classification.py
+++ b/memhub/apps/core/tests/core_test_classification.py
@@ -14,14 +14,13 @@ from pathlib import Path
import pytest
PRIMARY_MARKERS = ("unit", "contract", "integration", "performance", "live")
-EXPECTED_TEST_FILE_COUNT = 443
-EXPECTED_TEST_FILES_SHA256 = "6d4815ac6a76cfa3f6208672052b785c7562083cf9d122cc9ddc796b8e624d43"
+EXPECTED_TEST_FILE_COUNT = 428
+EXPECTED_TEST_FILES_SHA256 = "bd3bf4fc9cda2a8e4427d106283c40d22dad026fd452db954046b6f28d21b896"
# Pure transformations, validation models, parity checks and state machines.
# This list is intentionally small: uncertain files default to contract.
UNIT_FILES = frozenset(
{
- "test_context_host_artifact.py",
"test_context_v2_contract_parity.py",
"test_daemon_contract.py",
"test_diagnostic_payload_keys.py",
@@ -34,7 +33,6 @@ UNIT_FILES = frozenset(
"test_memory_server_config_state.py",
"test_memory_server_contracts.py",
"test_memory_server_job_state.py",
- "test_retrieval_models.py",
"test_scan_roots.py",
"test_scanner_classifier.py",
"test_scanner_sessionizer.py",
@@ -50,7 +48,6 @@ UNIT_FILES = frozenset(
INTEGRATION_FILES = frozenset(
{
"test_auth.py",
- "test_backfill_acceptance_lifecycle.py",
"test_backup_endpoint.py",
"test_backup_restore_api.py",
"test_c1_import_via_api_path.py",
@@ -58,11 +55,9 @@ INTEGRATION_FILES = frozenset(
"test_capture_deadline.py",
"test_chat_exports.py",
"test_cli_lifecycle.py",
- "test_concurrent_import_processing.py",
"test_connection_lifetime.py",
"test_context_api.py",
"test_context_search_both_paths.py",
- "test_continuous_processing_integration.py",
"test_conversation_search.py",
"test_credential_responsiveness.py",
"test_d93_same_process_load.py",
@@ -75,7 +70,6 @@ INTEGRATION_FILES = frozenset(
"test_file_import_operations.py",
"test_four_app_live_ingest.py",
"test_graph_width_endpoint.py",
- "test_health.py",
"test_home_summary.py",
"test_hy_writeback.py",
"test_import_api.py",
@@ -85,7 +79,6 @@ INTEGRATION_FILES = frozenset(
"test_log_privacy.py",
"test_loopback_origin_write.py",
"test_main_database_entry.py",
- "test_manual_memory_via_hy.py",
"test_manual_transcript_import.py",
"test_matter_collection.py",
"test_matter_hy_integration.py",
@@ -113,7 +106,6 @@ INTEGRATION_FILES = frozenset(
"test_model_probe_operations.py",
"test_model_profile_api.py",
"test_model_profile_context_reset.py",
- "test_model_request_budget_integration.py",
"test_onboarding_profile.py",
"test_parent_watchdog.py",
"test_policy_api_wiring.py",
diff --git a/memhub/apps/desktop/assets/app-icon-source.svg b/memhub/apps/desktop/assets/app-icon-source.svg
index 94e2b08..6c7836b 100644
--- a/memhub/apps/desktop/assets/app-icon-source.svg
+++ b/memhub/apps/desktop/assets/app-icon-source.svg
@@ -1 +1 @@
-<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="172"><defs><filter id="filter_0" color-interpolation-filters="sRGB" x="0" y="8" width="164" height="164" filterUnits="userSpaceOnUse"><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="0" dy="8"/><feGaussianBlur stdDeviation="9"/><feColorMatrix type="matrix" values="0 0 0 0 0.2 0 0 0 0 0.28 0 0 0 0 0.34 0 0 0 0.12 0" result="shadow"/></filter></defs><g filter="url(#filter_0)"><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><clipPath id="clip_0"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_0)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></g><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#829CAD" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#4F6373" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><path fill="#5E7C8C" transform="matrix(1 0 0 1 79 64)" d="M23 0L23 22Q23 26.6757 21.1904 30.9547Q19.4442 35.0835 16.2639 38.2639Q13.0835 41.4442 8.9547 43.1904Q4.6757 45 0 45Q-2.5153 45.0724 -4.2426 43.2426Q-6.0724 41.5153 -6 39Q-6.0724 36.4847 -4.2426 34.7574Q-2.5153 32.9276 0 33Q2.2425 33 4.2806 32.1381Q6.2535 31.3037 7.7786 29.7786Q9.3037 28.2535 10.1381 26.2806Q11 24.2425 11 22L11 0Q10.9276 -2.5153 12.7574 -4.2426Q14.4847 -6.0724 17 -6Q19.5153 -6.0724 21.2426 -4.2426Q23.0724 -2.5153 23 0Z"/><clipPath id="clip_1"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_1)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></svg>
\ No newline at end of file
+<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="172"><title>MemHub</title><defs><filter id="filter_0" color-interpolation-filters="sRGB" x="0" y="8" width="164" height="164" filterUnits="userSpaceOnUse"><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="0" dy="8"/><feGaussianBlur stdDeviation="9"/><feColorMatrix type="matrix" values="0 0 0 0 0.2 0 0 0 0 0.28 0 0 0 0 0.34 0 0 0 0.12 0" result="shadow"/></filter></defs><g filter="url(#filter_0)"><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><clipPath id="clip_0"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_0)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></g><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#829CAD" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#4F6373" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><path fill="#5E7C8C" transform="matrix(1 0 0 1 79 64)" d="M23 0L23 22Q23 26.6757 21.1904 30.9547Q19.4442 35.0835 16.2639 38.2639Q13.0835 41.4442 8.9547 43.1904Q4.6757 45 0 45Q-2.5153 45.0724 -4.2426 43.2426Q-6.0724 41.5153 -6 39Q-6.0724 36.4847 -4.2426 34.7574Q-2.5153 32.9276 0 33Q2.2425 33 4.2806 32.1381Q6.2535 31.3037 7.7786 29.7786Q9.3037 28.2535 10.1381 26.2806Q11 24.2425 11 22L11 0Q10.9276 -2.5153 12.7574 -4.2426Q14.4847 -6.0724 17 -6Q19.5153 -6.0724 21.2426 -4.2426Q23.0724 -2.5153 23 0Z"/><clipPath id="clip_1"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_1)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></svg>
\ No newline at end of file
diff --git a/memhub/apps/desktop/scripts/after-pack.cjs b/memhub/apps/desktop/scripts/after-pack.cjs
index 6c0764d..a700436 100644
--- a/memhub/apps/desktop/scripts/after-pack.cjs
+++ b/memhub/apps/desktop/scripts/after-pack.cjs
@@ -77,7 +77,9 @@ function releaseVersion(context) {
const packaged = context.packager?.appInfo?.version?.trim();
const version = supplied || packaged;
return typeof version === "string" &&
- /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(version)
+ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(
+ version,
+ )
? version
: undefined;
}
diff --git a/memhub/apps/desktop/src/connection-setup-ipc.ts b/memhub/apps/desktop/src/connection-setup-ipc.ts
index 7878027..cdea747 100644
--- a/memhub/apps/desktop/src/connection-setup-ipc.ts
+++ b/memhub/apps/desktop/src/connection-setup-ipc.ts
@@ -493,17 +493,17 @@ function publicItem(
receipt: !receipt
? null
: {
- kind: receipt.kind,
- hostId: receipt.host.hostId,
- installationId: receipt.host.installationId as string,
- permissionRevision: receipt.host.permissionRevision,
- ...(receipt.kind === "readGrant"
- ? {
- allowedTools: [...receipt.allowedTools],
- allowedScopes: [...receipt.allowedScopes],
- }
- : {}),
- },
+ kind: receipt.kind,
+ hostId: receipt.host.hostId,
+ installationId: receipt.host.installationId as string,
+ permissionRevision: receipt.host.permissionRevision,
+ ...(receipt.kind === "readGrant"
+ ? {
+ allowedTools: [...receipt.allowedTools],
+ allowedScopes: [...receipt.allowedScopes],
+ }
+ : {}),
+ },
};
}
function selectionInput(input: unknown): ConnectionSetupSelection {
diff --git a/memhub/apps/desktop/src/desktop-version.test.ts b/memhub/apps/desktop/src/desktop-version.test.ts
index 2c73a20..92f570d 100644
--- a/memhub/apps/desktop/src/desktop-version.test.ts
+++ b/memhub/apps/desktop/src/desktop-version.test.ts
@@ -4,10 +4,7 @@ import { desktopVersionOutput } from "./desktop-version";
describe("Desktop version probe", () => {
it("returns packaged SemVer for the product-private probe", () => {
expect(
- desktopVersionOutput(
- ["MemHub", "--memhub-version"],
- "0.1.0-internal.2",
- ),
+ desktopVersionOutput(["MemHub", "--memhub-version"], "0.1.0-internal.2"),
).toBe("MemHub 0.1.0-internal.2\n");
});
diff --git a/memhub/apps/desktop/src/display-preferences-ipc.test.ts b/memhub/apps/desktop/src/display-preferences-ipc.test.ts
index b9cd463..b534ec3 100644
--- a/memhub/apps/desktop/src/display-preferences-ipc.test.ts
+++ b/memhub/apps/desktop/src/display-preferences-ipc.test.ts
@@ -436,7 +436,9 @@ describe("display preference preload", () => {
it("preload exposes the explicit background restart action", async () => {
const api = await preload();
fake.invoke.mockResolvedValue({ state: "restarted" });
- await expect(api.restartBackground()).resolves.toEqual({ state: "restarted" });
+ await expect(api.restartBackground()).resolves.toEqual({
+ state: "restarted",
+ });
expect(fake.invoke).toHaveBeenCalledExactlyOnceWith(
"one-memory:restart-background",
);
diff --git a/memhub/apps/desktop/src/early-startup-errors.test.ts b/memhub/apps/desktop/src/early-startup-errors.test.ts
index 488fd20..39a56b9 100644
--- a/memhub/apps/desktop/src/early-startup-errors.test.ts
+++ b/memhub/apps/desktop/src/early-startup-errors.test.ts
@@ -8,7 +8,9 @@ import { installEarlyStartupErrorHandler } from "./early-startup-errors";
const roots: string[] = [];
afterEach(async () => {
- await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true })));
+ await Promise.all(
+ roots.splice(0).map((root) => rm(root, { recursive: true })),
+ );
});
describe("early desktop startup errors", () => {
@@ -31,7 +33,9 @@ describe("early desktop startup errors", () => {
});
it("writes stderr and diagnostics before showing the fatal dialog", async () => {
- const dataDir = await mkdtemp(path.join(os.tmpdir(), "desktop-early-error-"));
+ const dataDir = await mkdtemp(
+ path.join(os.tmpdir(), "desktop-early-error-"),
+ );
roots.push(dataDir);
const processEvents = new EventEmitter();
const order: string[] = [];
@@ -47,7 +51,8 @@ describe("early desktop startup errors", () => {
processEvents.emit(
"uncaughtException",
Object.assign(new Error("desktop_test_real_home_mismatch"), {
- stack: "Error: desktop_test_real_home_mismatch\n at boot (apps/desktop/src/main.ts:80:1)",
+ stack:
+ "Error: desktop_test_real_home_mismatch\n at boot (apps/desktop/src/main.ts:80:1)",
}),
);
diff --git a/memhub/apps/desktop/src/early-startup-errors.ts b/memhub/apps/desktop/src/early-startup-errors.ts
index 6b730c2..48d8873 100644
--- a/memhub/apps/desktop/src/early-startup-errors.ts
+++ b/memhub/apps/desktop/src/early-startup-errors.ts
@@ -29,7 +29,8 @@ export function installEarlyStartupErrorHandler(
if (handled) return;
handled = true;
const fields = diagnosticError(error);
- const message = error instanceof Error ? error.message : "desktop_startup_failed";
+ const message =
+ error instanceof Error ? error.message : "desktop_startup_failed";
const errorCode = SAFE_ERROR_CODE.test(message)
? message
: "desktop_startup_failed";
diff --git a/memhub/apps/desktop/src/isolated-runtime.test.ts b/memhub/apps/desktop/src/isolated-runtime.test.ts
index f5952af..fb4de53 100644
--- a/memhub/apps/desktop/src/isolated-runtime.test.ts
+++ b/memhub/apps/desktop/src/isolated-runtime.test.ts
@@ -65,29 +65,29 @@ describe("formal package test isolation", () => {
it.skipIf(process.platform !== "darwin")(
"accepts the macOS /tmp alias for an existing /private/tmp test home",
() => {
- const root = mkdtempSync("/private/tmp/one-memory-desktop-alias.");
- const home = path.join(root, "home");
- const dataDir = path.join(root, "data");
- const hostHome = path.join(root, "host-home");
- mkdirSync(home, { recursive: true });
- mkdirSync(dataDir, { recursive: true });
- mkdirSync(hostHome, { recursive: true });
+ const root = mkdtempSync("/private/tmp/one-memory-desktop-alias.");
+ const home = path.join(root, "home");
+ const dataDir = path.join(root, "data");
+ const hostHome = path.join(root, "host-home");
+ mkdirSync(home, { recursive: true });
+ mkdirSync(dataDir, { recursive: true });
+ mkdirSync(hostHome, { recursive: true });
- expect(
- resolveDesktopTestIsolation(
- {
- ONE_MEMORY_TEST_ISOLATED: "1",
- ONE_MEMORY_TEST_REAL_HOME: "/Users/example",
- ONE_MEMORY_DESKTOP_TEST_HOME: home,
- ONE_MEMORY_DATA_DIR: dataDir,
- ONE_MEMORY_HOST_HOME: hostHome,
- ONE_MEMORY_CORE_PORT: "27791",
- ONE_MEMORY_RUNTIME_PORT: "27791",
- ONE_MEMORY_BROKER_PORT: "37791",
- },
- home.replace(/^\/private\/tmp\//, "/tmp/"),
- ),
- ).toMatchObject({ home });
+ expect(
+ resolveDesktopTestIsolation(
+ {
+ ONE_MEMORY_TEST_ISOLATED: "1",
+ ONE_MEMORY_TEST_REAL_HOME: "/Users/example",
+ ONE_MEMORY_DESKTOP_TEST_HOME: home,
+ ONE_MEMORY_DATA_DIR: dataDir,
+ ONE_MEMORY_HOST_HOME: hostHome,
+ ONE_MEMORY_CORE_PORT: "27791",
+ ONE_MEMORY_RUNTIME_PORT: "27791",
+ ONE_MEMORY_BROKER_PORT: "37791",
+ },
+ home.replace(/^\/private\/tmp\//, "/tmp/"),
+ ),
+ ).toMatchObject({ home });
},
);
diff --git a/memhub/apps/desktop/src/login-service-package.test.ts b/memhub/apps/desktop/src/login-service-package.test.ts
index 25bdb6c..cdfb3eb 100644
--- a/memhub/apps/desktop/src/login-service-package.test.ts
+++ b/memhub/apps/desktop/src/login-service-package.test.ts
@@ -53,7 +53,9 @@ it.skipIf(process.platform !== "darwin")(
process: { env: {} },
require(name: string) {
if (name === "node:crypto")
- return { randomUUID: () => "00000000-0000-4000-8000-000000000000" };
+ return {
+ randomUUID: () => "00000000-0000-4000-8000-000000000000",
+ };
if (name === "node:path") return path;
if (name === "node:child_process")
return {
diff --git a/memhub/apps/desktop/src/package-resources.test.ts b/memhub/apps/desktop/src/package-resources.test.ts
index 731d8ce..c39061e 100644
--- a/memhub/apps/desktop/src/package-resources.test.ts
+++ b/memhub/apps/desktop/src/package-resources.test.ts
@@ -191,7 +191,9 @@ describe("packaged macOS permission metadata", () => {
expect(fixture.plist.get("CFBundleShortVersionString")).toBe("1.2.3");
expect(fixture.plist.get("CFBundleVersion")).toBe("3903");
expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_VERSION")).toBe("1.2.3");
- expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_BUILD_NUMBER")).toBe("3903");
+ expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_BUILD_NUMBER")).toBe(
+ "3903",
+ );
});
it("removes inherited audio capture and existing unused keys before signing", async () => {
@@ -209,10 +211,7 @@ describe("packaged macOS permission metadata", () => {
// Production clears any stale build marker before removing unused usage
// strings and signing. No LaunchAgent plist is written.
expect(fixture.execFileSync.mock.calls).toEqual([
- [
- "/usr/libexec/PlistBuddy",
- ["-c", "Add :LSEnvironment dict", plistPath],
- ],
+ ["/usr/libexec/PlistBuddy", ["-c", "Add :LSEnvironment dict", plistPath]],
[
"/usr/libexec/PlistBuddy",
["-c", "Delete :LSEnvironment:ONE_MEMORY_VERSION", plistPath],
diff --git a/memhub/apps/desktop/src/preload.ts b/memhub/apps/desktop/src/preload.ts
index 96fe720..622d4ec 100644
--- a/memhub/apps/desktop/src/preload.ts
+++ b/memhub/apps/desktop/src/preload.ts
@@ -229,6 +229,5 @@ contextBridge.exposeInMainWorld("oneMemory", {
hostId: string;
installed: boolean;
permission: RecallPermissionStatus;
- }> =>
- ipcRenderer.invoke("one-memory:uninstall-recall", hostId, approved),
+ }> => ipcRenderer.invoke("one-memory:uninstall-recall", hostId, approved),
});
diff --git a/memhub/apps/desktop/src/stable-runtime.test.ts b/memhub/apps/desktop/src/stable-runtime.test.ts
index 5a863d3..d5b5bc6 100644
--- a/memhub/apps/desktop/src/stable-runtime.test.ts
+++ b/memhub/apps/desktop/src/stable-runtime.test.ts
@@ -1,4 +1,10 @@
-import { mkdir, mkdtemp, readFile, readlink, writeFile } from "node:fs/promises";
+import {
+ mkdir,
+ mkdtemp,
+ readFile,
+ readlink,
+ writeFile,
+} from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
@@ -7,8 +13,8 @@ import {
ensureStableRuntimeThenRepair,
installBundledCliIfNeeded,
isInstalledApplicationsApp,
- startStableRuntimeRepair,
stableRuntimeErrorCode,
+ startStableRuntimeRepair,
} from "./stable-runtime";
it("only treats a packaged macOS executable under Applications as installed", () => {
@@ -35,7 +41,12 @@ it("only treats a packaged macOS executable under Applications as installed", ()
it("installs only memhub and adds its directory to a new shell", async () => {
if (process.platform === "win32") return;
const home = await mkdtemp(path.join(os.tmpdir(), "memhub-auto-cli-"));
- const installRoot = path.join(home, "Library", "Application Support", "One Memory");
+ const installRoot = path.join(
+ home,
+ "Library",
+ "Application Support",
+ "One Memory",
+ );
const target = path.join(installRoot, "current", "bin", "one-memory");
await mkdir(path.dirname(target), { recursive: true });
await writeFile(target, "#!/bin/sh\n", { mode: 0o700 });
@@ -43,10 +54,14 @@ it("installs only memhub and adds its directory to a new shell", async () => {
await installBundledCliIfNeeded({ home, installRoot, platform: "darwin" });
await installBundledCliIfNeeded({ home, installRoot, platform: "darwin" });
- expect(await readlink(path.join(home, ".local", "bin", "memhub"))).toBe(target);
+ expect(await readlink(path.join(home, ".local", "bin", "memhub"))).toBe(
+ target,
+ );
const profile = await readFile(path.join(home, ".zprofile"), "utf8");
expect(profile.match(/# >>> memhub PATH >>>/g)).toHaveLength(1);
- await expect(readFile(path.join(home, ".local", "bin", "one-memory"))).rejects.toThrow();
+ await expect(
+ readFile(path.join(home, ".local", "bin", "one-memory")),
+ ).rejects.toThrow();
});
describe("ensureStableRuntimeThenRepair", () => {
diff --git a/memhub/apps/desktop/src/stable-runtime.ts b/memhub/apps/desktop/src/stable-runtime.ts
index 570dcbd..dab2036 100644
--- a/memhub/apps/desktop/src/stable-runtime.ts
+++ b/memhub/apps/desktop/src/stable-runtime.ts
@@ -1,4 +1,12 @@
-import { chmod, lstat, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
+import {
+ chmod,
+ lstat,
+ mkdir,
+ readFile,
+ rename,
+ rm,
+ writeFile,
+} from "node:fs/promises";
import path from "node:path";
import { installCliLink, planCliLink } from "@one-memory/runtime-control";
@@ -36,13 +44,22 @@ async function ensureCliPath(
binDirectory: string,
platform: NodeJS.Platform,
): Promise<void> {
- const profile = path.join(home, platform === "darwin" ? ".zprofile" : ".profile");
+ const profile = path.join(
+ home,
+ platform === "darwin" ? ".zprofile" : ".profile",
+ );
const existingInfo = await lstat(profile).catch(() => null);
- if (existingInfo?.isSymbolicLink() || (existingInfo && !existingInfo.isFile())) {
+ if (
+ existingInfo?.isSymbolicLink() ||
+ (existingInfo && !existingInfo.isFile())
+ ) {
throw new Error("shell_profile_unmanaged");
}
const existing = existingInfo ? await readFile(profile, "utf8") : "";
- if (existing.includes(CLI_PATH_BEGIN) || existing.split("\n").some((line) => line.includes(binDirectory))) {
+ if (
+ existing.includes(CLI_PATH_BEGIN) ||
+ existing.split("\n").some((line) => line.includes(binDirectory))
+ ) {
return;
}
await mkdir(home, { recursive: true, mode: 0o700 });
@@ -50,7 +67,10 @@ async function ensureCliPath(
const block = `${CLI_PATH_BEGIN}\nexport PATH="$HOME/.local/bin:$PATH"\n${CLI_PATH_END}\n`;
const temporary = `${profile}.memhub-${process.pid}`;
try {
- await writeFile(temporary, `${existing}${separator}${block}`, { encoding: "utf8", mode: 0o600 });
+ await writeFile(temporary, `${existing}${separator}${block}`, {
+ encoding: "utf8",
+ mode: 0o600,
+ });
await chmod(temporary, existingInfo ? existingInfo.mode & 0o777 : 0o600);
await rename(temporary, profile);
} finally {
diff --git a/memhub/apps/desktop/src/sync-hook.ts b/memhub/apps/desktop/src/sync-hook.ts
index da1e721..ae948f8 100644
--- a/memhub/apps/desktop/src/sync-hook.ts
+++ b/memhub/apps/desktop/src/sync-hook.ts
@@ -3,8 +3,8 @@ export {
hasSyncHookArtifacts,
loadSyncHookAssets,
orphanSyncHookIdentity,
- syncHookInput,
- syncHookPreview,
type SyncHookPreview,
type SyncHookStatus,
+ syncHookInput,
+ syncHookPreview,
} from "@one-memory/runtime-control";
diff --git a/memhub/apps/desktop/tsup.config.ts b/memhub/apps/desktop/tsup.config.ts
index aab1dd0..295f5b6 100644
--- a/memhub/apps/desktop/tsup.config.ts
+++ b/memhub/apps/desktop/tsup.config.ts
@@ -1,10 +1,11 @@
-import { defineConfig } from "tsup";
import { createRequire } from "node:module";
+import { defineConfig } from "tsup";
const require = createRequire(import.meta.url);
-const { resolveBuildVersion } = require("../../scripts/release-version.cjs") as {
- resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
-};
+const { resolveBuildVersion } =
+ require("../../scripts/release-version.cjs") as {
+ resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
+ };
const releaseVersion = resolveBuildVersion(process.env);
export default defineConfig({
diff --git a/memhub/apps/web/public/r6/deepseek.svg b/memhub/apps/web/public/r6/deepseek.svg
index 78ca1c8..9abb9b4 100644
--- a/memhub/apps/web/public/r6/deepseek.svg
+++ b/memhub/apps/web/public/r6/deepseek.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#4d6bfe" d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.5 5.5 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11 11 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428s-1.67.295-2.687.684a3 3 0 0 1-.465.137 9.6 9.6 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.2 4.2 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.7 4.7 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614m1-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.7 1.7 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.56.56 0 0 1-.254-.078.253.253 0 0 1-.114-.358c.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>DeepSeek</title><path fill="#4d6bfe" d="M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.5 5.5 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11 11 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428s-1.67.295-2.687.684a3 3 0 0 1-.465.137 9.6 9.6 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.2 4.2 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.7 4.7 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614m1-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.7 1.7 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.56.56 0 0 1-.254-.078.253.253 0 0 1-.114-.358c.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452"/></svg>
\ No newline at end of file
diff --git a/memhub/apps/web/public/r6/hermes.svg b/memhub/apps/web/public/r6/hermes.svg
index 2b1d77a..c5ae7c2 100644
--- a/memhub/apps/web/public/r6/hermes.svg
+++ b/memhub/apps/web/public/r6/hermes.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" fill="#1c1b1a" fill-rule="evenodd" viewBox="0 0 24 24"><path d="M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05q-.184-.146-.354-.291c-.011-.01-.016-.027-.025-.042m2.458-3.423c.195-.032.39-.06.588-.05a.5.5 0 0 1 .148.026q.303.107.601.224c.028.01.05.036.075.055l-.013.027a9 9 0 0 1-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144q.413.207.823.417c.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137-.244-.027-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.5.5 0 0 1 .159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.4 1.4 0 0 0-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.4 1.4 0 0 1-.218.211.477.477 0 0 1-.641-.05 1.4 1.4 0 0 1-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.9.9 0 0 0-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172-.039-.049.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476"/><path d="M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"/><path d="M11.981.009q.34-.017.679 0c.247.01.495.024.74.062q.602.097 1.19.273c.463.138.92.299 1.356.511a7.3 7.3 0 0 1 2.948 2.642q.436.704.739 1.479c.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a8 8 0 0 1-.017.88c-.037.413-.1.818-.226 1.212a5 5 0 0 1-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.6 3.6 0 0 0 .325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 0 1-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.52.52 0 0 0-.033.406.4.4 0 0 1 .013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.2 1.2 0 0 1-.06-.233c-.04-.314-.155-.6-.308-.87a3.9 3.9 0 0 0-.73-.91 2.1 2.1 0 0 0-.897-.524 4 4 0 0 0-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375q.021.092-.053.144c-.047.033-.122.034-.163-.01a.5.5 0 0 1-.08-.14c-.03-.073-.038-.159-.078-.225a7.3 7.3 0 0 0-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 0 0-.736.278 5 5 0 0 0-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531l-.012.051a.096.096 0 0 1-.09.076h-.31c-.046 0-.082-.048-.072-.094q.033-.162.07-.324c.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.2.2 0 0 0-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.3 7.3 0 0 0-1.07 1.767 1 1 0 0 0-.04.12.075.075 0 0 1-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24q.042-.042.079-.085l-.018-.025-.135.041q-.053.023-.102.05c-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488q-.188.214-.373.431A.15.15 0 0 1 9.89 24H8.762l.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a5 5 0 0 0-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037q.106-.133.209-.268c.001-.002-.006-.012-.012-.024q-.022.004-.045.013-.264.135-.527.274a.4.4 0 0 1-.168.042H5.202c-.026 0-.039-.036-.019-.053a3 3 0 0 0 .558-.605c.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a2 2 0 0 1-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.5 3.5 0 0 1 1.97 20.6a2.3 2.3 0 0 1-.808-1.13 3.6 3.6 0 0 1-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46q.128.534.516.92c.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.9 1.9 0 0 0 .621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011q-.048.075-.093.152A2.7 2.7 0 0 1 3.625 19.6c-.351.17-.718.255-1.11.159a1.6 1.6 0 0 1-.971-.64 2 2 0 0 1-.368-.924 2.9 2.9 0 0 1 .02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.9 1.9 0 0 0-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.58.58 0 0 0 .386-.131 1.2 1.2 0 0 0 .366-.481c.168-.375.24-.777.309-1.179q.074-.444.133-.893c.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696l.076-.683q.036-.34.069-.683l.034-.42.037-.417q.031-.375.065-.748c.008-.082-.02-.132-.09-.177a2.5 2.5 0 0 1-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.1 2.1 0 0 0 .275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a5 5 0 0 1-.22-.057 2.7 2.7 0 0 1-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.2 5.2 0 0 1 .014-1.06q.106-.905.45-1.745c.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448a12.8 12.8 0 0 1 2.277-1.233A11 11 0 0 1 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.2.2 0 0 0 .093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12zm1.65-3.695a5.5 5.5 0 0 0-.653.593l-.37.386a.96.96 0 0 1-.377.25 1.4 1.4 0 0 1-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131l.45.724c.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048q.435-.204.867-.412c.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5 5 0 0 1-.506-.42 1.8 1.8 0 0 1-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.4 3.4 0 0 1-.555 1.01q-.3.373-.762.493c-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023q.272-.055.485-.234c.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164m14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.2 6.2 0 0 1-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064q.13-.124.248-.255c.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881l-.024-.055zM5.797 8.29a.26.26 0 0 0 .018.153q.186.376.379.75c.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132q-.08.062-.161.122a.24.24 0 0 0-.103.245.8.8 0 0 0 .055.195c.083.196.22.35.375.492q.126.116.222.257a.37.37 0 0 1 .025.377q-.036.075-.076.148c-.03.06-.028.111.022.162q.063.064.112.138c.038.058.078.079.147.05a.5.5 0 0 1 .333-.006c.16.046.302.126.444.21q.195.115.4.219c.067.035.14.05.219.026.071-.022.124.01.145.076q.031.094-.074.139c-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.21.21 0 0 0-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03a3 3 0 0 1-.231-.197.47.47 0 0 1-.157-.311.5.5 0 0 0-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.2 1.2 0 0 1-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.7.7 0 0 0 .047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173q.4.753.812 1.5c.055.098.13.189.208.27.198.202.452.272.724.273q.303.002.605-.026c.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03q.194-.182.394-.36c.067-.059.088-.12.067-.213a3.5 3.5 0 0 1-.085-.796q.002-.236.018-.471c.015-.224.03-.45.06-.672a59 59 0 0 1 .362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043q.051-.411.063-.825c.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a6 6 0 0 0-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06a31 31 0 0 0-.582.21 2.7 2.7 0 0 0-.675.394 1 1 0 0 1-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306l.073-.095-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.6 3.6 0 0 1-.733-.786zm8.592 8.963-.147.09q-.33.2-.659.402-.14.087-.27.188c-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.29.29 0 0 0 .087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169m-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138q-.018-.196-.034-.393l-.068-.886-.029-.31q-.013 0-.026-.004m3.081-8.13.099.285c.08.231.159.463.24.714l.58 1.952q.28.946.558 1.893c.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638l-.046-.211c-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336a12 12 0 0 0-.115-.322q-.061-.159-.127-.314l-.027.01zm-10.988 7.59c-.063-.001-.115.014-.134.083a.35.35 0 0 0 .41.012 5 5 0 0 0-.276-.095M5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115m.062-1.189a.14.14 0 0 0-.088.056.2.2 0 0 0-.025.11c.005.152.01.306.026.457a.8.8 0 0 0 .066.218q.091.202.288.101c.055-.027.06-.054.025-.11a5 5 0 0 1-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19v-.141c-.003-.038-.006-.087-.056-.083m-.017-.968a.87.87 0 0 0-.467.127c-.076.045-.084.07-.05.158q.05.131.115.254c.064.117.09.125.21.077a.66.66 0 0 1 .336-.053c.202.022.357.136.504.264l.092.077q.01-.01.022-.018c-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172m10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065q.066-.022.13-.046c.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a1 1 0 0 0-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.3.3 0 0 0 .002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.4.4 0 0 0 .253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394M10.397.497c-.2-.008-.405.004-.603.034q-.355.054-.7.152c-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058q.041.02.07.014c.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.1 1.1 0 0 0-.268.358.16.16 0 0 0 .083-.039c.08-.086.162-.172.235-.265a.56.56 0 0 0 .13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408q.13-.025.26-.042c.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.15.15 0 0 0-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.3 2.3 0 0 0-.544-.32l-.173-.075a.2.2 0 0 1-.126-.191.19.19 0 0 1 .128-.187l.059-.025c.099-.044.118-.076.112-.187a.4.4 0 0 0-.008-.063c-.067-.294-.123-.59-.205-.88a9.5 9.5 0 0 0-.826-2.036 7.5 7.5 0 0 0-1.39-1.805 4.5 4.5 0 0 0-1.177-.824 3.7 3.7 0 0 0-1.016-.328 6 6 0 0 0-.712-.074m6.719 5.955c.01.014.018.028.038.034l-.022-.044zM4.103 3.917a.1.1 0 0 1-.03.012l-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.13.13 0 0 0-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152l-.175.491c-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561q.133-.199.283-.401c.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04zm12.976 2.408a.02.02 0 0 1 .009.019l-.006.01.007.02.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038zM4.199 4.48c-.003.004-.008.008-.027.014a.14.14 0 0 1-.031.047 2 2 0 0 1-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a3 3 0 0 1-.079.264l-.033.155.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.1.1 0 0 1 .025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017a.1.1 0 0 1-.026.045.1.1 0 0 1-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6 6 0 0 1 .229-.518l-.007-.02a.1.1 0 0 1-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165a.27.27 0 0 1 .147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151q.044-.023.092-.042c.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.2.2 0 0 0 .022-.098l.002-.371c0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3 3 0 0 0-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03l-.137.382c-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178q.076-.021.114.054c.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241zm.278.358c-.096-.01-.107.01-.11.108a1 1 0 0 0 .002.115c.03.2.099.386.174.57q.005.008.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a1 1 0 0 0-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a5 5 0 0 1-.286-.29l-.104-.113-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205q-.123-.014-.246-.032c-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116q.06.11-.03.196l-.178.181a.18.18 0 0 1-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13q-.067-.104-.136-.207a.2.2 0 0 0-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.82.82 0 0 1 .458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013-.427-.934c.055.007.083.007.108.016q.29.105.577.216.111.042.219.094.091.043.157-.033.076-.084.154-.167.076-.076.132.014c.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a2 2 0 0 1-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06q.108.163.215.33c.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025q.137.187.277.371c.02.027.05.047.069.087l.04.063.019-.015a.3.3 0 0 1-.053-.082 28 28 0 0 1-.332-.49c-.221-.311-.363-.467-.485-.521m-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366a.8.8 0 0 1 .115-.36c.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.14.14 0 0 0-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a4 4 0 0 0-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285q-.074.053-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108" clip-rule="evenodd"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" fill="#1c1b1a" fill-rule="evenodd" viewBox="0 0 24 24"><title>Hermes</title><path d="M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05q-.184-.146-.354-.291c-.011-.01-.016-.027-.025-.042m2.458-3.423c.195-.032.39-.06.588-.05a.5.5 0 0 1 .148.026q.303.107.601.224c.028.01.05.036.075.055l-.013.027a9 9 0 0 1-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144q.413.207.823.417c.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137-.244-.027-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.5.5 0 0 1 .159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.4 1.4 0 0 0-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.4 1.4 0 0 1-.218.211.477.477 0 0 1-.641-.05 1.4 1.4 0 0 1-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.9.9 0 0 0-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172-.039-.049.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476"/><path d="M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"/><path d="M11.981.009q.34-.017.679 0c.247.01.495.024.74.062q.602.097 1.19.273c.463.138.92.299 1.356.511a7.3 7.3 0 0 1 2.948 2.642q.436.704.739 1.479c.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a8 8 0 0 1-.017.88c-.037.413-.1.818-.226 1.212a5 5 0 0 1-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.6 3.6 0 0 0 .325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 0 1-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.52.52 0 0 0-.033.406.4.4 0 0 1 .013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.2 1.2 0 0 1-.06-.233c-.04-.314-.155-.6-.308-.87a3.9 3.9 0 0 0-.73-.91 2.1 2.1 0 0 0-.897-.524 4 4 0 0 0-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375q.021.092-.053.144c-.047.033-.122.034-.163-.01a.5.5 0 0 1-.08-.14c-.03-.073-.038-.159-.078-.225a7.3 7.3 0 0 0-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 0 0-.736.278 5 5 0 0 0-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531l-.012.051a.096.096 0 0 1-.09.076h-.31c-.046 0-.082-.048-.072-.094q.033-.162.07-.324c.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.2.2 0 0 0-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.3 7.3 0 0 0-1.07 1.767 1 1 0 0 0-.04.12.075.075 0 0 1-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24q.042-.042.079-.085l-.018-.025-.135.041q-.053.023-.102.05c-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488q-.188.214-.373.431A.15.15 0 0 1 9.89 24H8.762l.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a5 5 0 0 0-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037q.106-.133.209-.268c.001-.002-.006-.012-.012-.024q-.022.004-.045.013-.264.135-.527.274a.4.4 0 0 1-.168.042H5.202c-.026 0-.039-.036-.019-.053a3 3 0 0 0 .558-.605c.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a2 2 0 0 1-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.5 3.5 0 0 1 1.97 20.6a2.3 2.3 0 0 1-.808-1.13 3.6 3.6 0 0 1-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46q.128.534.516.92c.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.9 1.9 0 0 0 .621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011q-.048.075-.093.152A2.7 2.7 0 0 1 3.625 19.6c-.351.17-.718.255-1.11.159a1.6 1.6 0 0 1-.971-.64 2 2 0 0 1-.368-.924 2.9 2.9 0 0 1 .02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.9 1.9 0 0 0-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.58.58 0 0 0 .386-.131 1.2 1.2 0 0 0 .366-.481c.168-.375.24-.777.309-1.179q.074-.444.133-.893c.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696l.076-.683q.036-.34.069-.683l.034-.42.037-.417q.031-.375.065-.748c.008-.082-.02-.132-.09-.177a2.5 2.5 0 0 1-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.1 2.1 0 0 0 .275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a5 5 0 0 1-.22-.057 2.7 2.7 0 0 1-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.2 5.2 0 0 1 .014-1.06q.106-.905.45-1.745c.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448a12.8 12.8 0 0 1 2.277-1.233A11 11 0 0 1 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.2.2 0 0 0 .093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12zm1.65-3.695a5.5 5.5 0 0 0-.653.593l-.37.386a.96.96 0 0 1-.377.25 1.4 1.4 0 0 1-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131l.45.724c.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048q.435-.204.867-.412c.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5 5 0 0 1-.506-.42 1.8 1.8 0 0 1-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.4 3.4 0 0 1-.555 1.01q-.3.373-.762.493c-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023q.272-.055.485-.234c.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164m14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.2 6.2 0 0 1-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064q.13-.124.248-.255c.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881l-.024-.055zM5.797 8.29a.26.26 0 0 0 .018.153q.186.376.379.75c.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132q-.08.062-.161.122a.24.24 0 0 0-.103.245.8.8 0 0 0 .055.195c.083.196.22.35.375.492q.126.116.222.257a.37.37 0 0 1 .025.377q-.036.075-.076.148c-.03.06-.028.111.022.162q.063.064.112.138c.038.058.078.079.147.05a.5.5 0 0 1 .333-.006c.16.046.302.126.444.21q.195.115.4.219c.067.035.14.05.219.026.071-.022.124.01.145.076q.031.094-.074.139c-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.21.21 0 0 0-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03a3 3 0 0 1-.231-.197.47.47 0 0 1-.157-.311.5.5 0 0 0-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.2 1.2 0 0 1-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.7.7 0 0 0 .047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173q.4.753.812 1.5c.055.098.13.189.208.27.198.202.452.272.724.273q.303.002.605-.026c.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03q.194-.182.394-.36c.067-.059.088-.12.067-.213a3.5 3.5 0 0 1-.085-.796q.002-.236.018-.471c.015-.224.03-.45.06-.672a59 59 0 0 1 .362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043q.051-.411.063-.825c.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a6 6 0 0 0-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06a31 31 0 0 0-.582.21 2.7 2.7 0 0 0-.675.394 1 1 0 0 1-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306l.073-.095-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.6 3.6 0 0 1-.733-.786zm8.592 8.963-.147.09q-.33.2-.659.402-.14.087-.27.188c-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.29.29 0 0 0 .087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169m-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138q-.018-.196-.034-.393l-.068-.886-.029-.31q-.013 0-.026-.004m3.081-8.13.099.285c.08.231.159.463.24.714l.58 1.952q.28.946.558 1.893c.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638l-.046-.211c-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336a12 12 0 0 0-.115-.322q-.061-.159-.127-.314l-.027.01zm-10.988 7.59c-.063-.001-.115.014-.134.083a.35.35 0 0 0 .41.012 5 5 0 0 0-.276-.095M5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115m.062-1.189a.14.14 0 0 0-.088.056.2.2 0 0 0-.025.11c.005.152.01.306.026.457a.8.8 0 0 0 .066.218q.091.202.288.101c.055-.027.06-.054.025-.11a5 5 0 0 1-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19v-.141c-.003-.038-.006-.087-.056-.083m-.017-.968a.87.87 0 0 0-.467.127c-.076.045-.084.07-.05.158q.05.131.115.254c.064.117.09.125.21.077a.66.66 0 0 1 .336-.053c.202.022.357.136.504.264l.092.077q.01-.01.022-.018c-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172m10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065q.066-.022.13-.046c.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a1 1 0 0 0-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.3.3 0 0 0 .002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.4.4 0 0 0 .253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394M10.397.497c-.2-.008-.405.004-.603.034q-.355.054-.7.152c-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058q.041.02.07.014c.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.1 1.1 0 0 0-.268.358.16.16 0 0 0 .083-.039c.08-.086.162-.172.235-.265a.56.56 0 0 0 .13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408q.13-.025.26-.042c.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.15.15 0 0 0-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.3 2.3 0 0 0-.544-.32l-.173-.075a.2.2 0 0 1-.126-.191.19.19 0 0 1 .128-.187l.059-.025c.099-.044.118-.076.112-.187a.4.4 0 0 0-.008-.063c-.067-.294-.123-.59-.205-.88a9.5 9.5 0 0 0-.826-2.036 7.5 7.5 0 0 0-1.39-1.805 4.5 4.5 0 0 0-1.177-.824 3.7 3.7 0 0 0-1.016-.328 6 6 0 0 0-.712-.074m6.719 5.955c.01.014.018.028.038.034l-.022-.044zM4.103 3.917a.1.1 0 0 1-.03.012l-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.13.13 0 0 0-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152l-.175.491c-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561q.133-.199.283-.401c.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04zm12.976 2.408a.02.02 0 0 1 .009.019l-.006.01.007.02.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038zM4.199 4.48c-.003.004-.008.008-.027.014a.14.14 0 0 1-.031.047 2 2 0 0 1-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a3 3 0 0 1-.079.264l-.033.155.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.1.1 0 0 1 .025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017a.1.1 0 0 1-.026.045.1.1 0 0 1-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6 6 0 0 1 .229-.518l-.007-.02a.1.1 0 0 1-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165a.27.27 0 0 1 .147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151q.044-.023.092-.042c.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.2.2 0 0 0 .022-.098l.002-.371c0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3 3 0 0 0-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03l-.137.382c-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178q.076-.021.114.054c.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241zm.278.358c-.096-.01-.107.01-.11.108a1 1 0 0 0 .002.115c.03.2.099.386.174.57q.005.008.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a1 1 0 0 0-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a5 5 0 0 1-.286-.29l-.104-.113-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205q-.123-.014-.246-.032c-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116q.06.11-.03.196l-.178.181a.18.18 0 0 1-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13q-.067-.104-.136-.207a.2.2 0 0 0-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.82.82 0 0 1 .458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013-.427-.934c.055.007.083.007.108.016q.29.105.577.216.111.042.219.094.091.043.157-.033.076-.084.154-.167.076-.076.132.014c.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a2 2 0 0 1-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06q.108.163.215.33c.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025q.137.187.277.371c.02.027.05.047.069.087l.04.063.019-.015a.3.3 0 0 1-.053-.082 28 28 0 0 1-.332-.49c-.221-.311-.363-.467-.485-.521m-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366a.8.8 0 0 1 .115-.36c.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.14.14 0 0 0-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a4 4 0 0 0-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285q-.074.053-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108" clip-rule="evenodd"/></svg>
\ No newline at end of file
diff --git a/memhub/apps/web/public/r6/openclaw.svg b/memhub/apps/web/public/r6/openclaw.svg
index 86335cf..1566cb9 100644
--- a/memhub/apps/web/public/r6/openclaw.svg
+++ b/memhub/apps/web/public/r6/openclaw.svg
@@ -1,4 +1,4 @@
-<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
+<svg width="120" height="120" viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg"><title>OpenClaw</title>
<defs>
<linearGradient id="ocLG" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#ff4d4d"/>
diff --git a/memhub/apps/web/public/r6/opencode.svg b/memhub/apps/web/public/r6/opencode.svg
index c57f89f..0db326a 100644
--- a/memhub/apps/web/public/r6/opencode.svg
+++ b/memhub/apps/web/public/r6/opencode.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" fill="#1c1b1a" fill-rule="evenodd" viewBox="0 0 24 24"><path d="M16 6H8v12h8zm4 16H4V2h16z"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" fill="#1c1b1a" fill-rule="evenodd" viewBox="0 0 24 24"><title>OpenCode</title><path d="M16 6H8v12h8zm4 16H4V2h16z"/></svg>
\ No newline at end of file
diff --git a/memhub/apps/web/public/r6/pi.svg b/memhub/apps/web/public/r6/pi.svg
index 0616cd6..a2ec5d9 100644
--- a/memhub/apps/web/public/r6/pi.svg
+++ b/memhub/apps/web/public/r6/pi.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800"><rect width="800" height="800" rx="120" fill="#09090b"/><path fill="#fff" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="#fff" d="M517.36 400H634.72V634.72H517.36Z"/></svg>
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800"><title>Pi</title><rect width="800" height="800" rx="120" fill="#09090b"/><path fill="#fff" fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/><path fill="#fff" d="M517.36 400H634.72V634.72H517.36Z"/></svg>
diff --git a/memhub/apps/web/src/ApplicationDetail.test.tsx b/memhub/apps/web/src/ApplicationDetail.test.tsx
index 9cd1e94..751d79d 100644
--- a/memhub/apps/web/src/ApplicationDetail.test.tsx
+++ b/memhub/apps/web/src/ApplicationDetail.test.tsx
@@ -1028,20 +1028,20 @@ it("does not keep WorkBuddy looking synced when the server write fails", async (
screen.getByRole("switch", { name: "同步开关" }),
);
expect(
- screen.getByRole("alert").compareDocumentPosition(
- screen.getByRole("switch", { name: "同步开关" }),
- ) & Node.DOCUMENT_POSITION_FOLLOWING,
+ screen
+ .getByRole("alert")
+ .compareDocumentPosition(
+ screen.getByRole("switch", { name: "同步开关" }),
+ ) & Node.DOCUMENT_POSITION_FOLLOWING,
).toBeTruthy();
});
it("disables connection and explains why outside Applications, and stays enabled when in Applications", async () => {
window.oneMemory = {
- getConnectionSetupCapability: vi
- .fn()
- .mockResolvedValue({
- available: false,
- reason: "app_not_in_applications",
- }),
+ getConnectionSetupCapability: vi.fn().mockResolvedValue({
+ available: false,
+ reason: "app_not_in_applications",
+ }),
} as unknown as NonNullable<typeof window.oneMemory>;
render(<ApplicationDetail {...props} />);
await waitFor(() =>
@@ -1106,13 +1106,9 @@ it("promises a backfill when the switch is turned back on (D97)", async () => {
/>,
);
expect(screen.queryByText(/将补充冻结期间的新对话/)).toBeNull();
- fireEvent.click(
- await screen.findByRole("switch", { name: "同步开关" }),
- );
+ fireEvent.click(await screen.findByRole("switch", { name: "同步开关" }));
await waitFor(() =>
- expect(
- screen.getByText(/将补充冻结期间的新对话/),
- ).toBeTruthy(),
+ expect(screen.getByText(/将补充冻结期间的新对话/)).toBeTruthy(),
);
});
@@ -1135,15 +1131,11 @@ it("says sync is being turned on while the write is in flight (D77)", async () =
);
const sync = await screen.findByRole("switch", { name: "同步开关" });
fireEvent.click(sync);
- await waitFor(() =>
- expect(screen.getByText("正在开启处理…")).toBeTruthy(),
- );
+ await waitFor(() => expect(screen.getByText("正在开启处理…")).toBeTruthy());
expect(screen.getByRole("status").textContent).toContain("一两分钟");
expect(screen.queryByText("处理中")).toBeNull();
finish();
- await waitFor(() =>
- expect(screen.queryByText("正在开启处理…")).toBeNull(),
- );
+ await waitFor(() => expect(screen.queryByText("正在开启处理…")).toBeNull());
});
it("sends a click made while the remembered sync is still writing (D77)", async () => {
diff --git a/memhub/apps/web/src/ApplicationDetail.tsx b/memhub/apps/web/src/ApplicationDetail.tsx
index d45b589..72664e8 100644
--- a/memhub/apps/web/src/ApplicationDetail.tsx
+++ b/memhub/apps/web/src/ApplicationDetail.tsx
@@ -517,7 +517,9 @@ export function ApplicationDetail({
)}
{hostError && <p role="alert">{hostError}</p>}
{appLocationNote && <p role="status">{appLocationNote}</p>}
- {hostRestartNotice ? <p role="status">{hostRestartNotice}</p> : null}
+ {hostRestartNotice ? (
+ <p role="status">{hostRestartNotice}</p>
+ ) : null}
</div>
<R6Switch
label="一键插入应用"
diff --git a/memhub/apps/web/src/ApplicationsHome.test.tsx b/memhub/apps/web/src/ApplicationsHome.test.tsx
index a62e1dc..fb0efc0 100644
--- a/memhub/apps/web/src/ApplicationsHome.test.tsx
+++ b/memhub/apps/web/src/ApplicationsHome.test.tsx
@@ -19,15 +19,21 @@ import { saveConnectionPreferences } from "./connection-preferences";
import { resetConnectionReconcile } from "./connection-reconcile";
import { queryClient } from "./query-client";
-const { summary, processing, permission, history, liveSync, recentConversations } =
- vi.hoisted(() => ({
- summary: vi.fn(),
- processing: vi.fn(),
- permission: vi.fn(),
- history: vi.fn(),
- liveSync: vi.fn(),
- recentConversations: vi.fn(),
- }));
+const {
+ summary,
+ processing,
+ permission,
+ history,
+ liveSync,
+ recentConversations,
+} = vi.hoisted(() => ({
+ summary: vi.fn(),
+ processing: vi.fn(),
+ permission: vi.fn(),
+ history: vi.fn(),
+ liveSync: vi.fn(),
+ recentConversations: vi.fn(),
+}));
vi.mock("./call-history-client", async (original) => ({
...(await original<typeof import("./call-history-client")>()),
getCallHistory: history,
@@ -116,7 +122,7 @@ it("hides a debug-frame dialogue excerpt from 最近更新 and falls back to mem
created_at: "2026-10-12T06:06:00Z",
imported_at: "2026-10-12T06:06:00Z",
time_basis: "conversation",
- excerpt: '[write_stdout] {"chars":"{\\\"session_id\\":93099}',
+ excerpt: '[write_stdout] {"chars":"{\\"session_id\\":93099}',
truncated: false,
},
],
@@ -556,9 +562,7 @@ it("shows disabled model-content permission and opens settings", async () => {
0,
);
expect(screen.getByText("新的对话不会再整理成记忆")).toBeTruthy();
- fireEvent.click(
- screen.getByRole("button", { name: "打开模型内容权限" }),
- );
+ fireEvent.click(screen.getByRole("button", { name: "打开模型内容权限" }));
expect(onSettings).toHaveBeenCalledOnce();
});
afterEach(() => {
diff --git a/memhub/apps/web/src/ApplicationsHome.tsx b/memhub/apps/web/src/ApplicationsHome.tsx
index afbf8b2..3042aa2 100644
--- a/memhub/apps/web/src/ApplicationsHome.tsx
+++ b/memhub/apps/web/src/ApplicationsHome.tsx
@@ -31,13 +31,13 @@ import {
retryAutoReconcile,
useAutoConnect,
} from "./connection-reconcile";
+import { HomeCardBoundary } from "./HomeCardBoundary";
import {
hostBridgeAvailable,
hostConnectionApproved,
hostConnectionUnknown,
useRecallHosts,
} from "./host-state";
-import { HomeCardBoundary } from "./HomeCardBoundary";
import { subscribePoll } from "./poll-scheduler";
import { R6Button } from "./R6Controls";
import { prefetchDataRuntime } from "./runtime-state";
@@ -804,214 +804,214 @@ export function ApplicationsHome({
inert={expanded || phase !== "idle"}
>
<HomeCardBoundary label="记忆概览">
- <section className="r6-home-overview" aria-label="记忆概览">
- <header>
- <h2>记忆概览</h2>
- </header>
- <div className="r6-home-metrics">
- <div>
- <p>已沉淀记忆</p>
- {/* The figure slot used to hold the word 读取中 while the first
+ <section className="r6-home-overview" aria-label="记忆概览">
+ <header>
+ <h2>记忆概览</h2>
+ </header>
+ <div className="r6-home-metrics">
+ <div>
+ <p>已沉淀记忆</p>
+ {/* The figure slot used to hold the word 读取中 while the first
read was in flight, which is how "大数字不可见" (D51) shows up
on a slow link: the biggest type on the page spends the first
frame saying something that is not a number. A bar of the same
height reserves the digits instead, and the wording moves to a
live region so screen readers still hear it. 暂无法读取 stays a
word, because that is a settled state rather than progress. */}
- {!visible && !summaryUnavailable ? (
- <>
- <p className="r6-home-figure">
- <span
- className="r6-home-figure-pending"
- aria-hidden="true"
- />
- </p>
- <small role="status">正在读取已沉淀记忆数量…</small>
- </>
+ {!visible && !summaryUnavailable ? (
+ <>
+ <p className="r6-home-figure">
+ <span
+ className="r6-home-figure-pending"
+ aria-hidden="true"
+ />
+ </p>
+ <small role="status">正在读取已沉淀记忆数量…</small>
+ </>
+ ) : (
+ <>
+ <p className="r6-home-figure">
+ <strong className={visible ? "" : "r6-home-word"}>
+ {visible
+ ? new Intl.NumberFormat("zh-CN").format(
+ visible.memory_count,
+ )
+ : "暂无法读取"}
+ </strong>
+ {visible ? <i>条</i> : null}
+ </p>
+ <small>按应用授权范围使用</small>
+ </>
+ )}
+ </div>
+ <div>
+ <p>沉淀状态</p>
+ <strong className="r6-home-word">{stateLabel}</strong>
+ <small>
+ {modelContentAllowed === false
+ ? "新的对话不会再整理成记忆"
+ : processing?.running
+ ? "新的对话正在整理"
+ : processing?.pending
+ ? "等待队列开始处理"
+ : "以当前处理状态为准"}
+ </small>
+ {modelContentAllowed === false ? (
+ <R6Button variant="quiet" onClick={() => onSettings()}>
+ 打开模型内容权限
+ </R6Button>
+ ) : null}
+ </div>
+ <div>
+ <p>最近更新</p>
+ <strong className={time ? "r6-home-time" : "r6-home-word"}>
+ {time ?? (visible ? "尚未生成" : "待核对")}
+ </strong>
+ <small>
+ {time
+ ? `${latestClock?.today ? "今天 · " : ""}记忆已保存`
+ : "历史与记忆分别处理"}
+ </small>
+ </div>
+ </div>
+ <div className="r6-home-activity">
+ {availableActivities.length > 1 &&
+ (activity === "call" ||
+ activity === "memory" ||
+ activity === "dialogue") ? (
+ <div className="r6-home-activity-tabs" role="tablist">
+ {(["update", "call"] as const).map((item) => (
+ <button
+ type="button"
+ role="tab"
+ key={item}
+ aria-selected={
+ item === "call"
+ ? activity === "call"
+ : activity === "memory" || activity === "dialogue"
+ }
+ onClick={() => setActivityView(item)}
+ >
+ {item === "call" ? "最近调用" : "最近更新"}
+ </button>
+ ))}
+ </div>
) : (
- <>
- <p className="r6-home-figure">
- <strong className={visible ? "" : "r6-home-word"}>
- {visible
- ? new Intl.NumberFormat("zh-CN").format(
- visible.memory_count,
- )
- : "暂无法读取"}
- </strong>
- {visible ? <i>条</i> : null}
- </p>
- <small>按应用授权范围使用</small>
- </>
+ <p>
+ {activity === "unavailable"
+ ? "动态暂不可用"
+ : activity === "call"
+ ? "最近调用"
+ : activity === "dialogue" || activity === "memory"
+ ? "最近更新"
+ : "首批沉淀"}
+ </p>
)}
- </div>
- <div>
- <p>沉淀状态</p>
- <strong className="r6-home-word">{stateLabel}</strong>
- <small>
- {modelContentAllowed === false
- ? "新的对话不会再整理成记忆"
- : processing?.running
- ? "新的对话正在整理"
- : processing?.pending
- ? "等待队列开始处理"
- : "以当前处理状态为准"}
- </small>
- {modelContentAllowed === false ? (
- <R6Button variant="quiet" onClick={() => onSettings()}>
- 打开模型内容权限
- </R6Button>
- ) : null}
- </div>
- <div>
- <p>最近更新</p>
- <strong className={time ? "r6-home-time" : "r6-home-word"}>
- {time ?? (visible ? "尚未生成" : "待核对")}
- </strong>
- <small>
- {time
- ? `${latestClock?.today ? "今天 · " : ""}记忆已保存`
- : "历史与记忆分别处理"}
- </small>
- </div>
- </div>
- <div className="r6-home-activity">
- {availableActivities.length > 1 &&
- (activity === "call" ||
- activity === "memory" ||
- activity === "dialogue") ? (
- <div className="r6-home-activity-tabs" role="tablist">
- {(["update", "call"] as const).map((item) => (
+ <div>
+ {activity === "call" && recentCall ? (
+ <div className="r6-home-call-direction" aria-hidden="true">
+ {recentCallSource ? (
+ <>
+ <AppMark id={recentCallSource.source_id} size={26} />
+ <ArrowRight size={22} />
+ </>
+ ) : null}
+ <AppMark
+ id={
+ recentCallHost?.source_id ??
+ recentCall.host_id ??
+ "unknown"
+ }
+ size={26}
+ />
+ </div>
+ ) : activity === "memory" && latest?.source_ids[0] ? (
+ (() => {
+ const source = imports.sources.find(
+ (item) => item.source_id === latest.source_ids[0],
+ );
+ return source ? <SourceMark source={source} /> : null;
+ })()
+ ) : activity === "dialogue" && latestDialogue ? (
+ (() => {
+ const source = imports.sources.find(
+ (item) => item.source_id === latestDialogue.source_id,
+ );
+ return source ? <SourceMark source={source} /> : null;
+ })()
+ ) : null}
+ <section>
+ <h3>
+ {activity === "unavailable"
+ ? callState === "unavailable"
+ ? "暂时无法读取调用记录"
+ : "暂时无法读取记忆状态"
+ : activity === "call" && recentCall
+ ? callDetailHeadline(
+ recentCall,
+ recentCallHost?.display_name ??
+ callHostName(recentCall.host_id),
+ )
+ : activity === "memory" && latest
+ ? `${latest.content}${latest.truncated ? "…" : ""}`
+ : activity === "dialogue" && latestDialogue
+ ? `${latestDialogue.excerpt}${latestDialogue.truncated ? "…" : ""}`
+ : activity === "importing"
+ ? "对话持续导入中,即将沉淀你的记忆"
+ : activity === "first-running"
+ ? "正在沉淀第一批记忆"
+ : activity === "first-queued"
+ ? "准备沉淀第一批记忆"
+ : activity === "loading"
+ ? "正在读取动态"
+ : "还没有已生成的记忆"}
+ </h3>
+ <small>
+ {activity === "unavailable"
+ ? callState === "unavailable"
+ ? "已有记忆仍可查看;重试不会发起新的调用。"
+ : "读取失败不会当作没有记忆。"
+ : activity === "call" && recentCall
+ ? `${stamped(recentCall.occurred_at)} · ${callRowDetail(recentCall)}${callState === "incomplete" ? " · 有几次调用没被记下来,列表可能不全" : ""}`
+ : activity === "memory" && latest
+ ? `${time} · ${memoryAction(latest.action)} · ${latest.source_ids.map((id) => imports.sources.find((s) => s.source_id === id)?.display_name ?? id).join("、")} · 版本 ${latest.revision}`
+ : activity === "dialogue" && latestDialogue
+ ? `${clockParts(latestDialogue.created_at ?? latestDialogue.imported_at)?.clock ?? "时间未知"} ${latestDialogue.time_basis === "conversation" ? "对话时间" : "导入时间"} · ${imports.sources.find((source) => source.source_id === latestDialogue.source_id)?.display_name ?? latestDialogue.source_id}`
+ : activity === "importing"
+ ? "对话正在后台持续保存。"
+ : "历史已保存,记忆生成后会显示在这里。"}
+ </small>
+ </section>
+ {(activity === "unavailable" ||
+ (activity === "call" && CALL_HISTORY_ENTRY_VISIBLE) ||
+ activity === "memory") && (
<button
type="button"
- role="tab"
- key={item}
- aria-selected={
- item === "call"
- ? activity === "call"
- : activity === "memory" || activity === "dialogue"
+ className="r6-home-activity-link"
+ onClick={
+ activity === "unavailable"
+ ? () => {
+ setRevision((n) => n + 1);
+ setCallRevision((n) => n + 1);
+ }
+ : activity === "call"
+ ? onCalls
+ : () => onMemories(latest?.memory_id)
}
- onClick={() => setActivityView(item)}
>
- {item === "call" ? "最近调用" : "最近更新"}
+ {activity === "unavailable"
+ ? "重新读取"
+ : activity === "call"
+ ? "查看记录"
+ : "查看记忆"}
+ {activity === "unavailable" ? null : (
+ <ArrowRight size={14} aria-hidden="true" />
+ )}
</button>
- ))}
+ )}
</div>
- ) : (
- <p>
- {activity === "unavailable"
- ? "动态暂不可用"
- : activity === "call"
- ? "最近调用"
- : activity === "dialogue" || activity === "memory"
- ? "最近更新"
- : "首批沉淀"}
- </p>
- )}
- <div>
- {activity === "call" && recentCall ? (
- <div className="r6-home-call-direction" aria-hidden="true">
- {recentCallSource ? (
- <>
- <AppMark id={recentCallSource.source_id} size={26} />
- <ArrowRight size={22} />
- </>
- ) : null}
- <AppMark
- id={
- recentCallHost?.source_id ??
- recentCall.host_id ??
- "unknown"
- }
- size={26}
- />
- </div>
- ) : activity === "memory" && latest?.source_ids[0] ? (
- (() => {
- const source = imports.sources.find(
- (item) => item.source_id === latest.source_ids[0],
- );
- return source ? <SourceMark source={source} /> : null;
- })()
- ) : activity === "dialogue" && latestDialogue ? (
- (() => {
- const source = imports.sources.find(
- (item) => item.source_id === latestDialogue.source_id,
- );
- return source ? <SourceMark source={source} /> : null;
- })()
- ) : null}
- <section>
- <h3>
- {activity === "unavailable"
- ? callState === "unavailable"
- ? "暂时无法读取调用记录"
- : "暂时无法读取记忆状态"
- : activity === "call" && recentCall
- ? callDetailHeadline(
- recentCall,
- recentCallHost?.display_name ??
- callHostName(recentCall.host_id),
- )
- : activity === "memory" && latest
- ? `${latest.content}${latest.truncated ? "…" : ""}`
- : activity === "dialogue" && latestDialogue
- ? `${latestDialogue.excerpt}${latestDialogue.truncated ? "…" : ""}`
- : activity === "importing"
- ? "对话持续导入中,即将沉淀你的记忆"
- : activity === "first-running"
- ? "正在沉淀第一批记忆"
- : activity === "first-queued"
- ? "准备沉淀第一批记忆"
- : activity === "loading"
- ? "正在读取动态"
- : "还没有已生成的记忆"}
- </h3>
- <small>
- {activity === "unavailable"
- ? callState === "unavailable"
- ? "已有记忆仍可查看;重试不会发起新的调用。"
- : "读取失败不会当作没有记忆。"
- : activity === "call" && recentCall
- ? `${stamped(recentCall.occurred_at)} · ${callRowDetail(recentCall)}${callState === "incomplete" ? " · 有几次调用没被记下来,列表可能不全" : ""}`
- : activity === "memory" && latest
- ? `${time} · ${memoryAction(latest.action)} · ${latest.source_ids.map((id) => imports.sources.find((s) => s.source_id === id)?.display_name ?? id).join("、")} · 版本 ${latest.revision}`
- : activity === "dialogue" && latestDialogue
- ? `${clockParts(latestDialogue.created_at ?? latestDialogue.imported_at)?.clock ?? "时间未知"} ${latestDialogue.time_basis === "conversation" ? "对话时间" : "导入时间"} · ${imports.sources.find((source) => source.source_id === latestDialogue.source_id)?.display_name ?? latestDialogue.source_id}`
- : activity === "importing"
- ? "对话正在后台持续保存。"
- : "历史已保存,记忆生成后会显示在这里。"}
- </small>
- </section>
- {(activity === "unavailable" ||
- (activity === "call" && CALL_HISTORY_ENTRY_VISIBLE) ||
- activity === "memory") && (
- <button
- type="button"
- className="r6-home-activity-link"
- onClick={
- activity === "unavailable"
- ? () => {
- setRevision((n) => n + 1);
- setCallRevision((n) => n + 1);
- }
- : activity === "call"
- ? onCalls
- : () => onMemories(latest?.memory_id)
- }
- >
- {activity === "unavailable"
- ? "重新读取"
- : activity === "call"
- ? "查看记录"
- : "查看记忆"}
- {activity === "unavailable" ? null : (
- <ArrowRight size={14} aria-hidden="true" />
- )}
- </button>
- )}
</div>
- </div>
- </section>
+ </section>
</HomeCardBoundary>
{attention ? (
<section className="r6-home-auto-failure" role="alert">
@@ -1038,81 +1038,81 @@ export function ApplicationsHome({
</section>
) : null}
<HomeCardBoundary label="运行状态">
- <aside className="r6-home-runtime">
- <h2>运行状态</h2>
- <h3>
- {connected
- ? "后台运行中"
- : imports.healthStale
- ? "连接状态待核对"
- : "服务未连接"}
- </h3>
- <p>仅处理已授权范围</p>
- <dl>
- <div>
- <dt>对话同步</dt>
- <dd>{syncState}</dd>
- </div>
- <div>
- <dt>记忆整理</dt>
- <dd>{stateLabel}</dd>
- </div>
- <div>
- <dt>应用访问</dt>
- <dd>{accessText}</dd>
- </div>
- </dl>
- {accessUnknownText ? (
- <div
- role="status"
- aria-label="应用接入核对"
- className="r6-home-auto-failure"
- >
- <p>{accessUnknownText}</p>
- <button
- type="button"
- className="r6-home-activity-link"
- disabled={hostQuery.isFetching}
- onClick={() => void hostQuery.refetch()}
+ <aside className="r6-home-runtime">
+ <h2>运行状态</h2>
+ <h3>
+ {connected
+ ? "后台运行中"
+ : imports.healthStale
+ ? "连接状态待核对"
+ : "服务未连接"}
+ </h3>
+ <p>仅处理已授权范围</p>
+ <dl>
+ <div>
+ <dt>对话同步</dt>
+ <dd>{syncState}</dd>
+ </div>
+ <div>
+ <dt>记忆整理</dt>
+ <dd>{stateLabel}</dd>
+ </div>
+ <div>
+ <dt>应用访问</dt>
+ <dd>{accessText}</dd>
+ </div>
+ </dl>
+ {accessUnknownText ? (
+ <div
+ role="status"
+ aria-label="应用接入核对"
+ className="r6-home-auto-failure"
>
- {hostQuery.isFetching ? "核对中…" : "重新核对"}
- </button>
- </div>
- ) : null}
- {hostStale ? (
- <p
- role="status"
- aria-label="应用接入状态"
- className="r6-home-auto-failure"
- >
- 应用接入状态暂时读取失败,当前为上次状态。
- </p>
- ) : null}
- {autoFailureText ? (
- <div role="alert" className="r6-home-auto-failure">
- <p>{`${autoFailureText}不会自动重试。`}</p>
- <button
- type="button"
- className="r6-home-activity-link"
- disabled={auto.running.length > 0}
- onClick={() =>
- void retryAutoReconcile({
- sources: imports.sources,
- setSync: imports.setSync,
- refresh: imports.refresh,
- })
- }
+ <p>{accessUnknownText}</p>
+ <button
+ type="button"
+ className="r6-home-activity-link"
+ disabled={hostQuery.isFetching}
+ onClick={() => void hostQuery.refetch()}
+ >
+ {hostQuery.isFetching ? "核对中…" : "重新核对"}
+ </button>
+ </div>
+ ) : null}
+ {hostStale ? (
+ <p
+ role="status"
+ aria-label="应用接入状态"
+ className="r6-home-auto-failure"
>
- 重新接入
- </button>
- </div>
- ) : null}
- <p className="r6-home-checked">
- {!checked
- ? "上次核对:待核对"
- : `上次核对:${checked.today ? "今天 " : ""}${checked.clock}`}
- </p>
- </aside>
+ 应用接入状态暂时读取失败,当前为上次状态。
+ </p>
+ ) : null}
+ {autoFailureText ? (
+ <div role="alert" className="r6-home-auto-failure">
+ <p>{`${autoFailureText}不会自动重试。`}</p>
+ <button
+ type="button"
+ className="r6-home-activity-link"
+ disabled={auto.running.length > 0}
+ onClick={() =>
+ void retryAutoReconcile({
+ sources: imports.sources,
+ setSync: imports.setSync,
+ refresh: imports.refresh,
+ })
+ }
+ >
+ 重新接入
+ </button>
+ </div>
+ ) : null}
+ <p className="r6-home-checked">
+ {!checked
+ ? "上次核对:待核对"
+ : `上次核对:${checked.today ? "今天 " : ""}${checked.clock}`}
+ </p>
+ </aside>
</HomeCardBoundary>
</div>
<section
diff --git a/memhub/apps/web/src/CallHistory.test.tsx b/memhub/apps/web/src/CallHistory.test.tsx
index 5e46e66..2c7bd78 100644
--- a/memhub/apps/web/src/CallHistory.test.tsx
+++ b/memhub/apps/web/src/CallHistory.test.tsx
@@ -439,7 +439,7 @@ it.each([
);
expect(
screen.getByRole("heading", {
- name: "未记录 · 09/20 11:03",
+ name: /^未记录 · 09\/20 \d{2}:03$/,
}),
).toBeTruthy();
expect(screen.getByText("没有找到相关内容")).toBeTruthy();
diff --git a/memhub/apps/web/src/CallHistory.tsx b/memhub/apps/web/src/CallHistory.tsx
index 4c8d6cd..6295fd8 100644
--- a/memhub/apps/web/src/CallHistory.tsx
+++ b/memhub/apps/web/src/CallHistory.tsx
@@ -14,9 +14,9 @@ import {
type CallHistoryPage,
callDeliveryLabel,
callDetailHeadline,
+ callReturnDeliveryLabel,
callRowDetail,
callRowHeadline,
- callReturnDeliveryLabel,
clearAllCallEvents,
clearCallEvents,
getCallHistory,
@@ -122,7 +122,9 @@ function CallReferences({
? "待核对"
: "不可用"}
</h4>
- {reference.source_id && <p>{sourceLabel(reference.source_id)}</p>}
+ {reference.source_id && (
+ <p>{sourceLabel(reference.source_id)}</p>
+ )}
</div>
{current?.available && current.reason === null && (
<R6Button
@@ -511,8 +513,9 @@ export function CallHistory({
{stateLabels[selected.state]}
</p>
<p className="call-history-stage">
- 找到原文 {selected.raw_count} 段 · 记忆 {selected.memory_count} 条
- · 用时 {(selected.elapsed_ms / 1000).toFixed(1)} 秒
+ 找到原文 {selected.raw_count} 段 · 记忆{" "}
+ {selected.memory_count} 条 · 用时{" "}
+ {(selected.elapsed_ms / 1000).toFixed(1)} 秒
</p>
{callDeliveryLabel(selected) && (
<p className="call-history-stage">
@@ -592,9 +595,7 @@ export function CallHistory({
{callRowHeadline(item)}
</button>
</h2>
- <p>
- {callRowDetail(item)}
- </p>
+ <p>{callRowDetail(item)}</p>
</div>
</li>
))}
diff --git a/memhub/apps/web/src/HealthPanel.test.tsx b/memhub/apps/web/src/HealthPanel.test.tsx
index 067a5dd..d36145c 100644
--- a/memhub/apps/web/src/HealthPanel.test.tsx
+++ b/memhub/apps/web/src/HealthPanel.test.tsx
@@ -168,7 +168,9 @@ describe("HealthPanel", () => {
expect(toggle.getAttribute("aria-checked")).toBe("false");
fireEvent.click(toggle);
await waitFor(() => expect(setDetailedLogging).toHaveBeenCalledWith(true));
- await waitFor(() => expect(toggle.getAttribute("aria-checked")).toBe("true"));
+ await waitFor(() =>
+ expect(toggle.getAttribute("aria-checked")).toBe("true"),
+ );
});
it("records a problem marker, copies its id and exports diagnostics", async () => {
diff --git a/memhub/apps/web/src/HistoryImport.tsx b/memhub/apps/web/src/HistoryImport.tsx
index c9983ac..3514d7a 100644
--- a/memhub/apps/web/src/HistoryImport.tsx
+++ b/memhub/apps/web/src/HistoryImport.tsx
@@ -353,9 +353,7 @@ export function HistoryImport({
await reviewSource(next, token);
settle("succeeded");
} catch (reason) {
- settle(
- saved ? "unknown" : apiErrorCode(reason) ? "failed" : "unknown",
- );
+ settle(saved ? "unknown" : apiErrorCode(reason) ? "failed" : "unknown");
if (active(token))
setError(
saved
diff --git a/memhub/apps/web/src/HomeCardBoundary.tsx b/memhub/apps/web/src/HomeCardBoundary.tsx
index 5c688bb..9d30730 100644
--- a/memhub/apps/web/src/HomeCardBoundary.tsx
+++ b/memhub/apps/web/src/HomeCardBoundary.tsx
@@ -36,7 +36,9 @@ export class HomeCardBoundary extends Component<Props, State> {
if (this.state.crashed) {
return (
<section className="r6-home-auto-failure" role="status">
- <p>{this.props.label}暂时显示不了,其他功能不受影响,稍后会自动恢复。</p>
+ <p>
+ {this.props.label}暂时显示不了,其他功能不受影响,稍后会自动恢复。
+ </p>
</section>
);
}
diff --git a/memhub/apps/web/src/ImportProgressStrip.tsx b/memhub/apps/web/src/ImportProgressStrip.tsx
index bd2d144..a5f7926 100644
--- a/memhub/apps/web/src/ImportProgressStrip.tsx
+++ b/memhub/apps/web/src/ImportProgressStrip.tsx
@@ -246,10 +246,19 @@ export function ImportProgressStrip({
const firstImport = !stale && runningHistory.length > 0;
const actionable =
currentArrival !== null &&
- ["model-required", "consent-required", "failed", "stopped", "unavailable"].includes(
- currentArrival.phase,
- );
- if (!firstImport && !actionable && !failed.length && !completedWithErrors.length) {
+ [
+ "model-required",
+ "consent-required",
+ "failed",
+ "stopped",
+ "unavailable",
+ ].includes(currentArrival.phase);
+ if (
+ !firstImport &&
+ !actionable &&
+ !failed.length &&
+ !completedWithErrors.length
+ ) {
return null;
}
const imported = sources.reduce(
@@ -264,14 +273,25 @@ export function ImportProgressStrip({
? "模型授权已撤回,新的对话不会再整理成记忆。"
: "有些内容没有处理完成,请前往设置查看。";
return (
- <div className="import-strip" role="status" aria-live="polite" data-feedback="compact">
+ <div
+ className="import-strip"
+ role="status"
+ aria-live="polite"
+ data-feedback="compact"
+ >
<div className="import-strip-headline">
<div className="import-strip-heading">
- {firstImport && <span className="import-strip-pulse" aria-hidden="true" />}
+ {firstImport && (
+ <span className="import-strip-pulse" aria-hidden="true" />
+ )}
<strong>{message}</strong>
</div>
{!firstImport && onConfigureModel && (
- <button type="button" className="secondary" onClick={onConfigureModel}>
+ <button
+ type="button"
+ className="secondary"
+ onClick={onConfigureModel}
+ >
<Settings2 size={15} aria-hidden="true" />
去设置
</button>
diff --git a/memhub/apps/web/src/MemoryNoteComposer.test.tsx b/memhub/apps/web/src/MemoryNoteComposer.test.tsx
index f2cc083..1ac6a8b 100644
--- a/memhub/apps/web/src/MemoryNoteComposer.test.tsx
+++ b/memhub/apps/web/src/MemoryNoteComposer.test.tsx
@@ -50,9 +50,7 @@ it("OBS-18: reads the configured model before saying it is not configured", asyn
page();
await userEvent.click(screen.getByRole("button", { name: "添加记忆" }));
expect(screen.getByText(/整理模型:/).textContent).toContain("正在读取");
- expect(
- screen.queryByRole("button", { name: "配置模型" }),
- ).toBeNull();
+ expect(screen.queryByRole("button", { name: "配置模型" })).toBeNull();
release([
{
profile_id: "p1",
diff --git a/memhub/apps/web/src/MemorySpace.test.tsx b/memhub/apps/web/src/MemorySpace.test.tsx
index 860abb5..700dd7a 100644
--- a/memhub/apps/web/src/MemorySpace.test.tsx
+++ b/memhub/apps/web/src/MemorySpace.test.tsx
@@ -706,9 +706,7 @@ describe("MemorySpace", () => {
// The arrival status belongs to the workbench surface, not the ask tab.
await userEvent.click(screen.getByRole("tab", { name: "工作台" }));
expect(screen.getByRole("region", { name: "记忆整理状态" })).toBeTruthy();
- expect(
- screen.getByText("等待允许模型读取本地会话内容"),
- ).toBeTruthy();
+ expect(screen.getByText("等待允许模型读取本地会话内容")).toBeTruthy();
expect(screen.queryByTestId("memory-graph")).toBeNull();
expectNoTeachingWrites();
});
diff --git a/memhub/apps/web/src/MemorySpace.tsx b/memhub/apps/web/src/MemorySpace.tsx
index 54ecd60..1e07296 100644
--- a/memhub/apps/web/src/MemorySpace.tsx
+++ b/memhub/apps/web/src/MemorySpace.tsx
@@ -284,11 +284,7 @@ export function MemorySpace({
null,
);
const [arrivalSetup, setArrivalSetup] = useState<
- | "checking"
- | "model-required"
- | "consent-required"
- | "ready"
- | "unavailable"
+ "checking" | "model-required" | "consent-required" | "ready" | "unavailable"
>("checking");
const [checkingSetup, setCheckingSetup] = useState(false);
const liveLoading = useRef(false);
@@ -318,7 +314,10 @@ export function MemorySpace({
]);
if (stopped || version !== request) return;
setCheckingSetup(false);
- if (profiles.status !== "fulfilled" || permission.status !== "fulfilled") {
+ if (
+ profiles.status !== "fulfilled" ||
+ permission.status !== "fulfilled"
+ ) {
setArrivalSetup("unavailable");
return;
}
@@ -351,6 +350,8 @@ export function MemorySpace({
// none"; not having read it yet means we do not know, and saying the first
// when we mean the second is how 483 memories came to look like zero.
const [loaded, setLoaded] = useState(false);
+ const loadedRef = useRef(loaded);
+ loadedRef.current = loaded;
/** Focus targets for the mode tablist's roving arrow-key navigation. */
const modeTabs = useRef<
Partial<
@@ -766,7 +767,7 @@ export function MemorySpace({
async function attemptLoad() {
if (cancelled || loading) return;
loading = true;
- if (loaded) {
+ if (loadedRef.current) {
refreshingTimer = window.setTimeout(() => {
if (!cancelled) setRefreshing(true);
}, 2_000);
@@ -777,7 +778,7 @@ export function MemorySpace({
if (!cancelled) {
// A failed refresh keeps the list on screen, so it says why the list
// may be behind. A quick successful one never flashes the hint.
- setRefreshing(!success && loaded);
+ setRefreshing(!success && loadedRef.current);
}
if (cancelled || success) return;
attempt += 1;
diff --git a/memhub/apps/web/src/ModelContentConsent.test.tsx b/memhub/apps/web/src/ModelContentConsent.test.tsx
index 9d405fd..d20cc7b 100644
--- a/memhub/apps/web/src/ModelContentConsent.test.tsx
+++ b/memhub/apps/web/src/ModelContentConsent.test.tsx
@@ -15,10 +15,14 @@ vi.mock("./ui-trace", () => ({
}));
beforeEach(() => {
- vi.mocked(api.getModelContentPermission).mockResolvedValue({ allowed: false });
- vi.mocked(api.setModelContentPermission).mockImplementation(async (allowed) => ({
- allowed,
- }));
+ vi.mocked(api.getModelContentPermission).mockResolvedValue({
+ allowed: false,
+ });
+ vi.mocked(api.setModelContentPermission).mockImplementation(
+ async (allowed) => ({
+ allowed,
+ }),
+ );
});
afterEach(() => {
@@ -46,12 +50,17 @@ it("writes the desired boolean and updates the switch", async () => {
await user.click(toggle);
await waitFor(() =>
- expect(api.setModelContentPermission).toHaveBeenCalledWith(true, "trace-id"),
+ expect(api.setModelContentPermission).toHaveBeenCalledWith(
+ true,
+ "trace-id",
+ ),
);
expect(toggle.getAttribute("aria-checked")).toBe("true");
});
it("states that generated-memory search is independent", async () => {
render(<ModelContentConsent onClose={vi.fn()} />);
- expect(await screen.findByText(/已生成记忆的搜索和读取不受影响/)).toBeTruthy();
+ expect(
+ await screen.findByText(/已生成记忆的搜索和读取不受影响/),
+ ).toBeTruthy();
});
diff --git a/memhub/apps/web/src/ModelContentConsent.tsx b/memhub/apps/web/src/ModelContentConsent.tsx
index c37e1fe..bddfa4d 100644
--- a/memhub/apps/web/src/ModelContentConsent.tsx
+++ b/memhub/apps/web/src/ModelContentConsent.tsx
@@ -19,9 +19,7 @@ export function ModelContentConsent({
useEffect(() => {
const before = document.activeElement;
- panel.current
- ?.querySelector<HTMLElement>("button:not(:disabled)")
- ?.focus();
+ panel.current?.querySelector<HTMLElement>("button:not(:disabled)")?.focus();
return () => {
if (before instanceof HTMLElement && before.isConnected) before.focus();
};
diff --git a/memhub/apps/web/src/ModelSettings.test.tsx b/memhub/apps/web/src/ModelSettings.test.tsx
index b8bb2bb..1b3ed31 100644
--- a/memhub/apps/web/src/ModelSettings.test.tsx
+++ b/memhub/apps/web/src/ModelSettings.test.tsx
@@ -800,9 +800,7 @@ describe("ModelSettings", () => {
profiles = [preset];
render(<ModelSettings />);
- expect(
- screen.getByRole("region", { name: "预配置模型服务" }),
- ).toBeTruthy();
+ expect(screen.getByRole("region", { name: "预配置模型服务" })).toBeTruthy();
// 贴一个 key 就能用的时候,没理由让人先面对协议、Base URL 和超时。
expect(screen.queryByLabelText("协议")).toBeNull();
expect(screen.getByRole("button", { name: "自定义一个模型" })).toBeTruthy();
@@ -862,10 +860,7 @@ describe("ModelSettings", () => {
const user = userEvent.setup();
render(<ModelSettings />);
- await user.type(
- screen.getByLabelText("粘贴 API Key"),
- "preset-key",
- );
+ await user.type(screen.getByLabelText("粘贴 API Key"), "preset-key");
await user.click(screen.getByRole("button", { name: "保存 key" }));
expect(update).toHaveBeenCalledWith("preset-1", {
diff --git a/memhub/apps/web/src/ModelSettings.tsx b/memhub/apps/web/src/ModelSettings.tsx
index f188dcd..deb169d 100644
--- a/memhub/apps/web/src/ModelSettings.tsx
+++ b/memhub/apps/web/src/ModelSettings.tsx
@@ -648,9 +648,7 @@ export function ModelSettings({
}
} catch {
if (alive.current) {
- setSaveError(
- "配置尚未保存成功,已填写内容保留,可核对后重试。",
- );
+ setSaveError("配置尚未保存成功,已填写内容保留,可核对后重试。");
}
} finally {
flight.current = false;
@@ -826,14 +824,13 @@ export function ModelSettings({
<div className="model-saved-heading">
<Check size={18} aria-hidden="true" />
<strong>
- {isReady(savedProfile) &&
- savedProfile.is_active
+ {isReady(savedProfile) && savedProfile.is_active
? "已保存,已启用"
: isReady(savedProfile)
- ? "已保存,连接通过"
- : models.probeFor(savedProfile)
- ? "已保存,测试未通过"
- : "已保存,待测试"}
+ ? "已保存,连接通过"
+ : models.probeFor(savedProfile)
+ ? "已保存,测试未通过"
+ : "已保存,待测试"}
</strong>
</div>
<h3>{savedProfile.name}</h3>
@@ -917,7 +914,7 @@ export function ModelSettings({
刷新配置列表
</button>
)}
- <label>
+ <div className="model-form-field">
服务商预设
<OptionMenu
ariaLabel="服务商预设"
@@ -954,7 +951,7 @@ export function ModelSettings({
只是帮你填好接口地址和一个模型名,不代表这个模型当前可用。
请对照服务商的模型列表核对后再保存。
</small>
- </label>
+ </div>
<label>
协议
<select
@@ -1245,11 +1242,7 @@ export function ModelSettings({
)}
<button
type="button"
- disabled={
- locked ||
- editChanged ||
- (!editing && unknownCreation)
- }
+ disabled={locked || editChanged || (!editing && unknownCreation)}
onClick={() => void persist(true)}
>
{setupPhase === "testing"
@@ -1350,10 +1343,7 @@ export function ModelSettings({
<>
<button
type="button"
- disabled={
- locked ||
- !isReady(profile)
- }
+ disabled={locked || !isReady(profile)}
onClick={() => models.activate(profile.profile_id)}
>
设为当前模型
diff --git a/memhub/apps/web/src/OnboardingFlow.test.tsx b/memhub/apps/web/src/OnboardingFlow.test.tsx
index c00208a..4474c44 100644
--- a/memhub/apps/web/src/OnboardingFlow.test.tsx
+++ b/memhub/apps/web/src/OnboardingFlow.test.tsx
@@ -332,9 +332,7 @@ describe("OnboardingFlow S1.3", () => {
connectForOnboarding: vi.fn(
() =>
new Promise<
- Awaited<
- ReturnType<ImportSourcesController["connectForOnboarding"]>
- >
+ Awaited<ReturnType<ImportSourcesController["connectForOnboarding"]>>
>((_resolve, reject) => {
rejectImport = reject;
}),
@@ -363,9 +361,9 @@ describe("OnboardingFlow S1.3", () => {
});
await act(async () => rejectImport(new Error("response lost")));
- expect(
- screen.getByRole("region", { name: "模型步骤边界" }),
- ).toBe(modelBoundary);
+ expect(screen.getByRole("region", { name: "模型步骤边界" })).toBe(
+ modelBoundary,
+ );
await user.click(screen.getByRole("button", { name: "返回导入" }));
await waitFor(() =>
expect(screen.getByRole("alert").textContent).toContain(
diff --git a/memhub/apps/web/src/OnboardingFlow.tsx b/memhub/apps/web/src/OnboardingFlow.tsx
index fd8651c..7b67009 100644
--- a/memhub/apps/web/src/OnboardingFlow.tsx
+++ b/memhub/apps/web/src/OnboardingFlow.tsx
@@ -188,6 +188,7 @@ export function OnboardingFlow({
accepted,
startingImport,
imports.sources,
+ modelSourceIds,
state.selected_source_ids,
]);
useEffect(() => {
@@ -431,7 +432,6 @@ export function OnboardingFlow({
await persistFinish(destination);
flight.current = false;
if (alive.current) setBusy(null);
-
},
[persistFinish],
);
@@ -616,8 +616,7 @@ export function OnboardingFlow({
: imports.sources;
const defaultDraft = defaultConnectionDraft(reviewSources, sourceIds);
const activeDraft =
- connectionTouched ||
- connectionDraft.hostSourceIds.length > 0
+ connectionTouched || connectionDraft.hostSourceIds.length > 0
? connectionDraft
: defaultDraft;
return (
diff --git a/memhub/apps/web/src/OnboardingModelController.tsx b/memhub/apps/web/src/OnboardingModelController.tsx
index f077314..48e8e73 100644
--- a/memhub/apps/web/src/OnboardingModelController.tsx
+++ b/memhub/apps/web/src/OnboardingModelController.tsx
@@ -1,7 +1,7 @@
import type {
+ ModelProbeResult,
ModelProfile,
ModelProfileInput,
- ModelProbeResult,
} from "@one-memory/contracts";
import { useRef, useState } from "react";
import { getModelProfiles, setModelContentPermission } from "./api";
diff --git a/memhub/apps/web/src/OnboardingModelStep.test.tsx b/memhub/apps/web/src/OnboardingModelStep.test.tsx
index 83a65c9..a087730 100644
--- a/memhub/apps/web/src/OnboardingModelStep.test.tsx
+++ b/memhub/apps/web/src/OnboardingModelStep.test.tsx
@@ -251,19 +251,12 @@ it("discloses that testing does not send historical conversations", () => {
expect(screen.getByText(/测试连接只发送测试内容/)).toBeTruthy();
expect(screen.getByText(/已导入 37 条对话/)).toBeTruthy();
- expect(
- screen.getByText(/启用时会打开全局模型内容权限/),
- ).toBeTruthy();
+ expect(screen.getByText(/启用时会打开全局模型内容权限/)).toBeTruthy();
});
it("does not expose an extra backlog selector in the first-run model page", () => {
const p = props();
- render(
- <OnboardingModelStep
- {...p}
- capability={{ saveAndEnable: true }}
- />,
- );
+ render(<OnboardingModelStep {...p} capability={{ saveAndEnable: true }} />);
fireEvent.click(screen.getByRole("button", { name: "确认启用" }));
expect(p.onSaveAndEnable).not.toHaveBeenCalled();
expect(screen.getByText(/先测试模型连通性/)).toBeTruthy();
diff --git a/memhub/apps/web/src/SelectedMemoryDetail.test.tsx b/memhub/apps/web/src/SelectedMemoryDetail.test.tsx
index 11af979..bb79bee 100644
--- a/memhub/apps/web/src/SelectedMemoryDetail.test.tsx
+++ b/memhub/apps/web/src/SelectedMemoryDetail.test.tsx
@@ -70,9 +70,7 @@ it("OBS-21: names a manually added memory 手动添加, not the internal source
detail={{
...detail,
memory: { ...detail.memory, origin: "manual" },
- evidence: [
- { ...detail.evidence[0], source_id: "one-memory-manual" },
- ],
+ evidence: [{ ...detail.evidence[0], source_id: "one-memory-manual" }],
}}
sources={[]}
onChanged={vi.fn()}
@@ -416,7 +414,9 @@ it("reports a definite undo refusal as not submitted, not as an unknown write",
fireEvent.click(screen.getByText("更多管理"));
fireEvent.click(screen.getByRole("button", { name: "撤销上次修改" }));
- expect((await screen.findByRole("alert")).textContent).toContain("撤销未提交");
+ expect((await screen.findByRole("alert")).textContent).toContain(
+ "撤销未提交",
+ );
expect(screen.queryByText(/操作尚未确认/)).toBeNull();
expect(trace.done).toHaveBeenLastCalledWith("failed", {
reason: "memory_undo_failed",
diff --git a/memhub/apps/web/src/SelectedMemoryDetail.tsx b/memhub/apps/web/src/SelectedMemoryDetail.tsx
index 2955372..41190ce 100644
--- a/memhub/apps/web/src/SelectedMemoryDetail.tsx
+++ b/memhub/apps/web/src/SelectedMemoryDetail.tsx
@@ -173,9 +173,7 @@ export function SelectedMemoryDetail({
} catch (reason) {
const refused = isDefiniteRefusal(reason);
trace.done(refused ? "failed" : "unknown", {
- reason: refused
- ? "memory_delete_failed"
- : "memory_delete_unconfirmed",
+ reason: refused ? "memory_delete_failed" : "memory_delete_unconfirmed",
});
if (alive.current)
setError(
@@ -445,8 +443,7 @@ export function SelectedMemoryDetail({
{detail.evidence.map((item) => (
<section key={item.evidence_id}>
<small>
- {sourceNameOr(sources, item.source_id, "来源待核对")}{" "}
- ·{" "}
+ {sourceNameOr(sources, item.source_id, "来源待核对")} ·{" "}
{item.written_by === "person"
? "你"
: item.written_by === "agent"
diff --git a/memhub/apps/web/src/SourceDirectoryPicker.test.tsx b/memhub/apps/web/src/SourceDirectoryPicker.test.tsx
index 5556035..0d367b0 100644
--- a/memhub/apps/web/src/SourceDirectoryPicker.test.tsx
+++ b/memhub/apps/web/src/SourceDirectoryPicker.test.tsx
@@ -299,7 +299,11 @@ describe("SourceDirectoryPicker COLD04", () => {
}> = [];
vi.stubGlobal("oneMemory", {
pickSourceDirectory: api.pick,
- logUiTrace: (input: { phase: string; status?: string; reason?: string }) => {
+ logUiTrace: (input: {
+ phase: string;
+ status?: string;
+ reason?: string;
+ }) => {
emitted.push(input);
return Promise.resolve({ state: "logged" });
},
diff --git a/memhub/apps/web/src/SourceDirectoryPicker.tsx b/memhub/apps/web/src/SourceDirectoryPicker.tsx
index 81d2dab..40c30f1 100644
--- a/memhub/apps/web/src/SourceDirectoryPicker.tsx
+++ b/memhub/apps/web/src/SourceDirectoryPicker.tsx
@@ -8,8 +8,8 @@ import { createPortal } from "react-dom";
import { previewSourceDirectory } from "./api";
import { saveSourceRoot } from "./source-state";
import { traceUiAction } from "./ui-trace";
-import { useMediaPreference } from "./use-media-preference";
import { isDefiniteJobRejection } from "./use-import-sources";
+import { useMediaPreference } from "./use-media-preference";
import "./source-directory-picker.css";
export interface SourceDirectoryPickerProps {
diff --git a/memhub/apps/web/src/SourcesView.tsx b/memhub/apps/web/src/SourcesView.tsx
index fb751ca..499fb07 100644
--- a/memhub/apps/web/src/SourcesView.tsx
+++ b/memhub/apps/web/src/SourcesView.tsx
@@ -32,9 +32,12 @@ import { SourceDirectoryPicker } from "./SourceDirectoryPicker";
import { SourceImportReceipt } from "./SourceImportReceipt";
import { SourceJobActions } from "./SourceJobActions";
import { SourceSnapshotStatus } from "./SourceSnapshotStatus";
-import { type UiTrace, traceUiAction } from "./ui-trace";
import { SyncHookControl } from "./SyncHookControl";
-import { isDefiniteAccessRefusal, type useImportSources } from "./use-import-sources";
+import { traceUiAction, type UiTrace } from "./ui-trace";
+import {
+ isDefiniteAccessRefusal,
+ type useImportSources,
+} from "./use-import-sources";
type ImportState = ReturnType<typeof useImportSources>;
@@ -472,9 +475,7 @@ export function SourcesView({ imports }: { imports: ImportState }) {
return (
<section className="view sources-view" aria-labelledby="sources-title">
{modelConsentOpen && (
- <ModelContentConsent
- onClose={() => setModelConsentOpen(false)}
- />
+ <ModelContentConsent onClose={() => setModelConsentOpen(false)} />
)}
<header className="view-header">
<div>
@@ -1190,7 +1191,9 @@ export function SourcesView({ imports }: { imports: ImportState }) {
event.stopPropagation();
if (!connecting) {
setConsentPhase(null);
- consentTrace.current?.done("rejected", { reason: "consent_dismissed" });
+ consentTrace.current?.done("rejected", {
+ reason: "consent_dismissed",
+ });
consentTrace.current = null;
}
}
diff --git a/memhub/apps/web/src/Workbench.test.tsx b/memhub/apps/web/src/Workbench.test.tsx
index 7f276ba..7cd264f 100644
--- a/memhub/apps/web/src/Workbench.test.tsx
+++ b/memhub/apps/web/src/Workbench.test.tsx
@@ -9,7 +9,13 @@ import type {
MemoryProcessingSummary,
SourceResponse,
} from "@one-memory/contracts";
-import { cleanup, render, screen, waitFor, within } from "@testing-library/react";
+import {
+ cleanup,
+ render,
+ screen,
+ waitFor,
+ within,
+} from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
@@ -113,7 +119,9 @@ const processing = {
outside_window_pending: 0,
extraction_window_preset: "3m",
manual_extract_batches_planned: 0,
- manual_extract_batches_current: 0, active_queue: 0, in_flight_count: 0,
+ manual_extract_batches_current: 0,
+ active_queue: 0,
+ in_flight_count: 0,
seconds_per_completion: null,
} as MemoryProcessingSummary;
@@ -227,7 +235,9 @@ it("选中的图节点把记忆库与详情联到一起(图 → 列表 → 原
// selects a node without WebGL. The same label also appears in the memory
// list, so scope the query to the graph.
const graph = screen.getByTestId("graph-3d");
- await user.click(within(graph).getByRole("button", { name: "统一用 axios 封装" }));
+ await user.click(
+ within(graph).getByRole("button", { name: "统一用 axios 封装" }),
+ );
expect(onOpenMemory).toHaveBeenCalledWith("memory-1");
});
@@ -265,14 +275,15 @@ it("展开一段原话后再选图节点,展开态被收起,不把旧原话
).not.toBeNull();
// Selecting a graph node must collapse it.
const graph = screen.getByTestId("graph-3d");
- await user.click(within(graph).getByRole("button", { name: "统一用 axios 封装" }));
+ await user.click(
+ within(graph).getByRole("button", { name: "统一用 axios 封装" }),
+ );
expect(
document.querySelector('[data-open="true"]'),
"graph selection must collapse the previously opened evidence",
).toBeNull();
});
-
beforeEach(() => {
vi.clearAllMocks();
});
diff --git a/memhub/apps/web/src/api.source-import-receipt.test.ts b/memhub/apps/web/src/api.source-import-receipt.test.ts
index 2a85646..6f88a94 100644
--- a/memhub/apps/web/src/api.source-import-receipt.test.ts
+++ b/memhub/apps/web/src/api.source-import-receipt.test.ts
@@ -18,15 +18,15 @@ import {
changeImportJob,
createImportJob,
getHistoryFile,
- getModelContentPermission,
- getModelProfiles,
getImportIssues,
getImportJob,
getImportJobs,
getLiveSyncHealth,
getMemoryNoteOperation,
getMemoryNotes,
+ getModelContentPermission,
getModelCreationOperation,
+ getModelProfiles,
getSourceImportReceipt,
getSources,
setModelContentPermission,
@@ -202,7 +202,9 @@ describe("import job transport validation", () => {
fake.post.mockResolvedValue({
data: { ...importJob, errors: Number.POSITIVE_INFINITY },
});
- await expect(createImportJob("cursor")).rejects.toThrow("import_job_invalid");
+ await expect(createImportJob("cursor")).rejects.toThrow(
+ "import_job_invalid",
+ );
await expect(changeImportJob("job-1", "pause")).rejects.toThrow(
"import_job_invalid",
);
@@ -256,8 +258,14 @@ describe("source list transport validation", () => {
it.each([
["negative messages", { imported_messages: -1 }],
["NaN messages", { imported_messages: Number.NaN }],
- ["infinite conversations", { imported_conversations: Number.POSITIVE_INFINITY }],
- ["unsafe conversations", { imported_conversations: Number.MAX_SAFE_INTEGER + 1 }],
+ [
+ "infinite conversations",
+ { imported_conversations: Number.POSITIVE_INFINITY },
+ ],
+ [
+ "unsafe conversations",
+ { imported_conversations: Number.MAX_SAFE_INTEGER + 1 },
+ ],
])("rejects %s before rendering the source list", async (_name, patch) => {
fake.get.mockResolvedValue({ data: [{ ...source, ...patch }] });
await expect(getSources()).rejects.toThrow("invalid source list");
diff --git a/memhub/apps/web/src/api.ts b/memhub/apps/web/src/api.ts
index cc4f3d8..3f8d53f 100644
--- a/memhub/apps/web/src/api.ts
+++ b/memhub/apps/web/src/api.ts
@@ -403,9 +403,7 @@ export function setReaderBaseUrl(url: string | null): void {
}
function readerAvailable(): boolean {
- return (
- readerBaseUrl !== null && Date.now() >= readerCircuitOpenUntil
- );
+ return readerBaseUrl !== null && Date.now() >= readerCircuitOpenUntil;
}
function openReaderCircuit(): void {
@@ -422,10 +420,7 @@ const READER_PATHS = new Set([
"/api/v1/memories/graph",
]);
-const READER_POST_PATHS = new Set([
- "/api/v1/recall",
- "/api/v1/context/search",
-]);
+const READER_POST_PATHS = new Set(["/api/v1/recall", "/api/v1/context/search"]);
async function tryReader<T>(
method: "get" | "post",
@@ -433,14 +428,19 @@ async function tryReader<T>(
config: Record<string, unknown> | undefined,
fallback: () => Promise<T>,
): Promise<T> {
- if (!readerAvailable() || !(READER_PATHS.has(url) || READER_POST_PATHS.has(url)))
+ if (
+ !readerAvailable() ||
+ !(READER_PATHS.has(url) || READER_POST_PATHS.has(url))
+ )
return fallback();
try {
const response = await axios.request<T>({
method,
url: `${readerBaseUrl}${url}`,
timeout: READER_TIMEOUT_MS,
- ...(method === "post" ? { data: config?.data ?? config?.body } : { params: config?.params }),
+ ...(method === "post"
+ ? { data: config?.data ?? config?.body }
+ : { params: config?.params }),
headers: (config?.headers as Record<string, string>) ?? {},
});
return response.data;
@@ -711,8 +711,7 @@ export async function getModelContentPermission(
{ signal },
);
const permission = parseModelContentPermission(response.data);
- if (permission === null)
- throw new Error("model_content_permission_invalid");
+ if (permission === null) throw new Error("model_content_permission_invalid");
return permission;
}
@@ -888,10 +887,15 @@ export async function deleteModelProfile(
}
export async function getHomeSummary(): Promise<HomeSummary> {
- return tryReader<HomeSummary>("get", "/api/v1/home-summary", undefined, async () => {
- const response = await client.get<HomeSummary>("/api/v1/home-summary");
- return response.data;
- });
+ return tryReader<HomeSummary>(
+ "get",
+ "/api/v1/home-summary",
+ undefined,
+ async () => {
+ const response = await client.get<HomeSummary>("/api/v1/home-summary");
+ return response.data;
+ },
+ );
}
export async function getLiveSyncHealth(): Promise<LiveSyncHealth[]> {
@@ -913,12 +917,17 @@ export async function getMemoryLibrary(
}
export async function getMemories(query = ""): Promise<GovernedMemory[]> {
- return tryReader<GovernedMemory[]>("get", "/api/v1/memories", { params: query ? { query } : undefined }, async () => {
- const response = await client.get<GovernedMemory[]>("/api/v1/memories", {
- params: query ? { query } : undefined,
- });
- return response.data;
- });
+ return tryReader<GovernedMemory[]>(
+ "get",
+ "/api/v1/memories",
+ { params: query ? { query } : undefined },
+ async () => {
+ const response = await client.get<GovernedMemory[]>("/api/v1/memories", {
+ params: query ? { query } : undefined,
+ });
+ return response.data;
+ },
+ );
}
export async function askMemories(
@@ -1089,7 +1098,9 @@ export async function getMemoryGraphWith(
): Promise<MemoryGraphResponse> {
if (pendingMemoryGraph) return pendingMemoryGraph;
pendingMemoryGraph = transport
- .get<MemoryGraphResponse>("/api/v1/memories/graph", { params: { limit: 300 } })
+ .get<MemoryGraphResponse>("/api/v1/memories/graph", {
+ params: { limit: 300 },
+ })
.then((response) => response.data)
.finally(() => {
pendingMemoryGraph = null;
diff --git a/memhub/apps/web/src/core-visual.css b/memhub/apps/web/src/core-visual.css
index f51e27d..a45d6f9 100644
--- a/memhub/apps/web/src/core-visual.css
+++ b/memhub/apps/web/src/core-visual.css
@@ -1720,7 +1720,8 @@ button.map-related {
border-block: 1px solid var(--bd);
gap: 20px 24px;
}
-.model-form label {
+.model-form label,
+.model-form .model-form-field {
font-size: 13px;
gap: 8px;
}
diff --git a/memhub/apps/web/src/graph-request.test.ts b/memhub/apps/web/src/graph-request.test.ts
index ae4dc8a..00da9ec 100644
--- a/memhub/apps/web/src/graph-request.test.ts
+++ b/memhub/apps/web/src/graph-request.test.ts
@@ -35,7 +35,9 @@ describe("the memory map request", () => {
});
it("asks again after the previous one settled", async () => {
- const transport = { get: vi.fn(async () => ({ data: { nodes: [], edges: [] } })) };
+ const transport = {
+ get: vi.fn(async () => ({ data: { nodes: [], edges: [] } })),
+ };
await getMemoryGraphWith(transport as never);
await getMemoryGraphWith(transport as never);
diff --git a/memhub/apps/web/src/memory-arrival-state.test.ts b/memhub/apps/web/src/memory-arrival-state.test.ts
index 7eb8ef7..1485cfb 100644
--- a/memhub/apps/web/src/memory-arrival-state.test.ts
+++ b/memhub/apps/web/src/memory-arrival-state.test.ts
@@ -24,7 +24,9 @@ const processing: MemoryProcessingSummary = {
seconds_per_completion: null,
extraction_window_preset: "all",
manual_extract_batches_planned: 0,
- manual_extract_batches_current: 0, active_queue: 0, in_flight_count: 0,
+ manual_extract_batches_current: 0,
+ active_queue: 0,
+ in_flight_count: 0,
};
const sources = [
{ authorized: true, imported_messages: 12, imported_conversations: 3 },
@@ -336,8 +338,6 @@ it("reports the global model-content permission block", () => {
},
});
expect(result.phase).toBe("consent-required");
- expect(memoryArrivalTitle(result)).toBe(
- "等待允许模型读取本地会话内容",
- );
+ expect(memoryArrivalTitle(result)).toBe("等待允许模型读取本地会话内容");
expect(result.blockedStages).toHaveLength(1);
});
diff --git a/memhub/apps/web/src/memory-arrival-state.ts b/memhub/apps/web/src/memory-arrival-state.ts
index a1c097c..68f42eb 100644
--- a/memhub/apps/web/src/memory-arrival-state.ts
+++ b/memhub/apps/web/src/memory-arrival-state.ts
@@ -86,9 +86,7 @@ export function resolveMemoryArrival({
phase = "processing";
} else if ((processing?.waiting_for_model ?? 0) > 0 || modelBlock(blocks)) {
phase = "model-required";
- } else if (
- blocks.some((block) => permissionReasons.has(block.reason))
- ) {
+ } else if (blocks.some((block) => permissionReasons.has(block.reason))) {
phase = "consent-required";
} else if ((processing?.failed ?? 0) > 0 && !onlyRetries(blocks)) {
// "Failed" is a prompt to go and look. Work the pipeline will pick up on
diff --git a/memhub/apps/web/src/memory-arrival.tsx b/memhub/apps/web/src/memory-arrival.tsx
index ab4e0e3..b381476 100644
--- a/memhub/apps/web/src/memory-arrival.tsx
+++ b/memhub/apps/web/src/memory-arrival.tsx
@@ -88,25 +88,26 @@ export function MemoryArrivalPanel({
["failed", "unavailable", "stopped", "checking"].includes(
arrival.phase,
)) && <p className="memory-arrival-description">{description}</p>}
- {showDetails && ((arrival.blockedStages?.length ?? 0) > 0 ||
- (arrival.phase === "processing" &&
- (arrival.backlogPending ?? 0) > 0)) && (
- <details className="memory-feedback-details">
- <summary>查看进度与详情</summary>
- {arrival.phase === "processing" &&
- (arrival.backlogPending ?? 0) > 0 && (
- <p>存量数据较大,为保证质量,正在后台分批整理</p>
- )}
- <ul>
- {arrival.blockedStages?.map((block) => (
- <li key={`${block.kind}:${block.reason}`}>
- {taskKindLabel(block.kind)} · {blockReasonLabel(block.reason)} ·{" "}
- {block.count.toLocaleString("zh-CN")} 项
- </li>
- ))}
- </ul>
- </details>
- )}
+ {showDetails &&
+ ((arrival.blockedStages?.length ?? 0) > 0 ||
+ (arrival.phase === "processing" &&
+ (arrival.backlogPending ?? 0) > 0)) && (
+ <details className="memory-feedback-details">
+ <summary>查看进度与详情</summary>
+ {arrival.phase === "processing" &&
+ (arrival.backlogPending ?? 0) > 0 && (
+ <p>存量数据较大,为保证质量,正在后台分批整理</p>
+ )}
+ <ul>
+ {arrival.blockedStages?.map((block) => (
+ <li key={`${block.kind}:${block.reason}`}>
+ {taskKindLabel(block.kind)} · {blockReasonLabel(block.reason)}{" "}
+ · {block.count.toLocaleString("zh-CN")} 项
+ </li>
+ ))}
+ </ul>
+ </details>
+ )}
<div className="memory-arrival-actions">
{arrival.phase === "model-required" && (
<button type="button" onClick={onConfigureModel}>
diff --git a/memhub/apps/web/src/memory-processing-labels.test.ts b/memhub/apps/web/src/memory-processing-labels.test.ts
index 1d734b1..0ff3da7 100644
--- a/memhub/apps/web/src/memory-processing-labels.test.ts
+++ b/memhub/apps/web/src/memory-processing-labels.test.ts
@@ -64,7 +64,11 @@ describe("pipeline codes stay out of the reader's way", () => {
it("separates what the reader owes attention from what Core retries", () => {
const stages = splitBlockedStages([
{ kind: "extract", reason: "model_api_key_missing", count: 3 },
- { kind: "extract", reason: "hy_memory_write_verification_failed", count: 1 },
+ {
+ kind: "extract",
+ reason: "hy_memory_write_verification_failed",
+ count: 1,
+ },
{
kind: "extract",
reason: "hy_memory_write_verification_clause_incomplete",
@@ -87,7 +91,11 @@ describe("pipeline codes stay out of the reader's way", () => {
// them apart learns nothing the total does not already say.
expect(
splitBlockedStages([
- { kind: "extract", reason: "hy_memory_write_verification_failed", count: 2 },
+ {
+ kind: "extract",
+ reason: "hy_memory_write_verification_failed",
+ count: 2,
+ },
{ kind: "extract", reason: "failed", count: 5 },
]),
).toEqual({ named: [], retrying: 7 });
@@ -100,7 +108,9 @@ describe("pipeline codes stay out of the reader's way", () => {
{ kind: "extract", reason: "hy_memory_input_exceeds_window", count: 1 },
]),
).toEqual({
- named: [{ kind: "extract", reason: "hy_memory_input_exceeds_window", count: 1 }],
+ named: [
+ { kind: "extract", reason: "hy_memory_input_exceeds_window", count: 1 },
+ ],
retrying: 0,
});
});
@@ -116,7 +126,9 @@ describe("pipeline codes stay out of the reader's way", () => {
{ kind: "extract", reason: "some_future_code", count: 4 },
]),
).toEqual({
- named: [{ kind: "extract", reason: "model_profile_not_active", count: 1 }],
+ named: [
+ { kind: "extract", reason: "model_profile_not_active", count: 1 },
+ ],
retrying: 4,
});
});
diff --git a/memhub/apps/web/src/memory-processing-labels.ts b/memhub/apps/web/src/memory-processing-labels.ts
index 55c6bf1..52daf08 100644
--- a/memhub/apps/web/src/memory-processing-labels.ts
+++ b/memhub/apps/web/src/memory-processing-labels.ts
@@ -46,8 +46,10 @@ const BLOCK_REASON_LABELS: Record<string, string> = {
// the one thing the reader can actually go and do.
secure_storage_authorization_required:
"需要授权访问本机钥匙串。请重新打开 App 并完成一次授权",
- secure_storage_read_timeout: "读取本机钥匙串超时。重新保存一遍模型配置即可恢复",
- secure_storage_write_timeout: "写入本机钥匙串超时。重新保存一遍模型配置即可恢复",
+ secure_storage_read_timeout:
+ "读取本机钥匙串超时。重新保存一遍模型配置即可恢复",
+ secure_storage_write_timeout:
+ "写入本机钥匙串超时。重新保存一遍模型配置即可恢复",
hy_memory_model_authentication_failed:
"模型认证失败。更新 key 后,到设置里点一次检测,会自动接着处理",
hy_memory_model_payment_required:
diff --git a/memhub/apps/web/src/state-boundaries.test.ts b/memhub/apps/web/src/state-boundaries.test.ts
index 4ef7f46..710a188 100644
--- a/memhub/apps/web/src/state-boundaries.test.ts
+++ b/memhub/apps/web/src/state-boundaries.test.ts
@@ -95,8 +95,6 @@ describe("single state layer", () => {
});
it("reads and writes sources only through source-state", () => {
- expect(
- offenders(sourceUses, ["source-state.ts", "api.ts"]),
- ).toEqual([]);
+ expect(offenders(sourceUses, ["source-state.ts", "api.ts"])).toEqual([]);
});
});
diff --git a/memhub/apps/web/src/styles.css b/memhub/apps/web/src/styles.css
index 2ddde5f..6a0e7a8 100644
--- a/memhub/apps/web/src/styles.css
+++ b/memhub/apps/web/src/styles.css
@@ -1464,7 +1464,8 @@ button.memory-row:hover:not(:disabled) {
background: var(--card);
}
-.model-form label {
+.model-form label,
+.model-form .model-form-field {
display: grid;
gap: 8px;
color: var(--tx2);
diff --git a/memhub/apps/web/src/ui-trace-coverage.test.ts b/memhub/apps/web/src/ui-trace-coverage.test.ts
index 26703e5..febbfb2 100644
--- a/memhub/apps/web/src/ui-trace-coverage.test.ts
+++ b/memhub/apps/web/src/ui-trace-coverage.test.ts
@@ -56,11 +56,11 @@ describe("ui trace write coverage", () => {
it("traces the global model-content permission write", () => {
const hook = source("use-model-content-permission.ts");
- expect(hook).toMatch(
- /setModelContentPermission\(next, trace\.traceId\)/,
- );
+ expect(hook).toMatch(/setModelContentPermission\(next, trace\.traceId\)/);
const api = source("api.ts");
- const start = api.indexOf("export async function setModelContentPermission(");
+ const start = api.indexOf(
+ "export async function setModelContentPermission(",
+ );
expect(start, "setModelContentPermission not found").toBeGreaterThan(-1);
const body = api.slice(start, start + 650);
expect(body).toContain("traceId?: string");
@@ -173,9 +173,7 @@ describe("ui trace write coverage", () => {
// leaving kernel-only legs behind.
const reconcile = source("connection-reconcile.ts");
expect(reconcile).toMatch(/traceUiAction\("sources", "confirm"\)/);
- expect(reconcile).toMatch(
- /setSync\(source, true, trace\.traceId\)/,
- );
+ expect(reconcile).toMatch(/setSync\(source, true, trace\.traceId\)/);
});
it("gives every settle() guard exactly one finally close", () => {
@@ -231,7 +229,10 @@ describe("ui trace write coverage", () => {
const memory = source("MemorySpace.tsx");
const start = memory.indexOf("async function syncIndex()");
expect(start).toBeGreaterThan(-1);
- const body = memory.slice(start, memory.indexOf("\n async function", start + 1));
+ const body = memory.slice(
+ start,
+ memory.indexOf("\n async function", start + 1),
+ );
expect(body).toMatch(
/if \(result\.status === "synced"\) trace\.done\("succeeded"\);\s*else\s+trace\.done\("failed"/,
);
@@ -286,10 +287,9 @@ describe("ui trace write coverage", () => {
expect(body, "askMemoriesStream must accept traceId").toContain(
"traceId?: string",
);
- expect(
- body,
- "askMemoriesStream must send the trace header",
- ).toContain("X-One-Memory-Trace-Id");
+ expect(body, "askMemoriesStream must send the trace header").toContain(
+ "X-One-Memory-Trace-Id",
+ );
});
it("traces the answer note save and the bulk memory mutations", () => {
@@ -308,7 +308,9 @@ describe("ui trace write coverage", () => {
it("traces the Harness Freeze/Thaw toggle", () => {
const control = source("SourcesView.tsx");
expect(control).toMatch(/traceUiAction\("sources", "toggle"\)/);
- expect(control).toMatch(/imports\.setSync\(source, enabled, trace\.traceId\)/);
+ expect(control).toMatch(
+ /imports\.setSync\(source, enabled, trace\.traceId\)/,
+ );
const hook = source("use-import-sources.ts");
expect(hook).toMatch(
@@ -381,7 +383,9 @@ describe("ui trace write coverage", () => {
expect(hook).toMatch(
/traceReason\(key\)[\s\S]{0,120}?traceReasonUnknown\(key\)/,
);
- expect(hook).toMatch(/function traceReasonUnknown\(key: string\): string \{/);
+ expect(hook).toMatch(
+ /function traceReasonUnknown\(key: string\): string \{/,
+ );
expect(hook).not.toMatch(/trace\.done\("failed", \{ reason: key \}\)/);
expect(hook).toMatch(
/createModelProfile\(\s*\{[\s\S]{0,200}?traceId,\s*\)/,
diff --git a/memhub/apps/web/src/use-import-sources.ts b/memhub/apps/web/src/use-import-sources.ts
index 9139e8c..629a006 100644
--- a/memhub/apps/web/src/use-import-sources.ts
+++ b/memhub/apps/web/src/use-import-sources.ts
@@ -81,9 +81,7 @@ interface ConnectOptions {
traceId?: string;
}
-export function useImportSources(_options: {
- automaticSync?: boolean;
-} = {}) {
+export function useImportSources(_options: { automaticSync?: boolean } = {}) {
const [health, setHealth] = useState<HealthResponse | null>(null);
const sources = useSources() ?? NO_SOURCES;
const syncWrite = useSourceSync();
diff --git a/memhub/apps/web/src/use-memory-library.ts b/memhub/apps/web/src/use-memory-library.ts
index b3ac76e..dd9fbf2 100644
--- a/memhub/apps/web/src/use-memory-library.ts
+++ b/memhub/apps/web/src/use-memory-library.ts
@@ -232,6 +232,7 @@ export function useMemoryLibrary({
const retryTick = stalePage ? (page?.total ?? 0) : -1;
useEffect(() => {
if (!stalePage) return;
+ void retryTick;
const timer = setTimeout(() => {
void refresh().catch(() => {});
}, 5000);
diff --git a/memhub/apps/web/src/use-model-content-permission.ts b/memhub/apps/web/src/use-model-content-permission.ts
index f3363fd..f5de5ad 100644
--- a/memhub/apps/web/src/use-model-content-permission.ts
+++ b/memhub/apps/web/src/use-model-content-permission.ts
@@ -1,8 +1,5 @@
import { useCallback, useEffect, useRef, useState } from "react";
-import {
- getModelContentPermission,
- setModelContentPermission,
-} from "./api";
+import { getModelContentPermission, setModelContentPermission } from "./api";
import { traceUiAction } from "./ui-trace";
import { isDefiniteRefusal, writeTraceStatus } from "./write-outcome";
diff --git a/memhub/apps/web/src/use-model-profiles.creation.test.ts b/memhub/apps/web/src/use-model-profiles.creation.test.ts
index e511dce..81671db 100644
--- a/memhub/apps/web/src/use-model-profiles.creation.test.ts
+++ b/memhub/apps/web/src/use-model-profiles.creation.test.ts
@@ -82,12 +82,14 @@ beforeEach(() => {
window.localStorage.clear();
vi.mocked(api.getModelProfiles).mockResolvedValue([]);
vi.mocked(api.createModelProfile).mockResolvedValue(profile);
- vi.mocked(api.abandonModelCreationOperation).mockImplementation(async (id) => ({
- operation_id: id,
- state: "deleted",
- profile_id: OTHER_ID,
- created_revision: 1,
- }));
+ vi.mocked(api.abandonModelCreationOperation).mockImplementation(
+ async (id) => ({
+ operation_id: id,
+ state: "deleted",
+ profile_id: OTHER_ID,
+ created_revision: 1,
+ }),
+ );
vi.mocked(api.getModelCreationOperation).mockImplementation(async (id) =>
committed(id),
);
diff --git a/memhub/apps/web/src/use-model-profiles.ts b/memhub/apps/web/src/use-model-profiles.ts
index 1ebab61..cd63c1c 100644
--- a/memhub/apps/web/src/use-model-profiles.ts
+++ b/memhub/apps/web/src/use-model-profiles.ts
@@ -8,8 +8,8 @@ import type {
import axios from "axios";
import { useCallback, useEffect, useRef, useState } from "react";
import {
- activateModelProfile,
abandonModelCreationOperation,
+ activateModelProfile,
apiErrorCode,
createModelProfile,
deleteModelProfile,
diff --git a/memhub/apps/web/src/workbench-findings.test.ts b/memhub/apps/web/src/workbench-findings.test.ts
index 42b34cd..5603eaf 100644
--- a/memhub/apps/web/src/workbench-findings.test.ts
+++ b/memhub/apps/web/src/workbench-findings.test.ts
@@ -74,7 +74,9 @@ const processing: MemoryProcessingSummary = {
outside_window_pending: 0,
extraction_window_preset: "3m",
manual_extract_batches_planned: 0,
- manual_extract_batches_current: 0, active_queue: 0, in_flight_count: 0,
+ manual_extract_batches_current: 0,
+ active_queue: 0,
+ in_flight_count: 0,
seconds_per_completion: null,
} as MemoryProcessingSummary;
diff --git a/memhub/packages/contracts/src/connection-setup.ts b/memhub/packages/contracts/src/connection-setup.ts
index 95e8d20..cb1f0f0 100644
--- a/memhub/packages/contracts/src/connection-setup.ts
+++ b/memhub/packages/contracts/src/connection-setup.ts
@@ -50,16 +50,14 @@ export interface ConnectionSetupItem {
id: string;
kind: "sync" | "install" | "readGrant";
state: ConnectionSetupItemState;
- receipt:
- | {
- kind: "install" | "readGrant";
- hostId: string;
- installationId: string;
- permissionRevision: number;
- allowedTools?: readonly string[];
- allowedScopes?: readonly string[];
- }
- | null;
+ receipt: {
+ kind: "install" | "readGrant";
+ hostId: string;
+ installationId: string;
+ permissionRevision: number;
+ allowedTools?: readonly string[];
+ allowedScopes?: readonly string[];
+ } | null;
}
export interface ConnectionSetupResult {
operationId: string;
diff --git a/memhub/packages/contracts/src/ui-restore.test.ts b/memhub/packages/contracts/src/ui-restore.test.ts
index b1045af..552486c 100644
--- a/memhub/packages/contracts/src/ui-restore.test.ts
+++ b/memhub/packages/contracts/src/ui-restore.test.ts
@@ -10,15 +10,23 @@ describe("Core UI session and restore contracts", () => {
it("pins the one-time session exchange shape", () => {
expectTypeOf<UISessionExchange["schema_version"]>().toEqualTypeOf<1>();
expectTypeOf<UISessionExchange["exchange_code"]>().toEqualTypeOf<string>();
- expectTypeOf<UISessionExchange["expires_in_seconds"]>().toEqualTypeOf<number>();
+ expectTypeOf<
+ UISessionExchange["expires_in_seconds"]
+ >().toEqualTypeOf<number>();
expectTypeOf<UISessionExchange["url"]>().toEqualTypeOf<string>();
expectTypeOf<UISessionLogout["state"]>().toEqualTypeOf<"logged_out">();
});
it("pins the managed restore result shape", () => {
expectTypeOf<BackupRestoreResult["state"]>().toEqualTypeOf<"restored">();
- expectTypeOf<BackupRestoreResult["restored_bytes"]>().toEqualTypeOf<number>();
- expectTypeOf<BackupRestoreResult["previous_backup_path"]>().toEqualTypeOf<string>();
- expectTypeOf<BackupRestoreResult["source_schema_version"]>().toEqualTypeOf<number>();
+ expectTypeOf<
+ BackupRestoreResult["restored_bytes"]
+ >().toEqualTypeOf<number>();
+ expectTypeOf<
+ BackupRestoreResult["previous_backup_path"]
+ >().toEqualTypeOf<string>();
+ expectTypeOf<
+ BackupRestoreResult["source_schema_version"]
+ >().toEqualTypeOf<number>();
});
});
diff --git a/memhub/packages/host-bridge/src/capture-hooks.test.ts b/memhub/packages/host-bridge/src/capture-hooks.test.ts
index c3bec76..180906f 100644
--- a/memhub/packages/host-bridge/src/capture-hooks.test.ts
+++ b/memhub/packages/host-bridge/src/capture-hooks.test.ts
@@ -119,7 +119,9 @@ describe("capture hooks installed with recall", () => {
);
expect(commands).toHaveLength(2);
expect(commands[0]).toBe("other-tool");
- expect(commands.filter((command) => command.includes("capture cursor"))).toHaveLength(1);
+ expect(
+ commands.filter((command) => command.includes("capture cursor")),
+ ).toHaveLength(1);
});
it("merges Claude Code and Codex hook groups", async () => {
@@ -185,10 +187,7 @@ describe("capture hooks installed with recall", () => {
const home = await root();
const dir = path.join(home, hostId === "codex" ? ".codex" : ".claude");
await mkdir(dir);
- const hooksPath = path.join(
- hostId === "codex" ? dir : dir,
- "hooks.json",
- );
+ const hooksPath = path.join(hostId === "codex" ? dir : dir, "hooks.json");
if (hostId === "claude-code") {
await writeFile(
path.join(dir, "settings.json"),
@@ -271,15 +270,14 @@ describe("capture hooks installed with recall", () => {
const target =
hostId === "codex" ? hooksPath : path.join(dir, "settings.json");
const document = JSON.parse(await readFile(target, "utf8")) as {
- hooks: Record<
- string,
- Array<{ hooks: Array<{ command: string }> }>
- >;
+ hooks: Record<string, Array<{ hooks: Array<{ command: string }> }>>;
};
const commands = document.hooks[event].flatMap((entry) =>
entry.hooks.map((hook) => hook.command),
);
- expect(commands.filter((command) => command === "other-tool")).toHaveLength(1);
+ expect(
+ commands.filter((command) => command === "other-tool"),
+ ).toHaveLength(1);
expect(
commands.filter((command) => command.includes(`capture ${hostId}`)),
).toHaveLength(1);
diff --git a/memhub/packages/host-bridge/src/capture-hooks.ts b/memhub/packages/host-bridge/src/capture-hooks.ts
index 765f77c..54a04c5 100644
--- a/memhub/packages/host-bridge/src/capture-hooks.ts
+++ b/memhub/packages/host-bridge/src/capture-hooks.ts
@@ -333,10 +333,7 @@ function mergeCommandHooks(
entry &&
typeof entry === "object" &&
typeof (entry as { command?: unknown }).command === "string" &&
- namesCapture(
- (entry as { command: string }).command,
- sourceId,
- )
+ namesCapture((entry as { command: string }).command, sourceId)
) {
entries.splice(index, 1);
}
@@ -365,9 +362,7 @@ function mergeCommandHooks(
const kept = group.hooks.filter((hook) => {
if (!hook || typeof hook !== "object") return true;
const value = (hook as { command?: unknown }).command;
- return !(
- typeof value === "string" && namesCapture(value, sourceId)
- );
+ return !(typeof value === "string" && namesCapture(value, sourceId));
});
if (kept.length === 0) entries.splice(index, 1);
else if (kept.length !== group.hooks.length)
diff --git a/memhub/packages/host-bridge/src/containment.test.ts b/memhub/packages/host-bridge/src/containment.test.ts
index 21176bc..832902b 100644
--- a/memhub/packages/host-bridge/src/containment.test.ts
+++ b/memhub/packages/host-bridge/src/containment.test.ts
@@ -12,8 +12,8 @@ import {
lstat,
mkdir,
mkdtemp,
- readFile,
readdir,
+ readFile,
realpath,
rm,
symlink,
@@ -31,15 +31,15 @@ import {
cursorLayout,
deepseekHarnessLayout,
hermesLayout,
+ LOCAL_OPERATION_DISABLED_MESSAGE,
opencodeLayout,
piLayout,
- qwenCodeLayout,
- LOCAL_OPERATION_DISABLED_MESSAGE,
planRecallInstall,
previewRecallInstall,
- refuseDisabledHostOperation,
+ qwenCodeLayout,
type RecallHostLayout,
type RecallRuntime,
+ refuseDisabledHostOperation,
verifyRecallInstall,
workbuddyLayout,
} from "./recall-installer.js";
@@ -152,7 +152,9 @@ describe("symlinked ancestor containment", () => {
await rm(linkedRoot);
await symlink(otherRoot, linkedRoot);
- await expect(applyRecallInstall(plan)).rejects.toThrow(/containment_refused/);
+ await expect(applyRecallInstall(plan)).rejects.toThrow(
+ /containment_refused/,
+ );
});
});
@@ -191,7 +193,10 @@ describe("all writing layouts refuse a symlinked ancestor", () => {
name: "claude-code skills",
link: "skills",
layout: (dir) =>
- claudeCodeLayout({ claudeDir: dir, configPath: path.join(dir, ".claude.json") }),
+ claudeCodeLayout({
+ claudeDir: dir,
+ configPath: path.join(dir, ".claude.json"),
+ }),
},
{ name: "qwen-code skills", link: "skills", layout: qwenCodeLayout },
{ name: "hermes skills", link: "skills", layout: hermesLayout },
@@ -200,14 +205,18 @@ describe("all writing layouts refuse a symlinked ancestor", () => {
{
name: "deepseek profiles/headless",
link: path.join("profiles", "headless"),
- layout: (dir) => deepseekHarnessLayout({ dshHome: dir, profile: "headless" }),
+ layout: (dir) =>
+ deepseekHarnessLayout({ dshHome: dir, profile: "headless" }),
},
{ name: "workbuddy plugins", link: "plugins", layout: workbuddyLayout },
];
for (const testCase of cases) {
it(`${testCase.name}`, async () => {
- const hostDir = path.join(base, testCase.name.replaceAll(/[^a-z0-9]+/gi, "-"));
+ const hostDir = path.join(
+ base,
+ testCase.name.replaceAll(/[^a-z0-9]+/gi, "-"),
+ );
await mkdir(hostDir, { recursive: true });
const linkPath = path.join(hostDir, testCase.link);
await mkdir(path.dirname(linkPath), { recursive: true });
@@ -229,7 +238,10 @@ describe("leaf-level attacks", () => {
await mkdir(skillDir, { recursive: true });
// The leaf itself is the symlink, not its parent.
await writeFile(path.join(outside, "target.md"), "outside\n");
- await symlink(path.join(outside, "target.md"), path.join(skillDir, "SKILL.md"));
+ await symlink(
+ path.join(outside, "target.md"),
+ path.join(skillDir, "SKILL.md"),
+ );
const layout = cursorLayout(hostDir);
// A symlinked leaf is refused either at plan (unmanaged skill) or apply
// (containment); both must decline to write through it.
@@ -275,7 +287,9 @@ describe("external config path", () => {
configPath: path.join(linkedParent, ".claude.json"),
});
const plan = await planRecallInstall(layout, runtime());
- await expect(applyRecallInstall(plan)).rejects.toThrow(/containment_refused/);
+ await expect(applyRecallInstall(plan)).rejects.toThrow(
+ /containment_refused/,
+ );
// Nothing was written through the linked parent.
expect(await readdir(outsideDir)).toEqual([]);
});
diff --git a/memhub/packages/host-bridge/src/context-cli.test.ts b/memhub/packages/host-bridge/src/context-cli.test.ts
index 1621787..e13d9e8 100644
--- a/memhub/packages/host-bridge/src/context-cli.test.ts
+++ b/memhub/packages/host-bridge/src/context-cli.test.ts
@@ -91,9 +91,7 @@ describe("om_context CLI receipts", () => {
const result = await runContextCli(["original"], env);
expect(result.exitCode).toBe(0);
- expect(result.stdout).toContain(
- "已完成MemHub的记忆查询。",
- );
+ expect(result.stdout).toContain("已完成MemHub的记忆查询。");
expect(result.stdout).not.toContain("成功使用 MemHub");
expect(result.stdout).not.toContain("获取部分相关记忆");
expect(result.stdout).not.toContain("暂时不可用");
diff --git a/memhub/packages/host-bridge/src/context-integration.test.ts b/memhub/packages/host-bridge/src/context-integration.test.ts
index d70f532..de386e2 100644
--- a/memhub/packages/host-bridge/src/context-integration.test.ts
+++ b/memhub/packages/host-bridge/src/context-integration.test.ts
@@ -528,7 +528,8 @@ it("reports a Core context failure without claiming MemHub is stopped", async ()
),
).rejects.toMatchObject({
code: "context_unavailable",
- message: "MemHub is running, but context search is temporarily unavailable.",
+ message:
+ "MemHub is running, but context search is temporarily unavailable.",
});
expect(f.calls.map((call) => call.url)).toEqual(["/api/v1/context/search"]);
});
diff --git a/memhub/packages/host-bridge/src/discovery.ts b/memhub/packages/host-bridge/src/discovery.ts
index 88c8e56..fc798ea 100644
--- a/memhub/packages/host-bridge/src/discovery.ts
+++ b/memhub/packages/host-bridge/src/discovery.ts
@@ -36,10 +36,9 @@ export async function readDiscovery(
try {
raw = await readFile(targetPath, "utf8");
} catch (error) {
- throw new Error(
- "MemHub is not running (broker discovery is unavailable)",
- { cause: error },
- );
+ throw new Error("MemHub is not running (broker discovery is unavailable)", {
+ cause: error,
+ });
}
let value: unknown;
diff --git a/memhub/packages/host-bridge/src/install-contract.test.ts b/memhub/packages/host-bridge/src/install-contract.test.ts
index f20b9db..0879853 100644
--- a/memhub/packages/host-bridge/src/install-contract.test.ts
+++ b/memhub/packages/host-bridge/src/install-contract.test.ts
@@ -39,8 +39,7 @@ function runtime(overrides: Partial<RecallRuntime> = {}): RecallRuntime {
runtimeCommand: "/Applications/MemHub.app/Contents/MacOS/MemHub",
mcpEntryPath: "/Applications/MemHub.app/Contents/Resources/mcp.cjs",
discoveryPath: "/Users/somebody/.one-memory/broker.json",
- recallCliPath:
- "/Applications/MemHub.app/Contents/Resources/recall-cli.cjs",
+ recallCliPath: "/Applications/MemHub.app/Contents/Resources/recall-cli.cjs",
...overrides,
};
}
diff --git a/memhub/packages/host-bridge/src/mcp-granted-tools.test.ts b/memhub/packages/host-bridge/src/mcp-granted-tools.test.ts
index c29325c..4dbdaa7 100644
--- a/memhub/packages/host-bridge/src/mcp-granted-tools.test.ts
+++ b/memhub/packages/host-bridge/src/mcp-granted-tools.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
-import { McpSession, type GrantedTools } from "./mcp-session.js";
+import { type GrantedTools, McpSession } from "./mcp-session.js";
function sessionWith(granted: GrantedTools): McpSession {
return new McpSession(
diff --git a/memhub/packages/host-bridge/src/mcp-session.ts b/memhub/packages/host-bridge/src/mcp-session.ts
index 94a2b21..01843be 100644
--- a/memhub/packages/host-bridge/src/mcp-session.ts
+++ b/memhub/packages/host-bridge/src/mcp-session.ts
@@ -24,8 +24,8 @@ import {
HOST_CONTEXT_TIMEOUT_MS,
isContextSearchRequest,
} from "./context-protocol.js";
-import { RECALL_PRESENTATION_GUIDANCE } from "./recall-presentation.js";
import { recallForHost } from "./host-facing.js";
+import { RECALL_PRESENTATION_GUIDANCE } from "./recall-presentation.js";
interface JsonRpcRequest {
jsonrpc: "2.0";
diff --git a/memhub/packages/host-bridge/src/mcp-write.test.ts b/memhub/packages/host-bridge/src/mcp-write.test.ts
index b02e7c2..0e73195 100644
--- a/memhub/packages/host-bridge/src/mcp-write.test.ts
+++ b/memhub/packages/host-bridge/src/mcp-write.test.ts
@@ -8,7 +8,7 @@
import { describe, expect, it, vi } from "vitest";
import { processMcpLine } from "./mcp-protocol.js";
-import { type MemoryWriteRequest, McpSession } from "./mcp-session.js";
+import { McpSession, type MemoryWriteRequest } from "./mcp-session.js";
/** Build a session whose only wired tools are the write ones.
*
@@ -96,8 +96,10 @@ describe("om_memory_write MCP tool", () => {
},
}),
);
- const payload = JSON.parse(response ?? "{}").result
- .structuredContent as { request_id: string; state: string };
+ const payload = JSON.parse(response ?? "{}").result.structuredContent as {
+ request_id: string;
+ state: string;
+ };
expect(payload.request_id).toBe("req-42");
expect(payload.state).toBe("accepted");
});
diff --git a/memhub/packages/host-bridge/src/notification-transport.ts b/memhub/packages/host-bridge/src/notification-transport.ts
index 8512200..6f59f74 100644
--- a/memhub/packages/host-bridge/src/notification-transport.ts
+++ b/memhub/packages/host-bridge/src/notification-transport.ts
@@ -32,8 +32,7 @@ const errors: Record<ErrorCode, { status: number; message: string }> = {
},
host_authorization_required: {
status: 401,
- message:
- "MemHub installation authorization is required or has changed.",
+ message: "MemHub installation authorization is required or has changed.",
},
source_not_authorized: {
status: 403,
diff --git a/memhub/packages/host-bridge/src/recall-broker.test.ts b/memhub/packages/host-bridge/src/recall-broker.test.ts
index 2799e74..420cbc8 100644
--- a/memhub/packages/host-bridge/src/recall-broker.test.ts
+++ b/memhub/packages/host-bridge/src/recall-broker.test.ts
@@ -145,7 +145,11 @@ describe("RecallBroker", () => {
},
);
expect(response.status).toBe(503);
- expect(diagnostics.some((event) => event.event === "connection_control.exception")).toBe(true);
+ expect(
+ diagnostics.some(
+ (event) => event.event === "connection_control.exception",
+ ),
+ ).toBe(true);
const exception = diagnostics.find(
(event) => event.event === "connection_control.exception",
);
@@ -425,9 +429,10 @@ describe("RecallBroker", () => {
try {
await broker.start();
closers.push(() => broker.stop());
- (broker as unknown as { handle: () => Promise<void> }).handle = async () => {
- throw new Error("forced handler failure");
- };
+ (broker as unknown as { handle: () => Promise<void> }).handle =
+ async () => {
+ throw new Error("forced handler failure");
+ };
const response = await axios.get(
`http://127.0.0.1:${broker.port}/health`,
{ validateStatus: () => true },
diff --git a/memhub/packages/host-bridge/src/recall-broker.ts b/memhub/packages/host-bridge/src/recall-broker.ts
index 5f73987..4d6e4cf 100644
--- a/memhub/packages/host-bridge/src/recall-broker.ts
+++ b/memhub/packages/host-bridge/src/recall-broker.ts
@@ -8,8 +8,8 @@ import type { AddressInfo } from "node:net";
import type {
AskMemoryRequest,
AskMemoryResponse,
- ContextSearchResponse,
ContextSearchRequest,
+ ContextSearchResponse,
ConversationSearchResponse,
RecallReceipt,
RecallRequest,
@@ -611,7 +611,8 @@ export class RecallBroker {
error instanceof Error && isConnectionControlError(error.message)
? error.message
: "connection_control_unavailable";
- const isKnown = error instanceof Error && isConnectionControlError(error.message);
+ const isKnown =
+ error instanceof Error && isConnectionControlError(error.message);
if (!isKnown) {
// Whitelist-out-of-range errors bypass the control-plane dedup:
// emit unconditionally so an unexpected exception (the D43
@@ -740,29 +741,31 @@ export class RecallBroker {
return;
}
const authorized = await this.authorizeHost(request, body, "all-apps");
- const result = { data: await this.readViaReader<unknown>(
- "/api/v1/context/search",
- body,
- authorized.headers,
- (body.timeout_ms ?? 2000) + 1000,
- async () => {
- const r = await axios.post(
- `${this.options.coreBaseUrl}/api/v1/context/search`,
- body,
- {
- headers: authorized.headers,
- proxy: false,
- maxRedirects: 0,
- timeout: (body.timeout_ms ?? 2000) + 1000,
- maxContentLength: 2 * 1024 * 1024,
- signal: abort.signal,
- },
- );
- await authorized.verifyBeforeRelease();
- return r.data;
- },
- abort.signal,
- ) };
+ const result = {
+ data: await this.readViaReader<unknown>(
+ "/api/v1/context/search",
+ body,
+ authorized.headers,
+ (body.timeout_ms ?? 2000) + 1000,
+ async () => {
+ const r = await axios.post(
+ `${this.options.coreBaseUrl}/api/v1/context/search`,
+ body,
+ {
+ headers: authorized.headers,
+ proxy: false,
+ maxRedirects: 0,
+ timeout: (body.timeout_ms ?? 2000) + 1000,
+ maxContentLength: 2 * 1024 * 1024,
+ signal: abort.signal,
+ },
+ );
+ await authorized.verifyBeforeRelease();
+ return r.data;
+ },
+ abort.signal,
+ ),
+ };
const invalidField = contextResponseInvalidField(result.data);
const identity = authorized.identity;
const responseFailure =
diff --git a/memhub/packages/host-bridge/src/recall-injection.test.ts b/memhub/packages/host-bridge/src/recall-injection.test.ts
index 48a986b..3ba28b9 100644
--- a/memhub/packages/host-bridge/src/recall-injection.test.ts
+++ b/memhub/packages/host-bridge/src/recall-injection.test.ts
@@ -1,3 +1,4 @@
+import { spawn } from "node:child_process";
import { appendFileSync, mkdirSync, readFileSync } from "node:fs";
import {
chmod,
@@ -14,7 +15,6 @@ import os from "node:os";
import path from "node:path";
import type { ContextSearchResponse, RecallHit } from "@one-memory/contracts";
import { afterEach, describe, expect, it } from "vitest";
-
import { HostGrantStore } from "./host-grants.js";
import { RecallBroker } from "./recall-broker.js";
import {
@@ -27,8 +27,6 @@ import {
stripInjectedBlocks,
} from "./recall-injection.js";
-import { spawn } from "node:child_process";
-
const roots: string[] = [];
const closers: Array<() => Promise<void>> = [];
@@ -1551,10 +1549,14 @@ describe("recall injection hook process", () => {
const cliPath = path.resolve("dist/recall-cli.cjs");
const started = Date.now();
const exitCode = await new Promise<number>((resolve) => {
- const child = spawn(process.execPath, [cliPath, "--inject", "workbuddy"], {
- env,
- stdio: ["pipe", "pipe", "pipe"],
- });
+ const child = spawn(
+ process.execPath,
+ [cliPath, "--inject", "workbuddy"],
+ {
+ env,
+ stdio: ["pipe", "pipe", "pipe"],
+ },
+ );
let stdout = "";
child.stdout.on("data", (chunk: Buffer) => {
stdout += chunk.toString("utf8");
@@ -1570,12 +1572,14 @@ describe("recall injection hook process", () => {
void stdout;
resolve(code ?? -1);
});
- child.stdin.end(JSON.stringify({
- session_id: "sess-subprocess",
- turn_id: "turn-subprocess",
- hook_event_name: "UserPromptSubmit",
- prompt: "项目周会在哪天",
- }));
+ child.stdin.end(
+ JSON.stringify({
+ session_id: "sess-subprocess",
+ turn_id: "turn-subprocess",
+ hook_event_name: "UserPromptSubmit",
+ prompt: "项目周会在哪天",
+ }),
+ );
});
const elapsed = Date.now() - started;
server.close();
diff --git a/memhub/packages/host-bridge/src/recall-installer.ts b/memhub/packages/host-bridge/src/recall-installer.ts
index 4b901b4..2303a12 100644
--- a/memhub/packages/host-bridge/src/recall-installer.ts
+++ b/memhub/packages/host-bridge/src/recall-installer.ts
@@ -1,13 +1,14 @@
import { createHash, randomUUID } from "node:crypto";
-import { constants } from "node:fs";
+import { constants, type Dirent, type Stats } from "node:fs";
import {
access,
chmod,
+ type FileHandle,
lstat,
mkdir,
open,
- readFile,
readdir,
+ readFile,
realpath,
rename,
rm,
@@ -908,7 +909,7 @@ async function assertExecutableFile(
target: string,
label: string,
): Promise<void> {
- let details;
+ let details: Stats;
try {
details = await stat(target);
} catch (error) {
@@ -931,7 +932,7 @@ async function assertReadableFile(
target: string,
label: string,
): Promise<void> {
- let details;
+ let details: Stats;
try {
details = await stat(target);
} catch (error) {
@@ -1062,7 +1063,8 @@ export async function applyRecallInstall(
plan.paths.mcp,
files.mcp.after,
await existingMode(plan.paths.mcp),
- () => ledger.recordWrite(plan.paths.mcp!, originalMcp, files.mcp!.after),
+ () =>
+ ledger.recordWrite(plan.paths.mcp!, originalMcp, files.mcp!.after),
);
}
if (plan.paths.skill !== null && plan.next.skill !== null) {
@@ -1094,7 +1096,8 @@ export async function applyRecallInstall(
registry.path,
registry.after,
await existingMode(registry.path),
- () => ledger.recordWrite(registry.path, registry.before, registry.after),
+ () =>
+ ledger.recordWrite(registry.path, registry.before, registry.after),
);
}
for (const capture of files.captures) {
@@ -3020,9 +3023,7 @@ async function canonicalizeWithMissing(input: string): Promise<string> {
for (;;) {
try {
const real = await realpath(current);
- return tail.length === 0
- ? real
- : path.join(real, ...[...tail].reverse());
+ return tail.length === 0 ? real : path.join(real, ...[...tail].reverse());
} catch (error) {
if (!isNotFound(error)) throw error;
const parent = path.dirname(current);
@@ -3086,7 +3087,10 @@ async function snapshotAncestry(
): Promise<AncestrySnapshot> {
const lexicalRoot = path.resolve(layout.containmentRoot);
const lexical = path.resolve(target);
- if (lexical !== lexicalRoot && !lexical.startsWith(`${lexicalRoot}${path.sep}`)) {
+ if (
+ lexical !== lexicalRoot &&
+ !lexical.startsWith(`${lexicalRoot}${path.sep}`)
+ ) {
// Preserve the historical message: the cheap lexical rejection is the
// same refusal it always was, just no longer the only check.
throw new Error(
@@ -3105,7 +3109,7 @@ async function snapshotAncestry(
// A fresh host directory legitimately does not exist yet: the installer
// creates it. Refuse only if an existing component above it is a symlink;
// otherwise treat the whole root as a to-be-created tail.
- let rootStats;
+ let rootStats: Stats;
try {
rootStats = await lstat(canonicalRoot);
} catch (error) {
@@ -3143,7 +3147,7 @@ async function snapshotAncestry(
missingTail.push(parts[index]!);
continue;
}
- let details;
+ let details: Stats;
try {
details = await lstat(current);
} catch (error) {
@@ -3284,7 +3288,9 @@ class MutationLedger {
target,
restore: null,
created,
- plannedHashes: new Map(files.map((file) => [file.path, hash(file.after)])),
+ plannedHashes: new Map(
+ files.map((file) => [file.path, hash(file.after)]),
+ ),
});
}
@@ -3363,7 +3369,7 @@ async function treeIsExactlyPlanned(record: MutationRecord): Promise<boolean> {
if (planned === undefined) return false;
const seen = new Set<string>();
const walk = async (current: string): Promise<boolean> => {
- let entries;
+ let entries: Dirent[];
try {
entries = await readdir(current, { withFileTypes: true });
} catch (error) {
@@ -3533,7 +3539,7 @@ async function assertConfigContainment(
if (!underSelectedRoot) {
await assertNoSymlinkAncestor(operation, config);
}
- let details;
+ let details: Stats;
try {
details = await lstat(config);
} catch (error) {
@@ -3607,7 +3613,7 @@ async function writeLeafNoFollow(
constants.O_CREAT |
constants.O_EXCL |
constants.O_NOFOLLOW;
- let handle;
+ let handle: FileHandle;
try {
handle = await open(target, flags, mode);
} catch (error) {
@@ -3874,7 +3880,7 @@ async function writeLeafExternal(
constants.O_CREAT |
constants.O_EXCL |
constants.O_NOFOLLOW;
- let handle;
+ let handle: FileHandle;
try {
handle = await open(targetPath, flags, mode);
} catch (error) {
@@ -3984,7 +3990,12 @@ async function restore(
await rmdir(skillDir).catch(() => {});
await rmdir(path.dirname(skillDir)).catch(() => {});
} else {
- await atomicWrite(layout, targetPath, content, await existingMode(targetPath));
+ await atomicWrite(
+ layout,
+ targetPath,
+ content,
+ await existingMode(targetPath),
+ );
}
}
diff --git a/memhub/packages/host-bridge/src/recall-probe.test.ts b/memhub/packages/host-bridge/src/recall-probe.test.ts
index 993be94..d7398a8 100644
--- a/memhub/packages/host-bridge/src/recall-probe.test.ts
+++ b/memhub/packages/host-bridge/src/recall-probe.test.ts
@@ -170,7 +170,9 @@ describe("recall link probe", () => {
const probe = await probeRecallInstall(cursorLayout(cursorDir));
expect(probe.state).toBe("unreachable");
- expect(probe.detail).toMatch(/closed before|did not complete the handshake/);
+ expect(probe.detail).toMatch(
+ /closed before|did not complete the handshake/,
+ );
});
it("records a self-check in the journal of every fresh install", async () => {
diff --git a/memhub/packages/host-bridge/src/skill-drift.ts b/memhub/packages/host-bridge/src/skill-drift.ts
index f0b99a1..9ea7758 100644
--- a/memhub/packages/host-bridge/src/skill-drift.ts
+++ b/memhub/packages/host-bridge/src/skill-drift.ts
@@ -1,8 +1,7 @@
import { createHash } from "node:crypto";
import path from "node:path";
-
-import { PLUGIN_HOOKS } from "./codebuddy-plugin.js";
import { captureFilePath, namesCapture } from "./capture-hooks.js";
+import { PLUGIN_HOOKS } from "./codebuddy-plugin.js";
import {
asInstalled,
expectedPluginHooks,
@@ -227,9 +226,7 @@ function isRecognizableWorkbuddyHookFile(raw: string): boolean {
const record = hooks as Record<string, unknown>;
const commands = (event: string): string[] =>
Array.isArray(record[event])
- ? (record[event] as unknown[]).flatMap((entry) =>
- commandValues(entry),
- )
+ ? (record[event] as unknown[]).flatMap((entry) => commandValues(entry))
: [];
const start = commands("SessionStart");
const prompt = commands("UserPromptSubmit");
@@ -238,8 +235,7 @@ function isRecognizableWorkbuddyHookFile(raw: string): boolean {
values.some((value) => value.includes(marker));
return (
has(start, "--inject workbuddy") &&
- (has(prompt, "--inject workbuddy") ||
- has(prompt, "capture workbuddy")) &&
+ (has(prompt, "--inject workbuddy") || has(prompt, "capture workbuddy")) &&
has(stop, "capture workbuddy")
);
}
diff --git a/memhub/packages/host-bridge/src/workbuddy-plugin-installer.test.ts b/memhub/packages/host-bridge/src/workbuddy-plugin-installer.test.ts
index a9fda09..5a0c9d0 100644
--- a/memhub/packages/host-bridge/src/workbuddy-plugin-installer.test.ts
+++ b/memhub/packages/host-bridge/src/workbuddy-plugin-installer.test.ts
@@ -640,12 +640,13 @@ describe("WorkBuddy recall injection hooks", () => {
const runtime = await injectingRuntime();
const missingRuntime = {
...runtime,
- runtimeCommand: "/opt/one-memory/missing/managed-runtime/current/bin/node",
+ runtimeCommand:
+ "/opt/one-memory/missing/managed-runtime/current/bin/node",
};
- await expect(
- planRecallInstall(layout, missingRuntime),
- ).rejects.toThrow(/runtimeCommand does not exist/);
+ await expect(planRecallInstall(layout, missingRuntime)).rejects.toThrow(
+ /runtimeCommand does not exist/,
+ );
expect(await missing(plugin.marketplaceRoot)).toBe(true);
expect(await missing(plugin.installRoot)).toBe(true);
});
@@ -658,9 +659,9 @@ describe("WorkBuddy recall injection hooks", () => {
recallCliPath: "/opt/one-memory/missing/host-bridge/recall-cli.cjs",
};
- await expect(
- planRecallInstall(layout, missingRecall),
- ).rejects.toThrow(/recallCliPath does not exist/);
+ await expect(planRecallInstall(layout, missingRecall)).rejects.toThrow(
+ /recallCliPath does not exist/,
+ );
expect(await missing(plugin.marketplaceRoot)).toBe(true);
expect(await missing(plugin.installRoot)).toBe(true);
});
@@ -669,9 +670,7 @@ describe("WorkBuddy recall injection hooks", () => {
const { layout, plugin } = await fixture({ populated: true });
const runtime = await injectingRuntime();
- await applyRecallInstall(
- await planRecallInstall(layout, runtime),
- );
+ await applyRecallInstall(await planRecallInstall(layout, runtime));
await verifyRecallInstall(layout);
const hooks = JSON.parse(
@@ -756,9 +755,7 @@ describe("WorkBuddy recall injection hooks", () => {
const before = await Promise.all(
paths.map((target) => readFile(target, "utf8")),
);
- await applyRecallInstall(
- await planRecallInstall(layout, runtime),
- );
+ await applyRecallInstall(await planRecallInstall(layout, runtime));
const plan = await planRecallUninstall(layout);
await applyRecallUninstall(plan, previewRecallUninstall(plan).fingerprint);
@@ -778,9 +775,9 @@ describe("WorkBuddy recall injection hooks", () => {
const hooksPath = path.join(plugin.installRoot, "hooks", "hooks.json");
expect(await readFile(hooksPath, "utf8")).not.toContain("--inject");
- await expect(
- checkSkillDrift(layout, runtime),
- ).resolves.toMatchObject({ state: "stale" });
+ await expect(checkSkillDrift(layout, runtime)).resolves.toMatchObject({
+ state: "stale",
+ });
const sync = await planSkillSync(layout, runtime);
if (!sync) throw new Error("expected the hooks to sync");
expect(sync.requiresConfirmation).toBe(false);
@@ -788,9 +785,9 @@ describe("WorkBuddy recall injection hooks", () => {
await verifyRecallInstall(layout);
expect(await readFile(hooksPath, "utf8")).toContain("--inject workbuddy");
- await expect(
- checkSkillDrift(layout, runtime),
- ).resolves.toMatchObject({ state: "in_sync" });
+ await expect(checkSkillDrift(layout, runtime)).resolves.toMatchObject({
+ state: "in_sync",
+ });
});
it("keeps one speaking boundary hook, silent on failure, when the runtime ships no recall command", async () => {
@@ -822,9 +819,7 @@ describe("WorkBuddy recall injection hooks", () => {
it("moves an install with two speaking hooks per event onto the single one", async () => {
const { layout, plugin } = await fixture({ populated: true });
const runtime = await injectingRuntime();
- await applyRecallInstall(
- await planRecallInstall(layout, runtime),
- );
+ await applyRecallInstall(await planRecallInstall(layout, runtime));
// The bytes 66d8f88 wrote, journaled as ours, as an install from then has.
const legacy = legacyHooksFile(runtime);
const copies = [
@@ -845,9 +840,9 @@ describe("WorkBuddy recall injection hooks", () => {
}
await writeFile(layout.journalPath, JSON.stringify(journal));
- await expect(
- checkSkillDrift(layout, runtime),
- ).resolves.toMatchObject({ state: "stale" });
+ await expect(checkSkillDrift(layout, runtime)).resolves.toMatchObject({
+ state: "stale",
+ });
const sync = await planSkillSync(layout, runtime);
if (!sync) throw new Error("expected the hooks to sync");
expect(sync.requiresConfirmation).toBe(false);
@@ -863,9 +858,9 @@ describe("WorkBuddy recall injection hooks", () => {
);
for (const event of ["SessionStart", "UserPromptSubmit"])
expect(speakingHooks(hooks.hooks[event], capture)).toHaveLength(1);
- await expect(
- checkSkillDrift(layout, runtime),
- ).resolves.toMatchObject({ state: "in_sync" });
+ await expect(checkSkillDrift(layout, runtime)).resolves.toMatchObject({
+ state: "in_sync",
+ });
});
it("does not silently overwrite a hooks file the user edited", async () => {
@@ -879,9 +874,9 @@ describe("WorkBuddy recall injection hooks", () => {
);
const sync = await planSkillSync(layout, runtime).catch(() => null);
- await expect(
- checkSkillDrift(layout, runtime),
- ).resolves.toMatchObject({ state: "modified" });
+ await expect(checkSkillDrift(layout, runtime)).resolves.toMatchObject({
+ state: "modified",
+ });
expect(sync?.requiresConfirmation ?? true).toBe(true);
});
diff --git a/memhub/packages/host-bridge/tsup.config.bundled_aywp34b5o3u.mjs b/memhub/packages/host-bridge/tsup.config.bundled_aywp34b5o3u.mjs
index 881c88e..187fe18 100644
--- a/memhub/packages/host-bridge/tsup.config.bundled_aywp34b5o3u.mjs
+++ b/memhub/packages/host-bridge/tsup.config.bundled_aywp34b5o3u.mjs
@@ -1,5 +1,6 @@
// tsup.config.ts
import { defineConfig } from "tsup";
+
var tsup_config_default = defineConfig({
entry: ["src/mcp.ts", "src/installer-cli.ts", "src/recall-cli.ts"],
format: ["cjs"],
@@ -7,9 +8,8 @@ var tsup_config_default = defineConfig({
outDir: "dist",
// Preserve the separately built sync-hook asset directory.
clean: false,
- noExternal: ["axios"]
+ noExternal: ["axios"],
});
-export {
- tsup_config_default as default
-};
+
+export { tsup_config_default as default };
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiL1VzZXJzL2tyaXN0aW5oZS9Eb2N1bWVudHMvQ29kZXgvMjAyNi0wOS0xMC9uaS93b3JrL29uZS1tZW1vcnktZGVtby9wYWNrYWdlcy9ob3N0LWJyaWRnZS90c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCIvVXNlcnMva3Jpc3RpbmhlL0RvY3VtZW50cy9Db2RleC8yMDI2LTA5LTEwL25pL3dvcmsvb25lLW1lbW9yeS1kZW1vL3BhY2thZ2VzL2hvc3QtYnJpZGdlXCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9Vc2Vycy9rcmlzdGluaGUvRG9jdW1lbnRzL0NvZGV4LzIwMjYtMDktMTAvbmkvd29yay9vbmUtbWVtb3J5LWRlbW8vcGFja2FnZXMvaG9zdC1icmlkZ2UvdHN1cC5jb25maWcudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tIFwidHN1cFwiO1xuXG5leHBvcnQgZGVmYXVsdCBkZWZpbmVDb25maWcoe1xuICBlbnRyeTogW1wic3JjL21jcC50c1wiLCBcInNyYy9pbnN0YWxsZXItY2xpLnRzXCIsIFwic3JjL3JlY2FsbC1jbGkudHNcIl0sXG4gIGZvcm1hdDogW1wiY2pzXCJdLFxuICBwbGF0Zm9ybTogXCJub2RlXCIsXG4gIG91dERpcjogXCJkaXN0XCIsXG4gIC8vIFByZXNlcnZlIHRoZSBzZXBhcmF0ZWx5IGJ1aWx0IHN5bmMtaG9vayBhc3NldCBkaXJlY3RvcnkuXG4gIGNsZWFuOiBmYWxzZSxcbiAgbm9FeHRlcm5hbDogW1wiYXhpb3NcIl0sXG59KTtcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBc1osU0FBUyxvQkFBb0I7QUFFbmIsSUFBTyxzQkFBUSxhQUFhO0FBQUEsRUFDMUIsT0FBTyxDQUFDLGNBQWMsd0JBQXdCLG1CQUFtQjtBQUFBLEVBQ2pFLFFBQVEsQ0FBQyxLQUFLO0FBQUEsRUFDZCxVQUFVO0FBQUEsRUFDVixRQUFRO0FBQUE7QUFBQSxFQUVSLE9BQU87QUFBQSxFQUNQLFlBQVksQ0FBQyxPQUFPO0FBQ3RCLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg==
diff --git a/memhub/packages/host-bridge/tsup.config.bundled_dh728h7xesr.mjs b/memhub/packages/host-bridge/tsup.config.bundled_dh728h7xesr.mjs
index 881c88e..187fe18 100644
--- a/memhub/packages/host-bridge/tsup.config.bundled_dh728h7xesr.mjs
+++ b/memhub/packages/host-bridge/tsup.config.bundled_dh728h7xesr.mjs
@@ -1,5 +1,6 @@
// tsup.config.ts
import { defineConfig } from "tsup";
+
var tsup_config_default = defineConfig({
entry: ["src/mcp.ts", "src/installer-cli.ts", "src/recall-cli.ts"],
format: ["cjs"],
@@ -7,9 +8,8 @@ var tsup_config_default = defineConfig({
outDir: "dist",
// Preserve the separately built sync-hook asset directory.
clean: false,
- noExternal: ["axios"]
+ noExternal: ["axios"],
});
-export {
- tsup_config_default as default
-};
+
+export { tsup_config_default as default };
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidHN1cC5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9faW5qZWN0ZWRfZmlsZW5hbWVfXyA9IFwiL1VzZXJzL2tyaXN0aW5oZS9Eb2N1bWVudHMvQ29kZXgvMjAyNi0wOS0xMC9uaS93b3JrL29uZS1tZW1vcnktZGVtby9wYWNrYWdlcy9ob3N0LWJyaWRnZS90c3VwLmNvbmZpZy50c1wiO2NvbnN0IF9faW5qZWN0ZWRfZGlybmFtZV9fID0gXCIvVXNlcnMva3Jpc3RpbmhlL0RvY3VtZW50cy9Db2RleC8yMDI2LTA5LTEwL25pL3dvcmsvb25lLW1lbW9yeS1kZW1vL3BhY2thZ2VzL2hvc3QtYnJpZGdlXCI7Y29uc3QgX19pbmplY3RlZF9pbXBvcnRfbWV0YV91cmxfXyA9IFwiZmlsZTovLy9Vc2Vycy9rcmlzdGluaGUvRG9jdW1lbnRzL0NvZGV4LzIwMjYtMDktMTAvbmkvd29yay9vbmUtbWVtb3J5LWRlbW8vcGFja2FnZXMvaG9zdC1icmlkZ2UvdHN1cC5jb25maWcudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tIFwidHN1cFwiO1xuXG5leHBvcnQgZGVmYXVsdCBkZWZpbmVDb25maWcoe1xuICBlbnRyeTogW1wic3JjL21jcC50c1wiLCBcInNyYy9pbnN0YWxsZXItY2xpLnRzXCIsIFwic3JjL3JlY2FsbC1jbGkudHNcIl0sXG4gIGZvcm1hdDogW1wiY2pzXCJdLFxuICBwbGF0Zm9ybTogXCJub2RlXCIsXG4gIG91dERpcjogXCJkaXN0XCIsXG4gIC8vIFByZXNlcnZlIHRoZSBzZXBhcmF0ZWx5IGJ1aWx0IHN5bmMtaG9vayBhc3NldCBkaXJlY3RvcnkuXG4gIGNsZWFuOiBmYWxzZSxcbiAgbm9FeHRlcm5hbDogW1wiYXhpb3NcIl0sXG59KTtcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBc1osU0FBUyxvQkFBb0I7QUFFbmIsSUFBTyxzQkFBUSxhQUFhO0FBQUEsRUFDMUIsT0FBTyxDQUFDLGNBQWMsd0JBQXdCLG1CQUFtQjtBQUFBLEVBQ2pFLFFBQVEsQ0FBQyxLQUFLO0FBQUEsRUFDZCxVQUFVO0FBQUEsRUFDVixRQUFRO0FBQUE7QUFBQSxFQUVSLE9BQU87QUFBQSxFQUNQLFlBQVksQ0FBQyxPQUFPO0FBQ3RCLENBQUM7IiwKICAibmFtZXMiOiBbXQp9Cg==
diff --git a/memhub/packages/operations/src/source-sync-operation.test.ts b/memhub/packages/operations/src/source-sync-operation.test.ts
index 8a70dc2..3d0d2a5 100644
--- a/memhub/packages/operations/src/source-sync-operation.test.ts
+++ b/memhub/packages/operations/src/source-sync-operation.test.ts
@@ -47,9 +47,9 @@ describe("source sync operation", () => {
});
it("refuses a missing source id", () => {
- expect(() => buildSourceSyncRequest(source({ source_id: "" }), true)).toThrow(
- SourceSyncInputError,
- );
+ expect(() =>
+ buildSourceSyncRequest(source({ source_id: "" }), true),
+ ).toThrow(SourceSyncInputError);
});
it("requires authorization and an implemented live-sync capability", () => {
diff --git a/memhub/packages/runtime-control/src/background-artifact.ts b/memhub/packages/runtime-control/src/background-artifact.ts
index f6a693e..81b006d 100644
--- a/memhub/packages/runtime-control/src/background-artifact.ts
+++ b/memhub/packages/runtime-control/src/background-artifact.ts
@@ -163,14 +163,11 @@ async function manifest(root: string): Promise<DistributionManifest> {
bytes.subarray(0, length),
),
);
- exact(value, [
- "schema_version",
- "product",
- "version",
- "platform",
- "arch",
- "files",
- ], ["build_number"]);
+ exact(
+ value,
+ ["schema_version", "product", "version", "platform", "arch", "files"],
+ ["build_number"],
+ );
if (
value.schema_version !== 1 ||
value.product !== "one-memory-runtime" ||
diff --git a/memhub/packages/runtime-control/src/cli-link.test.ts b/memhub/packages/runtime-control/src/cli-link.test.ts
index fc2441b..5d66493 100644
--- a/memhub/packages/runtime-control/src/cli-link.test.ts
+++ b/memhub/packages/runtime-control/src/cli-link.test.ts
@@ -9,11 +9,7 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
-import {
- installCliLink,
- planCliLink,
- rollbackCliLink,
-} from "./cli-link.js";
+import { installCliLink, planCliLink, rollbackCliLink } from "./cli-link.js";
describe("public CLI link", () => {
it("creates memhub plus an idempotent one-memory compatibility link", async () => {
@@ -74,9 +70,7 @@ describe("public CLI link", () => {
});
expect(plan.status).toBe("blocked");
- await expect(installCliLink(plan)).rejects.toThrow(
- "cli_link_unmanaged",
- );
+ await expect(installCliLink(plan)).rejects.toThrow("cli_link_unmanaged");
expect(await readFile(command, "utf8")).toBe("another product");
});
@@ -93,9 +87,7 @@ describe("public CLI link", () => {
});
expect(plan.status).toBe("blocked");
- await expect(installCliLink(plan)).rejects.toThrow(
- "cli_link_unmanaged",
- );
+ await expect(installCliLink(plan)).rejects.toThrow("cli_link_unmanaged");
expect(await readFile(command, "utf8")).toBe("another product");
});
diff --git a/memhub/packages/runtime-control/src/cli-link.ts b/memhub/packages/runtime-control/src/cli-link.ts
index 9865fb1..2aaff19 100644
--- a/memhub/packages/runtime-control/src/cli-link.ts
+++ b/memhub/packages/runtime-control/src/cli-link.ts
@@ -44,7 +44,8 @@ export async function planCliLink(options: {
options.includeCompatibilityAlias === false
? undefined
: paths.join(binDirectory, executableName);
- const compatTargetPath = compatLinkPath === undefined ? undefined : targetPath;
+ const compatTargetPath =
+ compatLinkPath === undefined ? undefined : targetPath;
if (platform === "win32") {
return blocked(
platform,
diff --git a/memhub/packages/runtime-control/src/connection-batch.test.ts b/memhub/packages/runtime-control/src/connection-batch.test.ts
index c3dd4f0..14a27c4 100644
--- a/memhub/packages/runtime-control/src/connection-batch.test.ts
+++ b/memhub/packages/runtime-control/src/connection-batch.test.ts
@@ -46,9 +46,7 @@ const grant: ConnectionItem = {
allowedTools: ["om_recall"],
allowedScopes: ["all-apps"],
};
-function plan(
- items: ConnectionItem[] = [install, grant],
-): ConnectionPlan {
+function plan(items: ConnectionItem[] = [install, grant]): ConnectionPlan {
return {
schemaVersion: 1,
...owner,
@@ -286,10 +284,10 @@ describe("connection batch authorization and recovery", () => {
const { batch, adapters, ledger } = fixture();
vi.mocked(adapters.install.apply).mockImplementation(
async (item, context) => {
- expect(ledger.entries.get(context.operationId)?.items[0].state).toBe(
- "in_flight",
- );
- return { status: "succeeded", receipt: receipt(item, context) };
+ expect(ledger.entries.get(context.operationId)?.items[0].state).toBe(
+ "in_flight",
+ );
+ return { status: "succeeded", receipt: receipt(item, context) };
},
);
const result = await execute(batch);
diff --git a/memhub/packages/runtime-control/src/connection-batch.ts b/memhub/packages/runtime-control/src/connection-batch.ts
index ab5f86e..1f12e1c 100644
--- a/memhub/packages/runtime-control/src/connection-batch.ts
+++ b/memhub/packages/runtime-control/src/connection-batch.ts
@@ -344,7 +344,8 @@ export class ConnectionBatch {
const value = await this.adapters.inspect(item, context);
if (value.status === "denied") return "rejected";
if (value.status !== "ready") return "unavailable";
- if (canonical(value.sources) !== canonical(item.sources)) return "changed";
+ if (canonical(value.sources) !== canonical(item.sources))
+ return "changed";
if (canonical(value.host) !== canonical(context.host)) return "changed";
if (
item.kind === "install" &&
@@ -365,9 +366,7 @@ export class ConnectionBatch {
const current = await this.adapters.inspect(item, context);
if (current.status === "denied") return "rejected";
if (current.status !== "ready") return "unknown";
- if (
- canonical(current.sources) !== canonical(item.sources)
- )
+ if (canonical(current.sources) !== canonical(item.sources))
return "changed";
// The write itself may have changed revision/fingerprint. Reconciliation
// must prove that exact transition, but never across another layout/root.
diff --git a/memhub/packages/runtime-control/src/connection-client.test.ts b/memhub/packages/runtime-control/src/connection-client.test.ts
index 54c1f6a..e241dbf 100644
--- a/memhub/packages/runtime-control/src/connection-client.test.ts
+++ b/memhub/packages/runtime-control/src/connection-client.test.ts
@@ -1,10 +1,4 @@
-import {
- mkdir,
- mkdtemp,
- readdir,
- rename,
- rm,
-} from "node:fs/promises";
+import { mkdir, mkdtemp, readdir, rename, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import axios, { type AxiosRequestConfig } from "axios";
diff --git a/memhub/packages/runtime-control/src/connection-control-integration.test.ts b/memhub/packages/runtime-control/src/connection-control-integration.test.ts
index 36f2d87..9a18aca 100644
--- a/memhub/packages/runtime-control/src/connection-control-integration.test.ts
+++ b/memhub/packages/runtime-control/src/connection-control-integration.test.ts
@@ -371,13 +371,19 @@ it.each(["core-response-lost", "identity-changed-after-commit"])(
syncSourceIds: ["cursor"],
hostSourceIds: [],
});
- expect((await reopened.execute({
- planId: retry.planId,
- digest: retry.digest,
- userConfirmed: true,
- })).items[0].state).toBe("succeeded");
+ expect(
+ (
+ await reopened.execute({
+ planId: retry.planId,
+ digest: retry.digest,
+ userConfirmed: true,
+ })
+ ).items[0].state,
+ ).toBe("succeeded");
expect(f.posts).toHaveLength(1);
- expect(f.dispatched.filter((action) => action === "execute")).toHaveLength(2);
+ expect(f.dispatched.filter((action) => action === "execute")).toHaveLength(
+ 2,
+ );
},
);
diff --git a/memhub/packages/runtime-control/src/connection-control-service.test.ts b/memhub/packages/runtime-control/src/connection-control-service.test.ts
index 8f92f87..dbc90ce 100644
--- a/memhub/packages/runtime-control/src/connection-control-service.test.ts
+++ b/memhub/packages/runtime-control/src/connection-control-service.test.ts
@@ -1,3 +1,4 @@
+import { createHash } from "node:crypto";
import {
chmod,
mkdir,
@@ -9,7 +10,6 @@ import {
rm,
writeFile,
} from "node:fs/promises";
-import { createHash } from "node:crypto";
import { createServer, type ServerResponse } from "node:http";
import { tmpdir } from "node:os";
import path from "node:path";
@@ -243,9 +243,7 @@ it("real preview applies direct final-state sync with no operation receipt", asy
await service.handle(execute(plan));
expect(f.posts).toEqual([{ enabled: true }]);
expect(
- await service.handle(
- request("receipt", { operationId: plan.operationId }),
- ),
+ await service.handle(request("receipt", { operationId: plan.operationId })),
).toBeNull();
await service.stop();
const reopened = f.service();
diff --git a/memhub/packages/runtime-control/src/connection-controller.ts b/memhub/packages/runtime-control/src/connection-controller.ts
index 5c0dc13..8b589ec 100644
--- a/memhub/packages/runtime-control/src/connection-controller.ts
+++ b/memhub/packages/runtime-control/src/connection-controller.ts
@@ -415,8 +415,8 @@ export class ConnectionController {
state:
skipped.some((item) => item.state !== "unchanged") ||
sync.some((item) => item.state !== "succeeded")
- ? ("partial" as const)
- : result.state,
+ ? ("partial" as const)
+ : result.state,
items: [...result.items, ...sync],
skipped,
};
@@ -466,9 +466,7 @@ export class ConnectionController {
const current = await inspect(item);
if (current.status !== "ready")
return { status: current.status === "denied" ? "rejected" : "unknown" };
- if (
- canonical(current.sources) !== canonical(item.sources)
- )
+ if (canonical(current.sources) !== canonical(item.sources))
return { status: "changed" };
const { host: _host, ...binding } = context;
if (canonical(current.host) !== canonical(context.host))
@@ -538,9 +536,7 @@ export class ConnectionController {
if (!layout || layout.hostId === "openclaw") fail("unsupported_host");
return structuredClone(layout);
}
- private async sourcesUnchanged(
- identities: readonly SourceIdentity[],
- ) {
+ private async sourcesUnchanged(identities: readonly SourceIdentity[]) {
try {
const sources = await this.trusted.getSources();
return (
diff --git a/memhub/packages/runtime-control/src/core-supervisor-restart.test.ts b/memhub/packages/runtime-control/src/core-supervisor-restart.test.ts
index c7e3dd0..d6f9a54 100644
--- a/memhub/packages/runtime-control/src/core-supervisor-restart.test.ts
+++ b/memhub/packages/runtime-control/src/core-supervisor-restart.test.ts
@@ -1,13 +1,12 @@
import type { ChildProcess, SpawnOptions } from "node:child_process";
import { EventEmitter } from "node:events";
+import { mkdtemp } from "node:fs/promises";
+import os from "node:os";
+import path from "node:path";
import { describe, expect, it, vi } from "vitest";
-
import { CORE_READINESS_DEFAULTS, CoreSupervisor } from "./core-supervisor.js";
import type { DiagnosticInput } from "./diagnostic-log.js";
import { DiagnosticLogger } from "./diagnostic-log.js";
-import { mkdtemp } from "node:fs/promises";
-import os from "node:os";
-import path from "node:path";
/** A child that only exits when the test drives it, so we can simulate an
* unexpected Core crash (not a deliberate stop). */
@@ -362,7 +361,11 @@ describe("Core crash recovery (macOS launchd Runtime)", () => {
}
// The streak has to end in a circuit, not in an endless retry: relaunching
// is what wears the heap down.
- for (let crash = 0; crash < 6 && !events.includes("core.restart_circuit_opened"); crash += 1) {
+ for (
+ let crash = 0;
+ crash < 6 && !events.includes("core.restart_circuit_opened");
+ crash += 1
+ ) {
const child = children[children.length - 1];
child?.emit("exit", 1, null);
const seen = events.length;
diff --git a/memhub/packages/runtime-control/src/core-supervisor.ts b/memhub/packages/runtime-control/src/core-supervisor.ts
index 6c32f28..490cf01 100644
--- a/memhub/packages/runtime-control/src/core-supervisor.ts
+++ b/memhub/packages/runtime-control/src/core-supervisor.ts
@@ -681,7 +681,8 @@ export class CoreSupervisor {
// Carry the streak across rounds so the delay actually grows: 1s,
// 2s, 4s ... capped, rather than restarting from 1s every crash.
const delayMs = Math.min(
- this.options.restartBaseDelayMs * 2 ** (this.restartStreak + attempt),
+ this.options.restartBaseDelayMs *
+ 2 ** (this.restartStreak + attempt),
this.options.restartMaxDelayMs,
);
await this.options.diagnostics?.log({
diff --git a/memhub/packages/runtime-control/src/diagnostic-log.ts b/memhub/packages/runtime-control/src/diagnostic-log.ts
index fead397..26394af 100644
--- a/memhub/packages/runtime-control/src/diagnostic-log.ts
+++ b/memhub/packages/runtime-control/src/diagnostic-log.ts
@@ -279,7 +279,8 @@ export function writeDiagnosticEventSync(
...input,
service: options.service,
session_id: canonicalUuid(options.sessionId) ?? randomUUID(),
- timestamp: input.timestamp ?? (options.now ?? (() => new Date()))().toISOString(),
+ timestamp:
+ input.timestamp ?? (options.now ?? (() => new Date()))().toISOString(),
});
const directory = diagnosticDirectory(options.dataDir);
mkdirSync(directory, { recursive: true, mode: 0o700 });
@@ -849,7 +850,9 @@ function compareDiagnosticTimestamps(left: string, right: string): number {
if (!Number.isFinite(milliseconds)) fail("diagnostic_timestamp_invalid");
const fraction = /\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/.exec(value)?.[1] ?? "";
const nanoseconds = BigInt((fraction + "000000000").slice(0, 9));
- return BigInt(Math.floor(milliseconds / 1000)) * 1_000_000_000n + nanoseconds;
+ return (
+ BigInt(Math.floor(milliseconds / 1000)) * 1_000_000_000n + nanoseconds
+ );
};
const leftKey = key(left);
const rightKey = key(right);
diff --git a/memhub/packages/runtime-control/src/index.test.ts b/memhub/packages/runtime-control/src/index.test.ts
index ab9a566..7e40a4b 100644
--- a/memhub/packages/runtime-control/src/index.test.ts
+++ b/memhub/packages/runtime-control/src/index.test.ts
@@ -3,10 +3,7 @@ import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
-import {
- discoverRuntimeAttachment,
- RuntimeDiscoveryError,
-} from "./index.js";
+import { discoverRuntimeAttachment, RuntimeDiscoveryError } from "./index.js";
async function runtimeFixture(changes: Record<string, unknown> = {}) {
const dataDir = await mkdtemp(path.join(tmpdir(), "runtime-control-"));
@@ -77,7 +74,9 @@ describe("Runtime attachment discovery", () => {
});
it("leaves absent, stale, legacy and parent-owned receipts to the caller", async () => {
- const missing = await mkdtemp(path.join(tmpdir(), "runtime-control-missing-"));
+ const missing = await mkdtemp(
+ path.join(tmpdir(), "runtime-control-missing-"),
+ );
const probe = vi.fn();
await expect(
discoverRuntimeAttachment({
diff --git a/memhub/packages/runtime-control/src/local-uninstall.test.ts b/memhub/packages/runtime-control/src/local-uninstall.test.ts
index 59da8f4..3b57e74 100644
--- a/memhub/packages/runtime-control/src/local-uninstall.test.ts
+++ b/memhub/packages/runtime-control/src/local-uninstall.test.ts
@@ -10,10 +10,7 @@ import {
import { tmpdir } from "node:os";
import path from "node:path";
import { describe, expect, it } from "vitest";
-import {
- applyLocalUninstall,
- planLocalUninstall,
-} from "./local-install.js";
+import { applyLocalUninstall, planLocalUninstall } from "./local-install.js";
const applyManagedUninstall = applyLocalUninstall;
diff --git a/memhub/packages/runtime-control/src/platform/linux/linux-runtime.test.ts b/memhub/packages/runtime-control/src/platform/linux/linux-runtime.test.ts
index 860b908..8534ee6 100644
--- a/memhub/packages/runtime-control/src/platform/linux/linux-runtime.test.ts
+++ b/memhub/packages/runtime-control/src/platform/linux/linux-runtime.test.ts
@@ -1,7 +1,6 @@
+import path from "node:path";
import { describe, expect, it } from "vitest";
-
import { planLinuxRuntimeControl } from "./linux-runtime.js";
-import path from "node:path";
function layout(home: string) {
return {
@@ -65,13 +64,17 @@ describe("Linux runtime control matrix", () => {
status: "ready",
service_id: "one-memory.service",
});
- expect(service?.legacyCanonicalDigest).toBe("b6c22afdd859760050cac9a4f621e67b38e0eaca");
+ expect(service?.legacyCanonicalDigest).toBe(
+ "b6c22afdd859760050cac9a4f621e67b38e0eaca",
+ );
expect(service?.migrate).toBe(true);
expect(service?.upgradeCommands).toEqual([
["systemctl", "--user", "stop", "one-memory.service"],
["systemctl", "--user", "enable", "--now", "one-memory.service"],
]);
- expect(service?.plan.service_file?.content).toContain("WantedBy=default.target");
+ expect(service?.plan.service_file?.content).toContain(
+ "WantedBy=default.target",
+ );
});
it("does not overwrite a unit whose only difference is upstream hardening", () => {
diff --git a/memhub/packages/runtime-control/src/platform/linux/linux-runtime.ts b/memhub/packages/runtime-control/src/platform/linux/linux-runtime.ts
index 6efc11d..b4b16ea 100644
--- a/memhub/packages/runtime-control/src/platform/linux/linux-runtime.ts
+++ b/memhub/packages/runtime-control/src/platform/linux/linux-runtime.ts
@@ -57,7 +57,11 @@ function sha1(value: string): string {
}
function addBackoff(content: string): string {
- if (content.includes("RestartSec=") && content.includes("StartLimitIntervalSec=")) return content;
+ if (
+ content.includes("RestartSec=") &&
+ content.includes("StartLimitIntervalSec=")
+ )
+ return content;
return content.replace(/Restart=on-failure\n?/, RESTART_BACKOFF_HEADER);
}
@@ -89,15 +93,25 @@ export function planLinuxRuntimeControl(input: {
plan.service_file.content = addBackoff(plan.service_file.content);
const current = input.currentUnit ?? null;
- const same = current !== null && canonicalUnit(current) === canonicalUnit(plan.service_file.content);
+ const same =
+ current !== null &&
+ canonicalUnit(current) === canonicalUnit(plan.service_file.content);
const legacy =
- current !== null && !same && sha1(canonicalUnit(current)) === LEGACY_CANONICAL_DIGEST;
+ current !== null &&
+ !same &&
+ sha1(canonicalUnit(current)) === LEGACY_CANONICAL_DIGEST;
const upgradeCommands = same
? []
: legacy
? [
["systemctl", "--user", "stop", "one-memory.service"] as const,
- ["systemctl", "--user", "enable", "--now", "one-memory.service"] as const,
+ [
+ "systemctl",
+ "--user",
+ "enable",
+ "--now",
+ "one-memory.service",
+ ] as const,
]
: [];
diff --git a/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.test.ts b/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.test.ts
index 71ce5c7..a8c89c8 100644
--- a/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.test.ts
+++ b/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.test.ts
@@ -1,4 +1,3 @@
-import { beforeEach, describe, expect, it } from "vitest";
import {
chmod,
lstat,
@@ -10,10 +9,11 @@ import {
} from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
+import { beforeEach, describe, expect, it } from "vitest";
import {
- buildLinuxUninstallPlan,
applyLinuxUninstall,
+ buildLinuxUninstallPlan,
verifyLinuxUninstallPlan,
} from "./linux-uninstall.js";
@@ -24,7 +24,9 @@ async function home() {
const HOME = home();
const INSTALL_ROOT = HOME.then((value) => path.join(value, "install"));
const DATA_DIR = HOME.then((value) => path.join(value, "One Memory Data"));
-const UNIT_PATH = HOME.then((value) => path.join(value, "systemd/user/one-memory.service"));
+const UNIT_PATH = HOME.then((value) =>
+ path.join(value, "systemd/user/one-memory.service"),
+);
const UNIT_CONTENT = "[Service]\nExecStart=old\n";
const CLI_LINK = HOME.then((value) => path.join(value, "bin/one-memory"));
@@ -33,15 +35,26 @@ async function fixture() {
await mkdir(path.join(await INSTALL_ROOT, "versions/0.0.0-linux-arm64/bin"), {
recursive: true,
});
- await writeFile(path.join(await INSTALL_ROOT, "versions/0.0.0-linux-arm64/bin/one-memory"), "program");
+ await writeFile(
+ path.join(await INSTALL_ROOT, "versions/0.0.0-linux-arm64/bin/one-memory"),
+ "program",
+ );
await mkdir(path.join(await INSTALL_ROOT, "unknown"), { recursive: true });
await writeFile(path.join(await INSTALL_ROOT, "unknown/stray"), "stray");
- await symlink("versions/0.0.0-linux-arm64", path.join(await INSTALL_ROOT, "current"), "dir");
+ await symlink(
+ "versions/0.0.0-linux-arm64",
+ path.join(await INSTALL_ROOT, "current"),
+ "dir",
+ );
await mkdir(path.dirname(await UNIT_PATH), { recursive: true });
await writeFile(await UNIT_PATH, UNIT_CONTENT);
await chmod(await UNIT_PATH, 0o600);
await mkdir(path.dirname(await CLI_LINK), { recursive: true });
- await symlink(path.join(await INSTALL_ROOT, "current/bin/one-memory"), await CLI_LINK, "file");
+ await symlink(
+ path.join(await INSTALL_ROOT, "current/bin/one-memory"),
+ await CLI_LINK,
+ "file",
+ );
await mkdir(await DATA_DIR, { recursive: true });
await writeFile(path.join(await DATA_DIR, "data"), "keep");
}
@@ -63,8 +76,12 @@ describe("Linux product uninstall", () => {
expect(plan.stops_service).toBe(true);
const receipt = await applyLinuxUninstall(plan);
expect(receipt.removed_version_directories).toHaveLength(1);
- await expect(lstat(path.join(await DATA_DIR, "data"))).resolves.toBeTruthy();
- await expect(lstat(path.join(await INSTALL_ROOT, "unknown/stray"))).resolves.toBeTruthy();
+ await expect(
+ lstat(path.join(await DATA_DIR, "data")),
+ ).resolves.toBeTruthy();
+ await expect(
+ lstat(path.join(await INSTALL_ROOT, "unknown/stray")),
+ ).resolves.toBeTruthy();
await expect(lstat(await UNIT_PATH)).resolves.toBeTruthy();
await expect(lstat(await CLI_LINK)).rejects.toThrow();
});
@@ -85,8 +102,12 @@ describe("Linux product uninstall", () => {
expect(receipt.removed_cli_link).toBe(true);
await expect(lstat(await CLI_LINK)).rejects.toThrow();
await expect(lstat(await UNIT_PATH)).resolves.toBeTruthy();
- await expect(lstat(path.join(await DATA_DIR, "data"))).resolves.toBeTruthy();
- await expect(lstat(path.join(await INSTALL_ROOT, "unknown/stray"))).resolves.toBeTruthy();
+ await expect(
+ lstat(path.join(await DATA_DIR, "data")),
+ ).resolves.toBeTruthy();
+ await expect(
+ lstat(path.join(await INSTALL_ROOT, "unknown/stray")),
+ ).resolves.toBeTruthy();
});
it("preserves a link that points outside the managed installation", async () => {
@@ -101,6 +122,8 @@ describe("Linux product uninstall", () => {
});
await unlink(await CLI_LINK);
await symlink("/usr/bin/true", await CLI_LINK, "file");
- await expect(verifyLinuxUninstallPlan(plan)).rejects.toThrow("linux_cli_link_unmanaged");
+ await expect(verifyLinuxUninstallPlan(plan)).rejects.toThrow(
+ "linux_cli_link_unmanaged",
+ );
});
});
diff --git a/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.ts b/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.ts
index 7762cfa..16c108e 100644
--- a/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.ts
+++ b/memhub/packages/runtime-control/src/platform/linux/linux-uninstall.ts
@@ -3,9 +3,9 @@ import path from "node:path";
import {
applyLocalUninstall,
- planLocalUninstall,
type LocalUninstallPlan,
type LocalUninstallReceipt,
+ planLocalUninstall,
} from "../../local-install.js";
export interface LinuxUninstallPlan extends LocalUninstallPlan {}
@@ -20,7 +20,11 @@ export async function buildLinuxUninstallPlan(options: {
unitPath?: string;
unitContent?: string;
}): Promise<LinuxUninstallPlan> {
- if (options.stopsService && options.unitPath && options.unitContent !== undefined) {
+ if (
+ options.stopsService &&
+ options.unitPath &&
+ options.unitContent !== undefined
+ ) {
const existing = await readlinkSafe(options.unitPath);
if (existing === null) {
const { readFile } = await import("node:fs/promises");
@@ -36,7 +40,9 @@ export async function buildLinuxUninstallPlan(options: {
return basePlan;
}
-export async function verifyLinuxUninstallPlan(plan: LinuxUninstallPlan): Promise<void> {
+export async function verifyLinuxUninstallPlan(
+ plan: LinuxUninstallPlan,
+): Promise<void> {
if (plan.cli_link) {
const link = await readlinkSafe(plan.cli_link);
if (link === null) {
@@ -50,7 +56,12 @@ export async function verifyLinuxUninstallPlan(plan: LinuxUninstallPlan): Promis
if (actual !== expected) throw new Error("linux_cli_link_unmanaged");
} else {
const target = path.resolve(path.dirname(plan.cli_link), link);
- const expected = path.join(plan.install_root, "current", "bin", "one-memory");
+ const expected = path.join(
+ plan.install_root,
+ "current",
+ "bin",
+ "one-memory",
+ );
if (target !== expected) throw new Error("linux_cli_link_unmanaged");
}
}
diff --git a/memhub/packages/runtime-control/src/platform/windows/research.test.ts b/memhub/packages/runtime-control/src/platform/windows/research.test.ts
index 6e98d4e..549e614 100644
--- a/memhub/packages/runtime-control/src/platform/windows/research.test.ts
+++ b/memhub/packages/runtime-control/src/platform/windows/research.test.ts
@@ -1,12 +1,14 @@
import { describe, expect, it } from "vitest";
import {
- WINDOWS_RESEARCH_STATE,
createWindowsSupportAssessment,
+ WINDOWS_RESEARCH_STATE,
} from "./research.js";
describe("Windows H08 support assessment", () => {
it("keeps every real-machine gate blocked instead of extrapolating", () => {
- for (const capability of Object.values(WINDOWS_RESEARCH_STATE.capabilities)) {
+ for (const capability of Object.values(
+ WINDOWS_RESEARCH_STATE.capabilities,
+ )) {
if ("status" in capability && capability.status !== "implemented") {
expect(capability.status).toBe("blocked");
expect(capability.blocked_reason).toMatch(/windows|target_machine/);
@@ -21,8 +23,14 @@ describe("Windows H08 support assessment", () => {
it("explicitly excludes Windows 10 and arm64 from the x64 release gate", () => {
expect(WINDOWS_RESEARCH_STATE.explicit_matrix).toMatchObject({
- windows_10_x64: { support: "blocked", blocked_reason: "windows_10_matrix_not_measured" },
- windows_arm64: { support: "blocked", blocked_reason: "windows_arm64_matrix_not_measured" },
+ windows_10_x64: {
+ support: "blocked",
+ blocked_reason: "windows_10_matrix_not_measured",
+ },
+ windows_arm64: {
+ support: "blocked",
+ blocked_reason: "windows_arm64_matrix_not_measured",
+ },
});
});
@@ -47,11 +55,13 @@ describe("Windows H08 support assessment", () => {
it("normalizes Windows paths for a future reparse-point containment check", () => {
const assessment = createWindowsSupportAssessment();
- expect(assessment.reparseLikePath("C:\\Programs\\中文 One Memory\\runtime")).toBe(
- "C:\\Programs\\中文 One Memory\\runtime",
- );
+ expect(
+ assessment.reparseLikePath("C:\\Programs\\中文 One Memory\\runtime"),
+ ).toBe("C:\\Programs\\中文 One Memory\\runtime");
expect(assessment.reparseLikePath("relative\\path")).toBeNull();
- expect(assessment.containsReparseMarker("C:\\One Memory\\runtime")).toBe(true);
+ expect(assessment.containsReparseMarker("C:\\One Memory\\runtime")).toBe(
+ true,
+ );
expect(assessment.containsReparseMarker("")).toBe(false);
});
});
diff --git a/memhub/packages/runtime-control/src/platform/windows/research.ts b/memhub/packages/runtime-control/src/platform/windows/research.ts
index d4fa111..bcb66a1 100644
--- a/memhub/packages/runtime-control/src/platform/windows/research.ts
+++ b/memhub/packages/runtime-control/src/platform/windows/research.ts
@@ -15,9 +15,18 @@ export const WINDOWS_RESEARCH_STATE = {
blocked_reason: "windows_target_machine_required",
},
explicit_matrix: {
- "windows_11_x64": { support: "blocked", blocked_reason: "windows_target_machine_required" },
- "windows_10_x64": { support: "blocked", blocked_reason: "windows_10_matrix_not_measured" },
- "windows_arm64": { support: "blocked", blocked_reason: "windows_arm64_matrix_not_measured" },
+ windows_11_x64: {
+ support: "blocked",
+ blocked_reason: "windows_target_machine_required",
+ },
+ windows_10_x64: {
+ support: "blocked",
+ blocked_reason: "windows_10_matrix_not_measured",
+ },
+ windows_arm64: {
+ support: "blocked",
+ blocked_reason: "windows_arm64_matrix_not_measured",
+ },
},
capabilities: {
x64_core_electron_cli_build: {
@@ -62,7 +71,8 @@ export const WINDOWS_RESEARCH_STATE = {
},
app_cli_shared_runtime: {
status: "implemented",
- evidence: "shared runtime-control layout and same install root are source-contract implemented",
+ evidence:
+ "shared runtime-control layout and same install root are source-contract implemented",
},
},
} as const;
@@ -83,13 +93,16 @@ export function createWindowsSupportAssessment(): WindowsSupportAssessment {
},
blockedReason(platform, arch) {
if (platform !== "win32") return null;
- if (arch !== "x64") return WINDOWS_RESEARCH_STATE.explicit_matrix.windows_arm64.blocked_reason;
+ if (arch !== "x64")
+ return WINDOWS_RESEARCH_STATE.explicit_matrix.windows_arm64
+ .blocked_reason;
return WINDOWS_RESEARCH_STATE.minimum_release_gate.blocked_reason;
},
canUsePosixOwnerOnlyFallback(platform) {
return platform !== "win32";
},
- containsReparseMarker: (source) => getNormalizedWindowsPath(source) !== null,
+ containsReparseMarker: (source) =>
+ getNormalizedWindowsPath(source) !== null,
reparseLikePath: (source) => getNormalizedWindowsPath(source),
};
}
diff --git a/memhub/packages/runtime-control/src/platform/windows/windows-runtime.ts b/memhub/packages/runtime-control/src/platform/windows/windows-runtime.ts
index 91ac4e5..3c336e5 100644
--- a/memhub/packages/runtime-control/src/platform/windows/windows-runtime.ts
+++ b/memhub/packages/runtime-control/src/platform/windows/windows-runtime.ts
@@ -1,7 +1,7 @@
import {
- runtimeInstallLayout,
type RuntimeInstallLayout,
type RuntimeServicePlan,
+ runtimeInstallLayout,
} from "../../service-plan.js";
export type WindowsCapabilityStatus = "available" | "unavailable" | "unknown";
diff --git a/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.test.ts b/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.test.ts
index fd34793..9ddee23 100644
--- a/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.test.ts
+++ b/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.test.ts
@@ -1,4 +1,11 @@
-import { mkdtemp, mkdir, rm, writeFile, symlink, readlink } from "node:fs/promises";
+import {
+ mkdir,
+ mkdtemp,
+ readlink,
+ rm,
+ symlink,
+ writeFile,
+} from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it } from "vitest";
diff --git a/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.ts b/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.ts
index d14e16e..d726ea0 100644
--- a/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.ts
+++ b/memhub/packages/runtime-control/src/platform/windows/windows-uninstall.ts
@@ -1,10 +1,10 @@
-import { readlink, lstat, readFile } from "node:fs/promises";
+import { lstat, readFile, readlink } from "node:fs/promises";
import path from "node:path";
import {
- planLocalUninstall,
type LocalUninstallPlan,
type LocalUninstallReceipt,
+ planLocalUninstall,
} from "../../local-install.js";
export type WindowsUninstallPlan = LocalUninstallPlan;
@@ -25,10 +25,7 @@ export async function planWindowsUninstall(options: {
}): Promise<WindowsUninstallPlan> {
const basePlan = await planLocalUninstall(options);
if (basePlan.cli_link) {
- await assertManagedWindowsCliLink(
- basePlan.cli_link,
- basePlan.install_root,
- );
+ await assertManagedWindowsCliLink(basePlan.cli_link, basePlan.install_root);
}
return basePlan;
}
diff --git a/memhub/packages/runtime-control/src/recall-hosts.test.ts b/memhub/packages/runtime-control/src/recall-hosts.test.ts
index 81ef5ae..e31fc8c 100644
--- a/memhub/packages/runtime-control/src/recall-hosts.test.ts
+++ b/memhub/packages/runtime-control/src/recall-hosts.test.ts
@@ -13,10 +13,7 @@ afterEach(async () => {
});
it("gives every DeepSeek Harness profile a matching unique layout identity", async () => {
- const root = path.join(
- tmpdir(),
- `recall-hosts-${process.pid}-${Date.now()}`,
- );
+ const root = path.join(tmpdir(), `recall-hosts-${process.pid}-${Date.now()}`);
roots.push(root);
const dshHome = path.join(root, ".dsh");
for (const profile of ["web", "headless"]) {
diff --git a/memhub/packages/runtime-control/src/release-contract.test.ts b/memhub/packages/runtime-control/src/release-contract.test.ts
index 214e224..95264c7 100644
--- a/memhub/packages/runtime-control/src/release-contract.test.ts
+++ b/memhub/packages/runtime-control/src/release-contract.test.ts
@@ -1,6 +1,6 @@
import { readFile } from "node:fs/promises";
-import { fileURLToPath } from "node:url";
import path from "node:path";
+import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import {
CLI_PROTOCOL,
@@ -16,7 +16,9 @@ describe("release protocol contract", () => {
path.dirname(fileURLToPath(import.meta.url)),
"../../..",
);
- const pkg = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
+ const pkg = JSON.parse(
+ await readFile(path.join(root, "package.json"), "utf8"),
+ );
expect({
runtime_manifest_schema: RUNTIME_MANIFEST_SCHEMA,
cli_protocol: CLI_PROTOCOL,
diff --git a/memhub/packages/runtime-control/src/release-contract.ts b/memhub/packages/runtime-control/src/release-contract.ts
index f9666a2..9ed22a2 100644
--- a/memhub/packages/runtime-control/src/release-contract.ts
+++ b/memhub/packages/runtime-control/src/release-contract.ts
@@ -28,6 +28,9 @@ export function protocolRange(value: unknown): value is ProtocolRange {
);
}
-export function protocolIncludes(range: ProtocolRange, version: number): boolean {
+export function protocolIncludes(
+ range: ProtocolRange,
+ version: number,
+): boolean {
return version >= range.min && version <= range.max;
}
diff --git a/memhub/packages/runtime-control/src/release-download.test.ts b/memhub/packages/runtime-control/src/release-download.test.ts
index 9a93998..5d52f3f 100644
--- a/memhub/packages/runtime-control/src/release-download.test.ts
+++ b/memhub/packages/runtime-control/src/release-download.test.ts
@@ -11,15 +11,15 @@ import {
import os from "node:os";
import path from "node:path";
import { Readable } from "node:stream";
-import { afterEach, describe, expect, it } from "vitest";
import * as tar from "tar";
+import { afterEach, describe, expect, it } from "vitest";
import {
acquireRuntimeDistribution,
type HttpGet,
parseRuntimeReleaseManifest,
- selectRuntimeReleaseArtifact,
type RuntimeReleaseArtifact,
type RuntimeReleaseManifest,
+ selectRuntimeReleaseArtifact,
validateTarEntry,
} from "./release-download.js";
@@ -42,7 +42,9 @@ async function fixture(
manifestPlatform?: "darwin" | "linux";
} = {},
) {
- const root = await mkdtemp(path.join(os.tmpdir(), "memhub-release-download-"));
+ const root = await mkdtemp(
+ path.join(os.tmpdir(), "memhub-release-download-"),
+ );
roots.push(root);
const distribution = path.join(root, "distribution");
await mkdir(distribution, { mode: 0o700 });
@@ -236,8 +238,18 @@ describe("archive entry safety", () => {
["../outside", "File", undefined, "release_archive_path_invalid"],
["/absolute", "File", undefined, "release_archive_path_invalid"],
["safe\\windows", "File", undefined, "release_archive_path_invalid"],
- ["safe/device", "CharacterDevice", undefined, "release_archive_type_invalid"],
- ["safe/symlink", "SymbolicLink", "../../outside", "release_archive_link_escapes"],
+ [
+ "safe/device",
+ "CharacterDevice",
+ undefined,
+ "release_archive_type_invalid",
+ ],
+ [
+ "safe/symlink",
+ "SymbolicLink",
+ "../../outside",
+ "release_archive_link_escapes",
+ ],
["safe/hardlink", "Link", "../outside", "release_archive_link_escapes"],
["safe/hardlink", "Link", "/absolute", "release_archive_link_escapes"],
] as const)(
@@ -254,15 +266,20 @@ describe("archive entry safety", () => {
["safe/directory", "Directory", undefined],
["safe/symlink", "SymbolicLink", "../target"],
["safe/hardlink", "Link", "safe/target"],
- ] as const)("accepts contained path=%s type=%s link=%s", (entryPath, type, linkPath) => {
- expect(() => validateTarEntry(entryPath, type, linkPath)).not.toThrow();
- });
+ ] as const)(
+ "accepts contained path=%s type=%s link=%s",
+ (entryPath, type, linkPath) => {
+ expect(() => validateTarEntry(entryPath, type, linkPath)).not.toThrow();
+ },
+ );
});
describe("remote Runtime acquisition", () => {
it("downloads, hashes, safely extracts and verifies the existing distribution contract", async () => {
const value = await fixture();
- const temporaryParent = await mkdtemp(path.join(os.tmpdir(), "memhub-release-parent-"));
+ const temporaryParent = await mkdtemp(
+ path.join(os.tmpdir(), "memhub-release-parent-"),
+ );
roots.push(temporaryParent);
const acquired = await acquireRuntimeDistribution({
manifestUrl: "https://downloads.example.test/release-manifest.json",
@@ -281,10 +298,12 @@ describe("remote Runtime acquisition", () => {
}),
});
- expect(await readFile(path.join(acquired.distribution, "payload.txt"), "utf8"))
- .toBe("verified runtime payload\n");
- expect((await lstat(path.join(acquired.distribution, "launcher"))).mode & 0o111)
- .toBe(0o100);
+ expect(
+ await readFile(path.join(acquired.distribution, "payload.txt"), "utf8"),
+ ).toBe("verified runtime payload\n");
+ expect(
+ (await lstat(path.join(acquired.distribution, "launcher"))).mode & 0o111,
+ ).toBe(0o100);
expect(acquired.release.version).toBe("1.2.3");
expect((await lstat(acquired.temporary_root)).mode & 0o777).toBe(0o700);
await acquired.cleanup();
@@ -486,7 +505,9 @@ describe("remote Runtime acquisition", () => {
it("rejects an archive symlink that escapes extraction root and cleans temporary state", async () => {
const value = await fixture({ escapingLink: true });
- const temporaryParent = await mkdtemp(path.join(os.tmpdir(), "memhub-release-parent-"));
+ const temporaryParent = await mkdtemp(
+ path.join(os.tmpdir(), "memhub-release-parent-"),
+ );
roots.push(temporaryParent);
await expect(
acquireRuntimeDistribution({
diff --git a/memhub/packages/runtime-control/src/release-download.ts b/memhub/packages/runtime-control/src/release-download.ts
index c3b5bd8..1a01b62 100644
--- a/memhub/packages/runtime-control/src/release-download.ts
+++ b/memhub/packages/runtime-control/src/release-download.ts
@@ -3,8 +3,8 @@ import { createReadStream } from "node:fs";
import {
chmod,
lstat,
- mkdtemp,
mkdir,
+ mkdtemp,
open,
readdir,
readFile,
@@ -14,7 +14,7 @@ import {
} from "node:fs/promises";
import os from "node:os";
import path from "node:path";
-import { Readable } from "node:stream";
+import type { Readable } from "node:stream";
import axios from "axios";
import { HttpsProxyAgent } from "https-proxy-agent";
// proxy-from-env 2.1.0 ships ESM/CJS entrypoints but no TypeScript declarations.
@@ -157,11 +157,11 @@ export function parseRuntimeReleaseManifest(
}
if (
value.cli_protocol !== CLI_PROTOCOL ||
+ !protocolIncludes(CLI_SUPPORTED_RUNTIME_PROTOCOL, value.runtime_protocol) ||
!protocolIncludes(
- CLI_SUPPORTED_RUNTIME_PROTOCOL,
+ value.supported_runtime_protocol,
value.runtime_protocol,
) ||
- !protocolIncludes(value.supported_runtime_protocol, value.runtime_protocol) ||
!protocolIncludes(value.supported_cli_protocol, CLI_PROTOCOL)
) {
throw new Error("release_protocol_incompatible");
@@ -224,7 +224,8 @@ export function selectRuntimeReleaseArtifact(
const artifact = release.artifacts.find(
(candidate): candidate is RuntimeReleaseArtifact =>
candidate.kind === "runtime" &&
- candidate.platform === options.platform && candidate.arch === options.arch,
+ candidate.platform === options.platform &&
+ candidate.arch === options.arch,
);
if (!artifact) throw new Error("release_artifact_unavailable");
return artifact;
@@ -254,7 +255,10 @@ export async function acquireRuntimeDistribution(options: {
const artifactUrl = trustedUrl(artifact.url);
const maxArtifactBytes = options.maxArtifactBytes ?? 2 * 1024 * 1024 * 1024;
const maxUnpackedBytes = options.maxUnpackedBytes ?? 4 * 1024 * 1024 * 1024;
- if (artifact.bytes > maxArtifactBytes || artifact.unpacked_bytes > maxUnpackedBytes) {
+ if (
+ artifact.bytes > maxArtifactBytes ||
+ artifact.unpacked_bytes > maxUnpackedBytes
+ ) {
throw new Error("release_artifact_too_large");
}
@@ -264,7 +268,9 @@ export async function acquireRuntimeDistribution(options: {
artifact.bytes + artifact.unpacked_bytes,
options.statfsImpl ?? statfs,
);
- const temporaryRoot = await mkdtemp(path.join(temporaryParent, "memhub-runtime-"));
+ const temporaryRoot = await mkdtemp(
+ path.join(temporaryParent, "memhub-runtime-"),
+ );
await chmod(temporaryRoot, 0o700);
const archive = path.join(temporaryRoot, artifact.filename);
const extracted = path.join(temporaryRoot, "extracted");
@@ -340,7 +346,9 @@ export async function resolveRuntimeRelease(options: {
});
let releaseValue: unknown;
try {
- releaseValue = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(manifestBytes));
+ releaseValue = JSON.parse(
+ new TextDecoder("utf-8", { fatal: true }).decode(manifestBytes),
+ );
} catch {
throw new Error("release_manifest_invalid");
}
@@ -426,7 +434,8 @@ async function fetchBytes(
}
for await (const chunk of response.body) {
total += chunk.byteLength;
- if (total > options.maxBytes) throw new Error("release_response_too_large");
+ if (total > options.maxBytes)
+ throw new Error("release_response_too_large");
chunks.push(chunk);
}
});
@@ -472,7 +481,8 @@ async function downloadArtifact(
} finally {
await file.close();
}
- if (total !== artifact.bytes) throw new Error("release_artifact_size_mismatch");
+ if (total !== artifact.bytes)
+ throw new Error("release_artifact_size_mismatch");
if (digest.digest("hex") !== artifact.sha256) {
throw new Error("release_artifact_hash_mismatch");
}
@@ -515,7 +525,8 @@ async function forResponse(
await consume(response);
return;
} catch (error) {
- if (controller.signal.aborted) throw new Error("release_download_timeout");
+ if (controller.signal.aborted)
+ throw new Error("release_download_timeout");
throw error;
} finally {
clearTimeout(timeout);
@@ -549,9 +560,7 @@ async function extractRuntimeArchive(
}
} catch (error) {
validationError =
- error instanceof Error
- ? error
- : new Error("release_archive_invalid");
+ error instanceof Error ? error : new Error("release_archive_invalid");
}
},
});
@@ -588,22 +597,29 @@ export function validateTarEntry(
type: string,
linkPath: string | undefined,
): void {
- if (!safeArchivePath(entryPath)) throw new Error("release_archive_path_invalid");
+ if (!safeArchivePath(entryPath))
+ throw new Error("release_archive_path_invalid");
if (!["File", "Directory", "SymbolicLink", "Link"].includes(type)) {
throw new Error("release_archive_type_invalid");
}
if (type === "SymbolicLink" || type === "Link") {
- if (!linkPath || path.posix.isAbsolute(linkPath) || linkPath.includes("\\")) {
+ if (
+ !linkPath ||
+ path.posix.isAbsolute(linkPath) ||
+ linkPath.includes("\\")
+ ) {
throw new Error("release_archive_link_escapes");
}
const base = type === "Link" ? "." : path.posix.dirname(entryPath);
const resolved = path.posix.normalize(path.posix.join(base, linkPath));
- if (!safeArchivePath(resolved)) throw new Error("release_archive_link_escapes");
+ if (!safeArchivePath(resolved))
+ throw new Error("release_archive_link_escapes");
}
}
async function locateDistribution(extracted: string): Promise<string> {
- if (await regularFile(path.join(extracted, "manifest.json"))) return extracted;
+ if (await regularFile(path.join(extracted, "manifest.json")))
+ return extracted;
const entries = await readdir(extracted, { withFileTypes: true });
const directories = entries.filter((entry) => entry.isDirectory());
if (entries.length !== 1 || directories.length !== 1) {
@@ -721,19 +737,24 @@ function safeArchivePath(value: string): boolean {
const segments = withoutTrailingSlash.split("/");
if (
withoutTrailingSlash.length === 0 ||
- segments.some((segment) => segment === "" || segment === "." || segment === "..")
+ segments.some(
+ (segment) => segment === "" || segment === "." || segment === "..",
+ )
) {
return false;
}
return path.posix.normalize(withoutTrailingSlash) === withoutTrailingSlash;
}
-function contentLength(headers: Record<string, string | undefined>): number | null {
+function contentLength(
+ headers: Record<string, string | undefined>,
+): number | null {
const raw = headers["content-length"];
if (raw === undefined) return null;
if (!/^\d+$/.test(raw)) throw new Error("release_content_length_invalid");
const value = Number(raw);
- if (!Number.isSafeInteger(value)) throw new Error("release_content_length_invalid");
+ if (!Number.isSafeInteger(value))
+ throw new Error("release_content_length_invalid");
return value;
}
@@ -758,8 +779,10 @@ function isProtocolVersion(value: unknown): value is number {
}
function validTimestamp(value: string): boolean {
- return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(value) &&
- !Number.isNaN(Date.parse(value));
+ return (
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/.test(value) &&
+ !Number.isNaN(Date.parse(value))
+ );
}
export async function sha256File(file: string): Promise<string> {
@@ -768,6 +791,8 @@ export async function sha256File(file: string): Promise<string> {
return digest.digest("hex");
}
-export async function readReleaseManifestFile(file: string): Promise<RuntimeReleaseManifest> {
+export async function readReleaseManifestFile(
+ file: string,
+): Promise<RuntimeReleaseManifest> {
return parseRuntimeReleaseManifest(JSON.parse(await readFile(file, "utf8")));
}
diff --git a/memhub/packages/runtime-control/src/runtime-service.test.ts b/memhub/packages/runtime-control/src/runtime-service.test.ts
index d0d5f0e..382c206 100644
--- a/memhub/packages/runtime-control/src/runtime-service.test.ts
+++ b/memhub/packages/runtime-control/src/runtime-service.test.ts
@@ -1,4 +1,12 @@
-import { chmod, mkdir, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
+import {
+ chmod,
+ mkdir,
+ mkdtemp,
+ readFile,
+ rm,
+ stat,
+ writeFile,
+} from "node:fs/promises";
import { tmpdir } from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
diff --git a/memhub/packages/runtime-control/src/runtime-service.ts b/memhub/packages/runtime-control/src/runtime-service.ts
index 98c3310..aefea50 100644
--- a/memhub/packages/runtime-control/src/runtime-service.ts
+++ b/memhub/packages/runtime-control/src/runtime-service.ts
@@ -31,7 +31,9 @@ export interface RuntimeServiceOptions {
dataDir: string;
/** Build the supervisor. `onSidecarFault` must be wired into it so a captured
* post-start sidecar fault reaches the durable receipt this service writes. */
- createSupervisor(onSidecarFault: () => void): ManagedRuntime | Promise<ManagedRuntime>;
+ createSupervisor(
+ onSidecarFault: () => void,
+ ): ManagedRuntime | Promise<ManagedRuntime>;
pid?: number;
processIsAlive?: (pid: number) => boolean;
diagnostics?: DiagnosticSink;
@@ -85,7 +87,13 @@ export class RuntimeService {
this.options.createSupervisor.length > 0
? (supervisor as { readerPort?: number | null }).readerPort
: undefined;
- await this.writeReceipt("running", connection.instanceId, connection.coreBaseUrl, undefined, readerPort);
+ await this.writeReceipt(
+ "running",
+ connection.instanceId,
+ connection.coreBaseUrl,
+ undefined,
+ readerPort,
+ );
this.started = true;
await this.options.diagnostics?.log({
level: "info",
diff --git a/memhub/packages/runtime-control/src/runtime-supervisor.ts b/memhub/packages/runtime-control/src/runtime-supervisor.ts
index 45f6654..e01de03 100644
--- a/memhub/packages/runtime-control/src/runtime-supervisor.ts
+++ b/memhub/packages/runtime-control/src/runtime-supervisor.ts
@@ -102,9 +102,8 @@ export class RuntimeSupervisor {
const health = await this.core.start();
coreStarted = true;
phase = "sidecar";
- const sidecar = this.createSidecar(
- this.currentConnection(),
- (code) => this.recordSidecarFault(code),
+ const sidecar = this.createSidecar(this.currentConnection(), (code) =>
+ this.recordSidecarFault(code),
);
this.sidecar = sidecar;
await sidecar.start();
diff --git a/memhub/packages/runtime-control/src/service-install-races.test.ts b/memhub/packages/runtime-control/src/service-install-races.test.ts
index 3b06b6e..2f582a3 100644
--- a/memhub/packages/runtime-control/src/service-install-races.test.ts
+++ b/memhub/packages/runtime-control/src/service-install-races.test.ts
@@ -24,7 +24,8 @@ vi.mock("node:fs/promises", async (original) => {
...real,
lstat: async (file: string) => {
const info = await real.lstat(file);
- if (file !== injection.stalePathLinkCount || info.nlink !== 1) return info;
+ if (file !== injection.stalePathLinkCount || info.nlink !== 1)
+ return info;
// CephFS can expose this exact stale view after unlink(temp): the open
// handle already reports nlink=1 while lstat(target) still says 2.
const stale = Object.create(Object.getPrototypeOf(info));
diff --git a/memhub/packages/runtime-control/src/service-log.test.ts b/memhub/packages/runtime-control/src/service-log.test.ts
index f25c7bb..45bf7d1 100644
--- a/memhub/packages/runtime-control/src/service-log.test.ts
+++ b/memhub/packages/runtime-control/src/service-log.test.ts
@@ -42,9 +42,9 @@ describe("service log capture", () => {
await capture?.writeStdout(chunk);
}
await capture?.flush();
- const entries = (
- await readdir(path.join(dataDir, "logs"))
- ).filter((name) => name.startsWith("service.log"));
+ const entries = (await readdir(path.join(dataDir, "logs"))).filter((name) =>
+ name.startsWith("service.log"),
+ );
// service.log + .1 + .2 + .3 -- never unbounded.
expect(entries.length).toBeLessThanOrEqual(4);
await rm(dataDir, { recursive: true, force: true });
diff --git a/memhub/packages/runtime-control/src/service-log.ts b/memhub/packages/runtime-control/src/service-log.ts
index 9928822..1f1c2e1 100644
--- a/memhub/packages/runtime-control/src/service-log.ts
+++ b/memhub/packages/runtime-control/src/service-log.ts
@@ -1,5 +1,4 @@
-import { chmod, mkdir, rename, rm, stat } from "node:fs/promises";
-import { appendFile } from "node:fs/promises";
+import { appendFile, chmod, mkdir, rename, rm, stat } from "node:fs/promises";
import path from "node:path";
/**
@@ -59,7 +58,10 @@ async function appendBounded(target: string, chunk: string): Promise<void> {
) {
await rotate(target);
}
- await appendFile(target, chunk, { encoding: "utf8", mode: SERVICE_LOG_FILE_MODE });
+ await appendFile(target, chunk, {
+ encoding: "utf8",
+ mode: SERVICE_LOG_FILE_MODE,
+ });
await chmod(target, SERVICE_LOG_FILE_MODE);
}
@@ -74,7 +76,10 @@ export async function createServiceLogCapture(
): Promise<ServiceLogCapture | null> {
const directory = path.join(dataDir, "logs");
try {
- await mkdir(directory, { recursive: true, mode: SERVICE_LOG_DIRECTORY_MODE });
+ await mkdir(directory, {
+ recursive: true,
+ mode: SERVICE_LOG_DIRECTORY_MODE,
+ });
await chmod(directory, SERVICE_LOG_DIRECTORY_MODE);
} catch {
return null;
diff --git a/memhub/packages/runtime-control/src/source-change-handler.ts b/memhub/packages/runtime-control/src/source-change-handler.ts
index 6679355..f1d7cc5 100644
--- a/memhub/packages/runtime-control/src/source-change-handler.ts
+++ b/memhub/packages/runtime-control/src/source-change-handler.ts
@@ -143,10 +143,7 @@ export function createSourceChangeHandler(options: {
)
throw new SourceNotificationError("source_work_unavailable", 409);
const after = await inspect(sourceId, bounded);
- if (
- after.root !== before.root ||
- after.revision !== before.revision
- )
+ if (after.root !== before.root || after.revision !== before.revision)
throw new SourceNotificationError(
"source_notification_permission_changed",
403,
diff --git a/memhub/packages/runtime-control/tsup.config.ts b/memhub/packages/runtime-control/tsup.config.ts
index 8d7ee5c..b0eb2b6 100644
--- a/memhub/packages/runtime-control/tsup.config.ts
+++ b/memhub/packages/runtime-control/tsup.config.ts
@@ -1,13 +1,12 @@
-import { defineConfig } from "tsup";
import { createRequire } from "node:module";
+import { defineConfig } from "tsup";
const require = createRequire(import.meta.url);
-const { resolveBuildNumber, resolveBuildVersion } = require(
- "../../scripts/release-version.cjs",
-) as {
- resolveBuildNumber(environment?: NodeJS.ProcessEnv, root?: string): number;
- resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
-};
+const { resolveBuildNumber, resolveBuildVersion } =
+ require("../../scripts/release-version.cjs") as {
+ resolveBuildNumber(environment?: NodeJS.ProcessEnv, root?: string): number;
+ resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
+ };
const releaseVersion = resolveBuildVersion(process.env);
const releaseBuildNumber = resolveBuildNumber(process.env);
diff --git a/memhub/scripts/assert-test-isolation.mjs b/memhub/scripts/assert-test-isolation.mjs
index 19685d4..af05416 100644
--- a/memhub/scripts/assert-test-isolation.mjs
+++ b/memhub/scripts/assert-test-isolation.mjs
@@ -20,8 +20,10 @@ if (process.env.ONE_MEMORY_TEST_ISOLATED !== "1") {
const realHome = process.env.ONE_MEMORY_TEST_REAL_HOME;
const home = process.env.HOME;
const dataDir = process.env.ONE_MEMORY_DATA_DIR;
-if (!realHome || !home || !dataDir) fail("required isolation paths are missing");
-if (path.resolve(home) === path.resolve(realHome)) fail("HOME is the real user directory");
+if (!realHome || !home || !dataDir)
+ fail("required isolation paths are missing");
+if (path.resolve(home) === path.resolve(realHome))
+ fail("HOME is the real user directory");
if (path.resolve(dataDir).startsWith(`${path.resolve(realHome)}${path.sep}`)) {
fail("ONE_MEMORY_DATA_DIR is inside the real user directory");
}
diff --git a/memhub/scripts/audit_core_test_design.py b/memhub/scripts/audit_core_test_design.py
new file mode 100644
index 0000000..79c5ebd
--- /dev/null
+++ b/memhub/scripts/audit_core_test_design.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python3
+"""Report review signals in the Core test suite without judging test value."""
+
+from __future__ import annotations
+
+import argparse
+import ast
+import json
+from collections import Counter, defaultdict
+from pathlib import Path
+from typing import Any
+
+TIMING_HOTSPOT_SECONDS = 5.0
+
+
+def _candidate(kind: str, path: Path, **details: Any) -> dict[str, Any]:
+ return {"kind": kind, "file": path.as_posix(), **details}
+
+
+def source_candidates(tests_root: Path) -> tuple[list[dict[str, Any]], dict[str, int]]:
+ candidates: list[dict[str, Any]] = []
+ names: dict[str, list[Path]] = defaultdict(list)
+ for path in sorted(tests_root.glob("test_*.py")):
+ source = path.read_text(encoding="utf-8")
+ tree = ast.parse(source, path.name)
+ for node in ast.walk(tree):
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name.startswith(
+ "test_"
+ ):
+ names[node.name].append(path)
+ if "legacy" in node.name.lower():
+ candidates.append(_candidate("legacy_name", path, test=node.name))
+ if (
+ isinstance(node, ast.Call)
+ and isinstance(node.func, ast.Attribute)
+ and node.func.attr == "sleep"
+ and node.args
+ and isinstance(node.args[0], ast.Constant)
+ and isinstance(node.args[0].value, (int, float))
+ and node.args[0].value > 0
+ ):
+ candidates.append(
+ _candidate(
+ "fixed_sleep",
+ path,
+ line=node.lineno,
+ seconds=float(node.args[0].value),
+ )
+ )
+ if "pytest.mark.xfail" in source:
+ candidates.append(_candidate("xfail", path))
+ for name, paths in sorted(names.items()):
+ unique = sorted({path.as_posix() for path in paths})
+ if len(unique) > 1:
+ candidates.append(
+ {
+ "kind": "duplicate_test_name",
+ "test": name,
+ "files": unique,
+ }
+ )
+ candidates.sort(
+ key=lambda item: (
+ str(item["kind"]),
+ str(item.get("file", "")),
+ str(item.get("test", "")),
+ )
+ )
+ return candidates, dict(sorted(Counter(item["kind"] for item in candidates).items()))
+
+
+def timing_candidates(report_dir: Path) -> tuple[list[dict[str, Any]], dict[str, int]]:
+ path = report_dir / "tests.jsonl"
+ if not path.is_file():
+ return [], {}
+ rows = [
+ json.loads(line)
+ for line in path.read_text(encoding="utf-8").splitlines()
+ if line.strip()
+ ]
+ candidates: list[dict[str, Any]] = []
+ by_file: dict[str, list[dict[str, Any]]] = defaultdict(list)
+ for row in rows:
+ file = str(row.get("file", ""))
+ if file:
+ by_file[file].append(row)
+ outcome = row.get("outcome")
+ if outcome == "xfailed":
+ candidates.append(
+ {
+ "kind": "xfailed",
+ "file": file,
+ "nodeid": row.get("nodeid"),
+ }
+ )
+ total = row.get("total_seconds")
+ if isinstance(total, (int, float)) and total >= TIMING_HOTSPOT_SECONDS:
+ candidates.append(
+ {
+ "kind": "timing_hotspot",
+ "file": file,
+ "nodeid": row.get("nodeid"),
+ "total_seconds": total,
+ }
+ )
+ for file, file_rows in sorted(by_file.items()):
+ executed = [row for row in file_rows if row.get("outcome") != "not_run"]
+ if executed and all(row.get("outcome") == "skipped" for row in executed):
+ candidates.append({"kind": "all_skipped_file", "file": file})
+ candidates.sort(
+ key=lambda item: (
+ str(item["kind"]),
+ str(item.get("file", "")),
+ str(item.get("nodeid", "")),
+ )
+ )
+ return candidates, dict(sorted(Counter(item["kind"] for item in candidates).items()))
+
+
+def audit(report_dir: Path, tests_root: Path) -> dict[str, Any]:
+ source, source_counts = source_candidates(tests_root)
+ timing, timing_counts = timing_candidates(report_dir)
+ result = {
+ "schema_version": 1,
+ "source_signals": source_counts,
+ "timing_signals": timing_counts,
+ "candidates": [*source, *timing],
+ }
+ report_dir.mkdir(parents=True, exist_ok=True)
+ (report_dir / "design-audit.json").write_text(
+ json.dumps(result, indent=2, sort_keys=True) + "\n",
+ encoding="utf-8",
+ )
+ return result
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("report_dir", type=Path)
+ parser.add_argument("tests_root", type=Path)
+ args = parser.parse_args()
+ result = audit(args.report_dir.resolve(), args.tests_root.resolve())
+ print(
+ "Core test design signals: "
+ f"source={result['source_signals']} timing={result['timing_signals']}"
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/memhub/scripts/build-release-assets.mjs b/memhub/scripts/build-release-assets.mjs
index ddd09ca..1f26e9f 100644
--- a/memhub/scripts/build-release-assets.mjs
+++ b/memhub/scripts/build-release-assets.mjs
@@ -2,18 +2,18 @@
import { createHash } from "node:crypto";
import { createReadStream } from "node:fs";
-import { createRequire } from "node:module";
import {
copyFile,
lstat,
mkdir,
- readFile,
readdir,
+ readFile,
realpath,
rm,
stat,
writeFile,
} from "node:fs/promises";
+import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath } from "node:url";
import * as tar from "tar";
@@ -42,7 +42,10 @@ export async function buildReleaseAssets(options) {
if (channel === "prerelease" && !version.includes("-")) {
throw new Error("release_channel_version_mismatch");
}
- if (!Array.isArray(options.distributions) || options.distributions.length === 0) {
+ if (
+ !Array.isArray(options.distributions) ||
+ options.distributions.length === 0
+ ) {
throw new Error("release_distribution_required");
}
const desktops = options.desktops ?? [];
@@ -76,7 +79,8 @@ export async function buildReleaseAssets(options) {
throw new Error("release_distribution_commit_mismatch");
}
const identity = `runtime/${manifest.platform}/${manifest.arch}`;
- if (identities.has(identity)) throw new Error("release_distribution_duplicate");
+ if (identities.has(identity))
+ throw new Error("release_distribution_duplicate");
identities.add(identity);
const filename = `memhub-runtime-v${version}-${manifest.platform}-${manifest.arch}.tar.gz`;
@@ -122,11 +126,16 @@ export async function buildReleaseAssets(options) {
throw new Error("release_desktop_invalid");
}
const identity = `desktop/darwin/${desktop.arch}`;
- if (identities.has(identity)) throw new Error("release_distribution_duplicate");
+ if (identities.has(identity))
+ throw new Error("release_distribution_duplicate");
identities.add(identity);
const source = await realpath(desktop.file);
const sourceInfo = await lstat(source);
- if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink() || sourceInfo.size <= 0) {
+ if (
+ !sourceInfo.isFile() ||
+ sourceInfo.isSymbolicLink() ||
+ sourceInfo.size <= 0
+ ) {
throw new Error("release_desktop_invalid");
}
const filename = `MemHub-v${version}-macos-${desktop.arch}.dmg`;
@@ -148,7 +157,11 @@ export async function buildReleaseAssets(options) {
}
for (const metadata of [
{ role: "sbom", format: "spdx-json", filename: "SBOM.spdx.json" },
- { role: "notices", format: "markdown", filename: "THIRD_PARTY_NOTICES.md" },
+ {
+ role: "notices",
+ format: "markdown",
+ filename: "THIRD_PARTY_NOTICES.md",
+ },
]) {
const source = path.join(root, metadata.filename);
const info = await lstat(source).catch(() => null);
@@ -169,7 +182,9 @@ export async function buildReleaseAssets(options) {
});
checksums.push(`${digest} ${metadata.filename}`);
}
- artifacts.sort((left, right) => artifactIdentity(left).localeCompare(artifactIdentity(right)));
+ artifacts.sort((left, right) =>
+ artifactIdentity(left).localeCompare(artifactIdentity(right)),
+ );
checksums.sort();
const publishedAt = options.publishedAt ?? new Date().toISOString();
if (
@@ -186,11 +201,9 @@ export async function buildReleaseAssets(options) {
git_commit: gitCommit,
channel,
cli_protocol: releaseContract.cliProtocol,
- supported_runtime_protocol:
- releaseContract.cliSupportedRuntimeProtocol,
+ supported_runtime_protocol: releaseContract.cliSupportedRuntimeProtocol,
runtime_protocol: releaseContract.runtimeProtocol,
- supported_cli_protocol:
- releaseContract.runtimeSupportedCliProtocol,
+ supported_cli_protocol: releaseContract.runtimeSupportedCliProtocol,
published_at: publishedAt,
artifacts,
};
@@ -205,7 +218,9 @@ export async function buildReleaseAssets(options) {
{ mode: 0o600 },
);
await rm(output, { recursive: true, force: true });
- await import("node:fs/promises").then(({ rename }) => rename(stage, output));
+ await import("node:fs/promises").then(({ rename }) =>
+ rename(stage, output),
+ );
return releaseManifest;
} catch (error) {
await rm(stage, { recursive: true, force: true });
@@ -216,7 +231,9 @@ export async function buildReleaseAssets(options) {
async function verifyDistribution(source) {
let value;
try {
- value = JSON.parse(await readFile(path.join(source, "manifest.json"), "utf8"));
+ value = JSON.parse(
+ await readFile(path.join(source, "manifest.json"), "utf8"),
+ );
} catch {
throw new Error("release_distribution_manifest_invalid");
}
@@ -257,7 +274,9 @@ async function verifyDistribution(source) {
throw new Error("release_distribution_manifest_incomplete");
}
for (const relative of declared) {
- if ((await sha256File(path.join(source, relative))) !== value.files[relative]) {
+ if (
+ (await sha256File(path.join(source, relative))) !== value.files[relative]
+ ) {
throw new Error("release_distribution_hash_mismatch");
}
}
@@ -271,7 +290,8 @@ async function treeFiles(source, current = source) {
for (const entry of entries) {
const target = path.join(current, entry.name);
const relative = path.relative(source, target);
- if (!safeRelative(relative)) throw new Error("release_distribution_path_invalid");
+ if (!safeRelative(relative))
+ throw new Error("release_distribution_path_invalid");
if (entry.isSymbolicLink()) {
const resolved = await realpath(target);
const escaped = path.relative(source, resolved);
@@ -345,9 +365,12 @@ function parseArgs(arguments_) {
const flag = arguments_[index];
const value = arguments_[++index];
if (value === undefined) throw new Error(`missing value for ${flag}`);
- if (flag === "--output" && options.output === undefined) options.output = value;
- else if (flag === "--version" && options.version === undefined) options.version = value;
- else if (flag === "--channel" && options.channel === undefined) options.channel = value;
+ if (flag === "--output" && options.output === undefined)
+ options.output = value;
+ else if (flag === "--version" && options.version === undefined)
+ options.version = value;
+ else if (flag === "--channel" && options.channel === undefined)
+ options.channel = value;
else if (flag === "--asset-base-url" && options.assetBaseUrl === undefined)
options.assetBaseUrl = value;
else if (flag === "--published-at" && options.publishedAt === undefined)
@@ -361,8 +384,7 @@ function parseArgs(arguments_) {
file: match[2],
minimumSystemVersion: "13.0",
});
- }
- else throw new Error(`invalid argument: ${flag}`);
+ } else throw new Error(`invalid argument: ${flag}`);
}
if (
!options.output ||
diff --git a/memhub/scripts/build-release-assets.test.mjs b/memhub/scripts/build-release-assets.test.mjs
index 6e142a6..78bbc27 100644
--- a/memhub/scripts/build-release-assets.test.mjs
+++ b/memhub/scripts/build-release-assets.test.mjs
@@ -3,8 +3,8 @@ import { createHash } from "node:crypto";
import {
mkdir,
mkdtemp,
- readFile,
readdir,
+ readFile,
rm,
writeFile,
} from "node:fs/promises";
@@ -22,7 +22,9 @@ async function distribution(root, platform, arch, buildNumber = 7) {
const target = path.join(root, `${platform}-${arch}`);
await mkdir(path.join(target, "bin"), { recursive: true });
const launcher = "#!/bin/sh\nexit 0\n";
- await writeFile(path.join(target, "bin", "memhub"), launcher, { mode: 0o700 });
+ await writeFile(path.join(target, "bin", "memhub"), launcher, {
+ mode: 0o700,
+ });
const sbom = await readFile(new URL("../SBOM.spdx.json", import.meta.url));
const notices = await readFile(
new URL("../THIRD_PARTY_NOTICES.md", import.meta.url),
@@ -87,22 +89,33 @@ test("builds versioned Runtime archives, checksums and a downloader-compatible m
],
);
const names = (await readdir(output)).sort();
- assert.deepEqual(names, [
- "checksums.txt",
- "MemHub-v0.1.0-internal.1-macos-arm64.dmg",
- "MemHub-v0.1.0-internal.1-macos-x64.dmg",
- "SBOM.spdx.json",
- "THIRD_PARTY_NOTICES.md",
- "memhub-runtime-v0.1.0-internal.1-darwin-arm64.tar.gz",
- "memhub-runtime-v0.1.0-internal.1-linux-x64.tar.gz",
- "release-manifest.json",
- ].sort());
- const saved = JSON.parse(await readFile(path.join(output, "release-manifest.json"), "utf8"));
+ assert.deepEqual(
+ names,
+ [
+ "checksums.txt",
+ "MemHub-v0.1.0-internal.1-macos-arm64.dmg",
+ "MemHub-v0.1.0-internal.1-macos-x64.dmg",
+ "SBOM.spdx.json",
+ "THIRD_PARTY_NOTICES.md",
+ "memhub-runtime-v0.1.0-internal.1-darwin-arm64.tar.gz",
+ "memhub-runtime-v0.1.0-internal.1-linux-x64.tar.gz",
+ "release-manifest.json",
+ ].sort(),
+ );
+ const saved = JSON.parse(
+ await readFile(path.join(output, "release-manifest.json"), "utf8"),
+ );
assert.deepEqual(saved, manifest);
const checksums = await readFile(path.join(output, "checksums.txt"), "utf8");
for (const artifact of manifest.artifacts) {
- assert.match(checksums, new RegExp(`${artifact.sha256} ${artifact.filename}`));
- assert.equal(artifact.url, `https://git.example.test/release/downloads/${artifact.filename}`);
+ assert.match(
+ checksums,
+ new RegExp(`${artifact.sha256} ${artifact.filename}`),
+ );
+ assert.equal(
+ artifact.url,
+ `https://git.example.test/release/downloads/${artifact.filename}`,
+ );
assert.ok(artifact.bytes > 0);
if (artifact.kind === "runtime") assert.ok(artifact.unpacked_bytes > 0);
}
@@ -153,7 +166,10 @@ test("refuses Runtime commit drift across platforms", async (t) => {
const secondManifestPath = path.join(second, "manifest.json");
const secondManifest = JSON.parse(await readFile(secondManifestPath, "utf8"));
secondManifest.git_commit = "b".repeat(40);
- await writeFile(secondManifestPath, `${JSON.stringify(secondManifest, null, 2)}\n`);
+ await writeFile(
+ secondManifestPath,
+ `${JSON.stringify(secondManifest, null, 2)}\n`,
+ );
await assert.rejects(
buildReleaseAssets({
output: path.join(root, "release"),
@@ -221,7 +237,11 @@ test("refuses duplicate Desktop architecture and unusable DMG inputs", async (t)
assetBaseUrl: "https://git.example.test/release/",
distributions: [source],
desktops: [
- { arch: "x64", file: path.join(root, "missing.dmg"), minimumSystemVersion: "13.0" },
+ {
+ arch: "x64",
+ file: path.join(root, "missing.dmg"),
+ minimumSystemVersion: "13.0",
+ },
],
}),
/ENOENT|release_desktop_invalid/,
diff --git a/memhub/scripts/export_public_snapshot.py b/memhub/scripts/export_public_snapshot.py
index c12b9df..7235e7c 100644
--- a/memhub/scripts/export_public_snapshot.py
+++ b/memhub/scripts/export_public_snapshot.py
@@ -51,6 +51,7 @@ PUBLIC_DOCS = frozenset(
PUBLIC_SCRIPTS = frozenset(
{
"scripts/assert-test-isolation.mjs",
+ "scripts/audit_core_test_design.py",
"scripts/build-release-assets.mjs",
"scripts/build-release-assets.test.mjs",
"scripts/build_app_icon.cjs",
@@ -62,6 +63,7 @@ PUBLIC_SCRIPTS = frozenset(
"scripts/check.sh",
"scripts/export_public_snapshot.py",
"scripts/fetch_embedding_model.py",
+ "scripts/generate_core_test_index.py",
"scripts/generate_sbom.py",
"scripts/install-docs.test.mjs",
"scripts/platform/macos/build-macos-release.mjs",
@@ -93,6 +95,7 @@ PUBLIC_SCRIPTS = frozenset(
"scripts/verify-published-release.test.mjs",
"scripts/set-release-version.mjs",
"scripts/set-release-version.test.mjs",
+ "scripts/summarize_core_test_report.py",
"scripts/verify-release-version.mjs",
"scripts/verify-release-version.test.mjs",
"scripts/verify_structure.py",
diff --git a/memhub/scripts/generate_core_test_index.py b/memhub/scripts/generate_core_test_index.py
new file mode 100644
index 0000000..23f8d16
--- /dev/null
+++ b/memhub/scripts/generate_core_test_index.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python3
+"""Render the reviewed Core test-file index deterministically."""
+
+from __future__ import annotations
+
+import argparse
+import ast
+import difflib
+import re
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+TESTS_ROOT = ROOT / "apps/core/tests"
+CLASSIFICATION = TESTS_ROOT / "core_test_classification.py"
+OUTPUT = TESTS_ROOT / "TEST_INDEX.md"
+ROW = re.compile(r"^\| `(?P<file>test_[^`]+\.py)` \| `[^`]+` \| (?P<summary>.*) \|$")
+
+
+def _reviewed_files(name: str) -> frozenset[str]:
+ tree = ast.parse(CLASSIFICATION.read_text(encoding="utf-8"), CLASSIFICATION.name)
+ for node in tree.body:
+ if not isinstance(node, ast.Assign):
+ continue
+ if not any(isinstance(target, ast.Name) and target.id == name for target in node.targets):
+ continue
+ value = node.value
+ if (
+ not isinstance(value, ast.Call)
+ or not isinstance(value.func, ast.Name)
+ or value.func.id != "frozenset"
+ or len(value.args) != 1
+ ):
+ break
+ literal = ast.literal_eval(value.args[0])
+ if not isinstance(literal, set) or not all(isinstance(item, str) for item in literal):
+ break
+ return frozenset(literal)
+ raise ValueError(f"{name} must be a literal frozenset in {CLASSIFICATION}")
+
+
+def _existing_summaries() -> dict[str, str]:
+ if not OUTPUT.is_file():
+ return {}
+ summaries: dict[str, str] = {}
+ for line in OUTPUT.read_text(encoding="utf-8").splitlines():
+ match = ROW.match(line)
+ if match:
+ summaries[match.group("file")] = match.group("summary")
+ return summaries
+
+
+def _fallback_summary(path: Path) -> str:
+ tree = ast.parse(path.read_text(encoding="utf-8"), path.name)
+ doc = ast.get_docstring(tree, clean=True)
+ if doc:
+ first_paragraph = doc.split("\n\n", 1)[0]
+ summary = " ".join(part.strip() for part in first_paragraph.splitlines() if part.strip())
+ if summary:
+ return summary
+ names: list[str] = []
+ for node in ast.walk(tree):
+ if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) and node.name.startswith("test_"):
+ names.append(node.name.removeprefix("test_").replace("_", " "))
+ names.sort()
+ if not names:
+ return "Core test module."
+ preview = "、".join(names[:3])
+ suffix = f" 等 {len(names)} 个场景。" if len(names) > 3 else " 场景。"
+ return f"覆盖 {preview}{suffix}"
+
+
+def _safe_cell(value: str) -> str:
+ return " ".join(value.split()).replace("|", r"\|")
+
+
+def render() -> str:
+ files = tuple(sorted(TESTS_ROOT.glob("test_*.py"), key=lambda path: path.name))
+ names = {path.name for path in files}
+ unit = _reviewed_files("UNIT_FILES")
+ integration = _reviewed_files("INTEGRATION_FILES")
+ missing = sorted((unit | integration) - names)
+ overlap = sorted(unit & integration)
+ if missing or overlap:
+ raise ValueError(
+ f"classification references missing={missing} overlap={overlap}"
+ )
+ existing = _existing_summaries()
+ lines = [
+ "# Core 测试文件清单",
+ "",
+ "此文件由 `scripts/generate_core_test_index.py` 生成;每个 Core 测试文件必须有且只有一条记录。",
+ "",
+ "| 测试文件 | 等级 | 一句话说明 |",
+ "| --- | --- | --- |",
+ ]
+ for path in files:
+ level = (
+ "unit"
+ if path.name in unit
+ else "integration"
+ if path.name in integration
+ else "contract"
+ )
+ summary = existing.get(path.name) or _fallback_summary(path)
+ lines.append(f"| `{path.name}` | `{level}` | {_safe_cell(summary)} |")
+ lines.extend(("", f"共 {len(files)} 个测试文件。", ""))
+ return "\n".join(lines)
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--check", action="store_true")
+ args = parser.parse_args()
+ rendered = render()
+ current = OUTPUT.read_text(encoding="utf-8") if OUTPUT.is_file() else ""
+ if args.check:
+ if current != rendered:
+ diff = difflib.unified_diff(
+ current.splitlines(),
+ rendered.splitlines(),
+ fromfile=str(OUTPUT),
+ tofile=f"{OUTPUT} (generated)",
+ lineterm="",
+ )
+ print("\n".join(diff))
+ raise SystemExit(1)
+ print(f"Core test index is current: {len(tuple(TESTS_ROOT.glob('test_*.py')))} files")
+ return
+ OUTPUT.write_text(rendered, encoding="utf-8")
+ print(f"Core test index updated: {len(tuple(TESTS_ROOT.glob('test_*.py')))} files")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/memhub/scripts/install-docs.test.mjs b/memhub/scripts/install-docs.test.mjs
index a07db58..f8e4c30 100644
--- a/memhub/scripts/install-docs.test.mjs
+++ b/memhub/scripts/install-docs.test.mjs
@@ -12,25 +12,22 @@ test("installation docs disclose publication and lifecycle boundaries", async ()
"utf8",
);
- assert.match(readme, /公共 Python SDK 已发布为 `hy-memory==2\.0\.1`/);
- assert.match(readme, /npm 包尚未发布,GitHub Releases 仍为空/s);
- assert.match(readme, /Linux x64/);
- assert.match(readme, /Linux arm64.*没有本版本公开支持证据/s);
- assert.match(readme, /macOS arm64.*正式公证.*尚未完成/s);
+ assert.match(readme, /公共 Python SDK 为 `hy-memory==2\.0\.1`/);
+ assert.match(readme, /`v1\.0\.0` 的发行目标是 Linux x64\/arm64 Runtime/);
+ assert.match(readme, /Linux 制品由 GitHub Actions/);
+ assert.match(readme, /macOS.*Developer ID 签名、公证/s);
+ assert.match(readme, /release-manifest\.json/);
assert.match(readme, /memhub uninstall/);
assert.match(readme, /memhub delete-data/);
assert.match(readme, /docs\/INSTALLATION\.md/);
+ assert.doesNotMatch(readme, /私有 RC|内部候选/);
- assert.match(installation, /384,082 bytes/);
- assert.match(installation, /277,961,300 bytes/);
- assert.match(installation, /688,414,016 bytes/);
- assert.match(installation, /277,961,849 bytes/);
- assert.match(installation, /688,414,163 bytes/);
+ assert.match(installation, /Linux x64.*GitHub Actions/s);
+ assert.match(installation, /Linux arm64.*GitHub Actions/s);
+ assert.match(installation, /macOS arm64.*Developer ID/s);
+ assert.match(installation, /macOS x64.*Developer ID/s);
+ assert.match(installation, /release-manifest\.json/);
assert.match(installation, /fake Release/);
- assert.match(installation, /verify-fake-release-bootstrap\.mjs/);
- assert.match(installation, /N-1 升级/);
- assert.match(installation, /健康检查失败会恢复/);
- assert.match(installation, /verify-linux-upgrade-rollback\.mjs/);
assert.match(installation, /--source/);
assert.match(installation, /完全离线/);
assert.match(installation, /HTTPS_PROXY/);
@@ -39,9 +36,9 @@ test("installation docs disclose publication and lifecycle boundaries", async ()
assert.match(installation, /Python Core.*系统 Python/s);
assert.match(installation, /默认数据目录是 `~\/\.one-memory`/);
assert.match(installation, /Windows.*不支持/s);
- assert.match(installation, /最低 macOS 13/);
+ assert.match(installation, /最低支持 macOS 13/);
assert.match(installation, /手动下载新版本/);
- assert.match(installation, /macos-15-intel/);
assert.match(installation, /auto-updater/);
+ assert.doesNotMatch(installation, /私有 RC|内部候选/);
assert.doesNotMatch(installation, /npm install -g @tencent\/memhub_internal/);
});
diff --git a/memhub/scripts/platform/linux/build-linux-runtime.mjs b/memhub/scripts/platform/linux/build-linux-runtime.mjs
index dc6f7f0..2057313 100644
--- a/memhub/scripts/platform/linux/build-linux-runtime.mjs
+++ b/memhub/scripts/platform/linux/build-linux-runtime.mjs
@@ -70,8 +70,16 @@ function run(command, args, env = {}) {
}
}
-run("pnpm", ["--filter", "@one-memory/runtime-control", "build"], releaseEnvironment);
-run("pnpm", ["--filter", "@one-memory/host-bridge", "build"], releaseEnvironment);
+run(
+ "pnpm",
+ ["--filter", "@one-memory/runtime-control", "build"],
+ releaseEnvironment,
+);
+run(
+ "pnpm",
+ ["--filter", "@one-memory/host-bridge", "build"],
+ releaseEnvironment,
+);
run("pnpm", ["--filter", "@one-memory/web", "build"], releaseEnvironment);
run("pnpm", ["--filter", "@one-memory/cli", "build"], releaseEnvironment);
run("uv", ["sync", "--directory", "apps/core", "--all-groups", "--locked"]);
@@ -89,18 +97,22 @@ run(
],
{ ...releaseEnvironment, ONE_MEMORY_CORE_LAYOUT: "folder" },
);
-run("pnpm", [
- "--filter",
- "@one-memory/cli",
- "exec",
- "node",
- "../../scripts/build_runtime_distribution.cjs",
- output,
- "linux",
- arch,
- version,
- String(buildNumber),
-], releaseEnvironment);
+run(
+ "pnpm",
+ [
+ "--filter",
+ "@one-memory/cli",
+ "exec",
+ "node",
+ "../../scripts/build_runtime_distribution.cjs",
+ output,
+ "linux",
+ arch,
+ version,
+ String(buildNumber),
+ ],
+ releaseEnvironment,
+);
const distributionManifestPath = path.join(output, "manifest.json");
if (!existsSync(distributionManifestPath)) {
diff --git a/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs b/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
index 45c920c..cb24369 100644
--- a/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
+++ b/memhub/scripts/platform/linux/linux-runtime-scripts.test.mjs
@@ -32,13 +32,22 @@ describe("Linux runtime scripts", () => {
path.join(directory, "../../../../.github/workflows/linux-lifecycle.yml"),
"utf8",
);
- assert.doesNotMatch(workflow, /ONE_MEMORY_BUILD_NUMBER:.*github\.run_number/);
+ assert.doesNotMatch(
+ workflow,
+ /ONE_MEMORY_BUILD_NUMBER:.*github\.run_number/,
+ );
assert.doesNotMatch(workflow, /ONE_MEMORY_VERSION:\s*0\.0\.0/);
assert.match(workflow, /runner:\s*ubuntu-24\.04-arm[\s\S]*arch:\s*arm64/);
- assert.match(workflow, /memhub-runtime-v\$\{VERSION\}-linux-\$\{ARCH\}\.tar\.gz/);
+ assert.match(
+ workflow,
+ /memhub-runtime-v\$\{VERSION\}-linux-\$\{ARCH\}\.tar\.gz/,
+ );
assert.match(workflow, /sha256sum "\$archive"/);
assert.match(workflow, /actions\/upload-artifact@[a-f0-9]{40}/);
- assert.match(workflow, /name:\s*memhub-runtime-linux-\$\{\{ matrix\.arch \}\}/);
+ assert.match(
+ workflow,
+ /name:\s*memhub-runtime-linux-\$\{\{ matrix\.arch \}\}/,
+ );
});
it("executes the complete Linux lifecycle instead of reporting static blockers", async () => {
@@ -66,7 +75,10 @@ describe("Linux runtime scripts", () => {
assert.match(script, /findKey\(installReceipt, "core_port"\)/);
assert.match(script, /doctorCheck\(doctor, "core"\)/);
assert.match(script, /doctorCheck\(doctor, "broker"\)/);
- assert.match(script, /coreCheck\.details\?\.version !== distributionManifest\.version/);
+ assert.match(
+ script,
+ /coreCheck\.details\?\.version !== distributionManifest\.version/,
+ );
assert.match(
script,
/env\.ONE_MEMORY_CORE_PORT = String\(installedCorePort\)/,
diff --git a/memhub/scripts/platform/linux/linux-upgrade-rollback.test.mjs b/memhub/scripts/platform/linux/linux-upgrade-rollback.test.mjs
index 0960fa7..d06cfd4 100644
--- a/memhub/scripts/platform/linux/linux-upgrade-rollback.test.mjs
+++ b/memhub/scripts/platform/linux/linux-upgrade-rollback.test.mjs
@@ -25,8 +25,8 @@ test("Linux upgrade matrix proves N-1 to N and crash rollback separately", () =>
assert.match(source, /manifest\.files\["core\/one-memory"\]/);
assert.match(source, /crashingExecutable = "\/bin\/false"/);
const crashUpgrade = source.slice(
- source.indexOf('const failedUpgrade = run('),
- source.indexOf('if (failedUpgrade.status !== 1)'),
+ source.indexOf("const failedUpgrade = run("),
+ source.indexOf("if (failedUpgrade.status !== 1)"),
);
assert.match(crashUpgrade, /"upgrade-to-crashing-build"/);
assert.match(crashUpgrade, /\[1\]/);
@@ -42,5 +42,8 @@ test("Linux upgrade matrix proves N-1 to N and crash rollback separately", () =>
assert.match(statusWait, /\[0, 1, 3\]/);
assert.match(statusWait, /if \(result\.status === 0\)/);
assert.match(source, /recalled_after_rollback/);
- assert.match(source, /databaseAfterUninstall\.sha256 !== databaseBeforeUninstall\.sha256/);
+ assert.match(
+ source,
+ /databaseAfterUninstall\.sha256 !== databaseBeforeUninstall\.sha256/,
+ );
});
diff --git a/memhub/scripts/platform/linux/self-contained-runtime.test.mjs b/memhub/scripts/platform/linux/self-contained-runtime.test.mjs
index ae6e7b4..67d9921 100644
--- a/memhub/scripts/platform/linux/self-contained-runtime.test.mjs
+++ b/memhub/scripts/platform/linux/self-contained-runtime.test.mjs
@@ -13,7 +13,7 @@ test("self-contained verifier poisons system build/runtime tools", async () => {
'"sqlite3"',
'"pnpm"',
'"uv"',
- 'PATH: `${poisonBin}:/usr/bin:/bin`',
+ "PATH: `${poisonBin}:/usr/bin:/bin`",
'child.kill("SIGTERM")',
"no_system_python_sqlite_build_tools",
]) {
diff --git a/memhub/scripts/platform/linux/verify-fake-release-bootstrap.mjs b/memhub/scripts/platform/linux/verify-fake-release-bootstrap.mjs
index cc5bd12..665c32f 100644
--- a/memhub/scripts/platform/linux/verify-fake-release-bootstrap.mjs
+++ b/memhub/scripts/platform/linux/verify-fake-release-bootstrap.mjs
@@ -9,21 +9,20 @@ import {
cp,
mkdir,
mkdtemp,
+ readdir,
readFile,
readlink,
- readdir,
realpath,
rm,
stat,
writeFile,
} from "node:fs/promises";
import https from "node:https";
+import { createRequire } from "node:module";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";
-
import { buildReleaseAssets } from "../../build-release-assets.mjs";
-import { createRequire } from "node:module";
const root = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
@@ -37,7 +36,7 @@ export async function verifyFakeReleaseBootstrap(options) {
if (process.platform !== "linux") {
throw new Error("fake_release_bootstrap_requires_linux");
}
- if (!['x64', 'arm64'].includes(process.arch)) {
+ if (!["x64", "arm64"].includes(process.arch)) {
throw new Error("fake_release_bootstrap_arch_unsupported");
}
const distribution = await realpath(options.distribution);
@@ -112,7 +111,7 @@ export async function verifyFakeReleaseBootstrap(options) {
};
let server;
- let managedCli = path.join(binDir, "memhub");
+ const managedCli = path.join(binDir, "memhub");
let environment;
try {
const tls = generateTlsFixture(tlsRoot);
@@ -156,23 +155,24 @@ export async function verifyFakeReleaseBootstrap(options) {
receipt.expected_cli_bundle_sha256 = options.expectedCliSha256;
receipt.status.npm_pack = "not_applicable";
} else {
- const pack = await run("pack-cli", "pnpm", [
- "--filter",
- "@one-memory/cli",
- "pack:publish",
- ], {
- cwd: sourceRoot,
- env: {
- ...process.env,
- ONE_MEMORY_VERSION: distributionManifest.version,
- ONE_MEMORY_BUILD_NUMBER: String(distributionManifest.build_number),
- ONE_MEMORY_COMMIT: receipt.verifier_source_commit,
- MEMHUB_NPM_PACKAGE: options.packageName,
- MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE: manifestUrl,
+ const pack = await run(
+ "pack-cli",
+ "pnpm",
+ ["--filter", "@one-memory/cli", "pack:publish"],
+ {
+ cwd: sourceRoot,
+ env: {
+ ...process.env,
+ ONE_MEMORY_VERSION: distributionManifest.version,
+ ONE_MEMORY_BUILD_NUMBER: String(distributionManifest.build_number),
+ ONE_MEMORY_COMMIT: receipt.verifier_source_commit,
+ MEMHUB_NPM_PACKAGE: options.packageName,
+ MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE: manifestUrl,
+ },
+ evidenceDir,
+ timeout: 5 * 60_000,
},
- evidenceDir,
- timeout: 5 * 60_000,
- });
+ );
if (pack.status !== 0) throw commandFailure("pack-cli", pack);
const tarball = path.join(
sourceRoot,
@@ -202,17 +202,12 @@ export async function verifyFakeReleaseBootstrap(options) {
if (options.npmRegistry !== undefined) {
npmInstallArguments.push("--registry", options.npmRegistry);
}
- const npmInstall = await run(
- "npm-install",
- "npm",
- npmInstallArguments,
- {
- cwd: sourceRoot,
- env: process.env,
- evidenceDir,
- timeout: 120_000,
- },
- );
+ const npmInstall = await run("npm-install", "npm", npmInstallArguments, {
+ cwd: sourceRoot,
+ env: process.env,
+ evidenceDir,
+ timeout: 120_000,
+ });
if (npmInstall.status !== 0) {
throw commandFailure("npm-install", npmInstall);
}
@@ -538,7 +533,7 @@ export async function verifyFakeReleaseBootstrap(options) {
throw new Error("fake_release_uninstall_changed_data");
}
if (
- await exists(path.join(installRoot, "current")) ||
+ (await exists(path.join(installRoot, "current"))) ||
(await readdir(binDir)).length !== 0
) {
throw new Error("fake_release_uninstall_left_managed_program");
@@ -817,7 +812,9 @@ function openssl(arguments_) {
timeout: 30_000,
});
if (result.status !== 0) {
- throw new Error(`fake_release_tls_failed:${result.stderr || result.stdout}`);
+ throw new Error(
+ `fake_release_tls_failed:${result.stderr || result.stdout}`,
+ );
}
}
diff --git a/memhub/scripts/platform/linux/verify-linux-lifecycle.mjs b/memhub/scripts/platform/linux/verify-linux-lifecycle.mjs
index 2626903..45cfd73 100644
--- a/memhub/scripts/platform/linux/verify-linux-lifecycle.mjs
+++ b/memhub/scripts/platform/linux/verify-linux-lifecycle.mjs
@@ -292,7 +292,10 @@ try {
) {
throw new Error("doctor did not verify the packaged Core identity");
}
- if (brokerCheck.state !== "pass" || brokerCheck.code !== "background_verified") {
+ if (
+ brokerCheck.state !== "pass" ||
+ brokerCheck.code !== "background_verified"
+ ) {
throw new Error("doctor did not verify the background broker");
}
observations.doctor_state = doctor.state;
@@ -370,9 +373,7 @@ try {
);
const afterUpgradeId = findKey(afterUpgrade, "instance_id");
observations.idempotent_upgrade_instance_id_changed = Boolean(
- beforeUpgradeId &&
- afterUpgradeId &&
- beforeUpgradeId !== afterUpgradeId,
+ beforeUpgradeId && afterUpgradeId && beforeUpgradeId !== afterUpgradeId,
);
if (!observations.idempotent_upgrade_instance_id_changed) {
throw new Error("idempotent upgrade did not restart the Runtime");
diff --git a/memhub/scripts/platform/linux/verify-linux-support.mjs b/memhub/scripts/platform/linux/verify-linux-support.mjs
index 6522c0f..991ee50 100644
--- a/memhub/scripts/platform/linux/verify-linux-support.mjs
+++ b/memhub/scripts/platform/linux/verify-linux-support.mjs
@@ -16,7 +16,11 @@ async function hasSystemdUser() {
async function hasPortables() {
try {
- await execFileAsync("systemctl", ["--user", "show", "--property=Portables"]);
+ await execFileAsync("systemctl", [
+ "--user",
+ "show",
+ "--property=Portables",
+ ]);
return true;
} catch {
return false;
@@ -33,9 +37,9 @@ async function hasTmpfilesD() {
}
const capabilities = {
- systemd_user: await hasSystemdUser() ? "available" : "unavailable",
- portable_service: await hasPortables() ? "available" : "unavailable",
- tmpfiles_d: await hasTmpfilesD() ? "available" : "unavailable",
+ systemd_user: (await hasSystemdUser()) ? "available" : "unavailable",
+ portable_service: (await hasPortables()) ? "available" : "unavailable",
+ tmpfiles_d: (await hasTmpfilesD()) ? "available" : "unavailable",
};
const matrix = {
@@ -48,9 +52,12 @@ const matrix = {
status: {
x64_build: "blocked",
arm64_build: "blocked",
- x64_systemd_user: capabilities.systemd_user === "available" ? "blocked" : "blocked",
- arm64_systemd_user: capabilities.systemd_user === "available" ? "blocked" : "blocked",
- no_systemd_serve: capabilities.systemd_user === "available" ? "blocked" : "blocked",
+ x64_systemd_user:
+ capabilities.systemd_user === "available" ? "blocked" : "blocked",
+ arm64_systemd_user:
+ capabilities.systemd_user === "available" ? "blocked" : "blocked",
+ no_systemd_serve:
+ capabilities.systemd_user === "available" ? "blocked" : "blocked",
},
blocked_reason: "linux_runtime_and_runner_unavailable",
conditions_to_unblock: [
diff --git a/memhub/scripts/platform/linux/verify-linux-support.test.mjs b/memhub/scripts/platform/linux/verify-linux-support.test.mjs
index d3badde..cc8876d 100644
--- a/memhub/scripts/platform/linux/verify-linux-support.test.mjs
+++ b/memhub/scripts/platform/linux/verify-linux-support.test.mjs
@@ -1,7 +1,7 @@
-import { describe, expect, it } from "vitest";
import { spawnSync } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
+import { describe, expect, it } from "vitest";
const script = path.join(
path.dirname(fileURLToPath(import.meta.url)),
@@ -21,6 +21,8 @@ describe("Linux support matrix", () => {
no_systemd_serve: "blocked",
});
expect(matrix.capabilities).toHaveProperty("systemd_user");
- expect(matrix.conditions_to_unblock).toContain("linux_x64_arm64_runtime_or_runner");
+ expect(matrix.conditions_to_unblock).toContain(
+ "linux_x64_arm64_runtime_or_runner",
+ );
});
});
diff --git a/memhub/scripts/platform/linux/verify-linux-upgrade-rollback.mjs b/memhub/scripts/platform/linux/verify-linux-upgrade-rollback.mjs
index 950e409..e55a9a1 100644
--- a/memhub/scripts/platform/linux/verify-linux-upgrade-rollback.mjs
+++ b/memhub/scripts/platform/linux/verify-linux-upgrade-rollback.mjs
@@ -5,14 +5,14 @@ import { createHash } from "node:crypto";
import { createReadStream } from "node:fs";
import {
chmod,
- cp,
copyFile,
+ cp,
lstat,
mkdir,
+ readdir,
readFile,
readlink,
realpath,
- readdir,
stat,
writeFile,
} from "node:fs/promises";
@@ -29,7 +29,7 @@ export async function verifyLinuxUpgradeRollback(options) {
if (process.platform !== "linux") {
throw new Error("linux_upgrade_rollback_requires_linux");
}
- if (!['x64', 'arm64'].includes(process.arch)) {
+ if (!["x64", "arm64"].includes(process.arch)) {
throw new Error("linux_upgrade_rollback_arch_unsupported");
}
const previousDistribution = await distributionIdentity(
@@ -228,7 +228,8 @@ export async function verifyLinuxUpgradeRollback(options) {
[0],
120_000,
);
- if (upgrade.status !== 0) throw commandFailure("upgrade-to-current", upgrade);
+ if (upgrade.status !== 0)
+ throw commandFailure("upgrade-to-current", upgrade);
systemctl(
"current-active",
["is-active", serviceId],
@@ -342,10 +343,7 @@ export async function verifyLinuxUpgradeRollback(options) {
evidenceDir,
previousInstanceId: observations.current_instance_id,
});
- observations.rollback_instance_id = findKey(
- rollbackStatus,
- "instance_id",
- );
+ observations.rollback_instance_id = findKey(rollbackStatus, "instance_id");
const selectedAfterRollback = await selectedManifest(installRoot);
if (
selectedAfterRollback.version !== currentDistribution.manifest.version ||
@@ -481,7 +479,7 @@ export async function verifyLinuxUpgradeRollback(options) {
evidenceDir,
[0, 5],
);
- const cleanupCli = await exists(path.join(binDir, "memhub"))
+ const cleanupCli = (await exists(path.join(binDir, "memhub")))
? path.join(binDir, "memhub")
: path.join(currentDistribution.path, "bin", "one-memory");
run(
@@ -544,13 +542,7 @@ function run(
return { ...document, status: result.status };
}
-function systemctl(
- name,
- arguments_,
- environment,
- evidenceDir,
- accepted = [0],
-) {
+function systemctl(name, arguments_, environment, evidenceDir, accepted = [0]) {
return run(
name,
"systemctl",
@@ -755,8 +747,10 @@ function parseArguments(arguments_) {
const flag = arguments_[index];
const value = arguments_[++index];
if (!value) throw new Error(`missing value for ${flag}`);
- if (flag === "--previous-distribution") options.previousDistribution = value;
- else if (flag === "--current-distribution") options.currentDistribution = value;
+ if (flag === "--previous-distribution")
+ options.previousDistribution = value;
+ else if (flag === "--current-distribution")
+ options.currentDistribution = value;
else if (flag === "--verify-root") options.verifyRoot = value;
else if (flag === "--core-port") options.corePort = Number(value);
else if (flag === "--runtime-port") options.runtimePort = Number(value);
diff --git a/memhub/scripts/platform/linux/verify-release-proxy.mjs b/memhub/scripts/platform/linux/verify-release-proxy.mjs
index 17e57b1..2685d9c 100644
--- a/memhub/scripts/platform/linux/verify-release-proxy.mjs
+++ b/memhub/scripts/platform/linux/verify-release-proxy.mjs
@@ -42,9 +42,7 @@ export async function verifyReleaseProxy(options = {}) {
command("pnpm", ["--filter", "@one-memory/cli", "build"], root, {
...process.env,
ONE_MEMORY_VERSION: version,
- ONE_MEMORY_BUILD_NUMBER: String(
- buildNumber,
- ),
+ ONE_MEMORY_BUILD_NUMBER: String(buildNumber),
ONE_MEMORY_COMMIT: gitCommit,
});
@@ -261,34 +259,82 @@ function generateTlsFixture(directory) {
const serverRequest = path.join(directory, "server.csr");
const serverCertificate = path.join(directory, "server-cert.pem");
const extension = path.join(directory, "server.ext");
- command("openssl", [
- "req", "-x509", "-newkey", "rsa:2048", "-nodes", "-days", "1",
- "-subj", "/CN=MemHub Proxy Test CA",
- "-addext", "basicConstraints=critical,CA:TRUE",
- "-addext", "keyUsage=critical,keyCertSign,cRLSign",
- "-keyout", caKey, "-out", caCertificate,
- ], root);
- command("openssl", [
- "req", "-newkey", "rsa:2048", "-nodes", "-subj", "/CN=127.0.0.1",
- "-keyout", serverKey, "-out", serverRequest,
- ], root);
- spawnSync(process.execPath, [
- "-e",
- "require('fs').writeFileSync(process.argv[1], process.argv[2])",
- extension,
+ command(
+ "openssl",
[
- "basicConstraints=critical,CA:FALSE",
- "keyUsage=critical,digitalSignature,keyEncipherment",
- "extendedKeyUsage=serverAuth",
- "subjectAltName=IP:127.0.0.1,DNS:localhost",
- "",
- ].join("\n"),
- ], { stdio: "inherit" });
- command("openssl", [
- "x509", "-req", "-days", "1", "-CA", caCertificate, "-CAkey", caKey,
- "-CAcreateserial", "-in", serverRequest, "-out", serverCertificate,
- "-extfile", extension,
- ], root);
+ "req",
+ "-x509",
+ "-newkey",
+ "rsa:2048",
+ "-nodes",
+ "-days",
+ "1",
+ "-subj",
+ "/CN=MemHub Proxy Test CA",
+ "-addext",
+ "basicConstraints=critical,CA:TRUE",
+ "-addext",
+ "keyUsage=critical,keyCertSign,cRLSign",
+ "-keyout",
+ caKey,
+ "-out",
+ caCertificate,
+ ],
+ root,
+ );
+ command(
+ "openssl",
+ [
+ "req",
+ "-newkey",
+ "rsa:2048",
+ "-nodes",
+ "-subj",
+ "/CN=127.0.0.1",
+ "-keyout",
+ serverKey,
+ "-out",
+ serverRequest,
+ ],
+ root,
+ );
+ spawnSync(
+ process.execPath,
+ [
+ "-e",
+ "require('fs').writeFileSync(process.argv[1], process.argv[2])",
+ extension,
+ [
+ "basicConstraints=critical,CA:FALSE",
+ "keyUsage=critical,digitalSignature,keyEncipherment",
+ "extendedKeyUsage=serverAuth",
+ "subjectAltName=IP:127.0.0.1,DNS:localhost",
+ "",
+ ].join("\n"),
+ ],
+ { stdio: "inherit" },
+ );
+ command(
+ "openssl",
+ [
+ "x509",
+ "-req",
+ "-days",
+ "1",
+ "-CA",
+ caCertificate,
+ "-CAkey",
+ caKey,
+ "-CAcreateserial",
+ "-in",
+ serverRequest,
+ "-out",
+ serverCertificate,
+ "-extfile",
+ extension,
+ ],
+ root,
+ );
return { caCertificate, serverCertificate, serverKey };
}
@@ -364,9 +410,13 @@ function parseArguments(arguments_) {
if (process.argv[1] === fileURLToPath(import.meta.url)) {
verifyReleaseProxy(parseArguments(process.argv.slice(2)))
- .then((receipt) => process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`))
+ .then((receipt) =>
+ process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`),
+ )
.catch((error) => {
- process.stderr.write(`${error instanceof Error ? error.message : error}\n`);
+ process.stderr.write(
+ `${error instanceof Error ? error.message : error}\n`,
+ );
process.exitCode = 1;
});
}
diff --git a/memhub/scripts/platform/linux/verify-self-contained-runtime.mjs b/memhub/scripts/platform/linux/verify-self-contained-runtime.mjs
index 887cb73..f07663b 100644
--- a/memhub/scripts/platform/linux/verify-self-contained-runtime.mjs
+++ b/memhub/scripts/platform/linux/verify-self-contained-runtime.mjs
@@ -159,7 +159,9 @@ async function waitForStatus(options) {
let attempt = 0;
while (Date.now() < deadline) {
if (options.child.exitCode !== null) {
- throw new Error(`self_contained_runtime_exited:${options.child.exitCode}`);
+ throw new Error(
+ `self_contained_runtime_exited:${options.child.exitCode}`,
+ );
}
attempt += 1;
const result = run(
@@ -232,9 +234,13 @@ function parseArguments(arguments_) {
if (process.argv[1] === fileURLToPath(import.meta.url)) {
verifySelfContainedRuntime(parseArguments(process.argv.slice(2)))
- .then((receipt) => process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`))
+ .then((receipt) =>
+ process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`),
+ )
.catch((error) => {
- process.stderr.write(`${error instanceof Error ? error.message : error}\n`);
+ process.stderr.write(
+ `${error instanceof Error ? error.message : error}\n`,
+ );
process.exitCode = 1;
});
}
diff --git a/memhub/scripts/platform/macos/custom-root-port-isolation.test.mjs b/memhub/scripts/platform/macos/custom-root-port-isolation.test.mjs
index d74f66e..b69d488 100644
--- a/memhub/scripts/platform/macos/custom-root-port-isolation.test.mjs
+++ b/memhub/scripts/platform/macos/custom-root-port-isolation.test.mjs
@@ -81,7 +81,11 @@ test("two non-default install roots must not both fall back to the fixed port",
null,
"a non-default install root must declare an explicit Core port in its plist",
);
- assert.notEqual(portA, portB, "two custom roots must not share one Core port");
+ assert.notEqual(
+ portA,
+ portB,
+ "two custom roots must not share one Core port",
+ );
});
test("the daily (default) install root keeps the fixed port and no override key", () => {
diff --git a/memhub/scripts/platform/windows/verify-windows-support.mjs b/memhub/scripts/platform/windows/verify-windows-support.mjs
index 7a5133c..9b91494 100644
--- a/memhub/scripts/platform/windows/verify-windows-support.mjs
+++ b/memhub/scripts/platform/windows/verify-windows-support.mjs
@@ -7,7 +7,12 @@ const execFileAsync = promisify(execFile);
async function hasWindowsPowerShell() {
try {
- await execFileAsync("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", "$PSVersionTable.PSVersion.Major"]);
+ await execFileAsync("powershell.exe", [
+ "-NoProfile",
+ "-NonInteractive",
+ "-Command",
+ "$PSVersionTable.PSVersion.Major",
+ ]);
return true;
} catch {
return false;
@@ -20,7 +25,8 @@ async function isWindowsHost() {
const windowsHost = await isWindowsHost();
const capabilities = {
- windows_power_shell: windowsHost && (await hasWindowsPowerShell()) ? "available" : "unavailable",
+ windows_power_shell:
+ windowsHost && (await hasWindowsPowerShell()) ? "available" : "unavailable",
};
const matrix = {
diff --git a/memhub/scripts/publish-cli-after-release.mjs b/memhub/scripts/publish-cli-after-release.mjs
index ed878ed..118ab8f 100644
--- a/memhub/scripts/publish-cli-after-release.mjs
+++ b/memhub/scripts/publish-cli-after-release.mjs
@@ -97,7 +97,8 @@ export async function publishCliAfterRelease(options, dependencies = {}) {
"--tag",
npmTag(options.npmTag),
];
- if (options.access) publishArguments.push("--access", npmAccess(options.access));
+ if (options.access)
+ publishArguments.push("--access", npmAccess(options.access));
if (options.provenance) publishArguments.push("--provenance");
if (options.dryRun) publishArguments.push("--dry-run");
runCommand("npm", publishArguments, { cwd: root, env: buildEnvironment });
@@ -191,18 +192,28 @@ function parseArgs(arguments_) {
}
const value = arguments_[++index];
if (!value) throw new Error(`missing value for ${flag}`);
- if (flag === "--manifest-url" && options.manifestUrl === undefined) options.manifestUrl = value;
- else if (flag === "--version" && options.version === undefined) options.version = value;
- else if (flag === "--git-commit" && options.gitCommit === undefined) options.gitCommit = value;
- else if (flag === "--channel" && options.channel === undefined) options.channel = value;
+ if (flag === "--manifest-url" && options.manifestUrl === undefined)
+ options.manifestUrl = value;
+ else if (flag === "--version" && options.version === undefined)
+ options.version = value;
+ else if (flag === "--git-commit" && options.gitCommit === undefined)
+ options.gitCommit = value;
+ else if (flag === "--channel" && options.channel === undefined)
+ options.channel = value;
else if (flag === "--tag" && options.tag === undefined) options.tag = value;
- else if (flag === "--build-number" && options.buildNumber === undefined) options.buildNumber = Number(value);
- else if (flag === "--platform" && options.platform === undefined) options.platform = value;
- else if (flag === "--arch" && options.arch === undefined) options.arch = value;
+ else if (flag === "--build-number" && options.buildNumber === undefined)
+ options.buildNumber = Number(value);
+ else if (flag === "--platform" && options.platform === undefined)
+ options.platform = value;
+ else if (flag === "--arch" && options.arch === undefined)
+ options.arch = value;
else if (flag === "--allowed-host") options.allowedHosts.push(value);
- else if (flag === "--registry" && options.registry === undefined) options.registry = value;
- else if (flag === "--npm-tag" && options.npmTag === undefined) options.npmTag = value;
- else if (flag === "--access" && options.access === undefined) options.access = value;
+ else if (flag === "--registry" && options.registry === undefined)
+ options.registry = value;
+ else if (flag === "--npm-tag" && options.npmTag === undefined)
+ options.npmTag = value;
+ else if (flag === "--access" && options.access === undefined)
+ options.access = value;
else throw new Error(`invalid argument: ${flag}`);
}
if (
@@ -226,7 +237,9 @@ function parseArgs(arguments_) {
}
async function main() {
- const receipt = await publishCliAfterRelease(parseArgs(process.argv.slice(2)));
+ const receipt = await publishCliAfterRelease(
+ parseArgs(process.argv.slice(2)),
+ );
process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`);
}
diff --git a/memhub/scripts/publish-cli-after-release.test.mjs b/memhub/scripts/publish-cli-after-release.test.mjs
index 0de1a88..e447a05 100644
--- a/memhub/scripts/publish-cli-after-release.test.mjs
+++ b/memhub/scripts/publish-cli-after-release.test.mjs
@@ -108,7 +108,11 @@ test("rejects a package identity that differs from the configured publish name",
const root = await fixture(t);
await assert.rejects(
publishCliAfterRelease(
- { ...options, root, environment: { MEMHUB_NPM_PACKAGE: "@public/memhub" } },
+ {
+ ...options,
+ root,
+ environment: { MEMHUB_NPM_PACKAGE: "@public/memhub" },
+ },
{
verifyVersion: async () => ({
version: options.version,
diff --git a/memhub/scripts/release-version.cjs b/memhub/scripts/release-version.cjs
index 140301f..5f148db 100644
--- a/memhub/scripts/release-version.cjs
+++ b/memhub/scripts/release-version.cjs
@@ -29,7 +29,10 @@ function readReleaseBuildNumber(root = repositoryRoot()) {
return value;
}
-function resolveBuildVersion(environment = process.env, root = repositoryRoot()) {
+function resolveBuildVersion(
+ environment = process.env,
+ root = repositoryRoot(),
+) {
const canonical = readReleaseVersion(root);
const supplied = environment.ONE_MEMORY_VERSION?.trim();
if (supplied === undefined || supplied === "") return canonical;
@@ -42,7 +45,10 @@ function resolveBuildVersion(environment = process.env, root = repositoryRoot())
return canonical;
}
-function resolveBuildNumber(environment = process.env, root = repositoryRoot()) {
+function resolveBuildNumber(
+ environment = process.env,
+ root = repositoryRoot(),
+) {
const canonical = readReleaseBuildNumber(root);
const supplied = environment.ONE_MEMORY_BUILD_NUMBER?.trim();
if (supplied === undefined || supplied === "") return canonical;
@@ -81,17 +87,21 @@ function pythonPackageVersion(version) {
if (prerelease) {
const parts = prerelease.split(".");
const label = parts[0].toLowerCase();
- const number = parts.length === 2 && /^\d+$/.test(parts[1]) ? parts[1] : null;
- if (number !== null && ["a", "alpha"].includes(label)) pep = `${base}a${number}`;
- else if (number !== null && ["b", "beta"].includes(label)) pep = `${base}b${number}`;
+ const number =
+ parts.length === 2 && /^\d+$/.test(parts[1]) ? parts[1] : null;
+ if (number !== null && ["a", "alpha"].includes(label))
+ pep = `${base}a${number}`;
+ else if (number !== null && ["b", "beta"].includes(label))
+ pep = `${base}b${number}`;
else if (number !== null && label === "rc") pep = `${base}rc${number}`;
else {
const trailing = parts.at(-1);
- const dev = trailing !== undefined && /^\d+$/.test(trailing) ? trailing : "0";
+ const dev =
+ trailing !== undefined && /^\d+$/.test(trailing) ? trailing : "0";
pep = `${base}.dev${dev}`;
- local = parts
- .slice(0, trailing === dev ? -1 : undefined)
- .join(".") || "prerelease";
+ local =
+ parts.slice(0, trailing === dev ? -1 : undefined).join(".") ||
+ "prerelease";
}
}
const localParts = [local, build]
diff --git a/memhub/scripts/release-workflow.test.mjs b/memhub/scripts/release-workflow.test.mjs
index 20e066b..d47d8c7 100644
--- a/memhub/scripts/release-workflow.test.mjs
+++ b/memhub/scripts/release-workflow.test.mjs
@@ -2,7 +2,10 @@ import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
-const workflowUrl = new URL("../../.github/workflows/release.yml", import.meta.url);
+const workflowUrl = new URL(
+ "../../.github/workflows/release.yml",
+ import.meta.url,
+);
test("the optional full release workflow is manual and preserves ordering", async () => {
const workflow = await readFile(workflowUrl, "utf8");
@@ -15,7 +18,10 @@ test("the optional full release workflow is manual and preserves ordering", asyn
assert.match(workflow, /verify-release-version\.mjs/);
assert.match(workflow, /release\.build_number/);
assert.match(workflow, /source_date_epoch=.*git show -s --format=%ct/);
- assert.match(workflow, /SOURCE_DATE_EPOCH: \$\{\{ needs\.contract\.outputs\.source_date_epoch \}\}/);
+ assert.match(
+ workflow,
+ /SOURCE_DATE_EPOCH: \$\{\{ needs\.contract\.outputs\.source_date_epoch \}\}/,
+ );
assert.match(workflow, /run: pnpm run sbom/);
assert.doesNotMatch(workflow, /run: pnpm sbom/);
assert.doesNotMatch(workflow, /github\.run_number/);
@@ -59,7 +65,10 @@ test("the optional full release workflow is manual and preserves ordering", asyn
assert.match(workflow, /core_port=.*node -e/);
assert.match(workflow, /ONE_MEMORY_CORE_PORT=\$core_port/);
assert.match(workflow, /GITHUB_ENV/);
- assert.match(workflow, /needs:\s*\n\s*- contract\s*\n\s*- verify-published-release/);
+ assert.match(
+ workflow,
+ /needs:\s*\n\s*- contract\s*\n\s*- verify-published-release/,
+ );
const uses = [...workflow.matchAll(/^\s*- uses:\s*([^\s]+)\s*$/gm)].map(
(match) => match[1],
diff --git a/memhub/scripts/set-release-version.mjs b/memhub/scripts/set-release-version.mjs
index 15b13c5..999bb22 100644
--- a/memhub/scripts/set-release-version.mjs
+++ b/memhub/scripts/set-release-version.mjs
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import { readFile, writeFile } from "node:fs/promises";
-import path from "node:path";
import { createRequire } from "node:module";
+import path from "node:path";
import { fileURLToPath } from "node:url";
const require = createRequire(import.meta.url);
@@ -56,10 +56,13 @@ export async function setReleaseVersion(
const lockRelative = "apps/core/uv.lock";
const lockPath = path.join(repositoryRoot, lockRelative);
const lock = await readFile(lockPath, "utf8");
- const lockPattern = /(\[\[package\]\]\s*\nname = "one-memory"\s*\nversion = ")[^"]+("\s*$)/gm;
+ const lockPattern =
+ /(\[\[package\]\]\s*\nname = "one-memory"\s*\nversion = ")[^"]+("\s*$)/gm;
const matches = [...lock.matchAll(lockPattern)];
if (matches.length !== 1) {
- throw new Error("apps/core/uv.lock one-memory version must appear exactly once");
+ throw new Error(
+ "apps/core/uv.lock one-memory version must appear exactly once",
+ );
}
const nextLock = lock.replace(lockPattern, `$1${pythonVersion}$2`);
diff --git a/memhub/scripts/set-release-version.test.mjs b/memhub/scripts/set-release-version.test.mjs
index 33542d1..d9777ad 100644
--- a/memhub/scripts/set-release-version.test.mjs
+++ b/memhub/scripts/set-release-version.test.mjs
@@ -1,5 +1,5 @@
import assert from "node:assert/strict";
-import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
+import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import test from "node:test";
@@ -25,9 +25,14 @@ test("updates every release-bearing manifest in one transaction-sized command",
await mkdir(path.dirname(target), { recursive: true });
await writeFile(target, '{"name":"fixture","version":"0.0.0"}\n');
}
- const rootPackage = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
+ const rootPackage = JSON.parse(
+ await readFile(path.join(root, "package.json"), "utf8"),
+ );
rootPackage.release = { build_number: 6 };
- await writeFile(path.join(root, "package.json"), `${JSON.stringify(rootPackage)}\n`);
+ await writeFile(
+ path.join(root, "package.json"),
+ `${JSON.stringify(rootPackage)}\n`,
+ );
await mkdir(path.join(root, "apps/core"), { recursive: true });
await writeFile(
path.join(root, "apps/core/pyproject.toml"),
@@ -43,7 +48,9 @@ test("updates every release-bearing manifest in one transaction-sized command",
assert.equal(receipt.changed.length, 11);
assert.equal(receipt.build_number, 7);
for (const relative of packageFiles) {
- const document = JSON.parse(await readFile(path.join(root, relative), "utf8"));
+ const document = JSON.parse(
+ await readFile(path.join(root, relative), "utf8"),
+ );
assert.equal(document.version, "1.2.3-rc.1");
}
assert.match(
@@ -62,7 +69,9 @@ test("updates every release-bearing manifest in one transaction-sized command",
});
test("maps an internal SemVer prerelease to deterministic PEP 440 metadata", async (t) => {
- const root = await mkdtemp(path.join(os.tmpdir(), "memhub-version-internal-"));
+ const root = await mkdtemp(
+ path.join(os.tmpdir(), "memhub-version-internal-"),
+ );
t.after(() => rm(root, { recursive: true, force: true }));
const packageFiles = [
"package.json",
@@ -80,9 +89,14 @@ test("maps an internal SemVer prerelease to deterministic PEP 440 metadata", asy
await mkdir(path.dirname(target), { recursive: true });
await writeFile(target, '{"name":"fixture","version":"0.0.0"}\n');
}
- const rootPackage = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
+ const rootPackage = JSON.parse(
+ await readFile(path.join(root, "package.json"), "utf8"),
+ );
rootPackage.release = { build_number: 1 };
- await writeFile(path.join(root, "package.json"), `${JSON.stringify(rootPackage)}\n`);
+ await writeFile(
+ path.join(root, "package.json"),
+ `${JSON.stringify(rootPackage)}\n`,
+ );
await mkdir(path.join(root, "apps/core"), { recursive: true });
await writeFile(
path.join(root, "apps/core/pyproject.toml"),
@@ -154,5 +168,8 @@ test("refuses an ambiguous Core lockfile instead of changing an arbitrary packag
});
test("rejects a non-SemVer version before changing files", async () => {
- await assert.rejects(setReleaseVersion("release-one", "/nonexistent"), /valid SemVer/);
+ await assert.rejects(
+ setReleaseVersion("release-one", "/nonexistent"),
+ /valid SemVer/,
+ );
});
diff --git a/memhub/scripts/summarize_core_test_report.py b/memhub/scripts/summarize_core_test_report.py
new file mode 100644
index 0000000..781c49b
--- /dev/null
+++ b/memhub/scripts/summarize_core_test_report.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python3
+"""Write a compact Markdown summary for one Core pytest report directory."""
+
+from __future__ import annotations
+
+import argparse
+import json
+from pathlib import Path
+from typing import Any
+
+
+def _read_json(path: Path) -> dict[str, Any]:
+ if not path.is_file():
+ return {}
+ value = json.loads(path.read_text(encoding="utf-8"))
+ return value if isinstance(value, dict) else {}
+
+
+def summarize(report_dir: Path) -> str:
+ run = _read_json(report_dir / "run.json")
+ audit = _read_json(report_dir / "design-audit.json")
+ lines = [
+ "# Core test report",
+ "",
+ f"- Suite: `{run.get('suite', 'unknown')}`",
+ f"- Collected: {run.get('collected', 0)}",
+ f"- Passed: {run.get('passed', 0)}",
+ f"- Failed: {run.get('failed', 0)}",
+ f"- Skipped: {run.get('skipped', 0)}",
+ f"- Source review signals: `{audit.get('source_signals', {})}`",
+ f"- Timing review signals: `{audit.get('timing_signals', {})}`",
+ "",
+ "Review signals identify files for human inspection; they do not classify tests as useful or useless.",
+ "",
+ ]
+ rendered = "\n".join(lines)
+ (report_dir / "summary.md").write_text(rendered, encoding="utf-8")
+ return rendered
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("report_dir", type=Path)
+ args = parser.parse_args()
+ print(summarize(args.report_dir.resolve()), end="")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/memhub/scripts/test_verify_public_release_ready.py b/memhub/scripts/test_verify_public_release_ready.py
index 70da909..8faed16 100644
--- a/memhub/scripts/test_verify_public_release_ready.py
+++ b/memhub/scripts/test_verify_public_release_ready.py
@@ -12,7 +12,10 @@ def write_public_fixture(root: Path) -> str:
"THIRD_PARTY_NOTICES.md",
"README.md",
"docs/INSTALLATION.md",
+ "scripts/audit_core_test_design.py",
"scripts/build-release-assets.mjs",
+ "scripts/generate_core_test_index.py",
+ "scripts/summarize_core_test_report.py",
"scripts/verify-release-version.mjs",
"scripts/verify-published-release.mjs",
"scripts/publish-cli-after-release.mjs",
diff --git a/memhub/scripts/verify-published-release.mjs b/memhub/scripts/verify-published-release.mjs
index 55ec559..6111b01 100644
--- a/memhub/scripts/verify-published-release.mjs
+++ b/memhub/scripts/verify-published-release.mjs
@@ -2,8 +2,8 @@
import { createHash } from "node:crypto";
import { createRequire } from "node:module";
-import { fileURLToPath } from "node:url";
import path from "node:path";
+import { fileURLToPath } from "node:url";
const require = createRequire(import.meta.url);
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
@@ -44,13 +44,17 @@ export async function verifyPublishedRelease(options) {
});
let value;
try {
- value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(manifestBytes));
+ value = JSON.parse(
+ new TextDecoder("utf-8", { fatal: true }).decode(manifestBytes),
+ );
} catch {
throw new Error("release_manifest_invalid");
}
const release = parseManifest(value);
- if (release.version !== expectedVersion) throw new Error("release_version_mismatch");
- if (release.git_commit !== expectedCommit) throw new Error("release_commit_mismatch");
+ if (release.version !== expectedVersion)
+ throw new Error("release_version_mismatch");
+ if (release.git_commit !== expectedCommit)
+ throw new Error("release_commit_mismatch");
if (release.channel !== channel) throw new Error("release_channel_mismatch");
const artifact = release.artifacts.find(
(candidate) =>
@@ -78,14 +82,17 @@ export async function verifyPublishedRelease(options) {
}
if (!response.body) throw new Error("release_response_body_missing");
for await (const chunk of response.body) {
- const bytes = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
+ const bytes =
+ chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
total += bytes.byteLength;
- if (total > artifact.bytes) throw new Error("release_artifact_size_mismatch");
+ if (total > artifact.bytes)
+ throw new Error("release_artifact_size_mismatch");
digest.update(bytes);
}
},
});
- if (total !== artifact.bytes) throw new Error("release_artifact_size_mismatch");
+ if (total !== artifact.bytes)
+ throw new Error("release_artifact_size_mismatch");
const actualSha256 = digest.digest("hex");
if (actualSha256 !== artifact.sha256) {
throw new Error("release_artifact_hash_mismatch");
@@ -121,9 +128,11 @@ async function fetchBody(initial, options) {
}
if (!response.body) throw new Error("release_response_body_missing");
for await (const chunk of response.body) {
- const bytes = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
+ const bytes =
+ chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
total += bytes.byteLength;
- if (total > options.maxBytes) throw new Error("release_response_too_large");
+ if (total > options.maxBytes)
+ throw new Error("release_response_too_large");
chunks.push(bytes);
}
},
@@ -150,20 +159,25 @@ async function consumeResponse(initial, options) {
method: "GET",
redirect: "manual",
signal: controller.signal,
- headers: { accept: "application/json, application/octet-stream;q=0.9, */*;q=0.1" },
+ headers: {
+ accept: "application/json, application/octet-stream;q=0.9, */*;q=0.1",
+ },
});
if (REDIRECTS.has(response.status)) {
- if (redirect >= options.maxRedirects) throw new Error("release_redirect_limit");
+ if (redirect >= options.maxRedirects)
+ throw new Error("release_redirect_limit");
const location = response.headers.get("location");
if (!location) throw new Error("release_redirect_invalid");
current = trustedUrl(new URL(location, current).href);
continue;
}
- if (response.status !== 200) throw new Error(`release_http_status_${response.status}`);
+ if (response.status !== 200)
+ throw new Error(`release_http_status_${response.status}`);
await options.consume(response);
return;
} catch (error) {
- if (controller.signal.aborted) throw new Error("release_download_timeout");
+ if (controller.signal.aborted)
+ throw new Error("release_download_timeout");
throw error;
} finally {
clearTimeout(timeout);
@@ -172,7 +186,11 @@ async function consumeResponse(initial, options) {
}
function parseManifest(value) {
- if (!object(value) || !Array.isArray(value.artifacts) || value.artifacts.length === 0) {
+ if (
+ !object(value) ||
+ !Array.isArray(value.artifacts) ||
+ value.artifacts.length === 0
+ ) {
throw new Error("release_manifest_invalid");
}
if (
@@ -279,17 +297,30 @@ function parseArgs(arguments_) {
const flag = arguments_[index];
const value = arguments_[++index];
if (!value) throw new Error(`missing value for ${flag}`);
- if (flag === "--manifest-url" && options.manifestUrl === undefined) options.manifestUrl = value;
- else if (flag === "--version" && options.version === undefined) options.version = value;
- else if (flag === "--channel" && options.channel === undefined) options.channel = value;
- else if (flag === "--git-commit" && options.gitCommit === undefined) options.gitCommit = value;
- else if (flag === "--platform" && options.platform === undefined) options.platform = value;
- else if (flag === "--arch" && options.arch === undefined) options.arch = value;
+ if (flag === "--manifest-url" && options.manifestUrl === undefined)
+ options.manifestUrl = value;
+ else if (flag === "--version" && options.version === undefined)
+ options.version = value;
+ else if (flag === "--channel" && options.channel === undefined)
+ options.channel = value;
+ else if (flag === "--git-commit" && options.gitCommit === undefined)
+ options.gitCommit = value;
+ else if (flag === "--platform" && options.platform === undefined)
+ options.platform = value;
+ else if (flag === "--arch" && options.arch === undefined)
+ options.arch = value;
else if (flag === "--kind") options.kind = value;
else if (flag === "--allowed-host") options.allowedHosts.push(value);
else throw new Error(`invalid argument: ${flag}`);
}
- if (!options.manifestUrl || !options.version || !options.gitCommit || !options.channel || !options.platform || !options.arch) {
+ if (
+ !options.manifestUrl ||
+ !options.version ||
+ !options.gitCommit ||
+ !options.channel ||
+ !options.platform ||
+ !options.arch
+ ) {
throw new Error(
"usage: verify-published-release.mjs --manifest-url <https-url> --version <SemVer> --git-commit <sha> --channel <stable|prerelease> --platform <darwin|linux> --arch <x64|arm64> [--kind <runtime|desktop>] [--allowed-host <hostname>]",
);
@@ -315,7 +346,8 @@ function contentLength(headers) {
if (raw === null) return null;
if (!/^\d+$/.test(raw)) throw new Error("release_content_length_invalid");
const value = Number(raw);
- if (!Number.isSafeInteger(value)) throw new Error("release_content_length_invalid");
+ if (!Number.isSafeInteger(value))
+ throw new Error("release_content_length_invalid");
return value;
}
@@ -332,17 +364,20 @@ function commit(value) {
}
function releaseChannel(value) {
- if (value !== "stable" && value !== "prerelease") throw new Error("release_channel_invalid");
+ if (value !== "stable" && value !== "prerelease")
+ throw new Error("release_channel_invalid");
return value;
}
function releasePlatform(value) {
- if (value !== "darwin" && value !== "linux") throw new Error("release_platform_unsupported");
+ if (value !== "darwin" && value !== "linux")
+ throw new Error("release_platform_unsupported");
return value;
}
function releaseArch(value) {
- if (value !== "x64" && value !== "arm64") throw new Error("release_arch_unsupported");
+ if (value !== "x64" && value !== "arm64")
+ throw new Error("release_arch_unsupported");
return value;
}
@@ -362,7 +397,9 @@ function object(value) {
}
async function main() {
- const receipt = await verifyPublishedRelease(parseArgs(process.argv.slice(2)));
+ const receipt = await verifyPublishedRelease(
+ parseArgs(process.argv.slice(2)),
+ );
process.stdout.write(`${JSON.stringify(receipt, null, 2)}\n`);
}
diff --git a/memhub/scripts/verify-published-release.test.mjs b/memhub/scripts/verify-published-release.test.mjs
index 957943f..a6627d3 100644
--- a/memhub/scripts/verify-published-release.test.mjs
+++ b/memhub/scripts/verify-published-release.test.mjs
@@ -97,7 +97,10 @@ const base = {
};
test("verifies the remotely served manifest and complete artifact", async () => {
- const receipt = await verifyPublishedRelease({ ...base, fetchImpl: fetcher() });
+ const receipt = await verifyPublishedRelease({
+ ...base,
+ fetchImpl: fetcher(),
+ });
assert.equal(receipt.version, "0.1.0-internal.1");
assert.equal(receipt.bytes, artifact.byteLength);
assert.equal(receipt.sha256, digest);
@@ -119,7 +122,11 @@ test("verifies a Desktop DMG without confusing it with the Runtime", async () =>
test("rejects version drift before accepting the artifact", async () => {
await assert.rejects(
- verifyPublishedRelease({ ...base, version: "0.1.0-internal.2", fetchImpl: fetcher() }),
+ verifyPublishedRelease({
+ ...base,
+ version: "0.1.0-internal.2",
+ fetchImpl: fetcher(),
+ }),
/release_version_mismatch/,
);
});
@@ -140,7 +147,9 @@ test("rejects a redirect to a host outside the allow-list", async () => {
if (url.endsWith("release-manifest.json")) {
return new Response(null, {
status: 302,
- headers: { location: "https://objects.example.test/release-manifest.json" },
+ headers: {
+ location: "https://objects.example.test/release-manifest.json",
+ },
});
}
throw new Error("unexpected request");
@@ -155,7 +164,10 @@ test("rejects an artifact whose bytes do not match the manifest digest", async (
await assert.rejects(
verifyPublishedRelease({
...base,
- fetchImpl: fetcher(manifest(), new TextEncoder().encode("different artifact bytes\n")),
+ fetchImpl: fetcher(
+ manifest(),
+ new TextEncoder().encode("different artifact bytes\n"),
+ ),
}),
/release_artifact_size_mismatch|release_artifact_hash_mismatch/,
);
diff --git a/memhub/scripts/verify-release-version.mjs b/memhub/scripts/verify-release-version.mjs
index 05bfa8e..c6abebf 100644
--- a/memhub/scripts/verify-release-version.mjs
+++ b/memhub/scripts/verify-release-version.mjs
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import { readFile } from "node:fs/promises";
-import path from "node:path";
import { createRequire } from "node:module";
+import path from "node:path";
import { fileURLToPath } from "node:url";
const require = createRequire(import.meta.url);
@@ -37,7 +37,8 @@ function parseArgs(arguments_) {
throw new Error(`unknown argument: ${flag}`);
}
const value = arguments_[++index];
- if (value === undefined || value === "") throw new Error(`missing value for ${flag}`);
+ if (value === undefined || value === "")
+ throw new Error(`missing value for ${flag}`);
options[flag.slice(2).replace("-", "_")] = value;
}
if (!["development", "stable", "prerelease"].includes(options.channel)) {
@@ -49,29 +50,45 @@ function parseArgs(arguments_) {
async function packageVersions() {
const versions = {};
for (const relative of packageFiles) {
- const document = JSON.parse(await readFile(path.join(root, relative), "utf8"));
+ const document = JSON.parse(
+ await readFile(path.join(root, relative), "utf8"),
+ );
versions[relative] = assertSemver(document.version, `${relative} version`);
}
- const pyproject = await readFile(path.join(root, "apps/core/pyproject.toml"), "utf8");
+ const pyproject = await readFile(
+ path.join(root, "apps/core/pyproject.toml"),
+ "utf8",
+ );
const match = /^version\s*=\s*"([^"]+)"\s*$/m.exec(pyproject);
- if (!match) throw new Error("apps/core/pyproject.toml project version missing");
+ if (!match)
+ throw new Error("apps/core/pyproject.toml project version missing");
versions["apps/core/pyproject.toml"] = match[1];
const lock = await readFile(path.join(root, "apps/core/uv.lock"), "utf8");
- const lockMatch = /\[\[package\]\]\s*\nname = "one-memory"\s*\nversion = "([^"]+)"/m.exec(lock);
- if (!lockMatch) throw new Error("apps/core/uv.lock one-memory version missing");
+ const lockMatch =
+ /\[\[package\]\]\s*\nname = "one-memory"\s*\nversion = "([^"]+)"/m.exec(
+ lock,
+ );
+ if (!lockMatch)
+ throw new Error("apps/core/uv.lock one-memory version missing");
versions["apps/core/uv.lock"] = lockMatch[1];
return versions;
}
-export async function verifyReleaseVersion(arguments_, environment = process.env) {
+export async function verifyReleaseVersion(
+ arguments_,
+ environment = process.env,
+) {
const options = parseArgs(arguments_);
const version = readReleaseVersion(root);
const canonicalBuildNumber = readReleaseBuildNumber(root);
- const suppliedVersion = options.version ?? environment.ONE_MEMORY_VERSION?.trim();
+ const suppliedVersion =
+ options.version ?? environment.ONE_MEMORY_VERSION?.trim();
if (suppliedVersion !== undefined && suppliedVersion !== "") {
assertSemver(suppliedVersion, "requested release version");
if (suppliedVersion !== version) {
- throw new Error(`requested version ${suppliedVersion} does not match root ${version}`);
+ throw new Error(
+ `requested version ${suppliedVersion} does not match root ${version}`,
+ );
}
}
resolveBuildVersion(
@@ -92,7 +109,8 @@ export async function verifyReleaseVersion(arguments_, environment = process.env
}
const tag = options.tag ?? environment.GITHUB_REF_NAME?.trim();
- const buildNumberRaw = options.build_number ?? environment.ONE_MEMORY_BUILD_NUMBER?.trim();
+ const buildNumberRaw =
+ options.build_number ?? environment.ONE_MEMORY_BUILD_NUMBER?.trim();
const buildNumber =
buildNumberRaw === undefined || buildNumberRaw === ""
? canonicalBuildNumber
@@ -108,14 +126,20 @@ export async function verifyReleaseVersion(arguments_, environment = process.env
if (options.channel !== "development") {
if (version === "0.0.0") throw new Error("0.0.0 cannot be published");
if (tag !== `v${version}`) {
- throw new Error(`release tag mismatch: expected v${version}, got ${tag ?? "<missing>"}`);
+ throw new Error(
+ `release tag mismatch: expected v${version}, got ${tag ?? "<missing>"}`,
+ );
}
}
if (options.channel === "stable" && isPrerelease(version)) {
- throw new Error(`stable channel cannot publish prerelease version ${version}`);
+ throw new Error(
+ `stable channel cannot publish prerelease version ${version}`,
+ );
}
if (options.channel === "prerelease" && !isPrerelease(version)) {
- throw new Error(`prerelease channel requires a SemVer prerelease: ${version}`);
+ throw new Error(
+ `prerelease channel requires a SemVer prerelease: ${version}`,
+ );
}
return {
diff --git a/memhub/scripts/verify_public_release_ready.py b/memhub/scripts/verify_public_release_ready.py
index 08ac6fb..2e6887d 100644
--- a/memhub/scripts/verify_public_release_ready.py
+++ b/memhub/scripts/verify_public_release_ready.py
@@ -25,7 +25,10 @@ REQUIRED_FILES = (
"SBOM.spdx.json",
"README.md",
"docs/INSTALLATION.md",
+ "scripts/audit_core_test_design.py",
"scripts/build-release-assets.mjs",
+ "scripts/generate_core_test_index.py",
+ "scripts/summarize_core_test_report.py",
"scripts/verify-release-version.mjs",
"scripts/verify-published-release.mjs",
"scripts/publish-cli-after-release.mjs",
diff --git a/memhub/scripts/verify_structure.py b/memhub/scripts/verify_structure.py
index d6ec344..8569682 100644
--- a/memhub/scripts/verify_structure.py
+++ b/memhub/scripts/verify_structure.py
@@ -12,6 +12,9 @@ REQUIRED_PATHS = (
"apps/web/package.json",
"apps/desktop/package.json",
"packages/contracts/package.json",
+ "scripts/audit_core_test_design.py",
+ "scripts/generate_core_test_index.py",
+ "scripts/summarize_core_test_report.py",
"pnpm-workspace.yaml",
"SECURITY.md",
"PRIVACY.md",