video-scribe 0.2.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.
Files changed (127) hide show
  1. video_scribe-0.2.0/.env.example +12 -0
  2. video_scribe-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yml +65 -0
  3. video_scribe-0.2.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
  4. video_scribe-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yml +34 -0
  5. video_scribe-0.2.0/.github/PULL_REQUEST_TEMPLATE.md +28 -0
  6. video_scribe-0.2.0/.github/workflows/ci.yml +110 -0
  7. video_scribe-0.2.0/.github/workflows/release.yml +152 -0
  8. video_scribe-0.2.0/.gitignore +35 -0
  9. video_scribe-0.2.0/.python-version +1 -0
  10. video_scribe-0.2.0/.worktreeinclude +3 -0
  11. video_scribe-0.2.0/AGENTS.md +68 -0
  12. video_scribe-0.2.0/CHANGELOG.md +66 -0
  13. video_scribe-0.2.0/CONTRIBUTING.md +106 -0
  14. video_scribe-0.2.0/LICENSE +201 -0
  15. video_scribe-0.2.0/PKG-INFO +194 -0
  16. video_scribe-0.2.0/README.md +149 -0
  17. video_scribe-0.2.0/README.zh-CN.md +149 -0
  18. video_scribe-0.2.0/SECURITY.md +28 -0
  19. video_scribe-0.2.0/config/agent-routing.yaml +78 -0
  20. video_scribe-0.2.0/config/default.yaml +53 -0
  21. video_scribe-0.2.0/config/local_ollama.yaml +35 -0
  22. video_scribe-0.2.0/config/local_sidecar.yaml +37 -0
  23. video_scribe-0.2.0/docs/architecture/01-pipeline-and-algorithms.md +57 -0
  24. video_scribe-0.2.0/docs/architecture/02-ir-schema-contract.md +198 -0
  25. video_scribe-0.2.0/docs/architecture/03-revision-loop-contract.md +267 -0
  26. video_scribe-0.2.0/docs/architecture/04-mermaid-export-contract.md +191 -0
  27. video_scribe-0.2.0/docs/architecture/05-photo-enhancement-contract.md +114 -0
  28. video_scribe-0.2.0/docs/architecture/06-local-vlm-contract.md +141 -0
  29. video_scribe-0.2.0/docs/architecture/07-image-sequence-contract.md +338 -0
  30. video_scribe-0.2.0/docs/architecture/08-live-review-sync-contract.md +283 -0
  31. video_scribe-0.2.0/docs/architecture/09-photo-quality-contract.md +293 -0
  32. video_scribe-0.2.0/docs/architecture/10-complex-document-contract.md +263 -0
  33. video_scribe-0.2.0/docs/architecture/11-batch-collection-contract.md +463 -0
  34. video_scribe-0.2.0/docs/architecture/12-phase11-evolution-contract.md +185 -0
  35. video_scribe-0.2.0/docs/assets/demo_walkthrough.gif +0 -0
  36. video_scribe-0.2.0/docs/assets/showcase_inspection_report.png +0 -0
  37. video_scribe-0.2.0/docs/assets/showcase_pipeline_comparison.png +0 -0
  38. video_scribe-0.2.0/docs/governance/01-multi-agent-collaboration.md +40 -0
  39. video_scribe-0.2.0/docs/governance/02-engineering-standards.md +30 -0
  40. video_scribe-0.2.0/docs/roadmap.md +44 -0
  41. video_scribe-0.2.0/paseo.json +30 -0
  42. video_scribe-0.2.0/pyproject.toml +98 -0
  43. video_scribe-0.2.0/src/video_scribe/__init__.py +3 -0
  44. video_scribe-0.2.0/src/video_scribe/__main__.py +8 -0
  45. video_scribe-0.2.0/src/video_scribe/batch.py +1435 -0
  46. video_scribe-0.2.0/src/video_scribe/benchmark.py +1766 -0
  47. video_scribe-0.2.0/src/video_scribe/cli.py +1725 -0
  48. video_scribe-0.2.0/src/video_scribe/config.py +346 -0
  49. video_scribe-0.2.0/src/video_scribe/export/__init__.py +149 -0
  50. video_scribe-0.2.0/src/video_scribe/export/docx.py +1353 -0
  51. video_scribe-0.2.0/src/video_scribe/export/markdown.py +573 -0
  52. video_scribe-0.2.0/src/video_scribe/export/mermaid_render.py +876 -0
  53. video_scribe-0.2.0/src/video_scribe/export/report.py +884 -0
  54. video_scribe-0.2.0/src/video_scribe/export/review_server.py +783 -0
  55. video_scribe-0.2.0/src/video_scribe/export/templates/inspection_report.html +3273 -0
  56. video_scribe-0.2.0/src/video_scribe/export/templates/vendor/LICENSE-mermaid.txt +21 -0
  57. video_scribe-0.2.0/src/video_scribe/export/templates/vendor/mermaid.min.js +3636 -0
  58. video_scribe-0.2.0/src/video_scribe/ingest/__init__.py +113 -0
  59. video_scribe-0.2.0/src/video_scribe/ingest/dewarp.py +637 -0
  60. video_scribe-0.2.0/src/video_scribe/ingest/enhance.py +904 -0
  61. video_scribe-0.2.0/src/video_scribe/ingest/extractor.py +572 -0
  62. video_scribe-0.2.0/src/video_scribe/ingest/images.py +940 -0
  63. video_scribe-0.2.0/src/video_scribe/ingest/motion.py +865 -0
  64. video_scribe-0.2.0/src/video_scribe/ingest/probe.py +142 -0
  65. video_scribe-0.2.0/src/video_scribe/ingest/roi.py +247 -0
  66. video_scribe-0.2.0/src/video_scribe/ingest/stream.py +567 -0
  67. video_scribe-0.2.0/src/video_scribe/ingest/subtitles.py +650 -0
  68. video_scribe-0.2.0/src/video_scribe/pipeline.py +1978 -0
  69. video_scribe-0.2.0/src/video_scribe/recognition/__init__.py +38 -0
  70. video_scribe-0.2.0/src/video_scribe/recognition/base.py +109 -0
  71. video_scribe-0.2.0/src/video_scribe/recognition/batcher.py +216 -0
  72. video_scribe-0.2.0/src/video_scribe/recognition/openai_vlm.py +1187 -0
  73. video_scribe-0.2.0/src/video_scribe/recognition/prompts.py +162 -0
  74. video_scribe-0.2.0/src/video_scribe/recognition/sidecar.py +1742 -0
  75. video_scribe-0.2.0/src/video_scribe/revision.py +1188 -0
  76. video_scribe-0.2.0/src/video_scribe/schemas/__init__.py +67 -0
  77. video_scribe-0.2.0/src/video_scribe/schemas/document_ir.py +159 -0
  78. video_scribe-0.2.0/src/video_scribe/schemas/export.py +40 -0
  79. video_scribe-0.2.0/src/video_scribe/schemas/pipeline.py +93 -0
  80. video_scribe-0.2.0/src/video_scribe/schemas/video.py +140 -0
  81. video_scribe-0.2.0/src/video_scribe/state/__init__.py +5 -0
  82. video_scribe-0.2.0/src/video_scribe/state/store.py +450 -0
  83. video_scribe-0.2.0/src/video_scribe/stitching/__init__.py +40 -0
  84. video_scribe-0.2.0/src/video_scribe/stitching/aligner.py +246 -0
  85. video_scribe-0.2.0/src/video_scribe/stitching/healer.py +433 -0
  86. video_scribe-0.2.0/src/video_scribe/stitching/normalizer.py +352 -0
  87. video_scribe-0.2.0/src/video_scribe/stitching/pipeline.py +224 -0
  88. video_scribe-0.2.0/src/video_scribe/stitching/validators.py +408 -0
  89. video_scribe-0.2.0/src/video_scribe/web/__init__.py +15 -0
  90. video_scribe-0.2.0/src/video_scribe/web/server.py +1951 -0
  91. video_scribe-0.2.0/src/video_scribe/web/templates/studio.html +1182 -0
  92. video_scribe-0.2.0/tests/adversarial/test_e4672d7_adversarial.py +496 -0
  93. video_scribe-0.2.0/tests/adversarial/test_phase10_adversarial.py +506 -0
  94. video_scribe-0.2.0/tests/adversarial/test_phase11_integration.py +261 -0
  95. video_scribe-0.2.0/tests/adversarial/test_phase2_adversarial.py +950 -0
  96. video_scribe-0.2.0/tests/adversarial/test_phase3_adversarial.py +1274 -0
  97. video_scribe-0.2.0/tests/adversarial/test_phase4_adversarial.py +1189 -0
  98. video_scribe-0.2.0/tests/adversarial/test_phase5_adversarial.py +394 -0
  99. video_scribe-0.2.0/tests/adversarial/test_phase6_adversarial.py +742 -0
  100. video_scribe-0.2.0/tests/adversarial/test_phase71_adversarial.py +301 -0
  101. video_scribe-0.2.0/tests/adversarial/test_phase81_adversarial.py +326 -0
  102. video_scribe-0.2.0/tests/adversarial/test_phase82_adversarial.py +758 -0
  103. video_scribe-0.2.0/tests/adversarial/test_phase83_adversarial.py +542 -0
  104. video_scribe-0.2.0/tests/adversarial/test_phase9_adversarial.py +409 -0
  105. video_scribe-0.2.0/tests/adversarial/test_track_a_adversarial.py +571 -0
  106. video_scribe-0.2.0/tests/fixtures/__init__.py +1 -0
  107. video_scribe-0.2.0/tests/fixtures/synthetic_video.py +552 -0
  108. video_scribe-0.2.0/tests/integration/test_e2e_pipeline.py +1215 -0
  109. video_scribe-0.2.0/tests/unit/test_cv_and_stitching.py +892 -0
  110. video_scribe-0.2.0/tests/unit/test_docx_styling.py +477 -0
  111. video_scribe-0.2.0/tests/unit/test_engineering.py +1995 -0
  112. video_scribe-0.2.0/tests/unit/test_enhance.py +338 -0
  113. video_scribe-0.2.0/tests/unit/test_image_sequence.py +532 -0
  114. video_scribe-0.2.0/tests/unit/test_live_review_sync.py +466 -0
  115. video_scribe-0.2.0/tests/unit/test_local_vlm.py +478 -0
  116. video_scribe-0.2.0/tests/unit/test_mermaid_export.py +762 -0
  117. video_scribe-0.2.0/tests/unit/test_phase10_batch_collection.py +592 -0
  118. video_scribe-0.2.0/tests/unit/test_phase11_heic_batch_capture.py +501 -0
  119. video_scribe-0.2.0/tests/unit/test_phase11_sidecar.py +629 -0
  120. video_scribe-0.2.0/tests/unit/test_phase11_webui.py +802 -0
  121. video_scribe-0.2.0/tests/unit/test_phase711_polish.py +380 -0
  122. video_scribe-0.2.0/tests/unit/test_phase9_complex_doc.py +483 -0
  123. video_scribe-0.2.0/tests/unit/test_photo_quality.py +377 -0
  124. video_scribe-0.2.0/tests/unit/test_report.py +762 -0
  125. video_scribe-0.2.0/tests/unit/test_revision.py +947 -0
  126. video_scribe-0.2.0/tests/unit/test_schemas_and_config.py +88 -0
  127. video_scribe-0.2.0/uv.lock +735 -0
