team-memory 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- team_memory-0.1.0/.dockerignore +14 -0
- team_memory-0.1.0/.github/workflows/ci.yml +78 -0
- team_memory-0.1.0/.gitignore +42 -0
- team_memory-0.1.0/Dockerfile +50 -0
- team_memory-0.1.0/LICENSE +21 -0
- team_memory-0.1.0/Makefile +61 -0
- team_memory-0.1.0/PKG-INFO +480 -0
- team_memory-0.1.0/README.md +440 -0
- team_memory-0.1.0/alembic.ini +149 -0
- team_memory-0.1.0/config/templates/templates.yaml +218 -0
- team_memory-0.1.0/config.minimal.yaml +27 -0
- team_memory-0.1.0/config.production.yaml +30 -0
- team_memory-0.1.0/config.test.yaml +18 -0
- team_memory-0.1.0/config.yaml +240 -0
- team_memory-0.1.0/docker-compose.yml +107 -0
- team_memory-0.1.0/docker-entrypoint.sh +92 -0
- team_memory-0.1.0/extensions/example_webhook_logger.py +36 -0
- team_memory-0.1.0/helm/team-memory/Chart.yaml +6 -0
- team_memory-0.1.0/helm/team-memory/templates/deployment.yaml +48 -0
- team_memory-0.1.0/helm/team-memory/templates/service.yaml +12 -0
- team_memory-0.1.0/helm/team-memory/values.yaml +61 -0
- team_memory-0.1.0/pm.md +633 -0
- team_memory-0.1.0/prompts/enrich.md +19 -0
- team_memory-0.1.0/prompts/parse_group.md +41 -0
- team_memory-0.1.0/prompts/parse_single.md +53 -0
- team_memory-0.1.0/prompts/review.md +32 -0
- team_memory-0.1.0/prompts/suggest_related.md +18 -0
- team_memory-0.1.0/prompts/suggest_type.md +24 -0
- team_memory-0.1.0/prompts/summary.md +16 -0
- team_memory-0.1.0/pyproject.toml +75 -0
- team_memory-0.1.0/scripts/backup.sh +38 -0
- team_memory-0.1.0/scripts/healthcheck.sh +100 -0
- team_memory-0.1.0/scripts/install_codified_knowledge.sh +36 -0
- team_memory-0.1.0/scripts/migrate_embeddings.py +160 -0
- team_memory-0.1.0/scripts/migrate_flat_to_parent_child.py +218 -0
- team_memory-0.1.0/scripts/restore.sh +47 -0
- team_memory-0.1.0/server.json +37 -0
- team_memory-0.1.0/src/team_memory/__init__.py +3 -0
- team_memory-0.1.0/src/team_memory/auth/__init__.py +1 -0
- team_memory-0.1.0/src/team_memory/auth/oauth.py +81 -0
- team_memory-0.1.0/src/team_memory/auth/permissions.py +94 -0
- team_memory-0.1.0/src/team_memory/auth/provider.py +249 -0
- team_memory-0.1.0/src/team_memory/bootstrap.py +278 -0
- team_memory-0.1.0/src/team_memory/config.py +522 -0
- team_memory-0.1.0/src/team_memory/embedding/__init__.py +0 -0
- team_memory-0.1.0/src/team_memory/embedding/base.py +44 -0
- team_memory-0.1.0/src/team_memory/embedding/local_provider.py +61 -0
- team_memory-0.1.0/src/team_memory/embedding/ollama_provider.py +68 -0
- team_memory-0.1.0/src/team_memory/embedding/openai_provider.py +68 -0
- team_memory-0.1.0/src/team_memory/extensions.py +109 -0
- team_memory-0.1.0/src/team_memory/reranker/__init__.py +6 -0
- team_memory-0.1.0/src/team_memory/reranker/base.py +67 -0
- team_memory-0.1.0/src/team_memory/reranker/cross_encoder_provider.py +110 -0
- team_memory-0.1.0/src/team_memory/reranker/factory.py +90 -0
- team_memory-0.1.0/src/team_memory/reranker/jina_provider.py +101 -0
- team_memory-0.1.0/src/team_memory/reranker/noop_provider.py +38 -0
- team_memory-0.1.0/src/team_memory/reranker/ollama_llm_provider.py +234 -0
- team_memory-0.1.0/src/team_memory/schema_presets.py +332 -0
- team_memory-0.1.0/src/team_memory/schemas.py +444 -0
- team_memory-0.1.0/src/team_memory/server.py +1476 -0
- team_memory-0.1.0/src/team_memory/services/__init__.py +0 -0
- team_memory-0.1.0/src/team_memory/services/ai_orchestrator.py +191 -0
- team_memory-0.1.0/src/team_memory/services/analytics.py +64 -0
- team_memory-0.1.0/src/team_memory/services/cache.py +368 -0
- team_memory-0.1.0/src/team_memory/services/config_manager.py +106 -0
- team_memory-0.1.0/src/team_memory/services/context_trimmer.py +266 -0
- team_memory-0.1.0/src/team_memory/services/embedding_queue.py +229 -0
- team_memory-0.1.0/src/team_memory/services/event_bus.py +170 -0
- team_memory-0.1.0/src/team_memory/services/experience.py +1620 -0
- team_memory-0.1.0/src/team_memory/services/installable_catalog.py +310 -0
- team_memory-0.1.0/src/team_memory/services/llm_client.py +116 -0
- team_memory-0.1.0/src/team_memory/services/llm_parser.py +616 -0
- team_memory-0.1.0/src/team_memory/services/pageindex_lite.py +143 -0
- team_memory-0.1.0/src/team_memory/services/prompt_loader.py +256 -0
- team_memory-0.1.0/src/team_memory/services/search_pipeline.py +619 -0
- team_memory-0.1.0/src/team_memory/services/webhook.py +136 -0
- team_memory-0.1.0/src/team_memory/storage/__init__.py +0 -0
- team_memory-0.1.0/src/team_memory/storage/database.py +82 -0
- team_memory-0.1.0/src/team_memory/storage/models.py +478 -0
- team_memory-0.1.0/src/team_memory/storage/repository.py +1259 -0
- team_memory-0.1.0/src/team_memory/web/__init__.py +0 -0
- team_memory-0.1.0/src/team_memory/web/app.py +831 -0
- team_memory-0.1.0/src/team_memory/web/dependencies.py +103 -0
- team_memory-0.1.0/src/team_memory/web/metrics.py +111 -0
- team_memory-0.1.0/src/team_memory/web/middleware.py +20 -0
- team_memory-0.1.0/src/team_memory/web/routes/__init__.py +35 -0
- team_memory-0.1.0/src/team_memory/web/routes/analytics.py +113 -0
- team_memory-0.1.0/src/team_memory/web/routes/auth.py +176 -0
- team_memory-0.1.0/src/team_memory/web/routes/config.py +375 -0
- team_memory-0.1.0/src/team_memory/web/routes/experiences.py +638 -0
- team_memory-0.1.0/src/team_memory/web/routes/import_export.py +361 -0
- team_memory-0.1.0/src/team_memory/web/routes/lifecycle.py +89 -0
- team_memory-0.1.0/src/team_memory/web/routes/parse.py +108 -0
- team_memory-0.1.0/src/team_memory/web/routes/schema.py +172 -0
- team_memory-0.1.0/src/team_memory/web/routes/search.py +128 -0
- team_memory-0.1.0/src/team_memory/web/static/index.html +1983 -0
- team_memory-0.1.0/src/team_memory/web/static/js/api.js +70 -0
- team_memory-0.1.0/src/team_memory/web/static/js/app.js +244 -0
- team_memory-0.1.0/src/team_memory/web/static/js/components.js +847 -0
- team_memory-0.1.0/src/team_memory/web/static/js/pages.js +993 -0
- team_memory-0.1.0/src/team_memory/web/static/js/schema.js +217 -0
- team_memory-0.1.0/src/team_memory/web/static/js/store.js +35 -0
- team_memory-0.1.0/src/team_memory/web/static/js/utils.js +99 -0
- team_memory-0.1.0/tests/__init__.py +0 -0
- team_memory-0.1.0/tests/conftest.py +89 -0
- team_memory-0.1.0/tests/test_architecture.py +336 -0
- team_memory-0.1.0/tests/test_auth.py +95 -0
- team_memory-0.1.0/tests/test_cache.py +174 -0
- team_memory-0.1.0/tests/test_config.py +150 -0
- team_memory-0.1.0/tests/test_context_trimmer.py +117 -0
- team_memory-0.1.0/tests/test_e2e.py +152 -0
- team_memory-0.1.0/tests/test_embedding.py +139 -0
- team_memory-0.1.0/tests/test_generalization.py +712 -0
- team_memory-0.1.0/tests/test_installable_catalog.py +69 -0
- team_memory-0.1.0/tests/test_integration.py +368 -0
- team_memory-0.1.0/tests/test_lifecycle.py +719 -0
- team_memory-0.1.0/tests/test_ollama_embedding.py +152 -0
- team_memory-0.1.0/tests/test_p0_core.py +401 -0
- team_memory-0.1.0/tests/test_reranker.py +152 -0
- team_memory-0.1.0/tests/test_search_pipeline.py +239 -0
- team_memory-0.1.0/tests/test_server.py +678 -0
- team_memory-0.1.0/tests/test_service.py +256 -0
- team_memory-0.1.0/tests/test_web.py +903 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
PYTHON_VERSION: "3.11"
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
name: Lint & Type Check
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: pip install -e ".[dev]"
|
|
23
|
+
- name: Ruff lint
|
|
24
|
+
run: ruff check src/ tests/
|
|
25
|
+
- name: Ruff format check
|
|
26
|
+
run: ruff format --check src/ tests/
|
|
27
|
+
|
|
28
|
+
test:
|
|
29
|
+
name: Tests
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
services:
|
|
32
|
+
postgres:
|
|
33
|
+
image: pgvector/pgvector:pg16
|
|
34
|
+
env:
|
|
35
|
+
POSTGRES_USER: developer
|
|
36
|
+
POSTGRES_PASSWORD: devpass
|
|
37
|
+
POSTGRES_DB: team_memory
|
|
38
|
+
ports:
|
|
39
|
+
- 5432:5432
|
|
40
|
+
options: >-
|
|
41
|
+
--health-cmd pg_isready
|
|
42
|
+
--health-interval 10s
|
|
43
|
+
--health-timeout 5s
|
|
44
|
+
--health-retries 5
|
|
45
|
+
env:
|
|
46
|
+
TEAM_MEMORY_DATABASE__URL: "postgresql+asyncpg://developer:devpass@localhost:5432/team_memory"
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/checkout@v4
|
|
49
|
+
- uses: actions/setup-python@v5
|
|
50
|
+
with:
|
|
51
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
52
|
+
- name: Install dependencies
|
|
53
|
+
run: pip install -e ".[dev]"
|
|
54
|
+
- name: Run migrations
|
|
55
|
+
run: alembic upgrade head
|
|
56
|
+
- name: Run tests
|
|
57
|
+
run: pytest -v --tb=short
|
|
58
|
+
- name: Coverage
|
|
59
|
+
run: pytest --cov=team_memory --cov-report=xml
|
|
60
|
+
- name: Upload coverage
|
|
61
|
+
uses: codecov/codecov-action@v4
|
|
62
|
+
with:
|
|
63
|
+
file: coverage.xml
|
|
64
|
+
continue-on-error: true
|
|
65
|
+
|
|
66
|
+
docker:
|
|
67
|
+
name: Docker Build
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
if: github.event_name == 'push'
|
|
70
|
+
needs: [lint, test]
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@v4
|
|
73
|
+
- name: Set up Docker Buildx
|
|
74
|
+
uses: docker/setup-buildx-action@v3
|
|
75
|
+
- name: Build Docker image
|
|
76
|
+
run: |
|
|
77
|
+
docker build -t team_memory:${{ github.sha }} .
|
|
78
|
+
echo "Docker image built successfully"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
env/
|
|
14
|
+
|
|
15
|
+
# IDE
|
|
16
|
+
.idea/
|
|
17
|
+
.vscode/
|
|
18
|
+
|
|
19
|
+
# Config overrides (may contain secrets)
|
|
20
|
+
config.local.yaml
|
|
21
|
+
|
|
22
|
+
# Environment
|
|
23
|
+
.env
|
|
24
|
+
.env.*
|
|
25
|
+
|
|
26
|
+
# Testing
|
|
27
|
+
.coverage
|
|
28
|
+
htmlcov/
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
|
|
31
|
+
# Debug / operations docs (personal)
|
|
32
|
+
.debug/
|
|
33
|
+
|
|
34
|
+
# OS
|
|
35
|
+
.DS_Store
|
|
36
|
+
Thumbs.db
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
.ruff_cache/
|
|
40
|
+
migrations/
|
|
41
|
+
.claude/
|
|
42
|
+
.cursor/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Multi-stage Dockerfile for team_memory
|
|
2
|
+
# Stage 1: Build
|
|
3
|
+
FROM python:3.11-slim AS builder
|
|
4
|
+
|
|
5
|
+
WORKDIR /app
|
|
6
|
+
|
|
7
|
+
# Install build dependencies
|
|
8
|
+
RUN pip install --no-cache-dir hatchling
|
|
9
|
+
|
|
10
|
+
# Copy project files
|
|
11
|
+
COPY pyproject.toml README.md ./
|
|
12
|
+
COPY src/ ./src/
|
|
13
|
+
COPY migrations/ ./migrations/
|
|
14
|
+
COPY alembic.ini ./
|
|
15
|
+
COPY config.yaml ./
|
|
16
|
+
|
|
17
|
+
# Build the wheel
|
|
18
|
+
RUN pip wheel --no-cache-dir --wheel-dir /wheels .
|
|
19
|
+
|
|
20
|
+
# Stage 2: Runtime
|
|
21
|
+
FROM python:3.11-slim AS runtime
|
|
22
|
+
|
|
23
|
+
WORKDIR /app
|
|
24
|
+
|
|
25
|
+
# Install runtime dependencies
|
|
26
|
+
COPY --from=builder /wheels /wheels
|
|
27
|
+
RUN pip install --no-cache-dir /wheels/*.whl && rm -rf /wheels
|
|
28
|
+
|
|
29
|
+
# Copy migrations, config, and static files
|
|
30
|
+
COPY migrations/ ./migrations/
|
|
31
|
+
COPY alembic.ini ./
|
|
32
|
+
COPY config.yaml ./
|
|
33
|
+
COPY src/team_memory/web/static/ ./src/team_memory/web/static/
|
|
34
|
+
|
|
35
|
+
# Copy entrypoint script
|
|
36
|
+
COPY docker-entrypoint.sh /usr/local/bin/
|
|
37
|
+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
|
38
|
+
|
|
39
|
+
# Create a non-root user
|
|
40
|
+
RUN useradd --create-home --shell /bin/bash appuser
|
|
41
|
+
USER appuser
|
|
42
|
+
|
|
43
|
+
# Expose port for web server
|
|
44
|
+
EXPOSE 9111
|
|
45
|
+
|
|
46
|
+
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
47
|
+
|
|
48
|
+
# Default: run the web server
|
|
49
|
+
# Override with: docker run ... team-memory (for MCP server)
|
|
50
|
+
CMD ["team-memory-web"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Team Memory Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# team_memory — 常用命令入口
|
|
3
|
+
# 使用 make help 查看所有可用命令
|
|
4
|
+
# ============================================================
|
|
5
|
+
|
|
6
|
+
.DEFAULT_GOAL := help
|
|
7
|
+
.PHONY: help setup dev web mcp test lint lint-fix backup health clean migrate install-knowledge
|
|
8
|
+
|
|
9
|
+
help: ## 显示所有可用命令
|
|
10
|
+
@echo ""
|
|
11
|
+
@echo " team_memory 命令一览"
|
|
12
|
+
@echo " ================================="
|
|
13
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
14
|
+
awk 'BEGIN {FS = ":.*?## "}; {printf " make %-15s %s\n", $$1, $$2}'
|
|
15
|
+
@echo ""
|
|
16
|
+
|
|
17
|
+
setup: ## 首次安装:启动 Docker + 安装依赖 + 初始化数据库
|
|
18
|
+
docker compose up -d
|
|
19
|
+
pip install -e ".[dev]"
|
|
20
|
+
alembic upgrade head
|
|
21
|
+
@echo ""
|
|
22
|
+
@echo " ✔ Setup complete!"
|
|
23
|
+
@echo " Run 'make web' to start the Web UI."
|
|
24
|
+
@echo " Run 'make mcp' to start the MCP server."
|
|
25
|
+
@echo ""
|
|
26
|
+
|
|
27
|
+
dev: ## 启动全部服务(Docker 基础设施 + Web 管理界面)
|
|
28
|
+
docker compose up -d
|
|
29
|
+
python -m team_memory.web.app
|
|
30
|
+
|
|
31
|
+
web: ## 仅启动 Web 管理界面(默认端口 9111)
|
|
32
|
+
python -m team_memory.web.app
|
|
33
|
+
|
|
34
|
+
mcp: ## 仅启动 MCP Server(供 Cursor / Claude Desktop 使用)
|
|
35
|
+
python -m team_memory.server
|
|
36
|
+
|
|
37
|
+
test: ## 运行全部测试
|
|
38
|
+
pytest tests/ -v
|
|
39
|
+
|
|
40
|
+
lint: ## Ruff 代码检查
|
|
41
|
+
ruff check src/
|
|
42
|
+
|
|
43
|
+
lint-fix: ## Ruff 代码检查并自动修复
|
|
44
|
+
ruff check src/ --fix
|
|
45
|
+
|
|
46
|
+
migrate: ## 运行数据库迁移
|
|
47
|
+
alembic upgrade head
|
|
48
|
+
|
|
49
|
+
backup: ## 备份数据库
|
|
50
|
+
./scripts/backup.sh
|
|
51
|
+
|
|
52
|
+
health: ## 一键健康检查(检测所有组件状态)
|
|
53
|
+
./scripts/healthcheck.sh
|
|
54
|
+
|
|
55
|
+
clean: ## 清理 Python 缓存文件
|
|
56
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
57
|
+
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
58
|
+
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
|
|
59
|
+
|
|
60
|
+
install-knowledge: ## 一键安装固化知识包(rules + skill)
|
|
61
|
+
./scripts/install_codified_knowledge.sh
|