High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat: restore agent-friendly start/stop routes and dashboard compat aliases
Mariodf5798387ef7
diff --git a/internal/orchestrator/handlers.go b/internal/orchestrator/handlers.goindex 89897dfd..5cd8abdf 100644--- a/internal/orchestrator/handlers.go+++ b/internal/orchestrator/handlers.go@@ -13,6 +13,18 @@ func (o *Orchestrator) RegisterHandlers(mux *http.ServeMux) {mux.HandleFunc("POST /stop", o.handleStop)mux.HandleFunc("GET /instances", o.handleList)mux.HandleFunc("GET /instances/logs", o.handleLogs)++ // Agent-friendly routes: start/stop by profile ID+ mux.HandleFunc("POST /start/{id}", o.handleStartByID)+ mux.HandleFunc("POST /stop/{id}", o.handleStopByID)++ // Dashboard-compatible aliases+ mux.HandleFunc("POST /instances/launch", o.handleLaunchCompat)+ mux.HandleFunc("POST /instances/{id}/stop", o.handleStopByInstanceID)+ mux.HandleFunc("GET /instances/{id}/logs", o.handleLogsByID)+ mux.HandleFunc("GET /instances/tabs", o.handleAllTabs)+ mux.HandleFunc("POST /profiles/{name}/stop", o.handleStopProfileByPath)+ mux.HandleFunc("GET /profiles/{name}/instance", o.handleProfileInstance)}func (o *Orchestrator) handleLaunch(w http.ResponseWriter, r *http.Request) {@@ -87,6 +99,132 @@ func (o *Orchestrator) handleList(w http.ResponseWriter, r *http.Request) {web.JSON(w, 200, o.List())}+func (o *Orchestrator) handleStartByID(w http.ResponseWriter, r *http.Request) {+ id := r.PathValue("id")+ if o.profiles == nil {+ web.Error(w, 500, fmt.Errorf("profile manager not configured"))+ return+ }+ name, err := o.profiles.FindByID(id)+ if err != nil {+ web.Error(w, 404, err)+ return+ }++ var req struct {+ Port string `json:"port"`+ Headless bool `json:"headless"`+ }+ _ = json.NewDecoder(r.Body).Decode(&req)+ if req.Port == "" {+ req.Port = "0"+ }++ inst, err := o.Launch(name, req.Port, req.Headless)+ if err != nil {+ web.Error(w, 409, err)+ return+ }+ web.JSON(w, 201, inst)+}++func (o *Orchestrator) handleStopByID(w http.ResponseWriter, r *http.Request) {+ id := r.PathValue("id")+ if o.profiles == nil {+ web.Error(w, 500, fmt.Errorf("profile manager not configured"))+ return+ }+ name, err := o.profiles.FindByID(id)+ if err != nil {+ web.Error(w, 404, err)+ return+ }+ if err := o.StopProfile(name); err != nil {+ web.Error(w, 404, err)+ return+ }+ web.JSON(w, 200, map[string]string{"status": "stopped", "id": id, "name": name})+}++func (o *Orchestrator) handleLaunchCompat(w http.ResponseWriter, r *http.Request) {+ var req struct {+ Name string `json:"name"`+ Port string `json:"port"`+ Headless bool `json:"headless"`+ }+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {+ web.Error(w, 400, fmt.Errorf("invalid JSON"))+ return+ }+ if req.Name == "" || req.Port == "" {+ web.Error(w, 400, fmt.Errorf("name and port required"))+ return+ }++ inst, err := o.Launch(req.Name, req.Port, req.Headless)+ if err != nil {+ web.Error(w, 409, err)+ return+ }+ web.JSON(w, 201, inst)+}++func (o *Orchestrator) handleStopByInstanceID(w http.ResponseWriter, r *http.Request) {+ id := r.PathValue("id")+ if err := o.Stop(id); err != nil {+ web.Error(w, 404, err)+ return+ }+ web.JSON(w, 200, map[string]string{"status": "stopped", "id": id})+}++func (o *Orchestrator) handleLogsByID(w http.ResponseWriter, r *http.Request) {+ id := r.PathValue("id")+ logs, err := o.Logs(id)+ if err != nil {+ web.Error(w, 404, err)+ return+ }+ w.Header().Set("Content-Type", "text/plain")+ _, _ = w.Write([]byte(logs))+}++func (o *Orchestrator) handleAllTabs(w http.ResponseWriter, r *http.Request) {+ web.JSON(w, 200, o.AllTabs())+}++func (o *Orchestrator) handleStopProfileByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ if err := o.StopProfile(name); err != nil {+ web.Error(w, 404, err)+ return+ }+ web.JSON(w, 200, map[string]string{"status": "stopped", "name": name})+}++func (o *Orchestrator) handleProfileInstance(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ instances := o.List()+ for _, inst := range instances {+ if inst.Name == name && (inst.Status == "running" || inst.Status == "starting") {+ web.JSON(w, 200, map[string]any{+ "name": name,+ "running": inst.Status == "running",+ "status": inst.Status,+ "port": inst.Port,+ "id": inst.ID,+ })+ return+ }+ }+ web.JSON(w, 200, map[string]any{+ "name": name,+ "running": false,+ "status": "stopped",+ "port": "",+ })+}+func (o *Orchestrator) handleLogs(w http.ResponseWriter, r *http.Request) {id := r.URL.Query().Get("id")if id == "" {diff --git a/internal/profiles/handlers.go b/internal/profiles/handlers.goindex 6a6aacd2..87617b3a 100644--- a/internal/profiles/handlers.go+++ b/internal/profiles/handlers.go@@ -18,6 +18,14 @@ func (pm *ProfileManager) RegisterHandlers(mux *http.ServeMux) {mux.HandleFunc("GET /profiles/logs", pm.handleLogs)mux.HandleFunc("GET /profiles/analytics", pm.handleAnalytics)mux.HandleFunc("PATCH /profiles/meta", pm.handleUpdateMeta)++ // Dashboard-compatible aliases (path-param style)+ mux.HandleFunc("POST /profiles/create", pm.handleCreate)+ mux.HandleFunc("DELETE /profiles/{name}", pm.handleDeleteByPath)+ mux.HandleFunc("PATCH /profiles/{name}", pm.handleUpdateByPath)+ mux.HandleFunc("POST /profiles/{name}/reset", pm.handleResetByPath)+ mux.HandleFunc("GET /profiles/{name}/logs", pm.handleLogsByPath)+ mux.HandleFunc("GET /profiles/{name}/analytics", pm.handleAnalyticsByPath)}func (pm *ProfileManager) handleList(w http.ResponseWriter, r *http.Request) {@@ -160,3 +168,65 @@ func (pm *ProfileManager) handleUpdateMeta(w http.ResponseWriter, r *http.Reques}web.JSON(w, 200, map[string]string{"status": "updated", "name": req.Name})}++// Path-param compat handlers for dashboard JS++func (pm *ProfileManager) handleDeleteByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ if err := pm.Delete(name); err != nil {+ web.Error(w, 404, err)+ return+ }+ web.JSON(w, 200, map[string]string{"status": "deleted", "name": name})+}++func (pm *ProfileManager) handleUpdateByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ var req struct {+ Name string `json:"name"`+ UseWhen string `json:"useWhen"`+ Description string `json:"description"`+ }+ if err := json.NewDecoder(r.Body).Decode(&req); err != nil {+ web.Error(w, 400, fmt.Errorf("invalid JSON"))+ return+ }++ updates := make(map[string]string)+ if req.Description != "" {+ updates["description"] = req.Description+ }+ if req.UseWhen != "" {+ updates["useWhen"] = req.UseWhen+ }+ if len(updates) > 0 {+ if err := pm.UpdateMeta(name, updates); err != nil {+ web.Error(w, 404, err)+ return+ }+ }++ web.JSON(w, 200, map[string]string{"status": "updated", "name": name})+}++func (pm *ProfileManager) handleResetByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ if err := pm.Reset(name); err != nil {+ web.Error(w, 404, err)+ return+ }+ web.JSON(w, 200, map[string]string{"status": "reset", "name": name})+}++func (pm *ProfileManager) handleLogsByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ limit, _ := strconv.Atoi(r.URL.Query().Get("limit"))+ logs := pm.Logs(name, limit)+ web.JSON(w, 200, logs)+}++func (pm *ProfileManager) handleAnalyticsByPath(w http.ResponseWriter, r *http.Request) {+ name := r.PathValue("name")+ report := pm.Analytics(name)+ web.JSON(w, 200, report)+}diff --git a/skill/pinchtab/SKILL.md b/skill/pinchtab/SKILL.mdindex f7b64411..fdae757f 100644--- a/skill/pinchtab/SKILL.md+++ b/skill/pinchtab/SKILL.md@@ -187,6 +187,20 @@ curl -X POST http://localhost:9867/stop/278be873adebcurl http://localhost:9867/profiles/Pinchtab%20org/instance```+### Launch by name (alternative)++```bash+# Via /launch endpoint (name-based)+curl -X POST http://localhost:9867/launch \+ -H 'Content-Type: application/json' \+ -d '{"profile": "work", "port": "9868", "headless": true}'++# Via /instances/launch (dashboard compat)+curl -X POST http://localhost:9867/instances/launch \+ -H 'Content-Type: application/json' \+ -d '{"name": "work", "port": "9868"}'+```+### Typical agent flow with profiles```bash@@ -409,7 +423,12 @@ Locked tabs show `owner` and `lockedUntil` in `/tabs`. Returns 409 on conflict.# Execute multiple actions in sequencecurl -X POST http://localhost:9867/actions \-H 'Content-Type: application/json' \- -d '[{"kind":"click","ref":"e3"},{"kind":"type","ref":"e3","text":"hello"},{"kind":"press","key":"Enter"}]'+ -d '{"actions":[{"kind":"click","ref":"e3"},{"kind":"type","ref":"e3","text":"hello"},{"kind":"press","key":"Enter"}]}'++# Stop on first error (default: false, continues through all)+curl -X POST http://localhost:9867/actions \+ -H 'Content-Type: application/json' \+ -d '{"tabId":"TARGET_ID","actions":[...],"stopOnError":true}'```### Cookies