Preuve · code, extrait

main.go

Dépôt apteva/server · commit b1d72aa5f0326d40536b7cdd280733edeb9a285b · plateforme Apteva, serveur, clone du 13 septembre 2026

Extrait tel qu'à ce commit : lignes 1200–1260, sur 1 799 (numérotation d'origine, 30 lignes de contexte autour de chaque citation) · fichier intégral sur GitHub (dépôt public)

Lignes citées par l'audit : 1230

61 lignes reproduites · ← retour à l'audit · catalogue des preuves

1200	// serves a provider row if one still exists and otherwise resolves the
1201	// migrated connection via legacy_provider_id. See runtime_token.go.
1202	//
1203	// Everything else the providers table used to expose — CRUD, types,
1204	// model discovery, usage, device auth, credential probes — now lives
1205	// on connections. See runtime_connection_handlers.go.
1206	apiMux.HandleFunc("/providers/", s.authMiddleware(func(w http.ResponseWriter, r *http.Request) {
1207		if strings.HasSuffix(strings.TrimPrefix(r.URL.Path, "/providers/"), "/auth/runtime-token") {
1208			s.handleRuntimeToken(w, r)
1209			return
1210		}
1211		http.Error(w, "providers have been replaced by connections; see /api/connections/runtime", http.StatusGone)
1212	}))
1213
1214	// /agent-templates — wizard's starter-config catalog. Builtin
1215	// rows are seeded inline in store.migrate(); apps can contribute
1216	// rows via their manifest (apps_loader upserts on install/upgrade);
1217	// users can save their own rows. See server/agent_templates.go.
1218	apiMux.HandleFunc("/agent-templates", s.authMiddleware(func(w http.ResponseWriter, r *http.Request) {
1219		switch r.Method {
1220		case http.MethodGet:
1221			s.handleListAgentTemplates(w, r)
1222		case http.MethodPost:
1223			s.handleCreateAgentTemplate(w, r)
1224		default:
1225			http.Error(w, "GET or POST", http.StatusMethodNotAllowed)
1226		}
1227	}))
1228	apiMux.HandleFunc("/agent-templates/", s.authMiddleware(s.handleAgentTemplateByID))
1229
1230	apiMux.HandleFunc("/platform/helper", s.authMiddleware(s.handlePlatformHelper))
1231	apiMux.HandleFunc("/platform/helper/status", s.authMiddleware(s.handlePlatformHelperStatus))
1232	apiMux.HandleFunc("/platform/helper/activate", s.authMiddleware(s.handlePlatformHelperActivate))
1233	apiMux.HandleFunc("/platform/helper/deactivate", s.authMiddleware(s.handlePlatformHelperDeactivate))
1234	apiMux.HandleFunc("/platform/helper/capabilities", s.authMiddleware(s.handlePlatformHelperCapabilities))
1235	// Private capability-token gateway used by temporary runtime agents to
1236	// reach dynamic MCP sessions exposed by the runtime-owning app.
1237	apiMux.HandleFunc("/runtime-mcp-gateway/", s.handleRuntimeMCPGateway)
1238
1239	// /environments, /environment-snapshots — isolated test environments.
1240	s.registerEnvironmentRoutes(apiMux)
1241
1242	// /environment-mcp — Environment control surface as MCP tools
1243	// (create/seed/list/destroy).
1244	apiMux.HandleFunc("/environment-mcp", s.handleEnvironmentMCP)
1245	// Helper's normal HTTP management MCP. The app-shaped path makes Core
1246	// inject its hidden caller thread identity; the handler resolves that
1247	// identity through the server-owned agent_thread_scopes table.
1248	apiMux.HandleFunc("/apps/apteva-server/mcp", s.handlePlatformMCP)
1249
1250	// /environment-app-gateway/<environmentID>/<app>/... — token-brokering
1251	// proxy so an in-environment agent core can reach token-protected app
1252	// sidecars.
1253	apiMux.HandleFunc("/environment-app-gateway/", s.handleEnvironmentAppGateway)
1254	apiMux.HandleFunc("/environment-app-public/", s.handleEnvironmentAppPublicGateway)
1255
1256	instancesCollectionHandler := s.authMiddleware(func(w http.ResponseWriter, r *http.Request) {
1257		switch r.Method {
1258		case http.MethodGet:
1259			s.handleListInstances(w, r)
1260		case http.MethodPost: