S265 research handoff — VS Code agent chat vs Vitto API routing
Documentation for Sessions
Purpose
Second-opinion brief for a research agent. All route and URL claims below are backed by repository grep/read, not inference. Use this to validate architecture, security, and implementation options for the Vitto VS Code extension native Chat tab and any future agent-session API.
MCP / session context
- Preflight was run for session 265 with subSession 2, then subSession 3 after
log_decision(investigation). - Manifest:
sessions/manifests/S265.json(verify currentsubSessionsif continuing work).
Verification methodology (reproducible)
Search for the HTTP path string the extension uses
Pattern:engine/agent-session
Scope: entiregspace1repo,*.ts
Result: Matches appear only inapps/vitto-vscode-extension/src/services/agent-session.service.ts(twofetchURLs).
No match inAPIs/backend-vitto-api/**/*.tsfor that path as a route decorator or string literal.Search for
agent-sessionin backend-vitto-api
Result: Occurrences are imports / class nameAgentSessionService, Mongo schemaagent-session.schema, collection nameagent-sessions— not an Express/Nest route segmentagent-session.Enumerate
POSTroutes on the main engine controller
File:APIs/backend-vitto-api/src/app/engine/vitto.controller.ts
Result: Includes@Post('message'),@Post('media/upload'),@Post('chat'), many others — no@Post('agent-session')and no@Post('...agent-session...')in the grep output for that file.Confirm global API prefix
File:APIs/backend-vitto-api/src/main.ts
Fact:app.setGlobalPrefix('vitto-api')
Therefore Nest@Controller('engine')+@Post('message')resolves toPOST /vitto-api/engine/message(not/engine/messageat server root).Confirm SPA dev proxy to Vitto backend
File:libs/libs-foundational/api-config/proxy.conf.js
Fact:/vitto-api→http://localhost:3003with no pathRewrite stripping the prefix.
Fact: There is no proxy entry for bare/engine.Extension base URL for those fetches
File:apps/vitto-vscode-extension/src/services/config.service.ts
Fact (dev):vittoUrlindetectEnvironment()ishttp://localhost:5400(comment: Vitto AI panel frontend).
File:apps/vitto-vscode-extension/src/services/agent-session.service.ts
Fact:const vittoUrl = env.vittoUrl || 'http://localhost:3003';
thenfetch(\${vittoUrl}/engine/agent-session`, ...)`.Angular chat engine (contrast)
File:libs/libs-foundational/api-config/src/lib/environment-presets.ts
Fact:VITTO_API_URLS.localDirect=http://localhost:3003/vitto-apilocalProxy=/vitto-api
So browser chat code that usesVITTO_API_URLis aligned with the prefixed API.
File:libs/libs-ai/vitto-chat/src/lib/services/vitto-chat-engine.service.ts
Fact: Ifthis.vittoApiUrlis set,sendMessageusessendMessageViaVitto→POST ${vittoApiUrl}/engine/message(i.e. with prefix when token is.../vitto-api).
Findings (ranked by severity)
F1 — Extension calls a route that does not exist in this repo (Certain)
- Evidence: Grep shows only the extension references
.../engine/agent-session. No controller defines that path underAPIs/backend-vitto-api. - Impact: Native Chat tab’s
AgentSessionService.chat()will get 404 (or non-SSE error) against a correctly runningbackend-vitto-api, even if URL/host were fixed. - Mitigation options (for research to compare):
- A. Implement
POST /vitto-api/engine/agent-session(+ tool-result sub-route) onbackend-vitto-api, reusing existing agent loop /AgentSessionService(Mongo) as appropriate. - B. Change the extension to call an existing endpoint (e.g.
POST /vitto-api/engine/message+ SSE stream) and adapt the protocol (today extension expects a specific SSE event shape andtool-resultPOST). - C. Proxy to another service if
agent-sessionwas intentionally hosted elsewhere (no evidence in this repo — verify externally if prod works today).
- A. Implement
F2 — Wrong URL shape vs Nest global prefix and dev proxy (Certain)
- Backend expects routes under
/vitto-api/.... - Extension builds
${vittoUrl}/engine/agent-session— missingvitto-apisegment. - In dev,
vittoUrlis typically the Angular dev server (localhost:5400), which only proxies/vitto-api, not/engine. - Impact: Double failure mode: wrong host role (SPA vs API) and wrong path.
F3 — Comment vs code in agent-session.service.ts (Certain, minor)
- Comment says Vitto API is on port 3003; actual first choice is
env.vittoUrl, which in dev is 5400 perconfig.service.ts. The3003fallback is misleading whenvittoUrlis always set.
F4 — Angular vitto-chat fallback to backend-ai-api (Certain, contextual)
- When
VITTO_API_URLis not injected,sendMessageusesAI_API_URL+/chat(backend-ai-api). That is not the primary Vitto engine path; it is a documented fallback in code comments. - Separate gap (from prior implementation work): In that fallback branch,
filespassed tosendMessageare not forwarded to/ai-api/chat— only relevant for deployments without Vitto API.
What is actually fine
- Mongo-backed
AgentSessionServicein vitto-api is a real, used subsystem for conversation persistence (referenced fromvitto-engine.service.ts, channel processing, etc.). The gap is HTTP exposure for the VS Code extension protocol, not the absence of session storage. - Angular Vitto chat path when
VITTO_API_URLis set is consistent withproxy.conf.jsandmain.tsglobal prefix (assuming apps provide the token correctly).
Questions for the research agent
- Product: Is native VS Code Chat intended to ship before a dedicated
agent-sessionHTTP API? If yes, should the extension align to/vitto-api/engine/messageonly? - Security: If attachments stay inline (base64 in JSON), what are max sizes, redaction, and logging policies vs R2 upload (
/vitto-api/engine/media/upload) used by Angular? - Ops: What is the canonical
vittoUrlfor the extension in each environment — SPA origin, API origin (3003/vitto-api), or configurable per setting? - S258 docs claimed backend work “not in scope” — reconcile with F1 (route missing in repo).
Key file index
| Area | Path |
|---|---|
| Extension fetches | apps/vitto-vscode-extension/src/services/agent-session.service.ts |
| Extension env | apps/vitto-vscode-extension/src/services/config.service.ts |
| Nest prefix | APIs/backend-vitto-api/src/main.ts |
| Engine routes (sample) | APIs/backend-vitto-api/src/app/engine/vitto.controller.ts |
| SPA proxy | libs/libs-foundational/api-config/proxy.conf.js |
| Vitto URL presets | libs/libs-foundational/api-config/src/lib/environment-presets.ts |
| Angular send | libs/libs-ai/vitto-chat/src/lib/services/vitto-chat-engine.service.ts |
Suggested follow-up grep (if repo changes)
rg "agent-session" APIs/backend-vitto-api --glob "*.ts"
rg "@Post\\('agent" APIs/backend-vitto-api --glob "*.ts"
rg "engine/agent-session" apps/vitto-vscode-extension --glob "*.ts"
End of handoff.