Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
33abf09
feat(frontend): typed call layer over the one transport, offline type…
mrveiss Nov 7, 2026
969dde3
feat(frontend): contract paths resolve once under each app's base, ca…
mrveiss Nov 7, 2026
89856a5
Merge remote-tracking branch 'origin/main' into issue-12363-typed-cli…
mrveiss Nov 7, 2026
a41100c
fix(frontend): re-freeze the verify-generated-types job digest and ke…
mrveiss Nov 7, 2026
2da29ea
refactor(frontend): dissolve the domain API wrappers onto the typed c…
mrveiss Nov 7, 2026
8045671
Merge origin/main into issue-12363-slice4-domain-wrappers
mrveiss Nov 7, 2026
07847eb
Merge main into issue-12363-typed-client-layer (auto-sync) [skip ci]
github-actions[bot] Nov 7, 2026
846a88e
refactor(frontend): the Advanced Control info call joins the composab…
mrveiss Nov 7, 2026
41d525e
Merge origin/issue-12363-typed-client-layer into issue-12363-slice4-d…
mrveiss Nov 7, 2026
bf71f5f
fix(frontend): the export download throws the response's HttpError, n…
mrveiss Nov 7, 2026
1d9b2c8
fix(frontend): a failed metrics call or video frame no longer aborts …
mrveiss Nov 7, 2026
9a76836
fix(frontend): an unextractable video frame is counted as skipped, th…
mrveiss Nov 7, 2026
30e9058
Merge remote-tracking branch 'origin/main' into issue-12363-slice4-do…
mrveiss Nov 7, 2026
8096c09
Merge origin/main into issue-12363-typed-client-layer (#12363)
mrveiss Nov 7, 2026
f8c89ab
fix(frontend): typed client review fixes: repeated-key array queries,…
mrveiss Nov 7, 2026
6cb4955
fix(frontend): typed call honours the configured API base, SLM refuse…
mrveiss Nov 7, 2026
513af72
Merge remote-tracking branch 'origin/issue-12363-typed-client-layer' …
mrveiss Nov 7, 2026
7810818
Merge remote-tracking branch 'origin/main' into issue-12363-slice4-do…
mrveiss Nov 8, 2026
ac0e791
Merge main into issue-12363-slice4-domain-wrappers (auto-sync) [skip ci]
github-actions[bot] Nov 8, 2026
b5a7b11
Merge remote-tracking branch 'origin/main' into issue-12363-slice4-do…
mrveiss Nov 8, 2026
898874c
Merge #21070 @ b5a7b11818 into the merge train
mrveiss Nov 9, 2026
416ec26
fix(ui): fillPathParams placeholder regex excludes '{' so it stays li…
mrveiss Nov 9, 2026
2f895b9
chore(guard): drop the VisionMultimodalApiClient size ceiling #21070 …
mrveiss Nov 9, 2026
c106255
Merge main into the merge train
mrveiss Nov 9, 2026
9c3bc40
Merge main into the merge train
mrveiss Nov 9, 2026
0dcbf54
Merge main into the merge train
mrveiss Nov 9, 2026
cc776d2
Merge branch 'main' into train-2026-11-09-t100b
mrveiss Nov 9, 2026
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
1 change: 1 addition & 0 deletions .github/filters/backend-python-paths.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ wiring:
- *backend_python
- 'autobot-frontend/src/**'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- 'scripts/api_wiring_baseline.txt'
- 'requirements*.txt'
- '.github/workflows/api-wiring.yml'
1 change: 1 addition & 0 deletions .github/workflows/api-wiring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ on:
- '.github/filters/backend-python-paths.yml'
- 'autobot-frontend/src/**'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- 'scripts/api_wiring_baseline.txt'
- 'requirements*.txt'
- '.github/workflows/api-wiring.yml'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/company-os-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on:
- 'autobot-frontend/src/views/llc/**'
- 'autobot-frontend/src/composables/llc/**'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- '.github/workflows/company-os-contract.yml'
- '.github/actions/free-disk-space/**'
- '.github/actions/install-ci-requirements/**'
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/verify-generated-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ on:
- 'autobot-frontend/package.json'
- 'autobot-frontend/package-lock.json'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- 'requirements*.txt'
- '.github/workflows/verify-generated-types.yml'
- '.github/workflows/_changes.yml'
Expand Down Expand Up @@ -133,6 +134,7 @@ jobs:
- 'autobot-frontend/package.json'
- 'autobot-frontend/package-lock.json'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- '**/requirements*.txt'
- '.github/workflows/verify-generated-types.yml'
slm_types:
Expand All @@ -142,6 +144,7 @@ jobs:
- 'autobot-slm-frontend/package.json'
- 'autobot-slm-frontend/package-lock.json'
- 'scripts/audit_api_wiring.py'
- 'scripts/audit_api_wiring_args.py'
- '**/requirements*.txt'
- '.github/workflows/verify-generated-types.yml'

Expand Down Expand Up @@ -198,14 +201,14 @@ jobs:
set -o pipefail
export PYTHONPATH="$PWD:$PWD/autobot-backend:${PYTHONPATH:-}"
mkdir -p data logs static config
if ! python scripts/audit_api_wiring.py --dump-openapi openapi.raw.json; then
# The schema the contract is generated from, without the audit-only x-websocket-paths extension,
# so it matches exactly what the live server serves to `npm run gen:types` (and what the offline
# `npm run gen:types:openapi` writes locally) (#12363).
if ! python scripts/audit_api_wiring.py --dump-openapi openapi.json --no-websocket-paths; then
echo "::error::Backend app.openapi() build failed — cannot verify generated types."
echo "This usually means the backend does not import cleanly in CI (see startup-import-smoke)."
exit 1
fi
# Strip the audit-only x-websocket-paths extension so the schema matches
# exactly what the live server serves to `npm run gen:types`.
python -c "import json; s=json.load(open('openapi.raw.json')); s.pop('x-websocket-paths', None); json.dump(s, open('openapi.json','w'))"

# #13572: reject absolute-path schema defaults here, where the contract has
# just been built, rather than paying for a second app.openapi().
Expand All @@ -217,7 +220,7 @@ jobs:
- name: Check no schema default is an absolute filesystem path (#13572)
run: |
export PYTHONPATH="$PWD:$PWD/autobot-backend:${PYTHONPATH:-}"
python scripts/check_openapi_absolute_defaults.py --contract openapi.raw.json
python scripts/check_openapi_absolute_defaults.py --contract openapi.json

- name: Set up Node.js
uses: actions/setup-node@v7
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -558,3 +558,6 @@ autobot-slm-backend/ansible/tests/inventory/group_vars/
# Session handoffs are working notes, not repository content (owner ruling 2026-09-25).
# They name branches, worktrees and in-flight state that is false the moment work moves.
.session/

# Offline OpenAPI dump for the main app (npm run gen:types:openapi); regenerated, never committed (#12363)
/autobot-frontend/openapi.json
91 changes: 66 additions & 25 deletions autobot-frontend/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,53 @@ import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

// #12363: one HTTP client. A raw fetch()/private axios instance re-implements the transport that
// ApiClient (over the kit's ApiClientBase) already owns -- base URL, bearer, timeout, retry, 401 policy.
// A site that must not use it (bootstrap before any client exists, another origin, a worker, telemetry
// that must never throw) carries `// eslint-disable-next-line no-restricted-syntax -- <reason>` at the
// call site, under a comment giving the reason (repo_tests/frontend_single_api_client_12363_test.py).
const NO_RAW_TRANSPORT = [
{
selector: "CallExpression[callee.name='fetch']",
message:
'Raw fetch() is not allowed here. Use apiClient.call(...) (utils/ApiClient.ts) for the AutoBot backend, or rawRequest/callRaw for streams and blobs - they own base-URL resolution, the bearer token, the timeout and 401 handling (#12363).',
},
{
selector: "CallExpression[callee.object.name='window'][callee.property.name='fetch']",
message: 'Raw window.fetch() is not allowed here. Use apiClient.call(...) or rawRequest/callRaw (#12363).',
},
{
selector: "CallExpression[callee.object.name='axios'][callee.property.name='create']",
message:
'A private axios instance re-implements a transport that already exists. Use apiClient.call(...) (#12363).',
},
]

const BASE_RESTRICTED_SYNTAX = [
{
selector: "Literal[value=/^(https?:\\/\\/)?172\\.16\\.168\\.[0-9]+/]",
message: 'Hardcoded AutoBot VM IP (172.16.168.X) — use window.location.hostname or VITE_*_HOST env var (#6784).',
},
{
selector: "TemplateElement[value.cooked=/172\\.16\\.168\\.[0-9]+/]",
message: 'Hardcoded AutoBot VM IP in template literal — use window.location.hostname or VITE_*_HOST env var (#6784).',
},
{
// (await ApiClient.<verb>(...)).json() — `.json()` on a parsed result.
selector:
"CallExpression[callee.property.name='json'][callee.object.type='AwaitExpression'][callee.object.argument.type='CallExpression'][callee.object.argument.callee.type='MemberExpression'][callee.object.argument.callee.property.name=/^(get|post|put|delete|patch)$/][callee.object.argument.callee.object.name=/^([aA]pi|[aA]piClient)$/]",
message:
'ApiClient already returns parsed JSON — do not call .json() on its result (#10025). Use `const data = await ApiClient.get<T>(...)` directly.',
},
{
// (await ApiClient.<verb>(...)).data — axios-envelope `.data` access.
selector:
"MemberExpression[property.name='data'][object.type='AwaitExpression'][object.argument.type='CallExpression'][object.argument.callee.type='MemberExpression'][object.argument.callee.property.name=/^(get|post|put|delete|patch)$/][object.argument.callee.object.name=/^([aA]pi|[aA]piClient)$/]",
message:
'ApiClient returns parsed JSON, not an axios envelope — do not read .data on its result (#10025). The awaited value IS the payload.',
},
]

export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
Expand Down Expand Up @@ -98,31 +145,7 @@ export default defineConfigWithVueTs(
// never fire on a real `fetch`/`rawRequest` Response `.json()`, nor on
// legitimate `.data` of Pinia state, refs, chart configs, or event
// payloads, nor on the two-statement `payload.data` pattern.
'no-restricted-syntax': [
'error',
{
selector: "Literal[value=/^(https?:\\/\\/)?172\\.16\\.168\\.[0-9]+/]",
message: 'Hardcoded AutoBot VM IP (172.16.168.X) — use window.location.hostname or VITE_*_HOST env var (#6784).',
},
{
selector: "TemplateElement[value.cooked=/172\\.16\\.168\\.[0-9]+/]",
message: 'Hardcoded AutoBot VM IP in template literal — use window.location.hostname or VITE_*_HOST env var (#6784).',
},
{
// (await ApiClient.<verb>(...)).json() — `.json()` on a parsed result.
selector:
"CallExpression[callee.property.name='json'][callee.object.type='AwaitExpression'][callee.object.argument.type='CallExpression'][callee.object.argument.callee.type='MemberExpression'][callee.object.argument.callee.property.name=/^(get|post|put|delete|patch)$/][callee.object.argument.callee.object.name=/^([aA]pi|[aA]piClient)$/]",
message:
'ApiClient already returns parsed JSON — do not call .json() on its result (#10025). Use `const data = await ApiClient.get<T>(...)` directly.',
},
{
// (await ApiClient.<verb>(...)).data — axios-envelope `.data` access.
selector:
"MemberExpression[property.name='data'][object.type='AwaitExpression'][object.argument.type='CallExpression'][object.argument.callee.type='MemberExpression'][object.argument.callee.property.name=/^(get|post|put|delete|patch)$/][object.argument.callee.object.name=/^([aA]pi|[aA]piClient)$/]",
message:
'ApiClient returns parsed JSON, not an axios envelope — do not read .data on its result (#10025). The awaited value IS the payload.',
},
],
'no-restricted-syntax': ['error', ...NO_RAW_TRANSPORT, ...BASE_RESTRICTED_SYNTAX],
// Issue #7085: forbid console.* in production code — use createLogger from @/utils/debugUtils instead.
// Note: you cannot suppress this rule with eslint-disable-next-line — reportUnusedDisableDirectives blocks that too.
'no-console': 'error',
Expand Down Expand Up @@ -161,6 +184,24 @@ export default defineConfigWithVueTs(
],
},
},
{
// Tests stub and call fetch directly; fetchWithAuth.ts is the bridge slice 3 of #12363 retires; service workers
// run in their own context with no access to the app's client; build/check scripts run in Node.
name: 'app/raw-transport-owners',
files: [
'src/utils/fetchWithAuth.ts',
'**/*.test.ts',
'**/*.spec.ts',
'**/__tests__/**',
'public/service-worker.ts',
'public/service-worker.js',
'public/sw-cache-bust.js',
'scripts/**/*.{ts,js,mjs,mts}',
],
rules: {
'no-restricted-syntax': ['error', ...BASE_RESTRICTED_SYNTAX],
},
},
{
name: 'app/console-allowed-in-debug-utils',
files: [
Expand Down
3 changes: 2 additions & 1 deletion autobot-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"lint:fix:eslint": "eslint . --fix",
"lint:fix": "run-s lint:fix:oxlint lint:fix:eslint",
"format": "prettier --write src/",
"gen:types": "openapi-typescript http://127.0.0.1:8001/openapi.json -o src/types/generated/api.ts --additional-properties",
"gen:types:openapi": "python3 ../scripts/audit_api_wiring.py --dump-openapi openapi.json --no-websocket-paths",
"gen:types": "npm run gen:types:openapi && openapi-typescript openapi.json -o src/types/generated/api.ts --additional-properties",
"verify:types": "git diff --exit-code src/types/generated/api.ts",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
Expand Down
57 changes: 28 additions & 29 deletions autobot-frontend/src/components/analytics/AdvancedAnalytics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -320,26 +320,24 @@
</template>

<script setup lang="ts">
import { BaseButton, BaseCard, saveBlob } from '@autobot/ui'
import { BaseButton, BaseCard, httpErrorFrom, saveBlob } from '@autobot/ui'
import type { IconName } from '@/components/ui/Icon.vue'
import { formatDuration } from '@/utils/formatHelpers'
import Icon from '@/components/ui/Icon.vue'
import { ref, computed, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import EmptyState from '@/components/ui/EmptyState.vue'
import api from '@/services/api'
import apiClient from '@/utils/ApiClient'
import { createLogger } from '@/utils/debugUtils'
import { getApiBase } from '@/config/ssot-config'

const { t } = useI18n()

const logger = createLogger('AdvancedAnalytics')

// Issue #701: Type for API response with data property
interface ApiDataResponse {
data?: unknown
[key: string]: unknown
}
// #21066: every analytics route above answers its model at the top level (no `data` envelope; verified
// against the response models in api/schemas_analytics.py and the producers in analytics_cost,
// analytics_agents, analytics_export and user_behavior_analytics), so the replies are read directly.
// The /behavior/* models are opaque (`extra=allow`); #21066 owns typing them.

// Domain shapes for analytics responses (fields consumed by the template)
interface CostSummary {
Expand Down Expand Up @@ -506,13 +504,13 @@ const fetchCostData = async () => {
// Issue #552: Fixed missing /api prefix in analytics endpoints
// Issue #701: Added type assertions for Promise.all results
const [summaryRes, trendsRes, modelsRes] = await Promise.all([
api.get<ApiDataResponse>(`${getApiBase()}/analytics/cost/summary`),
api.get<ApiDataResponse>(`${getApiBase()}/analytics/cost/trends`),
api.get<ApiDataResponse>(`${getApiBase()}/analytics/cost/by-model`)
apiClient.call('get', '/api/analytics/cost/summary'),
apiClient.call('get', '/api/analytics/cost/trends'),
apiClient.call('get', '/api/analytics/cost/by-model')
])
costSummary.value = (summaryRes as ApiDataResponse).data as CostSummary | null
costTrends.value = (trendsRes as ApiDataResponse).data as CostTrends | null
modelCosts.value = ((modelsRes as ApiDataResponse).data as ModelCostsData | undefined)?.models || []
costSummary.value = summaryRes as CostSummary | null
costTrends.value = trendsRes as CostTrends | null
modelCosts.value = (modelsRes as ModelCostsData | undefined)?.models || []
} catch (error) {
logger.error('Failed to fetch cost data:', error)
}
Expand All @@ -523,11 +521,11 @@ const fetchAgentData = async () => {
// Issue #552: Fixed missing /api prefix in analytics endpoints
// Issue #701: Added type assertions for Promise.all results
const [metricsRes, recsRes] = await Promise.all([
api.get<ApiDataResponse>(`${getApiBase()}/analytics/agents/performance`),
api.get<ApiDataResponse>(`${getApiBase()}/analytics/agents/recommendations`)
apiClient.call('get', '/api/analytics/agents/performance'),
apiClient.call('get', '/api/analytics/agents/recommendations')
])
agentMetrics.value = (metricsRes as ApiDataResponse).data as AgentMetrics | null
recommendations.value = (recsRes as ApiDataResponse).data as Recommendations | null
agentMetrics.value = metricsRes as AgentMetrics | null
recommendations.value = recsRes as Recommendations | null
} catch (error) {
logger.error('Failed to fetch agent data:', error)
}
Expand All @@ -537,8 +535,8 @@ const fetchExportFormats = async () => {
try {
// Issue #552: Fixed missing /api prefix in analytics endpoints
// Issue #701: Added type assertion for response
const res = await api.get<ApiDataResponse>(`${getApiBase()}/analytics/export/formats`)
exportFormats.value = ((res as ApiDataResponse).data as ExportFormatsData | undefined)?.formats || []
const res = await apiClient.call('get', '/api/analytics/export/formats')
exportFormats.value = (res as ExportFormatsData | undefined)?.formats || []
// Add icons
exportFormats.value.forEach((f: ExportFormat) => {
if (f.format === 'CSV') f.icon = 'file-csv'
Expand All @@ -557,13 +555,13 @@ const fetchBehaviorData = async () => {
// Issue #552: Fixed missing /api prefix in analytics endpoints
// Issue #701: Added type assertions for Promise.all results
const [engagementRes, featuresRes, heatmapRes] = await Promise.all([
api.get<ApiDataResponse>(`${getApiBase()}/analytics/behavior/engagement`),
api.get<ApiDataResponse>(`${getApiBase()}/analytics/behavior/features`),
api.get<ApiDataResponse>(`${getApiBase()}/analytics/behavior/stats/heatmap`)
apiClient.call('get', '/api/analytics/behavior/engagement'),
apiClient.call('get', '/api/analytics/behavior/features'),
apiClient.call('get', '/api/analytics/behavior/stats/heatmap')
])
engagementMetrics.value = (engagementRes as ApiDataResponse).data as EngagementMetricsData | null
behaviorMetrics.value = (featuresRes as ApiDataResponse).data
usageHeatmap.value = (heatmapRes as ApiDataResponse).data as UsageHeatmap | null
engagementMetrics.value = engagementRes as EngagementMetricsData | null
behaviorMetrics.value = featuresRes
usageHeatmap.value = heatmapRes as UsageHeatmap | null
} catch (error) {
logger.error('Failed to fetch behavior data:', error)
}
Expand All @@ -582,11 +580,12 @@ const getPopularityWidth = (views: number): string => {

const downloadExport = async (path: string) => {
try {
// Issue #701: Fixed api.get call - use responseType option properly
const response = await api.get<Blob>(path, { responseType: 'blob' })
// The server names the export route (from /analytics/export/formats), so the path is dynamic: a raw request.
const response = await apiClient.rawRequest(path)
if (!response.ok) throw await httpErrorFrom(response)
// Extract filename from path
const filename = path.split('/').pop() + (path.includes('csv') ? '.csv' : '.json')
saveBlob(new Blob([response as unknown as BlobPart]), filename)
saveBlob(await response.blob(), filename)
} catch (error) {
logger.error('Failed to download export:', error)
}
Expand Down
15 changes: 7 additions & 8 deletions autobot-frontend/src/components/analytics/AgentCostPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,8 @@ import { ref, computed, onMounted } from 'vue'
import { useI18n } from 'vue-i18n'
import { BaseButton, BaseTable, type BaseTableColumn } from '@autobot/ui'
import EmptyState from '@/components/ui/EmptyState.vue'
import api from '@/services/api'
import apiClient from '@/utils/ApiClient'
import { createLogger } from '@/utils/debugUtils'
import { getApiBase } from '@/config/ssot-config'

const logger = createLogger('AgentCostPanel')

Expand Down Expand Up @@ -191,8 +190,8 @@ const formatNumber = (num: number): string => {
const fetchAgentCosts = async () => {
loading.value = true
try {
const res = await api.get<{ data: { agents: AgentCost[] } }>(`${getApiBase()}/analytics/cost/by-agent`)
agents.value = res.data?.agents || []
const res = await apiClient.call('get', '/api/analytics/cost/by-agent')
agents.value = (res.agents as AgentCost[] | undefined) || []
} catch (error) {
logger.error('Failed to fetch agent costs:', error)
} finally {
Expand All @@ -217,10 +216,10 @@ const closeBudgetDialog = () => {
const saveBudget = async () => {
budgetDialog.value.saving = true
try {
await api.put<unknown>(
`${getApiBase()}/analytics/cost/by-agent/${budgetDialog.value.agentId}/budget`,
{ budget_monthly_usd: budgetDialog.value.amount }
)
await apiClient.call('put', '/api/analytics/cost/by-agent/{agent_id}/budget', {
path: { agent_id: budgetDialog.value.agentId },
body: { budget_monthly_usd: budgetDialog.value.amount },
})
closeBudgetDialog()
await fetchAgentCosts()
} catch (error) {
Expand Down
Loading
Loading