symphony-code 0.0.3__tar.gz → 0.0.5__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.
- {symphony_code-0.0.3 → symphony_code-0.0.5}/PKG-INFO +4 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/README.md +1 -1
- {symphony_code-0.0.3 → symphony_code-0.0.5}/pyproject.toml +3 -3
- {symphony_code-0.0.3 → symphony_code-0.0.5}/pyproject.toml.orig +3 -3
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/__init__.py +11 -0
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/addon.py +154 -0
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/capture.py +175 -0
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/kinds.py +51 -0
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/noise.py +62 -0
- symphony_code-0.0.5/src/coding_agent/addons/artifacts/store.py +212 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/jsonl.py +46 -0
- symphony_code-0.0.5/src/coding_agent/addons/skills/bundled_skills/pick-model/SKILL.md +24 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/registry.py +32 -6
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/tool.py +3 -3
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/agent.py +108 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/prompts.py +11 -10
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/README.md +69 -2
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/requests.py +33 -1
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/server.py +27 -1
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/transport.py +2 -2
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/__init__.py +3 -1
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/ask_user.py +5 -3
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/base.py +19 -7
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/bash.py +12 -11
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/generate_image.py +4 -3
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/memory.py +13 -7
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/patch.py +7 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/read_file.py +6 -4
- symphony_code-0.0.5/src/coding_agent/tools/save_artifact.py +40 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/search.py +6 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/web_search.py +5 -5
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/write_file.py +5 -2
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/app.py +20 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/chrome/__init__.py +2 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/chrome/footer.py +40 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/chrome/topbar.py +58 -5
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/events.py +48 -1
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/state.py +21 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/subagent.py +6 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/turn.py +37 -3
- symphony_code-0.0.5/src/coding_agent/tui/screens/artifacts.py +39 -0
- symphony_code-0.0.5/src/coding_agent/tui/screens/cost.py +61 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/dashboard.py +20 -4
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/history.py +28 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/labels.py +2 -1
- symphony_code-0.0.5/src/coding_agent/tui/transcript/artifact.py +42 -0
- symphony_code-0.0.5/src/coding_agent/tui/transcript/decision.py +35 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/transcript/surface.py +11 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/web/server.py +46 -6
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/web/sessions.py +5 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/LICENSE +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/_lazy.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/approvals.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/compaction/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/compaction/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/compaction/compactor.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/compaction/prompts.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/compaction/transcript.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/evaluators.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/handlers.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/policy.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/protocol.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/evaluation/state.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/langfuse/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/langfuse/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/langfuse/install.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/langfuse/serialize.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/loop.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/prompts.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/sanitize.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/learning/store.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/bridge.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/discovery.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/report.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/runtime.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/manager/tool_changes.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/active.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/artifacts.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/collection.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/compatibility.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/images.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/persistence/presentation.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/plugins/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/plugins/install.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/plugins/manager.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/plugins/models.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/args.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/addon-authoring/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/context-budget/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/orient-first/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/security-boundary/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/skill-discipline/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/surgical-edit/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/systematic-debug/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/bundled_skills/verify-before-done/SKILL.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/frontmatter.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/skills/models.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/addon.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/credentials.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/playback.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/speak.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/stream.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/addons/voice/summary.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/bench/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/bench/cli.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/bench/patch.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/cli.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/commands/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/commands/catalog.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/commands/jev_argument.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/config.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/credentials.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/personalities.json +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/config/personalities.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/acp/README.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/acp/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/acp/mapping.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/acp/server.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/acp/transport.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/catalog.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/protocols/stdio/commands.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/py.typed +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/resources/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/resources/usage.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/run/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/run/cli.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/run/detach.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/run/interrupted.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/run/log_sink.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tls.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/bash_jobs.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tools/summary.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/EFFICIENCY_PLAN.md +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/__main__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/commands/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/commands/catalog.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/commands/manager.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/input.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/slash_menu.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/surface.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/voice.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/composer/voice_mode.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/runtime/sink.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/ask.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/context.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/diff.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/extensions.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/file_selector.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/langfuse.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/learning.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/modal.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/onboard.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/resume.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/screens/update.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/theme/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/theme/load.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/theme/style.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/theme/theme.toml +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/activity.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/calls.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/code_view.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/images.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/modal.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/partial_args.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/tools/snapshots.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/transcript/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/transcript/messages.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/transcript/process.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/tui/transcript/thinking_markdown.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/updates.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/web/__init__.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/web/bundle.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/web/worker.py +0 -0
- {symphony_code-0.0.3 → symphony_code-0.0.5}/src/coding_agent/widget_fields.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: symphony-code
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: Symphony coding agent: workspace tools, JSONL sessions, and a Textual TUI on top of symphony-harness (import as coding_agent; run as `symphony`)
|
|
5
5
|
Author: Sarthak Chauhan
|
|
6
6
|
Author-email: Sarthak Chauhan <sarthakchauhann@gmail.com>
|
|
7
7
|
License-Expression: MIT
|
|
8
8
|
License-File: LICENSE
|
|
9
|
-
Requires-Dist: symphony-core
|
|
10
|
-
Requires-Dist: symphony-harness
|
|
9
|
+
Requires-Dist: symphony-core>=0.0.5
|
|
10
|
+
Requires-Dist: symphony-harness>=0.0.5
|
|
11
11
|
Requires-Dist: pillow>=12.3.0
|
|
12
12
|
Requires-Dist: pydantic>=2.0.0
|
|
13
13
|
Requires-Dist: certifi>=2024.2.2
|
|
@@ -28,7 +28,7 @@ Description-Content-Type: text/markdown
|
|
|
28
28
|
|
|
29
29
|
Run an AI coding agent in your terminal, or import the coding-agent API from the Symphony workspace. Package import name: `coding_agent`.
|
|
30
30
|
|
|
31
|
-
**Availability:** version 0.0.
|
|
31
|
+
**Availability:** version 0.0.3 is on PyPI. Version 0.0.4, including session artifacts and security updates, is being prepared.
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
34
|
python -m pip install symphony-code
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Run an AI coding agent in your terminal, or import the coding-agent API from the Symphony workspace. Package import name: `coding_agent`.
|
|
4
4
|
|
|
5
|
-
**Availability:** version 0.0.
|
|
5
|
+
**Availability:** version 0.0.3 is on PyPI. Version 0.0.4, including session artifacts and security updates, is being prepared.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
8
|
python -m pip install symphony-code
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "symphony-code"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.5"
|
|
4
4
|
description = "Symphony coding agent: workspace tools, JSONL sessions, and a Textual TUI on top of symphony-harness (import as coding_agent; run as `symphony`)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
7
7
|
license-files = ["LICENSE"]
|
|
8
8
|
requires-python = ">=3.11"
|
|
9
9
|
dependencies = [
|
|
10
|
-
"symphony-core",
|
|
11
|
-
"symphony-harness",
|
|
10
|
+
"symphony-core>=0.0.5",
|
|
11
|
+
"symphony-harness>=0.0.5",
|
|
12
12
|
"pillow>=12.3.0",
|
|
13
13
|
"pydantic>=2.0.0",
|
|
14
14
|
"certifi>=2024.2.2",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "symphony-code"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.5"
|
|
4
4
|
description = "Symphony coding agent: workspace tools, JSONL sessions, and a Textual TUI on top of symphony-harness (import as coding_agent; run as `symphony`)"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -10,8 +10,8 @@ authors = [
|
|
|
10
10
|
]
|
|
11
11
|
requires-python = ">=3.11"
|
|
12
12
|
dependencies = [
|
|
13
|
-
"symphony-core",
|
|
14
|
-
"symphony-harness",
|
|
13
|
+
"symphony-core>=0.0.5",
|
|
14
|
+
"symphony-harness>=0.0.5",
|
|
15
15
|
"pillow>=12.3.0",
|
|
16
16
|
"pydantic>=2.0.0",
|
|
17
17
|
# coding_agent.tls: stdlib HTTPS on uv-managed Pythons without a CA store.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""Session artifacts: the images, html, csv and json a run produces, stored and versioned."""
|
|
2
|
+
|
|
3
|
+
from coding_agent.addons.artifacts.addon import ARTIFACT_CREATED, ARTIFACT_UPDATED, ArtifactsAddon
|
|
4
|
+
from coding_agent.addons.artifacts.capture import ArtifactError, Snapshot, snapshot_path
|
|
5
|
+
from coding_agent.addons.artifacts.kinds import ArtifactKind
|
|
6
|
+
from coding_agent.addons.artifacts.store import ArtifactStore, Manifest, Saved
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"ARTIFACT_CREATED", "ARTIFACT_UPDATED", "ArtifactError", "ArtifactKind", "ArtifactStore",
|
|
10
|
+
"ArtifactsAddon", "Manifest", "Saved", "Snapshot", "snapshot_path",
|
|
11
|
+
]
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Capture the images, html, csv and json files a run produces as artifacts.
|
|
2
|
+
|
|
3
|
+
``on_tool`` sees every successful tool call after it ran:
|
|
4
|
+
|
|
5
|
+
- ``write_file``, ``patch`` and ``generate_image`` capture the written path
|
|
6
|
+
when its suffix is html, csv, json or an image (see ``capture``). A file
|
|
7
|
+
inside a website folder (one below the workspace with ``index.html``)
|
|
8
|
+
versions that whole site instead. A Vite, Next, or Astro project is not a
|
|
9
|
+
site: its ``index.html`` is the dev entry. Manifests, configs, lockfiles and
|
|
10
|
+
anything under node_modules, .git, dist, build, or .vite are skipped (``noise``),
|
|
11
|
+
as is a patch to an html or json file git tracks outside a website folder.
|
|
12
|
+
- ``save_artifact`` captures its path with the kind and title it was given.
|
|
13
|
+
- Any other tool except ``read_file`` captures the inline images it returned.
|
|
14
|
+
|
|
15
|
+
Each stored version is emitted through the session's harness as
|
|
16
|
+
``artifact_created`` or ``artifact_updated`` (the manifest plus the absolute
|
|
17
|
+
``path`` of its entry file), so it is journaled and reaches every host.
|
|
18
|
+
Unchanged content stores and emits nothing. Subagents inherit the add-on and
|
|
19
|
+
store into the parent session.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import asyncio
|
|
25
|
+
import logging
|
|
26
|
+
from collections.abc import Iterator, Mapping
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
from typing import Any, Optional
|
|
29
|
+
|
|
30
|
+
from core_ai.content import normalize_content
|
|
31
|
+
from core_harness import Addon, CoreHarness
|
|
32
|
+
from core_harness.models import ToolCall, ToolResult
|
|
33
|
+
|
|
34
|
+
from coding_agent.addons.artifacts.capture import (
|
|
35
|
+
SITE_ENTRY,
|
|
36
|
+
ArtifactError,
|
|
37
|
+
Snapshot,
|
|
38
|
+
snapshot_image_part,
|
|
39
|
+
snapshot_path,
|
|
40
|
+
snapshot_site,
|
|
41
|
+
)
|
|
42
|
+
from coding_agent.addons.artifacts.kinds import ArtifactKind, kind_of
|
|
43
|
+
from coding_agent.addons.artifacts.noise import git_tracked, is_app_project, is_noise
|
|
44
|
+
from coding_agent.addons.artifacts.store import ArtifactStore, Saved
|
|
45
|
+
|
|
46
|
+
ARTIFACT_CREATED = "artifact_created"
|
|
47
|
+
ARTIFACT_UPDATED = "artifact_updated"
|
|
48
|
+
PATH_TOOLS = frozenset({"write_file", "patch", "generate_image"})
|
|
49
|
+
SAVE_TOOL = "save_artifact"
|
|
50
|
+
PATCH_TOOL = "patch"
|
|
51
|
+
TRACKED_SOURCE_KINDS = frozenset({ArtifactKind.HTML, ArtifactKind.JSON})
|
|
52
|
+
# Reading an image shows an existing file; it produces nothing.
|
|
53
|
+
READ_TOOLS = frozenset({"read_file"})
|
|
54
|
+
|
|
55
|
+
logger = logging.getLogger(__name__)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def resolve(workspace: Path, raw: str) -> Path:
|
|
59
|
+
"""The path a workspace tool wrote, resolved the way ``WorkspaceTool`` does."""
|
|
60
|
+
candidate = Path(raw.strip()).expanduser()
|
|
61
|
+
return (candidate if candidate.is_absolute() else workspace / candidate).resolve()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def site_of(path: Path, workspace: Path) -> Path | None:
|
|
65
|
+
"""The nearest folder below the workspace holding ``index.html`` and ``path``.
|
|
66
|
+
|
|
67
|
+
Writing any file of a website (its index.html, css, scripts or images)
|
|
68
|
+
versions the whole site.
|
|
69
|
+
"""
|
|
70
|
+
for folder in path.parents:
|
|
71
|
+
if folder == workspace or not folder.is_relative_to(workspace):
|
|
72
|
+
return None
|
|
73
|
+
if (folder / SITE_ENTRY).is_file() and not is_app_project(folder):
|
|
74
|
+
return folder
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def artifact_frame(store: ArtifactStore, session_id: str, saved: Saved) -> tuple[str, dict[str, object]]:
|
|
79
|
+
manifest = saved.manifest
|
|
80
|
+
entry = store.folder(session_id, manifest.id) / manifest.entry
|
|
81
|
+
return (
|
|
82
|
+
ARTIFACT_CREATED if saved.created else ARTIFACT_UPDATED,
|
|
83
|
+
{**manifest.to_json(), "path": str(entry)},
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class ArtifactsAddon(Addon):
|
|
88
|
+
name = "artifacts"
|
|
89
|
+
|
|
90
|
+
def __init__(self, store: ArtifactStore, workspace: Path, owner: Optional[CoreHarness] = None) -> None:
|
|
91
|
+
self.store = store
|
|
92
|
+
self.workspace = Path(workspace).expanduser().resolve()
|
|
93
|
+
# The harness whose session keeps the artifacts: the parent for subagents.
|
|
94
|
+
self.owner = owner
|
|
95
|
+
|
|
96
|
+
def attach(self, harness: Any) -> None:
|
|
97
|
+
if self.owner is None and isinstance(harness, CoreHarness):
|
|
98
|
+
self.owner = harness
|
|
99
|
+
|
|
100
|
+
def fork_for_child(self, parent_harness: Any) -> Optional[Addon]:
|
|
101
|
+
del parent_harness
|
|
102
|
+
return ArtifactsAddon(self.store, self.workspace, self.owner)
|
|
103
|
+
|
|
104
|
+
@staticmethod
|
|
105
|
+
def tracked_edit(tool_name: str, kind: ArtifactKind, path: Path) -> bool:
|
|
106
|
+
"""A patch to a git-tracked html or json file edits source, not output."""
|
|
107
|
+
return tool_name == PATCH_TOOL and kind in TRACKED_SOURCE_KINDS and git_tracked(path)
|
|
108
|
+
|
|
109
|
+
def snapshots(self, tool_call: ToolCall, result: ToolResult) -> Iterator[Snapshot]:
|
|
110
|
+
arguments: Mapping[str, Any] = tool_call.arguments
|
|
111
|
+
raw = arguments.get("path")
|
|
112
|
+
if tool_call.name == SAVE_TOOL and isinstance(raw, str):
|
|
113
|
+
title = arguments.get("title")
|
|
114
|
+
yield snapshot_path(
|
|
115
|
+
resolve(self.workspace, raw), self.workspace,
|
|
116
|
+
ArtifactKind(str(arguments.get("kind"))), title if isinstance(title, str) else "",
|
|
117
|
+
)
|
|
118
|
+
elif tool_call.name in PATH_TOOLS and isinstance(raw, str):
|
|
119
|
+
path = resolve(self.workspace, raw)
|
|
120
|
+
if is_noise(path, self.workspace) or is_app_project(path.parent):
|
|
121
|
+
return
|
|
122
|
+
site = site_of(path, self.workspace)
|
|
123
|
+
kind = kind_of(path)
|
|
124
|
+
if site is not None:
|
|
125
|
+
yield snapshot_site(site, self.workspace)
|
|
126
|
+
elif kind is not None and not self.tracked_edit(tool_call.name, kind, path):
|
|
127
|
+
yield snapshot_path(path, self.workspace)
|
|
128
|
+
elif tool_call.name not in READ_TOOLS and not isinstance(result.content, str):
|
|
129
|
+
for index, part in enumerate(normalize_content(result.content)):
|
|
130
|
+
captured = snapshot_image_part(part, tool_call.id, index)
|
|
131
|
+
if captured is not None:
|
|
132
|
+
yield captured
|
|
133
|
+
|
|
134
|
+
async def on_tool(self, **payload: Any) -> None:
|
|
135
|
+
tool_call, result, owner = payload.get("tool_call"), payload.get("result"), self.owner
|
|
136
|
+
if not isinstance(tool_call, ToolCall) or not isinstance(result, ToolResult) or owner is None:
|
|
137
|
+
return
|
|
138
|
+
if result.status != "success" or not owner.session_id:
|
|
139
|
+
return
|
|
140
|
+
session_id = owner.session_id
|
|
141
|
+
try:
|
|
142
|
+
# Reading files and asking git happen off the event loop.
|
|
143
|
+
captures = await asyncio.to_thread(lambda: list(self.snapshots(tool_call, result)))
|
|
144
|
+
for captured in captures:
|
|
145
|
+
saved = await asyncio.to_thread(self.store.save, session_id, captured, tool_call.id)
|
|
146
|
+
if saved is not None:
|
|
147
|
+
event, body = artifact_frame(self.store, session_id, saved)
|
|
148
|
+
await owner.emit(event, body)
|
|
149
|
+
except (ArtifactError, OSError, ValueError) as exc:
|
|
150
|
+
# A file that cannot be kept must not fail the run that wrote it.
|
|
151
|
+
logger.warning("artifact capture skipped for %s: %s", tool_call.name, exc)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
__all__ = ["ARTIFACT_CREATED", "ARTIFACT_UPDATED", "ArtifactsAddon", "artifact_frame", "resolve", "site_of"]
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Turn a written path or an image result part into an artifact snapshot.
|
|
2
|
+
|
|
3
|
+
A snapshot is the complete content of one artifact version: its kind, a
|
|
4
|
+
stable source (the workspace path it came from), the entry file and every
|
|
5
|
+
file's bytes. ``ArtifactStore`` versions snapshots by sha256.
|
|
6
|
+
|
|
7
|
+
- An image (png/jpg/jpeg/webp/gif/svg), a ``.csv`` or a ``.json`` file is a
|
|
8
|
+
single-file artifact. CSV must be UTF-8 and JSON must parse.
|
|
9
|
+
- A ``.html`` file is a single-file html artifact, except ``index.html`` in a
|
|
10
|
+
folder below the workspace, which captures that whole folder (the site and
|
|
11
|
+
its assets) with ``index.html`` as the entry.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import base64
|
|
17
|
+
import binascii
|
|
18
|
+
import json
|
|
19
|
+
from collections.abc import Mapping
|
|
20
|
+
from dataclasses import dataclass
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
from core_ai.content import sniff_image_media_type
|
|
24
|
+
|
|
25
|
+
from coding_agent.addons.artifacts.kinds import IMAGE_MIME_TYPES, TEXT_MIME_TYPES, ArtifactKind, kind_of
|
|
26
|
+
from coding_agent.addons.artifacts.noise import is_app_project
|
|
27
|
+
|
|
28
|
+
MAX_FILE_BYTES = 20 * 1024 * 1024
|
|
29
|
+
MAX_SITE_FILES = 200
|
|
30
|
+
MAX_SITE_BYTES = 20 * 1024 * 1024
|
|
31
|
+
SKIPPED_DIRS = frozenset({"node_modules", "__pycache__"})
|
|
32
|
+
SITE_ENTRY = "index.html"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ArtifactError(ValueError):
|
|
36
|
+
"""The path cannot become an artifact of the requested kind."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass(frozen=True)
|
|
40
|
+
class Snapshot:
|
|
41
|
+
kind: ArtifactKind
|
|
42
|
+
source: str
|
|
43
|
+
title: str
|
|
44
|
+
entry: str
|
|
45
|
+
mime: str
|
|
46
|
+
files: tuple[tuple[str, bytes], ...]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def display_source(path: Path, workspace: Path) -> str:
|
|
50
|
+
"""The path relative to the workspace when inside it, else absolute."""
|
|
51
|
+
return path.relative_to(workspace).as_posix() if path.is_relative_to(workspace) else str(path)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _read(path: Path) -> bytes:
|
|
55
|
+
if path.is_symlink() or not path.is_file():
|
|
56
|
+
raise ArtifactError(f"not a regular file: {path}")
|
|
57
|
+
if path.stat().st_size > MAX_FILE_BYTES:
|
|
58
|
+
raise ArtifactError(f"file is over {MAX_FILE_BYTES // (1024 * 1024)} MiB: {path}")
|
|
59
|
+
return path.read_bytes()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def image_mime(payload: bytes, name: str) -> str:
|
|
63
|
+
"""png/jpg/jpeg/webp/gif/svg by suffix, else by magic bytes."""
|
|
64
|
+
suffix = Path(name).suffix.lower()
|
|
65
|
+
if suffix in IMAGE_MIME_TYPES:
|
|
66
|
+
return IMAGE_MIME_TYPES[suffix]
|
|
67
|
+
sniffed = sniff_image_media_type(payload)
|
|
68
|
+
if sniffed not in IMAGE_MIME_TYPES.values():
|
|
69
|
+
raise ArtifactError(f"not a png, jpeg, webp, gif or svg image: {name}")
|
|
70
|
+
return sniffed
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _check_text(kind: ArtifactKind, payload: bytes, name: str) -> None:
|
|
74
|
+
try:
|
|
75
|
+
text = payload.decode("utf-8")
|
|
76
|
+
if kind is ArtifactKind.JSON:
|
|
77
|
+
json.loads(text)
|
|
78
|
+
except (UnicodeDecodeError, ValueError) as exc:
|
|
79
|
+
raise ArtifactError(f"{name} is not valid {kind.value}: {exc}") from exc
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _site_files(folder: Path) -> tuple[tuple[str, bytes], ...]:
|
|
83
|
+
files: list[tuple[str, bytes]] = []
|
|
84
|
+
total = 0
|
|
85
|
+
for path in sorted(folder.rglob("*")):
|
|
86
|
+
relative = path.relative_to(folder)
|
|
87
|
+
if any(part.startswith(".") or part in SKIPPED_DIRS for part in relative.parts):
|
|
88
|
+
continue
|
|
89
|
+
if path.is_symlink() or not path.is_file():
|
|
90
|
+
continue
|
|
91
|
+
payload = _read(path)
|
|
92
|
+
total += len(payload)
|
|
93
|
+
files.append((relative.as_posix(), payload))
|
|
94
|
+
if len(files) > MAX_SITE_FILES or total > MAX_SITE_BYTES:
|
|
95
|
+
raise ArtifactError(f"site folder is too large to keep as an artifact: {folder}")
|
|
96
|
+
return tuple(files)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def snapshot_site(folder: Path, workspace: Path, title: str = "") -> Snapshot:
|
|
100
|
+
"""A website folder whose entry is ``index.html``."""
|
|
101
|
+
if not (folder / SITE_ENTRY).is_file():
|
|
102
|
+
raise ArtifactError(f"a website folder needs {SITE_ENTRY}: {folder}")
|
|
103
|
+
return Snapshot(
|
|
104
|
+
kind=ArtifactKind.HTML,
|
|
105
|
+
source=display_source(folder, workspace),
|
|
106
|
+
title=title or folder.name,
|
|
107
|
+
entry=SITE_ENTRY,
|
|
108
|
+
mime=TEXT_MIME_TYPES[ArtifactKind.HTML],
|
|
109
|
+
files=_site_files(folder),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def snapshot_path(path: Path, workspace: Path, kind: ArtifactKind | None = None, title: str = "") -> Snapshot:
|
|
114
|
+
"""Snapshot a written file or folder; ``kind`` defaults to the suffix's kind."""
|
|
115
|
+
if path.is_dir() and not path.is_symlink():
|
|
116
|
+
if kind not in (None, ArtifactKind.HTML):
|
|
117
|
+
raise ArtifactError(f"only an html artifact can be a folder: {path}")
|
|
118
|
+
return snapshot_site(path, workspace, title)
|
|
119
|
+
chosen = kind or kind_of(path)
|
|
120
|
+
if chosen is None:
|
|
121
|
+
raise ArtifactError(f"not an html, csv, json or image file: {path}")
|
|
122
|
+
if (
|
|
123
|
+
chosen is ArtifactKind.HTML
|
|
124
|
+
and path.name == SITE_ENTRY
|
|
125
|
+
and path.parent != workspace
|
|
126
|
+
and not is_app_project(path.parent)
|
|
127
|
+
):
|
|
128
|
+
return snapshot_site(path.parent, workspace, title)
|
|
129
|
+
payload = _read(path)
|
|
130
|
+
if chosen is ArtifactKind.IMAGE:
|
|
131
|
+
mime = image_mime(payload, path.name)
|
|
132
|
+
else:
|
|
133
|
+
_check_text(chosen, payload, path.name)
|
|
134
|
+
mime = TEXT_MIME_TYPES[chosen]
|
|
135
|
+
return Snapshot(
|
|
136
|
+
kind=chosen,
|
|
137
|
+
source=display_source(path, workspace),
|
|
138
|
+
title=title or path.name,
|
|
139
|
+
entry=path.name,
|
|
140
|
+
mime=mime,
|
|
141
|
+
files=((path.name, payload),),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def snapshot_image_part(part: Mapping[str, object], call_id: str, index: int) -> Snapshot | None:
|
|
146
|
+
"""An inline image a tool returned without writing a file."""
|
|
147
|
+
data = part.get("data")
|
|
148
|
+
if part.get("type") != "image" or not isinstance(data, str):
|
|
149
|
+
return None
|
|
150
|
+
try:
|
|
151
|
+
payload = base64.b64decode(data, validate=True)
|
|
152
|
+
except (binascii.Error, ValueError):
|
|
153
|
+
return None
|
|
154
|
+
filename = part.get("filename")
|
|
155
|
+
name = Path(filename).name if isinstance(filename, str) and Path(filename).name else f"image-{index + 1}"
|
|
156
|
+
try:
|
|
157
|
+
mime = image_mime(payload, name)
|
|
158
|
+
except ArtifactError:
|
|
159
|
+
return None
|
|
160
|
+
suffix = next(key for key, value in IMAGE_MIME_TYPES.items() if value == mime)
|
|
161
|
+
entry = name if Path(name).suffix.lower() in IMAGE_MIME_TYPES else f"{name}{suffix}"
|
|
162
|
+
return Snapshot(
|
|
163
|
+
kind=ArtifactKind.IMAGE,
|
|
164
|
+
source=f"{call_id}#image-{index + 1}",
|
|
165
|
+
title=name,
|
|
166
|
+
entry=entry,
|
|
167
|
+
mime=mime,
|
|
168
|
+
files=((entry, payload),),
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
__all__ = [
|
|
173
|
+
"ArtifactError", "MAX_FILE_BYTES", "MAX_SITE_BYTES", "MAX_SITE_FILES", "SITE_ENTRY", "Snapshot",
|
|
174
|
+
"display_source", "image_mime", "snapshot_image_part", "snapshot_path", "snapshot_site",
|
|
175
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""The four artifact kinds and the file suffixes that map to them."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from enum import StrEnum
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ArtifactKind(StrEnum):
|
|
10
|
+
"""What an artifact holds. Hosts pick a preview from this."""
|
|
11
|
+
|
|
12
|
+
HTML = "html"
|
|
13
|
+
CSV = "csv"
|
|
14
|
+
JSON = "json"
|
|
15
|
+
IMAGE = "image"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
IMAGE_MIME_TYPES = {
|
|
19
|
+
".png": "image/png",
|
|
20
|
+
".jpg": "image/jpeg",
|
|
21
|
+
".jpeg": "image/jpeg",
|
|
22
|
+
".webp": "image/webp",
|
|
23
|
+
".gif": "image/gif",
|
|
24
|
+
".svg": "image/svg+xml",
|
|
25
|
+
}
|
|
26
|
+
TEXT_MIME_TYPES = {
|
|
27
|
+
ArtifactKind.HTML: "text/html",
|
|
28
|
+
ArtifactKind.CSV: "text/csv",
|
|
29
|
+
ArtifactKind.JSON: "application/json",
|
|
30
|
+
}
|
|
31
|
+
SUFFIX_KINDS = {
|
|
32
|
+
".html": ArtifactKind.HTML,
|
|
33
|
+
".csv": ArtifactKind.CSV,
|
|
34
|
+
".json": ArtifactKind.JSON,
|
|
35
|
+
**{suffix: ArtifactKind.IMAGE for suffix in IMAGE_MIME_TYPES},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def kind_of(path: Path) -> ArtifactKind | None:
|
|
40
|
+
"""The kind auto-capture assigns to ``path``, or ``None`` for other files."""
|
|
41
|
+
return SUFFIX_KINDS.get(path.suffix.lower())
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def mime_of(kind: ArtifactKind, entry: Path) -> str:
|
|
45
|
+
"""The entry file's media type. An image without a known suffix is generic."""
|
|
46
|
+
if kind is ArtifactKind.IMAGE:
|
|
47
|
+
return IMAGE_MIME_TYPES.get(entry.suffix.lower(), "application/octet-stream")
|
|
48
|
+
return TEXT_MIME_TYPES[kind]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
__all__ = ["IMAGE_MIME_TYPES", "SUFFIX_KINDS", "TEXT_MIME_TYPES", "ArtifactKind", "kind_of", "mime_of"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Files that match an artifact suffix but are project plumbing, not output.
|
|
2
|
+
|
|
3
|
+
Auto-capture skips them; ``save_artifact`` still keeps any of them on request.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import fnmatch
|
|
9
|
+
import subprocess
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
# Any path through one of these folders is dependencies, VCS data or build output.
|
|
13
|
+
NOISE_DIRS = frozenset({
|
|
14
|
+
"node_modules", ".git", "dist", "build", ".vite", ".next", ".nuxt", ".output",
|
|
15
|
+
})
|
|
16
|
+
# A folder holding one of these is an application project. Its index.html is the
|
|
17
|
+
# dev server entry (Vite, Next, Astro), not a page the run produced.
|
|
18
|
+
APP_MARKERS = frozenset({
|
|
19
|
+
"package.json", "vite.config.js", "vite.config.ts", "vite.config.mjs",
|
|
20
|
+
"next.config.js", "next.config.ts", "next.config.mjs", "astro.config.mjs",
|
|
21
|
+
"astro.config.ts",
|
|
22
|
+
})
|
|
23
|
+
MANIFEST_NAMES = frozenset({"package.json", "package-lock.json", "npm-shrinkwrap.json"})
|
|
24
|
+
CONFIG_PATTERNS = ("tsconfig*.json", "*.config.json")
|
|
25
|
+
# Lockfiles of every package manager: yarn.lock, Cargo.lock, uv.lock,
|
|
26
|
+
# pnpm-lock.yaml, bun.lock(b), deno.lock, *.lock.json, ...
|
|
27
|
+
LOCK_PATTERNS = ("*.lock", "*.lockb", "*-lock.json", "*-lock.yaml", "*.lock.json", "*-lock.yml")
|
|
28
|
+
GIT_TIMEOUT_SECONDS = 5
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def is_noise(path: Path, workspace: Path) -> bool:
|
|
32
|
+
"""A manifest, config or lockfile, or anything under a noise folder."""
|
|
33
|
+
parts = path.relative_to(workspace).parts if path.is_relative_to(workspace) else path.parts
|
|
34
|
+
if any(part in NOISE_DIRS for part in parts[:-1]):
|
|
35
|
+
return True
|
|
36
|
+
name = path.name.lower()
|
|
37
|
+
if name in MANIFEST_NAMES:
|
|
38
|
+
return True
|
|
39
|
+
return any(fnmatch.fnmatchcase(name, pattern) for pattern in (*CONFIG_PATTERNS, *LOCK_PATTERNS))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def is_app_project(folder: Path) -> bool:
|
|
43
|
+
"""True when ``folder`` is a web app project rather than a generated site."""
|
|
44
|
+
return any((folder / name).is_file() for name in APP_MARKERS)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def git_tracked(path: Path) -> bool:
|
|
48
|
+
"""Whether git tracks ``path`` in the repository that contains it."""
|
|
49
|
+
try:
|
|
50
|
+
result = subprocess.run(
|
|
51
|
+
["git", "-C", str(path.parent), "ls-files", "--error-unmatch", "--", path.name],
|
|
52
|
+
capture_output=True,
|
|
53
|
+
timeout=GIT_TIMEOUT_SECONDS,
|
|
54
|
+
check=False,
|
|
55
|
+
)
|
|
56
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
57
|
+
# No git, or a hung repository: nothing proves the file is tracked.
|
|
58
|
+
return False
|
|
59
|
+
return result.returncode == 0
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
__all__ = ["APP_MARKERS", "NOISE_DIRS", "git_tracked", "is_app_project", "is_noise"]
|