Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6903d0a916 | ||
|
|
45dbf46545 | ||
|
|
fac7a43ffb | ||
|
|
6e4b22a363 | ||
|
|
c186e5b2fb | ||
|
|
ad84e5decd | ||
|
|
0c43973fc2 | ||
|
|
ebf16b9399 | ||
|
|
87d70b0eb9 | ||
|
|
603e0843c5 |
No files matched your search
+22
-1
@@ -4,6 +4,27 @@ Hy Memory and MemHub are versioned and released independently.
|
||||
|
||||
## Unreleased
|
||||
|
||||
- MemHub host capture hooks no longer write the database. `one-memory
|
||||
capture <host>` used to open the main SQLite file from its own short-lived
|
||||
process on every hook, re-create the retired `evidence` / FTS tables on an
|
||||
SDK-authority home and write the write queue outside Core's single writer,
|
||||
contending for the file lock with Core and with other hosts' hooks. It now
|
||||
reads only the runtime receipt and token and posts the hook's JSON to the
|
||||
running Core (`POST /api/v1/live-capture/{source}`, 1.5 s budget). Core
|
||||
applies the same gates (grant, sync switch, rejection counting, automated
|
||||
sessions, the Cursor/Claude Code rule; the migration fence stays on the hook
|
||||
side) and stages the turn in-process through the live file-sync path. When
|
||||
Core is not running the turn is dropped silently; nothing falls back to a
|
||||
local write.
|
||||
- MemHub no longer sends one turn to the SDK twice when a host's hook and live
|
||||
file sync both see it. The two lanes gave the same message different
|
||||
identities (the hook carries no workspace and often no message id) and
|
||||
separate assembly rows, so both were written as raws. Hook input for a
|
||||
source that live sync reads from its own files (every hooked host except
|
||||
Qwen Work, while live sync is on) is now left to the file path; only a
|
||||
source without file polling is staged from its hook. Tables an older hook
|
||||
re-created on an SDK home are dropped by the existing startup cleanup.
|
||||
|
||||
## Hy Memory 2.0.14 — 2026-11-04
|
||||
|
||||
- `search()` / `async_search()` take an optional `statuses` for explicit
|
||||
@@ -84,7 +105,7 @@ Hy Memory and MemHub are versioned and released independently.
|
||||
|
||||
## MemHub 1.0.6 — 2026-11-04
|
||||
|
||||
Build 41, on `hy-memory==2.0.14`. Linux x64/arm64 Runtime and macOS arm64
|
||||
Build 43, on `hy-memory==2.0.14`. Linux x64/arm64 Runtime and macOS arm64
|
||||
App and Runtime.
|
||||
|
||||
- MemHub App now exposes the complete memory-mode lifecycle. New installs
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ If you run into a problem, please open an Issue with the version, platform,repro
|
||||
## 发行与平台合同
|
||||
|
||||
源码当前固定使用公开 PyPI 正式版 `hy-memory==2.0.14`。MemHub 源码版本为 `1.0.6`
|
||||
(build 41),GitHub 仓库为
|
||||
(build 43),GitHub 仓库为
|
||||
[`Tencent-Hunyuan/Hy-Memory`](https://github.com/Tencent-Hunyuan/Hy-Memory),npm 包名为
|
||||
`memhub-cli`。当前代码架构见
|
||||
[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)。
|
||||
|
||||
@@ -2206,6 +2206,19 @@ def create_app(
|
||||
from one_memory.embedding_switch_routes import embedding_switch_router
|
||||
|
||||
app.include_router(embedding_switch_router(protected))
|
||||
from one_memory.live_capture import live_capture_router
|
||||
|
||||
def file_polled(request: Request, source_id: str) -> bool:
|
||||
"""Whether live sync reads this source's own files, so the hook's copy is redundant."""
|
||||
registration = getattr(request.app.state, "source_catalog", {}).get(source_id)
|
||||
return (
|
||||
runtime_settings.live_sync_enabled
|
||||
and registration is not None
|
||||
and registration.capabilities.live_sync is CapabilityState.IMPLEMENTED
|
||||
)
|
||||
|
||||
# Host hooks hand their turn over here instead of opening the database.
|
||||
app.include_router(live_capture_router(protected, file_polled=file_polled))
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
"""The hook side of live capture: hand the turn to the running Core, nothing more.
|
||||
|
||||
A host runs `one-memory capture <source>` as a short-lived process on every
|
||||
hook, often several at once. That process used to open the main database
|
||||
itself and write Evidence and the write queue from outside Core's single
|
||||
writer. It now never opens the database: it reads the hook's JSON, posts it to
|
||||
the running Core over loopback with the runtime token, and exits. Core applies
|
||||
every gate and stages the turn in-process (`live_capture.capture_hook`).
|
||||
|
||||
Anything that goes wrong — Core not running, a stale receipt, a slow answer —
|
||||
drops the turn silently. There is no local fallback write: file-backed sources
|
||||
are read again by live sync from their persisted cursor once Core is back.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import TextIO
|
||||
|
||||
CAPTURE_SOURCES = frozenset(
|
||||
{
|
||||
"workbuddy",
|
||||
"claude-code",
|
||||
"codex",
|
||||
"cursor",
|
||||
"pi",
|
||||
"qwen-code",
|
||||
"qwenwork",
|
||||
"hermes",
|
||||
"deepseek-harness",
|
||||
"opencode",
|
||||
"openclaw",
|
||||
}
|
||||
)
|
||||
SDK_MIGRATION_CAPTURE_FENCE = ".sdk-migration-capture-fence.json"
|
||||
#: Core's in-process intake for a hook's payload; see `live_capture`.
|
||||
CAPTURE_ROUTE = "/api/v1/live-capture/{source_id}"
|
||||
#: Whole request, connect to answer. Pi and OpenCode wait for the hook
|
||||
#: synchronously (3 s, interpreter start included), so this stays well under.
|
||||
HANDOFF_TIMEOUT_SECONDS = 1.5
|
||||
#: A hook carries one turn, or one session's visible text at most.
|
||||
MAX_PAYLOAD_BYTES = 8 * 1024 * 1024
|
||||
|
||||
|
||||
def data_directory() -> Path:
|
||||
from one_memory.config import load_settings
|
||||
|
||||
return load_settings().data_dir
|
||||
|
||||
|
||||
def capture_stdio(source_id: str, stdin: TextIO, output: TextIO) -> int:
|
||||
"""Host hooks must stay silent. A bad payload or an absent Core does not fail the turn."""
|
||||
|
||||
del output
|
||||
if source_id not in CAPTURE_SOURCES:
|
||||
return 2
|
||||
try:
|
||||
data_dir = data_directory()
|
||||
if sdk_migration_capture_fenced(data_dir):
|
||||
return 0
|
||||
payload = json.loads(stdin.read() or "")
|
||||
except Exception:
|
||||
return 0
|
||||
if not isinstance(payload, dict):
|
||||
return 0
|
||||
try:
|
||||
hand_to_core(source_id, payload, data_dir)
|
||||
except Exception:
|
||||
return 0
|
||||
return 0
|
||||
|
||||
|
||||
def hand_to_core(
|
||||
source_id: str,
|
||||
payload: dict[str, object],
|
||||
data_dir: Path,
|
||||
*,
|
||||
timeout: float = HANDOFF_TIMEOUT_SECONDS,
|
||||
) -> bool:
|
||||
"""Post the payload to the Core named by this home's receipt. True when Core took it.
|
||||
|
||||
Only the receipt, the runtime token and a loopback socket are touched; the
|
||||
main database is never opened from here.
|
||||
"""
|
||||
from one_memory.runtime_client import core_endpoint
|
||||
|
||||
endpoint = core_endpoint(data_dir)
|
||||
if endpoint is None:
|
||||
return False
|
||||
body = json.dumps(payload, ensure_ascii=False).encode("utf-8")
|
||||
if len(body) > MAX_PAYLOAD_BYTES:
|
||||
return False
|
||||
from one_memory.http_client import create_client
|
||||
|
||||
with create_client(timeout=timeout) as client:
|
||||
response = client.post(
|
||||
f"http://{endpoint.host}:{endpoint.port}{CAPTURE_ROUTE.format(source_id=source_id)}",
|
||||
content=body,
|
||||
headers={
|
||||
"Authorization": f"Bearer {endpoint.token}",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
)
|
||||
return response.status_code == 202
|
||||
|
||||
|
||||
def sdk_migration_capture_fenced(data_dir: Path) -> bool:
|
||||
"""Ignore stale fences; a live migration or a failed one pauses hook writes.
|
||||
|
||||
A failed upgrade migration leaves the fence `frozen` (no pid): the home was
|
||||
put back as it was before the upgrade and takes no writes until the next
|
||||
migration attempt, which replaces the fence and lifts it on success.
|
||||
"""
|
||||
marker = data_dir / SDK_MIGRATION_CAPTURE_FENCE
|
||||
try:
|
||||
document = json.loads(marker.read_text(encoding="utf-8"))
|
||||
if isinstance(document, dict) and document.get("frozen") is True:
|
||||
return True
|
||||
pid = int(document["pid"])
|
||||
if pid < 1:
|
||||
raise ValueError("invalid migration fence pid")
|
||||
os.kill(pid, 0)
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except ProcessLookupError:
|
||||
marker.unlink(missing_ok=True)
|
||||
return False
|
||||
except PermissionError:
|
||||
return True
|
||||
except (KeyError, TypeError, ValueError, json.JSONDecodeError, OSError):
|
||||
marker.unlink(missing_ok=True)
|
||||
return False
|
||||
@@ -119,7 +119,7 @@ def run(arguments: Sequence[str], *, output: TextIO | None = None) -> int:
|
||||
if command == "sdk-migration-status":
|
||||
return sdk_migration_status(options, stream)
|
||||
if command == "capture" and len(options) == 1:
|
||||
from one_memory.live_capture import capture_stdio
|
||||
from one_memory.capture_handoff import capture_stdio
|
||||
|
||||
return capture_stdio(options[0], sys.stdin, stream)
|
||||
if command not in {"status", "doctor"} or options not in ([], ["--json"]):
|
||||
|
||||
@@ -1,15 +1,35 @@
|
||||
"""Write visible hook text into Evidence. Tool output stays out."""
|
||||
"""Core's intake for host hooks: visible text only, staged under Core's writer.
|
||||
|
||||
The hook process (`capture_handoff`) never opens the database; it posts the
|
||||
hook's JSON to `POST /api/v1/live-capture/{source}` on the running Core, which
|
||||
calls `capture_hook` here. Tool output stays out.
|
||||
|
||||
A source that live sync already reads from its own files is left to that
|
||||
path: the hook and the file name the same message differently (the hook has
|
||||
no workspace and often no message id), so staging both sent one turn to the
|
||||
SDK twice. Only a source no file poller follows is staged from the hook.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
from collections.abc import Callable
|
||||
from datetime import UTC, datetime
|
||||
from enum import StrEnum
|
||||
from pathlib import Path
|
||||
from typing import TextIO, cast
|
||||
from typing import cast
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Request
|
||||
from fastapi.params import Depends
|
||||
from pydantic import JsonValue
|
||||
|
||||
from one_memory.capture_handoff import (
|
||||
CAPTURE_ROUTE,
|
||||
CAPTURE_SOURCES,
|
||||
MAX_PAYLOAD_BYTES,
|
||||
SDK_MIGRATION_CAPTURE_FENCE,
|
||||
sdk_migration_capture_fenced,
|
||||
)
|
||||
from one_memory.database_access import main_database
|
||||
from one_memory.derived_echo import PREFACE, strip_injected_memory
|
||||
from one_memory.imports.access import opaque_workspace_id, safe_project_label
|
||||
@@ -19,6 +39,7 @@ from one_memory.imports.models import (
|
||||
EvidenceRecord,
|
||||
OriginMetadata,
|
||||
WrittenBy,
|
||||
materialize_write_input,
|
||||
)
|
||||
from one_memory.imports.sources.claude_code import parse_claude_code_record
|
||||
from one_memory.imports.sources.codex import HARNESS_PREFIXES, parse_codex_record
|
||||
@@ -38,23 +59,21 @@ from one_memory.imports.sources.parsing import (
|
||||
)
|
||||
from one_memory.imports.sources.pi import _is_automated_session
|
||||
from one_memory.imports.sources.workbuddy import _is_scheduled_automation, parse_workbuddy_record
|
||||
from one_memory.imports.storage import EvidenceStore
|
||||
from one_memory.memory_server.durable_queue import DurableWriteQueue
|
||||
from one_memory.sdk_data_plane_migration import MemoryAuthority
|
||||
|
||||
__all__ = [
|
||||
"CAPTURE_SOURCES",
|
||||
"SDK_MIGRATION_CAPTURE_FENCE",
|
||||
"CaptureOutcome",
|
||||
"CaptureRejection",
|
||||
"capture_hook",
|
||||
"capture_rejection",
|
||||
"live_capture_router",
|
||||
"record_capture_rejection",
|
||||
"sdk_migration_capture_fenced",
|
||||
]
|
||||
|
||||
CAPTURE_SOURCES = frozenset(
|
||||
{
|
||||
"workbuddy",
|
||||
"claude-code",
|
||||
"codex",
|
||||
"cursor",
|
||||
"pi",
|
||||
"qwen-code",
|
||||
"qwenwork",
|
||||
"hermes",
|
||||
"deepseek-harness",
|
||||
"opencode",
|
||||
"openclaw",
|
||||
}
|
||||
)
|
||||
_UNKNOWN_USER = frozenset({"hermes", "opencode", "openclaw"})
|
||||
_USER_FIELDS = {
|
||||
"UserPromptSubmit": "prompt",
|
||||
@@ -75,112 +94,130 @@ _FILE_FALLBACK = {
|
||||
}
|
||||
_FALLBACK_EVENTS = frozenset({"Stop", "stop", "SubagentStop", "StopFailure"})
|
||||
_TEXT_BLOCKS = frozenset({"text"})
|
||||
SDK_MIGRATION_CAPTURE_FENCE = ".sdk-migration-capture-fence.json"
|
||||
|
||||
|
||||
def database_path() -> Path:
|
||||
from one_memory.config import load_settings
|
||||
class CaptureOutcome(StrEnum):
|
||||
"""What Core did with one hook payload. Never the payload itself."""
|
||||
|
||||
return load_settings().data_dir / "one-memory.sqlite3"
|
||||
STAGED = "staged"
|
||||
#: Live sync reads this source's own files; that path owns the turn.
|
||||
FILE_POLLED = "file_polled"
|
||||
REJECTED = "rejected"
|
||||
IGNORED = "ignored"
|
||||
|
||||
|
||||
def capture_stdio(source_id: str, stdin: TextIO, output: TextIO) -> int:
|
||||
"""Host hooks must stay silent. A bad payload does not fail the turn."""
|
||||
def capture_hook(
|
||||
source_id: str,
|
||||
payload: object,
|
||||
database: Path,
|
||||
*,
|
||||
queue: DurableWriteQueue,
|
||||
file_polled: Callable[[str], bool] = lambda _source_id: False,
|
||||
) -> CaptureOutcome:
|
||||
"""Gate one hook payload and stage its visible lines, inside Core.
|
||||
|
||||
del output
|
||||
if source_id not in CAPTURE_SOURCES:
|
||||
return 2
|
||||
database = database_path()
|
||||
if sdk_migration_capture_fenced(database.parent):
|
||||
return 0
|
||||
try:
|
||||
payload = json.loads(stdin.read() or "")
|
||||
except json.JSONDecodeError:
|
||||
return 0
|
||||
try:
|
||||
capture_hook(source_id, payload, database)
|
||||
except Exception:
|
||||
return 0
|
||||
return 0
|
||||
|
||||
|
||||
def sdk_migration_capture_fenced(data_dir: Path) -> bool:
|
||||
"""Ignore stale fences; a live migration or a failed one pauses hook writes.
|
||||
|
||||
A failed upgrade migration leaves the fence `frozen` (no pid): the home was
|
||||
put back as it was before the upgrade and takes no writes until the next
|
||||
migration attempt, which replaces the fence and lifts it on success.
|
||||
Runs on SDK authority through Core's single writer: the lines become
|
||||
write-job input exactly as live file sync stages them
|
||||
(`materialize_write_input` -> `stage_sdk_input` -> `finalize_sdk_file`,
|
||||
live priority). No Evidence table is involved.
|
||||
"""
|
||||
marker = data_dir / SDK_MIGRATION_CAPTURE_FENCE
|
||||
try:
|
||||
document = json.loads(marker.read_text(encoding="utf-8"))
|
||||
if isinstance(document, dict) and document.get("frozen") is True:
|
||||
return True
|
||||
pid = int(document["pid"])
|
||||
if pid < 1:
|
||||
raise ValueError("invalid migration fence pid")
|
||||
os.kill(pid, 0)
|
||||
return True
|
||||
except FileNotFoundError:
|
||||
return False
|
||||
except ProcessLookupError:
|
||||
marker.unlink(missing_ok=True)
|
||||
return False
|
||||
except PermissionError:
|
||||
return True
|
||||
except (KeyError, TypeError, ValueError, json.JSONDecodeError, OSError):
|
||||
marker.unlink(missing_ok=True)
|
||||
return False
|
||||
|
||||
|
||||
def capture_hook(source_id: str, payload: object, database: Path) -> bool:
|
||||
if source_id not in CAPTURE_SOURCES or not isinstance(payload, dict):
|
||||
return False
|
||||
return CaptureOutcome.IGNORED
|
||||
# Cursor also runs ~/.claude/settings.json hooks; its own hook already files the turn.
|
||||
if source_id != "cursor" and "cursor_version" in payload:
|
||||
return False
|
||||
return CaptureOutcome.IGNORED
|
||||
if not database.is_file():
|
||||
return False
|
||||
return CaptureOutcome.IGNORED
|
||||
rejection = capture_rejection(database, source_id)
|
||||
if rejection is not None:
|
||||
# Silent, and the reason is counted rather than printed: a hook that
|
||||
# spoke would put this into the host's turn as text.
|
||||
record_capture_rejection(database, source_id, rejection)
|
||||
return False
|
||||
return CaptureOutcome.REJECTED
|
||||
if source_id == "pi" and _is_automated_session(first_string(payload.get("cwd"))):
|
||||
return False
|
||||
lines = _messages(source_id, payload)
|
||||
if lines:
|
||||
conversation_id = _conversation(payload)
|
||||
store = EvidenceStore(database)
|
||||
wrote = False
|
||||
for role, written_by, verbatim, message_id in lines:
|
||||
target = conversation_id
|
||||
if target is None:
|
||||
continue
|
||||
result = store.put(
|
||||
EvidenceInput(
|
||||
source_id=source_id,
|
||||
conversation_id=target,
|
||||
message_id=message_id,
|
||||
source_ordinal=None if message_id else "hook-visible",
|
||||
role=role,
|
||||
written_by=written_by,
|
||||
created_at=datetime.now(UTC),
|
||||
verbatim=verbatim,
|
||||
origin_meta={EvidenceOrigin.HOOK: OriginMetadata()},
|
||||
)
|
||||
)
|
||||
_submit_live_memory(
|
||||
store, result.record, changed=result.was_created or result.was_revised
|
||||
)
|
||||
wrote = True
|
||||
return wrote
|
||||
return _capture_transcript(source_id, payload, database)
|
||||
return CaptureOutcome.IGNORED
|
||||
if file_polled(source_id):
|
||||
# The same turn reaches the SDK once, from the file: the two lanes give
|
||||
# one message different identities, so staging both wrote it twice.
|
||||
return CaptureOutcome.FILE_POLLED
|
||||
inputs = _hook_inputs(source_id, payload) or _capture_transcript(source_id, payload, database)
|
||||
if not inputs:
|
||||
return CaptureOutcome.IGNORED
|
||||
observed = datetime.now(UTC)
|
||||
conversations: dict[str, list[EvidenceRecord]] = {}
|
||||
for value in inputs:
|
||||
conversations.setdefault(value.conversation_id, []).append(
|
||||
materialize_write_input(value, observed_at=observed)
|
||||
)
|
||||
for conversation_id, records in conversations.items():
|
||||
# The turn rule decides what is written (`turn_batches`): a turn is
|
||||
# complete when the next user message arrives, batches are 5 turns or
|
||||
# 8000 characters, and Core writes the rest after 10 quiet minutes.
|
||||
queue.assemble_live_records(tuple(records), file_key=f"hook:{conversation_id}")
|
||||
return CaptureOutcome.STAGED
|
||||
|
||||
|
||||
def _sync_open(database: Path, source_id: str) -> bool:
|
||||
return capture_rejection(database, source_id) is None
|
||||
def _hook_inputs(source_id: str, payload: dict[str, object]) -> list[EvidenceInput]:
|
||||
conversation_id = _conversation(payload)
|
||||
if conversation_id is None:
|
||||
return []
|
||||
observed = datetime.now(UTC)
|
||||
return [
|
||||
EvidenceInput(
|
||||
source_id=source_id,
|
||||
conversation_id=conversation_id,
|
||||
message_id=message_id,
|
||||
source_ordinal=None if message_id else "hook-visible",
|
||||
role=role,
|
||||
written_by=written_by,
|
||||
created_at=observed,
|
||||
verbatim=verbatim,
|
||||
origin_meta={EvidenceOrigin.HOOK: OriginMetadata()},
|
||||
)
|
||||
for role, written_by, verbatim, message_id in _messages(source_id, payload)
|
||||
]
|
||||
|
||||
|
||||
def live_capture_router(
|
||||
dependencies: list[Depends],
|
||||
*,
|
||||
file_polled: Callable[[Request, str], bool],
|
||||
) -> APIRouter:
|
||||
"""`POST /api/v1/live-capture/{source_id}`: a hook's payload, handed over by the hook.
|
||||
|
||||
202 whatever the gates decide, so a hook has nothing to print. The answer
|
||||
names the outcome only, never any of the payload.
|
||||
"""
|
||||
router = APIRouter(dependencies=dependencies)
|
||||
|
||||
@router.post(CAPTURE_ROUTE, status_code=202)
|
||||
async def live_capture(source_id: str, request: Request) -> dict[str, str]:
|
||||
if source_id not in CAPTURE_SOURCES:
|
||||
raise HTTPException(status_code=404, detail="capture_source_not_found")
|
||||
body = await request.body()
|
||||
if len(body) > MAX_PAYLOAD_BYTES:
|
||||
raise HTTPException(status_code=413, detail="capture_payload_too_large")
|
||||
try:
|
||||
payload = json.loads(body)
|
||||
except (json.JSONDecodeError, UnicodeError) as error:
|
||||
raise HTTPException(status_code=422, detail="capture_payload_invalid") from error
|
||||
state = request.app.state
|
||||
queue = getattr(state, "memory_write_queue", None)
|
||||
if getattr(state, "memory_authority", None) is not MemoryAuthority.SDK or queue is None:
|
||||
# Only an SDK-authority home is served; nothing here may bring the
|
||||
# retired Evidence tables back for any other.
|
||||
return {"outcome": CaptureOutcome.IGNORED.value}
|
||||
outcome = await asyncio.to_thread(
|
||||
capture_hook,
|
||||
source_id,
|
||||
payload,
|
||||
queue.database_path,
|
||||
queue=queue,
|
||||
file_polled=lambda source: file_polled(request, source),
|
||||
)
|
||||
return {"outcome": outcome.value}
|
||||
|
||||
return router
|
||||
|
||||
|
||||
class CaptureRejection(StrEnum):
|
||||
@@ -255,22 +292,6 @@ def record_capture_rejection(
|
||||
return
|
||||
|
||||
|
||||
def _submit_live_memory(store: EvidenceStore, record: EvidenceRecord, *, changed: bool) -> None:
|
||||
"""Add the record to its conversation's live assembling row.
|
||||
|
||||
The turn rule decides what is written (`turn_batches`): a turn is
|
||||
complete when the next user message arrives, batches are 5 turns or
|
||||
8000 characters, and Core writes the rest after 10 quiet minutes.
|
||||
"""
|
||||
if not changed or not _sync_open(store.database_path, record.source_id):
|
||||
return
|
||||
from one_memory.memory_server.durable_queue import DurableWriteQueue
|
||||
|
||||
DurableWriteQueue(store.database_path, evidence=store).assemble_live_records(
|
||||
(record,), file_key=f"hook:{record.conversation_id}"
|
||||
)
|
||||
|
||||
|
||||
def _conversation(payload: dict[str, object]) -> str | None:
|
||||
return first_string(
|
||||
cast(JsonValue | None, payload.get("session_id")),
|
||||
@@ -470,34 +491,35 @@ def _opencode_messages(
|
||||
return lines
|
||||
|
||||
|
||||
def _capture_transcript(source_id: str, payload: dict[str, object], database: Path) -> bool:
|
||||
def _capture_transcript(
|
||||
source_id: str, payload: dict[str, object], database: Path
|
||||
) -> list[EvidenceInput]:
|
||||
"""Stop without in-memory text reads the granted transcript, then the same parser."""
|
||||
|
||||
event = payload.get("hook_event_name") or payload.get("hookEventName")
|
||||
parser = _FILE_FALLBACK.get(source_id)
|
||||
transcript = payload.get("transcript_path")
|
||||
if event not in _FALLBACK_EVENTS or parser is None or not isinstance(transcript, str):
|
||||
return False
|
||||
return []
|
||||
root = _grant_root(database, source_id)
|
||||
if root is None:
|
||||
return False
|
||||
return []
|
||||
try:
|
||||
granted = root.resolve()
|
||||
target = Path(transcript).resolve()
|
||||
except OSError:
|
||||
return False
|
||||
return []
|
||||
if target != granted and granted not in target.parents:
|
||||
return False
|
||||
return []
|
||||
if not target.is_file():
|
||||
return False
|
||||
return []
|
||||
_wait_stable(target)
|
||||
try:
|
||||
raw = target.read_text(encoding="utf-8")
|
||||
except OSError:
|
||||
return False
|
||||
return []
|
||||
relative = target.relative_to(granted).as_posix()
|
||||
store = EvidenceStore(database)
|
||||
wrote = False
|
||||
inputs: list[EvidenceInput] = []
|
||||
for index, line in enumerate(raw.splitlines()):
|
||||
if not line.strip():
|
||||
continue
|
||||
@@ -514,7 +536,7 @@ def _capture_transcript(source_id: str, payload: dict[str, object], database: Pa
|
||||
if not isinstance(parsed, ParsedMessage):
|
||||
continue
|
||||
for row_index, row in enumerate(parsed.rows()):
|
||||
result = store.put(
|
||||
inputs.append(
|
||||
EvidenceInput(
|
||||
source_id=source_id,
|
||||
workspace=opaque_workspace_id(source_id, row.workspace),
|
||||
@@ -533,11 +555,7 @@ def _capture_transcript(source_id: str, payload: dict[str, object], database: Pa
|
||||
origin_meta={EvidenceOrigin.FILE: OriginMetadata()},
|
||||
)
|
||||
)
|
||||
_submit_live_memory(
|
||||
store, result.record, changed=result.was_created or result.was_revised
|
||||
)
|
||||
wrote = True
|
||||
return wrote
|
||||
return inputs
|
||||
|
||||
|
||||
def _grant_root(database: Path, source_id: str) -> Path | None:
|
||||
|
||||
@@ -113,6 +113,37 @@ def inspect_runtime(
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CoreEndpoint:
|
||||
host: Literal["127.0.0.1"]
|
||||
port: int
|
||||
token: str
|
||||
|
||||
|
||||
def core_endpoint(
|
||||
data_dir: Path,
|
||||
*,
|
||||
alive: Callable[[int], bool] = process_is_alive,
|
||||
) -> CoreEndpoint | None:
|
||||
"""Where this home's Core listens and the token it accepts, from files alone.
|
||||
|
||||
The receipt and token checks `inspect_runtime` makes, without its identity
|
||||
round trip: a caller that only has to hand something over quickly lets the
|
||||
authenticated request itself be the proof. None when no live Core is named.
|
||||
"""
|
||||
try:
|
||||
raw = (data_dir / "runtime.json").read_text(encoding="utf-8")
|
||||
receipt = _receipt(json.loads(raw))
|
||||
except (OSError, UnicodeError, json.JSONDecodeError):
|
||||
return None
|
||||
if receipt is None or not alive(receipt.pid):
|
||||
return None
|
||||
token = _runtime_token(data_dir)
|
||||
if token is None:
|
||||
return None
|
||||
return CoreEndpoint(host=receipt.host, port=receipt.port, token=token)
|
||||
|
||||
|
||||
def _receipt(value: object) -> RuntimeReceipt | None:
|
||||
if not isinstance(value, dict):
|
||||
return None
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
| `test_internal_preset.py` | `contract` | The optional model preset a configured build carries. |
|
||||
| `test_jsonl_snapshot_tail.py` | `contract` | Bounded EOF handling on synthetic files only, never original host history. |
|
||||
| `test_library_search_window.py` | `unit` | The library search window store and the unified record/keyword parsing. |
|
||||
| `test_live_capture.py` | `integration` | Visible hook text lands in Evidence before the transcript file is flushed. |
|
||||
| `test_live_capture.py` | `integration` | Hooks hand visible text to Core, which stages it once, without Evidence. |
|
||||
| `test_live_sync.py` | `contract` | 覆盖 live sync preempts a reader batch before it emits work、live sync cuts in front of a running history import、live sync does not resume a history import the user paused 等 24 个场景。 |
|
||||
| `test_live_sync_file_incremental.py` | `contract` | 覆盖 unchanged file metadata avoids a job and content read、changed file content is read once by the import job、workbuddy first live poll baselines history then imports only append 等 6 个场景。 |
|
||||
| `test_live_sync_job_coalescing.py` | `contract` | A poll that finds nothing must not leave an import job behind. |
|
||||
|
||||
@@ -29,7 +29,6 @@ from one_memory.imports.sources.registry import (
|
||||
build_source_catalog,
|
||||
)
|
||||
from one_memory.imports.supervisor import ImportSupervisor
|
||||
from one_memory.live_capture import capture_hook
|
||||
|
||||
FREEZE_THRESHOLD_SECONDS = 1.0
|
||||
|
||||
@@ -228,31 +227,17 @@ async def _run(
|
||||
|
||||
hook_text = "realtime hook while history import is running"
|
||||
hook_started = time.monotonic()
|
||||
result["hook_accepted"] = await asyncio.to_thread(
|
||||
capture_hook,
|
||||
"workbuddy",
|
||||
{
|
||||
# A hook hands its turn to Core over loopback; it no longer writes the
|
||||
# database itself. What is measured is that hand-off under import load.
|
||||
handed = await client.post(
|
||||
"/api/v1/live-capture/workbuddy",
|
||||
json={
|
||||
"hook_event_name": "UserPromptSubmit",
|
||||
"session_id": "pressure-live-session",
|
||||
"prompt": hook_text,
|
||||
},
|
||||
app.state.evidence_store.database_path,
|
||||
)
|
||||
hook_deadline = hook_started + 10
|
||||
hook_stored = False
|
||||
while time.monotonic() < hook_deadline:
|
||||
with sqlite3.connect(app.state.evidence_store.database_path) as connection:
|
||||
hook_stored = (
|
||||
connection.execute(
|
||||
"SELECT 1 FROM evidence WHERE source_id='workbuddy' AND verbatim=?",
|
||||
(hook_text,),
|
||||
).fetchone()
|
||||
is not None
|
||||
)
|
||||
if hook_stored:
|
||||
break
|
||||
await asyncio.sleep(0.01)
|
||||
result["hook_stored"] = hook_stored
|
||||
result["hook_accepted"] = handed.status_code == 202
|
||||
result["hook_visible_ms"] = round((time.monotonic() - hook_started) * 1000, 1)
|
||||
|
||||
during, during_unavailable, sampled_terminal = await _measure_recall_until(
|
||||
|
||||
@@ -131,3 +131,24 @@ def test_run_as_the_entry_it_ends_itself_while_still_importing(tmp_path) -> None
|
||||
_reap([process])
|
||||
assert process.returncode == -signal.SIGALRM
|
||||
assert time.monotonic() - started < 10
|
||||
|
||||
|
||||
def test_with_no_core_a_real_capture_exits_at_once_and_writes_nothing(tmp_path) -> None:
|
||||
# The process a host actually starts: no Core is running for this home,
|
||||
# so the turn is dropped. Nothing may fall back to writing the database.
|
||||
data_dir = tmp_path / "data"
|
||||
env = {
|
||||
key: value for key, value in os.environ.items() if key != "ONE_MEMORY_CAPTURE_DEADLINE_S"
|
||||
}
|
||||
env.update(HOME=str(tmp_path), ONE_MEMORY_DATA_DIR=str(data_dir))
|
||||
payload = b'{"hook_event_name": "UserPromptSubmit", "session_id": "s", "prompt": "hi"}'
|
||||
result = subprocess.run(
|
||||
[sys.executable, "-m", "one_memory.cli", "capture", "workbuddy"],
|
||||
input=payload,
|
||||
capture_output=True,
|
||||
env=env,
|
||||
timeout=60,
|
||||
check=False,
|
||||
)
|
||||
assert (result.returncode, result.stdout, result.stderr) == (0, b"", b"")
|
||||
assert not (data_dir / "one-memory.sqlite3").exists()
|
||||
File diff suppressed because it is too large.
Load diff
@@ -293,6 +293,22 @@ def _retry_succeeds(home: Path, monkeypatch) -> None:
|
||||
assert len(list((home / "backups").glob("*-pre-cutover.sdk-bundle"))) == 1
|
||||
|
||||
|
||||
def test_evidence_an_older_capture_hook_recreated_is_dropped_on_the_next_start(home):
|
||||
# Builds through 1.0.6 let the hook process open `EvidenceStore`, which
|
||||
# rebuilt the retired tables on an SDK home. Nothing reads them there, and
|
||||
# the next startup migration's leftovers cleanup removes them again.
|
||||
assert _run(home).state == "cutover"
|
||||
database = home / "one-memory.sqlite3"
|
||||
EvidenceStore(database)
|
||||
assert "evidence" in legacy_tables_present(database)
|
||||
|
||||
result = _run(home)
|
||||
|
||||
assert result.state == "complete"
|
||||
assert {"evidence", "evidence_search"} <= set(result.dropped_tables)
|
||||
assert legacy_tables_present(database) == ()
|
||||
|
||||
|
||||
def test_a_failure_after_the_cutover_commit_is_not_restored(home, monkeypatch):
|
||||
import one_memory.sdk_migration_runner as runner
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@ def test_workbuddy_recall_remains_available_during_100k_import(tmp_path, monkeyp
|
||||
|
||||
assert result["import_status"] == "completed"
|
||||
assert result["stored"] == 100_000
|
||||
assert result["evidence_rows"] == 100_001
|
||||
assert result["evidence_rows"] == 100_000
|
||||
assert result["hook_accepted"] is True
|
||||
assert result["hook_stored"] is True
|
||||
assert result["hook_visible_ms"] < 10_000
|
||||
assert result["recall_sampling_terminal"] is True
|
||||
assert result["during_unavailable"] == 0
|
||||
|
||||
@@ -371,13 +371,11 @@ it("uses user-facing connection confirmation copy without implementation narrati
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByRole("complementary", { name: "连接应用" })).toBeTruthy();
|
||||
expect(screen.getByRole("checkbox", { name: "一键接入应用" })).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText(
|
||||
"点击底部按钮后,后台分别接入各应用;某个应用失败不影响其他应用。",
|
||||
screen.queryByText(
|
||||
/点击底部按钮后|选择草稿|按各应用回执|本页任务控制尚未接通/,
|
||||
),
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
screen.queryByText(/选择草稿|按各应用回执|本页任务控制尚未接通/),
|
||||
).toBeNull();
|
||||
expect(screen.queryByText(/下一步选择记忆模式/)).toBeNull();
|
||||
expect(screen.queryByText(/之后仍可在设置中更改/)).toBeNull();
|
||||
|
||||
@@ -148,6 +148,11 @@ export function FirstImportReview({
|
||||
const canResume = batch.some((job) =>
|
||||
["paused", "interrupted", "failed"].includes(job.status),
|
||||
);
|
||||
const allCompleted =
|
||||
batch.length > 0 &&
|
||||
ids.every((id) => batch.some((job) => job.source_id === id)) &&
|
||||
batch.every((job) => job.status === "completed") &&
|
||||
!Object.keys(failedSources).length;
|
||||
const title = "对话正在汇入,记忆从这里开始";
|
||||
const hostEligible = importHostEligible(sources, ids);
|
||||
const draftReady = !!connectionDraft && !!onConnectionDraftChange;
|
||||
@@ -322,6 +327,16 @@ export function FirstImportReview({
|
||||
className="first-import-r6-main"
|
||||
aria-label={text("导入与原文")}
|
||||
>
|
||||
<div className="first-import-r6-intro">
|
||||
<h2>{text("正在导入你的会话")}</h2>
|
||||
<p>
|
||||
{text(
|
||||
allCompleted
|
||||
? "本次导入已结束。已保存的对话无需重复导入。"
|
||||
: "后台将持续为你导入,可以放心进入下一步",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{(error || actionMessage) && (
|
||||
<div className="first-import-r6-feedback">
|
||||
<p
|
||||
@@ -355,46 +370,39 @@ export function FirstImportReview({
|
||||
jobs={batch}
|
||||
stale={progressStale}
|
||||
/>
|
||||
<section
|
||||
className="first-import-r6-feed"
|
||||
aria-label={text("导入说明")}
|
||||
>
|
||||
<h2>{text("正在导入你的会话")}</h2>
|
||||
<p className="first-import-r6-feed-status">
|
||||
{text("后台将持续为你导入,可以放心进入下一步")}
|
||||
</p>
|
||||
{Object.keys(failedSources).length > 0 && (
|
||||
<section
|
||||
className="first-import-r6-failures"
|
||||
aria-label={text("未开始的导入")}
|
||||
{Object.keys(failedSources).length > 0 && (
|
||||
<section
|
||||
className="first-import-r6-failures"
|
||||
aria-label={text("未开始的导入")}
|
||||
>
|
||||
{Object.keys(failedSources).map((id) => (
|
||||
<p key={id}>
|
||||
{sources.find((source) => source.source_id === id)
|
||||
?.display_name ?? id}{" "}
|
||||
{text("未能开始导入,其他已接受任务不受影响。")}
|
||||
</p>
|
||||
))}
|
||||
<R6Button
|
||||
variant="quiet"
|
||||
disabled={busy}
|
||||
onClick={() => leave("sources")}
|
||||
>
|
||||
{Object.keys(failedSources).map((id) => (
|
||||
<p key={id}>
|
||||
{sources.find((source) => source.source_id === id)
|
||||
?.display_name ?? id}{" "}
|
||||
{text("未能开始导入,其他已接受任务不受影响。")}
|
||||
</p>
|
||||
))}
|
||||
<R6Button
|
||||
variant="quiet"
|
||||
disabled={busy}
|
||||
onClick={() => leave("sources")}
|
||||
>
|
||||
{text("查看未导入的应用")}
|
||||
</R6Button>
|
||||
</section>
|
||||
)}
|
||||
</section>
|
||||
{text("查看未导入的应用")}
|
||||
</R6Button>
|
||||
</section>
|
||||
)}
|
||||
</section>
|
||||
<aside
|
||||
className="first-import-r6-options"
|
||||
aria-label={text("连接应用")}
|
||||
>
|
||||
<p className="first-import-r6-eyebrow">{text("让记忆继续生长")}</p>
|
||||
<h2>{text("连接你的应用")}</h2>
|
||||
<p className="first-import-r6-options-intro">
|
||||
{text("适用于本次选择且支持的应用。")}
|
||||
</p>
|
||||
<div className="first-import-r6-options-head">
|
||||
<p className="first-import-r6-eyebrow">{text("让记忆继续生长")}</p>
|
||||
<h2>{text("连接你的应用")}</h2>
|
||||
<p className="first-import-r6-options-intro">
|
||||
{text("适用于本次选择且支持的应用。")}
|
||||
</p>
|
||||
</div>
|
||||
<SelectionTile
|
||||
title={text(
|
||||
hostConnectionAvailable ? "一键接入应用" : "测试实例不接入应用",
|
||||
@@ -430,13 +438,11 @@ export function FirstImportReview({
|
||||
{text(connectionNote)}
|
||||
</p>
|
||||
)}
|
||||
<p className="first-import-r6-options-note">
|
||||
{text(
|
||||
draftReady
|
||||
? "点击底部按钮后,后台分别接入各应用;某个应用失败不影响其他应用。"
|
||||
: "暂时无法连接应用,当前不会安装连接。",
|
||||
)}
|
||||
</p>
|
||||
{!draftReady && (
|
||||
<p className="first-import-r6-options-note">
|
||||
{text("暂时无法连接应用,当前不会安装连接。")}
|
||||
</p>
|
||||
)}
|
||||
</aside>
|
||||
</div>
|
||||
</R6ColdStartFrame>
|
||||
|
||||
@@ -1235,11 +1235,11 @@ export function MemoryMap(props: Props) {
|
||||
<h2>
|
||||
{props.simplified
|
||||
? raw
|
||||
? t("memory:原始对话")
|
||||
? text("来源归属")
|
||||
: text("记忆关联")
|
||||
: label}
|
||||
</h2>
|
||||
{props.simplified && (
|
||||
{props.simplified && (!raw || !projection.nodes.length) && (
|
||||
<p className="selected-graph-subtitle">
|
||||
{projection.nodes.length
|
||||
? text("来源归属")
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import type { MemoryPipelineMode } from "@one-memory/contracts";
|
||||
import { Check } from "lucide-react";
|
||||
import { type ReactNode, useId } from "react";
|
||||
import { MODE_COPY } from "./memory-mode-ui";
|
||||
import { useOnboardingTranslation } from "./onboarding-language";
|
||||
import "./memory-mode-cards.css";
|
||||
|
||||
const MODES: Array<{
|
||||
id: MemoryPipelineMode;
|
||||
index: string;
|
||||
description: string;
|
||||
}> = [
|
||||
{
|
||||
id: "lite",
|
||||
index: "01",
|
||||
description: "不调用生成模型。保存并检索原始对话,不再生成高级记忆。",
|
||||
},
|
||||
{
|
||||
id: "pro",
|
||||
index: "02",
|
||||
description: "使用当前模型从新对话中提取事实、偏好和计划。",
|
||||
},
|
||||
{
|
||||
id: "ultra",
|
||||
index: "03",
|
||||
description: "在智能记忆之上使用知识图谱,并默认每天 03:00 自动整合记忆。",
|
||||
},
|
||||
];
|
||||
|
||||
export function MemoryModeCards({
|
||||
value,
|
||||
current,
|
||||
currentBadge,
|
||||
disabled = false,
|
||||
onChange,
|
||||
ultraDetail,
|
||||
"aria-label": ariaLabel,
|
||||
"aria-busy": ariaBusy,
|
||||
}: {
|
||||
value: MemoryPipelineMode | null;
|
||||
current?: MemoryPipelineMode;
|
||||
currentBadge?: ReactNode;
|
||||
disabled?: boolean | ((mode: MemoryPipelineMode) => boolean);
|
||||
onChange(mode: MemoryPipelineMode, control: HTMLInputElement): void;
|
||||
ultraDetail?: ReactNode;
|
||||
"aria-label": string;
|
||||
"aria-busy"?: boolean;
|
||||
}) {
|
||||
const { text } = useOnboardingTranslation();
|
||||
const name = useId();
|
||||
const unavailable = (mode: MemoryPipelineMode) =>
|
||||
typeof disabled === "function" ? disabled(mode) : disabled;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="memory-mode-cards"
|
||||
role="radiogroup"
|
||||
aria-label={ariaLabel}
|
||||
aria-busy={ariaBusy || undefined}
|
||||
>
|
||||
{MODES.map((mode) => {
|
||||
const selected = value === mode.id;
|
||||
const modeDisabled = unavailable(mode.id);
|
||||
const localizedTitle = text(MODE_COPY[mode.id].title);
|
||||
const title = localizedTitle.replace(
|
||||
/\s*[((](?:lite|pro|ultra)[))]\s*$/i,
|
||||
"",
|
||||
);
|
||||
const features = text(MODE_COPY[mode.id].description).split(/\s*·\s*/);
|
||||
return (
|
||||
<div
|
||||
key={mode.id}
|
||||
className="memory-mode-card"
|
||||
data-mode={mode.id}
|
||||
data-selected={selected || undefined}
|
||||
data-current={current === mode.id || undefined}
|
||||
data-disabled={modeDisabled || undefined}
|
||||
>
|
||||
<label className="memory-mode-card-choice">
|
||||
<input
|
||||
type="radio"
|
||||
name={name}
|
||||
value={mode.id}
|
||||
aria-label={localizedTitle}
|
||||
checked={selected}
|
||||
disabled={modeDisabled}
|
||||
onChange={(event) => onChange(mode.id, event.currentTarget)}
|
||||
/>
|
||||
<span className="memory-mode-title">
|
||||
<span className="memory-mode-index">{mode.index}</span>
|
||||
<strong>{title}</strong>
|
||||
<span className="memory-mode-tier">
|
||||
{mode.id.toUpperCase()}
|
||||
</span>
|
||||
{current === mode.id && currentBadge ? (
|
||||
<span className="memory-mode-current">{currentBadge}</span>
|
||||
) : null}
|
||||
<span className="memory-mode-radio" aria-hidden="true">
|
||||
{selected ? <Check size={13} /> : null}
|
||||
</span>
|
||||
</span>
|
||||
<span className="memory-mode-description">
|
||||
{text(mode.description)}
|
||||
</span>
|
||||
<span className="memory-mode-features">
|
||||
{features.map((feature) => (
|
||||
<span key={feature}>
|
||||
<i aria-hidden="true" />
|
||||
{text(feature)}
|
||||
</span>
|
||||
))}
|
||||
</span>
|
||||
</label>
|
||||
{mode.id === "ultra" && selected && ultraDetail ? (
|
||||
<div className="memory-mode-detail">{ultraDetail}</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ it("renders all settings modes as one grouped shared choice list", async () => {
|
||||
expect(within(group).getAllByRole("radio")).toHaveLength(3);
|
||||
expect(
|
||||
within(group).getByText("当前模式").closest("label")?.textContent,
|
||||
).toContain("智能记忆(pro)");
|
||||
).toContain("智能记忆PRO");
|
||||
});
|
||||
|
||||
it("confirms the data effects before switching to lite", async () => {
|
||||
|
||||
@@ -25,12 +25,8 @@ import {
|
||||
commitConfirmedMemoryMode,
|
||||
issueConfirmedModeTicket,
|
||||
} from "./confirmed-memory-mode";
|
||||
import { MemoryModeChoiceList } from "./MemoryModeChoiceList";
|
||||
import {
|
||||
BLOCKER_COPY,
|
||||
MemoryModeConfirmDialog,
|
||||
MODE_COPY,
|
||||
} from "./memory-mode-ui";
|
||||
import { MemoryModeCards } from "./MemoryModeCards";
|
||||
import { BLOCKER_COPY, MemoryModeConfirmDialog } from "./memory-mode-ui";
|
||||
import { useOnboardingTranslation } from "./onboarding-language";
|
||||
import { R6Button } from "./R6Controls";
|
||||
import { R6StateRecovery } from "./R6StateRecovery";
|
||||
@@ -237,16 +233,11 @@ export function MemoryModeSettings({
|
||||
<p>{text("模式决定新对话如何保存,以及记忆页面展示什么。")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<MemoryModeChoiceList
|
||||
<MemoryModeCards
|
||||
aria-label={text("当前模式")}
|
||||
aria-busy={state === null}
|
||||
modes={(["lite", "pro", "ultra"] as const).map((mode) => ({
|
||||
mode,
|
||||
title: text(MODE_COPY[mode].title),
|
||||
description: text(MODE_COPY[mode].description),
|
||||
}))}
|
||||
current={state?.mode}
|
||||
selected={state?.mode ?? null}
|
||||
value={state?.mode ?? null}
|
||||
currentBadge={text("当前模式")}
|
||||
disabled={(mode) =>
|
||||
!state ||
|
||||
@@ -256,6 +247,50 @@ export function MemoryModeSettings({
|
||||
(mode !== "lite" && !modelStateKnown)
|
||||
}
|
||||
onChange={(mode, control) => void choose(mode, control)}
|
||||
ultraDetail={
|
||||
state?.mode === "ultra" && schedule ? (
|
||||
<section
|
||||
id={`${id}-evolve`}
|
||||
className="r6-evolve-settings r6-evolve-settings--in-card"
|
||||
aria-labelledby={`${id}-evolve-title`}
|
||||
tabIndex={-1}
|
||||
>
|
||||
<UltraEvolveScheduleFields
|
||||
schedule={schedule}
|
||||
headingId={`${id}-evolve-title`}
|
||||
disabled={busy || maintenance}
|
||||
onEnabledChange={(enabled) => void changeSchedule({ enabled })}
|
||||
onTimeChange={(time) => changeSchedule({ time })}
|
||||
/>
|
||||
<div className="r6-evolve-setting r6-evolve-setting--manual">
|
||||
<div className="r6-evolve-setting-copy">
|
||||
<h3>{text("立即整合一次")}</h3>
|
||||
<p>
|
||||
{text("只运行这一次,不改变每天的计划。")}
|
||||
{" · "}
|
||||
{text(
|
||||
run?.state === "running"
|
||||
? "正在整合记忆…"
|
||||
: last?.last_run_at
|
||||
? text("上次整合:{time}").replace(
|
||||
"{time}",
|
||||
new Date(last.last_run_at).toLocaleString(locale),
|
||||
)
|
||||
: "尚未整合",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<R6Button
|
||||
pending={run?.state === "running"}
|
||||
disabled={busy || lifecycleBusy}
|
||||
onClick={() => void evolveNow()}
|
||||
>
|
||||
{text("立即整合")}
|
||||
</R6Button>
|
||||
</div>
|
||||
</section>
|
||||
) : null
|
||||
}
|
||||
/>
|
||||
{state?.forced_by_env ? (
|
||||
<p className="r6-settings-note" role="status">
|
||||
@@ -285,49 +320,6 @@ export function MemoryModeSettings({
|
||||
)
|
||||
) : null}
|
||||
|
||||
{state?.mode === "ultra" && schedule ? (
|
||||
<section
|
||||
id={`${id}-evolve`}
|
||||
className="r6-evolve-settings"
|
||||
aria-labelledby={`${id}-evolve-title`}
|
||||
tabIndex={-1}
|
||||
>
|
||||
<UltraEvolveScheduleFields
|
||||
schedule={schedule}
|
||||
headingId={`${id}-evolve-title`}
|
||||
disabled={busy || maintenance}
|
||||
onEnabledChange={(enabled) => void changeSchedule({ enabled })}
|
||||
onTimeChange={(time) => changeSchedule({ time })}
|
||||
/>
|
||||
<div className="r6-evolve-setting r6-evolve-setting--manual">
|
||||
<div className="r6-evolve-setting-copy">
|
||||
<h3>{text("立即整合一次")}</h3>
|
||||
<p>
|
||||
{text("只运行这一次,不改变每天的计划。")}
|
||||
{" · "}
|
||||
{text(
|
||||
run?.state === "running"
|
||||
? "正在整合记忆…"
|
||||
: last?.last_run_at
|
||||
? text("上次整合:{time}").replace(
|
||||
"{time}",
|
||||
new Date(last.last_run_at).toLocaleString(locale),
|
||||
)
|
||||
: "尚未整合",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<R6Button
|
||||
pending={run?.state === "running"}
|
||||
disabled={busy || lifecycleBusy}
|
||||
onClick={() => void evolveNow()}
|
||||
>
|
||||
{text("立即整合")}
|
||||
</R6Button>
|
||||
</div>
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
{pendingMode && pendingPlan ? (
|
||||
<MemoryModeConfirmDialog
|
||||
mode={pendingMode}
|
||||
|
||||
@@ -289,6 +289,11 @@ it("shows raw conversations instead of advanced memory in lite", async () => {
|
||||
render(<MemorySpace simplified />);
|
||||
|
||||
expect(await screen.findAllByText("原始对话内容")).toHaveLength(2);
|
||||
expect(screen.getByText("1 条原始对话")).toBeTruthy();
|
||||
expect(screen.queryByText("找到 1 条")).toBeNull();
|
||||
expect(
|
||||
screen.getByRole("heading", { level: 2, name: "来源归属" }),
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
document.querySelector(".core-memory-map")?.hasAttribute("hidden"),
|
||||
).toBe(false);
|
||||
@@ -625,6 +630,7 @@ it("opens a search hit with the complete role transcript", async () => {
|
||||
await user.click(screen.getByRole("button", { name: "搜索" }));
|
||||
|
||||
expect(await screen.findByText("完整问题")).toBeTruthy();
|
||||
expect(screen.getByText("找到 1 条")).toBeTruthy();
|
||||
expect(screen.getByText("完整回答")).toBeTruthy();
|
||||
expect(
|
||||
document.querySelector(".map-dialogue-reading")?.textContent,
|
||||
|
||||
@@ -964,10 +964,9 @@ export function MemorySpace({
|
||||
? sdkPage
|
||||
? sdkPage.total_exact === false
|
||||
? t("memory:原始对话")
|
||||
: `${t("memory:原始对话")} · ${tn(
|
||||
"sdk.raw.found",
|
||||
sdkPage.total,
|
||||
)}`
|
||||
: sdkLibrary.settledQuery.trim()
|
||||
? tn("sdk.raw.found", sdkPage.total)
|
||||
: tn("sdk.raw.total", sdkPage.total)
|
||||
: sdkLibrary.failed
|
||||
? null
|
||||
: t("memory:正在读取…")
|
||||
|
||||
@@ -23,20 +23,20 @@ vi.mock("./api", () => ({
|
||||
explicitly_configured: false,
|
||||
}),
|
||||
setMemoryMode: vi.fn().mockResolvedValue({ mode: "pro" }),
|
||||
planMemoryMode: vi.fn().mockResolvedValue({
|
||||
planMemoryMode: vi.fn().mockImplementation(async (target) => ({
|
||||
current: "lite",
|
||||
target: "pro",
|
||||
effective_target: "pro",
|
||||
target,
|
||||
effective_target: target,
|
||||
capabilities: {
|
||||
content_plane: "memory",
|
||||
generation_required: true,
|
||||
graph_enabled: false,
|
||||
evolve_available: false,
|
||||
content_plane: target === "lite" ? "raw" : "memory",
|
||||
generation_required: target !== "lite",
|
||||
graph_enabled: target === "ultra",
|
||||
evolve_available: target === "ultra",
|
||||
},
|
||||
effects: [],
|
||||
warnings: [],
|
||||
blockers: ["active_model_required"],
|
||||
}),
|
||||
blockers: target === "lite" ? [] : ["active_model_required"],
|
||||
})),
|
||||
putOnboardingProgress: vi.fn().mockResolvedValue({ model_profile_id: null }),
|
||||
patchOnboardingProgress: vi.fn().mockResolvedValue({}),
|
||||
}));
|
||||
@@ -156,9 +156,6 @@ it("moves from import to the actual third step without completing onboarding", a
|
||||
);
|
||||
await userEvent.click(screen.getByRole("button", { name: "进入第三步" }));
|
||||
await userEvent.click(screen.getByRole("radio", { name: /pro/i }));
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "确认选择" }),
|
||||
);
|
||||
await userEvent.click(screen.getByRole("button", { name: "继续配置模型" }));
|
||||
expect(screen.getByRole("heading", { name: "第三步模型页面" })).toBeTruthy();
|
||||
expect(completeOnboarding).not.toHaveBeenCalled();
|
||||
@@ -187,9 +184,6 @@ it("lets an empty first-time user enter without granting or importing a source",
|
||||
await waitFor(() => expect((skip as HTMLButtonElement).disabled).toBe(false));
|
||||
await userEvent.click(skip);
|
||||
await userEvent.click(screen.getByRole("radio", { name: /lite/i }));
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "确认选择" }),
|
||||
);
|
||||
await userEvent.click(screen.getByRole("button", { name: "使用 Lite 进入" }));
|
||||
await waitFor(() =>
|
||||
expect(finish).toHaveBeenCalledExactlyOnceWith("sources"),
|
||||
@@ -213,9 +207,6 @@ it("retains explicit retry or enter when saving the skipped onboarding fails", a
|
||||
await waitFor(() => expect((skip as HTMLButtonElement).disabled).toBe(false));
|
||||
await userEvent.click(skip);
|
||||
await userEvent.click(screen.getByRole("radio", { name: /lite/i }));
|
||||
await userEvent.click(
|
||||
await screen.findByRole("button", { name: "确认选择" }),
|
||||
);
|
||||
await userEvent.click(screen.getByRole("button", { name: "使用 Lite 进入" }));
|
||||
await screen.findByRole("button", { name: "重试保存并进入" });
|
||||
expect(finish).not.toHaveBeenCalled();
|
||||
|
||||
@@ -329,7 +329,6 @@ it("uses compact Spanish actions and preserves Chinese copy and permissions", as
|
||||
expect(
|
||||
screen.getByText(/Solo para las apps seleccionadas y compatibles/),
|
||||
).toBeTruthy();
|
||||
expect(screen.getByText(/Si una falla, las demás siguen/)).toBeTruthy();
|
||||
fireEvent.click(screen.getByText("中文"));
|
||||
expect(screen.getByRole("button", { name: "选择记忆模式" })).toBeTruthy();
|
||||
expect(navigation.textContent).toContain("连接应用");
|
||||
@@ -447,9 +446,6 @@ it("translates completion recovery live without repeating completion writes", as
|
||||
screen.getByRole("button", { name: "Elegir el modo de memoria" }),
|
||||
);
|
||||
fireEvent.click(screen.getByRole("radio", { name: /lite/i }));
|
||||
fireEvent.click(
|
||||
await screen.findByRole("button", { name: "Confirmar selección" }),
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "Entrar con Lite" }));
|
||||
expect(
|
||||
await screen.findByRole("button", { name: "Reintentar guardar y entrar" }),
|
||||
|
||||
@@ -353,7 +353,6 @@ it("empty discovery shows zero and allows explicit entry without a connection re
|
||||
);
|
||||
fireEvent.click(screen.getByRole("button", { name: "选择记忆模式" }));
|
||||
fireEvent.click(screen.getByRole("radio", { name: /lite/i }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "确认选择" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "使用 Lite 进入" }));
|
||||
await waitFor(() =>
|
||||
expect(finish).toHaveBeenCalledExactlyOnceWith("sources"),
|
||||
@@ -400,7 +399,6 @@ it("partial acceptance preserves the successful job and failure through model-st
|
||||
fireEvent.click(screen.getByRole("button", { name: "继续配置模型" }));
|
||||
expect(api.completeOnboarding).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("radio", { name: /lite/i }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "确认选择" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "使用 Lite 进入" }));
|
||||
await waitFor(() =>
|
||||
expect(finish).toHaveBeenCalledExactlyOnceWith("sources"),
|
||||
|
||||
@@ -251,7 +251,6 @@ async function selectMode(
|
||||
name: RegExp,
|
||||
) {
|
||||
await user.click(screen.getByRole("radio", { name }));
|
||||
await user.click(await screen.findByRole("button", { name: "确认选择" }));
|
||||
}
|
||||
function choice(name = "Claude Code") {
|
||||
return screen.getByRole<HTMLInputElement>("checkbox", {
|
||||
@@ -334,7 +333,7 @@ describe("OnboardingFlow S1.3", () => {
|
||||
|
||||
it("D41 opens source choice with metadata discovery but no content or authorization requests", async () => {
|
||||
const controller = imports();
|
||||
const view = render(
|
||||
render(
|
||||
<OnboardingFlow
|
||||
state={onboarding}
|
||||
imports={controller}
|
||||
@@ -430,6 +429,89 @@ describe("OnboardingFlow S1.3", () => {
|
||||
expect(controller.connectForOnboarding).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("keeps the import review open when a late connection result is unknown", async () => {
|
||||
const user = userEvent.setup();
|
||||
let rejectImport!: (reason?: unknown) => void;
|
||||
const controller = imports({
|
||||
connectForOnboarding: vi.fn(
|
||||
() =>
|
||||
new Promise<
|
||||
Awaited<ReturnType<ImportSourcesController["connectForOnboarding"]>>
|
||||
>((_resolve, reject) => {
|
||||
rejectImport = reject;
|
||||
}),
|
||||
),
|
||||
});
|
||||
window.oneMemory = {} as NonNullable<typeof window.oneMemory>;
|
||||
render(
|
||||
<OnboardingFlow
|
||||
state={onboarding}
|
||||
imports={controller}
|
||||
onFinish={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
await choose(user);
|
||||
await approve(user);
|
||||
await user.click(screen.getByRole("button", { name: START }));
|
||||
expect(
|
||||
await screen.findByRole("heading", {
|
||||
name: "对话正在汇入,记忆从这里开始",
|
||||
}),
|
||||
).toBeTruthy();
|
||||
|
||||
await act(async () => rejectImport(new Error("response lost")));
|
||||
|
||||
expect(
|
||||
screen.getByRole("heading", {
|
||||
name: "对话正在汇入,记忆从这里开始",
|
||||
}),
|
||||
).toBeTruthy();
|
||||
expect(screen.getByRole("alert").textContent).toContain(
|
||||
"开始导入的结果尚未确认",
|
||||
);
|
||||
expect(
|
||||
screen.queryByRole("heading", { name: "把熟悉的背景,带到这里" }),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("returns to source review when Core definitely refuses the connection", async () => {
|
||||
const user = userEvent.setup();
|
||||
const controller = imports({
|
||||
connectForOnboarding: vi.fn().mockRejectedValue(
|
||||
Object.assign(new Error("source rejected"), {
|
||||
definiteRefusal: true,
|
||||
}),
|
||||
),
|
||||
});
|
||||
window.oneMemory = {} as NonNullable<typeof window.oneMemory>;
|
||||
render(
|
||||
<OnboardingFlow
|
||||
state={onboarding}
|
||||
imports={controller}
|
||||
onFinish={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
await choose(user);
|
||||
await approve(user);
|
||||
await user.click(screen.getByRole("button", { name: START }));
|
||||
|
||||
expect(
|
||||
await screen.findByRole("heading", {
|
||||
name: "把熟悉的背景,带到这里",
|
||||
}),
|
||||
).toBeTruthy();
|
||||
expect(screen.getByRole("alert").textContent).toContain(
|
||||
"本次没有来源获准导入",
|
||||
);
|
||||
expect(
|
||||
screen.queryByRole("heading", {
|
||||
name: "对话正在汇入,记忆从这里开始",
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("opens model setup immediately and preserves it across a late import failure", async () => {
|
||||
const user = userEvent.setup();
|
||||
let rejectImport!: (reason?: unknown) => void;
|
||||
@@ -948,12 +1030,10 @@ describe("OnboardingFlow S1.3", () => {
|
||||
await user.click(screen.getByRole("button", { name: SKIP }));
|
||||
|
||||
expect(screen.getByRole("heading", { name: "选择记忆模式" })).toBeTruthy();
|
||||
expect(screen.queryByText("之后可在设置中更改。")).toBeNull();
|
||||
expect(screen.getByText("之后可在设置中更改。")).toBeTruthy();
|
||||
expect(screen.getAllByRole("radio")).toHaveLength(3);
|
||||
expect(screen.getByRole("radio", { name: /ultra/i })).toBeTruthy();
|
||||
expect(screen.getByText("推荐").closest("label")?.textContent).toContain(
|
||||
"pro",
|
||||
);
|
||||
expect(screen.queryByText("推荐")).toBeNull();
|
||||
const modeStep = screen
|
||||
.getByRole("navigation", { name: "首次设置进度" })
|
||||
.querySelector('[aria-current="step"]');
|
||||
@@ -1003,24 +1083,8 @@ describe("OnboardingFlow S1.3", () => {
|
||||
await openApps();
|
||||
await user.click(screen.getByRole("button", { name: SKIP }));
|
||||
await user.click(screen.getByRole("radio", { name: /ultra/i }));
|
||||
expect(
|
||||
await screen.findByRole("heading", {
|
||||
name: "选择深度记忆(ultra)?",
|
||||
}),
|
||||
).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText("使用 pro 或 ultra 前需要先配置并启用生成模型。"),
|
||||
).toBeTruthy();
|
||||
await user.click(screen.getByRole("button", { name: "确认选择" }));
|
||||
|
||||
expect(
|
||||
screen
|
||||
.getByRole("switch", { name: "每天自动整合" })
|
||||
.getAttribute("aria-checked"),
|
||||
).toBe("true");
|
||||
expect(
|
||||
screen.getByRole("button", { name: "执行时间,03:00" }),
|
||||
).toBeTruthy();
|
||||
expect(screen.getByText("每天自动整合")).toBeTruthy();
|
||||
expect(screen.getByText(/每天 03:00 左右自动整合/)).toBeTruthy();
|
||||
await user.click(screen.getByRole("button", { name: "继续" }));
|
||||
expect(screen.getByRole("region", { name: "模型步骤边界" })).toBeTruthy();
|
||||
expect(putOnboardingProgress).toHaveBeenCalledWith(
|
||||
@@ -1089,11 +1153,7 @@ describe("OnboardingFlow S1.3", () => {
|
||||
false,
|
||||
),
|
||||
);
|
||||
expect(
|
||||
screen
|
||||
.getByRole("switch", { name: "每天自动整合" })
|
||||
.getAttribute("aria-checked"),
|
||||
).toBe("false");
|
||||
expect(screen.getByText(/重新开启后仍按 05:30 运行/)).toBeTruthy();
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "继续" }));
|
||||
await waitFor(() =>
|
||||
@@ -1171,9 +1231,7 @@ describe("OnboardingFlow S1.3", () => {
|
||||
|
||||
await user.click(screen.getByRole("button", { name: "重试" }));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.getByRole("button", { name: "执行时间,04:15" }),
|
||||
).toBeTruthy(),
|
||||
expect(screen.getByText(/每天 04:15 左右自动整合/)).toBeTruthy(),
|
||||
);
|
||||
expect(
|
||||
screen.getByRole<HTMLInputElement>("radio", { name: /ultra/i }).checked,
|
||||
@@ -2682,10 +2740,9 @@ describe("OnboardingFlow S1.3", () => {
|
||||
);
|
||||
await user.click(screen.getByRole("button", { name: START }));
|
||||
await waitFor(() =>
|
||||
expect(api.getSourceConnection).toHaveBeenCalledExactlyOnceWith(
|
||||
requestId,
|
||||
),
|
||||
expect(api.getSourceConnection).toHaveBeenCalledTimes(2),
|
||||
);
|
||||
expect(api.getSourceConnection).toHaveBeenLastCalledWith(requestId);
|
||||
expect(api.connectSources).toHaveBeenCalledOnce();
|
||||
expect(screen.getByRole("alert").textContent).toContain("尚未确认");
|
||||
vi.mocked(api.getSourceConnection).mockResolvedValueOnce({
|
||||
@@ -2700,7 +2757,7 @@ describe("OnboardingFlow S1.3", () => {
|
||||
await continueImport(user);
|
||||
expect(onFinish).toHaveBeenCalledWith("sources");
|
||||
expect(api.connectSources).toHaveBeenCalledOnce();
|
||||
expect(api.getSourceConnection).toHaveBeenCalledTimes(2);
|
||||
expect(api.getSourceConnection).toHaveBeenCalledTimes(3);
|
||||
expect(api.createImportJob).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ import type {
|
||||
ConnectSourcesResponse,
|
||||
EvolveSchedule,
|
||||
ImportJob,
|
||||
MemoryModePlan,
|
||||
MemoryPipelineMode,
|
||||
OnboardingModeIntent,
|
||||
OnboardingState,
|
||||
SourceResponse,
|
||||
@@ -49,19 +47,17 @@ import {
|
||||
hostCapabilities,
|
||||
hostWriteReason,
|
||||
} from "./host-state";
|
||||
import { MemoryModeChoiceList } from "./MemoryModeChoiceList";
|
||||
import {
|
||||
BLOCKER_COPY,
|
||||
MemoryModeConfirmDialog,
|
||||
MODE_COPY,
|
||||
} from "./memory-mode-ui";
|
||||
import { MemoryModeCards } from "./MemoryModeCards";
|
||||
import { BLOCKER_COPY } from "./memory-mode-ui";
|
||||
import { OnboardingModelController } from "./OnboardingModelController";
|
||||
import { useOnboardingTranslation } from "./onboarding-language";
|
||||
import { R6ColdStartFrame } from "./R6ColdStartFrame";
|
||||
import { R6Button } from "./R6Controls";
|
||||
import { UltraEvolveScheduleFields } from "./UltraEvolveScheduleFields";
|
||||
import { traceUiAction } from "./ui-trace";
|
||||
import type { ImportSourcesController } from "./use-import-sources";
|
||||
import {
|
||||
type ImportSourcesController,
|
||||
isDefiniteAccessRefusal,
|
||||
} from "./use-import-sources";
|
||||
import { isDefiniteRefusal } from "./write-outcome";
|
||||
import "./cold-start.css";
|
||||
|
||||
@@ -115,7 +111,7 @@ export function OnboardingFlow({
|
||||
imports: ImportSourcesController;
|
||||
onFinish(destination: OnboardingDestination): void;
|
||||
}) {
|
||||
const { text, t } = useOnboardingTranslation();
|
||||
const { text, t, locale } = useOnboardingTranslation();
|
||||
const [sources, setSources] = useState(imports.sources);
|
||||
const sourceGeneration = useRef({ value: imports.sources, epoch: 0 });
|
||||
if (sourceGeneration.current.value !== imports.sources) {
|
||||
@@ -159,14 +155,7 @@ export function OnboardingFlow({
|
||||
);
|
||||
const modeSaving = modePhase !== "idle";
|
||||
const [modeError, setModeError] = useState<string | null>(null);
|
||||
const [knownMode, setKnownMode] = useState<MemoryPipelineMode>("pro");
|
||||
const [pendingMode, setPendingMode] = useState<OnboardingMemoryMode | null>(
|
||||
null,
|
||||
);
|
||||
const [pendingPlan, setPendingPlan] = useState<MemoryModePlan | null>(null);
|
||||
const [modePlanBusy, setModePlanBusy] = useState(false);
|
||||
const modeDialogOpener = useRef<HTMLElement | null>(null);
|
||||
const modePlanOperation = useRef(0);
|
||||
const [knownMode, setKnownMode] = useState<OnboardingMemoryMode>("pro");
|
||||
const [ultraSchedule, setUltraSchedule] = useState<EvolveSchedule>({
|
||||
enabled: true,
|
||||
time: "03:00",
|
||||
@@ -704,10 +693,6 @@ export function OnboardingFlow({
|
||||
const requestModeChoice = useCallback(
|
||||
(destination: OnboardingDestination) => {
|
||||
if (finished.current) return;
|
||||
modePlanOperation.current += 1;
|
||||
setModePlanBusy(false);
|
||||
setPendingMode(null);
|
||||
setPendingPlan(null);
|
||||
if (setupStepRef.current === "model")
|
||||
leaveModelStep(intentRef.current === "ultra" ? "ultra" : "pro", "mode");
|
||||
else {
|
||||
@@ -724,45 +709,19 @@ export function OnboardingFlow({
|
||||
[leaveModelStep, modeChoice],
|
||||
);
|
||||
|
||||
const requestModeSelection = useCallback(
|
||||
async (mode: OnboardingMemoryMode, opener: HTMLElement) => {
|
||||
if (modePlanBusy || modeSaving || completionBusy) return;
|
||||
const operation = ++modePlanOperation.current;
|
||||
setModePlanBusy(true);
|
||||
setModeError(null);
|
||||
const loadModePlan = useCallback(
|
||||
async (target: OnboardingMemoryMode) => {
|
||||
try {
|
||||
let plan: MemoryModePlan;
|
||||
try {
|
||||
plan = await planMemoryMode(mode);
|
||||
} catch (reason) {
|
||||
if (!memoryModePlanUnsupported(reason)) throw reason;
|
||||
const profiles = await getModelProfiles();
|
||||
plan = legacyMemoryModePlan(knownMode, mode, {
|
||||
hasActiveModel: profiles.some((profile) => profile.is_active),
|
||||
});
|
||||
}
|
||||
if (
|
||||
!alive.current ||
|
||||
modePlanOperation.current !== operation ||
|
||||
setupStepRef.current !== "mode"
|
||||
)
|
||||
return;
|
||||
modeDialogOpener.current = opener;
|
||||
setPendingMode(mode);
|
||||
setPendingPlan(plan);
|
||||
} catch {
|
||||
if (
|
||||
alive.current &&
|
||||
modePlanOperation.current === operation &&
|
||||
setupStepRef.current === "mode"
|
||||
)
|
||||
setModeError("模式切换影响暂时无法读取,请重试。");
|
||||
} finally {
|
||||
if (alive.current && modePlanOperation.current === operation)
|
||||
setModePlanBusy(false);
|
||||
return await planMemoryMode(target);
|
||||
} catch (reason) {
|
||||
if (!memoryModePlanUnsupported(reason)) throw reason;
|
||||
const profiles = await getModelProfiles();
|
||||
return legacyMemoryModePlan(knownMode, target, {
|
||||
hasActiveModel: profiles.some((profile) => profile.is_active),
|
||||
});
|
||||
}
|
||||
},
|
||||
[completionBusy, knownMode, modePlanBusy, modeSaving],
|
||||
[knownMode],
|
||||
);
|
||||
|
||||
const saveModeChoice = useCallback(async () => {
|
||||
@@ -777,7 +736,7 @@ export function OnboardingFlow({
|
||||
if (modeChoice !== "lite") {
|
||||
const target = modeChoice;
|
||||
const [plan, profiles] = await Promise.all([
|
||||
planMemoryMode(target),
|
||||
loadModePlan(target),
|
||||
getModelProfiles(),
|
||||
]);
|
||||
if (!ownsModeOperation()) return;
|
||||
@@ -856,6 +815,14 @@ export function OnboardingFlow({
|
||||
ownsModeOperation() &&
|
||||
intentRef.current === "lite" &&
|
||||
setupStepRef.current === "mode";
|
||||
const plan = await loadModePlan("lite");
|
||||
if (!liteStillCurrent()) return;
|
||||
if (plan.blockers.length > 0) {
|
||||
setModeError(
|
||||
plan.blockers.map((blocker) => BLOCKER_COPY[blocker]).join(" "),
|
||||
);
|
||||
return;
|
||||
}
|
||||
const changed = await queueModeWrite("lite", liteStillCurrent);
|
||||
if (!liteStillCurrent()) return;
|
||||
commitConfirmedMemoryMode(changed.mode, modeTicket);
|
||||
@@ -890,6 +857,7 @@ export function OnboardingFlow({
|
||||
modeSaving,
|
||||
completionBusy,
|
||||
finishOnce,
|
||||
loadModePlan,
|
||||
queueModeWrite,
|
||||
queueProgressWrite,
|
||||
scheduleLoaded,
|
||||
@@ -947,7 +915,7 @@ export function OnboardingFlow({
|
||||
setModeError(null);
|
||||
const modeTicket = issueConfirmedModeTicket("onboarding");
|
||||
try {
|
||||
const plan = await planMemoryMode(target);
|
||||
const plan = await loadModePlan(target);
|
||||
if (!ownsConfirmation()) return;
|
||||
if (plan.blockers.length > 0) throw new Error(plan.blockers.join(","));
|
||||
const changed = await queueModeWrite(target, ownsConfirmation);
|
||||
@@ -994,6 +962,7 @@ export function OnboardingFlow({
|
||||
finishOnce,
|
||||
leave,
|
||||
leaveModelStep,
|
||||
loadModePlan,
|
||||
modeDestination,
|
||||
queueModeWrite,
|
||||
queueProgressWrite,
|
||||
@@ -1133,11 +1102,14 @@ export function OnboardingFlow({
|
||||
setAccepted(result);
|
||||
setStartingImport(null);
|
||||
setError(null);
|
||||
} catch {
|
||||
} catch (reason) {
|
||||
if (alive.current) {
|
||||
setStartingImport(null);
|
||||
const refused = isDefiniteAccessRefusal(reason);
|
||||
if (refused) setStartingImport(null);
|
||||
setError(
|
||||
"开始导入的结果尚未确认,选择已保留。可以重试,或进入应用页核对。",
|
||||
refused
|
||||
? "本次没有来源获准导入。请核对下方原因后重试,或到应用页查看状态。"
|
||||
: "开始导入的结果尚未确认,选择已保留。可以重试,或进入应用页核对。",
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
@@ -1249,126 +1221,94 @@ export function OnboardingFlow({
|
||||
/>
|
||||
</div>
|
||||
{setupStep === "mode" && (
|
||||
<>
|
||||
<R6ColdStartFrame
|
||||
step={3}
|
||||
title={text("选择记忆模式")}
|
||||
focusToken={modeFocusToken}
|
||||
footer={
|
||||
<R6Button
|
||||
className="onboarding-r6-submit"
|
||||
variant="primary"
|
||||
pending={modeSaving || modePlanBusy}
|
||||
disabled={
|
||||
!modeChoice ||
|
||||
completionBusy ||
|
||||
modePlanBusy ||
|
||||
(modeChoice === "ultra" && !scheduleLoaded)
|
||||
}
|
||||
onClick={() => void saveModeChoice()}
|
||||
>
|
||||
{text(
|
||||
modePhase === "saving"
|
||||
? "正在保存模式…"
|
||||
: modePhase === "completing"
|
||||
? "正在完成首次设置…"
|
||||
: modeChoice === "lite"
|
||||
? "使用 Lite 进入"
|
||||
: modeChoice === "pro"
|
||||
? "继续配置模型"
|
||||
: "继续",
|
||||
)}
|
||||
</R6Button>
|
||||
}
|
||||
>
|
||||
<section
|
||||
className="onboarding-r6-mode"
|
||||
aria-label={text("记忆模式")}
|
||||
<R6ColdStartFrame
|
||||
step={3}
|
||||
title={text("选择记忆模式")}
|
||||
focusToken={modeFocusToken}
|
||||
footer={
|
||||
<R6Button
|
||||
className="onboarding-r6-submit"
|
||||
variant="primary"
|
||||
pending={modeSaving}
|
||||
disabled={
|
||||
!modeChoice ||
|
||||
completionBusy ||
|
||||
(modeChoice === "ultra" && !scheduleLoaded)
|
||||
}
|
||||
onClick={() => void saveModeChoice()}
|
||||
>
|
||||
<MemoryModeChoiceList
|
||||
aria-label={text("记忆模式")}
|
||||
modes={(["lite", "pro", "ultra"] as const).map((mode) => ({
|
||||
mode,
|
||||
title: text(MODE_COPY[mode].title),
|
||||
description: text(MODE_COPY[mode].description),
|
||||
}))}
|
||||
selected={modeChoice}
|
||||
disabled={modeSaving || completionBusy || modePlanBusy}
|
||||
recommended={{ mode: "pro", badge: text("推荐") }}
|
||||
onChange={(mode, control) =>
|
||||
void requestModeSelection(
|
||||
mode as OnboardingMemoryMode,
|
||||
control,
|
||||
)
|
||||
}
|
||||
/>
|
||||
{modeChoice === "ultra" && scheduleLoaded ? (
|
||||
<section
|
||||
className="r6-evolve-settings onboarding-r6-evolve-settings"
|
||||
aria-label={text("记忆整合(Evolve)")}
|
||||
>
|
||||
<UltraEvolveScheduleFields
|
||||
schedule={ultraSchedule}
|
||||
disabled={modeSaving || !scheduleLoaded}
|
||||
onEnabledChange={(enabled) =>
|
||||
setUltraSchedule((current) => ({
|
||||
...current,
|
||||
enabled,
|
||||
}))
|
||||
}
|
||||
onTimeChange={async (time) => {
|
||||
setUltraSchedule((current) => ({ ...current, time }));
|
||||
return true;
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
) : null}
|
||||
{modeChoice === "ultra" && scheduleReadFailed ? (
|
||||
<div className="onboarding-r6-schedule-recovery">
|
||||
<p role="alert">
|
||||
{text("记忆模式状态暂时无法读取,请重试。")}
|
||||
</p>
|
||||
<R6Button
|
||||
className="onboarding-r6-schedule-retry"
|
||||
onClick={() => void refreshUltraSchedule()}
|
||||
>
|
||||
{text("重试")}
|
||||
</R6Button>
|
||||
</div>
|
||||
) : null}
|
||||
{(modeError || error) && (
|
||||
<p className="onboarding-r6-mode-error" role="alert">
|
||||
{text(modeError ?? error ?? "")}
|
||||
</p>
|
||||
{text(
|
||||
modePhase === "saving"
|
||||
? "正在保存模式…"
|
||||
: modePhase === "completing"
|
||||
? "正在完成首次设置…"
|
||||
: modeChoice === "lite"
|
||||
? "使用 Lite 进入"
|
||||
: modeChoice === "pro"
|
||||
? "继续配置模型"
|
||||
: "继续",
|
||||
)}
|
||||
</section>
|
||||
</R6ColdStartFrame>
|
||||
{pendingMode && pendingPlan ? (
|
||||
<MemoryModeConfirmDialog
|
||||
mode={pendingMode}
|
||||
plan={pendingPlan}
|
||||
busy={modePlanBusy}
|
||||
opener={modeDialogOpener.current}
|
||||
allowedBlockers={["active_model_required"]}
|
||||
onCancel={() => {
|
||||
modePlanOperation.current += 1;
|
||||
setModePlanBusy(false);
|
||||
setPendingMode(null);
|
||||
setPendingPlan(null);
|
||||
}}
|
||||
onConfirm={() => {
|
||||
modePlanOperation.current += 1;
|
||||
setModePlanBusy(false);
|
||||
</R6Button>
|
||||
}
|
||||
>
|
||||
<section
|
||||
className="onboarding-r6-mode"
|
||||
aria-label={text("记忆模式")}
|
||||
>
|
||||
<div className="onboarding-r6-mode-intro">
|
||||
<h2>
|
||||
{locale === "zh-Hans"
|
||||
? "Choose how MemHub remembers"
|
||||
: text("你希望 MemHub 如何形成记忆?")}
|
||||
</h2>
|
||||
<p>{text("需要明确选择一种方式;之后仍可在设置中更改。")}</p>
|
||||
</div>
|
||||
<MemoryModeCards
|
||||
aria-label={text("记忆模式")}
|
||||
value={modeChoice}
|
||||
disabled={modeSaving || completionBusy}
|
||||
onChange={(mode) => {
|
||||
modeChoiceTouched.current = true;
|
||||
intentRef.current = pendingMode;
|
||||
setModeChoice(pendingMode);
|
||||
intentRef.current = mode;
|
||||
setModeChoice(mode);
|
||||
setModeError(null);
|
||||
setPendingMode(null);
|
||||
setPendingPlan(null);
|
||||
}}
|
||||
ultraDetail={
|
||||
scheduleLoaded ? (
|
||||
<div className="onboarding-r6-ultra-default">
|
||||
<strong>{text("每天自动整合")}</strong>
|
||||
<small>
|
||||
{text(
|
||||
ultraSchedule.enabled
|
||||
? "每天 {time} 左右自动整合,使用这台设备的本地时间;休眠错过后会补跑。"
|
||||
: "已关闭。重新开启后仍按 {time} 运行;已生成的结果会保留。",
|
||||
).replace("{time}", ultraSchedule.time)}
|
||||
</small>
|
||||
</div>
|
||||
) : scheduleReadFailed ? (
|
||||
<div className="onboarding-r6-schedule-recovery">
|
||||
<p role="alert">
|
||||
{text("记忆模式状态暂时无法读取,请重试。")}
|
||||
</p>
|
||||
<R6Button
|
||||
className="onboarding-r6-schedule-retry"
|
||||
onClick={() => void refreshUltraSchedule()}
|
||||
>
|
||||
{text("重试")}
|
||||
</R6Button>
|
||||
</div>
|
||||
) : (
|
||||
<p>{text("正在读取自动整合设置…")}</p>
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
{(modeError || error) && (
|
||||
<p className="onboarding-r6-mode-error" role="alert">
|
||||
{text(modeError ?? error ?? "")}
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
</R6ColdStartFrame>
|
||||
)}
|
||||
{visitedModel && (
|
||||
<div hidden={setupStep !== "model"}>
|
||||
|
||||
@@ -9,7 +9,7 @@ function declaration(file: string, selector: string): string {
|
||||
|
||||
it("fills settings controls without widening shared fallback controls", () => {
|
||||
for (const selector of [
|
||||
".r6-memory-mode-settings .memory-mode-choice-list",
|
||||
".r6-memory-mode-settings .memory-mode-cards",
|
||||
".r6-settings .connection-fallback .custom-harness-name",
|
||||
]) {
|
||||
const rule = declaration("r6-settings.css", selector);
|
||||
|
||||
@@ -29,6 +29,8 @@ it("shows every role and preserves a long original message in the detail pane",
|
||||
messages: [
|
||||
{ role: "user", content: long },
|
||||
{ role: "assistant", content: "已收到" },
|
||||
{ role: "tool", content: "3 tests passed" },
|
||||
{ role: "unknown", content: "来源角色缺失" },
|
||||
],
|
||||
}}
|
||||
sources={[]}
|
||||
@@ -38,6 +40,10 @@ it("shows every role and preserves a long original message in the detail pane",
|
||||
|
||||
expect(screen.getByText("你")).toBeTruthy();
|
||||
expect(screen.getByText("助手")).toBeTruthy();
|
||||
expect(screen.getByText("工具")).toBeTruthy();
|
||||
expect(screen.getByText("作者待核对")).toBeTruthy();
|
||||
expect(screen.getByText(long)).toHaveProperty("textContent", long);
|
||||
expect(screen.getByText("已收到")).toBeTruthy();
|
||||
expect(screen.queryByText("原始对话")).toBeNull();
|
||||
expect(screen.getByRole("article", { name: "原始对话" })).toBeTruthy();
|
||||
});
|
||||
@@ -14,6 +14,7 @@ function authorLabel(role: string, t: ReturnType<typeof useGuiLanguage>["t"]) {
|
||||
if (role === "user") return t("selectedMemory.author.user");
|
||||
if (role === "assistant" || role === "agent")
|
||||
return t("selectedMemory.author.agent");
|
||||
if (role === "tool") return t("selectedMemory.author.tool");
|
||||
return t("selectedMemory.author.unknown");
|
||||
}
|
||||
|
||||
@@ -46,8 +47,7 @@ export function SelectedRawDetail({
|
||||
record.source || t("selectedMemory.sourceUnknown"),
|
||||
);
|
||||
return (
|
||||
<article className="map-dialogue-reading">
|
||||
<p className="selected-memory-status">{t("memory:原始对话")}</p>
|
||||
<article className="map-dialogue-reading" aria-label={t("memory:原始对话")}>
|
||||
<ul className="map-transcript">
|
||||
{messages.map((message) => (
|
||||
<li key={`${rawRecordId(record)}:${message.role}:${message.content}`}>
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
min-height: 129px;
|
||||
}
|
||||
.r6-home-metrics > div {
|
||||
display: grid;
|
||||
grid-template-rows: 20px 72px minmax(20px, auto);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
padding: 4px 24px;
|
||||
border-right: 1px solid #d5dfe8;
|
||||
@@ -89,12 +92,16 @@
|
||||
.r6-home-metrics p,
|
||||
.r6-home-metrics small {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: #63707b;
|
||||
margin: 0;
|
||||
}
|
||||
.r6-home-metrics small {
|
||||
display: block;
|
||||
}
|
||||
.r6-home-figure {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -102,12 +109,10 @@
|
||||
font-style: normal;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
padding-bottom: 10px;
|
||||
color: #405e75;
|
||||
}
|
||||
/* Holds the digit slot while the first summary read is in flight, so the 48px
|
||||
type does not spend that frame rendering a word. Height matches the strong
|
||||
below (48px x 1.3). */
|
||||
type does not spend that frame rendering a word. */
|
||||
.r6-home-figure-pending {
|
||||
display: block;
|
||||
width: 92px;
|
||||
@@ -134,22 +139,22 @@
|
||||
animation: none;
|
||||
}
|
||||
.r6-home-metrics strong {
|
||||
display: block;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 48px;
|
||||
font-weight: 400;
|
||||
line-height: 1.3;
|
||||
line-height: 1;
|
||||
color: #405e75;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.r6-home-metrics strong.r6-home-word {
|
||||
font-size: 32px;
|
||||
padding: 14px 0;
|
||||
line-height: 1.25;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.r6-home-metrics strong.r6-home-time {
|
||||
font-size: 34px;
|
||||
line-height: 1.85;
|
||||
padding: 8px 0;
|
||||
line-height: 1.25;
|
||||
}
|
||||
.r6-home-activity {
|
||||
margin-top: auto;
|
||||
@@ -281,7 +286,10 @@
|
||||
white-space: normal;
|
||||
}
|
||||
.r6-home-activity small {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
color: #637786;
|
||||
}
|
||||
.r6-home-runtime {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
/* 143:2419/2502/2594/2685: only step2; shared frame/progress are owned elsewhere. */
|
||||
.first-import-r6-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 738px) 278px;
|
||||
gap: 30px;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
align-items: stretch;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.first-import-r6-main {
|
||||
min-width: 0;
|
||||
@@ -13,6 +12,22 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.first-import-r6-intro {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
.first-import-r6-intro h2 {
|
||||
margin: 0 0 3px;
|
||||
color: #262a2e;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 26px;
|
||||
}
|
||||
.first-import-r6-intro p {
|
||||
margin: 0;
|
||||
color: #63707b;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.first-import-r6-history-window {
|
||||
margin: 0 0 12px;
|
||||
padding: 8px 10px;
|
||||
@@ -25,6 +40,101 @@
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress {
|
||||
flex: 0 0 auto;
|
||||
width: 100%;
|
||||
margin-inline: auto;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress[data-count="1"] {
|
||||
width: min(680px, 100%);
|
||||
grid-auto-columns: 100%;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress[data-count="2"] {
|
||||
width: min(720px, 100%);
|
||||
grid-auto-columns: calc((100% - 16px) / 2);
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress .r6-import-progress-card {
|
||||
min-height: 112px;
|
||||
padding: 12px 18px;
|
||||
display: grid;
|
||||
grid-template-columns: 82px minmax(0, 1fr);
|
||||
grid-template-rows: auto auto auto;
|
||||
align-content: center;
|
||||
column-gap: 16px;
|
||||
text-align: left;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress .r6-import-progress-orbit {
|
||||
width: 76px;
|
||||
height: 76px;
|
||||
grid-column: 1;
|
||||
grid-row: 1 / 4;
|
||||
margin: 0;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress :is(h2, p, small) {
|
||||
grid-column: 2;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress .r6-import-progress-card h2 {
|
||||
align-self: end;
|
||||
}
|
||||
.first-import-r6-main > .r6-import-progress[data-count="many"] {
|
||||
grid-auto-flow: row;
|
||||
grid-auto-columns: unset;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:not(:has(> :nth-child(4))) {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(4)):not(
|
||||
:has(> :nth-child(5))
|
||||
) {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(5)):not(
|
||||
:has(> :nth-child(6))
|
||||
) {
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(6)):not(
|
||||
:has(> :nth-child(7))
|
||||
) {
|
||||
grid-template-columns: repeat(6, minmax(0, 1fr));
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(7)) {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(4))
|
||||
.r6-import-progress-card {
|
||||
min-height: 112px;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
justify-items: center;
|
||||
gap: 1px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(4))
|
||||
.r6-import-progress-orbit {
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
grid-column: 1;
|
||||
grid-row: auto;
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(4))
|
||||
:is(h2, p, small) {
|
||||
grid-column: 1;
|
||||
align-self: auto;
|
||||
margin-top: 1px;
|
||||
}
|
||||
.first-import-r6-main
|
||||
> .r6-import-progress[data-count="many"]:has(> :nth-child(4))
|
||||
.r6-import-progress-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
}
|
||||
.first-import-r6-feed {
|
||||
flex: 0 0 auto;
|
||||
@@ -76,9 +186,14 @@
|
||||
margin: 0;
|
||||
}
|
||||
.first-import-r6-options {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
padding: 24px;
|
||||
min-height: 132px;
|
||||
padding: 22px 24px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(190px, 0.7fr) minmax(0, 1.3fr);
|
||||
align-items: center;
|
||||
gap: 0 28px;
|
||||
border: 1px solid #ffffffe0;
|
||||
border-radius: 22px;
|
||||
background:
|
||||
@@ -87,11 +202,14 @@
|
||||
box-shadow:
|
||||
inset 0 1px #fff,
|
||||
0 12px 32px rgb(49 75 101 / 4%);
|
||||
overflow: auto;
|
||||
overflow: visible;
|
||||
scrollbar-width: thin;
|
||||
overscroll-behavior: contain;
|
||||
align-self: stretch;
|
||||
}
|
||||
.first-import-r6-options-head {
|
||||
min-width: 0;
|
||||
}
|
||||
.first-import-r6-eyebrow {
|
||||
margin: 0 0 14px;
|
||||
font-size: 12px;
|
||||
@@ -117,12 +235,12 @@
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 124px;
|
||||
margin: 0 0 16px;
|
||||
padding: 18px 16px 12px;
|
||||
min-height: 104px;
|
||||
margin: 0;
|
||||
padding: 18px 52px 16px 18px;
|
||||
border: 1px solid rgb(179 196 209 / 42%);
|
||||
border-radius: 0;
|
||||
background: rgb(255 255 255 / 10%);
|
||||
border-radius: 12px;
|
||||
background: rgb(255 255 255 / 34%);
|
||||
box-shadow: inset 0 1px 1px #ffffffd9;
|
||||
backdrop-filter: blur(20px);
|
||||
cursor: pointer;
|
||||
@@ -151,8 +269,8 @@
|
||||
.first-import-r6-selection input {
|
||||
appearance: none;
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
right: 18px;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
min-height: 16px;
|
||||
@@ -190,10 +308,11 @@
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
margin-top: 8px;
|
||||
margin-top: 7px;
|
||||
color: #5e6e7a;
|
||||
}
|
||||
.first-import-r6-options-note {
|
||||
grid-column: 1 / -1;
|
||||
font-size: 11px;
|
||||
line-height: 22px;
|
||||
margin: 0 0 12px;
|
||||
@@ -390,8 +509,7 @@ dialog.first-import-r6-original[open] {
|
||||
}
|
||||
@media (max-width: 1150px) {
|
||||
.first-import-r6-layout {
|
||||
grid-template-columns: minmax(0, 1fr) 278px;
|
||||
gap: 24px;
|
||||
gap: 18px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 761px) and (max-height: 959px) {
|
||||
@@ -401,12 +519,12 @@ dialog.first-import-r6-original[open] {
|
||||
padding-bottom: 16px;
|
||||
}
|
||||
.first-import-r6-layout {
|
||||
height: auto;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@media (min-width: 761px) and (max-height: 859px) {
|
||||
.first-import-r6-options {
|
||||
padding: 14px;
|
||||
padding: 18px 20px;
|
||||
overflow: visible;
|
||||
}
|
||||
.first-import-r6-eyebrow {
|
||||
@@ -424,16 +542,16 @@ dialog.first-import-r6-original[open] {
|
||||
}
|
||||
.first-import-r6-selection,
|
||||
.first-import-r6-selection + .first-import-r6-selection {
|
||||
min-height: 86px;
|
||||
margin-bottom: 8px;
|
||||
padding: 9px 12px;
|
||||
min-height: 96px;
|
||||
margin-bottom: 0;
|
||||
padding: 15px 48px 13px 16px;
|
||||
}
|
||||
.first-import-r6-selection strong {
|
||||
line-height: 24px;
|
||||
}
|
||||
.first-import-r6-selection input {
|
||||
top: 13px;
|
||||
right: 12px;
|
||||
top: 17px;
|
||||
right: 16px;
|
||||
}
|
||||
.first-import-r6-selection span {
|
||||
margin-top: 4px;
|
||||
@@ -454,6 +572,7 @@ dialog.first-import-r6-original[open] {
|
||||
overflow: visible;
|
||||
}
|
||||
.first-import-r6-options {
|
||||
display: block;
|
||||
overflow: visible;
|
||||
}
|
||||
.first-import-r6-footer-note {
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
.memory-mode-cards {
|
||||
min-width: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.memory-mode-card {
|
||||
min-width: 0;
|
||||
min-height: 286px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid #c7d3dc;
|
||||
border-radius: 15px;
|
||||
background: rgb(255 255 255 / 66%);
|
||||
color: #304757;
|
||||
box-shadow: inset 0 1px rgb(255 255 255 / 82%);
|
||||
transition:
|
||||
border-color 140ms ease-out,
|
||||
background-color 140ms ease-out,
|
||||
box-shadow 140ms ease-out,
|
||||
transform 140ms ease-out;
|
||||
}
|
||||
|
||||
.memory-mode-card:has(.memory-mode-card-choice:hover):not(
|
||||
[data-disabled="true"]
|
||||
) {
|
||||
border-color: #91a7b6;
|
||||
background: rgb(255 255 255 / 82%);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.memory-mode-card[data-selected="true"] {
|
||||
border: 2px solid #6f9183;
|
||||
background: #fbfdfc;
|
||||
box-shadow: 0 10px 26px rgb(47 107 87 / 8%);
|
||||
}
|
||||
|
||||
.memory-mode-card[data-disabled="true"] {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
.memory-mode-card-choice {
|
||||
min-height: 284px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.memory-mode-card[data-disabled="true"] .memory-mode-card-choice {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.memory-mode-card-choice > input {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.memory-mode-card:has(input:focus-visible) {
|
||||
outline: 2px solid var(--r6-focus, #557c93);
|
||||
outline-offset: 3px;
|
||||
}
|
||||
|
||||
.memory-mode-title {
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.memory-mode-index {
|
||||
flex: 0 0 auto;
|
||||
color: var(--ok, #2f6b57);
|
||||
font-size: 11px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
.memory-mode-title strong {
|
||||
min-width: 0;
|
||||
color: #263947;
|
||||
font-size: 19px;
|
||||
font-weight: 600;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
.memory-mode-tier {
|
||||
flex: 0 0 auto;
|
||||
color: var(--ok, #2f6b57);
|
||||
font-size: 11px;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.memory-mode-current {
|
||||
flex: 0 0 auto;
|
||||
padding: 1px 6px;
|
||||
border-radius: 999px;
|
||||
color: #526a60;
|
||||
background: #edf4f0;
|
||||
font-size: 10px;
|
||||
line-height: 17px;
|
||||
}
|
||||
|
||||
.memory-mode-radio {
|
||||
width: 21px;
|
||||
height: 21px;
|
||||
margin-left: auto;
|
||||
flex: 0 0 21px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: 1px solid #8da0ae;
|
||||
border-radius: 6px;
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 82%);
|
||||
}
|
||||
|
||||
.memory-mode-card[data-selected="true"] .memory-mode-radio {
|
||||
border-color: var(--ok, #2f6b57);
|
||||
background: var(--ok, #2f6b57);
|
||||
}
|
||||
|
||||
.memory-mode-radio svg {
|
||||
stroke: #fff;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.memory-mode-description {
|
||||
min-height: 50px;
|
||||
margin-top: 10px;
|
||||
color: #526674;
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
.memory-mode-features {
|
||||
margin-top: auto;
|
||||
padding: 16px 0 2px;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
border-top: 1px solid #dbe4ea;
|
||||
color: #5e6e7a;
|
||||
font-size: 12px;
|
||||
line-height: 19px;
|
||||
}
|
||||
|
||||
.memory-mode-features > span {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.memory-mode-features i {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
margin-top: 7px;
|
||||
flex: 0 0 5px;
|
||||
border-radius: 50%;
|
||||
background: #7f95a4;
|
||||
}
|
||||
|
||||
.memory-mode-detail {
|
||||
margin-top: auto;
|
||||
padding: 14px 18px;
|
||||
border-top: 1px solid #d4e0e7;
|
||||
background: #f1f6f8;
|
||||
color: #405867;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
animation: memory-mode-detail-in 180ms ease-out both;
|
||||
}
|
||||
|
||||
@keyframes memory-mode-detail-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-4px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 681px) and (max-height: 959px) {
|
||||
.memory-mode-cards {
|
||||
gap: 14px;
|
||||
}
|
||||
.memory-mode-card {
|
||||
min-height: 194px;
|
||||
}
|
||||
.memory-mode-card-choice {
|
||||
min-height: 194px;
|
||||
padding: 16px;
|
||||
}
|
||||
.memory-mode-title strong {
|
||||
font-size: 17px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.memory-mode-description {
|
||||
min-height: 36px;
|
||||
margin-top: 8px;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.memory-mode-features {
|
||||
padding-top: 10px;
|
||||
gap: 6px;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.memory-mode-detail {
|
||||
padding: 10px 14px;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 680px) {
|
||||
.memory-mode-cards {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.memory-mode-card,
|
||||
.memory-mode-card-choice {
|
||||
min-height: 0;
|
||||
}
|
||||
.memory-mode-description {
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.memory-mode-card,
|
||||
.memory-mode-detail {
|
||||
animation: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,7 @@
|
||||
}
|
||||
.onboarding-model-layout {
|
||||
display: block;
|
||||
width: min(760px, 100%);
|
||||
width: min(880px, 100%);
|
||||
height: auto;
|
||||
margin-inline: auto;
|
||||
}
|
||||
@@ -603,11 +603,13 @@
|
||||
}
|
||||
.onboarding-model-group {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
padding: 24px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 18px 20px;
|
||||
padding: 24px 26px;
|
||||
border: 1px solid #d8e2e8;
|
||||
border-radius: 14px;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
background: rgb(255 255 255 / 72%);
|
||||
box-shadow: inset 0 1px rgb(255 255 255 / 88%);
|
||||
}
|
||||
.onboarding-model-provider,
|
||||
.onboarding-model-key {
|
||||
@@ -639,6 +641,7 @@
|
||||
line-height: 19px;
|
||||
}
|
||||
.onboarding-model-default-summary {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
padding: 14px 0;
|
||||
@@ -656,10 +659,12 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
.onboarding-model-disclosure {
|
||||
grid-column: 1 / -1;
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
.generation-technical-disclosure {
|
||||
grid-column: 1 / -1;
|
||||
border-top: 1px solid #e4eaee;
|
||||
padding-top: 4px;
|
||||
}
|
||||
@@ -750,8 +755,27 @@
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
@media (min-width: 761px) and (max-height: 959px) {
|
||||
.onboarding-model-r6 .onboarding-r6-body {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.onboarding-model-layout,
|
||||
.onboarding-model-form {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
.onboarding-model-form {
|
||||
overflow-y: auto;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
.onboarding-model-group {
|
||||
gap: 14px 18px;
|
||||
padding: 18px 22px;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.onboarding-model-layout--single-column-600 .onboarding-model-group {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
padding: 16px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@@ -225,6 +225,22 @@
|
||||
overscroll-behavior: contain;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
.onboarding-r6-body:has(> .onboarding-r6-mode) {
|
||||
padding-block: 14px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.onboarding-r6-mode {
|
||||
width: 100%;
|
||||
gap: 12px;
|
||||
}
|
||||
.onboarding-r6-mode-intro h2 {
|
||||
font-size: 20px;
|
||||
line-height: 28px;
|
||||
}
|
||||
.onboarding-r6-mode-intro p {
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
.onboarding-r6-discovery {
|
||||
height: 100%;
|
||||
@@ -541,41 +557,36 @@
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
gap: 16px;
|
||||
}
|
||||
.onboarding-r6-mode-intro {
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
}
|
||||
.onboarding-r6-mode-intro h2 {
|
||||
margin: 0;
|
||||
color: #263947;
|
||||
font-size: 22px;
|
||||
line-height: 32px;
|
||||
}
|
||||
.onboarding-r6-mode-intro p {
|
||||
margin: 0;
|
||||
margin: 4px 0 0;
|
||||
color: #637381;
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.onboarding-r6-mode .memory-mode-choice-list {
|
||||
background: rgb(255 255 255 / 72%);
|
||||
.onboarding-r6-ultra-default {
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
}
|
||||
.onboarding-r6-mode .memory-mode-choice {
|
||||
min-height: 82px;
|
||||
padding: 15px 18px;
|
||||
}
|
||||
.onboarding-r6-mode .memory-mode-choice-copy {
|
||||
gap: 4px;
|
||||
}
|
||||
.onboarding-r6-mode .memory-mode-choice-copy strong {
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.onboarding-r6-mode .memory-mode-choice-copy small {
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.onboarding-r6-mode-ultra-note {
|
||||
margin: -6px 0 0;
|
||||
color: #637381;
|
||||
.onboarding-r6-ultra-default strong {
|
||||
color: #304757;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
.onboarding-r6-ultra-default small {
|
||||
color: #607482;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
}
|
||||
.onboarding-r6-evolve-settings {
|
||||
margin-top: 0;
|
||||
|
||||
@@ -227,10 +227,27 @@
|
||||
font-size: 13px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.r6-memory-mode-settings .memory-mode-choice-list {
|
||||
.r6-memory-mode-settings .memory-mode-cards {
|
||||
width: 100%;
|
||||
max-width: none;
|
||||
}
|
||||
.r6-memory-mode-settings
|
||||
.memory-mode-card[data-mode="ultra"][data-selected="true"] {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.r6-memory-mode-settings
|
||||
.memory-mode-card[data-mode="ultra"][data-selected="true"]
|
||||
.memory-mode-card-choice {
|
||||
min-height: 180px;
|
||||
}
|
||||
.r6-evolve-settings--in-card {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
.r6-evolve-settings--in-card .r6-evolve-setting:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
.r6-settings-note {
|
||||
margin: 14px 0 0;
|
||||
padding: 10px 12px;
|
||||
|
||||
@@ -129,7 +129,7 @@ function ColdIntentHarness() {
|
||||
}
|
||||
|
||||
describe("useImportSources", () => {
|
||||
it("queries an uncertain cold-start intent before trying another write", async () => {
|
||||
it("recovers an uncertain cold-start write from its durable receipt immediately", async () => {
|
||||
connectSources.mockRejectedValueOnce(new Error("response lost"));
|
||||
getSourceConnection.mockImplementation(async (requestId: string) => ({
|
||||
request_id: requestId,
|
||||
@@ -142,11 +142,11 @@ describe("useImportSources", () => {
|
||||
const button = screen.getByRole("button", { name: "start cold import" });
|
||||
await waitFor(() => expect(button).toHaveProperty("disabled", false));
|
||||
await userEvent.click(button);
|
||||
await userEvent.click(button);
|
||||
expect(connectSources).toHaveBeenCalledTimes(1);
|
||||
await waitFor(() => expect(getSourceConnection).toHaveBeenCalledOnce());
|
||||
const sent = connectSources.mock.calls[0][2];
|
||||
expect(sent.sourceRoots).toEqual({ cursor: "root:v2:fixture" });
|
||||
expect(getSourceConnection).toHaveBeenCalledWith(sent.requestId);
|
||||
expect(connectSources).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
it("translates a source error code without exposing a generic HTTP failure", async () => {
|
||||
const reason = Object.assign(
|
||||
@@ -434,6 +434,7 @@ describe("useImportSources", () => {
|
||||
expect(stored).not.toContain("authorized");
|
||||
expect(stored).not.toContain("~/.fixture");
|
||||
first.unmount();
|
||||
getSourceConnection.mockClear();
|
||||
getHealth.mockResolvedValue(health(instance));
|
||||
getSourceConnection.mockResolvedValue(receipt(requestId, ["ok"]));
|
||||
const next = await controller();
|
||||
@@ -639,7 +640,9 @@ describe("useImportSources", () => {
|
||||
let currentSource = { ...source("ok"), grant_revision: 1 };
|
||||
const saved = new Map<string, ConnectSourcesResponse>();
|
||||
getSources.mockImplementation(async () => [currentSource]);
|
||||
getSourceConnection.mockImplementation(async (id: string) => saved.get(id));
|
||||
getSourceConnection
|
||||
.mockRejectedValueOnce(new Error("receipt temporarily offline"))
|
||||
.mockImplementation(async (id: string) => saved.get(id));
|
||||
connectSources.mockImplementation(async (ids: string[], _, options) => {
|
||||
saved.set(options.requestId, receipt(options.requestId, ids));
|
||||
currentSource = { ...currentSource, authorized: true, grant_revision: 2 };
|
||||
@@ -854,6 +857,7 @@ describe("useImportSources", () => {
|
||||
|
||||
it("recovers an uncertain failed-only retry after remount without replaying accepted sources", async () => {
|
||||
const saved = new Map<string, ConnectSourcesResponse>();
|
||||
let loseRetryReceiptOnce = true;
|
||||
connectSources.mockImplementation(async (ids: string[], _, options) => {
|
||||
const response =
|
||||
ids.length === 2
|
||||
@@ -863,7 +867,17 @@ describe("useImportSources", () => {
|
||||
if (ids.length === 1) throw new Error("retry response lost");
|
||||
return response;
|
||||
});
|
||||
getSourceConnection.mockImplementation(async (id: string) => saved.get(id));
|
||||
getSourceConnection.mockImplementation(async (id: string) => {
|
||||
const known = saved.get(id);
|
||||
if (
|
||||
loseRetryReceiptOnce &&
|
||||
known?.accepted_source_ids.includes("failed")
|
||||
) {
|
||||
loseRetryReceiptOnce = false;
|
||||
throw new Error("retry receipt temporarily offline");
|
||||
}
|
||||
return known;
|
||||
});
|
||||
const first = await controller();
|
||||
const snapshot = [source("ok"), source("failed")];
|
||||
await act(async () => {
|
||||
|
||||
@@ -159,39 +159,53 @@ export function useImportSources(_options: { automaticSync?: boolean } = {}) {
|
||||
});
|
||||
}
|
||||
submitted = true;
|
||||
const result = await connectSourceSet([
|
||||
[...ids],
|
||||
true,
|
||||
{
|
||||
fullRescan: checked.onboarding,
|
||||
onboarding: checked.onboarding,
|
||||
enableSync: true,
|
||||
requestId: id,
|
||||
...(traceId ? { traceId } : {}),
|
||||
...(checked.importUploadId === undefined
|
||||
? {}
|
||||
: { importUploadId: checked.importUploadId }),
|
||||
sourceRoots: Object.fromEntries(
|
||||
checked.sources
|
||||
.filter((source) => ids.includes(source.source_id))
|
||||
.map((source) => [source.source_id, source.candidate_root_id]),
|
||||
),
|
||||
...(checked.sources.some(
|
||||
(source) => (source.candidate_revision ?? 0) > 0,
|
||||
)
|
||||
? {
|
||||
sourceCandidateRevisions: Object.fromEntries(
|
||||
checked.sources
|
||||
.filter((source) => ids.includes(source.source_id))
|
||||
.map((source) => [
|
||||
source.source_id,
|
||||
source.candidate_revision ?? 0,
|
||||
]),
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
]);
|
||||
let result: ConnectSourcesResponse;
|
||||
try {
|
||||
result = await connectSourceSet([
|
||||
[...ids],
|
||||
true,
|
||||
{
|
||||
fullRescan: checked.onboarding,
|
||||
onboarding: checked.onboarding,
|
||||
enableSync: true,
|
||||
requestId: id,
|
||||
...(traceId ? { traceId } : {}),
|
||||
...(checked.importUploadId === undefined
|
||||
? {}
|
||||
: { importUploadId: checked.importUploadId }),
|
||||
sourceRoots: Object.fromEntries(
|
||||
checked.sources
|
||||
.filter((source) => ids.includes(source.source_id))
|
||||
.map((source) => [source.source_id, source.candidate_root_id]),
|
||||
),
|
||||
...(checked.sources.some(
|
||||
(source) => (source.candidate_revision ?? 0) > 0,
|
||||
)
|
||||
? {
|
||||
sourceCandidateRevisions: Object.fromEntries(
|
||||
checked.sources
|
||||
.filter((source) => ids.includes(source.source_id))
|
||||
.map((source) => [
|
||||
source.source_id,
|
||||
source.candidate_revision ?? 0,
|
||||
]),
|
||||
),
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
]);
|
||||
} catch (reason) {
|
||||
// Core persists the idempotent receipt before it finishes activating
|
||||
// every source lane. A large cold start can therefore commit and keep
|
||||
// working after the POST's 30s transport deadline. Read the receipt
|
||||
// before surfacing an unknown result; never replay the write here.
|
||||
if (isDefiniteAccessRefusal(reason)) throw reason;
|
||||
try {
|
||||
result = await getSourceConnection(id);
|
||||
} catch {
|
||||
throw reason;
|
||||
}
|
||||
}
|
||||
assertConnectionReceipt(result, id, ids);
|
||||
liveRequests.current.set(id, {
|
||||
instanceId: fresh.instance_id,
|
||||
|
||||
@@ -139,6 +139,14 @@ This exception does not extend to VDB, Coding, prompt, reconcile, or lifecycle.
|
||||
- 旧用户迁移:由 App 在可见的启动 loading 阶段统一执行;此时 Core 尚未对外提供产品读写。所有已发布版本都先经 SDK 写入,Governance/Evidence 只是镜像,所以迁移**不复制任何 memory 或 raw**:创建并校验完整 bundle、让写入队列脱离旧表、把旧版命名的 SDK 向量集合接回当前名字、用 Runtime 同样配置的公开 SDK client 按 ID 回读核对,通过后才提交 marker、删除旧表。由一个 Core 命令 `sdk-migrate` 完成;Desktop 启动与 CLI `memhub install`/`upgrade`(macOS、Linux)在启动新 Runtime 前调用它,普通用户不需要另跑命令。App 不得在 migration `deferred` 状态继续启动 Runtime。
|
||||
- 迁移期间宿主 capture hook 由 Desktop 活跃 PID marker 静默挡住,不再追加
|
||||
Evidence;cutover 后先从宿主 History checkpoint 补齐遗漏 turn,再恢复 live sync。
|
||||
- 宿主 capture hook(`one-memory capture <host>`)是短命的独立进程,**不打开主库**:
|
||||
它只读 runtime receipt 与 runtime token,把 hook JSON 经 loopback
|
||||
`POST /api/v1/live-capture/{source}` 交给正在运行的 Core,超时或 Core 未运行即静默丢弃,
|
||||
不回退本地写;迁移 fence 仍在 hook 侧检查。Core 在进程内套用其余的门(grant、sync、
|
||||
拒绝计数、自动化会话、cursor/claude 去重),再按 live file sync 的同一路径
|
||||
(`materialize_write_input` → `stage_sdk_input` → `finalize_sdk_file`,live 优先级)
|
||||
经单一 writer 入队。live sync 已读取其宿主文件的来源,hook 内容交给文件路径,
|
||||
同一 turn 只进 SDK 一次;只有没有文件轮询的来源才从 hook 入队。
|
||||
- Matter 若未来重新开发,需以新的 SDK-native 合同重新设计,不继承当前占位 schema。
|
||||
|
||||
Pinned SDK 版本见发布锁文件 / `MEMORY.md`(随发布更新)。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# MemHub 安装与发行
|
||||
|
||||
MemHub `v1.0.6`(build 41)的发行目标如下:
|
||||
MemHub `v1.0.6`(build 43)的发行目标如下:
|
||||
|
||||
| 平台 | 发行物 | 构建与验收 |
|
||||
| --- | --- | --- |
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "one-memory",
|
||||
"version": "1.0.6",
|
||||
"release": {
|
||||
"build_number": 41,
|
||||
"build_number": 43,
|
||||
"macos_min_version": "13.0",
|
||||
"app_update": "manual",
|
||||
"runtime_manifest_schema": 1,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/** Register `capture` on the hosts whose one-click install can own a hook file.
|
||||
*
|
||||
* The command is the packaged core binary. It reads the hook's JSON on stdin
|
||||
* and writes visible text into Evidence. Stdout stays empty, so the host does
|
||||
* not treat the capture as another instruction.
|
||||
* and hands it to the running Core over loopback; it never opens the
|
||||
* database, and drops the turn when Core is not running. Stdout stays empty,
|
||||
* so the host does not treat the capture as another instruction.
|
||||
*
|
||||
* WorkBuddy's command lives in its plugin tree. Hermes and OpenClaw deliver
|
||||
* the turn through a single memory-provider slot; those are not written here,
|
||||
|
||||
@@ -271,6 +271,87 @@ it("reads Core's SDK context directly and passes native fields unchanged", async
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["omitted", raw],
|
||||
["null", { ...raw, turn_id: null, turn_index: null, turn_count: null }],
|
||||
[
|
||||
"minimum populated",
|
||||
{
|
||||
...raw,
|
||||
turn_id: "t",
|
||||
turn_index: 0,
|
||||
turn_count: 1,
|
||||
},
|
||||
],
|
||||
[
|
||||
"maximum populated",
|
||||
{
|
||||
...raw,
|
||||
turn_id: "t".repeat(96),
|
||||
turn_index: Number.MAX_SAFE_INTEGER,
|
||||
turn_count: Number.MAX_SAFE_INTEGER,
|
||||
},
|
||||
],
|
||||
])("passes through %s optional raw turn metadata", async (_name, item) => {
|
||||
const f = await fixture();
|
||||
const response = receiptFor([item]);
|
||||
f.respond(response);
|
||||
|
||||
const result = await f.post();
|
||||
|
||||
expect(result.status).toBe(200);
|
||||
expect(result.data).toEqual(response);
|
||||
expect(f.diagnostics).not.toContainEqual(
|
||||
expect.objectContaining({ event: "context.response_invalid" }),
|
||||
);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["empty turn_id", { turn_id: "" }],
|
||||
["overlong turn_id", { turn_id: "t".repeat(97) }],
|
||||
["non-string turn_id", { turn_id: 1 }],
|
||||
["negative turn_index", { turn_index: -1 }],
|
||||
["fractional turn_index", { turn_index: 0.5 }],
|
||||
["non-number turn_index", { turn_index: "0" }],
|
||||
["unsafe turn_index", { turn_index: 2 ** 53 }],
|
||||
["zero turn_count", { turn_count: 0 }],
|
||||
["negative turn_count", { turn_count: -1 }],
|
||||
["fractional turn_count", { turn_count: 1.5 }],
|
||||
["non-number turn_count", { turn_count: "1" }],
|
||||
["unsafe turn_count", { turn_count: 2 ** 53 }],
|
||||
["unknown field", { revision: 1 }],
|
||||
])("rejects raw context with %s", async (_name, fields) => {
|
||||
const f = await fixture();
|
||||
f.respond(receiptFor([{ ...raw, content: "private turn", ...fields }]));
|
||||
|
||||
const result = await f.post();
|
||||
|
||||
expect(result.status).toBe(502);
|
||||
expect(result.data).toEqual({ error: "context_unavailable" });
|
||||
expect(f.diagnostics).toContainEqual(
|
||||
expect.objectContaining({
|
||||
event: "context.response_invalid",
|
||||
error_code: "invalid_context_response",
|
||||
details: { reason: "response" },
|
||||
}),
|
||||
);
|
||||
expect(JSON.stringify(f.diagnostics)).not.toContain("private turn");
|
||||
});
|
||||
|
||||
it("rejects raw turn metadata on a memory context item", async () => {
|
||||
const f = await fixture();
|
||||
f.respond({
|
||||
...mixed,
|
||||
items: [{ ...memory, turn_id: "t" }],
|
||||
used_characters: [...memory.content].length,
|
||||
});
|
||||
|
||||
const result = await f.post();
|
||||
|
||||
expect(result.status).toBe(502);
|
||||
expect(result.data).toEqual({ error: "context_unavailable" });
|
||||
});
|
||||
|
||||
it.each([
|
||||
[10, 200],
|
||||
[11, 502],
|
||||
|
||||
@@ -184,17 +184,30 @@ function validSdkItem(value: unknown): boolean {
|
||||
if (!record(value) || typeof value.truncated !== "boolean") return false;
|
||||
if (value.kind === "raw")
|
||||
return (
|
||||
exact(value, [
|
||||
"kind",
|
||||
"raw_id",
|
||||
"content",
|
||||
"source",
|
||||
"session_id",
|
||||
"memory_at",
|
||||
"score",
|
||||
"truncated",
|
||||
]) &&
|
||||
exact(
|
||||
value,
|
||||
[
|
||||
"kind",
|
||||
"raw_id",
|
||||
"content",
|
||||
"source",
|
||||
"session_id",
|
||||
"memory_at",
|
||||
"score",
|
||||
"truncated",
|
||||
],
|
||||
["turn_id", "turn_index", "turn_count"],
|
||||
) &&
|
||||
text(value.raw_id, 1, 512) &&
|
||||
(value.turn_id === undefined ||
|
||||
value.turn_id === null ||
|
||||
text(value.turn_id, 1, 96)) &&
|
||||
(value.turn_index === undefined ||
|
||||
value.turn_index === null ||
|
||||
integer(value.turn_index, 0, Number.MAX_SAFE_INTEGER)) &&
|
||||
(value.turn_count === undefined ||
|
||||
value.turn_count === null ||
|
||||
integer(value.turn_count, 1, Number.MAX_SAFE_INTEGER)) &&
|
||||
text(value.content, 0, 20000) &&
|
||||
text(value.source, 1, 128) &&
|
||||
text(value.session_id, 1, 512) &&
|
||||
|
||||
@@ -229,6 +229,12 @@ describe("English catalog", () => {
|
||||
});
|
||||
|
||||
it("uses CLDR English singular and plural forms", () => {
|
||||
expect(translateCount("en", "sdk.raw.total", 1, { count: 1 })).toBe(
|
||||
"1 original conversation",
|
||||
);
|
||||
expect(translateCount("en", "sdk.raw.total", 2, { count: 2 })).toBe(
|
||||
"2 original conversations",
|
||||
);
|
||||
expect(
|
||||
translateCount("en", "calls.headline.found", 1, {
|
||||
host: "Cursor",
|
||||
|
||||
@@ -73,6 +73,8 @@ export const currentChineseMessages = {
|
||||
"sdk.raw.searchFailed": "原始对话搜索失败,请重试。",
|
||||
"sdk.raw.recent": "最近原始对话",
|
||||
"sdk.raw.empty": "还没有原始对话。连接来源后,对话会显示在这里。",
|
||||
"sdk.raw.total": "{count} 条原始对话",
|
||||
"sdk.raw.total.one": "{count} 条原始对话",
|
||||
"sdk.raw.found": "找到 {count} 条",
|
||||
"sdk.raw.found.one": "找到 {count} 条",
|
||||
|
||||
@@ -134,6 +136,7 @@ export const currentChineseMessages = {
|
||||
"selectedMemory.save": "保存修改",
|
||||
"selectedMemory.author.user": "你",
|
||||
"selectedMemory.author.agent": "助手",
|
||||
"selectedMemory.author.tool": "工具",
|
||||
"selectedMemory.sourceUnavailable": "来源权限已变化或原文不可用。",
|
||||
"selectedMemory.related": "对应记忆",
|
||||
"selectedMemory.viewMemory": "查看记忆",
|
||||
@@ -222,6 +225,8 @@ export const currentEnglishMessages: Record<
|
||||
"sdk.raw.recent": "Recent original conversations",
|
||||
"sdk.raw.empty":
|
||||
"No original conversations yet. Connect a source to see conversations here.",
|
||||
"sdk.raw.total": "{count} original conversations",
|
||||
"sdk.raw.total.one": "{count} original conversation",
|
||||
"sdk.raw.found": "{count} results",
|
||||
"sdk.raw.found.one": "{count} result",
|
||||
|
||||
@@ -289,6 +294,7 @@ export const currentEnglishMessages: Record<
|
||||
"selectedMemory.save": "Save changes",
|
||||
"selectedMemory.author.user": "You",
|
||||
"selectedMemory.author.agent": "Assistant",
|
||||
"selectedMemory.author.tool": "Tool",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Source permissions changed or the original text is unavailable.",
|
||||
"selectedMemory.related": "Related memory",
|
||||
@@ -384,6 +390,8 @@ export const currentSpanishMessages: Record<
|
||||
"sdk.raw.recent": "Conversaciones originales recientes",
|
||||
"sdk.raw.empty":
|
||||
"Todavía no hay conversaciones originales. Conecta una fuente para verlas aquí.",
|
||||
"sdk.raw.total": "{count} conversaciones originales",
|
||||
"sdk.raw.total.one": "{count} conversación original",
|
||||
"sdk.raw.found": "{count} resultados",
|
||||
"sdk.raw.found.one": "{count} resultado",
|
||||
|
||||
@@ -452,6 +460,7 @@ export const currentSpanishMessages: Record<
|
||||
"selectedMemory.save": "Guardar cambios",
|
||||
"selectedMemory.author.user": "Tú",
|
||||
"selectedMemory.author.agent": "Asistente",
|
||||
"selectedMemory.author.tool": "Herramienta",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Los permisos del origen cambiaron o el texto no está disponible.",
|
||||
"selectedMemory.related": "Memoria correspondiente",
|
||||
|
||||
@@ -86,6 +86,8 @@ export const germanMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "Letzte Originalunterhaltungen",
|
||||
"sdk.raw.empty":
|
||||
"Noch keine Originalunterhaltungen. Verbinde eine Quelle, damit sie hier erscheinen.",
|
||||
"sdk.raw.total": "{count} Originalunterhaltungen",
|
||||
"sdk.raw.total.one": "{count} Originalunterhaltung",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"Der Basisspeicher ist aktiv. Neue Unterhaltungen werden als Originale gespeichert und erzeugen keine erweiterten Erinnerungen. Vorhandene erweiterte Erinnerungen bleiben gespeichert, werden aber nicht angezeigt oder abgerufen.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -158,6 +160,7 @@ export const germanMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "Speichern",
|
||||
"selectedMemory.author.user": "Sie",
|
||||
"selectedMemory.author.agent": "Assistent",
|
||||
"selectedMemory.author.tool": "Tool",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Quellberechtigungen haben sich geändert oder der Originaltext ist nicht verfügbar.",
|
||||
"selectedMemory.related": "Zugehörige Erinnerung",
|
||||
|
||||
@@ -87,6 +87,8 @@ export const frenchMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "Conversations originales récentes",
|
||||
"sdk.raw.empty":
|
||||
"Aucune conversation originale pour le moment. Connectez une source pour les afficher ici.",
|
||||
"sdk.raw.total": "{count} conversations originales",
|
||||
"sdk.raw.total.one": "{count} conversation originale",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"La mémoire de base est active. Les nouvelles conversations sont conservées telles quelles et ne créent pas de mémoires avancées. Les mémoires avancées existantes restent enregistrées, mais ne sont ni affichées ni rappelées.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -162,6 +164,7 @@ export const frenchMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "Enregistrer",
|
||||
"selectedMemory.author.user": "Vous",
|
||||
"selectedMemory.author.agent": "Assistant",
|
||||
"selectedMemory.author.tool": "Outil",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Les autorisations de la source ont changé ou le texte original est indisponible.",
|
||||
"selectedMemory.related": "Mémoire associée",
|
||||
|
||||
@@ -81,6 +81,8 @@ export const indonesianMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "Percakapan asli terbaru",
|
||||
"sdk.raw.empty":
|
||||
"Belum ada percakapan asli. Hubungkan sumber agar percakapan tampil di sini.",
|
||||
"sdk.raw.total": "{count} percakapan asli",
|
||||
"sdk.raw.total.one": "{count} percakapan asli",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"Memori dasar aktif. Percakapan baru disimpan sebagai catatan asli dan tidak membuat memori lanjutan. Memori lanjutan yang ada tetap tersimpan, tetapi tidak ditampilkan atau digunakan untuk recall.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -151,6 +153,7 @@ export const indonesianMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "Simpan perubahan",
|
||||
"selectedMemory.author.user": "Anda",
|
||||
"selectedMemory.author.agent": "Asisten",
|
||||
"selectedMemory.author.tool": "Alat",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Izin sumber berubah atau teks asli tidak tersedia.",
|
||||
"selectedMemory.related": "Memori terkait",
|
||||
|
||||
@@ -83,6 +83,8 @@ export const japaneseMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "最近の元の会話",
|
||||
"sdk.raw.empty":
|
||||
"元の会話はまだありません。ソースを接続すると、ここに表示されます。",
|
||||
"sdk.raw.total": "元の会話 {count} 件",
|
||||
"sdk.raw.total.one": "元の会話 {count} 件",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"基本メモリを使用中です。新しい会話は原文として保存され、高度なメモリは生成されません。既存の高度なメモリは保持されますが、現在は表示も呼び出しもされません。",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -152,6 +154,7 @@ export const japaneseMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "変更を保存",
|
||||
"selectedMemory.author.user": "あなた",
|
||||
"selectedMemory.author.agent": "アシスタント",
|
||||
"selectedMemory.author.tool": "ツール",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"ソースの権限が変更されたか、原文を利用できません。",
|
||||
"selectedMemory.related": "関連する記憶",
|
||||
|
||||
@@ -80,6 +80,8 @@ export const koreanMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "최근 원본 대화",
|
||||
"sdk.raw.empty":
|
||||
"아직 원본 대화가 없습니다. 소스를 연결하면 여기에 표시됩니다.",
|
||||
"sdk.raw.total": "원본 대화 {count}개",
|
||||
"sdk.raw.total.one": "원본 대화 {count}개",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"기본 메모리를 사용 중입니다. 새 대화는 원본 기록으로 저장되며 고급 메모리를 만들지 않습니다. 기존 고급 메모리는 보존되지만 현재 표시되거나 회상에 사용되지 않습니다.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -149,6 +151,7 @@ export const koreanMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "변경 사항 저장",
|
||||
"selectedMemory.author.user": "나",
|
||||
"selectedMemory.author.agent": "어시스턴트",
|
||||
"selectedMemory.author.tool": "도구",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"출처 권한이 변경되었거나 원문을 사용할 수 없습니다.",
|
||||
"selectedMemory.related": "관련 기억",
|
||||
|
||||
@@ -86,6 +86,8 @@ export const portugueseMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "Conversas originais recentes",
|
||||
"sdk.raw.empty":
|
||||
"Ainda não há conversas originais. Ligue uma origem para as ver aqui.",
|
||||
"sdk.raw.total": "{count} conversas originais",
|
||||
"sdk.raw.total.one": "{count} conversa original",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"A memória básica está ativa. As novas conversas são guardadas como registos originais e não criam memórias avançadas. As memórias avançadas existentes continuam guardadas, mas não são mostradas nem usadas na recuperação.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -159,6 +161,7 @@ export const portugueseMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "Salvar alterações",
|
||||
"selectedMemory.author.user": "Você",
|
||||
"selectedMemory.author.agent": "Assistente",
|
||||
"selectedMemory.author.tool": "Ferramenta",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"As permissões da fonte mudaram ou o texto original não está disponível.",
|
||||
"selectedMemory.related": "Memória relacionada",
|
||||
|
||||
@@ -83,6 +83,8 @@ export const russianMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.recent": "Недавние исходные диалоги",
|
||||
"sdk.raw.empty":
|
||||
"Исходных диалогов пока нет. Подключите источник, и они появятся здесь.",
|
||||
"sdk.raw.total": "Исходных диалогов: {count}",
|
||||
"sdk.raw.total.one": "{count} исходный диалог",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"Включена базовая память. Новые диалоги сохраняются в исходном виде и не создают расширенные воспоминания. Существующие расширенные воспоминания сохраняются, но не показываются и не используются при поиске.",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -155,6 +157,7 @@ export const russianMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "Сохранить изменения",
|
||||
"selectedMemory.author.user": "Вы",
|
||||
"selectedMemory.author.agent": "Ассистент",
|
||||
"selectedMemory.author.tool": "Инструмент",
|
||||
"selectedMemory.sourceUnavailable":
|
||||
"Разрешения источника изменились, или исходный текст недоступен.",
|
||||
"selectedMemory.related": "Связанная запись памяти",
|
||||
|
||||
@@ -74,6 +74,8 @@ export const traditionalChineseMessages: Record<MessageKey, string> = {
|
||||
"sdk.raw.searchFailed": "原始對話搜尋失敗,請重試。",
|
||||
"sdk.raw.recent": "最近原始對話",
|
||||
"sdk.raw.empty": "還沒有原始對話。連接來源後,對話會顯示在這裡。",
|
||||
"sdk.raw.total": "{count} 則原始對話",
|
||||
"sdk.raw.total.one": "{count} 則原始對話",
|
||||
"memory:当前使用基础记忆。新对话会保存为原始记录,不会生成高级记忆;以前生成的高级记忆仍会保留,但当前不会显示或参与记忆召回。":
|
||||
"目前使用基礎記憶。新對話會保留為原始記錄,不會產生進階記憶;過去的進階記憶仍會保留,但目前不會顯示或參與記憶召回。",
|
||||
"memory:当前使用智能记忆。新对话会由模型整理为高级记忆。":
|
||||
@@ -139,6 +141,7 @@ export const traditionalChineseMessages: Record<MessageKey, string> = {
|
||||
"selectedMemory.save": "儲存修改",
|
||||
"selectedMemory.author.user": "你",
|
||||
"selectedMemory.author.agent": "助理",
|
||||
"selectedMemory.author.tool": "工具",
|
||||
"selectedMemory.sourceUnavailable": "來源權限已變化或原文不可用。",
|
||||
"selectedMemory.related": "對應記憶",
|
||||
"selectedMemory.viewMemory": "檢視記憶",
|
||||
|
||||
Reference in new issue
Block a user