privateaistack 0.1.0a1__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.
Files changed (147) hide show
  1. privateaistack-0.1.0a1/.dockerignore +15 -0
  2. privateaistack-0.1.0a1/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  3. privateaistack-0.1.0a1/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. privateaistack-0.1.0a1/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  5. privateaistack-0.1.0a1/.github/dependabot.yml +14 -0
  6. privateaistack-0.1.0a1/.github/workflows/ci.yml +26 -0
  7. privateaistack-0.1.0a1/.github/workflows/container.yml +17 -0
  8. privateaistack-0.1.0a1/.github/workflows/docs.yml +17 -0
  9. privateaistack-0.1.0a1/.github/workflows/packaging.yml +39 -0
  10. privateaistack-0.1.0a1/.github/workflows/publish.yml +50 -0
  11. privateaistack-0.1.0a1/.github/workflows/release-validation.yml +19 -0
  12. privateaistack-0.1.0a1/.github/workflows/scorecard.yml +25 -0
  13. privateaistack-0.1.0a1/.github/workflows/security.yml +23 -0
  14. privateaistack-0.1.0a1/.gitignore +92 -0
  15. privateaistack-0.1.0a1/ARCHITECTURE.md +253 -0
  16. privateaistack-0.1.0a1/CHANGELOG.md +15 -0
  17. privateaistack-0.1.0a1/CODEOWNERS +6 -0
  18. privateaistack-0.1.0a1/CODE_OF_CONDUCT.md +5 -0
  19. privateaistack-0.1.0a1/CONTRIBUTING.md +20 -0
  20. privateaistack-0.1.0a1/Dockerfile +22 -0
  21. privateaistack-0.1.0a1/LICENSE +21 -0
  22. privateaistack-0.1.0a1/Makefile +64 -0
  23. privateaistack-0.1.0a1/NOTICE.md +7 -0
  24. privateaistack-0.1.0a1/PKG-INFO +303 -0
  25. privateaistack-0.1.0a1/README.md +219 -0
  26. privateaistack-0.1.0a1/SECURITY.md +16 -0
  27. privateaistack-0.1.0a1/THREAT_MODEL.md +104 -0
  28. privateaistack-0.1.0a1/compose.yaml +109 -0
  29. privateaistack-0.1.0a1/config/otel-collector.yaml +25 -0
  30. privateaistack-0.1.0a1/docker/postgres/init.sql +22 -0
  31. privateaistack-0.1.0a1/docs/backup-and-restore.md +27 -0
  32. privateaistack-0.1.0a1/docs/cli.md +41 -0
  33. privateaistack-0.1.0a1/docs/contributor-handoff.md +20 -0
  34. privateaistack-0.1.0a1/docs/data-flow.md +117 -0
  35. privateaistack-0.1.0a1/docs/dependency-licenses.md +22 -0
  36. privateaistack-0.1.0a1/docs/observability.md +19 -0
  37. privateaistack-0.1.0a1/docs/packaging.md +45 -0
  38. privateaistack-0.1.0a1/docs/phase-1-design.md +63 -0
  39. privateaistack-0.1.0a1/docs/policy-guide.md +11 -0
  40. privateaistack-0.1.0a1/docs/private-code-review.md +75 -0
  41. privateaistack-0.1.0a1/docs/production-hardening.md +15 -0
  42. privateaistack-0.1.0a1/docs/pypi-release.md +34 -0
  43. privateaistack-0.1.0a1/docs/template-versioning.md +23 -0
  44. privateaistack-0.1.0a1/docs/trust-boundaries.md +62 -0
  45. privateaistack-0.1.0a1/examples/code_review/README.md +17 -0
  46. privateaistack-0.1.0a1/examples/policy_gate/README.md +15 -0
  47. privateaistack-0.1.0a1/examples/private_rag/README.md +13 -0
  48. privateaistack-0.1.0a1/private_ai_stack/__init__.py +3 -0
  49. privateaistack-0.1.0a1/private_ai_stack/agents/__init__.py +0 -0
  50. privateaistack-0.1.0a1/private_ai_stack/agents/code_quality.py +10 -0
  51. privateaistack-0.1.0a1/private_ai_stack/agents/documentation.py +11 -0
  52. privateaistack-0.1.0a1/private_ai_stack/agents/infrastructure.py +9 -0
  53. privateaistack-0.1.0a1/private_ai_stack/agents/security.py +8 -0
  54. privateaistack-0.1.0a1/private_ai_stack/agents/supervisor.py +31 -0
  55. privateaistack-0.1.0a1/private_ai_stack/agents/tests.py +11 -0
  56. privateaistack-0.1.0a1/private_ai_stack/api/__init__.py +0 -0
  57. privateaistack-0.1.0a1/private_ai_stack/api/app.py +60 -0
  58. privateaistack-0.1.0a1/private_ai_stack/api/dependencies.py +32 -0
  59. privateaistack-0.1.0a1/private_ai_stack/api/errors.py +69 -0
  60. privateaistack-0.1.0a1/private_ai_stack/api/middleware.py +18 -0
  61. privateaistack-0.1.0a1/private_ai_stack/api/routes/__init__.py +0 -0
  62. privateaistack-0.1.0a1/private_ai_stack/api/routes/health.py +34 -0
  63. privateaistack-0.1.0a1/private_ai_stack/api/routes/knowledge.py +24 -0
  64. privateaistack-0.1.0a1/private_ai_stack/api/routes/models.py +14 -0
  65. privateaistack-0.1.0a1/private_ai_stack/api/routes/policies.py +10 -0
  66. privateaistack-0.1.0a1/private_ai_stack/api/routes/reviews.py +29 -0
  67. privateaistack-0.1.0a1/private_ai_stack/api/routes/tasks.py +27 -0
  68. privateaistack-0.1.0a1/private_ai_stack/api/schemas.py +113 -0
  69. privateaistack-0.1.0a1/private_ai_stack/audit/__init__.py +0 -0
  70. privateaistack-0.1.0a1/private_ai_stack/audit/models.py +19 -0
  71. privateaistack-0.1.0a1/private_ai_stack/audit/redaction.py +26 -0
  72. privateaistack-0.1.0a1/private_ai_stack/audit/writer.py +72 -0
  73. privateaistack-0.1.0a1/private_ai_stack/cli/__init__.py +2 -0
  74. privateaistack-0.1.0a1/private_ai_stack/cli/main.py +569 -0
  75. privateaistack-0.1.0a1/private_ai_stack/config/__init__.py +0 -0
  76. privateaistack-0.1.0a1/private_ai_stack/config/settings.py +61 -0
  77. privateaistack-0.1.0a1/private_ai_stack/memory/__init__.py +0 -0
  78. privateaistack-0.1.0a1/private_ai_stack/memory/embeddings.py +29 -0
  79. privateaistack-0.1.0a1/private_ai_stack/memory/models.py +17 -0
  80. privateaistack-0.1.0a1/private_ai_stack/memory/store.py +175 -0
  81. privateaistack-0.1.0a1/private_ai_stack/observability/__init__.py +0 -0
  82. privateaistack-0.1.0a1/private_ai_stack/observability/telemetry.py +39 -0
  83. privateaistack-0.1.0a1/private_ai_stack/policies/__init__.py +0 -0
  84. privateaistack-0.1.0a1/private_ai_stack/policies/approvals.py +9 -0
  85. privateaistack-0.1.0a1/private_ai_stack/policies/defaults.py +77 -0
  86. privateaistack-0.1.0a1/private_ai_stack/policies/models.py +8 -0
  87. privateaistack-0.1.0a1/private_ai_stack/py.typed +1 -0
  88. privateaistack-0.1.0a1/private_ai_stack/reviews/__init__.py +0 -0
  89. privateaistack-0.1.0a1/private_ai_stack/reviews/collector.py +50 -0
  90. privateaistack-0.1.0a1/private_ai_stack/reviews/exclusions.py +44 -0
  91. privateaistack-0.1.0a1/private_ai_stack/reviews/findings.py +39 -0
  92. privateaistack-0.1.0a1/private_ai_stack/reviews/normalizers.py +136 -0
  93. privateaistack-0.1.0a1/private_ai_stack/reviews/reports.py +95 -0
  94. privateaistack-0.1.0a1/private_ai_stack/reviews/runner.py +31 -0
  95. privateaistack-0.1.0a1/private_ai_stack/services/__init__.py +0 -0
  96. privateaistack-0.1.0a1/private_ai_stack/services/forge_service.py +111 -0
  97. privateaistack-0.1.0a1/private_ai_stack/services/knowledge_service.py +51 -0
  98. privateaistack-0.1.0a1/private_ai_stack/services/ollama_service.py +47 -0
  99. privateaistack-0.1.0a1/private_ai_stack/services/review_service.py +111 -0
  100. privateaistack-0.1.0a1/private_ai_stack/services/task_service.py +79 -0
  101. privateaistack-0.1.0a1/private_ai_stack/templates/__init__.py +1 -0
  102. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/.env.example +26 -0
  103. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/.privateaistack-template.json +8 -0
  104. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/Dockerfile +16 -0
  105. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/README-DEPLOYMENT.md +28 -0
  106. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/compose.yaml +109 -0
  107. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/config/otel-collector.yaml +25 -0
  108. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/docker/postgres/init.sql +22 -0
  109. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/sample-target/README.md +3 -0
  110. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/backup.ps1 +4 -0
  111. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/backup.sh +4 -0
  112. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/bootstrap.ps1 +27 -0
  113. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/bootstrap.sh +28 -0
  114. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/export.ps1 +15 -0
  115. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/export.sh +15 -0
  116. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/health.ps1 +3 -0
  117. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/health.sh +6 -0
  118. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/restore.ps1 +5 -0
  119. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/restore.sh +7 -0
  120. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/security.ps1 +15 -0
  121. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/smoke.ps1 +4 -0
  122. privateaistack-0.1.0a1/private_ai_stack/templates/deployment/scripts/smoke.sh +6 -0
  123. privateaistack-0.1.0a1/private_ai_stack/tools/__init__.py +0 -0
  124. privateaistack-0.1.0a1/private_ai_stack/tools/base.py +8 -0
  125. privateaistack-0.1.0a1/private_ai_stack/tools/command_runner.py +48 -0
  126. privateaistack-0.1.0a1/private_ai_stack/tools/scanners/__init__.py +0 -0
  127. privateaistack-0.1.0a1/pyproject.toml +214 -0
  128. privateaistack-0.1.0a1/scripts/backup.ps1 +4 -0
  129. privateaistack-0.1.0a1/scripts/backup.sh +4 -0
  130. privateaistack-0.1.0a1/scripts/bootstrap.ps1 +27 -0
  131. privateaistack-0.1.0a1/scripts/bootstrap.sh +28 -0
  132. privateaistack-0.1.0a1/scripts/export.ps1 +15 -0
  133. privateaistack-0.1.0a1/scripts/export.sh +15 -0
  134. privateaistack-0.1.0a1/scripts/health.ps1 +3 -0
  135. privateaistack-0.1.0a1/scripts/health.sh +6 -0
  136. privateaistack-0.1.0a1/scripts/restore.ps1 +5 -0
  137. privateaistack-0.1.0a1/scripts/restore.sh +7 -0
  138. privateaistack-0.1.0a1/scripts/security.ps1 +15 -0
  139. privateaistack-0.1.0a1/scripts/smoke.ps1 +4 -0
  140. privateaistack-0.1.0a1/scripts/smoke.sh +6 -0
  141. privateaistack-0.1.0a1/tests/unit/test_api.py +42 -0
  142. privateaistack-0.1.0a1/tests/unit/test_audit.py +43 -0
  143. privateaistack-0.1.0a1/tests/unit/test_cli.py +346 -0
  144. privateaistack-0.1.0a1/tests/unit/test_memory.py +40 -0
  145. privateaistack-0.1.0a1/tests/unit/test_policies.py +14 -0
  146. privateaistack-0.1.0a1/tests/unit/test_reviews.py +63 -0
  147. privateaistack-0.1.0a1/tests/unit/test_task_service.py +52 -0
