Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 68 additions & 8 deletions .agents/skills/testing-jada-nextcloud/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Guide for E2E testing the Jada AI native Nextcloud app on the live deployment.
## Devin Secrets Needed

- `NEXTCLOUD_APP_PASSWORD` — Nextcloud admin app password for API auth
- SSH key file at `~/attachments/.../id_rsa` — provided per-session by user for server access to 83.228.213.100
- SSH key at `~/.ssh/nc_rsa` — for server access to 83.228.213.100 (user: `ubuntu`, passwordless sudo)

## Infrastructure

Expand All @@ -16,6 +16,7 @@ Guide for E2E testing the Jada AI native Nextcloud app on the live deployment.
| External Hermes API | https://jada-api.garzaos.online | On 187.77.25.131 — may have STALE config; the Nextcloud app uses the LOCAL backend |
| Telegram bot | Container `jada-telegram-bot` on 83.228.213.100 | Token changes frequently — check with user |
| Conversations on disk | `/data/conversations.json` inside `hermes-backend` container | File-based persistence with 2s debounce |
| Nextcloud container | `nextcloud-aio-nextcloud` on 83.228.213.100 | PHP app at `/var/www/html/custom_apps/jadaagent/` |

## Key API Endpoints

Expand Down Expand Up @@ -75,21 +76,80 @@ print(f'Double-prefix: {len(double)} {\"NONE\" if not double else double}')
- New conversations should have format `admin:conv-{timestamp}` (single prefix)
- Legacy conversations with `admin:admin:conv-...` are pre-fix artifacts

### 4. Tool Call Display
- After sending a message that triggers a tool call
- Right panel "Recent Tool Calls" should show the tool name with a checkmark
- The chat area should show inline tool call visualization
### 4. Tool Call Display & Icon Verification
- After sending a message that triggers tool calls (mix of success/error recommended)
- **Right panel**: "Recent Tool Calls" should show tool names with ✅ (success) or ❌ (error)
- **Chat body**: Inline tool call icons should match the right panel exactly
- Use "List my cookbook recipes and news feeds" as a good test — triggers ~12 tools with a mix of success (files/calendar) and error (cookbook 404, news 404)
- **Pass**: ❌ for failed tools, ✅ for successful tools in BOTH views, zero 🔧 in finalized messages
- **Fail**: 🔧 (wrench) icons remain after response completes, or icons don't match between views

### 5. Streaming Icon Transitions
- Start a new chat and send a message that triggers tools
- During streaming: tool icons should show 🔧 (wrench) with spinning animation
- After each tool completes: icon should transition to ✅ or ❌ immediately
- After full response completes: zero 🔧 icons should remain

### 6. JS Cache Verification
Nextcloud caches JS bundles using a `?v=<hash>` parameter derived from the app version in `appinfo/info.xml`.
```javascript
// Run in browser console to check which JS version is loaded
var s = document.querySelectorAll('script[src*="jadaagent-main"]')[0];
console.log('Script URL:', s.src);
console.log('Version param:', s.src.match(/\?v=([^&]+)/)?.[1]);
```
- If the `?v=` hash hasn't changed after deploying new code, the browser is serving old cached JS
- **Fix**: Bump `<version>` in `appinfo/info.xml`, then run `occ upgrade` inside the Nextcloud container

## Deploying Code Changes

### Frontend (Vue/JS)
```bash
# Build locally
cd /home/ubuntu/repos/jada-agent && npm run build

# Copy to remote
scp -i ~/.ssh/nc_rsa js/jadaagent-main.js ubuntu@83.228.213.100:/tmp/

# Deploy into Nextcloud container
ssh -i ~/.ssh/nc_rsa ubuntu@83.228.213.100 \
"sudo docker cp /tmp/jadaagent-main.js nextcloud-aio-nextcloud:/var/www/html/custom_apps/jadaagent/js/"
```

### Cache busting after frontend deploy
```bash
# If the JS ?v= hash didn't change, bump the version in info.xml:
# Edit appinfo/info.xml → increment <version>
# Then:
scp -i ~/.ssh/nc_rsa appinfo/info.xml ubuntu@83.228.213.100:/tmp/
ssh -i ~/.ssh/nc_rsa ubuntu@83.228.213.100 \
"sudo docker cp /tmp/info.xml nextcloud-aio-nextcloud:/var/www/html/custom_apps/jadaagent/appinfo/ && \
sudo docker exec -u www-data nextcloud-aio-nextcloud php occ upgrade"
```

### Backend (Hermes)
```bash
scp -i ~/.ssh/nc_rsa backend/server.mjs backend/agent-loop.mjs ubuntu@83.228.213.100:/tmp/
ssh -i ~/.ssh/nc_rsa ubuntu@83.228.213.100 \
"sudo docker cp /tmp/server.mjs hermes-backend:/app/ && \
sudo docker cp /tmp/agent-loop.mjs hermes-backend:/app/ && \
sudo docker restart hermes-backend"
```

## Common Pitfalls

1. **SSH access to 83.228.213.100** — Only accepts SSH key auth (no password). The key is provided per-session as an attachment. Run `chmod 600` on it before use. The key may stop working mid-session.
1. **SSH access to 83.228.213.100** — Use `ssh -i ~/.ssh/nc_rsa ubuntu@83.228.213.100` (not root). Passwordless sudo available. The key may also be at `~/attachments/.../id_rsa` if provided as session attachment.

2. **Brief "Hello, User" / "0 servers" flash on page load** — When navigating to the app, the UI briefly shows defaults before the health check completes (~3-5 seconds). This is a known minor UX issue, not a functional bug.
2. **Brief "Hello, User" / "0 servers" flash on page load** — The UI briefly shows defaults before the health check completes (~3-5 seconds). This is a known minor UX issue, not a functional bug.

3. **External vs Local Hermes** — The Nextcloud app uses the LOCAL Hermes on 83.228.213.100, NOT the external one at jada-api.garzaos.online. The external API may have stale/different config.

4. **CSRF on Nextcloud API calls** — Always include `-H "OCS-APIRequest: true"` header when calling Nextcloud proxy endpoints via curl, or you'll get "CSRF check failed".

5. **Telegram bot token changes** — The bot token gets revoked/regenerated periodically. Always verify with the user if you see 401 errors from the Telegram bot container.

6. **Deploying code changes** — Use `docker cp` to copy files into containers, then `docker restart` the container. For PHP changes, copy to `/var/www/html/custom_apps/jadaagent/` inside the Nextcloud container. For backend changes, copy to `/app/` inside `hermes-backend` container.
6. **Nextcloud JS caching** — Nextcloud appends `?v=<hash>` to JS URLs based on the app version in `appinfo/info.xml`. If you deploy new JS but don't bump the version, browsers will serve the old cached bundle indefinitely. Always bump `<version>` and run `occ upgrade` after frontend changes.

7. **HTML entities vs Unicode escapes in Vue templates** — Inline HTML entity ternaries (e.g., `&#10060;`) can get corrupted during Vite minification. The app uses a `toolIcon()` method with JS Unicode escapes (`\u274c`, `\u2705`, `\ud83d\udd27`) instead — this is more reliable. If icons appear wrong, check the minified JS to see if entities were corrupted.

8. **Tool icon rendering paths** — The chat body has TWO template blocks for tool icons: finalized messages (line ~34) and streaming messages (line ~56). Both use `{{ toolIcon(tc.status) }}`. If icons are wrong in one view but not the other, check both template blocks.