Commit graph

141 commits

Author SHA1 Message Date
Ashwin Kumar Sivakumar
4e3180745f docs: add Ask Ash billing architecture and implementation plan docs
All checks were successful
build-and-release / build (push) Successful in 4m23s
2026-08-15 22:32:13 +05:30
Tracewebstudio Dev
964b8d7ec4 docs: mark ai-assistant service as deprecated, not in live path
All checks were successful
build-and-release / build (push) Successful in 3m31s
The production frontend calls backend-rust/apps/users/src/handlers/ai.rs
directly. This service is an orphaned parallel build. Added a prominent
banner in main.rs pointing devs to the correct extension points.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-14 18:06:12 +02:00
Ashwin Kumar Sivakumar
23a707e175 Fix security audit findings: IDOR, rate limiting, action audit trail
All checks were successful
build-and-release / build (push) Successful in 4m14s
- Chat and ticket-creation endpoints now scope lookups/attribution to
  the authenticated JWT identity instead of trusting a client-supplied
  user_id in the request body (IDOR)
- Add per-user in-memory rate limiter on AI-generation endpoints to
  guard against unbounded LLM-cost abuse
- Bind confirm_action to the authenticated user for audit logging
- Bump vulnerable transitive dependencies via cargo update

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 17:32:01 +05:30
Ashwin Kumar Sivakumar
6f67864390 chore: trigger build after registry-cleanup fix
All checks were successful
build-and-release / build (push) Successful in 3m13s
2026-07-19 18:16:14 +05:30
Ashwin Kumar Sivakumar
114626e169 feat: look up records by human-readable reference number in chat
All checks were successful
build-and-release / build (push) Successful in 3m26s
Adds a ReferenceLookupProvider that calls the backend's new
GET /api/support/reference/{number} endpoint, and wires intent detection
so a customer mentioning a reference number like NXT-VER-26-000042 gets
that record's status looked up and summarized directly in chat.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-19 16:36:44 +05:30
Ashwin Kumar Sivakumar
fef82cb92d fix(ci): sort registry prune by real image build time, protect current SHA
All checks were successful
build-and-release / build (push) Successful in 9s
Same fix as nxtgauge-frontend-solid and nxtgauge-admin-solid: this
script isn't currently wired into this repo's build.yaml, but it's
identical to the version that deleted frontend-solid's just-built image
seconds after pushing it (sorted candidates by request time instead of
actual build time). Fixing it here too so it's safe if/when it gets
wired up, rather than leaving a dormant copy of the same bug.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 05:37:58 +05:30
Ashwin Kumar Sivakumar
23aca4ed65 fix(ci): compare staged vs HEAD when deciding to commit gitops update
All checks were successful
build-and-release / build (push) Successful in 8s
git diff --quiet (no --cached) compares the working tree to the index,
not the index to HEAD. It ran right after git add, at which point the
working tree always matches the index - so it reported "no changes"
unconditionally, on every single run, regardless of whether the sed
substitution actually changed anything relative to HEAD. This silently
skipped the gitops commit+push every time (job still exited 0), which
is why the deployed digest never advanced across ~15 build runs.
Switched to git diff --cached --quiet, and added step-by-step echo
diagnostics so a future silent failure is visible in the run log
instead of just vanishing between two log lines.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 04:59:56 +05:30
Ashwin Kumar Sivakumar
37af327fa1 fix(ci): match digest-pinned image format when updating gitops
All checks were successful
build-and-release / build (push) Successful in 3m21s
The gitops-update sed only matched the old tag-based image reference
(image: ...:SHA). After the digest-pinning fix in nxtgauge-gitops
(release-patch.yaml now uses @sha256:... to stop Flux's
ImageUpdateAutomation from racing this file), the regex silently
matched nothing, git diff showed no change, and every build since
has skipped deploying - the cluster stayed on an old digest despite
CI reporting success. Now captures the pushed image's digest via
buildx's --metadata-file and writes @sha256:<digest> directly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-17 04:49:58 +05:30
Tracewebstudio Dev
60d9c28b64 fix: use configured model for all LiteLLM completions
All checks were successful
build-and-release / build (push) Successful in 3m38s
complete_as and complete_as_user were passing internal logical model names
(jd-generator, profile-writer, etc.) directly to LiteLLM, which only
knows the configured model alias (askash-main). Route all completions
through self.model so LiteLLM can resolve the correct backend model.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-17 00:48:19 +02:00
Ashwin Kumar Sivakumar
ed6a094003 fix(ci): clone gitops repo with an explicit branch, not via HEAD resolution
All checks were successful
build-and-release / build (push) Successful in 17s
Third failure: ashwin/nxtgauge-gitops's server-side HEAD symref is broken
("remote HEAD refers to nonexistent ref" on plain clone, even though
refs/heads/main exists via the API) - a Forgejo-level repo quirk, not
something to fix here. backend-rust's workflow survives this by accident
(it does an explicit git checkout after cloning); clone with -b main
directly instead of relying on HEAD resolution at all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 23:56:05 +05:30
Ashwin Kumar Sivakumar
1a73e6ac04 fix(ci): push to the ashwin/ registry namespace, not the nonexistent nxtgauge org
Some checks failed
build-and-release / build (push) Failing after 18s
Second failure: pushing to ci.nxtgauge.com/nxtgauge/nxtgauge-ai-assistant
404'd because no "nxtgauge" org exists on this Forgejo instance. The image
this app actually runs (verified against the live k8s deployment) lives
under ci.nxtgauge.com/ashwin/nxtgauge-ai-assistant, and the real GitOps
target is apps/nxtgauge-ai-assistant/overlays/prod/release-patch.yaml in
ashwin/nxtgauge-gitops (which Flux's image-automation-controller also
tracks via its $imagepolicy marker), not base/deployment.yaml.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 23:47:59 +05:30
Ashwin Kumar Sivakumar
32e071ee8b fix(ci): resolve dind daemon's actual gateway IP instead of 127.0.0.1
Some checks failed
build-and-release / build (push) Failing after 3m15s
First real run after fixing the registry/secrets config failed immediately
with "Cannot connect to the Docker daemon at tcp://127.0.0.1:2375" - the
job container is nested inside the runner pod's dind sidecar, so its own
loopback isn't the sidecar's. Port the gateway-detection step already
working in nxtgauge-backend-rust's workflow.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 22:01:25 +05:30
Ashwin Kumar Sivakumar
4becb73ab0 fix(ci): push image to Forgejo registry and update GitOps repo over HTTPS
Some checks failed
build-and-release / build (push) Failing after 1m5s
The GitOps step relied on GITEOPS_REPO/GITEOPS_SSH_KEY secrets that were
never configured, and the registry login used a REGISTRY_HOSTPORT secret
that doesn't match this repo's actual registry setup. Switch to the
Forgejo registry directly and push the GitOps update over HTTPS with a
token, matching how other services in this org already deploy.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 20:33:14 +05:30
Ashwin Kumar Sivakumar
526e12ac12 Resolve per-account LiteLLM key instead of always using the shared master key
Some checks are pending
build-and-release / build (push) Waiting to run
Adds UserKeyClient, which fetches (and caches) an account's LiteLLM virtual
key from the users service's internal endpoint. AiProvider gains
complete_as_user(), and LiteLLMProvider resolves the caller's key when
available, falling back to the master key otherwise so existing behavior
is unchanged where no per-account key is wired up yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 20:29:11 +05:30
Ashwin Kumar Sivakumar
520806cb08 chore: trigger build
Some checks failed
build-and-release / build (push) Failing after 1m15s
2026-07-06 04:42:22 +05:30
Ashwin Kumar Sivakumar
709cc1024b ci: remove GitHub Actions workflow - using Forgejo CI exclusively
Some checks failed
build-and-release / build (push) Failing after 1m4s
- Remove build-and-deploy-forgejo.yml from GitHub Actions
- Forgejo CI at ci.nxtgauge.com now handles all builds and deployments
- All images pushed to Forgejo registry (ci.nxtgauge.com/ashwin/*)
2026-07-06 04:19:48 +05:30
Ashwin Kumar Sivakumar
8f20efae1f fix(ci): switch from GHCR to Forgejo registry
Some checks failed
build-and-release / build (push) Failing after 1m4s
- Update workflow to push to ci.nxtgauge.com/ashwin/nxtgauge-ai-assistant
- Use FORGEJO_USERNAME and FORGEJO_TOKEN secrets
- Fix gitops repo cloning to use x-access-token
2026-07-06 03:52:35 +05:30
Ashwin Kumar Sivakumar
2402b1f7e4 fix(ci): use runner docker host
Some checks failed
build-and-release / build (push) Failing after 1m10s
2026-07-05 22:25:37 +05:30
Ashwin Kumar Sivakumar
366b6b878a ci: sync GitHub pushes to Forgejo
Some checks failed
build-and-release / build (push) Failing after 0s
2026-07-03 18:59:01 +05:30
Ashwin Kumar Sivakumar
2355788106 Fix panic on every authenticated request: jsonwebtoken missing crypto backend
Some checks failed
build-and-release / build (push) Failing after 0s
jsonwebtoken v10's default features are just use_pem - neither of its
crypto backend features (rust_crypto/aws_lc_rs) is enabled by default,
so decode::<Claims>() panicked on every real bearer token (not caught
by earlier testing, which only exercised the no-token 401 path).
backend-rust's own crates already enable rust_crypto for the same
crate; matches that here.
2026-07-02 22:27:03 +05:30
Ashwin Kumar Sivakumar
f0fbb15e54 Route through LiteLLM's task-specific models and implement missing Ask Ash features
Wires up 8 previously missing/stub Ask Ash capabilities: resume
improvement, job post improvement, professional/jobseeker/company
profile improvement, service description generation, KB
article/notification writing, admin support ticket summarization, and
lead/credit guidance. Also upgrades explain_plan_limits and
check_ai_pack_balance from static canned strings to real generated
answers.

Adds AiProvider::complete_as(model, ...) so callers can target
specific LiteLLM model aliases (jd-generator, profile-writer,
service-writer, support-drafter, decision-support, askash-main/fast)
that were already defined in apps/litellm/base/configmap.yaml but
never actually used by ai-assistant, since it wasn't even configured
to use the litellm provider (defaulted to plain Ollama with the tiny
gemma3:270m model for every task, with no LLM_PROVIDER/LITELLM_* env
vars set in the deployment).

New content_tools module holds the shared generation logic; new
routes registered for each feature; KB content generation and support
ticket summarization are gated to ADMIN/EMPLOYEE roles via JWT claims.
Registry gains 4 new ActionDefinitions (improve_job_post,
generate_kb_content, lead_credit_guidance, ai_auto_apply_status) to
match the existing registry pattern.
2026-07-02 18:48:43 +05:30
Ashwin Kumar Sivakumar
6decf8dce2 Fix panic-on-missing-env in auth middleware and ticket provider
require_auth and NxtgaugeTicketProvider::create_ticket both called
env::var(...).expect(...) on every request, crashing instead of
returning a proper error when JWT_SECRET/AI_SERVICE_KEY were unset.
Both are now loaded once into AppConfig at startup and checked with
a graceful 401/500 response.
2026-07-02 18:31:35 +05:30
Tracewebstudio Dev
2e0b986e20 feat: JWT auth middleware, env-var CORS origins, real user_id in confirm_action
- Add src/auth.rs with require_auth middleware extracting user_id from Bearer token
- Wire auth middleware onto all /api/* routes
- Replace CorsLayer::permissive() with env-driven FRONTEND_URL/ADMIN_URL origins
- Pass real auth_user.user_id to confirm_action instead of conversation_id

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-02 13:51:41 +02:00
Ashwin Kumar Sivakumar
e33ed2192c Update workflows and source files 2026-07-02 06:51:03 +05:30
Ashwin Kumar Sivakumar
d66ef693e5 fix(ci): isolate gitops checkout dir 2026-06-16 03:29:00 +05:30
Ashwin Kumar Sivakumar
d132f957b4 fix(ci): retry gitops sync pushes 2026-06-16 01:26:32 +05:30
Ashwin Kumar Sivakumar
91d91481c8 fix(ci): run ai assistant deploys on self-hosted runners 2026-06-16 00:50:02 +05:30
Tracewebstudio Dev
4505d8987e feat: add Ask Ash AI assistant implementation
- Add LiteLLM provider with LLM_PROVIDER env var support
- Add Fake LLM provider for testing
- Add action registry with 17 AI actions
- Add permission checker with role verification
- Add UI events in chat responses (fill_form, open_preview, etc)
- Add versioned prompt files system
- Add confirm action endpoint
- Add 80 unit tests

New endpoints:
- POST /api/ai/actions/confirm

New files:
- src/handlers/actions.rs
- src/handlers/confirm_action.rs
- src/services/action_confirmation.rs
- src/prompts.rs
- src/tests.rs
- prompts/v1/*.txt
2026-06-14 20:28:17 +02:00
Ashwin Kumar Sivakumar
510195ae24 fix(ci): deploy via gitops from github actions 2026-06-14 23:06:22 +05:30
Tracewebstudio Dev
89e4809f0b feat: add permission checker module
Checks:
- User is logged in
- Role is allowed for action
- Verification status
- Account status

Includes unit tests.
2026-06-14 19:29:09 +02:00
Ashwin Kumar Sivakumar
eaec788b2f fix(ci): use lowercase ghcr image names 2026-06-14 22:58:24 +05:30
Tracewebstudio Dev
fced248dfc feat: add action registry with code-based action definitions
Includes 17 actions with:
- Allowed roles
- Required/optional fields
- AI action costs
- Backend handlers
- Confirmation requirements
2026-06-14 19:28:12 +02:00
Tracewebstudio Dev
e947e248e2 feat: add fake LLM provider for testing
Set LLM_PROVIDER=fake to use mock responses without calling real LLM.
Useful for API flow tests, action engine tests, UI event tests.
2026-06-14 19:24:10 +02:00
Ashwin Kumar Sivakumar
1a2781a85f ci: deploy ai assistant via github actions and ghcr 2026-06-14 22:52:50 +05:30
Tracewebstudio Dev
7d31d1a2bd feat: add LiteLLM provider and cover letter generation
- Add LiteLLM provider implementing AiProvider trait
- Support both Ollama and LiteLLM via LLM_PROVIDER env var
- Add cover letter generation endpoint
- Improve chat orchestrator with better intent detection
- Add search_kb, explain_plan_limits, check_ai_pack_balance intents
- Add LiteLLM config env vars
2026-06-14 18:00:33 +02:00
Ashwin Kumar Sivakumar
0be8bd65b5 fix(ci): deploy ai assistant via immutable gitops release 2026-06-14 05:52:49 +05:30
Ashwin Kumar Sivakumar
e5733a147b chore: rebuild all 2026-06-13 20:37:33 +05:30
Ashwin Kumar Sivakumar
983b766c07 fix: move cleanup to post-build job, keep 2 SHA tags 2026-06-12 04:20:52 +05:30
Ashwin Kumar Sivakumar
3866c66e5f fix: remove push preflight from forgejo mirror sync 2026-06-11 19:29:41 +05:30
Ashwin Kumar Sivakumar
3ccbdfb322 fix: trigger forgejo mirror sync via api 2026-06-11 19:14:46 +05:30
Ashwin Kumar Sivakumar
2f999dfe95 fix: use basic auth for forgejo sync 2026-06-11 18:56:39 +05:30
Ashwin Kumar Sivakumar
2c25a16402 fix: use existing forgejo mirror secrets 2026-06-11 18:19:10 +05:30
Ashwin Kumar Sivakumar
7407d6371e fix: point forgejo sync to ashwin namespace 2026-06-11 18:00:03 +05:30
Ashwin Kumar Sivakumar
4f7f475979 chore: align forgejo ci and main deployment 2026-06-11 17:17:42 +05:30
Tracewebstudio Dev
2876b45568 chore: trigger gitea pipeline 2026-05-05 20:27:09 +02:00
Tracewebstudio Dev
88427c715e chore: force rebuild to restore image tags after prune 2026-05-01 19:20:06 +02:00
Tracewebstudio Dev
b3729541f9 ci: skip gitops update if GITEOPS_REPO secret not set 2026-05-01 18:45:53 +02:00
Tracewebstudio Dev
86a2f15b0a chore: force rebuild to restore image tags after prune 2026-05-01 18:40:10 +02:00
Tracewebstudio Dev
a27301fe36 ci: update gitops with new SHA on each build (auto-deploy) 2026-05-01 11:04:27 +02:00
Tracewebstudio Dev
6e0339e6a1 ci: add post-push registry prune (keep latest 1 SHA build) 2026-05-01 10:10:33 +02:00