@@ -0,0 +1,15 @@
1
+ .git
2
+ .venv
3
+ __pycache__
4
+ .pytest_cache
5
+ .mypy_cache
6
+ .ruff_cache
7
+ reports
8
+ exports
9
+ backups
10
+ audit
11
+ .env
12
+ *.log
13
+ .codex
14
+ .claude
15
+ .cursor
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a reproducible problem
4
+ title: "[Bug]: "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Summary
10
+
11
+ ## Steps To Reproduce
12
+
13
+ ## Expected Behavior
14
+
15
+ ## Actual Behavior
16
+
17
+ ## Environment
18
+
19
+ ## Logs Or Output
20
+
21
+ Do not include secrets, credentials, or private source code.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Feature request
3
+ about: Propose an improvement
4
+ title: "[Feature]: "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Problem Or Mission Need
10
+
11
+ ## Proposed Capability
12
+
13
+ ## Users And Stakeholders
14
+
15
+ ## Acceptance Criteria
16
+
17
+ ## Alternatives Considered
@@ -0,0 +1,11 @@
1
+ ## Summary
2
+
3
+ ## Tests
4
+
5
+ ## Security And Privacy Notes
6
+
7
+ ## DCO
8
+
9
+ By submitting this pull request, I certify that I have the right to contribute this work under the MIT License.
10
+
11
+ Signed-off-by:
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: docker
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
11
+ - package-ecosystem: github-actions
12
+ directory: /
13
+ schedule:
14
+ interval: weekly
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, master]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-24.04
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.11", "3.12", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
19
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - run: python -m pip install --upgrade pip
23
+ - run: python -m pip install -e ".[dev]"
24
+ - run: python -m ruff check .
25
+ - run: python -m mypy private_ai_stack
26
+ - run: python -m pytest
@@ -0,0 +1,17 @@
1
+ name: Container
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, master]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ container:
13
+ runs-on: ubuntu-24.04
14
+ steps:
15
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16
+ - run: docker compose config
17
+ - run: docker build .
@@ -0,0 +1,17 @@
1
+ name: Documentation
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, master]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ docs:
13
+ runs-on: ubuntu-24.04
14
+ steps:
15
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16
+ - run: test -f README.md
17
+ - run: grep -R "qwen2.5:3b" README.md .env.example docs
@@ -0,0 +1,39 @@
1
+ name: Packaging
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, master]
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ package:
14
+ runs-on: ubuntu-24.04
15
+ steps:
16
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
18
+ with:
19
+ python-version: "3.13"
20
+ - run: python -m pip install --upgrade pip
21
+ - run: python -m pip install -e ".[dev,security,quality,postgres,observability]"
22
+ - run: python -m ruff check .
23
+ - run: python -m mypy private_ai_stack
24
+ - run: python -m pytest
25
+ - run: python -m bandit -r private_ai_stack
26
+ - run: python -m build
27
+ - run: python -m twine check dist/*
28
+ - run: python -m pip install dist/privateaistack-0.1.0a1-py3-none-any.whl
29
+ - run: privateaistack --version
30
+ - run: privateaistack init package-test-deployment
31
+ - run: privateaistack config check --directory package-test-deployment
32
+ - run: docker compose -f package-test-deployment/compose.yaml config
33
+ - run: sha256sum dist/* > checksums.txt
34
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
35
+ with:
36
+ name: privateaistack-0.1.0a1
37
+ path: |
38
+ dist/*
39
+ checksums.txt
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ # Trusted publishing: no API tokens. PyPI verifies the OIDC claims below
4
+ # (repository, workflow filename, environment) against the publisher you
5
+ # registered at https://pypi.org/manage/project/privateaistack/settings/publishing/
6
+ #
7
+ # Publishing is gated on a published GitHub Release so it never fires on a
8
+ # normal push or PR. To release: create a release for tag v0.1.0-alpha.1.
9
+
10
+ on:
11
+ release:
12
+ types: [published]
13
+ workflow_dispatch:
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-24.04
21
+ steps:
22
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
23
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
24
+ with:
25
+ python-version: "3.13"
26
+ - run: python -m pip install --upgrade pip build twine
27
+ - run: python -m build
28
+ - run: python -m twine check dist/*
29
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+
34
+ publish:
35
+ needs: build
36
+ runs-on: ubuntu-24.04
37
+ # Must match the "Environment name" of your PyPI trusted publisher.
38
+ environment:
39
+ name: pypi
40
+ url: https://pypi.org/p/privateaistack
41
+ permissions:
42
+ id-token: write # required for PyPI trusted publishing (OIDC)
43
+ steps:
44
+ - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+ # NOTE: This is a Docker action; it pulls ghcr.io/pypa/gh-action-pypi-publish:<ref>.
49
+ # No image is tagged by commit SHA, so it must be pinned to a version tag, not a SHA.
50
+ - uses: pypa/gh-action-pypi-publish@v1.14.0
@@ -0,0 +1,19 @@
1
+ name: Release Validation
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ validate:
11
+ runs-on: ubuntu-24.04
12
+ steps:
13
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
15
+ with:
16
+ python-version: "3.13"
17
+ - run: python -m pip install --upgrade pip build
18
+ - run: python -m build
19
+ - run: sha256sum dist/* > checksums.txt
@@ -0,0 +1,25 @@
1
+ name: OpenSSF Scorecard
2
+
3
+ on:
4
+ branch_protection_rule:
5
+ schedule:
6
+ - cron: "0 6 * * 1"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ security-events: write
12
+ id-token: write
13
+
14
+ jobs:
15
+ scorecard:
16
+ runs-on: ubuntu-24.04
17
+ steps:
18
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
19
+ - uses: ossf/scorecard-action@ff5dd8929f96a8a4dc67d13f32b8c75057829621 # v2.4.0
20
+ with:
21
+ results_file: results.sarif
22
+ results_format: sarif
23
+ - uses: github/codeql-action/upload-sarif@e8e8e51caba890f74f97e228d00b0b81b666ee4c # v3
24
+ with:
25
+ sarif_file: results.sarif
@@ -0,0 +1,23 @@
1
+ name: Security
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main, master]
7
+
8
+ permissions:
9
+ contents: read
10
+ security-events: write
11
+
12
+ jobs:
13
+ security:
14
+ runs-on: ubuntu-24.04
15
+ steps:
16
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17
+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
18
+ with:
19
+ python-version: "3.13"
20
+ - run: python -m pip install --upgrade pip
21
+ - run: python -m pip install -e ".[dev]"
22
+ - run: python -m bandit -r private_ai_stack
23
+ - run: python -m pip_audit
@@ -0,0 +1,92 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ .pytest_cache/
6
+ .mypy_cache/
7
+ .ruff_cache/
8
+ .coverage
9
+ coverage.xml
10
+ htmlcov/
11
+ .tox/
12
+ .nox/
13
+ .venv/
14
+ .audit-venv/
15
+ .audit-dev-venv/
16
+ .package-test-venv/
17
+ .package-sdist-venv/
18
+ venv/
19
+ ENV/
20
+ env/
21
+ build/
22
+ dist/
23
+ *.egg-info/
24
+
25
+ # Local environment and secrets
26
+ .env
27
+ .env.*
28
+ !.env.example
29
+ *.pem
30
+ *.key
31
+ *.crt
32
+ *.p12
33
+ *.pfx
34
+ id_rsa*
35
+ id_ed25519*
36
+ secrets.*
37
+
38
+ # PrivateAIStack runtime outputs
39
+ reports/*
40
+ !reports/.gitkeep
41
+ !reports/v0.1-verification.md
42
+ !reports/packaging-verification.md
43
+ exports/
44
+ backups/
45
+ data/
46
+ tmp/
47
+ logs/
48
+ package-test-deployment/
49
+ audit/*.jsonl
50
+ memory/*.jsonl
51
+
52
+ # Docker and local database state
53
+ .docker/
54
+ docker-volumes/
55
+ postgres-data/
56
+ ollama-data/
57
+
58
+ # Tool caches and scan output
59
+ .bandit
60
+ .detect-secrets.baseline
61
+ .trivycache/
62
+ pip-audit-report.*
63
+ sarif/
64
+
65
+ # Editor and OS files
66
+ .idea/
67
+ .vscode/
68
+ *.swp
69
+ *.swo
70
+ .DS_Store
71
+ Thumbs.db
72
+
73
+ # AI assistant and agent workspace artifacts
74
+ .claude/
75
+ .cursor/
76
+ .continue/
77
+ .aider*
78
+ .agent/
79
+ .agents/
80
+ .codex/
81
+ CLAUDE.md
82
+ AGENTS.md
83
+ agent.md
84
+ *.agent.md
85
+ *.prompt.md
86
+ *.instructions.md
87
+
88
+ # Logs
89
+ *.log
90
+ npm-debug.log*
91
+ yarn-debug.log*
92
+ yarn-error.log*
@@ -0,0 +1,253 @@
1
+ # PrivateAIStack Architecture
2
+
3
+ PrivateAIStack is a local-first, provider-replaceable AI stack for governed agent tasks, persistent RAG, private code review, auditability, and optional open observability.
4
+
5
+ Status: Phase 1 design baseline.
6
+
7
+ Author: Sekacorn
8
+
9
+ Project contact: Sekacorn@gmail.com
10
+
11
+ GitHub email: sekacorn@aol.com
12
+
13
+ ## V0.1 Decisions
14
+
15
+ - Repository: https://github.com/sekacorn/PrivateAIStack.git
16
+ - Original repository code license: MIT
17
+ - Default laptop model: `qwen2.5:3b`
18
+ - Default runtime profile: `laptop-cpu`
19
+ - Default Forge worker count: `1`
20
+ - Default services: API, Ollama, PostgreSQL with pgvector
21
+ - Optional observability profile: `observability`
22
+ - Optional observability services: OpenTelemetry Collector and Jaeger
23
+ - Default startup command: `docker compose up --build -d`
24
+ - Observability startup command: `docker compose --profile observability up --build -d`
25
+ - Larger models are optional and are never automatically downloaded.
26
+
27
+ ## Logical Architecture
28
+
29
+ ```text
30
+ User or CI
31
+ |
32
+ v
33
+ PrivateAIStack FastAPI service
34
+ |
35
+ v
36
+ Application service layer
37
+ |
38
+ +--> Task service
39
+ +--> Knowledge service
40
+ +--> Code-review service
41
+ +--> Audit/export service
42
+ +--> Policy/approval adapter
43
+ |
44
+ v
45
+ Forge Orchestrator
46
+ |
47
+ +--> Supervisor agent
48
+ | |
49
+ | +--> specialist agents
50
+ |
51
+ +--> Forge policy engine
52
+ +--> Forge tool sandbox
53
+ +--> Forge audit log
54
+ +--> Forge event bus / OpenTelemetry
55
+ +--> Ollama or configured model provider
56
+ +--> PostgreSQL / pgvector
57
+ ```
58
+
59
+ ## Observability Flow
60
+
61
+ ```text
62
+ PrivateAIStack and Forge
63
+ |
64
+ | OTLP, when enabled
65
+ v
66
+ OpenTelemetry Collector
67
+ |
68
+ v
69
+ Jaeger
70
+ ```
71
+
72
+ The API must keep working when observability is disabled or unavailable. Application code exports to the OpenTelemetry Collector boundary rather than hardwiring directly to Jaeger.
73
+
74
+ ## Component Responsibilities
75
+
76
+ FastAPI owns:
77
+
78
+ - HTTP contracts and Swagger documentation.
79
+ - Request IDs, trace IDs, structured errors, and exception redaction.
80
+ - Task and review lifecycle APIs.
81
+ - Safe-static repository collection.
82
+ - Report, audit, memory, backup, and export APIs.
83
+
84
+ Forge owns or fronts:
85
+
86
+ - Agent orchestration.
87
+ - Supervisor and worker execution.
88
+ - Model routing.
89
+ - Tool sandbox policy checks.
90
+ - Governance policies.
91
+ - Audit primitives.
92
+ - Event bus and OpenTelemetry hooks.
93
+ - pgvector-backed memory where compatible.
94
+
95
+ PostgreSQL with pgvector owns:
96
+
97
+ - Persistent RAG records.
98
+ - Agent memory metadata.
99
+ - Exportable memory state.
100
+ - Database backup and restore target.
101
+
102
+ Ollama owns:
103
+
104
+ - Local model serving.
105
+ - Explicit model pulls.
106
+ - Provider-replaceable inference endpoint.
107
+
108
+ Deterministic quality tools own:
109
+
110
+ - Linting, type checking, SAST, dependency scanning, secret scanning, complexity analysis, infrastructure checks, and repository metadata facts.
111
+
112
+ Agents own:
113
+
114
+ - Interpretation, correlation, deduplication, prioritization, and report synthesis.
115
+
116
+ ## Forge Integration Baseline
117
+
118
+ The minimum supported Forge package for v0.1 is expected to be:
119
+
120
+ ```text
121
+ agentforge-oss>=0.5.0,<0.6.0
122
+ ```
123
+
124
+ Verified import:
125
+
126
+ ```python
127
+ import forge
128
+ ```
129
+
130
+ Verified local Forge 0.5.0 exports include:
131
+
132
+ - `Orchestrator`
133
+ - `Agent`
134
+ - `Supervisor`
135
+ - `ForgeConfig`
136
+ - `OllamaProvider`
137
+ - `ModelRegistry`
138
+ - `PGVectorMemoryStore`
139
+ - `PolicySet`
140
+ - `PolicyRule`
141
+ - `ToolSandbox`
142
+ - `AuditLogger`
143
+ - `EventBus`
144
+
145
+ Implementation note: Forge 0.5.0 `Orchestrator.run` may return an awaitable at runtime. PrivateAIStack awaits that result and explicitly registers the configured Ollama model in a `ModelRegistry` with fixed routing to avoid accidental hosted-provider fallback.
146
+
147
+ Integration points requiring implementation-time verification:
148
+
149
+ - Async context manager behavior around `Orchestrator`.
150
+ - Exact audit write and verification APIs.
151
+ - Event subscription APIs for correlation with FastAPI request and task IDs.
152
+ - pgvector embedding dimension validation behavior.
153
+ - Whether PrivateAIStack needs a subprocess wrapper around deterministic tools in addition to Forge `ToolSandbox`.
154
+
155
+ ## V0.1 API Surface
156
+
157
+ Required endpoints:
158
+
159
+ - `GET /health`
160
+ - `GET /ready`
161
+ - `GET /version`
162
+ - `POST /v1/tasks`
163
+ - `GET /v1/tasks/{task_id}`
164
+ - `GET /v1/tasks/{task_id}/events`
165
+ - `GET /v1/tasks/{task_id}/audit`
166
+ - `POST /v1/knowledge/documents`
167
+ - `POST /v1/knowledge/search`
168
+ - `POST /v1/reviews`
169
+ - `GET /v1/reviews/{review_id}`
170
+ - `GET /v1/reviews/{review_id}/report`
171
+ - `GET /v1/reviews/{review_id}/findings`
172
+ - `GET /v1/models`
173
+ - `GET /v1/policies`
174
+
175
+ ## Code Review Architecture
176
+
177
+ ```text
178
+ Review request
179
+ |
180
+ v
181
+ Safe repository collector
182
+ |
183
+ +--> path allowlist and exclusion checks
184
+ +--> file size limits
185
+ +--> read-only access
186
+ |
187
+ v
188
+ Deterministic tool runners
189
+ |
190
+ +--> Ruff, mypy, pytest when approved, Bandit, pip-audit, Radon
191
+ +--> Hadolint, ShellCheck, yamllint, markdownlint, actionlint, Trivy
192
+ +--> detect-secrets or Gitleaks
193
+ |
194
+ v
195
+ Normalized findings
196
+ |
197
+ v
198
+ ReviewSupervisor
199
+ |
200
+ +--> CodeQualityAgent
201
+ +--> SecurityReviewAgent
202
+ +--> TestReviewAgent
203
+ +--> InfrastructureReviewAgent
204
+ +--> DocumentationReviewAgent
205
+ |
206
+ v
207
+ Markdown, JSON, SARIF, machine-readable summary
208
+ ```
209
+
210
+ Rule: deterministic tools find facts; agents interpret, correlate, and prioritize those facts.
211
+
212
+ Public-sector and restricted-environment deployments must still be evaluated against product requirements beyond code findings: real user need, measurable mission outcomes, accessible and plain-language interfaces, human ownership for high-impact decisions, records and retention handling, operational ownership, continuity of operations, vendor portability, and whether deterministic software is safer or simpler than AI.
213
+
214
+ ## Runtime Profiles
215
+
216
+ ### laptop-cpu
217
+
218
+ - Target: 16 GB system RAM with about 6 GB free.
219
+ - Default model: `qwen2.5:3b`.
220
+ - Workers: `1`.
221
+ - Context: limited.
222
+ - Observability: optional.
223
+
224
+ ### workstation-gpu
225
+
226
+ - Target: 32 GB or more system RAM and compatible GPU.
227
+ - Larger Ollama model permitted after explicit user pull.
228
+ - More workers allowed by configuration.
229
+ - Observability recommended.
230
+
231
+ ### external-ollama
232
+
233
+ - PrivateAIStack services run in Compose.
234
+ - Ollama runs on host or another private server.
235
+ - `OLLAMA_BASE_URL` selects the external endpoint.
236
+
237
+ ### hosted-provider-opt-in
238
+
239
+ - Disabled by default.
240
+ - Requires explicit environment configuration.
241
+ - Documentation must warn that content may leave the local environment.
242
+
243
+ ## Design Constraints
244
+
245
+ - No custom React or Next.js frontend in v0.1.
246
+ - No automatic large model download.
247
+ - No database port published by default.
248
+ - No Docker socket mount.
249
+ - No privileged containers.
250
+ - No host root mount.
251
+ - No hosted provider unless explicitly opted in.
252
+ - No claim of regulatory certification or complete sandboxing.
253
+ - No fabricated test results.
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ - Prepared Python package metadata for the `privateaistack` alpha distribution at version `0.1.0a1`.
6
+ - Added the `privateaistack` CLI for deployment initialization, Compose management, health checks, model management, task/review/knowledge API calls, audit inspection, backup, and restore.
7
+ - Added packaged deployment templates with optional `observability` profile support and `.env` preservation.
8
+ - Added packaging, CLI, PyPI release, and template-versioning documentation plus packaging CI validation.
9
+ - Updated the pinned official Ollama Docker image from `ollama/ollama:0.5.7` to `ollama/ollama:0.31.1`, the newest verified stable non-release-candidate tag available from Docker Hub at verification time.
10
+ - Removed the mistakenly shipped Government Business Analyst runtime agent while preserving neutral public-sector product requirements in documentation.
11
+
12
+ ## 0.1.0
13
+
14
+ - Initial local-first PrivateAIStack v0.1 implementation.
15
+ - FastAPI API, Ollama integration, PostgreSQL-backed document storage, audit JSONL, safe-static code review, optional observability, and open-source project scaffolding.
@@ -0,0 +1,6 @@
1
+ * @sekacorn
2
+ .github/workflows/ @sekacorn
3
+ SECURITY.md @sekacorn
4
+ THREAT_MODEL.md @sekacorn
5
+ private_ai_stack/policies/ @sekacorn
6
+ private_ai_stack/audit/ @sekacorn
@@ -0,0 +1,5 @@
1
+ # Code of Conduct
2
+
3
+ PrivateAIStack uses the Contributor Covenant spirit: be respectful, constructive, and focused on improving the project. Harassment, abusive behavior, and deliberate disruption are not welcome.
4
+
5
+ Report concerns to Sekacorn@gmail.com.