@@ -0,0 +1,12 @@
1
+ # Video-Scribe VLM / LLM API Configuration
2
+ # Copy this file to .env and fill in your credentials (never commit .env)
3
+
4
+ VIDEO_SCRIBE_VLM_BASE_URL=https://api.openai.com/v1
5
+ VIDEO_SCRIBE_VLM_API_KEY=sk-replace-me
6
+ VIDEO_SCRIBE_VLM_MODEL=gpt-4o-mini
7
+
8
+ # Optional lightweight text-only model for ambiguous boundary stitching & heading normalization
9
+ # If unset, falls back to VIDEO_SCRIBE_VLM_MODEL
10
+ VIDEO_SCRIBE_STITCH_MODEL=
11
+ VIDEO_SCRIBE_CONCURRENCY=4
12
+ VIDEO_SCRIBE_MAX_COST_USD=0
@@ -0,0 +1,65 @@
1
+ name: Bug Report
2
+ description: Report a reproducible problem with Video-Scribe.
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to report a bug. Please search existing issues first, and never include API keys or other secrets in this form.
10
+ - type: textarea
11
+ id: summary
12
+ attributes:
13
+ label: Summary
14
+ description: What went wrong, in one or two sentences?
15
+ placeholder: A clear and concise description of the problem.
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: command
20
+ attributes:
21
+ label: Reproduction command
22
+ description: The exact CLI command (or minimal steps) that triggers the issue.
23
+ placeholder: |
24
+ uv run video-scribe extract demo.mp4 -o output/demo --dewarp auto
25
+ render: shell
26
+ validations:
27
+ required: true
28
+ - type: input
29
+ id: environment
30
+ attributes:
31
+ label: OS and Python version
32
+ description: Your operating system and the output of `python --version`.
33
+ placeholder: Windows 11, Python 3.12.4
34
+ validations:
35
+ required: true
36
+ - type: input
37
+ id: vlm-provider
38
+ attributes:
39
+ label: VLM provider
40
+ description: Which recognition backend were you using? Cloud OpenAI-compatible, or a local preset?
41
+ placeholder: openai_compatible / ollama / lmstudio / vllm / llama_cpp
42
+ validations:
43
+ required: false
44
+ - type: textarea
45
+ id: expected
46
+ attributes:
47
+ label: Expected behavior
48
+ description: What did you expect to happen?
49
+ validations:
50
+ required: true
51
+ - type: textarea
52
+ id: actual
53
+ attributes:
54
+ label: Actual behavior
55
+ description: What happened instead? Include error messages where relevant.
56
+ validations:
57
+ required: true
58
+ - type: textarea
59
+ id: logs
60
+ attributes:
61
+ label: Logs and output
62
+ description: Paste relevant logs, stack traces, or benchmark output. Redact paths, tokens, and document content as needed.
63
+ render: shell
64
+ validations:
65
+ required: false
@@ -0,0 +1 @@
1
+ blank_issues_enabled: true
@@ -0,0 +1,34 @@
1
+ name: Feature Request
2
+ description: Suggest an improvement or a new capability for Video-Scribe.
3
+ title: "[Feature]: "
4
+ labels: ["enhancement"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for the suggestion. Please describe the problem you are trying to solve before proposing an implementation.
10
+ - type: textarea
11
+ id: use-case
12
+ attributes:
13
+ label: Use case
14
+ description: What are you trying to accomplish, and why is the current behavior insufficient?
15
+ placeholder: Describe the recording, photo set, or document workflow that motivates this request.
16
+ validations:
17
+ required: true
18
+ - type: textarea
19
+ id: proposal
20
+ attributes:
21
+ label: Proposed CLI or UX
22
+ description: How would you like this to work? Include example commands, flags, or output if you have them.
23
+ placeholder: |
24
+ uv run video-scribe extract input.mp4 --new-option auto
25
+ render: shell
26
+ validations:
27
+ required: false
28
+ - type: textarea
29
+ id: alternatives
30
+ attributes:
31
+ label: Alternatives considered
32
+ description: Other approaches or workarounds you have tried or considered.
33
+ validations:
34
+ required: false
@@ -0,0 +1,28 @@
1
+ ## Summary
2
+
3
+ <!-- What does this pull request change, and why? -->
4
+
5
+ ## Related Issue
6
+
7
+ <!-- Link the issue this addresses, e.g. "Closes #123". Write "N/A" if none. -->
8
+
9
+ ## Type of Change
10
+
11
+ - [ ] Bug fix
12
+ - [ ] New feature
13
+ - [ ] Documentation update
14
+ - [ ] Refactor or performance improvement
15
+ - [ ] Test or benchmark improvement
16
+ - [ ] Other (describe below)
17
+
18
+ ## Verification
19
+
20
+ - [ ] `uv run ruff check src tests`
21
+ - [ ] `uv run pytest tests/unit tests/adversarial tests/integration`
22
+ - [ ] `uv run video-scribe benchmark --json`
23
+
24
+ ## Invariants Checked
25
+
26
+ - [ ] O(1) streaming memory for video ingest (no unbounded frame loading)
27
+ - [ ] No secrets, real API keys, or personal data in code, logs, tests, or fixtures
28
+ - [ ] Windows and UTF-8 compatibility preserved (list subprocess args, explicit encoding, safe pipe handling)
@@ -0,0 +1,110 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}-${{ github.ref }}
12
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
13
+
14
+ env:
15
+ PYTHONIOENCODING: utf-8
16
+
17
+ jobs:
18
+ test:
19
+ name: ${{ matrix.os }} / Python ${{ matrix.python-version }}
20
+ runs-on: ${{ matrix.os }}
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ os: [ubuntu-latest, windows-latest]
25
+ python-version: ["3.11", "3.12"]
26
+
27
+ steps:
28
+ - name: Checkout
29
+ uses: actions/checkout@v4
30
+
31
+ - name: Install system tools (Ubuntu)
32
+ if: runner.os == 'Linux'
33
+ run: |
34
+ sudo apt-get update
35
+ sudo apt-get install -y --no-install-recommends ffmpeg pandoc
36
+
37
+ - name: Install system tools (Windows)
38
+ if: runner.os == 'Windows'
39
+ shell: pwsh
40
+ run: |
41
+ $ErrorActionPreference = 'Stop'
42
+ $missing = @()
43
+ if (-not (Get-Command ffmpeg -ErrorAction SilentlyContinue)) { $missing += 'ffmpeg' }
44
+ if (-not (Get-Command pandoc -ErrorAction SilentlyContinue)) { $missing += 'pandoc' }
45
+ if ($missing.Count -gt 0) {
46
+ Write-Host "Installing via Chocolatey: $($missing -join ', ')"
47
+ choco install $missing --yes --no-progress
48
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
49
+ $regDirs = @(
50
+ [Environment]::GetEnvironmentVariable('Path', 'Machine'),
51
+ [Environment]::GetEnvironmentVariable('Path', 'User')
52
+ ) -join ';' -split ';' | Where-Object { $_ -and (Test-Path $_) } | Select-Object -Unique
53
+ foreach ($dir in $regDirs) {
54
+ $dir | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
55
+ }
56
+ $env:Path = ($regDirs + ($env:Path -split ';') | Where-Object { $_ } | Select-Object -Unique) -join ';'
57
+ }
58
+ ffmpeg -version
59
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
60
+ pandoc --version
61
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
62
+
63
+ - name: Install uv
64
+ uses: astral-sh/setup-uv@v5
65
+ with:
66
+ enable-cache: true
67
+ python-version: ${{ matrix.python-version }}
68
+
69
+ - name: Sync dependencies
70
+ run: uv sync --frozen --extra dev
71
+
72
+ - name: Lint
73
+ run: uv run ruff check src tests
74
+
75
+ - name: Test
76
+ run: uv run pytest tests/unit tests/adversarial tests/integration
77
+
78
+ - name: Synthetic benchmark smoke
79
+ run: uv run video-scribe benchmark --work-dir "${{ runner.temp }}/ci-bench" --json
80
+
81
+ - name: Build wheel and verify bundled templates
82
+ shell: bash
83
+ run: |
84
+ rm -rf dist
85
+ uv build --wheel
86
+ uv run python - <<'PY'
87
+ import glob
88
+ import sys
89
+ import zipfile
90
+
91
+ wheels = glob.glob("dist/*.whl")
92
+ assert len(wheels) == 1, wheels
93
+ with zipfile.ZipFile(wheels[0]) as zf:
94
+ names = zf.namelist()
95
+ required = [
96
+ "video_scribe/export/templates/inspection_report.html",
97
+ "video_scribe/export/templates/vendor/mermaid.min.js",
98
+ "video_scribe/export/templates/vendor/LICENSE-mermaid.txt",
99
+ "video_scribe/web/templates/studio.html",
100
+ "LICENSE",
101
+ ]
102
+ hits = {
103
+ req: [n for n in names if n == req or n.endswith("/" + req)]
104
+ for req in required
105
+ }
106
+ for req, found in hits.items():
107
+ print(f"{req}: {found}")
108
+ sys.exit(0 if all(hits.values()) else 1)
109
+ PY
110
+ rm -rf dist
@@ -0,0 +1,152 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ concurrency:
13
+ group: release-${{ github.ref }}
14
+ cancel-in-progress: false
15
+
16
+ env:
17
+ PYTHONIOENCODING: utf-8
18
+
19
+ jobs:
20
+ build:
21
+ name: Build distributions
22
+ runs-on: ubuntu-latest
23
+
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v4
27
+
28
+ - name: Install uv
29
+ uses: astral-sh/setup-uv@v5
30
+ with:
31
+ python-version: "3.12"
32
+ enable-cache: true
33
+
34
+ - name: Verify tag matches pyproject.toml version
35
+ if: github.ref_type == 'tag'
36
+ shell: bash
37
+ env:
38
+ TAG_NAME: ${{ github.ref_name }}
39
+ run: |
40
+ uv run --no-project python - <<'PY'
41
+ import os
42
+ import tomllib
43
+ from pathlib import Path
44
+
45
+ tag = os.environ["TAG_NAME"]
46
+ tag_version = tag.removeprefix("v")
47
+ pyproject = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
48
+ pkg_version = pyproject["project"]["version"]
49
+ if tag_version != pkg_version:
50
+ raise SystemExit(
51
+ f"Tag {tag!r} (version {tag_version!r}) does not match pyproject.toml version {pkg_version!r}"
52
+ )
53
+ print(f"Verified tag {tag} matches pyproject.toml version {pkg_version}")
54
+ PY
55
+
56
+ - name: Build sdist and wheel
57
+ shell: bash
58
+ run: |
59
+ rm -rf dist
60
+ uv build
61
+
62
+ - name: Verify wheel contains bundled templates and licenses
63
+ shell: bash
64
+ run: |
65
+ uv run --no-project python - <<'PY'
66
+ import glob
67
+ import sys
68
+ import zipfile
69
+
70
+ wheels = glob.glob("dist/*.whl")
71
+ sdists = glob.glob("dist/*.tar.gz")
72
+ assert len(wheels) == 1, f"Expected 1 wheel, found: {wheels}"
73
+ assert len(sdists) == 1, f"Expected 1 sdist, found: {sdists}"
74
+
75
+ with zipfile.ZipFile(wheels[0]) as zf:
76
+ names = zf.namelist()
77
+
78
+ required = [
79
+ "video_scribe/export/templates/inspection_report.html",
80
+ "video_scribe/export/templates/vendor/mermaid.min.js",
81
+ "video_scribe/export/templates/vendor/LICENSE-mermaid.txt",
82
+ "video_scribe/web/templates/studio.html",
83
+ "LICENSE",
84
+ ]
85
+ hits = {
86
+ req: [n for n in names if n == req or n.endswith("/" + req)]
87
+ for req in required
88
+ }
89
+ for req, found in hits.items():
90
+ print(f"{req}: {found}")
91
+ print(f"sdist: {sdists[0]}")
92
+ sys.exit(0 if all(hits.values()) else 1)
93
+ PY
94
+
95
+ - name: Upload release distributions
96
+ uses: actions/upload-artifact@v4
97
+ with:
98
+ name: release-dists
99
+ path: dist/*
100
+
101
+ publish-pypi:
102
+ name: Publish to PyPI
103
+ needs: build
104
+ if: github.ref_type == 'tag'
105
+ runs-on: ubuntu-latest
106
+ environment:
107
+ name: pypi
108
+ url: https://pypi.org/p/video-scribe
109
+ permissions:
110
+ id-token: write
111
+
112
+ steps:
113
+ - name: Download release distributions
114
+ uses: actions/download-artifact@v4
115
+ with:
116
+ name: release-dists
117
+ path: dist/
118
+
119
+ - name: Publish package to PyPI
120
+ uses: pypa/gh-action-pypi-publish@release/v1
121
+ with:
122
+ packages-dir: dist/
123
+
124
+ github-release:
125
+ name: Create GitHub Release
126
+ needs: [build, publish-pypi]
127
+ if: github.ref_type == 'tag'
128
+ runs-on: ubuntu-latest
129
+ permissions:
130
+ contents: write
131
+
132
+ steps:
133
+ - name: Checkout
134
+ uses: actions/checkout@v4
135
+
136
+ - name: Download release distributions
137
+ uses: actions/download-artifact@v4
138
+ with:
139
+ name: release-dists
140
+ path: dist/
141
+
142
+ - name: Create or update GitHub Release
143
+ shell: bash
144
+ env:
145
+ GH_TOKEN: ${{ github.token }}
146
+ TAG: ${{ github.ref_name }}
147
+ run: |
148
+ if gh release view "$TAG" >/dev/null 2>&1; then
149
+ gh release upload "$TAG" dist/* --clobber
150
+ else
151
+ gh release create "$TAG" dist/* --title "Video-Scribe $TAG" --generate-notes
152
+ fi
@@ -0,0 +1,35 @@
1
+ # Python / uv
2
+ .venv/
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ dist/
10
+ build/
11
+ .coverage
12
+
13
+ # Secrets & local env
14
+ .env
15
+ .env.local
16
+ *.key
17
+ *.pem
18
+
19
+ # Runtime artifacts & media (never commit raw recordings or large caches)
20
+ work/
21
+ output/
22
+ runs/
23
+ *.mp4
24
+ *.mkv
25
+ *.mov
26
+ *.webm
27
+ *.avi
28
+ *.flv
29
+ *.wmv
30
+
31
+ # OS / IDE
32
+ .DS_Store
33
+ Thumbs.db
34
+ .vscode/
35
+ .idea/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,3 @@
1
+ # Copy gitignored local VLM/API secrets into new Paseo worktrees before setup runs
2
+ .env
3
+ .env.local
@@ -0,0 +1,68 @@
1
+ # AGENTS.md — Video-Scribe 全局 AI Agent 行为宪法
2
+
3
+ > 本文件适用于所有在 `video-scribe` 仓库内工作的 AI Agent(Antigravity、OpenCode 及后续接入的任何运行时)。在执行任何读取、分析、编码或审查任务前,必须先遵守本宪法。
4
+
5
+ ---
6
+
7
+ ## 1. 项目一句话定位
8
+
9
+ **Video-Scribe** — *High-Fidelity Structured Document Extraction from Arbitrary-Duration Screen Recordings*。
10
+ 我们构建的是面向**任意时长录屏(几分钟至数小时)**的高保真文档提取系统,**内存恒定性、零漏页/零重复的精确拼接、排版高保真(标题/表格/代码/LaTeX/图表)与断点可恢复性**永远高于短期堆砌功能。
11
+
12
+ ---
13
+
14
+ ## 2. 3+1 Agent 固定角色与精确运行时配置
15
+
16
+ > **三常驻主力 + 一超低频顾问(3+1)**:日常 100% 闭环与编码测试由 Neon / Hydrogen / DeepSeek 承担;Opus 5.5 严格限定为 **「单轮脱水顾问 / 视觉蓝图师」**(`escalation_or_explicit_only`:仅在熔断前疑难僵局、重大前端交互视觉蓝图或重大发布核心 Diff 盲审时触发,严禁多轮编码/测试/截图循环)。
17
+
18
+ | 角色代号 | Provider Instance | Model ID | Reasoning / Effort 参数 | 职责边界 |
19
+ | :--- | :--- | :--- | :--- | :--- |
20
+ | **Neon**(常驻 · 主控架构师) | `antigravity` | `gemini-4-neon` | `thought_level: "high"` | 顶层架构、契约/Schema 定义、任务拆解与派发、分支合入、端到端验真、视觉截图核验、阶段门禁汇报 |
21
+ | **Hydrogen**(常驻 · CV/算法专家 & 红队审查官) | `antigravity` | `gemini-4-hydrogen` | `thought_level: "high"` | 自动 ROI/光标去噪、FFT 相位相关滚动追踪、翻页检测、确定性后缀-前缀去重与断裂缝合算法攻坚;以独立冷上下文执行红队 Code Review |
22
+ | **DeepSeek**(常驻 · 主力研发 & 自动化测试官) | `opencode` | `opencode-go/deepseek-v4.1-flash` | `variant: "max"` | 按契约主力实现 FFmpeg 流式管道、VLM 异步批处理、SQLite 断点库、Markdown/Pandoc-Docx 导出与 CLI;编写单测、合成录屏基准与异构对抗测试 |
23
+ | **Opus**(+1 超低频 · 首席顾问 & 视觉蓝图师) | `antigravity` | `claude-opus-5-5` | `thought_level: "medium"`(纯 UI 原型) / `"high"`(疑难会诊 & 脱水 Diff 终审) | **1–2 轮纯文本高密直出**:疑难算法/审查僵局第三家族会诊、Phase 3 交互式抽检报告纯视觉蓝图、大版本脱水 Diff 盲审(**严禁 `worktree` 编码、严禁跑测试/lint 循环、严禁读图**) |
24
+
25
+ 完整协同模式、Opus 5 条防烧额度禁令与派单模板见:[docs/governance/01-multi-agent-collaboration.md](docs/governance/01-multi-agent-collaboration.md)。
26
+
27
+ ---
28
+
29
+ ## 3. 六条不可违背的工程红线
30
+
31
+ 1. **契约先行,禁止私改接口**:涉及 `src/video_scribe/schemas/`、`docs/architecture/02-ir-schema-contract.md` 或跨模块数据结构的修改,必须由 Neon 发起,并经 **Hydrogen 独立红队审查**通过后锁定,下游再行施工。
32
+ 2. **流式 O(1) 内存与断点续传不变量**:
33
+ - 视频扫描阶段必须采用 FFmpeg 流式管道逐帧处理,严禁将整段视频帧一次性载入内存或无差别全分辨率落盘。
34
+ - 凡消耗外部 VLM/LLM API 额度的批处理阶段,必须以原子事务落盘缓存至 SQLite/工作目录,保证中断重启后零重复调用。
35
+ 3. **禁止“既当运动员又当裁判”**:
36
+ - DeepSeek 实现的工程/I/O/导出模块,必须由 **Hydrogen** 在独立冷上下文中做红队审查。
37
+ - Hydrogen 实现的核心 CV/去重/缝合算法,必须由 **DeepSeek** 编写独立异构对抗测试验证,并由 **Neon** 验收合入。
38
+ - Neon 变更核心 Schema 或治理规范,必须由 **Hydrogen** 独立复审。
39
+ 4. **严格遵守文件所有权白名单**:
40
+ - 被委托的子 Agent 只允许修改任务单中显式列出的路径白名单;发现白名单之外的缺陷时,在交付报告中记录上报,**禁止越界顺手修改**。
41
+ - 并行写代码必须使用 `isolation: "worktree"` 或严格互不相交的文件切片。
42
+ 5. **量化基准说话,严禁凭感觉调参**:
43
+ - 抽帧去重、滚动步长、重叠合并等算法变更,必须通过合成文档录屏基准验证覆盖率、重复率、清晰度与峰值内存,所有文档块须保留可回溯的视频时间戳与源帧 ID(`ProvenanceRef`)。
44
+ 6. **严守人工门禁与连续打回熔断机制**:
45
+ - 阶段切换、破坏性契约变更与真实 VLM 大规模消耗前须明确汇报确认。
46
+ - **远端推送人工门禁**:任何 `git push`(含新建/更新远端分支、打 Tag 或覆盖远端历史)执行前,必须先完成本地提交与验证,向用户汇报提交哈希、变更文件清单与验收结果,获得用户明确确认后再执行推送;严禁在未经确认的情况下自动推送远端。
47
+ - **连续打回熔断**:同一任务在红队审查或验证门禁中连续打回 `≥ 2` 次时,立即停止自动循环,由 Neon 汇总分歧升级人工仲裁(必要时在第 1 次打回僵局后触发 Opus 单轮脱水会诊)。
48
+
49
+ ---
50
+
51
+ ## 4. 文档提取领域强制检查项
52
+
53
+ 处理任何视频抽帧、CV 算法、VLM Prompt、去重缝合或导出代码时,必须显式核对以下 6 项:
54
+ - **长视频安全**:FFmpeg 子进程退出码与 `stderr` 排空(防管道死锁)、Windows 路径与编码 (`utf-8`) 兼容、可变帧率(VFR)时间戳精准性。
55
+ - **视口与噪声鲁棒性**:静态任务栏/粘性导航栏/滚动条不污染差异得分,移动鼠标光标与时钟跳动不误触关键帧。
56
+ - **滚动与翻页完整性**:滚动采样保留安全重叠带(默认 ~30%),回滚重看时不重复输出,翻页过渡动画等待稳定后再抓最清晰帧。
57
+ - **跨边界结构保真**:跨屏断裂的段落、Markdown 表格、代码块与 `$$...$$` 公式须无缝合并,绝不拆成两个残缺块。
58
+ - **图表混合策略安全**:`bbox_norm` 坐标须严格边界裁剪 `[0, 1]`;Mermaid 语法校验失败时自动降级保留高清裁剪图,绝不丢失图表。
59
+ - **零幻觉与密钥安全**:严禁在代码、日志、测试快照中写入或打印真实 API Key;VLM 不可凭空编造屏幕未出现的正文内容。
60
+
61
+ ---
62
+
63
+ ## 5. 必读规范索引
64
+
65
+ - 核心流水线与算法规范:[docs/architecture/01-pipeline-and-algorithms.md](docs/architecture/01-pipeline-and-algorithms.md)
66
+ - IR Schema 与接口契约:[docs/architecture/02-ir-schema-contract.md](docs/architecture/02-ir-schema-contract.md)
67
+ - 3+1 多 Agent 协同手册:[docs/governance/01-multi-agent-collaboration.md](docs/governance/01-multi-agent-collaboration.md)
68
+ - 工程标准与验收门禁:[docs/governance/02-engineering-standards.md](docs/governance/02-engineering-standards.md)
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.0] - 2026-11-29
10
+
11
+ First official PyPI release, adding the zero-CLI loopback Web Studio, HEIC / 4K batch capture acceleration, and pure-offline OCR/layout Sidecar support.
12
+
13
+ ### Added
14
+
15
+ - **Zero-CLI Lightweight Web Studio (`video-scribe ui`)**: zero-dependency loopback `127.0.0.1` web UI with bilingual (`zh` / `en`) live toggle, light/dark theme, O(1) streaming drag-and-drop uploads (CJK percent-encoded filenames + duplicate disambiguation), local path mode, live progress logs, Markdown preview, header-authenticated `Blob` artifact downloads, direct `inspection_report.html` viewing, and graceful browser shutdown.
16
+ - **iPhone `.heic` / `.heif` Optional Extra & 4K Batched FFmpeg Capture**: optional `video-scribe[heic]` (`pillow-heif>=0.18`) lazy opener with thread-safe module-identity caching, plus chunked VFR FFmpeg `select` batch full-resolution frame capture (`capture_full_res_frames_batch`) with atomic replacement and automatic lossless per-frame fallback.
17
+ - **Pure-Offline OCR / Layout Sidecar Adapter (`--provider sidecar`)**: zero-CUDA/PyTorch HTTP sidecar client (`config/local_sidecar.yaml`) normalizing native IR, MinerU (`lxml.html` `colspan`/`rowspan` table parsing), and PaddleOCR-VL responses with encoded-frame `bbox_unit` alignment, `OPENAI_API_KEY` isolation, and `check-vlm --provider sidecar` health probe.
18
+ - **PyPI Trusted Publishing & Walkthrough Showcase**: OIDC `.github/workflows/release.yml` workflow for automated PyPI + GitHub Releases, plus a 32-second synthetic end-to-end walkthrough GIF in both READMEs.
19
+
20
+ ### Fixed
21
+
22
+ - Added `pythonpath = ["."]` to `[tool.pytest.ini_options]` so bare `uv run pytest` collects test fixtures reliably on clean Linux and Windows runners.
23
+ - Stripped Rich ANSI escape sequences in CLI `--help` assertions and aligned Linux CI headless Chrome flags (`--no-sandbox`) for Ubuntu 24.04 AppArmor compatibility.
24
+ - Eliminated a module import-order cycle between `video_scribe.recognition` and `video_scribe.ingest.subtitles`.
25
+
26
+ ## [0.1.0] - 2026-11-29
27
+
28
+ Initial public open-source release.
29
+
30
+ ### Added
31
+
32
+ #### Video and Photo Ingestion
33
+
34
+ - O(1)-memory FFmpeg streaming scan for arbitrary-duration recordings.
35
+ - Automatic ROI detection plus cursor and static-bar denoising.
36
+ - Page mode based on SSIM stability detection and scroll mode based on FFT phase correlation.
37
+ - Ordered photo-sequence ingest through `extract-images` and `scan-images`.
38
+ - Burst-retake deduplication with `--dedup-burst`.
39
+ - Five-gate anti-vignette perspective rectification with `--dewarp auto`.
40
+ - Screen-photo enhancement with `--enhance auto`.
41
+
42
+ #### Recognition and Stitching
43
+
44
+ - Async micro-batch VLM recognition with atomic SQLite checkpoint resume.
45
+ - Cloud OpenAI-compatible endpoints and local GPU presets (`ollama`, `lmstudio`, `vllm`, `llama_cpp`), with a `check-vlm` connectivity probe.
46
+ - Offline two-stage `scan` / `import-batches` workflow.
47
+ - Cross-page split-block and multi-page long-table healing.
48
+ - Deterministic suffix-prefix alignment for overlapping captures.
49
+ - Static LaTeX and reading-order validators.
50
+
51
+ #### Export, Inspection, and Revision Loop
52
+
53
+ - Markdown and Pandoc OMML Word (`.docx`) export, including native offline high-DPI Mermaid PNG embedding.
54
+ - Structured JSON IR plus `provenance.json` traceability.
55
+ - 100% offline bilingual (`zh` / `en`) interactive `inspection_report.html`.
56
+ - Live loopback `--serve` review sync and targeted `revise` cascade rebuild with `--plan-only`, `--apply-patch`, and `--vlm`.
57
+
58
+ #### Batch Collections and Benchmarks
59
+
60
+ - `batch-extract` mixed multi-video / multi-photo chapter merge with a unified table of contents.
61
+ - Sidecar subtitle (`.srt` / `.vtt` / Whisper JSON) and cached ASR lecturer footnotes.
62
+ - Zero-API synthetic `video-scribe benchmark` regression suite.
63
+
64
+ [Unreleased]: https://github.com/aaronley/video-scribe/compare/v0.2.0...HEAD
65
+ [0.2.0]: https://github.com/aaronley/video-scribe/compare/v0.1.0...v0.2.0
66
+ [0.1.0]: https://github.com/aaronley/video-scribe/releases/tag/v0.1.0