Commit Graph

374 Commits

Author SHA1 Message Date
Ubuntu fe357668b4 feat(admin): system config and global executions history API
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:18:39 +00:00
Ubuntu d8513d055d feat(users): admin CRUD users API with invitation flow
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:18:11 +00:00
Ubuntu cca6564dad feat(auth): JWTManager, get_current_user, require_admin, require_project_owner decorators
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:16:23 +00:00
Ubuntu 949630100c feat(auth): rewrite auth.py with real login, invite, forgot/reset password
Replaces demo-only login with bcrypt+JWT authentication endpoints:
login, refresh, logout, me, forgot-password, reset-password, invitation,
set-password. Adds JWTManager initialization and get_current_user helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:14:24 +00:00
Ubuntu fc0dbddbdf feat(email): EmailService with ACS and dev console fallback 2026-05-16 09:11:33 +00:00
Ubuntu 84fdb4ceaa feat(auth): AuthService — bcrypt hash, invitation and reset token CRUD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:10:56 +00:00
Ubuntu 6a31af082d feat(config): JWT + ACS + admin initial vars for Phase 3
Replace old JWT_SECRET/JWT_REFRESH_SECRET scalar vars with flask-jwt-extended
compatible timedelta-based JWT_ACCESS_TOKEN_EXPIRES / JWT_REFRESH_TOKEN_EXPIRES,
and add ACS connection settings and ADMIN_EMAIL/ADMIN_PASSWORD bootstrap vars.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 09:09:18 +00:00
Ubuntu fddf2d4636 chore(deps): add flask-jwt-extended, bcrypt, azure-communication-email 2026-05-16 09:08:12 +00:00
Ubuntu 010c9c8fac feat(history): editable project name, related files downloads, fix step2 navigation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:21:20 +00:00
Ubuntu cf63bccc39 feat(api): add download endpoints for source doc, report and simulation log
Adds GET /api/graph/project/<id>/download/source, GET /api/simulation/<id>/download/report,
and GET /api/simulation/<id>/download/log with corresponding tests (5/5 passing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:18:23 +00:00
Ubuntu 123be0eea9 fix(project): expose uploaded files in project _to_dict response
Add _get_project_files classmethod that queries ProjectFileModel for
file_type=="upload" records, and wire it into _to_dict replacing the
hardcoded empty list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:15:13 +00:00
Ubuntu 0d5a2cf993 feat(api): add PATCH /api/graph/project/<id> to update project name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:14:13 +00:00
Ubuntu ca38800a53 feat(project): trigger async LLM name generation on project creation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:12:43 +00:00
Ubuntu f301eff373 feat(project): add LLM-based project name generator service
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:11:13 +00:00
Ubuntu df6c77255a fix(simulation): fix SQLite lock on Azure Files and Neo4j clone query
- Add nobrl,cache=strict,nosharesock,actimeo=30 mount options to the
  Azure Files volume so SQLite can use byte-range locking correctly over
  SMB (without nobrl, Reddit DB creation fails with 'database is locked')
- Fix _execute_neo4j_query to pass parameters as params= keyword arg
  (was parameters_= which the installed neo4j driver does not accept),
  restoring per-simulation graph isolation via clone_graph

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 22:49:38 +00:00
Ubuntu a6bf9b3891 fix(azure): fix PostgreSQL SKU format and ACR login resource group
- infra.bicep: correct SKU format from B_Standard_B1ms to Standard_B1ms
  (Azure Flexible Server uses Standard_* prefix, not B_*); update tier
  detection logic accordingly (contains '_B' -> Burstable)
- 2-build-deploy.sh: add --resource-group to az acr login to avoid
  accidentally matching an ACR with the same name in a different RG
- config.sh.example: update POSTGRES_SKU default to Standard_B1ms

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 08:17:06 +00:00
Ubuntu c032580c3b fix(azure): fix Bicep syntax errors in infra.bicep and container-app.bicep
- infra.bicep: remove escaped apostrophes from @description strings (BCP071),
  remove unsupported @sensitive() decorator (BCP057), rename output
  storageAccountName -> storageAccountNameOut to avoid collision with param,
  rename postgresAdminUser output -> postgresAdminUserOut
- container-app.bicep: remove unused fileShareName param (no-unused-params)
- 1-infra.sh: update output key storageAccountName -> storageAccountNameOut
- 2-build-deploy.sh: remove fileShareName param (no longer in container-app.bicep)

Both files now compile clean (az bicep build passes with only expected
outputs-should-not-contain-secrets warnings).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 07:47:06 +00:00
Ubuntu 9ee3dc1d59 feat(azure): allow reusing existing Storage Account via storageAccountName param
- infra.bicep: add storageAccountName param (empty = auto-generate
  '${projectName}store'); effectiveStorageAccountName var resolves the
  final name; Bicep reconciles the existing account idempotently without
  touching other file shares (caddydata, neo4jdata, etc.)
- 1-infra.sh: forward STORAGE_ACCOUNT_NAME (optional) to Bicep
- config.sh.example: document Opció A (existing account, e.g. stgraphiti16852)
  vs Opció B (new account); clarify which vars are inputs vs outputs of 1-infra.sh

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-05 07:33:30 +00:00
Ubuntu 842cf09a10 feat(azure): add PostgreSQL Flexible Server + Azure Files persistent storage
- infra.bicep: Storage Account + File Share (mirofish-uploads, 100GB SMB),
  envStorage to register share in Container Apps Env, PostgreSQL Flexible
  Server (v16, 32GB) with mirofish database and Azure-services firewall rule;
  new secure outputs: storageConnectionString, databaseUrl, storageAccountKey
- container-app.bicep: storageConnectionString/databaseUrl/storageAccountName/
  fileShareName params; volume mount at /mnt/uploads (Azure Files);
  OASIS_SIMULATION_DATA_DIR + UPLOAD_FOLDER + STORAGE_TYPE env vars set
  conditionally based on whether storage is configured
- 1-infra.sh: POSTGRES_ADMIN_PASSWORD required, register Storage/PostgreSQL
  providers, pass new Bicep params, print generated DATABASE_URL and
  STORAGE_CONNECTION_STRING for pasting into config.sh
- 2-build-deploy.sh: DATABASE_URL + STORAGE_CONNECTION_STRING required and
  forwarded to container-app.bicep
- config.sh.example: add POSTGRES_ADMIN_PASSWORD, POSTGRES_ADMIN_USER,
  POSTGRES_SKU, STORAGE_CONNECTION_STRING, STORAGE_ACCOUNT_NAME,
  FILE_SHARE_NAME, DATABASE_URL
- pyproject.toml + uv.lock: add psycopg2-binary>=2.9.9 (PostgreSQL driver)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 23:37:31 +00:00
Ubuntu e7641e9831 feat(history): enable 'Analysis Report' button in simulation history
- ProjectManager._to_dict now scans simulation state files to find
  last_simulation_id and last_report_id for each project
- HistoryDatabase: report button enabled when last_report_id or
  last_simulation_id available; goToReport looks up report by
  simulation ID if no direct report_id; report status icon reflects
  availability
- Add getReportBySimulation() to frontend report API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 23:27:10 +00:00
Ubuntu f0f8a797ef feat(step5): add 'New simulation' button to return to home
Adds a restart button in the action-bar-header of Step5Interaction
that navigates to '/' (home/project list). Translated in all 4 locales.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 23:23:22 +00:00
Ubuntu 2aa44760d1 feat(f2a-b): step02/03 UX overhaul, Azure OpenAI fix, offline report interviews
Step 02/03 UX:
- Remove duplicate simulation params (total_hours, minutes_per_round) from Fase B form
- Add following_probability + recsys_type to step 03 config panel instead
- Step 03 now read-only by default with Edit / Save toolbar toggle
- Add common.edit and log.configSaved i18n keys to all 4 locales

Backend - Azure OpenAI fix (run_parallel_simulation.py):
- create_model() now detects Azure URLs (cognitiveservices.azure.com / openai.azure.com)
  and uses ModelPlatformType.AZURE with AzureOpenAIModel, passing api_version and
  azure_deployment_name explicitly — fixes 404 "Resource not found" from camel-ai

Backend - offline report interviews (simulation_runner.py):
- interview_agents_batch() falls back to _offline_batch_interview() when OASIS env is
  closed (simulation finished), reading posts from SQLite DB instead of failing with
  "No successful interviews / check OASIS environment status"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 23:20:41 +00:00
Ubuntu 34962edc20 fix(step2): add null-guard for task_id in pollTaskUntilDone, add try/catch to confirmDeleteAgent 2026-05-03 22:20:26 +00:00
Ubuntu c7bc4d5ad0 feat(step2/step3): add Fase A agent edit/delete/regen modal, Fase B config form, and Step3 enable_graph_memory_update checkbox
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 22:17:05 +00:00
Ubuntu 9b69c55842 feat(i18n): add F2-A+B translation keys for en and zh
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 22:12:10 +00:00
Ubuntu 1a5ea5a470 feat(frontend-api): add 7 new simulation API calls for F2-A+B
Adds patchAgent, deleteAgent, createAgent, regenerateAgent, generateConfig,
patchSimulationConfig, and cloneSimulation to the simulation API client.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 22:11:45 +00:00
Ubuntu 5ec98a3e0e fix(graph): use get_running_loop() in _execute_neo4j_query, unify delete_graph to single async-backed method 2026-05-03 22:10:14 +00:00
Ubuntu 0343cad632 feat(simulation): clone graph on start for per-simulation isolation, use graph_id_simulation in report
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 22:06:27 +00:00
Ubuntu 6ea83f31a4 feat(graph): add clone_graph and delete_graph to GraphitiBackend via APOC
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 22:05:19 +00:00
Ubuntu 594144e195 fix(simulation): move regenerate_agent validation to request handler (404/400 before task creation) 2026-05-03 22:02:56 +00:00
Ubuntu 5d679024c3 feat(simulation): add POST /agent create and /agent/{id}/regenerate endpoints
Implements Tasks 8 and 9 of F2-A+B: async agent creation from entity UUID
and async per-agent profile regeneration, both with atomic profile file writes.
Refactors generate_profile_from_entity to accept extra_instructions instead
of requiring user_id (renamed internal logic to _generate_single_profile).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:59:25 +00:00
Ubuntu 306414a555 fix(simulation): add int coercion and 400 validation for max_agents in prepare endpoint 2026-05-03 21:56:03 +00:00
Ubuntu ef46ba1743 feat(simulation): add max_agents selector via top-N connectivity in prepare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:54:34 +00:00
Ubuntu a74c0975fe fix(simulation): fix clone 400→404 for not found, remove redundant makedirs, hoist uuid import
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:52:35 +00:00
Ubuntu a6b4ccca3c feat(simulation): add POST /<simulation_id>/clone endpoint (Task 6)
Implements SimulationManager.clone_simulation() and the corresponding
Flask route. The clone copies reddit_profiles.json, twitter_profiles.csv
and agent_profiles.json from the source simulation; does not copy
simulation_config.json; sets status=PROFILES_READY and records
parent_simulation_id. All 3 tests in test_simulation_clone.py pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:48:57 +00:00
Ubuntu ed71afe442 fix(simulation): add FileNotFoundError check in delete_agent_profile and endpoint 2026-05-03 21:44:55 +00:00
Ubuntu 83cf890c83 feat(simulation): add DELETE agent, POST generate-config, PATCH config endpoints
- DELETE /<sim_id>/agent/<user_id>: removes agent from reddit_profiles.json (atomic write, guards against running/completed status)
- POST /<sim_id>/generate-config: transitions profiles_ready→configuring→ready, runs LLM config generation in background thread, returns task_id
- PATCH /<sim_id>/config: merges time/platform config fields into simulation_config.json (atomic write)
- Corresponding SimulationManager methods: delete_agent_profile(), patch_simulation_config()
- 7 tests all passing (3 original + 4 new)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:43:02 +00:00
Ubuntu c0356e706a fix(simulation): catch FileNotFoundError in patch_agent endpoint (return 404 not 500) 2026-05-03 21:40:16 +00:00
Ubuntu f7dd353a31 feat(simulation): add PATCH /simulation/{id}/agent/{user_id} endpoint
Implements atomic agent profile editing with manually_edited flag.
Blocks edits when simulation is running or completed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 21:37:19 +00:00
Ubuntu 8a0854ceba feat(simulation): add profiles_ready/configuring states and parent_simulation_id/graph_id_simulation fields 2026-05-03 21:33:14 +00:00
Ubuntu 65554bcd50 docs(plan): add F2-A+B implementation plan — agent editing, simulation params, graph isolation 2026-05-03 21:25:33 +00:00
Ubuntu 27cef87e65 docs(spec): add graph_id_simulation cleanup on simulation delete
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 20:38:43 +00:00
Ubuntu bb80ec115a docs(spec): fix F2-A graph isolation — ReportAgent queries graph_id_simulation only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 20:38:20 +00:00
Ubuntu a1862c1c86 docs(spec): update F2-A spec — add agent creation/deletion and graph isolation (ex F2-D)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 20:32:33 +00:00
Ubuntu 26f0b72b3c docs(spec): add F2-A design spec for agent edit, regen and clone
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 20:12:10 +00:00
Ubuntu 607a2640e1 feat(history): use listProjects API for project recovery in home page
Replace getSimulationHistory (simulation API) with listProjects (graph API)
and adapt all template references from simulation_id/report_id fields to
project_id/graph_id fields matching the new project data model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 01:31:53 +00:00
Ubuntu 1eae54346f feat(frontend-api): add listProjects() to graph API client 2026-05-03 01:30:11 +00:00
Ubuntu 17a547e9f0 test(graph-api): add integration tests for project CRUD endpoints
8 tests covering list, get, create, delete, and reset endpoints via
Flask test client with in-memory SQLite and mocked storage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 01:29:12 +00:00
Ubuntu 83b69dfd87 fix(graph-api): fix build_graph endpoint for dict-based ProjectManager
Convert all project.attribute accesses to project["key"]/project.get("key"),
use save_project({...}) dict calls, and wire save_graph_record/complete_graph_record
helpers for proper graph persistence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 01:24:56 +00:00
Ubuntu 5d6d4d787a fix(graph-api): cleanup orphan project on ontology generation failure
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 01:23:15 +00:00