Commit Graph

54 Commits

Author SHA1 Message Date
gilesb
0ead728fde Fix dag_elements undefined in run detail template
Add dag_elements to the get_run endpoint render call to match
what the detail.html template expects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:15:52 +00:00
gilesb
f7dbb952ab Preserve recipe name in run service and templates
- Pass recipe_name through create_run to display friendly names
- Update templates to show name instead of hash
- Fall back to truncated hash if no name available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:09:33 +00:00
gilesb
e59a50c000 Add S-expression recipe support
- Add format detection that correctly handles ; comments
- Import artdag.sexp parser/compiler with YAML fallback
- Add execute_step_sexp and run_plan_sexp Celery tasks
- Update recipe upload to handle both S-expr and YAML formats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 23:08:53 +00:00
gilesb
9df78f771d Fix run detail: add username, total_steps, recipe_name
- Extract username from actor_id format (@user@server)
- Set total_steps and executed from recipe nodes
- Use recipe name for display instead of hash

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:23:08 +00:00
gilesb
9a8e26e79c Compute step_count in recipe service
Check multiple locations for nodes (nodes, dag.nodes, pipeline, steps)
and compute step_count for display in recipe list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:09:34 +00:00
gilesb
145c69f21b Add artifacts to run detail view
Build artifacts list from run output_hash and detect media type
for display in the artifacts tab.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:08:06 +00:00
gilesb
ccf28bd351 Load recipe to show plan in run detail view
When viewing a run, try to load the recipe by hash to display
the plan/steps in the UI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:05:41 +00:00
gilesb
50ea0f1491 Fix run detail: default to JSON, only HTML if browser requests it
API clients like Python requests send Accept: */* which wasn't
matching wants_json(). Switch to checking wants_html() instead
so API clients get JSON by default.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:03:53 +00:00
gilesb
95ffe9fa69 Fix run detail page and recipe name
- Render HTML template for run detail (not just JSON)
- Get recipe name from pending_runs instead of hardcoding "dag"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 21:56:08 +00:00
gilesb
aacf1ceb77 Add error logging for pending run creation 2026-01-11 21:45:29 +00:00
gilesb
59de1cf6b5 Add _ensure_inputs_list to handle legacy Redis data format
Inputs stored in old Redis format are JSON strings - this helper
ensures they're always returned as lists regardless of source.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 21:27:49 +00:00
gilesb
cca8f74d3c Add debug logging for recipe node structure 2026-01-11 21:24:17 +00:00
gilesb
8ab0f05a7d Add durable pending runs and recipe list debugging
- Store pending runs in PostgreSQL for durability across restarts
- Add recovery method for orphaned runs
- Increase Celery result_expires to 7 days
- Add task_reject_on_worker_lost for automatic re-queuing
- Add logging to recipe list to debug filter issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 20:35:00 +00:00
gilesb
a6dd470623 Fix recipe steps display and DAG visualization
- Check multiple locations for nodes: dag.nodes, recipe.nodes, pipeline, steps
- Add dagre layout libraries for cytoscape DAG visualization
- Fix inputs parsing when stored as JSON string in Redis

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 20:21:24 +00:00
gilesb
209d416442 Fix running runs not appearing in UI list
- Normalize Celery status names (started -> running)
- Store full run metadata in Redis for pending runs (recipe, inputs, actor_id)
- Filter pending runs by actor_id so users only see their own
- Parse both old and new Redis task data formats for compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 20:15:41 +00:00
gilesb
ab2f65e14d Add client download link and build tarball during deployment
- Added /download/client endpoint to serve the CLI client tarball
- Added "Client" link to navigation in base template
- Created build-client.sh script to clone and package the client
- Updated Dockerfile to run build-client.sh during container build

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 19:08:55 +00:00
gilesb
0ddeb5ba94 Resolve registry asset/effect references when running recipes
SOURCE nodes with config.asset now get content_hash from registry.
EFFECT nodes with config.effect now get effect_hash from registry.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:22:36 +00:00
gilesb
156014a1f3 Add Share to L2 buttons for media, recipes, and runs
- Updated cache detail button from "Publish to IPFS" to "Share to L2"
- Added Share to L2 button on recipe detail page
- Added Share to L2 button on run detail page
- Created /recipes/{id}/publish endpoint
- Created /runs/{id}/publish endpoint (publishes run output)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:21:14 +00:00
gilesb
088af1611b Transform recipe DAG format to artdag library format
The recipe YAML uses:
- type, id, output

But artdag library expects:
- node_type, node_id, output_id, metadata

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:14:44 +00:00
gilesb
3acaacce1f Fix recipe detail to display DAG nodes as steps
The template expects recipe.steps and recipe.yaml but the recipe
data has dag.nodes. Convert nodes (list or dict) to steps format
and add YAML dump for source display.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:12:08 +00:00
gilesb
e806337503 Remove unnecessary redirect routes, fix template links
- Removed /run/{id} and /recipe/{id} redirect routes
- Updated templates to use /runs/ and /recipes/ paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:05:24 +00:00
gilesb
6c73a06539 Fix redirect handlers to pass dependencies explicitly
The /run/{id} and /recipe/{id} redirects were calling route handlers
directly without passing the required service dependencies.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:02:24 +00:00
gilesb
970faa3fa0 Fix run recipe: optional fields in RunStatus, list->dict nodes
- Made recipe and inputs optional in RunStatus model
- Convert DAG nodes from list format to dict format when running recipes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:50:36 +00:00
gilesb
b57745098e Fix run_recipe to handle dict return from create_run
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:43:31 +00:00
gilesb
2e9ba46f19 Use UserContext from artdag_common, remove duplicate
- Updated requirements.txt to use art-common@11aa056 with l2_server field
- All routers now import UserContext from artdag_common
- Removed duplicate UserContext from auth_service.py
- dependencies.py sets l2_server from settings on user context

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:38:02 +00:00
gilesb
9e3c4c9d78 Add l2_server to UserContext
Fixes AttributeError when running recipes - the UserContext was
missing the l2_server field that run_service expects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:28:40 +00:00
gilesb
3373be285e Fix recipe list links and home page recipe count
- Template used recipe.id but service returns recipe.recipe_id
- Add recipe count to home page stats

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:26:00 +00:00
gilesb
a6fe88c277 Fix recipe upload to accept file uploads instead of JSON
The CLI client sends multipart file uploads but the server expected JSON.
Changed the /recipes/upload endpoint to accept UploadFile and return
the additional fields (name, version, variable_inputs, fixed_inputs)
that the client expects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:13:06 +00:00
gilesb
697fa7c64d Show actual media count on home page 2026-01-11 16:55:14 +00:00
gilesb
f6a7e0852c Fix cache detail template field names 2026-01-11 16:53:48 +00:00
gilesb
921d81421a Fix cache method name: get_content_path -> get_by_content_hash
The L1CacheManager uses get_by_content_hash not get_content_path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:36:29 +00:00
gilesb
27cbb0a85c Store MIME type in database during upload
Detect actual MIME type from file content and store it instead of
generic "media" type. This enables proper media categorization
and filtering in the UI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:18:56 +00:00
gilesb
9c148f535d Fix media list template field names
- Use content_hash instead of hash
- Use type instead of media_type
- Show filename instead of size_bytes
- Detect media type from both type field and filename extension

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:18:09 +00:00
giles
e8501de466 Fix list_media to use get_user_items instead of list_cache_items
list_cache_items doesn't accept actor_id parameter.
Use get_user_items which properly filters by actor_id and item_type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:10:49 +00:00
giles
854396680f Refactor storage: remove Redis duplication, use proper data tiers
- Recipes: Now content-addressed only (cache + IPFS), removed Redis storage
- Runs: Completed runs stored in PostgreSQL, Redis only for task_id mapping
- Add list_runs_by_actor() to database.py for paginated run queries
- Add list_by_type() to cache_manager for filtering by node_type
- Fix upload endpoint to return size and filename fields
- Fix recipe run endpoint with proper DAG input binding
- Fix get_run_service() dependency to pass database module

Storage architecture:
- Redis: Ephemeral only (sessions, task mappings with TTL)
- PostgreSQL: Permanent records (completed runs, metadata)
- Cache: Content-addressed files (recipes, media, outputs)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 14:05:31 +00:00
giles
8591faf0fc Fix CacheService list_media and recipe inputs type
- Add list_media method to CacheService
- Change recipe run inputs from List to dict

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:28:27 +00:00
giles
4f011a66ff Fix recipe run endpoint to accept JSON body
Use Pydantic model for inputs parameter.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:22:13 +00:00
giles
b47417704e Fix /media route by mounting cache router directly
Avoids Depends() resolution issues with manual function calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:21:26 +00:00
giles
3f77c24699 Enable markdown tables and fenced_code extensions
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:20:48 +00:00
giles
ada51c0880 Add 404 handler and template
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:14:29 +00:00
giles
e7e95b7857 Fix Request type hints in redirect handlers
FastAPI requires type hints to recognize Request objects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 13:11:36 +00:00
giles
f0db4f4ea6 Restore home page with README display
Instead of redirecting to /runs, show the home page with stats and README.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:54:50 +00:00
giles
a34fff3aaa Add database init/close lifecycle events to app startup
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:52:29 +00:00
giles
b372d02df2 Fix list_recipes to use offset parameter
Match the router's expected signature and return type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:43:54 +00:00
giles
d19d6d6e42 Fix RecipeService initialization with cache manager
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:34:39 +00:00
giles
eed4596af8 Update base.html to extend _base.html
Matches renamed template in artdag-common package.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:28:26 +00:00
giles
83cce09b1a Fix list_runs to use offset parameter
Match the router's expected signature and return type.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:22:59 +00:00
giles
29da91e01a Refactor to modular app factory architecture
- Replace 6847-line monolithic server.py with 26-line entry point
- All routes now in app/routers/ using Jinja2 templates
- Add plan_node.html template for step details
- Add plan node route to runs router with cache_id lookup
- Backup old server as server_legacy.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 11:48:24 +00:00
giles
1869a76157 Fix CACHE_DIR default path mismatch across files
Changed default from /data/cache to ~/.artdag/cache for local runs.
Docker sets CACHE_DIR=/data/cache via environment variable.

Files updated:
- tasks/analyze.py
- tasks/orchestrate.py
- app/config.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:14:39 +00:00
giles
945fb3b413 Fix analysis display for recipe-based runs
Add get_run_analysis() to RunService to load per-input analysis from
CACHE_DIR/analysis/{hash}.json files. Update runs router and template
to display tempo, beats, energy, and beat timeline visualization.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 08:05:40 +00:00