Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60de47d566 | ||
|
|
9ba602ffd2 | ||
|
|
842fbe6044 | ||
|
|
268ad16d26 | ||
|
|
8903872b47 | ||
|
|
1aed8d7507 | ||
|
|
1c31295e13 |
No files matched your search
@@ -59,4 +59,30 @@ jobs:
|
||||
- run: corepack enable
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: uv sync --directory apps/core --all-groups --locked
|
||||
- run: pnpm check
|
||||
- name: Verify public source structure and privacy boundaries
|
||||
run: |
|
||||
python3 scripts/verify_structure.py
|
||||
python3 scripts/generate_core_test_index.py --check
|
||||
python3 scripts/verify_zero_collection.py
|
||||
python3 scripts/verify_zero_collection.py --self-test
|
||||
- name: Lint Node workspaces
|
||||
run: pnpm lint
|
||||
- name: Typecheck Node workspaces
|
||||
run: pnpm typecheck
|
||||
- name: Test Node workspaces
|
||||
run: pnpm test
|
||||
- name: Test release tooling
|
||||
run: pnpm test:release-scripts
|
||||
- name: Fetch and verify the pinned embedding model
|
||||
run: |
|
||||
pnpm fetch:embedding-model
|
||||
uv run --directory apps/core python -c \
|
||||
"from one_memory.embedding_assets import assets_present, verify_assets; assert assets_present(); verify_assets()"
|
||||
- name: Test public Core smoke suite
|
||||
run: >-
|
||||
bash scripts/run-tests-isolated.sh core-pr
|
||||
tests/test_core_test_reporting.py
|
||||
tests/test_import_api.py
|
||||
tests/test_recent_first_import.py
|
||||
tests/test_source_session_count_api.py
|
||||
tests/test_schema_migrations.py
|
||||
@@ -102,3 +102,65 @@ jobs:
|
||||
if-no-files-found: error
|
||||
compression-level: 0
|
||||
retention-days: 14
|
||||
|
||||
publish-draft-release:
|
||||
if: ${{ inputs.run_lifecycle && startsWith(github.ref, 'refs/tags/v') }}
|
||||
needs: matrix
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
|
||||
with:
|
||||
pattern: memhub-runtime-linux-*
|
||||
path: memhub/release-assets
|
||||
merge-multiple: true
|
||||
- name: Verify tag and Linux release assets
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version=$(node -p 'require("./package.json").version')
|
||||
node scripts/verify-release-version.mjs \
|
||||
--channel stable \
|
||||
--version "$version" \
|
||||
--build-number "$(node -p 'require("./package.json").release.build_number')" \
|
||||
--tag "$GITHUB_REF_NAME"
|
||||
for arch in x64 arm64; do
|
||||
archive="release-assets/memhub-runtime-v${version}-linux-${arch}.tar.gz"
|
||||
test -f "$archive"
|
||||
test -f "$archive.sha256"
|
||||
(
|
||||
cd release-assets
|
||||
sha256sum -c "$(basename "$archive.sha256")"
|
||||
)
|
||||
done
|
||||
- name: Upload Linux assets to a draft GitHub Release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if gh release view "$GITHUB_REF_NAME" \
|
||||
--repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
|
||||
test "$(
|
||||
gh release view "$GITHUB_REF_NAME" \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--json isDraft \
|
||||
--jq .isDraft
|
||||
)" = "true"
|
||||
else
|
||||
gh release create "$GITHUB_REF_NAME" \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--verify-tag \
|
||||
--draft \
|
||||
--generate-notes \
|
||||
--title "$GITHUB_REF_NAME"
|
||||
fi
|
||||
gh release upload "$GITHUB_REF_NAME" \
|
||||
release-assets/memhub-runtime-v*-linux-*.tar.gz \
|
||||
release-assets/memhub-runtime-v*-linux-*.tar.gz.sha256 \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--clobber
|
||||
+23
-8
@@ -2,6 +2,12 @@
|
||||
|
||||
Hy Memory and MemHub are versioned and released independently.
|
||||
|
||||
## Hy Memory 2.0.2 — 2026-10-17
|
||||
|
||||
- Published
|
||||
[`hy-memory==2.0.2`](https://pypi.org/project/hy-memory/2.0.2/) with the
|
||||
current SDK fixes and Apache-2.0 package metadata.
|
||||
|
||||
## Hy Memory 2.0.1 — 2026-10-16
|
||||
|
||||
- Published the Python distribution as
|
||||
@@ -10,13 +16,22 @@ Hy Memory and MemHub are versioned and released independently.
|
||||
Because PyPI release metadata is immutable, the next SDK patch release must
|
||||
carry the updated license metadata; `2.0.1` retains its published metadata.
|
||||
|
||||
## MemHub
|
||||
## MemHub 1.0.2 — Unreleased
|
||||
|
||||
MemHub has no public release yet. The source version is `1.0.0` (build 4), the
|
||||
selected npm package is `memhub-cli`, and both npm publication and GitHub
|
||||
Release artifacts are still pending. Internal release-candidate builds are not
|
||||
public releases.
|
||||
- Updated the source version to `1.0.2` (build 6).
|
||||
- Pinned the public SDK to `hy-memory==2.0.2`.
|
||||
- Pinned `onnxruntime==1.23.2` to retain macOS x64 packaging support.
|
||||
- Fixed relaunch and upgrade failures when a prior managed Runtime exists.
|
||||
- Embedded canonical build identity when an external packaging pipeline omits
|
||||
release environment fields.
|
||||
- Added automatic Linux Runtime upload to tagged Draft Releases.
|
||||
|
||||
No compatibility or deprecation policy has been adopted beyond the explicit
|
||||
CLI/Runtime protocol ranges stored in the release manifests. Future public
|
||||
releases must record user-visible changes and supported platforms here.
|
||||
## MemHub 1.0.1 — Superseded before release
|
||||
|
||||
- The candidate tag was not published as a GitHub Release; `1.0.2` replaces it
|
||||
after the managed-Runtime relaunch fix.
|
||||
|
||||
## MemHub 1.0.0
|
||||
|
||||
- Published the initial GitHub Release with macOS arm64 and Linux Runtime
|
||||
artifacts.
|
||||
@@ -32,7 +32,7 @@ English | [中文](README.zh.md)
|
||||
|
||||
## Latest News
|
||||
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **Released** **Hy Memory 2.0 (`hy-memory==2.0.1`)** on [PyPI](https://pypi.org/project/hy-memory/2.0.1/) and open-sourced the **Hy-Memory** monorepo together with **[MemHub](memhub/README.md)**!
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **Released** **Hy Memory 2.0 (`hy-memory==2.0.2`)** on [PyPI](https://pypi.org/project/hy-memory/2.0.2/) and open-sourced the **Hy-Memory** monorepo together with **[MemHub](memhub/README.md)**!
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **Open-sourced** **[Hy-Memory-30B-A3B](https://huggingface.co/tencent/Hy-Memory-30B-A3B)** on Hugging Face along with its [technical report](https://arxiv.org/abs/2610.22196) on attributed reinforcement learning for long-term memory writing!
|
||||
* *<mark>[new]</mark>* 🔥🔥 **[2026-09]**: 📊 **Released** **[CMB: A Coding Memory Benchmark for Long-Horizon and Interleaved Coding Agents](docs/papers/CMB_A_Coding_Memory_Benchmark_for_Long_Horizon_and_Interleaved_Coding_Agents.pdf)** (submitted to **ICLR 2027**).
|
||||
* *<mark>[new]</mark>* 🔥🔥 **[2026-08]**: 🎉 **Accepted** at **EMNLP 2026**: **[Memory Beyond Recall: A Dual-Process Cognitive Memory System for Self-Evolving LLM Agents](https://arxiv.org/abs/2606.09483)**!
|
||||
@@ -63,13 +63,13 @@ Welcome to the **Hy Memory Research Family**, covering cognitive chat memory, lo
|
||||
### 1. Installation
|
||||
|
||||
```bash
|
||||
pip install hy-memory==2.0.1 # core (includes ChromaDB and Kuzu)
|
||||
pip install "hy-memory[qdrant]==2.0.1" # + Qdrant
|
||||
pip install "hy-memory[faiss]==2.0.1" # + FAISS
|
||||
pip install "hy-memory[graph]==2.0.1" # + Neo4j
|
||||
pip install "hy-memory[mysql]==2.0.1" # + MySQL cache
|
||||
pip install "hy-memory[rerank]==2.0.1" # + local multilingual cross-encoder rerank
|
||||
pip install "hy-memory[all]==2.0.1" # everything
|
||||
pip install hy-memory==2.0.2 # core (includes ChromaDB and Kuzu)
|
||||
pip install "hy-memory[qdrant]==2.0.2" # + Qdrant
|
||||
pip install "hy-memory[faiss]==2.0.2" # + FAISS
|
||||
pip install "hy-memory[graph]==2.0.2" # + Neo4j
|
||||
pip install "hy-memory[mysql]==2.0.2" # + MySQL cache
|
||||
pip install "hy-memory[rerank]==2.0.2" # + local multilingual cross-encoder rerank
|
||||
pip install "hy-memory[all]==2.0.2" # everything
|
||||
```
|
||||
|
||||
### 2. Configuration
|
||||
|
||||
+8
-8
@@ -32,7 +32,7 @@
|
||||
|
||||
## 最新动态
|
||||
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **正式发布** **Hy Memory 2.0 (`hy-memory==2.0.1`)**(已上线 [PyPI](https://pypi.org/project/hy-memory/2.0.1/)),并开源 **Hy-Memory** monorepo 与 **[MemHub](memhub/README.md)**!
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **正式发布** **Hy Memory 2.0 (`hy-memory==2.0.2`)**(已上线 [PyPI](https://pypi.org/project/hy-memory/2.0.2/)),并开源 **Hy-Memory** monorepo 与 **[MemHub](memhub/README.md)**!
|
||||
* *<mark>[new]</mark>* 🔥🔥🔥 **[2026-10]**: 🚀 **模型开源** 在 Hugging Face 发布 **[Hy-Memory-30B-A3B](https://huggingface.co/tencent/Hy-Memory-30B-A3B)** 长期记忆写入模型及[技术报告](https://arxiv.org/abs/2610.22196)!
|
||||
* *<mark>[new]</mark>* 🔥🔥 **[2026-09]**: 📊 **基准与方法发布** 推出长周期与交错式编程记忆评测基准 **[CMB: A Coding Memory Benchmark for Long-Horizon and Interleaved Coding Agents](docs/papers/CMB_A_Coding_Memory_Benchmark_for_Long_Horizon_and_Interleaved_Coding_Agents.pdf)**(已投稿 **ICLR 2027**)。
|
||||
* *<mark>[new]</mark>* 🔥🔥 **[2026-08]**: 🎉 **论文录用** 双系统认知记忆架构论文 **[Memory Beyond Recall: A Dual-Process Cognitive Memory System for Self-Evolving LLM Agents](https://arxiv.org/abs/2606.09483)** 被 **EMNLP 2026** 接收!
|
||||
@@ -63,13 +63,13 @@
|
||||
### 1. 安装
|
||||
|
||||
```bash
|
||||
pip install hy-memory==2.0.1 # 核心(含 ChromaDB 与 Kuzu)
|
||||
pip install "hy-memory[qdrant]==2.0.1" # + Qdrant
|
||||
pip install "hy-memory[faiss]==2.0.1" # + FAISS
|
||||
pip install "hy-memory[graph]==2.0.1" # + Neo4j
|
||||
pip install "hy-memory[mysql]==2.0.1" # + MySQL 缓存
|
||||
pip install "hy-memory[rerank]==2.0.1" # + 本地多语言 cross-encoder rerank
|
||||
pip install "hy-memory[all]==2.0.1" # 全部
|
||||
pip install hy-memory==2.0.2 # 核心(含 ChromaDB 与 Kuzu)
|
||||
pip install "hy-memory[qdrant]==2.0.2" # + Qdrant
|
||||
pip install "hy-memory[faiss]==2.0.2" # + FAISS
|
||||
pip install "hy-memory[graph]==2.0.2" # + Neo4j
|
||||
pip install "hy-memory[mysql]==2.0.2" # + MySQL 缓存
|
||||
pip install "hy-memory[rerank]==2.0.2" # + 本地多语言 cross-encoder rerank
|
||||
pip install "hy-memory[all]==2.0.2" # 全部
|
||||
```
|
||||
|
||||
### 2. 配置
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ do not belong in the public source tree.
|
||||
- Root GitHub workflows run SDK and MemHub checks from their respective working
|
||||
directories. Native lifecycle workflows produce reviewable Actions artifacts;
|
||||
tag releases remain fail-closed on public identity, signing and notarization.
|
||||
- Hy Memory is published as `hy-memory==2.0.1`. MemHub pins that public
|
||||
- Hy Memory is published as `hy-memory==2.0.2`. MemHub pins that public
|
||||
distribution; its selected npm package is `memhub-cli`, which is not yet
|
||||
published.
|
||||
- Hy-Memory source uses Apache-2.0 at the repository root. Third-party
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
## 安装与快速开始
|
||||
|
||||
```bash
|
||||
pip install hy-memory==2.0.1
|
||||
pip install hy-memory==2.0.2
|
||||
|
||||
# 可选后端
|
||||
pip install 'hy-memory[qdrant]==2.0.1'
|
||||
|
||||
+36
-2
@@ -15,12 +15,12 @@ write、search,并把搜索结果格式化为可交给模型的 memory text ch
|
||||
|
||||
```text
|
||||
distribution: hy-memory
|
||||
version: 2.0.1
|
||||
version: 2.0.2
|
||||
mode: 按运行时配置选择
|
||||
reader: hybrid
|
||||
```
|
||||
|
||||
仓库 pin、lockfile 和运行时版本守卫均固定到公开的 `hy-memory==2.0.1`。
|
||||
仓库 pin、lockfile 和运行时版本守卫均固定到公开的 `hy-memory==2.0.2`。
|
||||
MemHub 在本地 Runtime 内嵌入 SDK,但不绕过自身的来源授权、模型授权、Evidence、
|
||||
Governance 和撤权边界。
|
||||
|
||||
@@ -37,6 +37,40 @@ MemHub 对 SDK 使用以下公开、可复现的本地策略:
|
||||
- API Key 进入系统安全存储,不写入仓库、安装包、日志或 HY metadata;
|
||||
- 服务端数据库、租户队列及宿主 shell 中的 ambient 凭据不会进入 SDK config。
|
||||
|
||||
发布包固定应用以下 SDK 行为配置:
|
||||
|
||||
| 环境变量 | 值 |
|
||||
|---|---|
|
||||
| `MEMORY_MODE` | `ultra` |
|
||||
| `MEMORY_ENABLE_GRAPH` | `true` |
|
||||
| `MEMORY_GRAPH_RERANK_ENABLED` | `false` |
|
||||
| `MEMORY_GRAPH_TEMPORAL_SPINE` | `true` |
|
||||
| `MEMORY_TOPIC_SUMMARY_ENABLED` | `false` |
|
||||
| `MEMORY_EPISODE_SUMMARY_ENABLED` | `false` |
|
||||
| `MEMORY_EPISODE_RECALL_ENABLED` | `true` |
|
||||
| `MEMORY_DYNAMIC_EPISODE_ENABLED` | `true` |
|
||||
| `MEMORY_SESSION_EPISODE_ENABLED` | `false` |
|
||||
| `MEMORY_SESSION_EPISODE_CONTEXT_ENABLED` | `false` |
|
||||
| `MEMORY_EPISODE_CAPSULE_CONTEXT_ENABLED` | `true` |
|
||||
| `MEMORY_EPISODE_CAPSULE_QUERY_MIN` | `0.65` |
|
||||
| `MEMORY_EPISODE_CAPSULE_ASSIGNMENT_MIN` | `0.60` |
|
||||
| `MEMORY_EPISODE_CAPSULE_FIRST_RANK_MAX` | `3` |
|
||||
| `MEMORY_EPISODE_CAPSULE_MEMBER_LIMIT` | `3` |
|
||||
| `MEMORY_ENABLE_INTENTION` | `false` |
|
||||
| `MEMORY_ENABLE_QUERY_REWRITE` | `false` |
|
||||
| `MEMORY_FEW_SHOT_ENABLED` | `true` |
|
||||
| `MEMORY_HYBRID_V2_QUERY_EXPAND` | `1` |
|
||||
| `MEMORY_HYBRID_V2_GEO_INTENT_PRIOR` | `0.6` |
|
||||
| `MEMORY_HYBRID_V2_DIVERSITY` | `1` |
|
||||
| `MEMORY_HYBRID_V2_TEMPORAL_ADMIT_PRIOR` | `0.55` |
|
||||
| `MEMORY_HYBRID_V2_TEMPORAL_BOOST` | `0.18` |
|
||||
| `MEMORY_CROSS_DOMAIN_CON_THRESHOLD` | `0.5` |
|
||||
| `MEMORY_READER_ENABLE_SUMMARY` | `false` |
|
||||
| `MEMORY_SUMMARY_ENABLED_IN_SYS2` | `false` |
|
||||
| `MEMORY_LOCAL_RERANK_ENABLED` | `false` |
|
||||
| `RECONCILE_ENABLED` | `true` |
|
||||
| `HY_MEMORY_READER` | `hybrid` |
|
||||
|
||||
这些默认值集中在
|
||||
`apps/core/src/one_memory/hy_runtime_config.py`,并由发布测试和 lockfile 共同约束。
|
||||
独立脚本若绕过 MemHub 直接导入 SDK,应自行显式配置存储目录和模型端点。
|
||||
|
||||
+4
-4
@@ -6,13 +6,13 @@ SDK 和记忆引擎。One Memory / `one-memory` 是历史模块、数据目录
|
||||
|
||||
## 发行与平台合同
|
||||
|
||||
公共 Python SDK 为 `hy-memory==2.0.1`。MemHub 源码版本为 `1.0.0`
|
||||
(build 4),GitHub 仓库为
|
||||
公共 Python SDK 为 `hy-memory==2.0.2`。MemHub 源码版本为 `1.0.2`
|
||||
(build 6),GitHub 仓库为
|
||||
[`Tencent-Hunyuan/Hy-Memory`](https://github.com/Tencent-Hunyuan/Hy-Memory),npm 包名为
|
||||
`memhub-cli`。当前代码架构见
|
||||
[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md)。
|
||||
|
||||
`v1.0.0` 的发行目标是 Linux x64/arm64 Runtime 与 macOS arm64/x64 App 和 Runtime。
|
||||
`v1.0.2` 的发行目标是 Linux x64/arm64 Runtime 与 macOS arm64/x64 App 和 Runtime。
|
||||
Linux 制品由 GitHub Actions 在原生架构 runner 上构建并完成生命周期验收;macOS
|
||||
制品由发行流水线完成 Developer ID 签名、公证和验收后手动上传。Windows 不支持。
|
||||
只有同时出现在 GitHub Release 与 `release-manifest.json` 中、且通过公开校验的制品才属于
|
||||
@@ -99,7 +99,7 @@ MemHub 的 SQLite 数据默认位于 `~/.one-memory`,不在 npm 包或 Runtime
|
||||
|
||||
## Hy Memory
|
||||
|
||||
当前开发依赖固定为公开 PyPI 包 `hy-memory==2.0.1`。SDK 配置、权限边界及 search
|
||||
当前开发依赖固定为公开 PyPI 包 `hy-memory==2.0.2`。SDK 配置、权限边界及 search
|
||||
返回格式见 [`MEMORY.md`](MEMORY.md)。HY search 返回的 `content` 已包含 SDK 统一生成的
|
||||
逻辑时间和演化上下文;调用方不应再次转换时间戳或重复拼接 `When`。
|
||||
|
||||
|
||||
+94
-6
@@ -479,6 +479,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-coloredlogs",
|
||||
"name": "coloredlogs",
|
||||
"versionInfo": "15.0.1",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "NOASSERTION",
|
||||
"licenseDeclared": "NOASSERTION",
|
||||
"copyrightText": "NOASSERTION",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceType": "purl",
|
||||
"referenceLocator": "pkg:pypi/coloredlogs@15.0.1"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-distro",
|
||||
"name": "distro",
|
||||
@@ -751,6 +768,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-humanfriendly",
|
||||
"name": "humanfriendly",
|
||||
"versionInfo": "10.0",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "NOASSERTION",
|
||||
"licenseDeclared": "NOASSERTION",
|
||||
"copyrightText": "NOASSERTION",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceType": "purl",
|
||||
"referenceLocator": "pkg:pypi/humanfriendly@10.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-idna",
|
||||
"name": "idna",
|
||||
@@ -1125,6 +1159,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-mpmath",
|
||||
"name": "mpmath",
|
||||
"versionInfo": "1.3.0",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "NOASSERTION",
|
||||
"licenseDeclared": "NOASSERTION",
|
||||
"copyrightText": "NOASSERTION",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceType": "purl",
|
||||
"referenceLocator": "pkg:pypi/mpmath@1.3.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-multidict",
|
||||
"name": "multidict",
|
||||
@@ -1230,7 +1281,7 @@
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-onnxruntime",
|
||||
"name": "onnxruntime",
|
||||
"versionInfo": "1.29.0",
|
||||
"versionInfo": "1.23.2",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "NOASSERTION",
|
||||
@@ -1240,7 +1291,7 @@
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceType": "purl",
|
||||
"referenceLocator": "pkg:pypi/onnxruntime@1.29.0"
|
||||
"referenceLocator": "pkg:pypi/onnxruntime@1.23.2"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -1992,6 +2043,23 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-sympy",
|
||||
"name": "sympy",
|
||||
"versionInfo": "1.14.0",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "NOASSERTION",
|
||||
"licenseDeclared": "NOASSERTION",
|
||||
"copyrightText": "NOASSERTION",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceType": "purl",
|
||||
"referenceLocator": "pkg:pypi/sympy@1.14.0"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pypi-tenacity",
|
||||
"name": "tenacity",
|
||||
@@ -2267,12 +2335,12 @@
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-hy-memory",
|
||||
"name": "hy-memory",
|
||||
"versionInfo": "2.0.1",
|
||||
"versionInfo": "2.0.2",
|
||||
"downloadLocation": "NOASSERTION",
|
||||
"filesAnalyzed": false,
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"copyrightText": "Copyright (c) 2025 HY Memory Contributors"
|
||||
"licenseConcluded": "Apache-2.0",
|
||||
"licenseDeclared": "Apache-2.0",
|
||||
"copyrightText": "Copyright (C) 2026 Tencent. All rights reserved."
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-memmy-agent-derived",
|
||||
@@ -2427,6 +2495,11 @@
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-cloudpickle"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-coloredlogs"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
@@ -2507,6 +2580,11 @@
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-huggingface-hub"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-humanfriendly"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
@@ -2617,6 +2695,11 @@
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-more-itertools"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-mpmath"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
@@ -2872,6 +2955,11 @@
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-starlette"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pypi-sympy"
|
||||
},
|
||||
{
|
||||
"spdxElementId": "SPDXRef-Package-one-memory",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
|
||||
@@ -9,32 +9,72 @@ Per-package license texts are not reproduced here yet; the license
|
||||
column is filled in as part of release review, and the SBOM records
|
||||
`NOASSERTION` until then rather than guessing.
|
||||
|
||||
## hy-memory 2.0.1
|
||||
## hy-memory 2.0.2
|
||||
|
||||
License: MIT
|
||||
License: Apache-2.0
|
||||
|
||||
```text
|
||||
MIT License
|
||||
Tencent is pleased to support the community by making Hy-Memory available.
|
||||
|
||||
Copyright (c) 2025 HY Memory Contributors
|
||||
Copyright (C) 2026 Tencent. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Hy-Memory is licensed under Apache-2.0. Hy-Memory does not impose any additional restrictions beyond those specified in the license.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
For the avoidance of doubt, Hy-Memory refers solely to code, parameters, and weights made publicly available by Tencent in accordance with Apache-2.0.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
Terms of the Apache-2.0 License:
|
||||
--------------------------------------------------------------------
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
```
|
||||
|
||||
## MemTensor memmy-agent (adapted)
|
||||
@@ -85,7 +125,7 @@ No Memmy brand, icon, font or mascot assets are distributed.
|
||||
- tar 7.5.22
|
||||
- three 0.185.1
|
||||
|
||||
## Python (PyPI) — 122 packages
|
||||
## Python (PyPI) — 126 packages
|
||||
|
||||
- aiohappyeyeballs 2.7.1
|
||||
- aiohttp 3.14.3
|
||||
@@ -104,6 +144,7 @@ No Memmy brand, icon, font or mascot assets are distributed.
|
||||
- chromadb 1.5.9
|
||||
- click 8.5.0
|
||||
- cloudpickle 3.1.2
|
||||
- coloredlogs 15.0.1
|
||||
- distro 1.9.0
|
||||
- durationpy 0.11
|
||||
- execnet 2.1.2
|
||||
@@ -120,6 +161,7 @@ No Memmy brand, icon, font or mascot assets are distributed.
|
||||
- httptools 0.8.0
|
||||
- httpx 0.28.1
|
||||
- huggingface-hub 1.29.0
|
||||
- humanfriendly 10.0
|
||||
- idna 3.19
|
||||
- importlib-resources 7.1.0
|
||||
- iniconfig 2.3.0
|
||||
@@ -142,13 +184,14 @@ No Memmy brand, icon, font or mascot assets are distributed.
|
||||
- mdurl 0.1.2
|
||||
- mmh3 5.3.0
|
||||
- more-itertools 11.1.0
|
||||
- mpmath 1.3.0
|
||||
- multidict 6.7.1
|
||||
- mypy 2.3.1
|
||||
- mypy-extensions 1.1.0
|
||||
- narwhals 2.25.0
|
||||
- numpy 2.5.2
|
||||
- oauthlib 3.3.1
|
||||
- onnxruntime 1.29.0
|
||||
- onnxruntime 1.23.2
|
||||
- openai 2.54.0
|
||||
- opentelemetry-api 1.44.0
|
||||
- opentelemetry-exporter-otlp-proto-common 1.44.0
|
||||
@@ -193,6 +236,7 @@ No Memmy brand, icon, font or mascot assets are distributed.
|
||||
- six 1.17.0
|
||||
- sniffio 1.3.1
|
||||
- starlette 1.6.0
|
||||
- sympy 1.14.0
|
||||
- tenacity 9.1.4
|
||||
- threadpoolctl 3.6.0
|
||||
- tiktoken 0.14.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@one-memory/cli",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"description": "MemHub bootstrap CLI for installing and managing the local-first shared memory runtime",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* the real package.json and only strips what is provably not needed at runtime.
|
||||
*/
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { createRequire } from "node:module";
|
||||
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
||||
import { dirname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -27,10 +27,7 @@ const releaseVersion = resolveBuildVersion(process.env, repositoryRoot);
|
||||
const pkgPath = resolve(root, "package.json");
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
||||
const publishName = process.env.MEMHUB_NPM_PACKAGE?.trim();
|
||||
if (
|
||||
!publishName ||
|
||||
!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(publishName)
|
||||
) {
|
||||
if (!publishName || !/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/.test(publishName)) {
|
||||
throw new Error(
|
||||
"MEMHUB_NPM_PACKAGE must name the explicit npm publish identity",
|
||||
);
|
||||
@@ -38,8 +35,12 @@ if (
|
||||
|
||||
const bundle = resolve(root, "dist/one-memory.cjs");
|
||||
const source = readFileSync(bundle, "utf8");
|
||||
const runtimeRequires = [...source.matchAll(/require\(["']([^"']+)["']\)/g)].map((m) => m[1]);
|
||||
const workspaceLeaked = runtimeRequires.filter((name) => name.startsWith("@one-memory/"));
|
||||
const runtimeRequires = [
|
||||
...source.matchAll(/require\(["']([^"']+)["']\)/g),
|
||||
].map((m) => m[1]);
|
||||
const workspaceLeaked = runtimeRequires.filter((name) =>
|
||||
name.startsWith("@one-memory/"),
|
||||
);
|
||||
if (workspaceLeaked.length > 0) {
|
||||
throw new Error(
|
||||
`bundle still requires workspace packages at runtime: ${workspaceLeaked.join(", ")}. ` +
|
||||
@@ -61,9 +62,7 @@ for (const section of ["dependencies", "devDependencies", "peerDependencies"]) {
|
||||
// else is build-time only. The bundle is inlined (tsup noExternal), so
|
||||
// in practice only Node builtins remain — but compute it rather than
|
||||
// assume, so a future non-inlined dep is not silently dropped.
|
||||
runtimeRequires.some(
|
||||
(req) => req === name || req.startsWith(`${name}/`),
|
||||
),
|
||||
runtimeRequires.some((req) => req === name || req.startsWith(`${name}/`)),
|
||||
),
|
||||
);
|
||||
if (Object.keys(published[section]).length === 0) delete published[section];
|
||||
@@ -77,8 +76,15 @@ published.files = ["dist", "scripts", "package.json"];
|
||||
// in the staging dir overrides that and makes the manifest authoritative.
|
||||
writeFileSync(
|
||||
resolve(outDir, ".npmignore"),
|
||||
["# Ship the built bundle: the repo root .gitignore excludes dist/.", "!dist/", ""].join("\n"),
|
||||
[
|
||||
"# Ship the built bundle: the repo root .gitignore excludes dist/.",
|
||||
"!dist/",
|
||||
"",
|
||||
].join("\n"),
|
||||
);
|
||||
|
||||
writeFileSync(resolve(outDir, "package.json"), `${JSON.stringify(published, null, 2)}\n`);
|
||||
writeFileSync(
|
||||
resolve(outDir, "package.json"),
|
||||
`${JSON.stringify(published, null, 2)}\n`,
|
||||
);
|
||||
console.log("wrote", resolve(outDir, "package.json"));
|
||||
@@ -20,11 +20,7 @@ import { pathToFileURL } from "node:url";
|
||||
|
||||
const REQUIRED_ALIASES = {
|
||||
daemon: ["start", "stop", "restart", "status"],
|
||||
"startup-service": [
|
||||
"service-plan",
|
||||
"service-install",
|
||||
"service-uninstall",
|
||||
],
|
||||
"startup-service": ["service-plan", "service-install", "service-uninstall"],
|
||||
};
|
||||
|
||||
const REQUIRED_COMMAND_SURFACE = [
|
||||
@@ -112,19 +108,85 @@ const REQUIRED_SUBCOMMANDS = [
|
||||
* These run without `--lifecycle`, so they are safe against any package.
|
||||
*/
|
||||
const STOPPED_DESTRUCTIVE_PROBES = [
|
||||
{ name: "calls_clear_preview", args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111"] },
|
||||
{ name: "calls_clear_apply", args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111", "--confirm"] },
|
||||
{ name: "calls_clear_all_apply", args: ["calls", "clear", "--all", "--confirm"] },
|
||||
{ name: "import_file_commit_apply", args: ["import-file", "commit", "22222222-2222-4222-8222-222222222222", "--confirm"] },
|
||||
{ name: "import_file_discard_apply", args: ["import-file", "discard", "22222222-2222-4222-8222-222222222222", "--confirm"] },
|
||||
{ name: "notes_process_apply", args: ["notes", "process", "33333333-3333-4333-8333-333333333333", "--confirm"] },
|
||||
{
|
||||
name: "calls_clear_preview",
|
||||
args: ["calls", "clear", "--event", "11111111-1111-4111-8111-111111111111"],
|
||||
},
|
||||
{
|
||||
name: "calls_clear_apply",
|
||||
args: [
|
||||
"calls",
|
||||
"clear",
|
||||
"--event",
|
||||
"11111111-1111-4111-8111-111111111111",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "calls_clear_all_apply",
|
||||
args: ["calls", "clear", "--all", "--confirm"],
|
||||
},
|
||||
{
|
||||
name: "import_file_commit_apply",
|
||||
args: [
|
||||
"import-file",
|
||||
"commit",
|
||||
"22222222-2222-4222-8222-222222222222",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "import_file_discard_apply",
|
||||
args: [
|
||||
"import-file",
|
||||
"discard",
|
||||
"22222222-2222-4222-8222-222222222222",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "notes_process_apply",
|
||||
args: [
|
||||
"notes",
|
||||
"process",
|
||||
"33333333-3333-4333-8333-333333333333",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
{ name: "permission_allow", args: ["permission", "allow"] },
|
||||
{ name: "permission_deny", args: ["permission", "deny"] },
|
||||
{ name: "extraction_set_apply", args: ["extraction", "set", "--window", "6m", "--confirm"] },
|
||||
{ name: "graph_width_apply", args: ["graph", "width", "--decision", "keep_existing", "--confirm"] },
|
||||
{ name: "processing_extract_apply", args: ["processing", "extract", "--confirm"] },
|
||||
{ name: "models_activate_apply", args: ["models", "activate", "44444444-4444-4444-8444-444444444444", "--confirm"] },
|
||||
{ name: "models_edit_apply", args: ["models", "edit", "44444444-4444-4444-8444-444444444444", "--config-file", "/nonexistent/patch.json", "--confirm"] },
|
||||
{
|
||||
name: "extraction_set_apply",
|
||||
args: ["extraction", "set", "--window", "6m", "--confirm"],
|
||||
},
|
||||
{
|
||||
name: "graph_width_apply",
|
||||
args: ["graph", "width", "--decision", "keep_existing", "--confirm"],
|
||||
},
|
||||
{
|
||||
name: "processing_extract_apply",
|
||||
args: ["processing", "extract", "--confirm"],
|
||||
},
|
||||
{
|
||||
name: "models_activate_apply",
|
||||
args: [
|
||||
"models",
|
||||
"activate",
|
||||
"44444444-4444-4444-8444-444444444444",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "models_edit_apply",
|
||||
args: [
|
||||
"models",
|
||||
"edit",
|
||||
"44444444-4444-4444-8444-444444444444",
|
||||
"--config-file",
|
||||
"/nonexistent/patch.json",
|
||||
"--confirm",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function validateCatalog(document) {
|
||||
@@ -201,7 +263,9 @@ export async function runPackageMatrix(runtimeDist, options = {}) {
|
||||
const markers = REQUIRED_MARKERS.filter(
|
||||
(marker) => !bundle.toString("utf8").includes(marker),
|
||||
);
|
||||
const isolatedRoot = await mkdtemp(path.join(tmpdir(), "memhub-package-matrix-"));
|
||||
const isolatedRoot = await mkdtemp(
|
||||
path.join(tmpdir(), "memhub-package-matrix-"),
|
||||
);
|
||||
const home = path.join(isolatedRoot, "home");
|
||||
const dataDir = path.join(isolatedRoot, "data");
|
||||
const hostHome = path.join(isolatedRoot, "host-home");
|
||||
@@ -343,7 +407,10 @@ async function runStoppedDestructive(node, cli, environment) {
|
||||
`${probe.name} exit ${result.code}, expected 3 while Runtime is stopped`,
|
||||
);
|
||||
}
|
||||
if (document?.state !== "unknown" || document?.code !== "runtime_not_running") {
|
||||
if (
|
||||
document?.state !== "unknown" ||
|
||||
document?.code !== "runtime_not_running"
|
||||
) {
|
||||
failures.push(
|
||||
`${probe.name} did not fail closed with unknown/runtime_not_running`,
|
||||
);
|
||||
@@ -451,8 +518,7 @@ async function main() {
|
||||
}
|
||||
const asJson = rest.includes("--json");
|
||||
const expectShaIndex = rest.indexOf("--expect-sha");
|
||||
const expectSha =
|
||||
expectShaIndex >= 0 ? rest[expectShaIndex + 1] : undefined;
|
||||
const expectSha = expectShaIndex >= 0 ? rest[expectShaIndex + 1] : undefined;
|
||||
if (expectSha !== undefined && !/^[0-9a-fA-F]{64}$/.test(expectSha)) {
|
||||
process.stderr.write("--expect-sha must be a 64-character SHA-256\n");
|
||||
process.exitCode = 2;
|
||||
|
||||
@@ -30,12 +30,16 @@ describe("managed restore over HTTP", { timeout: 15_000 }, () => {
|
||||
}
|
||||
if (request.headers.authorization === "Bearer r409") {
|
||||
response.statusCode = 409;
|
||||
response.end(JSON.stringify({ detail: "backup_restore_runtime_running" }));
|
||||
response.end(
|
||||
JSON.stringify({ detail: "backup_restore_runtime_running" }),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (request.headers.authorization === "Bearer r422") {
|
||||
response.statusCode = 422;
|
||||
response.end(JSON.stringify({ detail: "backup_restore_source_outside_home" }));
|
||||
response.end(
|
||||
JSON.stringify({ detail: "backup_restore_source_outside_home" }),
|
||||
);
|
||||
return;
|
||||
}
|
||||
response.end(
|
||||
@@ -48,9 +52,12 @@ describe("managed restore over HTTP", { timeout: 15_000 }, () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
||||
await new Promise<void>((resolve) =>
|
||||
server.listen(0, "127.0.0.1", resolve),
|
||||
);
|
||||
const address = server.address();
|
||||
if (address === null || typeof address === "string") throw new Error("no port");
|
||||
if (address === null || typeof address === "string")
|
||||
throw new Error("no port");
|
||||
port = address.port;
|
||||
});
|
||||
|
||||
@@ -137,8 +144,18 @@ describe("maintenance Core identity", { timeout: 15_000 }, () => {
|
||||
|
||||
it("rejects a squatter, wrong service, wrong instance, and non-200", async () => {
|
||||
const cases = [
|
||||
{ status: 200, data: { status: "ok", service: "other", instance_id: "x" } },
|
||||
{ status: 200, data: { status: "ok", service: "one-memory-core", instance_id: "wrong" } },
|
||||
{
|
||||
status: 200,
|
||||
data: { status: "ok", service: "other", instance_id: "x" },
|
||||
},
|
||||
{
|
||||
status: 200,
|
||||
data: {
|
||||
status: "ok",
|
||||
service: "one-memory-core",
|
||||
instance_id: "wrong",
|
||||
},
|
||||
},
|
||||
{ status: 503, data: {} },
|
||||
{ status: 200, data: null },
|
||||
];
|
||||
|
||||
@@ -91,7 +91,8 @@ export async function callRestore(
|
||||
source: string,
|
||||
request: typeof defaultPost = defaultPost,
|
||||
): Promise<
|
||||
{ state: "restored"; result: RestoreResult } | { state: "rejected"; code: string }
|
||||
| { state: "restored"; result: RestoreResult }
|
||||
| { state: "rejected"; code: string }
|
||||
> {
|
||||
const response = await request(
|
||||
`http://${options.host}:${options.port}/api/v1/backup/restore`,
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { CoreReader, ReadOutcome } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
import {
|
||||
batchScanExitCode,
|
||||
executeBatchImport,
|
||||
planBatchImport,
|
||||
renderBatchScanText,
|
||||
} from "./batch-import-flow.js";
|
||||
import type { CoreReader, ReadOutcome } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
|
||||
function readerFor(catalog: unknown): CoreReader {
|
||||
return (async (path: string) =>
|
||||
path === "/api/v1/sources"
|
||||
? ({ state: "ok", data: catalog } as ReadOutcome<unknown>)
|
||||
: ({ state: "not_found", code: "http_404" } as ReadOutcome<unknown>)) as CoreReader;
|
||||
: ({
|
||||
state: "not_found",
|
||||
code: "http_404",
|
||||
} as ReadOutcome<unknown>)) as CoreReader;
|
||||
}
|
||||
|
||||
function found(source_id: string, extra: Record<string, unknown> = {}) {
|
||||
@@ -81,18 +83,36 @@ describe("A19 batch execution", () => {
|
||||
readerFor([found("codex"), found("cursor")]),
|
||||
);
|
||||
if (planned.state !== "preview") throw new Error("expected preview");
|
||||
const post = vi.fn(async (_path: string, body: Record<string, unknown>) => ({
|
||||
state: "committed" as const,
|
||||
data: {
|
||||
request_id: body.request_id,
|
||||
accepted_source_ids: ["codex", "cursor"],
|
||||
failed_sources: {},
|
||||
jobs: [
|
||||
{ job_id: "j1", source_id: "codex", status: "pending", discovered: 3, stored: 3, errors: 0, operation: "history" },
|
||||
{ job_id: "j2", source_id: "cursor", status: "pending", discovered: 5, stored: 5, errors: 0, operation: "history" },
|
||||
],
|
||||
},
|
||||
}));
|
||||
const post = vi.fn(
|
||||
async (_path: string, body: Record<string, unknown>) => ({
|
||||
state: "committed" as const,
|
||||
data: {
|
||||
request_id: body.request_id,
|
||||
accepted_source_ids: ["codex", "cursor"],
|
||||
failed_sources: {},
|
||||
jobs: [
|
||||
{
|
||||
job_id: "j1",
|
||||
source_id: "codex",
|
||||
status: "pending",
|
||||
discovered: 3,
|
||||
stored: 3,
|
||||
errors: 0,
|
||||
operation: "history",
|
||||
},
|
||||
{
|
||||
job_id: "j2",
|
||||
source_id: "cursor",
|
||||
status: "pending",
|
||||
discovered: 5,
|
||||
stored: 5,
|
||||
errors: 0,
|
||||
operation: "history",
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
const operations = { post } as unknown as CoreOperations;
|
||||
const document = await executeBatchImport(
|
||||
planned.candidates,
|
||||
@@ -127,7 +147,15 @@ describe("A19 batch execution", () => {
|
||||
accepted_source_ids: ["codex"],
|
||||
failed_sources: { cursor: "source_identity_changed" },
|
||||
jobs: [
|
||||
{ job_id: "j1", source_id: "codex", status: "pending", discovered: 1, stored: 1, errors: 0, operation: "history" },
|
||||
{
|
||||
job_id: "j1",
|
||||
source_id: "codex",
|
||||
status: "pending",
|
||||
discovered: 1,
|
||||
stored: 1,
|
||||
errors: 0,
|
||||
operation: "history",
|
||||
},
|
||||
],
|
||||
},
|
||||
})),
|
||||
@@ -242,7 +270,15 @@ describe("A19 batch execution", () => {
|
||||
accepted_source_ids: ["codex"],
|
||||
failed_sources: {},
|
||||
jobs: [
|
||||
{ job_id: "j1", source_id: "codex", status: "pending", discovered: 1, stored: 1, errors: 0, operation: "history" },
|
||||
{
|
||||
job_id: "j1",
|
||||
source_id: "codex",
|
||||
status: "pending",
|
||||
discovered: 1,
|
||||
stored: 1,
|
||||
errors: 0,
|
||||
operation: "history",
|
||||
},
|
||||
],
|
||||
},
|
||||
})),
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
*/
|
||||
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { buildSourceImportRequest } from "@one-memory/operations";
|
||||
|
||||
import type { ImportJob } from "@one-memory/contracts";
|
||||
import { buildSourceImportRequest } from "@one-memory/operations";
|
||||
import type { CoreReader } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
import {
|
||||
type SourceConnectionCandidate,
|
||||
validateSourceConnectionCandidates,
|
||||
} from "./core-responses.js";
|
||||
import type { CoreReader } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
import { PRODUCT } from "./version.js";
|
||||
|
||||
export interface BatchSourceRow {
|
||||
@@ -57,19 +56,34 @@ export function detectedSourceIds(
|
||||
return candidates.map((candidate) => candidate.source_id);
|
||||
}
|
||||
|
||||
export async function planBatchImport(
|
||||
reader: CoreReader,
|
||||
): Promise<
|
||||
| { state: "preview"; candidates: SourceConnectionCandidate[]; rows: BatchSourceRow[]; notFound: string[] }
|
||||
| { state: "rejected" | "unknown" | "no_sources"; code: string; notFound: string[] }
|
||||
export async function planBatchImport(reader: CoreReader): Promise<
|
||||
| {
|
||||
state: "preview";
|
||||
candidates: SourceConnectionCandidate[];
|
||||
rows: BatchSourceRow[];
|
||||
notFound: string[];
|
||||
}
|
||||
| {
|
||||
state: "rejected" | "unknown" | "no_sources";
|
||||
code: string;
|
||||
notFound: string[];
|
||||
}
|
||||
> {
|
||||
const outcome = await reader<unknown>("/api/v1/sources");
|
||||
if (outcome.state !== "ok") {
|
||||
return { state: outcome.state === "unavailable" ? "unknown" : "rejected", code: outcome.code, notFound: [] };
|
||||
return {
|
||||
state: outcome.state === "unavailable" ? "unknown" : "rejected",
|
||||
code: outcome.code,
|
||||
notFound: [],
|
||||
};
|
||||
}
|
||||
const catalog = outcome.data;
|
||||
if (!Array.isArray(catalog) || catalog.length > SOURCE_LIST_LIMIT) {
|
||||
return { state: "rejected", code: "sources_response_invalid", notFound: [] };
|
||||
return {
|
||||
state: "rejected",
|
||||
code: "sources_response_invalid",
|
||||
notFound: [],
|
||||
};
|
||||
}
|
||||
const candidates = validateSourceConnectionCandidates(catalog);
|
||||
if (!candidates) {
|
||||
@@ -165,9 +179,7 @@ export async function executeBatchImport(
|
||||
receipt.failed_sources && typeof receipt.failed_sources === "object"
|
||||
? (receipt.failed_sources as Record<string, string>)
|
||||
: {};
|
||||
const jobs = Array.isArray(receipt.jobs)
|
||||
? (receipt.jobs as ImportJob[])
|
||||
: [];
|
||||
const jobs = Array.isArray(receipt.jobs) ? (receipt.jobs as ImportJob[]) : [];
|
||||
const firstSeen = jobs.map((job) => ({
|
||||
source_id: job.source_id,
|
||||
discovered: job.discovered,
|
||||
@@ -262,7 +274,8 @@ export async function executeBatchImport(
|
||||
}
|
||||
|
||||
export function batchScanExitCode(document: BatchScanDocument): number {
|
||||
if (document.state === "committed" || document.state === "no_sources") return 0;
|
||||
if (document.state === "committed" || document.state === "no_sources")
|
||||
return 0;
|
||||
if (document.state === "partial") return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -282,11 +282,7 @@ export const COMMANDS: readonly CommandDescriptor[] = [
|
||||
summary: "列出来源、执行已确认的导入计划。",
|
||||
usage:
|
||||
"memhub sources list [--json]\n memhub sources import --plan-file <path> --confirm [--json]\n memhub sources receipt <request-id> [--json]",
|
||||
options: [
|
||||
PLAN_FILE_OPTION,
|
||||
EXPLICIT_CONFIRM_OPTION,
|
||||
JSON_OPTION,
|
||||
],
|
||||
options: [PLAN_FILE_OPTION, EXPLICIT_CONFIRM_OPTION, JSON_OPTION],
|
||||
exit_codes: [EXIT_OK, EXIT_FAILED, EXIT_USAGE, EXIT_RUNTIME_STOPPED],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -300,11 +300,7 @@ describe("CLI-22 shared output contract", () => {
|
||||
`${PRODUCT} sync`,
|
||||
],
|
||||
[
|
||||
[
|
||||
"sync",
|
||||
"receipt",
|
||||
"123e4567-e89b-12d3-a456-426614174000",
|
||||
],
|
||||
["sync", "receipt", "123e4567-e89b-12d3-a456-426614174000"],
|
||||
`${PRODUCT} sync`,
|
||||
],
|
||||
[["sync", "pause", "--source"], `${PRODUCT} sync`],
|
||||
@@ -555,12 +551,7 @@ describe("documented commands", () => {
|
||||
// Source processing is one Freeze/Thaw switch under `sync`; the obsolete
|
||||
// independent read/write `sources access` command must not return here.
|
||||
sources: ["list", "import", "receipt"],
|
||||
jobs: [
|
||||
"list",
|
||||
"show",
|
||||
"start",
|
||||
"<pause|resume|cancel>",
|
||||
],
|
||||
jobs: ["list", "show", "start", "<pause|resume|cancel>"],
|
||||
// `sync <pause|resume>` is documented as one alternation, so it is
|
||||
// checked as an entry rather than as two literal subcommands.
|
||||
sync: ["status", "<pause|resume>"],
|
||||
|
||||
@@ -342,17 +342,20 @@ describe("unified context search", () => {
|
||||
["--limit", "1", "2"],
|
||||
["--character-budget", "200", "300"],
|
||||
["--timeout-ms", "100", "200"],
|
||||
])("rejects a repeated %s before Runtime attach", async (flag, first, second) => {
|
||||
const streams = captureStreams();
|
||||
try {
|
||||
expect(
|
||||
await run(["recall", "q", flag, first, flag, second, "--json"], {}),
|
||||
).toBe(2);
|
||||
} finally {
|
||||
streams.restore();
|
||||
}
|
||||
expect(streams.stdout()).toBe("");
|
||||
});
|
||||
])(
|
||||
"rejects a repeated %s before Runtime attach",
|
||||
async (flag, first, second) => {
|
||||
const streams = captureStreams();
|
||||
try {
|
||||
expect(
|
||||
await run(["recall", "q", flag, first, flag, second, "--json"], {}),
|
||||
).toBe(2);
|
||||
} finally {
|
||||
streams.restore();
|
||||
}
|
||||
expect(streams.stdout()).toBe("");
|
||||
},
|
||||
);
|
||||
|
||||
it("refuses malformed success bodies instead of leaking nested values", async () => {
|
||||
transport.post.mockResolvedValue({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import axios from "axios";
|
||||
import { classifyModelRemove } from "@one-memory/operations";
|
||||
import axios from "axios";
|
||||
|
||||
/**
|
||||
* Only paths proven side-effect free by reading the Core handlers belong here.
|
||||
@@ -56,7 +56,10 @@ export function createUiSessionRequest(attachment: {
|
||||
return { state: "ok" as const, data: response.data };
|
||||
}
|
||||
if (response.status === 503) {
|
||||
return { state: "unavailable" as const, code: "ui_web_assets_unavailable" };
|
||||
return {
|
||||
state: "unavailable" as const,
|
||||
code: "ui_web_assets_unavailable",
|
||||
};
|
||||
}
|
||||
return { state: "unavailable" as const, code: `http_${response.status}` };
|
||||
};
|
||||
@@ -397,18 +400,23 @@ export async function readMemoryWrite(
|
||||
|
||||
export async function readScanRoots(
|
||||
attachment: RuntimeAttachmentLike,
|
||||
): Promise<{ schema_version: number; revision: number; roots: unknown[] } | null> {
|
||||
): Promise<{
|
||||
schema_version: number;
|
||||
revision: number;
|
||||
roots: unknown[];
|
||||
} | null> {
|
||||
try {
|
||||
const response = await axios.get<{ schema_version: number; revision: number; roots: unknown[] }>(
|
||||
`${baseUrlOf(attachment)}/api/v1/scan-roots`,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
},
|
||||
);
|
||||
const response = await axios.get<{
|
||||
schema_version: number;
|
||||
revision: number;
|
||||
roots: unknown[];
|
||||
}>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, {
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
});
|
||||
return response.data;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -420,13 +428,17 @@ export async function addScanRoot(
|
||||
body: { root: string; source?: string; recursive?: boolean },
|
||||
): Promise<unknown | null> {
|
||||
try {
|
||||
const response = await axios.post<unknown>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, body, {
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
});
|
||||
const response = await axios.post<unknown>(
|
||||
`${baseUrlOf(attachment)}/api/v1/scan-roots`,
|
||||
body,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
},
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
return { _error: error instanceof Error ? error.message : String(error) };
|
||||
@@ -438,14 +450,17 @@ export async function removeScanRoot(
|
||||
body: { root: string },
|
||||
): Promise<unknown | null> {
|
||||
try {
|
||||
const response = await axios.delete<unknown>(`${baseUrlOf(attachment)}/api/v1/scan-roots`, {
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
data: body,
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
});
|
||||
const response = await axios.delete<unknown>(
|
||||
`${baseUrlOf(attachment)}/api/v1/scan-roots`,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
data: body,
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
},
|
||||
);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
return { _error: error instanceof Error ? error.message : String(error) };
|
||||
@@ -456,16 +471,16 @@ export async function readAdapters(
|
||||
attachment: RuntimeAttachmentLike,
|
||||
): Promise<{ schema_version: number; adapters: unknown[] } | null> {
|
||||
try {
|
||||
const response = await axios.get<{ schema_version: number; adapters: unknown[] }>(
|
||||
`${baseUrlOf(attachment)}/api/v1/adapters`,
|
||||
{
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
},
|
||||
);
|
||||
const response = await axios.get<{
|
||||
schema_version: number;
|
||||
adapters: unknown[];
|
||||
}>(`${baseUrlOf(attachment)}/api/v1/adapters`, {
|
||||
headers: { Authorization: `Bearer ${attachment.apiToken}` },
|
||||
timeout: 10_000,
|
||||
proxy: false,
|
||||
maxRedirects: 0,
|
||||
maxContentLength: MAX_RESPONSE_BYTES,
|
||||
});
|
||||
return response.data;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdtemp, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
||||
import { mkdir, mkdtemp, readFile, stat, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
@@ -23,14 +23,22 @@ describe("explicit data deletion", () => {
|
||||
"one-memory.sqlite3": "db",
|
||||
"runtime-service.json": "{}",
|
||||
});
|
||||
const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
|
||||
const plan = await planDataDeletion({
|
||||
dataDir,
|
||||
home,
|
||||
runtimeRunning: false,
|
||||
});
|
||||
expect(plan.state).toBe("preview");
|
||||
expect(plan.entries).toContain(path.join(dataDir, "one-memory.sqlite3"));
|
||||
});
|
||||
|
||||
it("refuses while the Runtime is still running", async () => {
|
||||
const { home, dataDir } = await homeWith();
|
||||
const plan = await planDataDeletion({ dataDir, home, runtimeRunning: true });
|
||||
const plan = await planDataDeletion({
|
||||
dataDir,
|
||||
home,
|
||||
runtimeRunning: true,
|
||||
});
|
||||
expect(plan).toMatchObject({
|
||||
state: "blocked",
|
||||
code: "runtime_still_running",
|
||||
@@ -66,16 +74,23 @@ describe("explicit data deletion", () => {
|
||||
home,
|
||||
runtimeRunning: false,
|
||||
});
|
||||
expect(plan).toMatchObject({ state: "blocked", code: "data_dir_refused" });
|
||||
expect(plan).toMatchObject({
|
||||
state: "blocked",
|
||||
code: "data_dir_refused",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("requires the second confirmation to name the exact directory", async () => {
|
||||
const { home, dataDir } = await homeWith();
|
||||
const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
|
||||
await expect(applyDataDeletion(plan, path.join(home, "other"))).rejects.toThrow(
|
||||
"data_deletion_confirmation_mismatch",
|
||||
);
|
||||
const plan = await planDataDeletion({
|
||||
dataDir,
|
||||
home,
|
||||
runtimeRunning: false,
|
||||
});
|
||||
await expect(
|
||||
applyDataDeletion(plan, path.join(home, "other")),
|
||||
).rejects.toThrow("data_deletion_confirmation_mismatch");
|
||||
// The data survived a mismatched confirmation.
|
||||
await expect(
|
||||
stat(path.join(dataDir, "one-memory.sqlite3")),
|
||||
@@ -84,7 +99,11 @@ describe("explicit data deletion", () => {
|
||||
|
||||
it("deletes an owned Home only when both confirmations match", async () => {
|
||||
const { home, dataDir } = await homeWith({ "one-memory.sqlite3": "db" });
|
||||
const plan = await planDataDeletion({ dataDir, home, runtimeRunning: false });
|
||||
const plan = await planDataDeletion({
|
||||
dataDir,
|
||||
home,
|
||||
runtimeRunning: false,
|
||||
});
|
||||
const receipt = await applyDataDeletion(plan, dataDir);
|
||||
expect(receipt.state).toBe("deleted");
|
||||
await expect(stat(dataDir)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
|
||||
@@ -68,7 +68,8 @@ export function renderDoctorText(document: DoctorDocument): string {
|
||||
return [
|
||||
`MemHub 检查:${doctorState(document.state)}`,
|
||||
...document.checks.map(
|
||||
(check) => `${symbol(check.state)} ${labels[check.id]}:${checkState(check.state)}`,
|
||||
(check) =>
|
||||
`${symbol(check.state)} ${labels[check.id]}:${checkState(check.state)}`,
|
||||
),
|
||||
...(document.state === "healthy"
|
||||
? []
|
||||
|
||||
@@ -28,11 +28,7 @@ export function resolveEntryDiagnostics(input: {
|
||||
// comparison would misread that as isolated and silently drop diagnostics.
|
||||
const home = resolve(input.home);
|
||||
const accountHome = resolve(input.accountHome);
|
||||
if (
|
||||
home === undefined ||
|
||||
accountHome === undefined ||
|
||||
home === accountHome
|
||||
) {
|
||||
if (home === undefined || accountHome === undefined || home === accountHome) {
|
||||
return { kind: "log" };
|
||||
}
|
||||
// Isolated HOME with no explicit data dir: the fallback path would write
|
||||
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
resolveRuntimeCliConfig,
|
||||
} from "@one-memory/runtime-control";
|
||||
import { run } from "./cli.js";
|
||||
import { resolveDiagnosticsDataDir } from "./install-receipt.js";
|
||||
import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
|
||||
import { resolveDiagnosticsDataDir } from "./install-receipt.js";
|
||||
|
||||
function accountHomeDirectory(): string | undefined {
|
||||
try {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import type { ImportJob, ModelProfile } from "@one-memory/contracts";
|
||||
import {
|
||||
ModelProfileInputError,
|
||||
SourceImportInputError,
|
||||
buildModelProfileCreateRequest,
|
||||
buildSourceImportRequest,
|
||||
ModelProfileInputError,
|
||||
parseModelProfileReceipt,
|
||||
SourceImportInputError,
|
||||
} from "@one-memory/operations";
|
||||
import type { ImportJob, ModelProfile } from "@one-memory/contracts";
|
||||
import type { CoreReader, ReadOutcome } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
import {
|
||||
@@ -117,9 +117,7 @@ function classifySourceImport(
|
||||
product: PRODUCT,
|
||||
state: "rejected",
|
||||
operation_id: operationId,
|
||||
code: onlyBusy
|
||||
? "source_import_all_busy"
|
||||
: "source_import_all_rejected",
|
||||
code: onlyBusy ? "source_import_all_busy" : "source_import_all_rejected",
|
||||
receipt,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -266,7 +266,9 @@ export function renderHostText(document: HostFlowDocument): string {
|
||||
}
|
||||
if (review.length > 12) lines.push(` … 另有 ${review.length - 12} 处`);
|
||||
lines.push("");
|
||||
lines.push("这些不是我们安装的内容,卸载不会替你删除;需自行处理后才能卸载。");
|
||||
lines.push(
|
||||
"这些不是我们安装的内容,卸载不会替你删除;需自行处理后才能卸载。",
|
||||
);
|
||||
}
|
||||
}
|
||||
return `${lines.join("\n")}\n`;
|
||||
|
||||
@@ -7,7 +7,9 @@ import {
|
||||
type WizardPrompter,
|
||||
} from "./init-wizard.js";
|
||||
|
||||
function scripted(lines: string[]): WizardPrompter & { asked: string[]; wrote: string[] } {
|
||||
function scripted(
|
||||
lines: string[],
|
||||
): WizardPrompter & { asked: string[]; wrote: string[] } {
|
||||
let index = 0;
|
||||
const asked: string[] = [];
|
||||
const wrote: string[] = [];
|
||||
|
||||
@@ -99,8 +99,7 @@ export async function runInitWizard(
|
||||
"开启处理?开启后会处理历史未完成会话并持续接收新会话;输入 n 保持冻结。[Y/n]: ",
|
||||
);
|
||||
const processing = parseYesNo(processingAnswer, true);
|
||||
if (processing === null)
|
||||
return { state: "invalid", code: "invalid_answer" };
|
||||
if (processing === null) return { state: "invalid", code: "invalid_answer" };
|
||||
|
||||
return {
|
||||
state: "answered",
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
readdir,
|
||||
readFile,
|
||||
rm,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
|
||||
import {
|
||||
defaultInstallReceiptPath,
|
||||
readInstallReceipt,
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
resolveInstalledDataDir,
|
||||
writeInstallReceipt,
|
||||
} from "./install-receipt.js";
|
||||
import { resolveEntryDiagnostics } from "./entry-diagnostics.js";
|
||||
|
||||
async function root(): Promise<string> {
|
||||
return mkdtemp(path.join(tmpdir(), "memhub-install-receipt-"));
|
||||
@@ -230,9 +229,9 @@ describe("managed install receipt", () => {
|
||||
}),
|
||||
).toBe("/tmp/env data");
|
||||
// Receipt beats default.
|
||||
expect(
|
||||
await resolveDiagnosticsDataDir(["install"], { HOME: home }),
|
||||
).toBe(path.join(home, "receipt data"));
|
||||
expect(await resolveDiagnosticsDataDir(["install"], { HOME: home })).toBe(
|
||||
path.join(home, "receipt data"),
|
||||
);
|
||||
// Invalid explicit flag must not silently fall back to the receipt.
|
||||
expect(
|
||||
await resolveDiagnosticsDataDir(
|
||||
|
||||
@@ -184,10 +184,9 @@ describe("interactive model setup", () => {
|
||||
embedding_provider_kind: "local_onnx",
|
||||
}),
|
||||
);
|
||||
expect(api.post).toHaveBeenCalledWith(
|
||||
"/api/v1/model-content-permission",
|
||||
{ allowed: true },
|
||||
);
|
||||
expect(api.post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
|
||||
allowed: true,
|
||||
});
|
||||
expect(prompt.written.join("\n")).not.toContain("sk-do-not-print");
|
||||
});
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ import {
|
||||
} from "./headless-flows.js";
|
||||
import { approvalFingerprint, listHosts, readHost } from "./host-flow.js";
|
||||
import { parseSelection, type WizardPrompter } from "./init-wizard.js";
|
||||
import { setModelContentPermission } from "./model-content-permission-flow.js";
|
||||
import { executeModelProbe, planModelProbe } from "./model-probe-flow.js";
|
||||
import {
|
||||
executeModelProfileActivate,
|
||||
planModelProfileActivate,
|
||||
} from "./model-write-flows.js";
|
||||
import { setModelContentPermission } from "./model-content-permission-flow.js";
|
||||
|
||||
type ProviderPreset = {
|
||||
id: string;
|
||||
|
||||
@@ -17,6 +17,7 @@ vi.mock("axios", () => ({
|
||||
default: { create: vi.fn(() => transport), get: vi.fn() },
|
||||
}));
|
||||
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
import { createCoreOperations } from "./core-operations.js";
|
||||
import {
|
||||
executeJobAction,
|
||||
@@ -25,7 +26,6 @@ import {
|
||||
planJobAction,
|
||||
planJobStart,
|
||||
} from "./job-flow.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
|
||||
function operations(
|
||||
post: (path: string, body: Record<string, unknown>) => Promise<unknown>,
|
||||
|
||||
@@ -145,9 +145,7 @@ function jobMutationResult(
|
||||
export function jobExitCode(document: JobFlowDocument): number {
|
||||
if (document.state === "preview" || document.state === "committed") return 0;
|
||||
if (document.state === "recovered") return 0;
|
||||
return document.state === "rejected" || document.state === "unknown"
|
||||
? 1
|
||||
: 2;
|
||||
return document.state === "rejected" || document.state === "unknown" ? 1 : 2;
|
||||
}
|
||||
|
||||
function invalid(code: string): JobFlowDocument {
|
||||
|
||||
@@ -105,10 +105,7 @@ describe("memhub jobs", () => {
|
||||
const output = captureStdout();
|
||||
let code: number;
|
||||
try {
|
||||
code = await run(
|
||||
["jobs", "start", "--source", "codex", "--json"],
|
||||
{},
|
||||
);
|
||||
code = await run(["jobs", "start", "--source", "codex", "--json"], {});
|
||||
} finally {
|
||||
output.restore();
|
||||
}
|
||||
@@ -154,10 +151,7 @@ describe("memhub jobs", () => {
|
||||
const output = captureStdout();
|
||||
let code: number;
|
||||
try {
|
||||
code = await run(
|
||||
["jobs", action, "--job", "job-1", "--json"],
|
||||
{},
|
||||
);
|
||||
code = await run(["jobs", action, "--job", "job-1", "--json"], {});
|
||||
} finally {
|
||||
output.restore();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import type { DiagnosticEventV1 } from "@one-memory/runtime-control";
|
||||
import { diagnosticLogFiles, readDiagnosticEvents } from "@one-memory/runtime-control";
|
||||
import { lstat } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { DiagnosticEventV1 } from "@one-memory/runtime-control";
|
||||
import {
|
||||
diagnosticLogFiles,
|
||||
readDiagnosticEvents,
|
||||
} from "@one-memory/runtime-control";
|
||||
|
||||
export interface LogQuery {
|
||||
since?: Date;
|
||||
@@ -160,10 +163,21 @@ export async function readLogReport(
|
||||
const logsDirectory = path.join(path.resolve(dataDir), "logs");
|
||||
const info = await lstat(logsDirectory).catch(() => null);
|
||||
if (info !== null && (!info.isDirectory() || info.isSymbolicLink())) {
|
||||
return { events: [], invalid_lines: 0, failure: "log_directory_unreadable" };
|
||||
return {
|
||||
events: [],
|
||||
invalid_lines: 0,
|
||||
failure: "log_directory_unreadable",
|
||||
};
|
||||
}
|
||||
if (info !== null && (await diagnosticLogFiles(dataDir).catch(() => null)) === null) {
|
||||
return { events: [], invalid_lines: 0, failure: "log_directory_unreadable" };
|
||||
if (
|
||||
info !== null &&
|
||||
(await diagnosticLogFiles(dataDir).catch(() => null)) === null
|
||||
) {
|
||||
return {
|
||||
events: [],
|
||||
invalid_lines: 0,
|
||||
failure: "log_directory_unreadable",
|
||||
};
|
||||
}
|
||||
const explicit =
|
||||
query.since ||
|
||||
@@ -239,15 +253,27 @@ export function redactDiagnosticEvent(
|
||||
outcome: event.outcome,
|
||||
session_id: event.session_id,
|
||||
...(event.trace_id === undefined ? {} : { trace_id: event.trace_id }),
|
||||
...(event.incident_id === undefined ? {} : { incident_id: event.incident_id }),
|
||||
...(event.instance_id === undefined ? {} : { instance_id: event.instance_id }),
|
||||
...(event.operation_id === undefined ? {} : { operation_id: event.operation_id }),
|
||||
...(event.incident_id === undefined
|
||||
? {}
|
||||
: { incident_id: event.incident_id }),
|
||||
...(event.instance_id === undefined
|
||||
? {}
|
||||
: { instance_id: event.instance_id }),
|
||||
...(event.operation_id === undefined
|
||||
? {}
|
||||
: { operation_id: event.operation_id }),
|
||||
...(event.request_id === undefined ? {} : { request_id: event.request_id }),
|
||||
...(event.job_id === undefined ? {} : { job_id: event.job_id }),
|
||||
...(event.task_id === undefined ? {} : { task_id: event.task_id }),
|
||||
...(event.duration_ms === undefined ? {} : { duration_ms: event.duration_ms }),
|
||||
...(event.state_before === undefined ? {} : { state_before: event.state_before }),
|
||||
...(event.state_after === undefined ? {} : { state_after: event.state_after }),
|
||||
...(event.duration_ms === undefined
|
||||
? {}
|
||||
: { duration_ms: event.duration_ms }),
|
||||
...(event.state_before === undefined
|
||||
? {}
|
||||
: { state_before: event.state_before }),
|
||||
...(event.state_after === undefined
|
||||
? {}
|
||||
: { state_after: event.state_after }),
|
||||
...(event.error_code === undefined ? {} : { error_code: event.error_code }),
|
||||
...(event.error_type === undefined ? {} : { error_type: event.error_type }),
|
||||
...(event.safe_stack === undefined
|
||||
|
||||
@@ -11,9 +11,8 @@ import {
|
||||
} from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import type { CliLinkPlan } from "@one-memory/runtime-control";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
installManagedCliAlias,
|
||||
installManagedCliLink,
|
||||
@@ -107,7 +106,9 @@ describe("managed memhub CLI alias", () => {
|
||||
await installManagedCliAlias(plan);
|
||||
|
||||
await expect(removeManagedCliAlias(plan)).resolves.toBe("removed");
|
||||
await expect(lstat(plan.link_path)).rejects.toMatchObject({ code: "ENOENT" });
|
||||
await expect(lstat(plan.link_path)).rejects.toMatchObject({
|
||||
code: "ENOENT",
|
||||
});
|
||||
});
|
||||
|
||||
// C8 P1 (2026-09-29): `runtime-control.applyLocalUninstall` deletes
|
||||
@@ -156,7 +157,10 @@ describe("managed memhub CLI alias", () => {
|
||||
it("manages the one-memory companion when memhub is already present", async () => {
|
||||
if (process.platform === "win32") return;
|
||||
const f = await fixture();
|
||||
const primary = { ...f.base, link_path: path.join(f.base.bin_directory, "memhub") };
|
||||
const primary = {
|
||||
...f.base,
|
||||
link_path: path.join(f.base.bin_directory, "memhub"),
|
||||
};
|
||||
await mkdir(f.base.bin_directory, { recursive: true, mode: 0o700 });
|
||||
await (await import("node:fs/promises")).chmod(f.base.bin_directory, 0o700);
|
||||
await (await import("node:fs/promises")).symlink(
|
||||
@@ -168,7 +172,10 @@ describe("managed memhub CLI alias", () => {
|
||||
const plan = await planManagedCliLink(f.base, "one-memory");
|
||||
// The companion does not exist yet, so it is ours to create; crucially it
|
||||
// targets the compat name, not the package's `memhub`.
|
||||
expect(plan).toMatchObject({ status: "create", link_path: f.base.link_path });
|
||||
expect(plan).toMatchObject({
|
||||
status: "create",
|
||||
link_path: f.base.link_path,
|
||||
});
|
||||
|
||||
// The package's memhub link is untouched.
|
||||
expect(await readlink(primary.link_path)).toBe(f.target);
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
import { access, chmod, lstat, mkdir, readlink, rm, symlink } from "node:fs/promises";
|
||||
import {
|
||||
access,
|
||||
chmod,
|
||||
lstat,
|
||||
mkdir,
|
||||
readlink,
|
||||
rm,
|
||||
symlink,
|
||||
} from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import type { CliLinkPlan, CliLinkReceipt } from "@one-memory/runtime-control";
|
||||
|
||||
@@ -53,7 +53,9 @@ describe("model content permission CLI", () => {
|
||||
expect(permission.code).toBe(0);
|
||||
expect(permission.stdout).toContain("memhub permission allow");
|
||||
expect(permission.stdout).toContain("memhub permission deny");
|
||||
expect(permission.stdout).not.toMatch(/\b(preview|confirm|process|revoke)\b/);
|
||||
expect(permission.stdout).not.toMatch(
|
||||
/\b(preview|confirm|process|revoke)\b/,
|
||||
);
|
||||
expect(permission.stdout).not.toContain("revision");
|
||||
expect(permission.stdout).not.toContain("receipt");
|
||||
|
||||
|
||||
@@ -23,19 +23,22 @@ describe("model content permission flow", () => {
|
||||
it.each([
|
||||
["allow", true],
|
||||
["deny", false],
|
||||
] as const)("sets %s directly without revision or receipt fields", async (_, allowed) => {
|
||||
const post = vi.fn().mockResolvedValue({
|
||||
state: "committed",
|
||||
data: { allowed },
|
||||
});
|
||||
] as const)(
|
||||
"sets %s directly without revision or receipt fields",
|
||||
async (_, allowed) => {
|
||||
const post = vi.fn().mockResolvedValue({
|
||||
state: "committed",
|
||||
data: { allowed },
|
||||
});
|
||||
|
||||
await expect(
|
||||
setModelContentPermission({ post } as CoreOperations, allowed),
|
||||
).resolves.toMatchObject({ state: "ok", allowed });
|
||||
expect(post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
|
||||
allowed,
|
||||
});
|
||||
});
|
||||
await expect(
|
||||
setModelContentPermission({ post } as CoreOperations, allowed),
|
||||
).resolves.toMatchObject({ state: "ok", allowed });
|
||||
expect(post).toHaveBeenCalledWith("/api/v1/model-content-permission", {
|
||||
allowed,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("does not accept a malformed or mismatched success response", async () => {
|
||||
const malformed = vi.fn().mockResolvedValue({
|
||||
|
||||
@@ -23,7 +23,10 @@ export async function readModelContentPermission(
|
||||
if (outcome.state !== "ok") {
|
||||
return failure("unknown", outcome.code);
|
||||
}
|
||||
return permissionState(outcome.data, "model_content_permission_response_invalid");
|
||||
return permissionState(
|
||||
outcome.data,
|
||||
"model_content_permission_response_invalid",
|
||||
);
|
||||
}
|
||||
|
||||
export async function setModelContentPermission(
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import type { ModelProfile } from "@one-memory/contracts";
|
||||
import {
|
||||
ModelProfileInputError,
|
||||
buildModelProfileUpdateRequest,
|
||||
ModelProfileInputError,
|
||||
parseModelProfileReceipt,
|
||||
} from "@one-memory/operations";
|
||||
import type { CoreOperations, CorePatchOperations } from "./core-operations.js";
|
||||
@@ -78,7 +78,10 @@ function digestOf(value: unknown): string {
|
||||
|
||||
function preview(
|
||||
plan:
|
||||
| Omit<Extract<ModelWritePlan, { kind: "model_profile_activate" }>, "digest">
|
||||
| Omit<
|
||||
Extract<ModelWritePlan, { kind: "model_profile_activate" }>,
|
||||
"digest"
|
||||
>
|
||||
| Omit<Extract<ModelWritePlan, { kind: "model_profile_edit" }>, "digest">,
|
||||
): ModelWriteDocument {
|
||||
return {
|
||||
@@ -198,9 +201,9 @@ export async function executeModelProfileEdit(
|
||||
let request: ReturnType<typeof buildModelProfileUpdateRequest>;
|
||||
try {
|
||||
request = buildModelProfileUpdateRequest(plan.profile_id, {
|
||||
...plan.patch,
|
||||
expected_revision: plan.expected_revision,
|
||||
...(apiKey === undefined ? {} : { api_key: apiKey }),
|
||||
...plan.patch,
|
||||
expected_revision: plan.expected_revision,
|
||||
...(apiKey === undefined ? {} : { api_key: apiKey }),
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof ModelProfileInputError) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdtemp, readFile, writeFile } from "node:fs/promises";
|
||||
import { tmpdir, homedir } from "node:os";
|
||||
import { homedir, tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { existsSync } from "node:fs";
|
||||
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
||||
import { mkdtemp, readdir, readFile, rm } from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
@@ -103,26 +103,45 @@ describe("unknown flags are rejected", () => {
|
||||
});
|
||||
|
||||
it("still accepts the documented verbless scan", () => {
|
||||
expect(parseProductCommand("scan", ["--all", "--yes"])?.plan.all).toBe(true);
|
||||
expect(parseProductCommand("scan", ["--source", "codex"])?.plan.sourceId).toBe(
|
||||
"codex",
|
||||
expect(parseProductCommand("scan", ["--all", "--yes"])?.plan.all).toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
parseProductCommand("scan", ["--source", "codex"])?.plan.sourceId,
|
||||
).toBe("codex");
|
||||
});
|
||||
|
||||
it("rejects flags that the named verb does not consume", () => {
|
||||
// These were accepted and then silently dropped. An operator who typed
|
||||
// `path remove --source codex` would believe the source filter applied.
|
||||
expect(
|
||||
parseProductCommand("path", ["remove", "--root", "/tmp/x", "--source", "codex"]),
|
||||
parseProductCommand("path", [
|
||||
"remove",
|
||||
"--root",
|
||||
"/tmp/x",
|
||||
"--source",
|
||||
"codex",
|
||||
]),
|
||||
).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("path", ["remove", "--root", "/tmp/x", "--no-recursive"]),
|
||||
parseProductCommand("path", [
|
||||
"remove",
|
||||
"--root",
|
||||
"/tmp/x",
|
||||
"--no-recursive",
|
||||
]),
|
||||
).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("path", ["add", "--root", "/tmp/x", "--full"]),
|
||||
).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("backup", ["create", "--target", "/tmp/b", "--source", "/tmp/s"]),
|
||||
parseProductCommand("backup", [
|
||||
"create",
|
||||
"--target",
|
||||
"/tmp/b",
|
||||
"--source",
|
||||
"/tmp/s",
|
||||
]),
|
||||
).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("backup", [
|
||||
@@ -163,9 +182,7 @@ describe("unknown flags are rejected", () => {
|
||||
});
|
||||
|
||||
it("rejects repeated boolean flags instead of treating them as idempotent", () => {
|
||||
expect(
|
||||
parseProductCommand("scan", ["--all", "--all", "--yes"]),
|
||||
).toBeNull();
|
||||
expect(parseProductCommand("scan", ["--all", "--all", "--yes"])).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("scan", ["--full", "--full", "--yes"]),
|
||||
).toBeNull();
|
||||
@@ -179,7 +196,13 @@ describe("unknown flags are rejected", () => {
|
||||
]),
|
||||
).toBeNull();
|
||||
expect(
|
||||
parseProductCommand("backup", ["create", "--target", "/tmp/a", "--yes", "--yes"]),
|
||||
parseProductCommand("backup", [
|
||||
"create",
|
||||
"--target",
|
||||
"/tmp/a",
|
||||
"--yes",
|
||||
"--yes",
|
||||
]),
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
@@ -215,12 +238,12 @@ describe("unknown flags are rejected", () => {
|
||||
]);
|
||||
expect(parsed).not.toBeNull();
|
||||
expect(parsed?.confirmPath).toBe("/tmp/backups/a.sqlite3");
|
||||
expect(restoreConfirmationMatches("/tmp/backups/a.sqlite3", parsed?.confirmPath)).toBe(
|
||||
true,
|
||||
);
|
||||
expect(restoreConfirmationMatches("/tmp/backups/a.sqlite3", undefined)).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
restoreConfirmationMatches("/tmp/backups/a.sqlite3", parsed?.confirmPath),
|
||||
).toBe(true);
|
||||
expect(
|
||||
restoreConfirmationMatches("/tmp/backups/a.sqlite3", undefined),
|
||||
).toBe(false);
|
||||
expect(
|
||||
restoreConfirmationMatches(
|
||||
"/tmp/backups/a.sqlite3",
|
||||
@@ -365,7 +388,11 @@ describe("path add and remove carry what the endpoint needs", () => {
|
||||
});
|
||||
|
||||
it("distinguishes remove from add", () => {
|
||||
const parsed = parseProductCommand("path", ["remove", "--root", "/tmp/scanme"]);
|
||||
const parsed = parseProductCommand("path", [
|
||||
"remove",
|
||||
"--root",
|
||||
"/tmp/scanme",
|
||||
]);
|
||||
if (parsed === null) {
|
||||
throw new Error("path remove must parse");
|
||||
}
|
||||
@@ -375,7 +402,12 @@ describe("path add and remove carry what the endpoint needs", () => {
|
||||
});
|
||||
|
||||
it("does not silently drop --yes", () => {
|
||||
const parsed = parseProductCommand("path", ["add", "--root", "/tmp/a", "--yes"]);
|
||||
const parsed = parseProductCommand("path", [
|
||||
"add",
|
||||
"--root",
|
||||
"/tmp/a",
|
||||
"--yes",
|
||||
]);
|
||||
expect(parsed?.confirmed).toBe(true);
|
||||
// Without this, a typo'd `--yes` would fall through to a plan and the user
|
||||
// would believe the change had been made.
|
||||
|
||||
@@ -6,10 +6,7 @@ import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
/** The app root (one level above this test's `src/`). */
|
||||
const root = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"..",
|
||||
);
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const bundle = path.join(root, "dist", "one-memory.cjs");
|
||||
|
||||
// The published npm package must be self-contained. The bundle inlines
|
||||
@@ -20,9 +17,10 @@ const bundle = path.join(root, "dist", "one-memory.cjs");
|
||||
describe("publish manifest is production-safe", () => {
|
||||
it("declares no npm runtime dependency once dependencies are inlined", () => {
|
||||
// `test` builds with tsup first, so a missing bundle is a real failure.
|
||||
expect(existsSync(bundle), "run `pnpm --filter @one-memory/cli build`").toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
existsSync(bundle),
|
||||
"run `pnpm --filter @one-memory/cli build`",
|
||||
).toBe(true);
|
||||
const source = readFileSync(bundle, "utf8");
|
||||
const external = [
|
||||
...new Set(
|
||||
@@ -37,16 +35,15 @@ describe("publish manifest is production-safe", () => {
|
||||
),
|
||||
];
|
||||
// Every one of these must be a Node builtin, i.e. no npm package.
|
||||
const npmDeps = external.filter(
|
||||
(name) => !builtinModules.includes(name),
|
||||
);
|
||||
const npmDeps = external.filter((name) => !builtinModules.includes(name));
|
||||
expect(npmDeps).toEqual([]);
|
||||
});
|
||||
|
||||
it("strip-out rule keeps only what the bundle requires", () => {
|
||||
expect(existsSync(bundle), "run `pnpm --filter @one-memory/cli build`").toBe(
|
||||
true,
|
||||
);
|
||||
expect(
|
||||
existsSync(bundle),
|
||||
"run `pnpm --filter @one-memory/cli build`",
|
||||
).toBe(true);
|
||||
// Run the real generator, then inspect its output manifest.
|
||||
execFileSync("node", ["scripts/prepare-publish-manifest.mjs"], {
|
||||
cwd: root,
|
||||
|
||||
@@ -49,9 +49,9 @@ describe("runtime service lock guard", () => {
|
||||
JSON.stringify({ pid: 4321 }),
|
||||
{ mode: 0o600 },
|
||||
);
|
||||
await expect(
|
||||
inspectRuntimeServiceLock(dataDir, () => false),
|
||||
).resolves.toBe("clear");
|
||||
await expect(inspectRuntimeServiceLock(dataDir, () => false)).resolves.toBe(
|
||||
"clear",
|
||||
);
|
||||
});
|
||||
|
||||
it("fails closed on a malformed lease", async () => {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { mkdtemp, mkdir, writeFile } from "node:fs/promises";
|
||||
import { mkdir, mkdtemp, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
type CommandResult,
|
||||
inspectLaunchdService,
|
||||
restartManagedService,
|
||||
type ServiceCommandRunner,
|
||||
startManagedService,
|
||||
stopManagedService,
|
||||
type CommandResult,
|
||||
type ServiceCommandRunner,
|
||||
} from "./service-session.js";
|
||||
|
||||
const SERVICE_ID = "com.tencent.onememory.runtime";
|
||||
@@ -35,7 +35,11 @@ describe("service-aware launchd session", () => {
|
||||
it("reports running with the launchd pid and plist", async () => {
|
||||
const run = vi.fn<ServiceCommandRunner>(async () => running(84237));
|
||||
await expect(
|
||||
inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
inspectLaunchdService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toEqual({
|
||||
state: "running",
|
||||
pid: 84237,
|
||||
@@ -46,7 +50,11 @@ describe("service-aware launchd session", () => {
|
||||
it("treats 'could not find service' as absent", async () => {
|
||||
const run = vi.fn<ServiceCommandRunner>(async () => absent());
|
||||
await expect(
|
||||
inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
inspectLaunchdService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toEqual({ state: "absent" });
|
||||
});
|
||||
|
||||
@@ -57,7 +65,11 @@ describe("service-aware launchd session", () => {
|
||||
stderr: "Input/output error",
|
||||
}));
|
||||
await expect(
|
||||
inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
inspectLaunchdService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toEqual({ state: "unknown", code: "launchd_inspection_failed" });
|
||||
});
|
||||
|
||||
@@ -146,13 +158,21 @@ describe("service-aware launchd session", () => {
|
||||
if (command[1] === "print") {
|
||||
printed += 1;
|
||||
return printed === 1
|
||||
? { code: 0, stdout: `path = /tmp/x.plist\nstate = not running\n`, stderr: "" }
|
||||
? {
|
||||
code: 0,
|
||||
stdout: `path = /tmp/x.plist\nstate = not running\n`,
|
||||
stderr: "",
|
||||
}
|
||||
: running(84237);
|
||||
}
|
||||
return running(84237);
|
||||
});
|
||||
await expect(
|
||||
startManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
startManagedService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toBe("started");
|
||||
expect(calls).toContainEqual([
|
||||
"launchctl",
|
||||
@@ -169,7 +189,11 @@ describe("service-aware launchd session", () => {
|
||||
return running(84237);
|
||||
});
|
||||
await expect(
|
||||
startManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
startManagedService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toBe("started");
|
||||
// Already running -> no kickstart needed.
|
||||
expect(calls.some((c) => c[1] === "kickstart")).toBe(false);
|
||||
@@ -214,7 +238,11 @@ describe("service-aware launchd session", () => {
|
||||
stderr: "",
|
||||
}));
|
||||
await expect(
|
||||
inspectLaunchdService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
inspectLaunchdService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toEqual({ state: "loaded", plistPath: "/tmp/x.plist" });
|
||||
});
|
||||
|
||||
@@ -225,7 +253,11 @@ describe("service-aware launchd session", () => {
|
||||
return running(101);
|
||||
});
|
||||
await expect(
|
||||
restartManagedService({ serviceId: SERVICE_ID, uid: UID, runCaptured: run }),
|
||||
restartManagedService({
|
||||
serviceId: SERVICE_ID,
|
||||
uid: UID,
|
||||
runCaptured: run,
|
||||
}),
|
||||
).resolves.toBe("restarted");
|
||||
expect(calls).toContainEqual([
|
||||
"launchctl",
|
||||
@@ -286,7 +318,9 @@ describe("service-aware launchd session", () => {
|
||||
stdout: JSON.stringify({
|
||||
Label: SERVICE_ID,
|
||||
ProgramArguments: ["/tmp/node", "/tmp/runtime.cjs", "serve"],
|
||||
EnvironmentVariables: { ONE_MEMORY_DATA_DIR: "/tmp/this-install/data" },
|
||||
EnvironmentVariables: {
|
||||
ONE_MEMORY_DATA_DIR: "/tmp/this-install/data",
|
||||
},
|
||||
}),
|
||||
stderr: "",
|
||||
};
|
||||
|
||||
@@ -49,7 +49,10 @@ function launchdDomain(uid: number): string {
|
||||
/** Deterministic location of the managed LaunchAgent plist. Needed because
|
||||
* after `bootout` launchd no longer reports a path, yet `start` must be able to
|
||||
* bootstrap the very same service back. */
|
||||
export function defaultLaunchAgentPath(home: string, serviceId: string): string {
|
||||
export function defaultLaunchAgentPath(
|
||||
home: string,
|
||||
serviceId: string,
|
||||
): string {
|
||||
return path.posix.join(home, "Library", "LaunchAgents", `${serviceId}.plist`);
|
||||
}
|
||||
|
||||
@@ -162,7 +165,10 @@ export async function stopManagedService(options: {
|
||||
? (["launchctl", "bootout", domain, before.plistPath] as const)
|
||||
: (["launchctl", "bootout", `${domain}/${options.serviceId}`] as const);
|
||||
const result = await options.runCaptured([...target]);
|
||||
if (result.code !== 0 && !/could not find service|service not found/i.test(result.stderr)) {
|
||||
if (
|
||||
result.code !== 0 &&
|
||||
!/could not find service|service not found/i.test(result.stderr)
|
||||
) {
|
||||
throw new Error("launchd_bootout_failed");
|
||||
}
|
||||
// "Stopped" must mean the label stays gone, not that we saw it gone once.
|
||||
@@ -295,9 +301,7 @@ export async function runLaunchctlCaptured(
|
||||
stderr += String(chunk);
|
||||
});
|
||||
child.once("error", () => reject(new Error("launchd_command_failed")));
|
||||
child.once("close", (code) =>
|
||||
resolve({ code: code ?? 1, stdout, stderr }),
|
||||
);
|
||||
child.once("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@ import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { applyShellPath, planShellPath, removeShellPath } from "./shell-path.js";
|
||||
import {
|
||||
applyShellPath,
|
||||
planShellPath,
|
||||
removeShellPath,
|
||||
} from "./shell-path.js";
|
||||
|
||||
async function home(): Promise<string> {
|
||||
return mkdtemp(path.join(tmpdir(), "memhub-shell-path-"));
|
||||
|
||||
@@ -72,9 +72,7 @@ function blockFor(binDirectory: string): string {
|
||||
* original file byte-for-byte regardless of the original's trailing newline. */
|
||||
function ownedBlock(existing: string | null, binDirectory: string): string {
|
||||
const separator =
|
||||
existing === null || existing === "" || existing.endsWith("\n")
|
||||
? ""
|
||||
: "\n";
|
||||
existing === null || existing === "" || existing.endsWith("\n") ? "" : "\n";
|
||||
return `${separator}${blockFor(binDirectory)}`;
|
||||
}
|
||||
|
||||
@@ -104,10 +102,7 @@ export async function planShellPath(options: {
|
||||
disabled: true,
|
||||
};
|
||||
}
|
||||
const blocked = (
|
||||
reason: string,
|
||||
target: string,
|
||||
): ShellPathPlan => ({
|
||||
const blocked = (reason: string, target: string): ShellPathPlan => ({
|
||||
schema_version: 1,
|
||||
status: "blocked",
|
||||
blocked_reason: reason,
|
||||
@@ -229,11 +224,12 @@ async function writeProfileAtomically(
|
||||
// A fresh `--home` may not exist yet; create it (owner-only) before writing
|
||||
// the temp profile, otherwise the write fails with a raw ENOENT. Surface a
|
||||
// structured code for any other failure.
|
||||
await mkdir(path.dirname(profilePath), { recursive: true, mode: 0o700 }).catch(
|
||||
() => {
|
||||
throw new Error("shell_path_home_unwritable");
|
||||
},
|
||||
);
|
||||
await mkdir(path.dirname(profilePath), {
|
||||
recursive: true,
|
||||
mode: 0o700,
|
||||
}).catch(() => {
|
||||
throw new Error("shell_path_home_unwritable");
|
||||
});
|
||||
const temporary = `${profilePath}.memhub.${process.pid}.tmp`;
|
||||
try {
|
||||
await writeFile(temporary, content, { encoding: "utf8", mode: 0o644 });
|
||||
|
||||
@@ -468,7 +468,9 @@ describe("CLI-19 progress and issue reads", () => {
|
||||
);
|
||||
expect(output).toContain("[15:04:05.067] progress #1");
|
||||
expect(output).toContain("[15:04:05.067] progress #2");
|
||||
expect(output.match(/\x1b\[2J\x1b\[H/g)).toHaveLength(2);
|
||||
expect(output.match(new RegExp("\\x1b\\[2J\\x1b\\[H", "g"))).toHaveLength(
|
||||
2,
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps non-terminal watch output append-only", async () => {
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { CoreReader, ReadOutcome } from "./core-client.js";
|
||||
import type {
|
||||
CoreOperations,
|
||||
OperationOutcome,
|
||||
} from "./core-operations.js";
|
||||
import type { CoreOperations, OperationOutcome } from "./core-operations.js";
|
||||
import {
|
||||
renderSourceSyncText,
|
||||
setSourceSync,
|
||||
@@ -320,4 +317,3 @@ describe("setSourceSync", () => {
|
||||
expect(renderSourceSyncText(invalid)).toBe("未变更:invalid_source_id\n");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
SourceSyncInputError,
|
||||
buildSourceSyncRequest,
|
||||
hasSourceSyncTarget,
|
||||
SourceSyncInputError,
|
||||
} from "@one-memory/operations";
|
||||
import type { CoreReader } from "./core-client.js";
|
||||
import type { CoreOperations } from "./core-operations.js";
|
||||
@@ -36,7 +36,10 @@ async function current(
|
||||
reader: CoreReader,
|
||||
sourceId: string,
|
||||
): Promise<
|
||||
| { state: "ok"; source: NonNullable<ReturnType<typeof validateSources>>[number] }
|
||||
| {
|
||||
state: "ok";
|
||||
source: NonNullable<ReturnType<typeof validateSources>>[number];
|
||||
}
|
||||
| { state: "invalid" | "unknown"; code: string }
|
||||
> {
|
||||
const outcome = await reader<unknown>("/api/v1/sources");
|
||||
|
||||
@@ -30,6 +30,8 @@ describe("status default output", () => {
|
||||
expect(text).not.toContain("[object Object]");
|
||||
expect(text).toContain("卡住 类型 整理对话/原因 等待模型/数量 2");
|
||||
expect(text).not.toMatch(/background_verified|additions_only|error_codes=/);
|
||||
expect(text).not.toMatch(/provider_kind|has_api_key|credential_state|observed_at/);
|
||||
expect(text).not.toMatch(
|
||||
/provider_kind|has_api_key|credential_state|observed_at/,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -85,12 +85,16 @@ describe("memhub ui command wiring", () => {
|
||||
const output = capture();
|
||||
let code: number;
|
||||
try {
|
||||
code = await run(["ui", "--json"], {}, {
|
||||
openBrowser: async (url) => {
|
||||
opened.push(url);
|
||||
return true;
|
||||
code = await run(
|
||||
["ui", "--json"],
|
||||
{},
|
||||
{
|
||||
openBrowser: async (url) => {
|
||||
opened.push(url);
|
||||
return true;
|
||||
},
|
||||
},
|
||||
});
|
||||
);
|
||||
} finally {
|
||||
output.restore();
|
||||
}
|
||||
@@ -102,7 +106,9 @@ describe("memhub ui command wiring", () => {
|
||||
state: "opened",
|
||||
url: "http://127.0.0.1:8765/ui/login?code=one-time-code",
|
||||
});
|
||||
expect(opened).toEqual(["http://127.0.0.1:8765/ui/login?code=one-time-code"]);
|
||||
expect(opened).toEqual([
|
||||
"http://127.0.0.1:8765/ui/login?code=one-time-code",
|
||||
]);
|
||||
// The bearer token was sent to Core in the request header, never in output.
|
||||
expect(output.value()).not.toMatch(/synthetic-runtime-token/);
|
||||
});
|
||||
@@ -159,7 +165,11 @@ describe("memhub ui command wiring", () => {
|
||||
const output = capture();
|
||||
let code: number;
|
||||
try {
|
||||
code = await run(["ui", "--json"], {}, { openBrowser: async () => false });
|
||||
code = await run(
|
||||
["ui", "--json"],
|
||||
{},
|
||||
{ openBrowser: async () => false },
|
||||
);
|
||||
} finally {
|
||||
output.restore();
|
||||
}
|
||||
@@ -185,7 +195,11 @@ describe("memhub ui command wiring", () => {
|
||||
const output = capture();
|
||||
let code: number;
|
||||
try {
|
||||
code = await run(["ui", "--json"], {}, { openBrowser: async () => true });
|
||||
code = await run(
|
||||
["ui", "--json"],
|
||||
{},
|
||||
{ openBrowser: async () => true },
|
||||
);
|
||||
} finally {
|
||||
output.restore();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import { parseUiSessionExchange } from "./ui-session.js";
|
||||
describe("ui session exchange over HTTP", () => {
|
||||
let server: Server;
|
||||
let port: number;
|
||||
const seen: Array<{ authorization?: string; method?: string; url?: string }> = [];
|
||||
const seen: Array<{ authorization?: string; method?: string; url?: string }> =
|
||||
[];
|
||||
let status = 200;
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -45,11 +45,31 @@ describe("memhub ui session wiring", () => {
|
||||
for (const doc of [
|
||||
null,
|
||||
{},
|
||||
{ schema_version: 2, exchange_code: "x", expires_in_seconds: 60, url: "http://127.0.0.1:1/ui/login?code=x" },
|
||||
{
|
||||
schema_version: 2,
|
||||
exchange_code: "x",
|
||||
expires_in_seconds: 60,
|
||||
url: "http://127.0.0.1:1/ui/login?code=x",
|
||||
},
|
||||
{ schema_version: 1, exchange_code: "x", expires_in_seconds: 60 },
|
||||
{ schema_version: 1, exchange_code: "", expires_in_seconds: 60, url: "http://127.0.0.1:1/ui/login?code=x" },
|
||||
{ schema_version: 1, exchange_code: "x", expires_in_seconds: 0, url: "http://127.0.0.1:1/ui/login?code=x" },
|
||||
{ schema_version: 1, exchange_code: "x", expires_in_seconds: 60, url: "http://127.0.0.1:1/" },
|
||||
{
|
||||
schema_version: 1,
|
||||
exchange_code: "",
|
||||
expires_in_seconds: 60,
|
||||
url: "http://127.0.0.1:1/ui/login?code=x",
|
||||
},
|
||||
{
|
||||
schema_version: 1,
|
||||
exchange_code: "x",
|
||||
expires_in_seconds: 0,
|
||||
url: "http://127.0.0.1:1/ui/login?code=x",
|
||||
},
|
||||
{
|
||||
schema_version: 1,
|
||||
exchange_code: "x",
|
||||
expires_in_seconds: 60,
|
||||
url: "http://127.0.0.1:1/",
|
||||
},
|
||||
]) {
|
||||
expect(parseUiSessionExchange(doc)).toBeNull();
|
||||
}
|
||||
@@ -59,9 +79,18 @@ describe("memhub ui session wiring", () => {
|
||||
expect(uiSessionFailure("ui_web_assets_unavailable")).toMatchObject({
|
||||
code: "ui_web_assets_unavailable",
|
||||
});
|
||||
expect(uiExitCode({ state: "opened", url: "http://127.0.0.1:1/ui/login?code=x" })).toBe(0);
|
||||
expect(uiExitCode({ state: "blocked", code: "ui_session_contract_unavailable" })).toBe(4);
|
||||
expect(uiExitCode({ state: "failed", code: "ui_session_code_invalid" })).toBe(1);
|
||||
expect(
|
||||
uiExitCode({
|
||||
state: "opened",
|
||||
url: "http://127.0.0.1:1/ui/login?code=x",
|
||||
}),
|
||||
).toBe(0);
|
||||
expect(
|
||||
uiExitCode({ state: "blocked", code: "ui_session_contract_unavailable" }),
|
||||
).toBe(4);
|
||||
expect(
|
||||
uiExitCode({ state: "failed", code: "ui_session_code_invalid" }),
|
||||
).toBe(1);
|
||||
});
|
||||
|
||||
it("uses a platform-appropriate opener and reports missing openers", async () => {
|
||||
|
||||
@@ -42,7 +42,12 @@ function isLoopbackHttpUrl(value: string): boolean {
|
||||
}
|
||||
if (parsed.protocol !== "http:") return false;
|
||||
const host = parsed.hostname.toLowerCase();
|
||||
return host === "localhost" || host === "127.0.0.1" || host === "[::1]" || host === "::1";
|
||||
return (
|
||||
host === "localhost" ||
|
||||
host === "127.0.0.1" ||
|
||||
host === "[::1]" ||
|
||||
host === "::1"
|
||||
);
|
||||
}
|
||||
|
||||
/** Validate the Core exchange document; return null when it does not match the
|
||||
|
||||
@@ -80,7 +80,13 @@ describe("calls clear", () => {
|
||||
});
|
||||
|
||||
it("previews without contacting Core", async () => {
|
||||
const result = await capturedRun(["calls", "clear", "--event", EVENT, "--json"]);
|
||||
const result = await capturedRun([
|
||||
"calls",
|
||||
"clear",
|
||||
"--event",
|
||||
EVENT,
|
||||
"--json",
|
||||
]);
|
||||
expect(result.code).toBe(0);
|
||||
const document = JSON.parse(result.stdout);
|
||||
expect(document.state).toBe("preview");
|
||||
@@ -341,7 +347,10 @@ describe("notes / extraction / graph / manual extract", () => {
|
||||
"--json",
|
||||
]);
|
||||
expect(applied.code).toBe(0);
|
||||
const body = transport.post.mock.calls.at(-1)?.[1] as Record<string, unknown>;
|
||||
const body = transport.post.mock.calls.at(-1)?.[1] as Record<
|
||||
string,
|
||||
unknown
|
||||
>;
|
||||
expect(body.text).toBe("记住这个决定");
|
||||
expect(body.scope).toBe("all-apps");
|
||||
expect(JSON.parse(applied.stdout).state).toBe("committed");
|
||||
|
||||
@@ -10,18 +10,17 @@
|
||||
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import {
|
||||
MemoryNoteInputError,
|
||||
buildMemoryNoteSaveRequest,
|
||||
parseMemoryNoteReceipt,
|
||||
MemoryNoteInputError,
|
||||
parseExtractionSettingsReceipt,
|
||||
parseGraphWidthDecisionReceipt,
|
||||
parseManualExtractReceipt,
|
||||
parseMemoryNoteReceipt,
|
||||
} from "@one-memory/operations";
|
||||
import type { CoreOperations, CorePutOperations } from "./core-operations.js";
|
||||
import { PRODUCT } from "./version.js";
|
||||
|
||||
const UUID =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
const DIGEST = /^[0-9a-f]{64}$/;
|
||||
const NOTE_MAX_CHARACTERS = 12_000;
|
||||
const EXTRACTION_PRESETS = ["3m", "6m", "1y", "all"] as const;
|
||||
@@ -117,7 +116,10 @@ function digestOf(value: unknown): string {
|
||||
type Draft =
|
||||
| Omit<Extract<ExtendedWritePlan, { kind: "memory_note_add" }>, "digest">
|
||||
| Omit<Extract<ExtendedWritePlan, { kind: "memory_note_process" }>, "digest">
|
||||
| Omit<Extract<ExtendedWritePlan, { kind: "extraction_window_set" }>, "digest">
|
||||
| Omit<
|
||||
Extract<ExtendedWritePlan, { kind: "extraction_window_set" }>,
|
||||
"digest"
|
||||
>
|
||||
| Omit<Extract<ExtendedWritePlan, { kind: "graph_width_decide" }>, "digest">
|
||||
| Omit<Extract<ExtendedWritePlan, { kind: "manual_extract" }>, "digest">;
|
||||
|
||||
@@ -148,7 +150,10 @@ function committed(
|
||||
};
|
||||
}
|
||||
|
||||
function rejected(operationId: string | undefined, code: string): ExtendedWriteOutcome {
|
||||
function rejected(
|
||||
operationId: string | undefined,
|
||||
code: string,
|
||||
): ExtendedWriteOutcome {
|
||||
return {
|
||||
schema_version: 1,
|
||||
product: PRODUCT,
|
||||
@@ -158,7 +163,10 @@ function rejected(operationId: string | undefined, code: string): ExtendedWriteO
|
||||
};
|
||||
}
|
||||
|
||||
function unknown(operationId: string | undefined, code: string): ExtendedWriteOutcome {
|
||||
function unknown(
|
||||
operationId: string | undefined,
|
||||
code: string,
|
||||
): ExtendedWriteOutcome {
|
||||
return {
|
||||
schema_version: 1,
|
||||
product: PRODUCT,
|
||||
@@ -197,7 +205,9 @@ export function validNoteText(text: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
export function planMemoryNoteProcess(evidenceId: string): ExtendedWriteOutcome {
|
||||
export function planMemoryNoteProcess(
|
||||
evidenceId: string,
|
||||
): ExtendedWriteOutcome {
|
||||
return UUID.test(evidenceId)
|
||||
? preview({
|
||||
schema_version: 1,
|
||||
@@ -313,8 +323,7 @@ export function planGraphWidthDecide(decision: string): ExtendedWriteOutcome {
|
||||
|
||||
export function planManualExtract(evidenceIds: string[]): ExtendedWriteOutcome {
|
||||
const ids = [...new Set(evidenceIds)];
|
||||
return ids.length === evidenceIds.length &&
|
||||
ids.every((id) => UUID.test(id))
|
||||
return ids.length === evidenceIds.length && ids.every((id) => UUID.test(id))
|
||||
? preview({
|
||||
schema_version: 1,
|
||||
kind: "manual_extract",
|
||||
@@ -455,12 +464,12 @@ export function validateExtendedWritePlan(
|
||||
}
|
||||
|
||||
export function extendedWriteExitCode(document: ExtendedWriteOutcome): number {
|
||||
return ["preview", "committed", "recovered"].includes(document.state)
|
||||
? 0
|
||||
: 1;
|
||||
return ["preview", "committed", "recovered"].includes(document.state) ? 0 : 1;
|
||||
}
|
||||
|
||||
export function renderExtendedWriteText(document: ExtendedWriteOutcome): string {
|
||||
export function renderExtendedWriteText(
|
||||
document: ExtendedWriteOutcome,
|
||||
): string {
|
||||
if (document.state === "preview") {
|
||||
const lines = ["以下操作尚未执行;加 --confirm 后才会写入:"];
|
||||
const plan = document.plan;
|
||||
|
||||
@@ -61,10 +61,9 @@ describe("UI write execution", () => {
|
||||
}));
|
||||
const plan = planOf(planCallEventsClear([EVENT]));
|
||||
if (plan.kind !== "call_events_clear") throw new Error("kind");
|
||||
const result = await executeCallEventsClear(
|
||||
plan,
|
||||
{ post } as unknown as CoreOperations,
|
||||
);
|
||||
const result = await executeCallEventsClear(plan, {
|
||||
post,
|
||||
} as unknown as CoreOperations);
|
||||
expect(result.state).toBe("committed");
|
||||
expect(post).toHaveBeenCalledWith("/api/v1/call-events/clear", {
|
||||
event_ids: [EVENT],
|
||||
@@ -79,10 +78,9 @@ describe("UI write execution", () => {
|
||||
}));
|
||||
const plan = planOf(planCallEventsClearAll());
|
||||
if (plan.kind !== "call_events_clear_all") throw new Error("kind");
|
||||
await executeCallEventsClearAll(
|
||||
plan,
|
||||
{ post } as unknown as CoreOperations,
|
||||
);
|
||||
await executeCallEventsClearAll(plan, {
|
||||
post,
|
||||
} as unknown as CoreOperations);
|
||||
expect(post).toHaveBeenCalledWith("/api/v1/call-events/clear-all", {
|
||||
user_confirmed: true,
|
||||
});
|
||||
@@ -107,7 +105,7 @@ describe("UI write execution", () => {
|
||||
committed: true,
|
||||
},
|
||||
}));
|
||||
const del = vi.fn(async <T,>() => ({
|
||||
const del = vi.fn(async <T>() => ({
|
||||
state: "committed" as const,
|
||||
data: {} as T,
|
||||
}));
|
||||
@@ -118,10 +116,9 @@ describe("UI write execution", () => {
|
||||
const commit = planOf(planImportFileCommit(UPLOAD));
|
||||
if (commit.kind !== "import_file_commit") throw new Error("kind");
|
||||
await executeImportFileCommit(commit, operations);
|
||||
expect(post).toHaveBeenCalledWith(
|
||||
`/api/v1/import-files/${UPLOAD}/commit`,
|
||||
{ confirmed: true },
|
||||
);
|
||||
expect(post).toHaveBeenCalledWith(`/api/v1/import-files/${UPLOAD}/commit`, {
|
||||
confirmed: true,
|
||||
});
|
||||
const discard = planOf(planImportFileDiscard(UPLOAD));
|
||||
if (discard.kind !== "import_file_discard") throw new Error("kind");
|
||||
expect((await executeImportFileDiscard(discard, operations)).state).toBe(
|
||||
@@ -133,15 +130,12 @@ describe("UI write execution", () => {
|
||||
it("treats a malformed success receipt as unknown", async () => {
|
||||
const plan = planOf(planCallEventsClear([EVENT]));
|
||||
if (plan.kind !== "call_events_clear") throw new Error("kind");
|
||||
const result = await executeCallEventsClear(
|
||||
plan,
|
||||
{
|
||||
post: vi.fn(async () => ({
|
||||
state: "committed" as const,
|
||||
data: { wrong: true },
|
||||
})),
|
||||
} as unknown as CoreOperations,
|
||||
);
|
||||
const result = await executeCallEventsClear(plan, {
|
||||
post: vi.fn(async () => ({
|
||||
state: "committed" as const,
|
||||
data: { wrong: true },
|
||||
})),
|
||||
} as unknown as CoreOperations);
|
||||
expect(result).toMatchObject({
|
||||
state: "unknown",
|
||||
code: "ui_write_receipt_invalid",
|
||||
|
||||
@@ -14,8 +14,7 @@ import type {
|
||||
} from "./core-operations.js";
|
||||
import { PRODUCT } from "./version.js";
|
||||
|
||||
const UUID =
|
||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
||||
const INPUT_KINDS = ["raw_conversation", "memory_content"] as const;
|
||||
const MAX_UPLOAD_BYTES = 128 * 1024 * 1024;
|
||||
|
||||
@@ -139,7 +138,11 @@ export function planCallEventsClear(
|
||||
) {
|
||||
return invalid("call_event_ids_invalid");
|
||||
}
|
||||
return preview({ schema_version: 1, kind: "call_events_clear", event_ids: [...eventIds] });
|
||||
return preview({
|
||||
schema_version: 1,
|
||||
kind: "call_events_clear",
|
||||
event_ids: [...eventIds],
|
||||
});
|
||||
}
|
||||
|
||||
export function planCallEventsClearAll(): UiWriteOutcome {
|
||||
@@ -224,11 +227,7 @@ export async function readImportFileUpload(
|
||||
}
|
||||
try {
|
||||
const stats = await handle.stat();
|
||||
if (
|
||||
!stats.isFile() ||
|
||||
stats.nlink !== 1 ||
|
||||
stats.size > MAX_UPLOAD_BYTES
|
||||
) {
|
||||
if (!stats.isFile() || stats.nlink !== 1 || stats.size > MAX_UPLOAD_BYTES) {
|
||||
return null;
|
||||
}
|
||||
const buffer = Buffer.alloc(Number(stats.size));
|
||||
@@ -273,9 +272,7 @@ function fileUploadOperationId(
|
||||
checksum: string,
|
||||
): string {
|
||||
const hex = createHash("sha256")
|
||||
.update(
|
||||
JSON.stringify([filename, inputKind, checksum]),
|
||||
)
|
||||
.update(JSON.stringify([filename, inputKind, checksum]))
|
||||
.digest("hex");
|
||||
return [
|
||||
hex.slice(0, 8),
|
||||
@@ -325,8 +322,7 @@ export function validateUiWritePlan(value: unknown): UiWritePlan | null {
|
||||
UUID.test(candidate.operation_id) &&
|
||||
typeof candidate.path === "string" &&
|
||||
typeof candidate.filename === "string" &&
|
||||
candidate.filename ===
|
||||
candidate.path.split(/[/\\]/).pop() &&
|
||||
candidate.filename === candidate.path.split(/[/\\]/).pop() &&
|
||||
/^[0-9a-f]{64}$/.test(String(candidate.sha256)) &&
|
||||
INPUT_KINDS.includes(
|
||||
candidate.input_kind as (typeof INPUT_KINDS)[number],
|
||||
@@ -364,9 +360,7 @@ export async function executeCallEventsClear(
|
||||
event_ids: plan.event_ids,
|
||||
user_confirmed: true,
|
||||
});
|
||||
return outcome(result, plan.event_ids.join(","), [
|
||||
"removed",
|
||||
]);
|
||||
return outcome(result, plan.event_ids.join(","), ["removed"]);
|
||||
}
|
||||
|
||||
export async function executeCallEventsClearAll(
|
||||
@@ -543,7 +537,9 @@ function outcome(
|
||||
return committed(operationId, {});
|
||||
}
|
||||
const data =
|
||||
result.data !== null && typeof result.data === "object" && !Array.isArray(result.data)
|
||||
result.data !== null &&
|
||||
typeof result.data === "object" &&
|
||||
!Array.isArray(result.data)
|
||||
? (result.data as Record<string, unknown>)
|
||||
: null;
|
||||
if (data === null || required.some((key) => !Object.hasOwn(data, key))) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { defineConfig } from "tsup";
|
||||
import { createRequire } from "node:module";
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { resolveBuildVersion } = require("../../scripts/release-version.cjs") as {
|
||||
resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
|
||||
};
|
||||
const { resolveBuildVersion } =
|
||||
require("../../scripts/release-version.cjs") as {
|
||||
resolveBuildVersion(environment?: NodeJS.ProcessEnv, root?: string): string;
|
||||
};
|
||||
const releaseVersion = resolveBuildVersion(process.env);
|
||||
|
||||
export default defineConfig({
|
||||
@@ -18,7 +19,9 @@ export default defineConfig({
|
||||
__ONE_MEMORY_BUILD_NUMBER__: JSON.stringify(
|
||||
process.env.ONE_MEMORY_BUILD_NUMBER ?? "unknown",
|
||||
),
|
||||
__ONE_MEMORY_COMMIT__: JSON.stringify(process.env.ONE_MEMORY_COMMIT ?? "unknown"),
|
||||
__ONE_MEMORY_COMMIT__: JSON.stringify(
|
||||
process.env.ONE_MEMORY_COMMIT ?? "unknown",
|
||||
),
|
||||
__MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE__: JSON.stringify(
|
||||
process.env.MEMHUB_DEFAULT_RELEASE_MANIFEST_URL_TEMPLATE ?? "",
|
||||
),
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { defineConfig } from "vitest/config";
|
||||
|
||||
const version = JSON.parse(readFileSync(new URL("package.json", import.meta.url), "utf8"))
|
||||
.version as string;
|
||||
const version = JSON.parse(
|
||||
readFileSync(new URL("package.json", import.meta.url), "utf8"),
|
||||
).version as string;
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
|
||||
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
||||
|
||||
[project]
|
||||
name = "one-memory"
|
||||
version = "1.0.0"
|
||||
version = "1.0.2"
|
||||
description = "MemHub local-first memory core"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
@@ -12,7 +12,7 @@ dependencies = [
|
||||
"fastapi>=0.141.1",
|
||||
"filelock>=3.32.4",
|
||||
# Public SDK version validated against MemHub's permission and recall contracts.
|
||||
"hy-memory==2.0.1",
|
||||
"hy-memory==2.0.2",
|
||||
# Retrieval's derived vector index directly consumes these locked versions.
|
||||
"chromadb==1.5.9",
|
||||
"numpy==2.5.2",
|
||||
@@ -24,7 +24,7 @@ dependencies = [
|
||||
# transitive version we do not ask for is one an unrelated upgrade could
|
||||
# drop. Deliberately NOT sentence-transformers or torch: those would take
|
||||
# the installer past 2GB, and onnxruntime alone runs the exported model.
|
||||
"onnxruntime>=1.22.0",
|
||||
"onnxruntime==1.23.2",
|
||||
"tokenizers>=0.21.0",
|
||||
"pydantic-settings>=2.15.0",
|
||||
"uvicorn[standard]>=0.52.4",
|
||||
|
||||
@@ -43,7 +43,7 @@ _NATIVE_WRITES = frozenset(
|
||||
|
||||
_TIMESTAMPS = frozenset({"created_at", "updated_at"})
|
||||
|
||||
# SDK 2.0.1 reads `config` off the coding store while routing a coding
|
||||
# SDK 2.0.2 reads `config` off the coding store while routing a coding
|
||||
# turn. The wrapper must answer it, but the native `MemoryConfig` carries
|
||||
# credentials (llm/embedder api keys, graph and cache passwords) and is a live
|
||||
# handle into the backend, so it is never handed out. Only this redacted
|
||||
@@ -199,7 +199,7 @@ class HyPermissionCodingStore:
|
||||
def config(self) -> Any:
|
||||
"""Read-only, redacted view of the native coding config.
|
||||
|
||||
SDK 2.0.1 reads `config` when it routes a coding turn. Answering
|
||||
SDK 2.0.2 reads `config` when it routes a coding turn. Answering
|
||||
it is safe only as a projection: the native MemoryConfig is a live
|
||||
backend handle and carries credentials, so callers get plain values
|
||||
with every credential-bearing key collapsed to None. This carries no
|
||||
@@ -543,7 +543,7 @@ class HyPermissionCodingStore:
|
||||
) -> list[Any]:
|
||||
"""Read recent raw trace rows, still bounded by this lease.
|
||||
|
||||
Public SDK 2.0.1 asks for recent history before a coding write. The native call is
|
||||
Public SDK 2.0.2 asks for recent history before a coding write. The native call is
|
||||
scoped to the lease's own user and agent, and rows this lease cannot
|
||||
attest are filtered out, so unapproved conversations never reach a
|
||||
coding prompt through this path.
|
||||
|
||||
@@ -120,7 +120,7 @@ _UPDATE_FIELDS = frozenset(
|
||||
"supersedes",
|
||||
"superseded_by",
|
||||
"source_raw_memory_id",
|
||||
# SDK 2.0.1 sends both of these on an in-place reconcile UPDATE.
|
||||
# SDK 2.0.2 sends both of these on an in-place reconcile UPDATE.
|
||||
# They are metadata only and must never carry identity, permission or
|
||||
# tenant state: `owner` is a provenance label whose only values are
|
||||
# "user" / "agent" (who said this line), and `custom` is the SDK's own
|
||||
@@ -462,7 +462,7 @@ class HyPermissionVectorStore:
|
||||
if node.user_id != self.__user_id or node.layer not in _CHAT_LAYERS:
|
||||
return False
|
||||
if node.layer is MemoryLayer.L0_BASIC_INFO:
|
||||
# Public SDK 2.0.1 migrates verified legacy agent-level profiles into one
|
||||
# Public SDK 2.0.2 migrates verified legacy agent-level profiles into one
|
||||
# user-level chain. Existing nodes still require a full proof in
|
||||
# __load; accepting their historical agent id does not authorize
|
||||
# unproven cross-agent memories.
|
||||
@@ -819,7 +819,7 @@ class HyPermissionVectorStore:
|
||||
):
|
||||
self.__deny("update_fields")
|
||||
allowed |= {"custom"}
|
||||
# `custom` is an allowed field name (SDK 2.0.1 sends it on a
|
||||
# `custom` is an allowed field name (SDK 2.0.2 sends it on a
|
||||
# reconcile UPDATE), but the System 2 evidence counter it can hold
|
||||
# stays digest-only: only the digest scope may advance it, and only
|
||||
# by one per write. Letting the name through must not let an
|
||||
|
||||
@@ -14,7 +14,7 @@ from pathlib import Path
|
||||
from typing import Literal, cast
|
||||
|
||||
HY_MEMORY_DISTRIBUTION = "hy-memory"
|
||||
HY_MEMORY_VERSION = "2.0.1"
|
||||
HY_MEMORY_VERSION = "2.0.2"
|
||||
HY_MEMORY_NAMESPACE = "governed-v2"
|
||||
DiagnosticLogLevel = Literal["error", "warning", "info", "debug"]
|
||||
|
||||
@@ -35,7 +35,7 @@ _COLLECTION_LOGGERS = (
|
||||
# One Memory deliberately stays on ultra because its existing, user-visible
|
||||
# profile/graph flow calls digest(), which the pinned public SDK exposes only
|
||||
# for ultra clients. Reader and non-reranker behavior remain pinned for
|
||||
# compatibility with public SDK 2.0.1.
|
||||
# compatibility with public SDK 2.0.2.
|
||||
HY_MEMORY_MODE = "ultra"
|
||||
# The SDK only recognises `legacy` and `hybrid` (see
|
||||
# hy_memory/pipelines/_retrieval/config.py: `ALL_READERS = (READER_LEGACY,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
The result decides whether the `unknown` job state can ever be retired, so it
|
||||
is probed against the installed SDK rather than written down from memory.
|
||||
|
||||
What was verified against `hy_memory-internal==2.0.1`:
|
||||
What was verified against `hy-memory==2.0.2`:
|
||||
|
||||
- `HyMemoryClient.add(..., request_id=...)` accepts a caller-supplied id and
|
||||
echoes it back. It is described as a request/receipt handle, and the SDK
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
| `test_archive_extract.py` | `contract` | Unpacking an archive a stranger sent, onto this user's disk. |
|
||||
| `test_ask_workspace_path.py` | `contract` | Ask must honour the same workspace_path expansion recall uses. |
|
||||
| `test_async_bridge.py` | `contract` | 覆盖 reader rejects parallel workers that could close during next、cancelling a read stops the worker before the batch finishes、starting a read does not stop the app answering 等 10 个场景。 |
|
||||
| `test_async_dispatch_checks.py` | `contract` | 覆盖 quiet arrival guard is off loop and 5000 events coalesce、live preparation cancel joins thread without late dispatch、quiet preparation rechecks permission before credentials or durable work 等 6 个场景。 |
|
||||
| `test_async_dispatch_checks.py` | `contract` | 覆盖 cancelling quiet timer does not start any permission reader、dispatch check does not queue work after shutdown、dispatch permission check denies before queue after classification 等 6 个场景。 |
|
||||
| `test_auth.py` | `integration` | 覆盖 local api requires bearer token、browser origin is checked in addition to token 场景。 |
|
||||
| `test_backfill_acceptance_lifecycle.py` | `integration` | A processing acknowledgement belongs to one consent revision and live worker. |
|
||||
| `test_backfill_acceptance_lifecycle.py` | `contract` | A processing acknowledgement belongs to one consent revision and live worker. |
|
||||
| `test_backfill_conversation_isolation.py` | `contract` | One stale conversation cannot invalidate an entire backfill scan. |
|
||||
| `test_background_work.py` | `contract` | 覆盖 a request does not wait behind a catch up、bulk work is kept to a few threads at a time、the pool outlives one hand off 等 4 个场景。 |
|
||||
| `test_backup_destroy_restore_reconciliation.py` | `contract` | Backup -> destroy -> restore, reconciled row for row. |
|
||||
@@ -25,7 +25,6 @@
|
||||
| `test_bug01_workbuddy_root.py` | `contract` | 3925a kernel item 2 (BUG-01, backend half): WorkBuddy import root. |
|
||||
| `test_bug03_identity_key.py` | `contract` | BUG-03: the hook lane and the file scan must share one identity for one message. |
|
||||
| `test_bug04_thinking_strip.py` | `contract` | BUG-04: Cursor thinking text must not be stored as the assistant's answer. |
|
||||
| `test_bulk_import_experience.py` | `contract` | A-6:大数据量导入的自动检查。 |
|
||||
| `test_c1_append_per_source.py` | `contract` | Append, per source, including the SQLite-backed ones. |
|
||||
| `test_c1_attribution_per_source.py` | `contract` | Attribution per source, asserted on stored Evidence, not just on parsed events. |
|
||||
| `test_c1_conversation_identity_scope.py` | `contract` | Same-named source sessions must stay separate through the read path. |
|
||||
@@ -66,33 +65,23 @@
|
||||
| `test_cli_restore.py` | `contract` | 覆盖 restore requires a source、restore refuses while the runtime is running、restore previews without confirmation 等 4 个场景。 |
|
||||
| `test_codex_header_provenance.py` | `contract` | 覆盖 header workspace versions and native ids reach file origin、new adapter rereads header after a real checkpoint、machine and unknown session sources do not establish human or agent sender 等 14 个场景。 |
|
||||
| `test_compact_model_content.py` | `contract` | Server-held previews preserve exact grants without round-tripping all refs. |
|
||||
| `test_concurrent_import_processing.py` | `integration` | Four real source formats/Core scheduling, with a blocked failing model boundary. |
|
||||
| `test_connection_lifetime.py` | `integration` | Every SQLite connection a request opens must be closed when the request ends. |
|
||||
| `test_context_access.py` | `contract` | 覆盖 memory only never reads raw authority、raw permission does not grant memory and removes revoked sources、raw requires all apps and source 等 13 个场景。 |
|
||||
| `test_context_api.py` | `integration` | 覆盖 no model local query returns real raw and governed items、existing single lane authorization never runs denied reader、authentication and origin remain required 等 14 个场景。 |
|
||||
| `test_context_auto_recall.py` | `contract` | 覆盖 needed history queries trigger without excluding recent turns、ordinary messages do not trigger、auto recall respects disable permission and satisfied state 等 7 个场景。 |
|
||||
| `test_context_endpoint_guard.py` | `contract` | 覆盖 composite route accepts existing read capabilities for later body validation、other capabilities do not enable composite read、composite read does not open other routes 等 5 个场景。 |
|
||||
| `test_context_expand.py` | `contract` | 覆盖 signed expansion returns only bounded same conversation、expansion uses source order not database insertion order、reference is bound to runtime host scope and revision 等 11 个场景。 |
|
||||
| `test_context_feedback.py` | `contract` | 覆盖 explicit feedback contains only offline label and versioned refs、click copy injection and assistant claims are not feedback、feedback cannot be unversioned duplicated or retained forever by omission 等 6 个场景。 |
|
||||
| `test_context_host_artifact.py` | `unit` | 覆盖 each priority host gets an independent artifact、host deadline drops content but preserves source coverage receipt、host character budget omits whole group and never truncates a citation 等 12 个场景。 |
|
||||
| `test_context_hy_primary.py` | `contract` | MemHub_context memory lane: HY decides the order, keywords only when HY does not answer. |
|
||||
| `test_context_memory.py` | `contract` | 覆盖 permissions precede candidate limit and do not leak counts、scope user status and active source isolation、denied scope does not open database 等 60 个场景。 |
|
||||
| `test_context_memory_scale_benchmark.py` | `contract` | 覆盖 memory scale probe covers the required layers and target、memory scale rows preserve governed memory schema shape、memory scale builds the candidate index before measuring 等 9 个场景。 |
|
||||
| `test_context_mutations.py` | `contract` | 覆盖 raw candidate never survives update delete or revoke、memory candidate never survives update delete revoke or lifecycle、denied memory never consumes candidate limit before return 等 5 个场景。 |
|
||||
| `test_context_query_planner.py` | `contract` | 覆盖 local mode performs zero authorization and network calls、authorization precedes exactly one audited transport call、denied or expired budget never calls transport 等 6 个场景。 |
|
||||
| `test_context_raw.py` | `contract` | 覆盖 empty authority and unrequested path do not open database、permissions precede candidate limit and no model needed、explicit source filter never broadens authority 等 37 个场景。 |
|
||||
| `test_context_raw_scale_benchmark.py` | `performance` | 覆盖 raw scale probe uses fts and has a nonzero positive control、object scale probe has exact positive control and plan 场景。 |
|
||||
| `test_context_resume.py` | `contract` | 覆盖 resume packet keeps literal sources and missing fields、agent report and tool output are not system acceptance、only trusted receipt identity marks system acceptance 等 9 个场景。 |
|
||||
| `test_context_raw_scale_benchmark.py` | `contract` | 覆盖 object scale probe has exact positive control and plan、raw scale probe uses fts and has a nonzero positive control 场景。 |
|
||||
| `test_context_search.py` | `contract` | 覆盖 authorization and requested paths never invoke other lane、empty partial zero unavailable and safe failures、parallel common deadline and finalizers wait for both reads 等 24 个场景。 |
|
||||
| `test_context_search_both_paths.py` | `integration` | The objective names 'recall' and requires BOTH paths: raw and memory. |
|
||||
| `test_context_v2_contract_parity.py` | `unit` | Mechanical parity checks for the shared v2 coverage receipt contract. |
|
||||
| `test_context_v2_coordinator.py` | `contract` | 覆盖 no model path returns raw and memory with exact evidence、semantic failure is not recast as empty、empty lexical with incomplete semantic index is not complete no hit 等 52 个场景。 |
|
||||
| `test_continuous_completed_input_review.py` | `contract` | Independent review of completed-input reuse; real stores and controlled HY only. |
|
||||
| `test_continuous_coordinator.py` | `contract` | 覆盖 restart replays lost callback into same durable task queue、new journal event and source regrant wake replay without legacy request、activation hook and startup recovery start single monitor then stop 等 6 个场景。 |
|
||||
| `test_continuous_outcome_unknown.py` | `contract` | 覆盖 crashed continuous send is not replayed but new event progresses、legacy running recovery remains pending and no continuous table、a timed out non continuous task also becomes unknown 等 8 个场景。 |
|
||||
| `test_continuous_policy.py` | `contract` | 覆盖 explicit policy never upgrades legacy or sends or creates tasks、backlog snapshot over one hundred thousand is compact、legacy backlog receipt remains readable 等 19 个场景。 |
|
||||
| `test_continuous_processing_bridge.py` | `contract` | 覆盖 continuous prepare lease ingest has no legacy receipt or old context、continuous inactive never falls back to legacy、revocation rechecked at runner and publication boundaries 等 17 个场景。 |
|
||||
| `test_continuous_processing_integration.py` | `integration` | Real temporary Core/stores with controlled probe and HY boundaries, never real data. |
|
||||
| `test_continuous_coordinator.py` | `contract` | 覆盖 activation hook and startup recovery start single monitor then stop、failed preparation does not advance observed watermark、new journal event and source regrant wake replay without legacy request 等 6 个场景。 |
|
||||
| `test_continuous_outcome_unknown.py` | `contract` | 覆盖 a timed out continuous task becomes unknown not pending、a timed out non continuous task also becomes unknown、an unsettled continuous send becomes unknown not failed 等 8 个场景。 |
|
||||
| `test_continuous_policy.py` | `contract` | 覆盖 backlog snapshot over one hundred thousand is compact、caller rollback includes policy and backlog、enable idempotence rejects changed payload and superseded operation 等 19 个场景。 |
|
||||
| `test_continuous_processing_bridge.py` | `contract` | 覆盖 bound source regrant refuses old task、continuous inactive never falls back to legacy、continuous prepare lease ingest has no legacy receipt or old context 等 17 个场景。 |
|
||||
| `test_continuous_processing_integration.py` | `contract` | Real temporary Core/stores with controlled probe and HY boundaries, never real data. |
|
||||
| `test_contract_parity.py` | `contract` | Python 的枚举和 TypeScript 里那份手写的联合类型必须一致。 |
|
||||
| `test_conversation_search.py` | `integration` | Searching imported conversations before any generation model is configured. |
|
||||
| `test_conversation_seed_ids.py` | `contract` | 覆盖 seed ids read metadata only without hydrating、seed eligibility keeps person and memory content only、latest activity includes nonseed turns and import time fallback 等 13 个场景。 |
|
||||
@@ -105,9 +94,9 @@
|
||||
| `test_daemon_contract.py` | `unit` | A5-01/A5-03: process ownership, and the three grants kept apart. |
|
||||
| `test_daemon_scheduler.py` | `contract` | A5-02/A5-04: the daemon's scan scheduler and composed health. |
|
||||
| `test_data_safety.py` | `contract` | A5-05: backup usability/rotation, crash recovery, log retention. |
|
||||
| `test_database_contention.py` | `integration` | Writers meet in this one file, and the loser used to lose data. |
|
||||
| `test_database_contention.py` | `contract` | Writers meet in this one file, and the loser used to lose data. |
|
||||
| `test_database_file_permissions.py` | `contract` | 覆盖 a new main database is readable by its owner alone、the wal sidecars are not left world readable、a database from an older build is tightened on open 场景。 |
|
||||
| `test_db_session_utc.py` | `live` | The MySQL session must be pinned to UTC. |
|
||||
| `test_db_session_utc.py` | `contract` | The MySQL session must be pinned to UTC. |
|
||||
| `test_delete_no_conversation_freeze.py` | `contract` | 删掉一条记忆,不得让同一对话之后的新 turn 停止沉淀(RC10)。 |
|
||||
| `test_delivery_board.py` | `contract` | 覆盖 parses only the marked structured record、verified requires evidence with a positive control、rejects unknown dependency 等 5 个场景。 |
|
||||
| `test_derived_echo.py` | `contract` | A host that saves our injection back must not mint a new user decision. |
|
||||
@@ -147,7 +136,7 @@
|
||||
| `test_graph_width_export.py` | `unit` | EXPORT_FIRST has to actually export. |
|
||||
| `test_graph_width_guard.py` | `unit` | Graph width mismatch must ask, never silently archive. |
|
||||
| `test_harness_contract_suite.py` | `contract` | A4-09: one contract, ten harnesses. |
|
||||
| `test_health.py` | `integration` | 覆盖 health reports the single core、core refuses to start a database written by a newer build、core stays ready when legacy policy upgrade cannot read keychain 等 15 个场景。 |
|
||||
| `test_health.py` | `contract` | 覆盖 a backfill that fails says so rather than disappearing、a failed catch up leaves a traceback behind、configured model without content consent does not start backfill 等 15 个场景。 |
|
||||
| `test_history_listing_rotation.py` | `contract` | 覆盖 history listing alternates started and untouched files、history listing drains whichever cohort is longer 场景。 |
|
||||
| `test_home_summary.py` | `integration` | 覆盖 summary counts beyond page limit and excludes ineligible rows、summary revocation excludes whole mixed memory not only citation、latest is bounded and other users revocations do not hide local data 等 6 个场景。 |
|
||||
| `test_home_summary_permissions.py` | `contract` | 覆盖 bad active link excludes whole latest memory、bad inactive link does not hide memory or enter source set、other user memory and grant are isolated 等 10 个场景。 |
|
||||
@@ -158,7 +147,7 @@
|
||||
| `test_hy_coding_lease.py` | `contract` | HY's own coding/working route under the permission lease, on the pinned SDK. |
|
||||
| `test_hy_coding_reply.py` | `contract` | R-07: HY's coding-shaped replies read as "no memories at all". |
|
||||
| `test_hy_lease_responsiveness.py` | `contract` | Blocked lease checks, local failing doubles only; no network or credentials. |
|
||||
| `test_hy_lifecycle_sync.py` | `contract` | HY decides deletions; the ledger mirrors them. |
|
||||
| `test_hy_lifecycle_sync.py` | `contract` | HY decides deletions; the ledger mirrors them. Pinned SDK, scripted HTTP. |
|
||||
| `test_hy_log_privacy.py` | `contract` | HY SDK records are not rewritten by One Memory's logging setup. |
|
||||
| `test_hy_memory_bridge.py` | `contract` | 覆盖 hy client initialization is serial across bridges、native hy clients share one runtime per data directory、ollama profile ignores ambient remote storage and models 等 41 个场景。 |
|
||||
| `test_hy_metrics_lifecycle.py` | `contract` | What the pinned public SDK's MetricsCollector does, and what that costs us. |
|
||||
@@ -178,7 +167,7 @@
|
||||
| `test_hy_state_source.py` | `contract` | RC4:记忆生命周期(有效 / 被取代 / 去重隐藏 / 过期)直接读 HY,产品账本不再逐类镜像。 |
|
||||
| `test_hy_step_timing.py` | `contract` | Where an HY write spends the time that is not a model call. |
|
||||
| `test_hy_step_trace_switch.py` | `contract` | Rule 15: the per-step HY trace is off unless the debug tier asks for it. |
|
||||
| `test_hy_supersede_sync.py` | `contract` | HY decides supersessions; the ledger mirrors them. |
|
||||
| `test_hy_supersede_sync.py` | `contract` | HY decides supersessions; the ledger mirrors them. Pinned SDK, scripted HTTP. |
|
||||
| `test_hy_trial_budget.py` | `contract` | Offline proofs for the real-model acceptance budget (no network, no Keychain). |
|
||||
| `test_hy_turn_input.py` | `contract` | HY gets one turn at a time, exactly as it happened, and picks its own route. |
|
||||
| `test_hy_writeback.py` | `integration` | HY 的结果只有一扇门进治理表,而且每次进门都带着调用开始时的证据快照。 |
|
||||
@@ -190,9 +179,9 @@
|
||||
| `test_import_snapshots.py` | `contract` | Atomic snapshot publication plus frozen manifest, path, mode, and per-file checksum guards. |
|
||||
| `test_import_supervisor.py` | `contract` | 覆盖 supervisor starts all granted sources together、supervisor runs enqueued job in background、harness freeze keeps pending job and thaw runs the same row 等 11 个场景。 |
|
||||
| `test_import_three_scenarios.py` | `contract` | The three import scenarios a user actually meets. |
|
||||
| `test_import_three_scenarios_real.py` | `performance` | The three import scenarios, on a real Core at a real volume. |
|
||||
| `test_import_three_scenarios_real.py` | `contract` | The three import scenarios, on a real Core at a real volume. |
|
||||
| `test_imported_index_background.py` | `contract` | The ordering index is built off the startup path. |
|
||||
| `test_incremental_memory_backfill.py` | `contract` | 覆盖 accept backfill returns after first batch while later history is still read、first task is dispatched before later conversation is prepared、cancellation joins the preparation thread before return 等 18 个场景。 |
|
||||
| `test_incremental_memory_backfill.py` | `contract` | 覆盖 accept backfill returns after first batch while later history is still read、backfill budget yields between rounds and resumes same cursor、backfill holds an unanswered raw turn until its reply arrives 等 18 个场景。 |
|
||||
| `test_ingest_journal.py` | `contract` | 覆盖 baseline and empty initialize are explicit transactional and idempotent、old date new import and revise noop and rollbacks、import metadata changes invalidate without authorizing content 等 12 个场景。 |
|
||||
| `test_input_sanitization.py` | `unit` | 覆盖 redacts cli and assignment secrets without removing context、redacts bearer known tokens urls and private keys、redacts quoted json assignments and basic authorization 等 8 个场景。 |
|
||||
| `test_installer.py` | `contract` | 覆盖 installer create verify and rollback is transactional、installer updates owned file and restores backup、installer refuses unowned or changed target 场景。 |
|
||||
@@ -220,7 +209,7 @@
|
||||
| `test_main_database_fairness.py` | `contract` | Waiting for the one database has to be a queue, not a scramble. |
|
||||
| `test_main_database_isolation.py` | `contract` | What one checkout of the main database can do, and what it leaves for the next. |
|
||||
| `test_managed_restore.py` | `contract` | 覆盖 restore rejects a source outside the managed backup directory、restore rejects a symlinked source、restore rejects a non one memory database 等 9 个场景。 |
|
||||
| `test_manual_memory_via_hy.py` | `integration` | T04: what the person explicitly asks to remember is written through HY's import path. |
|
||||
| `test_manual_memory_via_hy.py` | `contract` | T04: what the person explicitly asks to remember is written through HY's import path. |
|
||||
| `test_manual_transcript_import.py` | `integration` | 覆盖 manual json keeps authors unknown time and exact text、marked text keeps code fences and never invents timestamps、ambiguous partial or invalid manual data never leaves partial import 等 4 个场景。 |
|
||||
| `test_matter_collection.py` | `integration` | 覆盖 hy windows cover every turn including leading and boundary assistants、oversize turn is split without silently dropping content、partial timestamps preserve source sequence 等 8 个场景。 |
|
||||
| `test_matter_discovery.py` | `contract` | 覆盖 synthesis materializes only known verbatim citations、duplicate claims keep all governed refs and distinct states、synthesis cannot echo the original sixty claim list 等 27 个场景。 |
|
||||
@@ -247,7 +236,7 @@
|
||||
| `test_memory_governance_api.py` | `integration` | 覆盖 memory governance api preserves evidence and reports cleanup、memory validation does not echo content 场景。 |
|
||||
| `test_memory_graph_api.py` | `integration` | 覆盖 graph labels where every edge came from、a created memory is on the map with its source links、drawing the map does not stop the app answering 等 12 个场景。 |
|
||||
| `test_memory_language.py` | `contract` | R-03: memory language follows the message, so Kristin's gets written in English. |
|
||||
| `test_memory_library.py` | `performance` | 覆盖 full library is reachable in stable pages、permission filter precedes count search source and page、query filters before expensive freshness 等 26 个场景。 |
|
||||
| `test_memory_library.py` | `contract` | 覆盖 full library is reachable in stable pages、permission filter precedes count search source and page、query filters before expensive freshness 等 26 个场景。 |
|
||||
| `test_memory_library_api.py` | `integration` | 覆盖 auth and external policy reject before reading、invalid parameters are 422 before projection、empty unknown source and query boundary are success not failure 等 12 个场景。 |
|
||||
| `test_memory_mutation_receipts.py` | `integration` | Read-only mutation receipts from real governance history, without model calls. |
|
||||
| `test_memory_no_candidate.py` | `integration` | 新记忆一经创建即有效;「待确认」「已拒绝」只作为旧库迁移的输入存在。 |
|
||||
@@ -288,8 +277,8 @@
|
||||
| `test_model_creation_api.py` | `integration` | Normal protected model creation routes with temporary data and in-memory secrets. |
|
||||
| `test_model_creation_operations.py` | `contract` | 覆盖 lookup without table is read only and legacy create does not initialize、operation commits with profile and version without autoactivation、any replay conflicts before secret put 等 21 个场景。 |
|
||||
| `test_model_creation_validation_boundary.py` | `integration` | Real ASGI validation must precede creation reservation and secret writes. |
|
||||
| `test_model_policy_activation.py` | `contract` | 覆盖 current is read only without policy tables、switch and policy commit together without old activate、policy append failure rolls back active and initialization 等 21 个场景。 |
|
||||
| `test_model_policy_routes.py` | `contract` | 覆盖 get does not initialize and capability defaults false、all routes require auth、factory refuses no auth dependency 等 10 个场景。 |
|
||||
| `test_model_policy_activation.py` | `contract` | 覆盖 activation helper is transactional and restores row factory、backlog scan does not hold the single writer、cloud credential is checked without keychain write 等 21 个场景。 |
|
||||
| `test_model_policy_routes.py` | `contract` | 覆盖 all routes require auth、backlog is required not defaulted、enable and transition safe shape and callback once after commit 等 10 个场景。 |
|
||||
| `test_model_probe.py` | `contract` | 覆盖 probe still measures embedding when structured output fails、probe records the real embedding width on the profile、openai compatible probe checks model and structured output 等 23 个场景。 |
|
||||
| `test_model_probe_input_revision.py` | `contract` | 覆盖 input revision precedes measured width update、concurrent update still rejects width or capability cas、early returns record the actual starting revision 等 6 个场景。 |
|
||||
| `test_model_probe_operations.py` | `integration` | Persisted probe identity, real SQLite/API and synthetic transport only. |
|
||||
@@ -300,7 +289,7 @@
|
||||
| `test_model_profile_queue_handover.py` | `contract` | Queued work when the model changes or its configuration is deleted (D75). |
|
||||
| `test_model_profiles.py` | `contract` | 覆盖 profile uses one model and keeps key out of database、api key updates reuse one stable secret reference、startup cleanup removes only secrets not referenced by current profiles 等 15 个场景。 |
|
||||
| `test_model_request_budget.py` | `contract` | 覆盖 persists failed request reservations without content、parallel leases cannot exceed request limit、unknown or excessive output and body are denied 等 6 个场景。 |
|
||||
| `test_model_request_budget_integration.py` | `integration` | Real HY leaf retries plus durable budget accounting; no network or provider. |
|
||||
| `test_model_request_budget_integration.py` | `contract` | Real HY leaf retries plus durable budget accounting; no network or provider. |
|
||||
| `test_model_scope_lifecycle.py` | `contract` | Bound derived/temporary data without changing consent or original history. |
|
||||
| `test_mysql_lifecycle.py` | `contract` | A1-07: the decisions Runtime makes around the bundled MySQL. |
|
||||
| `test_mysql_platform.py` | `contract` | A1-07: the machine-facing half of managing the bundled MySQL. |
|
||||
@@ -310,7 +299,7 @@
|
||||
| `test_oversized_file_guard.py` | `contract` | One pass over a source file is bounded by a byte budget, not skipped. |
|
||||
| `test_parent_watchdog.py` | `integration` | A Core that outlives its launcher makes the next launch impossible. |
|
||||
| `test_policy_api_wiring.py` | `integration` | 覆盖 global model permission off does not backfill、backfill puts history on write jobs without scheduling memory tasks、source pause skips history until the source is reenabled 场景。 |
|
||||
| `test_policy_operation_lookup.py` | `contract` | 覆盖 missing table returns not found without initializing or reading secrets、current operation uses safe receipt without callback or writes、superseded operation preserves historical receipt not current activation 等 12 个场景。 |
|
||||
| `test_policy_operation_lookup.py` | `contract` | 覆盖 corrupt current row cannot make history or missing operation look safe、current operation uses safe receipt without callback or writes、lookup connection rejects writes and preserves database 等 12 个场景。 |
|
||||
| `test_policy_production_entry.py` | `contract` | 覆盖 production serve passes only supported app options、maintenance serve does not own the runtime 场景。 |
|
||||
| `test_precipitation_concurrency_setting.py` | `contract` | Rule 2/9: precipitation concurrency is configurable, not hardcoded to 1. |
|
||||
| `test_primary_source_adapters.py` | `contract` | 覆盖 pipeline json is host generated even when truncated、workbuddy record parsing never blocks the event loop、cursor store user info envelope is not attributed to the person 等 34 个场景。 |
|
||||
@@ -318,20 +307,18 @@
|
||||
| `test_probe_payment_required.py` | `contract` | 覆盖 http 402 without a useful body is still understood as unpaid、a wrong address is still a missing model not an unpaid one 场景。 |
|
||||
| `test_processing_coordinator.py` | `contract` | 覆盖 monitor is retained and observes config plus tasks 场景。 |
|
||||
| `test_processing_merged_context.py` | `contract` | 覆盖 new chunk omits known memory with changed support but keeps original history 场景。 |
|
||||
| `test_processing_requests.py` | `contract` | 覆盖 receipt is small frozen and persistent、grant deduplication never retriggers or changes profile、concurrent create same grant has one id and profile 等 14 个场景。 |
|
||||
| `test_product_contract_coverage.py` | `contract` | 覆盖 full app contract is part of the existing acceptance manifest、core visual phase has its own contract without erasing full product scope 场景。 |
|
||||
| `test_processing_requests.py` | `contract` | 覆盖 concurrent claim only one snapshot wins、concurrent create same grant has one id and profile、concurrent different profile never reuses another scope 等 14 个场景。 |
|
||||
| `test_quality_acceptance.py` | `contract` | 覆盖 acceptance pack is deterministic and scores personal boundary、acceptance score fails missing personal memory 场景。 |
|
||||
| `test_raw_search_without_model.py` | `integration` | Search imported conversations with no generative model configured at all. |
|
||||
| `test_raw_vector_scale_benchmark.py` | `performance` | 覆盖 vector scale probe uses real 512 dimension filtered search 场景。 |
|
||||
| `test_raw_vector_scale_benchmark.py` | `contract` | 覆盖 vector scale probe uses real 512 dimension filtered search 场景。 |
|
||||
| `test_read_path_freshness_batch.py` | `contract` | The row-by-row read check must not scale its query count with the page. |
|
||||
| `test_reader_app.py` | `integration` | The Reader process stays read-only and never blocks a read on its side effects. |
|
||||
| `test_reader_conversation_hit.py` | `contract` | A search hit carries who wrote the row it matched. |
|
||||
| `test_real_load_metrics.py` | `performance` | Run the real access layer under a production-like combined load. |
|
||||
| `test_real_model_prereq_guards.py` | `contract` | Real-model first-run preconditions must fail closed before any egress. |
|
||||
| `test_real_load_metrics.py` | `contract` | Run the real access layer under a production-like combined load. |
|
||||
| `test_recall.py` | `contract` | 覆盖 recall is confirmed only grounded and scope bound、wildcard scope means every scope just like it does in qa、recall returns empty instead of unrelated fallback 等 10 个场景。 |
|
||||
| `test_recall_during_import_probe_contract.py` | `contract` | Guard the source-level recall-during-import probe's sampling semantics. |
|
||||
| `test_recall_excluded_sources.py` | `contract` | D94: an empty result names the sources this host may not read. |
|
||||
| `test_recall_fusion_live.py` | `live` | RCL-04 against a real HY instance instead of a stand-in. |
|
||||
| `test_recall_fusion_live.py` | `integration` | RCL-04 against a real HY instance instead of a stand-in. |
|
||||
| `test_recall_hy_primary.py` | `integration` | Host recall: HY search decides the order, the ledger only filters. |
|
||||
| `test_recall_library_scale.py` | `contract` | 覆盖 recall reaches a memory that is not among the newest 500、semantic recall reaches a memory outside the newest 500、recall still works just below the boundary 等 5 个场景。 |
|
||||
| `test_recall_log_probe_exclusion.py` | `contract` | A-21:R-10 一旦引入召回日志,「探针不污染」必须自动变红而不是静默失效。 |
|
||||
@@ -343,14 +330,13 @@
|
||||
| `test_recall_scope_off_loop.py` | `contract` | The workspace lookup behind an external recall must not run on the loop. |
|
||||
| `test_recent_first_import.py` | `contract` | Recent-file priority survives restart through a selection-bound frozen copy. |
|
||||
| `test_retrieval_chunking.py` | `contract` | 覆盖 default 384 body 64 overlap and exact source slices、all prefix and special tokens count toward strict 512 budget、real tokenizer covers long chinese middle and tail object locations 等 20 个场景。 |
|
||||
| `test_retrieval_eligibility_benchmark.py` | `performance` | 覆盖 scale probe proves composite authority index changes the plan 场景。 |
|
||||
| `test_retrieval_eligibility_benchmark.py` | `contract` | 覆盖 scale probe proves composite authority index changes the plan 场景。 |
|
||||
| `test_retrieval_index_store.py` | `contract` | 覆盖 constructor and reads do not create database or schema、explicit initialization rolls back and never grants model policy、consumer and jobs commit together 等 19 个场景。 |
|
||||
| `test_retrieval_index_supervisor.py` | `contract` | 覆盖 stop waits for native exit and does not close resources、async cancellation repeatedly waits for native thread、idle no trigger no spin and duplicate start rejected 等 14 个场景。 |
|
||||
| `test_retrieval_index_worker.py` | `contract` | 覆盖 tick indexes complete original and reopen can search、change during native encoding never publishes、cancel after encode does not publish and is reclaimable 等 10 个场景。 |
|
||||
| `test_retrieval_lifespan.py` | `integration` | 覆盖 retrieval defaults off and does not create index、enabling retrieval requires runtime ownership、index enabled serve imports without building an unmanaged app 等 6 个场景。 |
|
||||
| `test_retrieval_mapped_content.py` | `contract` | 覆盖 raw authors keep exact body and do not mutate evidence、raw and author qualification rejects without tokenizing、ambiguous generated and body hygiene are not admitted 等 22 个场景。 |
|
||||
| `test_retrieval_mapped_integration.py` | `contract` | 覆盖 empty materialization rechecks excluded map、completed excluded missing active binding is not empty success、old empty completion is invalidated when a new indexed record arrives 等 24 个场景。 |
|
||||
| `test_retrieval_models.py` | `unit` | RCL v2 wire contracts only; no service, model or database is initialized. |
|
||||
| `test_retrieval_provisioning.py` | `contract` | The index has to come up through the product, not through a test helper. |
|
||||
| `test_retrieval_query_plan.py` | `contract` | Local QueryPlan: extract URL/path objects. |
|
||||
| `test_retrieval_raw_candidates.py` | `contract` | 覆盖 positive only current authorized published chunks are searched、empty authority never reads database or vector、unapproved source never enters vector query 等 15 个场景。 |
|
||||
@@ -384,7 +370,7 @@
|
||||
| `test_secret_store_error_codes.py` | `integration` | 3925a kernel item 3: keychain failure classification and backoff that heals. |
|
||||
| `test_secure_storage.py` | `integration` | 覆盖 isolated keychain service namespace、custom keychain service is refused outside isolated tests、packaged keychain budget covers loaded process startup 等 20 个场景。 |
|
||||
| `test_sedimentation_concurrency.py` | `contract` | Sedimentation runs several harnesses at once, but one harness at a time. |
|
||||
| `test_service_level_pressure_acceptance.py` | `performance` | 覆盖 workbuddy recall remains available during 100k import 场景。 |
|
||||
| `test_service_level_pressure_acceptance.py` | `contract` | 覆盖 workbuddy recall remains available during 100k import 场景。 |
|
||||
| `test_service_levels.py` | `contract` | 覆盖 background never consumes the realtime reservation、realtime is next for the same source after background yields、import history gets one slice after nine realtime admissions 等 8 个场景。 |
|
||||
| `test_session_inbox.py` | `contract` | A session inbox is not a shared mailbox and a pull is not adoption. |
|
||||
| `test_session_lease.py` | `contract` | A session file on disk is not proof that the session is online. |
|
||||
@@ -393,7 +379,7 @@
|
||||
| `test_simplified_model_permission_migrations.py` | `contract` | 覆盖 fresh schema omits removed permission state machines 场景。 |
|
||||
| `test_snapshot_adapter.py` | `contract` | Selection-only binding reopens checksum-verified frozen copies. |
|
||||
| `test_snapshot_pool.py` | `contract` | A whole-directory snapshot must not hold a thread everything else is waiting for. |
|
||||
| `test_soak_probe_effectiveness.py` | `contract` | The soak probe must observe the load it reports on. |
|
||||
| `test_soak_probe_effectiveness.py` | `integration` | The soak probe must observe the load it reports on. |
|
||||
| `test_source_access.py` | `contract` | 覆盖 source root requires explicit user grant、sensitive home directory is rejected without requesting os access、authorized file cannot escape root through a symlink 等 24 个场景。 |
|
||||
| `test_source_candidate_api.py` | `integration` | Candidate location changes must not implicitly grant or import anything. |
|
||||
| `test_source_candidate_connections.py` | `contract` | 覆盖 empty candidate revisions preserve default fingerprint、persisted candidate requires exact revision、connection resolves candidate in transaction and prior replay never regrants 等 7 个场景。 |
|
||||
@@ -420,7 +406,7 @@
|
||||
| `test_source_write_switch.py` | `contract` | A frozen Harness produces no extraction tasks. |
|
||||
| `test_sql_compat.py` | `contract` | The shared compatibility layer, especially 'rowcount'. |
|
||||
| `test_sqlite_semantics_gate.py` | `contract` | D56: prevent SQLite implementation details spreading outside the data layer. |
|
||||
| `test_sqlite_write_contention.py` | `performance` | Measure whether SQLite's single writer actually blocks us. |
|
||||
| `test_sqlite_write_contention.py` | `contract` | Measure whether SQLite's single writer actually blocks us. |
|
||||
| `test_storage_ingest_journal.py` | `contract` | 覆盖 legacy put and reopen never initialize journal、initialized put records final origins create revision and noop、attribution propagation journals old rows as maintenance only 等 11 个场景。 |
|
||||
| `test_store_binding.py` | `contract` | A2: which store is in force, and honest reporting of it. |
|
||||
| `test_store_binding_ratchet.py` | `contract` | D56: ratchet the retired dual-engine 'store_for' seam out of the Core. |
|
||||
@@ -432,7 +418,6 @@
|
||||
| `test_tail_metadata_lane.py` | `contract` | Post-response metadata retries must be bounded and never block the route. |
|
||||
| `test_terminal_payload_reaping.py` | `contract` | Rule 14: dead-end payloads are actually reaped, not just reapable. |
|
||||
| `test_tool_evidence_hy_turns.py` | `contract` | Every adapter's tool records reach HY inside the turn they happened in. |
|
||||
| `test_training_extraction_and_baseline.py` | `contract` | R-17:抽取结果落盘成训练数据,评测基线冻结成可复跑产物。 |
|
||||
| `test_two_level_discovery.py` | `contract` | 3925a kernel item 1: two-level discovery. |
|
||||
| `test_ui_session.py` | `contract` | 覆盖 exchange is single use and creates a session、expired exchange cannot create a session、exchange is bound to the core instance 等 5 个场景。 |
|
||||
| `test_ui_session_api.py` | `integration` | 覆盖 ui session exchange sets httponly strict cookie、ui session requires bearer for exchange、ui session reports missing web assets 场景。 |
|
||||
@@ -448,4 +433,4 @@
|
||||
| `test_workspace_recall.py` | `contract` | Workspace memories were unreachable from every host; these pin the way in. |
|
||||
| `test_write_queue_lease_renewal.py` | `contract` | Rule 8: a lease must outlive the work it covers, and be renewed while it runs. |
|
||||
|
||||
共 443 个测试文件。
|
||||
共 428 个测试文件。
|
||||
@@ -14,14 +14,13 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
PRIMARY_MARKERS = ("unit", "contract", "integration", "performance", "live")
|
||||
EXPECTED_TEST_FILE_COUNT = 443
|
||||
EXPECTED_TEST_FILES_SHA256 = "6d4815ac6a76cfa3f6208672052b785c7562083cf9d122cc9ddc796b8e624d43"
|
||||
EXPECTED_TEST_FILE_COUNT = 428
|
||||
EXPECTED_TEST_FILES_SHA256 = "bd3bf4fc9cda2a8e4427d106283c40d22dad026fd452db954046b6f28d21b896"
|
||||
|
||||
# Pure transformations, validation models, parity checks and state machines.
|
||||
# This list is intentionally small: uncertain files default to contract.
|
||||
UNIT_FILES = frozenset(
|
||||
{
|
||||
"test_context_host_artifact.py",
|
||||
"test_context_v2_contract_parity.py",
|
||||
"test_daemon_contract.py",
|
||||
"test_diagnostic_payload_keys.py",
|
||||
@@ -34,7 +33,6 @@ UNIT_FILES = frozenset(
|
||||
"test_memory_server_config_state.py",
|
||||
"test_memory_server_contracts.py",
|
||||
"test_memory_server_job_state.py",
|
||||
"test_retrieval_models.py",
|
||||
"test_scan_roots.py",
|
||||
"test_scanner_classifier.py",
|
||||
"test_scanner_sessionizer.py",
|
||||
@@ -50,7 +48,6 @@ UNIT_FILES = frozenset(
|
||||
INTEGRATION_FILES = frozenset(
|
||||
{
|
||||
"test_auth.py",
|
||||
"test_backfill_acceptance_lifecycle.py",
|
||||
"test_backup_endpoint.py",
|
||||
"test_backup_restore_api.py",
|
||||
"test_c1_import_via_api_path.py",
|
||||
@@ -58,11 +55,9 @@ INTEGRATION_FILES = frozenset(
|
||||
"test_capture_deadline.py",
|
||||
"test_chat_exports.py",
|
||||
"test_cli_lifecycle.py",
|
||||
"test_concurrent_import_processing.py",
|
||||
"test_connection_lifetime.py",
|
||||
"test_context_api.py",
|
||||
"test_context_search_both_paths.py",
|
||||
"test_continuous_processing_integration.py",
|
||||
"test_conversation_search.py",
|
||||
"test_credential_responsiveness.py",
|
||||
"test_d93_same_process_load.py",
|
||||
@@ -75,7 +70,6 @@ INTEGRATION_FILES = frozenset(
|
||||
"test_file_import_operations.py",
|
||||
"test_four_app_live_ingest.py",
|
||||
"test_graph_width_endpoint.py",
|
||||
"test_health.py",
|
||||
"test_home_summary.py",
|
||||
"test_hy_writeback.py",
|
||||
"test_import_api.py",
|
||||
@@ -85,7 +79,6 @@ INTEGRATION_FILES = frozenset(
|
||||
"test_log_privacy.py",
|
||||
"test_loopback_origin_write.py",
|
||||
"test_main_database_entry.py",
|
||||
"test_manual_memory_via_hy.py",
|
||||
"test_manual_transcript_import.py",
|
||||
"test_matter_collection.py",
|
||||
"test_matter_hy_integration.py",
|
||||
@@ -113,7 +106,6 @@ INTEGRATION_FILES = frozenset(
|
||||
"test_model_probe_operations.py",
|
||||
"test_model_profile_api.py",
|
||||
"test_model_profile_context_reset.py",
|
||||
"test_model_request_budget_integration.py",
|
||||
"test_onboarding_profile.py",
|
||||
"test_parent_watchdog.py",
|
||||
"test_policy_api_wiring.py",
|
||||
|
||||
@@ -328,7 +328,7 @@ def test_revoking_during_coding_extraction_stops_the_route(tmp_path):
|
||||
|
||||
|
||||
def test_exposed_coding_config_is_a_redacted_projection_not_the_native_handle(tmp_path):
|
||||
"""Public SDK 2.0.1 reads `config` off the coding store; it must not hand out secrets.
|
||||
"""Public SDK 2.0.2 reads `config` off the coding store; it must not hand out secrets.
|
||||
|
||||
The wrapper answers `config` so the SDK's routing works, but the native
|
||||
MemoryConfig is a live backend handle carrying api keys and passwords. This
|
||||
|
||||
@@ -1324,7 +1324,7 @@ def test_hy_runtime_matches_public_sdk_without_reranker_or_service_backends(
|
||||
config = build_hy_memory_config(profile, api_key=None, data_dir=tmp_path)
|
||||
|
||||
assert HY_MEMORY_DISTRIBUTION == "hy-memory"
|
||||
assert HY_MEMORY_VERSION == "2.0.1"
|
||||
assert HY_MEMORY_VERSION == "2.0.2"
|
||||
assert HY_MEMORY_MODE == "ultra"
|
||||
assert HY_MEMORY_READER == "hybrid"
|
||||
assert os.environ["MEMORY_MODE"] == "ultra"
|
||||
|
||||
@@ -325,7 +325,7 @@ def grant_records(supervisor, records, expected_revision=0):
|
||||
|
||||
@asynccontextmanager
|
||||
async def raw_client(tmp_path, *, tool=None, conversation_id="raw-session"):
|
||||
assert hy_memory_version() == "2.0.1"
|
||||
assert hy_memory_version() == "2.0.2"
|
||||
root = tmp_path / "source"
|
||||
root.mkdir()
|
||||
database = tmp_path / "one-memory.sqlite3"
|
||||
@@ -627,7 +627,7 @@ async def assert_outputs(supervisor, task, records, client, *, raw_records=None)
|
||||
memory = by_content[record.verbatim]
|
||||
output = next(output for output in outputs if output.memory_id == memory.memory_id)
|
||||
assert output.owner == CLAIMS[record.verbatim]
|
||||
assert output.engine == "hy-memory" and output.engine_version == "2.0.1"
|
||||
assert output.engine == "hy-memory" and output.engine_version == "2.0.2"
|
||||
assert output.hy_memory_id == memory.memory_id
|
||||
assert output.memory_revision == memory.revision
|
||||
assert output.support_refs == (evidence_ref(record),)
|
||||
@@ -819,7 +819,7 @@ def test_approved_native_candidates_are_reused_without_disclosing_denied_nodes(t
|
||||
assert not oracle.errors, oracle.errors
|
||||
assert await node_snapshots(client, DENIED_IDS) == before
|
||||
assert result.status == "completed", (result.last_error_code, oracle.stages)
|
||||
# SDK 2.0.1 keeps the `limit=1` pre-check removed, so
|
||||
# SDK 2.0.2 keeps the `limit=1` pre-check removed, so
|
||||
# skip reconcile, so the second write now compares against the
|
||||
# already-approved candidates instead of blindly ADDing them. The
|
||||
# contract is the reuse itself, not the absence of the call: one
|
||||
|
||||
@@ -592,7 +592,7 @@ def test_update_cannot_retarget_identity_or_add_denied_chain():
|
||||
{"user_id": "other"},
|
||||
{"node_id": "other"},
|
||||
{"supersedes": ["outside"]},
|
||||
# `custom` remains an allowed field name for SDK 2.0.1; the field it
|
||||
# `custom` remains an allowed field name for SDK 2.0.2; the field it
|
||||
# must not smuggle through is the digest-only System 2 counter.
|
||||
{"custom": {"s2_evidence_count": 1}},
|
||||
{"tag_ners": "not-a-list"},
|
||||
|
||||
@@ -258,7 +258,7 @@ def test_native_entry_points_preserve_payload_response_and_restore_instances():
|
||||
def test_permission_transport_pins_the_public_sdk_identity():
|
||||
"""The transport fails closed unless the audited SDK identity is installed."""
|
||||
assert HY_MEMORY_DISTRIBUTION == "hy-memory"
|
||||
assert HY_MEMORY_VERSION == "2.0.1"
|
||||
assert HY_MEMORY_VERSION == "2.0.2"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("entry", ["complete", "complete_messages", "embed"])
|
||||
@@ -445,7 +445,7 @@ def test_config_drift_or_overrides_deny_before_send(change):
|
||||
elif change == "model":
|
||||
provider._llm_config.model = "not-approved"
|
||||
elif change == "backend":
|
||||
# Public SDK 2.0.1 keeps LLMBackend narrowed to OPENAI, so the
|
||||
# Public SDK 2.0.2 keeps LLMBackend narrowed to OPENAI, so the
|
||||
# drifted-backend case uses an illegal sentinel value
|
||||
# instead. It must differ from the approved openai backend,
|
||||
# otherwise no drift is constructed at all.
|
||||
|
||||
@@ -62,5 +62,10 @@ def test_the_installed_sdk_is_the_pinned_one():
|
||||
|
||||
def test_the_pin_matches_the_lock_file_and_its_wheel():
|
||||
lock = (DOCUMENT.parent / "apps/core/uv.lock").read_text(encoding="utf-8")
|
||||
assert f"{HY_MEMORY_DISTRIBUTION}/{HY_MEMORY_VERSION}/" in lock
|
||||
assert re.search(
|
||||
rf'\[\[package\]\]\nname = "{HY_MEMORY_DISTRIBUTION}"\n'
|
||||
rf'version = "{HY_MEMORY_VERSION}"',
|
||||
lock,
|
||||
)
|
||||
assert f"hy_memory-{HY_MEMORY_VERSION}-" in lock
|
||||
assert f'specifier = "=={HY_MEMORY_VERSION}"' in lock
|
||||
@@ -69,7 +69,7 @@ def test_no_idempotency_key_means_unknown_must_remain() -> None:
|
||||
|
||||
|
||||
def test_measured_sdk_verdict_is_recorded() -> None:
|
||||
"""Pin the measured answer for `hy_memory-internal==2.0.1`.
|
||||
"""Pin the measured answer for `hy-memory==2.0.2`.
|
||||
|
||||
The finding: `add()` takes a `request_id` but nothing de-duplicates on it,
|
||||
while `MemoryInspector.get_pipeline_logs(request_id=...)` can look the
|
||||
|
||||
@@ -4,7 +4,7 @@ Dev history: when the model extracted no fact, the coding extractor stored the
|
||||
raw dialogue as a working fact, and with no words of the person's it took the
|
||||
first 600 characters of the rendered trace. MemHub showed that as the memory
|
||||
content, which is where `[0] assistant: ... [1] tool(?): ...` came from
|
||||
(D87). The SDK fix is present in 2.0.1: it does not store that fallback by
|
||||
(D87). The SDK fix is present in 2.0.2: it does not store that fallback by
|
||||
default.
|
||||
|
||||
This pins the default here, so a future bump that turns it back on, or our own
|
||||
|
||||
Generated
+75
-26
@@ -593,6 +593,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "coloredlogs"
|
||||
version = "15.0.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "humanfriendly" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/cc/c7/eed8f27100517e8c0e6b923d5f0845d0cb99763da6fdee00478f91db7325/coloredlogs-15.0.1.tar.gz", hash = "sha256:7c991aa71a4577af2f82600d8f8f3a89f936baeaf9b50a9c197da014e5bf16b0", size = 278520, upload-time = "2021-06-11T10:22:45.202Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a7/06/3d6badcf13db419e25b07041d9c7b4a2c331d3f4e7134445ec5df57714cd/coloredlogs-15.0.1-py2.py3-none-any.whl", hash = "sha256:612ee75c546f53e92e70049c9dbfcc18c935a2b9a53b66085ce9ef6a6e5c0934", size = 46018, upload-time = "2021-06-11T10:22:42.561Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cryptography"
|
||||
version = "50.0.1"
|
||||
@@ -965,9 +977,21 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/a5/47c2ea9b228ccbcba8467e9a64823146e8ebbad29855e591d8f5eedcc9c7/huggingface_hub-1.29.0-py3-none-any.whl", hash = "sha256:b00f7782afc14db4bc6572763810a635bdfbab8623d957bfb553bd18e03852cd", size = 795768, upload-time = "2026-08-27T12:18:35.431Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humanfriendly"
|
||||
version = "10.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "pyreadline3", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/cc/3f/2c29224acb2e2df4d2046e4c73ee2662023c58ff5b113c4c1adac0886c43/humanfriendly-10.0.tar.gz", hash = "sha256:6b0b831ce8f15f7300721aa49829fc4e83921a9a301cc7f606be6686a2288ddc", size = 360702, upload-time = "2021-09-17T21:40:43.31Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f0/0f/310fb31e39e2d734ccaa2c0fb981ee41f7bd5056ce9bc29b2248bd569169/humanfriendly-10.0-py2.py3-none-any.whl", hash = "sha256:1697e1a8a8f550fd43c2865cd84542fc175a61dcb779b6fee18cf6b6ccba1477", size = 86794, upload-time = "2021-09-17T21:40:39.897Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hy-memory"
|
||||
version = "2.0.1"
|
||||
version = "2.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "chromadb" },
|
||||
@@ -984,9 +1008,9 @@ dependencies = [
|
||||
{ name = "scikit-learn" },
|
||||
{ name = "tiktoken" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/0d/9174fa81cb7413254e71684db1c94775b6191f1a004179ca9d7b6b312f49/hy_memory-2.0.1.tar.gz", hash = "sha256:78764c3f8e4458e211e572a0d9dfc74fb2f19aaa3ba5fdc775a9693daf6f6a34", size = 819506, upload-time = "2026-10-15T17:24:49.881Z" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b4/45/367b6d319f8f6c4fb99ee84d440e19616e64096fa50c3cc7672f7ef98653/hy_memory-2.0.2.tar.gz", hash = "sha256:1ba3b0d0bb1eb15ce9bf9b055190449614f93b550d02fb1646469dd01162c77e", size = 823220, upload-time = "2026-10-16T16:01:48.002Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/35/783fd23ce9cde1b3248a3fd4abf04c7ae21d5ee9d2cd820c752bbed7db9d/hy_memory-2.0.1-py3-none-any.whl", hash = "sha256:87c1b0e3a419b950b1d72009a5a03b453a56b0daa25d851de85932f204a244f0", size = 883333, upload-time = "2026-10-15T17:24:47.568Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1f/0e/2a95b967ec29165fe36e3f6d7da3e07baeb6d7404a023d4b816223c8af60/hy_memory-2.0.2-py3-none-any.whl", hash = "sha256:e76419c3313db4fd4850249ec833ce7f98d17049a3e346b06bb1461038021384", size = 886789, upload-time = "2026-10-16T16:01:45.899Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1513,6 +1537,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e8/3d/1087453384dbde46a8c7f9356eead2c58be8a7bf156bca40243377c85715/more_itertools-11.1.0-py3-none-any.whl", hash = "sha256:4b65538ae22f6fed0ce4874efd317463a7489796a0939fa66824dd542125a192", size = 72226, upload-time = "2026-05-22T14:14:28.824Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mpmath"
|
||||
version = "1.3.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e0/47/dd32fa426cc72114383ac549964eecb20ecfd886d1e5ccf5340b55b02f57/mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f", size = 508106, upload-time = "2023-03-07T16:47:11.061Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c", size = 536198, upload-time = "2023-03-07T16:47:09.197Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multidict"
|
||||
version = "6.7.1"
|
||||
@@ -1768,7 +1801,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "one-memory"
|
||||
version = "1.0.0"
|
||||
version = "1.0.2"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "aiomysql" },
|
||||
@@ -1804,10 +1837,10 @@ requires-dist = [
|
||||
{ name = "fastapi", specifier = ">=0.141.1" },
|
||||
{ name = "filelock", specifier = ">=3.32.4" },
|
||||
{ name = "httpx", specifier = ">=0.28.1" },
|
||||
{ name = "hy-memory", specifier = "==2.0.1" },
|
||||
{ name = "hy-memory", specifier = "==2.0.2" },
|
||||
{ name = "keyring", specifier = ">=25.7.0" },
|
||||
{ name = "numpy", specifier = "==2.5.2" },
|
||||
{ name = "onnxruntime", specifier = ">=1.22.0" },
|
||||
{ name = "onnxruntime", specifier = "==1.23.2" },
|
||||
{ name = "pydantic-settings", specifier = ">=2.15.0" },
|
||||
{ name = "tokenizers", specifier = ">=0.21.0" },
|
||||
{ name = "uvicorn", extras = ["standard"], specifier = ">=0.52.4" },
|
||||
@@ -1827,34 +1860,29 @@ dev = [
|
||||
|
||||
[[package]]
|
||||
name = "onnxruntime"
|
||||
version = "1.29.0"
|
||||
version = "1.23.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "coloredlogs" },
|
||||
{ name = "flatbuffers" },
|
||||
{ name = "numpy" },
|
||||
{ name = "packaging" },
|
||||
{ name = "protobuf" },
|
||||
{ name = "sympy" },
|
||||
]
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d4/80/381c1e9efed9cc32d00aa7cab0547dc84116cec906c3ffe3613686d6963a/onnxruntime-1.29.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:3a3814c041251d6a77fdf513fb282056538ee826d2f1178a0df3c549d3fff6ba", size = 21430049, upload-time = "2026-08-17T22:53:48.286Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/12/4be0e345d38fe707a701ca07e8f63c05b152a2e6285d1e43a7faf63fedd2/onnxruntime-1.29.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:d2fb19e848f7c33ed8d3182b52504aaa11c5e8da438bbb47296f85b133cbcf6b", size = 20816870, upload-time = "2026-08-17T22:53:51.169Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/96/eb/e6968f5e41aac3125f2ff5708855f09cb0b70d85ed3115b625b0b58305ba/onnxruntime-1.29.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:2b80d8c7ec2cc7438e4da3760b88c24568cba72c9ace96d668800a6c79419acb", size = 23136745, upload-time = "2026-08-17T22:53:53.92Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b4/80/5b28f1f1111210fc4a336ddbc6950f468ebf9a6a265420568f4f43fa33ce/onnxruntime-1.29.0-cp312-cp312-win_amd64.whl", hash = "sha256:4acf2b4948b7ede87221ca6332344b8facdc8059d6ac751a7d367d04532b02dd", size = 14001407, upload-time = "2026-08-17T22:53:56.486Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/6f/d6/6883f89ea4b044e6e8447ebfaf9bcecdf457b7d80a683635e130b25498e0/onnxruntime-1.29.0-cp312-cp312-win_arm64.whl", hash = "sha256:dc61a79cb39afd66ab3f01fd2c23591a7f01de89c1668e1fb6315067fc279164", size = 13746981, upload-time = "2026-08-17T22:53:58.977Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/41/f8/d375facf60edaf41f5732f9f689c98a800fcc52df5cf6ddfb406703eb5a1/onnxruntime-1.29.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:be0f8ed688cfb1d4d5765a137193b7bfab0c8ea214eed99260b380bb525a3a7f", size = 21429708, upload-time = "2026-08-17T22:54:01.44Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c9/17/b9ad04051a8c4f504852ce0e8e10f9a6b2f1a331eedcdcc503df776dd0ea/onnxruntime-1.29.0-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:d67673c5367727860922c5262d724472f1b5539fb7ccf4c81a638f9b71719803", size = 20816263, upload-time = "2026-08-17T22:54:04.088Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/83/2c/d8eb945d2a372149df9705a8d5c8d7c6c46c987c5446dbcea9e1ea7f6556/onnxruntime-1.29.0-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:e2128f31f449e922c62dbe5d8b6b7b079f0bcaf2d56a102fa203cb6e5bb5ab19", size = 23136817, upload-time = "2026-08-17T22:54:06.714Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/3b/66b424c63fa92dfaa48d1719efaae66fc8c256b9426a832eda51d8dfe1e9/onnxruntime-1.29.0-cp313-cp313-win_amd64.whl", hash = "sha256:2945e1f82f81f27e88decea88c7861f45baea23818950d467bf3909aa303119e", size = 14001310, upload-time = "2026-08-17T22:54:09.13Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/83/22/d6a700e3a6322fa3d56fbe7cee9ffc53f35e77ffcd6b7e97f4b7722a27ab/onnxruntime-1.29.0-cp313-cp313-win_arm64.whl", hash = "sha256:4b940b0d777590c7e20bf298f5c16af1ea6ad1b400a1c822a6be192f64f4d954", size = 13747112, upload-time = "2026-08-17T22:54:11.608Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/89/c4af146de3d60a32c89fea48d5d34bfd044faaf8957270043a03bd1b462b/onnxruntime-1.29.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:533f8370ce124304e5cb08ab961836cf755631e3dd77adc5f3bbdab70c2b7d99", size = 20826136, upload-time = "2026-08-17T22:54:14.315Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/9d/f2/e6bbacd11dfe8d070613261a758795ea128b9fc9bea391a2a7da2e4c7a08/onnxruntime-1.29.0-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:c1ad3f437153fe77f9d01a08fbaac0beb030e09b8a80ace1603bcf69b6c95481", size = 23138951, upload-time = "2026-08-17T22:54:17.154Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ff/a3/718e1b83096a1bc7b0fc8014c23d4cf795559fe666961cfac4fc038a4871/onnxruntime-1.29.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:e74b278af1d949876f5d91d1268fd6c680e79f2bac194967394eaba9fdf69e7e", size = 21431104, upload-time = "2026-08-17T22:54:20.118Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4e/17/c75e78ddc1fe69b6ebaef7fe88ac83f29bfe10955e3a0d2436d93473c91c/onnxruntime-1.29.0-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:939e5d65f332e6d399774b2bd0d3559fd8fa629c1e77833db29d968d2384f23d", size = 20818488, upload-time = "2026-08-17T22:54:23.147Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/65/54/9f197c578d3d3d7bea16971e233e5483981228eec73748585cf7b5933403/onnxruntime-1.29.0-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:6c0c37b92f67ed68dd36221ce0403e1d9bd4f7efce724439978a2597848530e5", size = 23136994, upload-time = "2026-08-17T22:54:26.321Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/24/53/4616a55d2495679cfd0195f968feb3d74fe30e26467d168ee243ac97c089/onnxruntime-1.29.0-cp314-cp314-win_amd64.whl", hash = "sha256:4a3129ae56e70d2618ff773920166916310370a7e3cacb60b9e0e8910092725f", size = 14350643, upload-time = "2026-08-17T22:54:28.794Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0a/0f/c338cb5500a522c7e671a3bb1276f4562404fbecce8a0e274565aa968484/onnxruntime-1.29.0-cp314-cp314-win_arm64.whl", hash = "sha256:e417ef8628dcce310d2d53023e750ea298ec14d4341ae6dc3a572bfd9bc7fa97", size = 14124294, upload-time = "2026-08-17T22:54:31.015Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b8/e7/61064289a9a1301b25c1f0f574fe98aba31c2d388db3c1dbec664f78621f/onnxruntime-1.29.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:11264bb58f7b7cf6af835ab10d36838d73680580820fd6f51d90124a1ca8f449", size = 20826174, upload-time = "2026-08-17T22:54:34.283Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/21/d0c04b561b46e9bff89b5f500fb7415b8ca0669f7902204f76ab06bb0c7e/onnxruntime-1.29.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:1ea91cef3b971506e51ae9c37c16d027774ec64994a524ec1bdfb027d68a9832", size = 23138547, upload-time = "2026-08-17T22:54:37.491Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1b/9e/f748cd64161213adeef83d0cb16cb8ace1e62fa501033acdd9f9341fff57/onnxruntime-1.23.2-cp312-cp312-macosx_13_0_arm64.whl", hash = "sha256:b8f029a6b98d3cf5be564d52802bb50a8489ab73409fa9db0bf583eabb7c2321", size = 17195929, upload-time = "2025-10-22T03:47:36.24Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/9d/a81aafd899b900101988ead7fb14974c8a58695338ab6a0f3d6b0100f30b/onnxruntime-1.23.2-cp312-cp312-macosx_13_0_x86_64.whl", hash = "sha256:218295a8acae83905f6f1aed8cacb8e3eb3bd7513a13fe4ba3b2664a19fc4a6b", size = 19157705, upload-time = "2025-10-22T03:46:40.415Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/35/4e40f2fba272a6698d62be2cd21ddc3675edfc1a4b9ddefcc4648f115315/onnxruntime-1.23.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:76ff670550dc23e58ea9bc53b5149b99a44e63b34b524f7b8547469aaa0dcb8c", size = 15226915, upload-time = "2025-10-22T03:46:27.773Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ef/88/9cc25d2bafe6bc0d4d3c1db3ade98196d5b355c0b273e6a5dc09c5d5d0d5/onnxruntime-1.23.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f9b4ae77f8e3c9bee50c27bc1beede83f786fe1d52e99ac85aa8d65a01e9b77", size = 17382649, upload-time = "2025-10-22T03:47:02.782Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/b4/569d298f9fc4d286c11c45e85d9ffa9e877af12ace98af8cab52396e8f46/onnxruntime-1.23.2-cp312-cp312-win_amd64.whl", hash = "sha256:25de5214923ce941a3523739d34a520aac30f21e631de53bba9174dc9c004435", size = 13470528, upload-time = "2025-10-22T03:47:28.106Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/41/fba0cabccecefe4a1b5fc8020c44febb334637f133acefc7ec492029dd2c/onnxruntime-1.23.2-cp313-cp313-macosx_13_0_arm64.whl", hash = "sha256:2ff531ad8496281b4297f32b83b01cdd719617e2351ffe0dba5684fb283afa1f", size = 17196337, upload-time = "2025-10-22T03:46:35.168Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/f9/2d49ca491c6a986acce9f1d1d5fc2099108958cc1710c28e89a032c9cfe9/onnxruntime-1.23.2-cp313-cp313-macosx_13_0_x86_64.whl", hash = "sha256:162f4ca894ec3de1a6fd53589e511e06ecdc3ff646849b62a9da7489dee9ce95", size = 19157691, upload-time = "2025-10-22T03:46:43.518Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/1c/a1/428ee29c6eaf09a6f6be56f836213f104618fb35ac6cc586ff0f477263eb/onnxruntime-1.23.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:45d127d6e1e9b99d1ebeae9bcd8f98617a812f53f46699eafeb976275744826b", size = 15226898, upload-time = "2025-10-22T03:46:30.039Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f2/2b/b57c8a2466a3126dbe0a792f56ad7290949b02f47b86216cd47d857e4b77/onnxruntime-1.23.2-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8bace4e0d46480fbeeb7bbe1ffe1f080e6663a42d1086ff95c1551f2d39e7872", size = 17382518, upload-time = "2025-10-22T03:47:05.407Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/93/aba75358133b3a941d736816dd392f687e7eab77215a6e429879080b76b6/onnxruntime-1.23.2-cp313-cp313-win_amd64.whl", hash = "sha256:1f9cc0a55349c584f083c1c076e611a7c35d5b867d5d6e6d6c823bf821978088", size = 13470276, upload-time = "2025-10-22T03:47:31.193Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/3d/6830fa61c69ca8e905f237001dbfc01689a4e4ab06147020a4518318881f/onnxruntime-1.23.2-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9d2385e774f46ac38f02b3a91a91e30263d41b2f1f4f26ae34805b2a9ddef466", size = 15229610, upload-time = "2025-10-22T03:46:32.239Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/ca/862b1e7a639460f0ca25fd5b6135fb42cf9deea86d398a92e44dfda2279d/onnxruntime-1.23.2-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e2b9233c4947907fd1818d0e581c049c41ccc39b2856cc942ff6d26317cee145", size = 17394184, upload-time = "2025-10-22T03:47:08.127Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2497,6 +2525,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/24/12818598c362d7f300f18e74db45963dbcb85150324092410c8b49405e42/pyproject_hooks-1.2.0-py3-none-any.whl", hash = "sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913", size = 10216, upload-time = "2024-09-29T09:24:11.978Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pyreadline3"
|
||||
version = "3.5.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b6/6d/f94028646d7bbe6d9d873c47ee7c246f2d29129d253f0d96cb6fcab70733/pyreadline3-3.5.6.tar.gz", hash = "sha256:61e53218b99656091ddb077df9e71f25850e72e030b6183b39c9b7e6e4f4a9bf", size = 100368, upload-time = "2026-05-14T17:55:04.471Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f7/5e/35c856e186b74678c24927847ad9895a51f1bc02a0c6126477a6c6040064/pyreadline3-3.5.6-py3-none-any.whl", hash = "sha256:8449b734232e42a5dcd74048e39b60db2839a4c38cf3ae2bf7707d58b5389c0d", size = 85243, upload-time = "2026-05-14T17:55:03.262Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "9.1.1"
|
||||
@@ -3050,6 +3087,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c8/cb/6a6a47d5b464bd08695d254f3da6e7986cc70c9fa5d778eda57538edfe56/starlette-1.6.0-py3-none-any.whl", hash = "sha256:a86dd39d14bb45f85a3d18525215a9ef0cfd1f192ac793220e72598c90335f0c", size = 75969, upload-time = "2026-08-08T18:27:56.196Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sympy"
|
||||
version = "1.14.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "mpmath" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/83/d3/803453b36afefb7c2bb238361cd4ae6125a569b4db67cd9e79846ba2d68c/sympy-1.14.0.tar.gz", hash = "sha256:d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517", size = 7793921, upload-time = "2025-04-27T18:05:01.611Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a2/09/77d55d46fd61b4a135c444fc97158ef34a095e5681d0a6c10b75bf356191/sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5", size = 6299353, upload-time = "2025-04-27T18:04:59.103Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tenacity"
|
||||
version = "9.1.4"
|
||||
|
||||
@@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="172"><defs><filter id="filter_0" color-interpolation-filters="sRGB" x="0" y="8" width="164" height="164" filterUnits="userSpaceOnUse"><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="0" dy="8"/><feGaussianBlur stdDeviation="9"/><feColorMatrix type="matrix" values="0 0 0 0 0.2 0 0 0 0 0.28 0 0 0 0 0.34 0 0 0 0.12 0" result="shadow"/></filter></defs><g filter="url(#filter_0)"><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><clipPath id="clip_0"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_0)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></g><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#829CAD" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#4F6373" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><path fill="#5E7C8C" transform="matrix(1 0 0 1 79 64)" d="M23 0L23 22Q23 26.6757 21.1904 30.9547Q19.4442 35.0835 16.2639 38.2639Q13.0835 41.4442 8.9547 43.1904Q4.6757 45 0 45Q-2.5153 45.0724 -4.2426 43.2426Q-6.0724 41.5153 -6 39Q-6.0724 36.4847 -4.2426 34.7574Q-2.5153 32.9276 0 33Q2.2425 33 4.2806 32.1381Q6.2535 31.3037 7.7786 29.7786Q9.3037 28.2535 10.1381 26.2806Q11 24.2425 11 22L11 0Q10.9276 -2.5153 12.7574 -4.2426Q14.4847 -6.0724 17 -6Q19.5153 -6.0724 21.2426 -4.2426Q23.0724 -2.5153 23 0Z"/><clipPath id="clip_1"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_1)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></svg>
|
||||
<?xml version="1.0" encoding="utf-8" ?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="164" height="172"><title>MemHub</title><defs><filter id="filter_0" color-interpolation-filters="sRGB" x="0" y="8" width="164" height="164" filterUnits="userSpaceOnUse"><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dx="0" dy="8"/><feGaussianBlur stdDeviation="9"/><feColorMatrix type="matrix" values="0 0 0 0 0.2 0 0 0 0 0.28 0 0 0 0 0.34 0 0 0 0.12 0" result="shadow"/></filter></defs><g filter="url(#filter_0)"><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#FFF" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><clipPath id="clip_0"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_0)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></g><rect fill="#FFF" transform="matrix(1 0 0 1 18 18)" width="128" height="128" rx="28" ry="28"/><rect fill="none" stroke="#829CAD" stroke-width="12" transform="matrix(1 0 0 1 46 41)" width="56" height="68" rx="23" ry="23"/><rect fill="none" stroke="#4F6373" stroke-width="12" transform="matrix(1 0 0 1 62 55)" width="56" height="68" rx="23" ry="23"/><path fill="#5E7C8C" transform="matrix(1 0 0 1 79 64)" d="M23 0L23 22Q23 26.6757 21.1904 30.9547Q19.4442 35.0835 16.2639 38.2639Q13.0835 41.4442 8.9547 43.1904Q4.6757 45 0 45Q-2.5153 45.0724 -4.2426 43.2426Q-6.0724 41.5153 -6 39Q-6.0724 36.4847 -4.2426 34.7574Q-2.5153 32.9276 0 33Q2.2425 33 4.2806 32.1381Q6.2535 31.3037 7.7786 29.7786Q9.3037 28.2535 10.1381 26.2806Q11 24.2425 11 22L11 0Q10.9276 -2.5153 12.7574 -4.2426Q14.4847 -6.0724 17 -6Q19.5153 -6.0724 21.2426 -4.2426Q23.0724 -2.5153 23 0Z"/><clipPath id="clip_1"><rect x="18" y="18" width="128" height="128" rx="28" ry="28"/></clipPath><g clip-path="url(#clip_1)"><path fill="#FFF" transform="matrix(1 0 0 1 18 18)" d="M129 28L129 100Q129 112.0121 120.5061 120.5061Q112.0121 129.0001 100 129L28 129Q15.9878 129 7.4939 120.5061Q-1 112.0121 -1 100L-1 28Q-1 15.9878 7.4939 7.4939Q15.9878 -1 28 -1L100 -1Q112.0122 -1 120.5061 7.4939Q129.0001 15.9878 129 28ZM127 28Q127 16.8162 119.0919 8.9081Q111.1838 1 100 1L28 1Q16.8162 1 8.9081 8.9081Q1 16.8162 1 28L1 100Q1 111.1838 8.9081 119.0919Q16.8162 127.0001 28 127L100 127Q111.1837 127 119.0919 119.0919Q127 111.1838 127 100L127 28Z"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@one-memory/desktop",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"main": "dist/main.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -77,7 +77,9 @@ function releaseVersion(context) {
|
||||
const packaged = context.packager?.appInfo?.version?.trim();
|
||||
const version = supplied || packaged;
|
||||
return typeof version === "string" &&
|
||||
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(version)
|
||||
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(
|
||||
version,
|
||||
)
|
||||
? version
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
it("bakes fallback release identity when the packaging pipeline omits it", async () => {
|
||||
const config = await readFile(
|
||||
path.resolve(__dirname, "../tsup.config.ts"),
|
||||
"utf8",
|
||||
);
|
||||
|
||||
expect(config).toContain("resolveBuildNumber");
|
||||
expect(config).toContain(
|
||||
"const releaseBuildNumber = resolveBuildNumber(process.env)",
|
||||
);
|
||||
expect(config).toMatch(
|
||||
/__ONE_MEMORY_BUILD_NUMBER__: JSON\.stringify\(\s*String\(releaseBuildNumber\)/,
|
||||
);
|
||||
expect(config).toMatch(
|
||||
/process\.env\.ONE_MEMORY_COMMIT\?\.trim\(\) \|\| readSourceCommit\(\)/,
|
||||
);
|
||||
expect(config).toMatch(
|
||||
/execFileSync\("git", \["rev-parse", "HEAD"\],[\s\S]*?encoding: "utf8"/,
|
||||
);
|
||||
expect(config).toContain(
|
||||
"__ONE_MEMORY_COMMIT__: JSON.stringify(releaseCommit)",
|
||||
);
|
||||
});
|
||||
@@ -493,17 +493,17 @@ function publicItem(
|
||||
receipt: !receipt
|
||||
? null
|
||||
: {
|
||||
kind: receipt.kind,
|
||||
hostId: receipt.host.hostId,
|
||||
installationId: receipt.host.installationId as string,
|
||||
permissionRevision: receipt.host.permissionRevision,
|
||||
...(receipt.kind === "readGrant"
|
||||
? {
|
||||
allowedTools: [...receipt.allowedTools],
|
||||
allowedScopes: [...receipt.allowedScopes],
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
kind: receipt.kind,
|
||||
hostId: receipt.host.hostId,
|
||||
installationId: receipt.host.installationId as string,
|
||||
permissionRevision: receipt.host.permissionRevision,
|
||||
...(receipt.kind === "readGrant"
|
||||
? {
|
||||
allowedTools: [...receipt.allowedTools],
|
||||
allowedScopes: [...receipt.allowedScopes],
|
||||
}
|
||||
: {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
function selectionInput(input: unknown): ConnectionSetupSelection {
|
||||
|
||||
@@ -234,7 +234,9 @@ describe("desktop lifecycle failure paths", () => {
|
||||
await f.flush();
|
||||
expect(f.createWindow).not.toHaveBeenCalled();
|
||||
expect(f.quit().preventDefault).toHaveBeenCalled();
|
||||
f.stopping.resolve();
|
||||
// Teardown can fail after the startup error (for example, while writing a
|
||||
// diagnostic). It must not replace the useful error with a second dialog.
|
||||
f.stopping.reject(new Error("diagnostic_detail_key_invalid"));
|
||||
await f.flush();
|
||||
// Whatever did come up before the failure still has to be torn down.
|
||||
expect(f.stop).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -108,7 +108,9 @@ export function startDesktopLifecycle(options: LifecycleOptions): void {
|
||||
shutdown = startup
|
||||
.catch(() => {})
|
||||
.then(options.stop)
|
||||
.catch(options.onError)
|
||||
// Quit-time failures are logged by stop itself. A second modal here can
|
||||
// only obscure the startup error that initiated this shutdown.
|
||||
.catch(report)
|
||||
.finally(() => {
|
||||
stopped = true;
|
||||
app.quit();
|
||||
|
||||
@@ -4,10 +4,7 @@ import { desktopVersionOutput } from "./desktop-version";
|
||||
describe("Desktop version probe", () => {
|
||||
it("returns packaged SemVer for the product-private probe", () => {
|
||||
expect(
|
||||
desktopVersionOutput(
|
||||
["MemHub", "--memhub-version"],
|
||||
"0.1.0-internal.2",
|
||||
),
|
||||
desktopVersionOutput(["MemHub", "--memhub-version"], "0.1.0-internal.2"),
|
||||
).toBe("MemHub 0.1.0-internal.2\n");
|
||||
});
|
||||
|
||||
|
||||
@@ -436,7 +436,9 @@ describe("display preference preload", () => {
|
||||
it("preload exposes the explicit background restart action", async () => {
|
||||
const api = await preload();
|
||||
fake.invoke.mockResolvedValue({ state: "restarted" });
|
||||
await expect(api.restartBackground()).resolves.toEqual({ state: "restarted" });
|
||||
await expect(api.restartBackground()).resolves.toEqual({
|
||||
state: "restarted",
|
||||
});
|
||||
expect(fake.invoke).toHaveBeenCalledExactlyOnceWith(
|
||||
"one-memory:restart-background",
|
||||
);
|
||||
|
||||
@@ -8,7 +8,9 @@ import { installEarlyStartupErrorHandler } from "./early-startup-errors";
|
||||
const roots: string[] = [];
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true })));
|
||||
await Promise.all(
|
||||
roots.splice(0).map((root) => rm(root, { recursive: true })),
|
||||
);
|
||||
});
|
||||
|
||||
describe("early desktop startup errors", () => {
|
||||
@@ -31,7 +33,9 @@ describe("early desktop startup errors", () => {
|
||||
});
|
||||
|
||||
it("writes stderr and diagnostics before showing the fatal dialog", async () => {
|
||||
const dataDir = await mkdtemp(path.join(os.tmpdir(), "desktop-early-error-"));
|
||||
const dataDir = await mkdtemp(
|
||||
path.join(os.tmpdir(), "desktop-early-error-"),
|
||||
);
|
||||
roots.push(dataDir);
|
||||
const processEvents = new EventEmitter();
|
||||
const order: string[] = [];
|
||||
@@ -47,7 +51,8 @@ describe("early desktop startup errors", () => {
|
||||
processEvents.emit(
|
||||
"uncaughtException",
|
||||
Object.assign(new Error("desktop_test_real_home_mismatch"), {
|
||||
stack: "Error: desktop_test_real_home_mismatch\n at boot (apps/desktop/src/main.ts:80:1)",
|
||||
stack:
|
||||
"Error: desktop_test_real_home_mismatch\n at boot (apps/desktop/src/main.ts:80:1)",
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
@@ -29,7 +29,8 @@ export function installEarlyStartupErrorHandler(
|
||||
if (handled) return;
|
||||
handled = true;
|
||||
const fields = diagnosticError(error);
|
||||
const message = error instanceof Error ? error.message : "desktop_startup_failed";
|
||||
const message =
|
||||
error instanceof Error ? error.message : "desktop_startup_failed";
|
||||
const errorCode = SAFE_ERROR_CODE.test(message)
|
||||
? message
|
||||
: "desktop_startup_failed";
|
||||
|
||||
@@ -65,29 +65,29 @@ describe("formal package test isolation", () => {
|
||||
it.skipIf(process.platform !== "darwin")(
|
||||
"accepts the macOS /tmp alias for an existing /private/tmp test home",
|
||||
() => {
|
||||
const root = mkdtempSync("/private/tmp/one-memory-desktop-alias.");
|
||||
const home = path.join(root, "home");
|
||||
const dataDir = path.join(root, "data");
|
||||
const hostHome = path.join(root, "host-home");
|
||||
mkdirSync(home, { recursive: true });
|
||||
mkdirSync(dataDir, { recursive: true });
|
||||
mkdirSync(hostHome, { recursive: true });
|
||||
const root = mkdtempSync("/private/tmp/one-memory-desktop-alias.");
|
||||
const home = path.join(root, "home");
|
||||
const dataDir = path.join(root, "data");
|
||||
const hostHome = path.join(root, "host-home");
|
||||
mkdirSync(home, { recursive: true });
|
||||
mkdirSync(dataDir, { recursive: true });
|
||||
mkdirSync(hostHome, { recursive: true });
|
||||
|
||||
expect(
|
||||
resolveDesktopTestIsolation(
|
||||
{
|
||||
ONE_MEMORY_TEST_ISOLATED: "1",
|
||||
ONE_MEMORY_TEST_REAL_HOME: "/Users/example",
|
||||
ONE_MEMORY_DESKTOP_TEST_HOME: home,
|
||||
ONE_MEMORY_DATA_DIR: dataDir,
|
||||
ONE_MEMORY_HOST_HOME: hostHome,
|
||||
ONE_MEMORY_CORE_PORT: "27791",
|
||||
ONE_MEMORY_RUNTIME_PORT: "27791",
|
||||
ONE_MEMORY_BROKER_PORT: "37791",
|
||||
},
|
||||
home.replace(/^\/private\/tmp\//, "/tmp/"),
|
||||
),
|
||||
).toMatchObject({ home });
|
||||
expect(
|
||||
resolveDesktopTestIsolation(
|
||||
{
|
||||
ONE_MEMORY_TEST_ISOLATED: "1",
|
||||
ONE_MEMORY_TEST_REAL_HOME: "/Users/example",
|
||||
ONE_MEMORY_DESKTOP_TEST_HOME: home,
|
||||
ONE_MEMORY_DATA_DIR: dataDir,
|
||||
ONE_MEMORY_HOST_HOME: hostHome,
|
||||
ONE_MEMORY_CORE_PORT: "27791",
|
||||
ONE_MEMORY_RUNTIME_PORT: "27791",
|
||||
ONE_MEMORY_BROKER_PORT: "37791",
|
||||
},
|
||||
home.replace(/^\/private\/tmp\//, "/tmp/"),
|
||||
),
|
||||
).toMatchObject({ home });
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -124,9 +124,10 @@ export function hourlyRuntimeInstanceId(): string {
|
||||
* `build_number` is the only ordering authority the installer compares, so a
|
||||
* package that omits it defaults to 0 and can never outrank an earlier install:
|
||||
* R->R.1 would be refused as a downgrade. The value is baked into the bundle's
|
||||
* `LSEnvironment` at pack time (`apps/desktop/scripts/after-pack.cjs`); this
|
||||
* reads it back and never invents one, so a source checkout that did not pass a
|
||||
* build number stays undefined rather than fabricating order.
|
||||
* `LSEnvironment` at pack time (`apps/desktop/scripts/after-pack.cjs`) and is
|
||||
* also compiled from the canonical root release contract. This reader accepts
|
||||
* either source so Finder launches still carry ordering even when an external
|
||||
* packaging pipeline omitted the plist field.
|
||||
*/
|
||||
export function resolvePackagedBuildNumber(
|
||||
environmentValue: unknown,
|
||||
|
||||
@@ -53,7 +53,9 @@ it.skipIf(process.platform !== "darwin")(
|
||||
process: { env: {} },
|
||||
require(name: string) {
|
||||
if (name === "node:crypto")
|
||||
return { randomUUID: () => "00000000-0000-4000-8000-000000000000" };
|
||||
return {
|
||||
randomUUID: () => "00000000-0000-4000-8000-000000000000",
|
||||
};
|
||||
if (name === "node:path") return path;
|
||||
if (name === "node:child_process")
|
||||
return {
|
||||
|
||||
@@ -103,6 +103,7 @@ import { createSourceChangeHandler } from "./source-change-handler";
|
||||
import { SourceDirectoryPicker } from "./source-directory-picker";
|
||||
import {
|
||||
installBundledCliIfNeeded,
|
||||
installServiceWithDisabledFallback,
|
||||
isInstalledApplicationsApp,
|
||||
stableRuntimeErrorCode,
|
||||
startStableRuntimeRepair,
|
||||
@@ -989,6 +990,7 @@ async function initialize(isQuitting: () => boolean): Promise<void> {
|
||||
const startAtLogin = owner?.owner === "app" ? owner.start_at_login : true;
|
||||
const previousOwner = owner;
|
||||
let runtimeChanged = false;
|
||||
let transientRuntime = false;
|
||||
if (owner?.owner !== "cli") {
|
||||
const installed = await installPackagedRuntime({
|
||||
resourcesPath: process.resourcesPath,
|
||||
@@ -1027,25 +1029,48 @@ async function initialize(isQuitting: () => boolean): Promise<void> {
|
||||
});
|
||||
}
|
||||
if (!alreadyRunning) {
|
||||
try {
|
||||
await installUserService(layout, {
|
||||
uid: process.getuid?.(),
|
||||
platform: "darwin",
|
||||
});
|
||||
await waitForRuntimeProcess({ dataDir, attempts: 360 });
|
||||
} catch (error) {
|
||||
if (owner?.owner === "app") {
|
||||
if (previousOwner === null)
|
||||
await removeRuntimeServiceOwner(dataDir);
|
||||
else await writeRuntimeServiceOwner(dataDir, previousOwner);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
// A durable `launchctl disable` override is a state to report, not a
|
||||
// failure to undo: `installUserService` never re-enables a service the
|
||||
// user or the system disabled. An explicit App launch may still own a
|
||||
// transient Runtime for this UI session. Shutdown stops that process.
|
||||
const serviceMode = await installServiceWithDisabledFallback({
|
||||
install: async () => {
|
||||
await installUserService(layout, {
|
||||
uid: process.getuid?.(),
|
||||
platform: "darwin",
|
||||
});
|
||||
await waitForRuntimeProcess({ dataDir, attempts: 360 });
|
||||
},
|
||||
restoreOwner: async () => {
|
||||
if (owner?.owner === "app") {
|
||||
if (previousOwner === null)
|
||||
await removeRuntimeServiceOwner(dataDir);
|
||||
else await writeRuntimeServiceOwner(dataDir, previousOwner);
|
||||
}
|
||||
owner = previousOwner;
|
||||
},
|
||||
reportDisabled: () =>
|
||||
diagnostics.log({
|
||||
level: "warn",
|
||||
component: "desktop.stable_runtime",
|
||||
event: "stable_runtime.service_disabled",
|
||||
outcome: "degraded",
|
||||
error_code: "runtime_service_disabled_by_system",
|
||||
}),
|
||||
startTransient: async () => {
|
||||
await ensureRuntimeProcess({
|
||||
dataDir,
|
||||
launch: runtimeLaunch(),
|
||||
attempts: app.isPackaged ? 360 : 120,
|
||||
});
|
||||
},
|
||||
});
|
||||
transientRuntime = serviceMode === "transient";
|
||||
}
|
||||
if (owner?.owner === "app" && !startAtLogin) {
|
||||
await disableRuntimeService(dataDir);
|
||||
}
|
||||
preserveManagedRuntimeOnQuit = true;
|
||||
preserveManagedRuntimeOnQuit = !transientRuntime;
|
||||
} else if (standaloneRuntime) {
|
||||
await ensureRuntimeProcess({
|
||||
dataDir,
|
||||
@@ -1379,7 +1404,7 @@ if (desktopVersion !== null) {
|
||||
component: "desktop.lifecycle",
|
||||
event: "desktop.runtime_stop",
|
||||
outcome: event.outcome,
|
||||
details: { runtime: event.detail },
|
||||
details: { runtime_state: event.detail },
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -191,7 +191,9 @@ describe("packaged macOS permission metadata", () => {
|
||||
expect(fixture.plist.get("CFBundleShortVersionString")).toBe("1.2.3");
|
||||
expect(fixture.plist.get("CFBundleVersion")).toBe("3903");
|
||||
expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_VERSION")).toBe("1.2.3");
|
||||
expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_BUILD_NUMBER")).toBe("3903");
|
||||
expect(fixture.plist.get("LSEnvironment:ONE_MEMORY_BUILD_NUMBER")).toBe(
|
||||
"3903",
|
||||
);
|
||||
});
|
||||
|
||||
it("removes inherited audio capture and existing unused keys before signing", async () => {
|
||||
@@ -209,10 +211,7 @@ describe("packaged macOS permission metadata", () => {
|
||||
// Production clears any stale build marker before removing unused usage
|
||||
// strings and signing. No LaunchAgent plist is written.
|
||||
expect(fixture.execFileSync.mock.calls).toEqual([
|
||||
[
|
||||
"/usr/libexec/PlistBuddy",
|
||||
["-c", "Add :LSEnvironment dict", plistPath],
|
||||
],
|
||||
["/usr/libexec/PlistBuddy", ["-c", "Add :LSEnvironment dict", plistPath]],
|
||||
[
|
||||
"/usr/libexec/PlistBuddy",
|
||||
["-c", "Delete :LSEnvironment:ONE_MEMORY_VERSION", plistPath],
|
||||
|
||||
@@ -229,6 +229,5 @@ contextBridge.exposeInMainWorld("oneMemory", {
|
||||
hostId: string;
|
||||
installed: boolean;
|
||||
permission: RecallPermissionStatus;
|
||||
}> =>
|
||||
ipcRenderer.invoke("one-memory:uninstall-recall", hostId, approved),
|
||||
}> => ipcRenderer.invoke("one-memory:uninstall-recall", hostId, approved),
|
||||
});
|
||||
@@ -1,4 +1,10 @@
|
||||
import { mkdir, mkdtemp, readFile, readlink, writeFile } from "node:fs/promises";
|
||||
import {
|
||||
mkdir,
|
||||
mkdtemp,
|
||||
readFile,
|
||||
readlink,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
@@ -6,9 +12,11 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
ensureStableRuntimeThenRepair,
|
||||
installBundledCliIfNeeded,
|
||||
installServiceWithDisabledFallback,
|
||||
isDisabledServiceInstallError,
|
||||
isInstalledApplicationsApp,
|
||||
startStableRuntimeRepair,
|
||||
stableRuntimeErrorCode,
|
||||
startStableRuntimeRepair,
|
||||
} from "./stable-runtime";
|
||||
|
||||
it("only treats a packaged macOS executable under Applications as installed", () => {
|
||||
@@ -35,7 +43,12 @@ it("only treats a packaged macOS executable under Applications as installed", ()
|
||||
it("installs only memhub and adds its directory to a new shell", async () => {
|
||||
if (process.platform === "win32") return;
|
||||
const home = await mkdtemp(path.join(os.tmpdir(), "memhub-auto-cli-"));
|
||||
const installRoot = path.join(home, "Library", "Application Support", "One Memory");
|
||||
const installRoot = path.join(
|
||||
home,
|
||||
"Library",
|
||||
"Application Support",
|
||||
"One Memory",
|
||||
);
|
||||
const target = path.join(installRoot, "current", "bin", "one-memory");
|
||||
await mkdir(path.dirname(target), { recursive: true });
|
||||
await writeFile(target, "#!/bin/sh\n", { mode: 0o700 });
|
||||
@@ -43,10 +56,14 @@ it("installs only memhub and adds its directory to a new shell", async () => {
|
||||
await installBundledCliIfNeeded({ home, installRoot, platform: "darwin" });
|
||||
await installBundledCliIfNeeded({ home, installRoot, platform: "darwin" });
|
||||
|
||||
expect(await readlink(path.join(home, ".local", "bin", "memhub"))).toBe(target);
|
||||
expect(await readlink(path.join(home, ".local", "bin", "memhub"))).toBe(
|
||||
target,
|
||||
);
|
||||
const profile = await readFile(path.join(home, ".zprofile"), "utf8");
|
||||
expect(profile.match(/# >>> memhub PATH >>>/g)).toHaveLength(1);
|
||||
await expect(readFile(path.join(home, ".local", "bin", "one-memory"))).rejects.toThrow();
|
||||
await expect(
|
||||
readFile(path.join(home, ".local", "bin", "one-memory")),
|
||||
).rejects.toThrow();
|
||||
});
|
||||
|
||||
describe("ensureStableRuntimeThenRepair", () => {
|
||||
@@ -143,3 +160,97 @@ describe("ensureStableRuntimeThenRepair", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("isDisabledServiceInstallError", () => {
|
||||
it("recognises the durable disabled-service state", () => {
|
||||
expect(
|
||||
isDisabledServiceInstallError(
|
||||
new Error("runtime_service_disabled_by_system"),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps every other startup failure fatal", () => {
|
||||
for (const other of [
|
||||
new Error("runtime_service_label_conflict"),
|
||||
new Error("runtime_service_install_root_not_ready"),
|
||||
new Error("runtime_service_command_failed"),
|
||||
"runtime_service_disabled_by_system",
|
||||
null,
|
||||
undefined,
|
||||
]) {
|
||||
expect(isDisabledServiceInstallError(other)).toBe(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("installServiceWithDisabledFallback", () => {
|
||||
it("keeps a successfully installed service managed", async () => {
|
||||
const restoreOwner = vi.fn(async () => undefined);
|
||||
const reportDisabled = vi.fn(async () => undefined);
|
||||
const startTransient = vi.fn(async () => undefined);
|
||||
|
||||
await expect(
|
||||
installServiceWithDisabledFallback({
|
||||
install: async () => undefined,
|
||||
restoreOwner,
|
||||
reportDisabled,
|
||||
startTransient,
|
||||
}),
|
||||
).resolves.toBe("managed");
|
||||
expect(restoreOwner).not.toHaveBeenCalled();
|
||||
expect(reportDisabled).not.toHaveBeenCalled();
|
||||
expect(startTransient).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses an app-lifetime Runtime when launchd disabled the service", async () => {
|
||||
const order: string[] = [];
|
||||
|
||||
await expect(
|
||||
installServiceWithDisabledFallback({
|
||||
install: async () => {
|
||||
order.push("install");
|
||||
throw new Error("runtime_service_disabled_by_system");
|
||||
},
|
||||
restoreOwner: async () => {
|
||||
order.push("restore-owner");
|
||||
},
|
||||
reportDisabled: async () => {
|
||||
order.push("report-start");
|
||||
await Promise.resolve();
|
||||
order.push("report-end");
|
||||
},
|
||||
startTransient: async () => {
|
||||
order.push("start-transient");
|
||||
},
|
||||
}),
|
||||
).resolves.toBe("transient");
|
||||
expect(order).toEqual([
|
||||
"install",
|
||||
"restore-owner",
|
||||
"report-start",
|
||||
"report-end",
|
||||
"start-transient",
|
||||
]);
|
||||
});
|
||||
|
||||
it("restores ownership and preserves unrelated startup failures", async () => {
|
||||
const restoreOwner = vi.fn(async () => undefined);
|
||||
const reportDisabled = vi.fn(async () => undefined);
|
||||
const startTransient = vi.fn(async () => undefined);
|
||||
|
||||
await expect(
|
||||
installServiceWithDisabledFallback({
|
||||
install: async () => {
|
||||
throw new Error("runtime_service_command_failed");
|
||||
},
|
||||
restoreOwner,
|
||||
reportDisabled,
|
||||
startTransient,
|
||||
}),
|
||||
).rejects.toThrow("runtime_service_command_failed");
|
||||
expect(restoreOwner).toHaveBeenCalledOnce();
|
||||
expect(reportDisabled).not.toHaveBeenCalled();
|
||||
expect(startTransient).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Loaded 100 of 262 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user