lampson 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +4 -0
  2. package/chat.syn +1 -1
  3. package/hub.tpl.syn +55 -12
  4. package/lib/api.syn +178 -7
  5. package/lib/diagnose.syn +142 -0
  6. package/lib/loop.syn +14 -0
  7. package/lib/plugins.syn +6 -4
  8. package/lib/provider.syn +16 -13
  9. package/lib/runtime.syn +56 -0
  10. package/lib/schedule.syn +40 -2
  11. package/lib/teamrun.syn +42 -5
  12. package/lib/teams.syn +397 -24
  13. package/lib/workspaces.syn +58 -0
  14. package/lib/worktree.syn +108 -0
  15. package/package.json +1 -1
  16. package/plugins/example-hello/plugin.json +1 -0
  17. package/public/css/chat.css +9 -8
  18. package/public/css/hub.css +69 -16
  19. package/public/css/layout.css +12 -4
  20. package/public/css/login.css +1 -1
  21. package/public/css/mobile.css +2 -2
  22. package/public/css/panel.css +16 -7
  23. package/public/css/sidebar.css +1 -1
  24. package/public/css/teams.css +701 -55
  25. package/public/css/tokens.css +36 -12
  26. package/public/css/views.css +124 -0
  27. package/public/hub.html +17 -9
  28. package/public/index.html +3 -2
  29. package/public/js/app.js +2 -2
  30. package/public/js/approvals.js +1 -1
  31. package/public/js/core.js +5 -2
  32. package/public/js/flow.js +187 -0
  33. package/public/js/hub.js +131 -31
  34. package/public/js/navtabs.js +23 -0
  35. package/public/js/objdiag.js +90 -0
  36. package/public/js/objlive.js +393 -0
  37. package/public/js/panel.js +2 -1
  38. package/public/js/plugins-home.js +59 -0
  39. package/public/js/plugins.js +40 -18
  40. package/public/js/schedules.js +5 -0
  41. package/public/js/sidebar.js +6 -4
  42. package/public/js/tasks-home.js +104 -0
  43. package/public/js/teams-home.js +64 -15
  44. package/public/js/teams.js +927 -202
  45. package/public/js/terminal.js +8 -2
  46. package/public/js/workspaces.js +6 -3
  47. package/public/plugins-home.html +32 -0
  48. package/public/tasks-home.html +31 -0
  49. package/public/teams-home.html +5 -2
  50. package/public/teams.html +33 -46
  51. package/public/vendor/xterm-addon-webgl.js +2 -0
  52. package/web.syn +61 -8
package/README.md CHANGED
@@ -147,6 +147,10 @@ view at `/w/<project>/equipos` with the objectives, the team as a live graph, it
147
147
  editor to build the team.
148
148
  → **[lampson.org/docs/teams](https://lampson.org/docs/teams)**
149
149
 
150
+ The home page has a tab per product: **proyectos · equipos · tareas · plugins**. `/tareas` lists the scheduled tasks
151
+ of every project (switch them on or off, run one now) and `/plugins` shows what's installed and where it's on —
152
+ turning a plugin on is still decided project by project, inside the project.
153
+
150
154
  ## Also in the box
151
155
 
152
156
  Sub-agents that work in parallel · skills (`SKILL.md` procedures, anything on [skills.sh](https://skills.sh)
package/chat.syn CHANGED
@@ -854,7 +854,7 @@ task attach_image(mode, path)
854
854
  let vis be provider.supports_vision(cfg)
855
855
  print(" " + green("📎 imagen " + text(length(pending_images)) + " adjunta") + dim(" · " + text(im["w"]) + "x" + text(im["h"]) + " · " + text(floor(length(im["data"]) * 3 / 4 / 1024)) + " KB · se manda con tu próximo mensaje"))
856
856
  when not vis
857
- print(" " + yellow("ojo: " + cfg["provider"] + " · " + cfg["model"] + " no acepta imágenes; el modelo recibirá solo una nota. Cambiá con /provider a uno con visión (anthropic, gpt-4o…)"))
857
+ print(" " + yellow("ojo: " + cfg["provider"] + " · " + cfg["model"] + " no acepta imágenes; el modelo recibirá solo una nota. Cambiá con /provider a uno con visión (anthropic, gpt-6.1-sol, deepseek-flash…)"))
858
858
  give true
859
859
 
860
860
  -- ---------- boot ----------
package/hub.tpl.syn CHANGED
@@ -6,6 +6,8 @@
6
6
  -- GET /w/<slug> la UI de ese workspace (public/index.html; los assets /css /js los sirve el hub)
7
7
  -- * /w/<slug>/api/… proxy al proceso del workspace (127.0.0.1:808N) — SSE y WebSocket pasan (Synsema ≥ 0.6.12)
8
8
  -- GET /w/<slug>/approve/… links de aprobación de ese workspace
9
+ -- GET /equipos · /tareas · /plugins vistas de todos los proyectos (pestañas del inicio)
10
+ -- GET /w/<slug>/equipos[/…] · /w/<slug>/objetivos/<n> equipos, objetivos y rutinas de un proyecto
9
11
  -- /api/workspaces… registro, crear (diálogo nativo o explorador), start/stop/quitar, política
10
12
  -- Supervisor: cada 15 s arranca los workspaces que deben vivir y apaga los inactivos (política en ⚙ → idle_hours).
11
13
  -- Acceso: esta PC entra sin nada; lo remoto — túnel, LAN, VPS — necesita la sesión de un dispositivo emparejado con
@@ -35,6 +37,9 @@ require file.read("public/*")
35
37
  -- equipos que no programan: su carpeta vive en la instalación (equipos/<nombre>/), creada desde /equipos
36
38
  require file("equipos")
37
39
  require file("equipos/*")
40
+ -- /plugins: el catálogo de plugins de la instalación (solo lectura: encender es dentro de cada proyecto)
41
+ require file.read("plugins")
42
+ require file.read("plugins/*")
38
43
  require random
39
44
 
40
45
  use "./lib/workspaces.syn" as ws
@@ -62,6 +67,21 @@ task check_client(token, request)
62
67
  task page_allowed(request)
63
68
  give check_client(nothing, request) != nothing
64
69
 
70
+ -- la pantalla de equipos (public/teams.html) en cualquiera de sus rutas: /w/<nombre> sin el hash va al slug completo, y
71
+ -- entrar enciende el workspace si estaba apagado
72
+ task teams_page(request, slug, rest, query)
73
+ when not page_allowed(request)
74
+ give redirect("/login", 302)
75
+ let full be ws.resolve_slug(slug)
76
+ when full != nothing and full != slug
77
+ give redirect("/w/" + full + rest + (when contains(query, "new") then "?new=1" otherwise ""), 302)
78
+ let w be ws.get(slug)
79
+ when w != nothing and ws.health(w) == nothing
80
+ ws.start_ws(w)
81
+ ws.wait_ready(w, 8)
82
+ ws.summary()
83
+ give html(read_file("public/teams.html"))
84
+
65
85
  task with_session(resp, request, sid)
66
86
  give set_cookie(resp, auth.COOKIE, sid, {"max_age": auth.SESSION_MAX_DAYS * 86400, "secure": auth.secure_cookie(headers of request), "same_site": "Lax"})
67
87
 
@@ -185,19 +205,15 @@ serve on 8080
185
205
  ws.summary()
186
206
  give html(read_file("public/index.html"))
187
207
 
188
- -- la pantalla de equipos y objetivos de un workspace (public/teams.html): página propia, a pantalla completa
208
+ -- la pantalla de equipos y objetivos de un workspace (public/teams.html): página propia, a pantalla completa. Las
209
+ -- subrutas (…/equipos/<equipo>, /editar, /objetivos/<n>, /rutinas/<id>, /w/<slug>/objetivos/<n>) son la misma
210
+ -- página: js/teams.js lee la URL y muestra ese nivel (así «atrás» y los enlaces van a donde dicen)
189
211
  route "GET /w/:slug/equipos"
190
- when not page_allowed(request)
191
- give redirect("/login", 302)
192
- let full be ws.resolve_slug(params.slug)
193
- when full != nothing and full != params.slug
194
- give redirect("/w/" + full + "/equipos" + (when contains(query, "new") then "?new=1" otherwise ""), 302)
195
- let w be ws.get(params.slug)
196
- when w != nothing and ws.health(w) == nothing
197
- ws.start_ws(w)
198
- ws.wait_ready(w, 8)
199
- ws.summary()
200
- give html(read_file("public/teams.html"))
212
+ give teams_page(request, params.slug, "/equipos", query)
213
+ route "GET /w/:slug/equipos/*rest"
214
+ give teams_page(request, params.slug, "/equipos/" + params.rest, query)
215
+ route "GET /w/:slug/objetivos/*rest"
216
+ give teams_page(request, params.slug, "/objetivos/" + params.rest, query)
201
217
 
202
218
  -- EQUIPOS Y OBJETIVOS de todos los workspaces (public/teams-home.html): lo que espera a la persona, cada proyecto
203
219
  -- con sus equipos y objetivos, y «+ equipo». Lee el resumen que escribe cada workspace (lib/teamrun.syn).
@@ -238,6 +254,33 @@ serve on 8080
238
254
  ws.summary()
239
255
  give {"ok": true, "slug": w["slug"], "url": "/w/" + w["slug"] + "/equipos?new=1"}
240
256
 
257
+ -- TAREAS PROGRAMADAS de todos los workspaces (public/tasks-home.html): leídas del json de cada uno, así se ven
258
+ -- también las de un proyecto apagado. Correr y encender/apagar van al workspace por el proxy (/w/<slug>/api/…).
259
+ route "GET /tareas"
260
+ when not page_allowed(request)
261
+ give redirect("/login", 302)
262
+ give html(read_file("public/tasks-home.html"))
263
+
264
+ route "GET /api/tasks-home" requires auth
265
+ let out be []
266
+ each w in ws.summary_cached(20)
267
+ set out to append(out, {"slug": w["slug"], "name": w["name"], "path": w["path"], "alive": w["alive"], "tasks": ws.tasks_summary(w)})
268
+ give {"workspaces": out}
269
+
270
+ -- PLUGINS (public/plugins-home.html): qué hay instalado y en qué proyectos está encendido cada uno. Es un
271
+ -- escaparate: encender sigue siendo una decisión por proyecto, dentro del proyecto (/w/<slug>#plugins=<nombre>).
272
+ route "GET /plugins"
273
+ when not page_allowed(request)
274
+ give redirect("/login", 302)
275
+ give html(read_file("public/plugins-home.html"))
276
+
277
+ route "GET /api/plugins-home" requires auth
278
+ let out be []
279
+ each w in ws.summary_cached(20)
280
+ let p be ws.plugins_of(w)
281
+ set out to append(out, {"slug": w["slug"], "name": w["name"], "path": w["path"], "alive": w["alive"], "enabled": p["enabled"], "local": p["local"]})
282
+ give {"global": ws.plugins_global(), "workspaces": out}
283
+
241
284
  route "GET /api/hub" requires auth
242
285
  give {"ok": true, "port": ws.HUB_PORT, "idle_hours": ws.idle_hours(), "home": ws.home(), "local": request.user["local"]}
243
286
 
package/lib/api.syn CHANGED
@@ -23,6 +23,9 @@ use "./runtime.syn" as runtime
23
23
  use "./apikeys.syn" as apikeys
24
24
  use "./mailbox.syn" as mailbox
25
25
  use "./teams.syn" as teams
26
+ use "./schedule.syn" as schedule
27
+ use "./worktree.syn" as worktree
28
+ use "./diagnose.syn" as diagnose
26
29
 
27
30
 
28
31
  -- la key del header Authorization (o nothing)
@@ -72,6 +75,10 @@ export task agents_for(rec)
72
75
  set out to append(out, {"id": id, "description": runtime.get(id)["description"]})
73
76
  give out
74
77
 
78
+ -- la sesión de un asiento en un objetivo: la que quedó anotada; si no hay (objetivos de antes), la del thread
79
+ task pick_session(own, thread_sid)
80
+ give when own != "" then own otherwise thread_sid
81
+
75
82
  task field(m, k, fallback)
76
83
  when contains(m, k)
77
84
  when m[k] != nothing
@@ -160,10 +167,33 @@ export task objective_view(o)
160
167
  require db(".lampson/teams.db")
161
168
  require file(".lampson")
162
169
  require file(".lampson/*")
170
+ require file.read("workspace")
171
+ require file.read("workspace/*")
163
172
  let scope be teams.obj_scope(o)
164
- let ts be apply(teams.tasks(scope), (t) => {"id": t["id"], "title": t["title"], "status": t["status"], "owner": t["owner"], "notes": t["notes"], "depends": json_decode(t["depends"])})
165
- let lg be apply(teams.ledger(scope, 0, 100), (r) => {"id": r["id"], "at": r["at"], "actor": r["actor"], "kind": r["kind"], "ref": r["ref"], "text": r["text"]})
166
- give {"id": o["id"], "ref": "O-" + text(o["id"]), "agent": o["agent"], "team": o["team"], "text": o["text"], "status": o["status"], "progress": o["progress"], "question": o["question"], "question_kind": o["question_kind"], "result": o["result"], "turns": o["turns"], "spent": o["spent"], "budget_tokens": o["budget_tokens"], "round_seconds": o["round_seconds"], "created_at": o["created_at"], "updated_at": o["updated_at"], "tasks": ts, "ledger": lg}
173
+ let team_obj be field(o, "team", "") != ""
174
+ -- el tablero y el registro de un equipo son de todos sus objetivos: acá, solo lo de este (sus tareas; el registro
175
+ -- de mientras estuvo abierto)
176
+ let mine be when team_obj then where(teams.tasks(scope), (t) => field(t, "objective", 0) == o["id"]) otherwise teams.tasks(scope)
177
+ let ts be apply(mine, (t) => {"id": t["id"], "title": t["title"], "status": t["status"], "owner": t["owner"], "notes": t["notes"], "depends": json_decode(t["depends"])})
178
+ let closed be not contains(["active", "waiting", "paused"], o["status"])
179
+ let rows be when team_obj then where(teams.ledger(scope, 0, 400), (r) => r["at"] >= o["created_at"] - 2 and (not closed or r["at"] <= o["updated_at"] + 60)) otherwise teams.ledger(scope, 0, 150)
180
+ let lg be apply(slice(rows, 0, min(150, length(rows))), (r) => {"id": r["id"], "at": r["at"], "actor": r["actor"], "kind": r["kind"], "ref": r["ref"], "text": r["text"]})
181
+ -- quién trabajó y dónde quedó cada paso: la sesión de cada asiento en la conversación del objetivo (la pantalla lee
182
+ -- su traza con /api/trace y la recorta a la ventana del objetivo)
183
+ let seats be []
184
+ when team_obj
185
+ let tm be teams.get(o["team"])
186
+ when tm != nothing
187
+ each m in tm["members"]
188
+ set seats to append(seats, {"agent": m["agent"], "role": m["role"], "lead": m["agent"] == o["agent"], "today": teams.spent_today(m["agent"]), "cap": teams.cap_of(tm, m["agent"]), "session": pick_session(teams.seat_session_of(o["id"], m["agent"]), runtime.thread_session(m["agent"], scope))})
189
+ otherwise
190
+ set seats to [{"agent": o["agent"], "role": o["agent"], "lead": true, "session": runtime.thread_session(o["agent"], "objective:" + text(o["id"]))}]
191
+ -- el pase entre equipos: de dónde vino, a quién lo pasó, a quién lo puede pasar
192
+ let chain be json_decode(field(o, "chain", "[]"))
193
+ let origin be when field(o, "from_obj", 0) > 0 then {"id": o["from_obj"], "ref": "O-" + text(o["from_obj"]), "team": when length(chain) > 0 then chain[length(chain) - 1] otherwise ""} otherwise nothing
194
+ let passed be apply(teams.obj_children(o["id"]), (c) => {"id": c["id"], "ref": "O-" + text(c["id"]), "team": c["team"], "status": c["status"]})
195
+ let pend be field(o, "pass_pending", "")
196
+ give {"id": o["id"], "ref": "O-" + text(o["id"]), "agent": o["agent"], "team": o["team"], "text": o["text"], "status": o["status"], "progress": o["progress"], "question": o["question"], "question_kind": o["question_kind"], "result": o["result"], "turns": o["turns"], "spent": o["spent"], "budget_tokens": o["budget_tokens"], "round_seconds": o["round_seconds"], "created_at": o["created_at"], "updated_at": o["updated_at"], "created_by": o["created_by"], "tasks": ts, "ledger": lg, "seats": seats, "from": origin, "passed": passed, "pass_to": json_decode(field(o, "pass_to", "[]")), "pass_ask": field(o, "pass_ask", 0) == 1, "pass_pending": when pend == "" then nothing otherwise json_decode(pend)}
167
197
 
168
198
  -- POST /v1/objectives: {agent, text, round_seconds?, budget_tokens?} → {ok, id} / {ok: false, status, error}
169
199
  export task create_objective(body, rec)
@@ -193,7 +223,7 @@ export task create_objective(body, rec)
193
223
  give {"ok": false, "status": 403, "error": "this API key can't use agent '" + agent + "'"}
194
224
  when trim(text(field(body, "text", ""))) == ""
195
225
  give {"ok": false, "status": 400, "error": "text is required"}
196
- let opts be {"budget_tokens": field(body, "budget_tokens", 500000), "created_by": "api:" + rec["name"], "team": tid}
226
+ let opts be {"budget_tokens": field(body, "budget_tokens", 600000), "created_by": "api:" + rec["name"], "team": tid, "pass_ask": field(body, "pass_ask", false) == true}
197
227
  when field(body, "round_seconds", nothing) != nothing
198
228
  set opts["round_seconds"] to body["round_seconds"]
199
229
  let id be teams.obj_create(agent, field(body, "text", ""), opts)
@@ -227,10 +257,10 @@ export task teams_view()
227
257
  let members be []
228
258
  each m in t["members"]
229
259
  let spec be runtime.get(m["agent"])
230
- set members to append(members, {"agent": m["agent"], "role": m["role"], "reports_to": m["reports_to"], "description": when spec == nothing then "" otherwise spec["description"], "system": when spec == nothing then "" otherwise spec["system"], "tools": when spec == nothing then [] otherwise spec["tools"], "permission": when spec == nothing then "" otherwise spec["permission"], "missing": spec == nothing, "working": mailbox.working(m["agent"], scope), "spent_today": teams.spent_today(m["agent"]), "peers": teams.peers(t, m["agent"])})
260
+ set members to append(members, {"agent": m["agent"], "role": m["role"], "reports_to": m["reports_to"], "description": when spec == nothing then "" otherwise spec["description"], "system": when spec == nothing then "" otherwise spec["system"], "tools": when spec == nothing then [] otherwise spec["tools"], "permission": when spec == nothing then "" otherwise spec["permission"], "missing": spec == nothing, "working": mailbox.working(m["agent"], scope), "spent_today": teams.spent_today(m["agent"]), "daily_tokens": m["daily_tokens"], "cap": teams.cap_of(t, m["agent"]), "peers": teams.peers(t, m["agent"])})
231
261
  let ts be apply(teams.tasks(scope), (x) => {"id": x["id"], "title": x["title"], "status": x["status"], "owner": x["owner"], "notes": x["notes"], "depends": json_decode(x["depends"])})
232
262
  let lg be apply(teams.ledger(scope, 0, 150), (r) => {"id": r["id"], "at": r["at"], "actor": r["actor"], "kind": r["kind"], "ref": r["ref"], "text": r["text"]})
233
- set out to append(out, {"id": t["id"], "description": t["description"], "members": members, "talks": t["talks"], "round_minutes": t["round_minutes"], "budget_daily_tokens": t["budget_daily_tokens"], "worktrees": t["worktrees"], "lead": teams.lead_of(t), "tasks": ts, "ledger": lg})
263
+ set out to append(out, {"id": t["id"], "name": t["name"], "description": t["description"], "members": members, "talks": t["talks"], "round_minutes": t["round_minutes"], "budget_daily_tokens": t["budget_daily_tokens"], "worktrees": t["worktrees"], "lead": teams.lead_of(t), "tasks": ts, "ledger": lg})
234
264
  give {"teams": out, "errors": sc["errors"]}
235
265
 
236
266
 
@@ -238,6 +268,147 @@ export task teams_view()
238
268
  -- conserva lo que su archivo ya tenía y pisa solo lo que se editó. → {ok, error}
239
269
  export let TOOL_PRESETS be {"code": ["read", "write", "edit", "ls", "find", "grep", "bash", "todo"], "read": ["read", "ls", "find", "grep", "bash"], "none": []}
240
270
 
271
+ -- las aprobaciones, y en un merge o un push pendiente lo que va a pasar (rama, commits, archivos, si choca): se
272
+ -- aprueba sabiendo qué entra, no leyendo el comando
273
+ export task approvals_view(list)
274
+ require exec
275
+ require time
276
+ require file("workspace")
277
+ require file("workspace/*")
278
+ let out be []
279
+ each a in list
280
+ let x be a
281
+ when a["status"] == "pending" and contains(text(a["why"]), "shared history")
282
+ try
283
+ set x["preview"] to worktree.preview(a["message"])
284
+ recover err
285
+ set x["preview"] to nothing
286
+ set out to append(out, x)
287
+ give out
288
+
289
+ -- darle más tokens por hoy a un asiento: {agent, action: grant|reset, tokens?} → {ok, today, cap}
290
+ export task seat_tokens(body)
291
+ require db(".lampson/teams.db")
292
+ require time
293
+ require file(".lampson")
294
+ require file(".lampson/*")
295
+ require file.read("workspace")
296
+ require file.read("workspace/*")
297
+ let agent be lower(text(field(body, "agent", "")))
298
+ let ts be teams.teams_of(agent)
299
+ when length(ts) == 0
300
+ give {"ok": false, "error": "'" + agent + "' is not in any team"}
301
+ let act be lower(text(field(body, "action", "grant")))
302
+ when act != "grant" and act != "reset"
303
+ give {"ok": false, "error": "action must be grant or reset"}
304
+ let before be teams.spent_today(agent)
305
+ let after be teams.seat_tokens(agent, act, field(body, "tokens", teams.cap_of(ts[0], agent)))
306
+ each t in ts
307
+ teams.log("team:" + t["id"], "person", "tokens", "", agent + ": " + (when act == "reset" then "today's count reset" otherwise "+" + text(before - after) + " tokens for today") + " (" + text(after) + " of " + text(teams.cap_of(t, agent)) + ")")
308
+ give {"ok": true, "today": after, "cap": teams.cap_of(ts[0], agent)}
309
+
310
+ -- «Revisar qué pasa» en un objetivo de equipo: los hechos (sin IA), el análisis (con el modelo) y lo que la persona
311
+ -- hace desde ahí (escribirle a un asiento, mover una tarea)
312
+ export task obj_facts(o)
313
+ require db(".lampson/teams.db")
314
+ require time
315
+ require file(".lampson")
316
+ require file(".lampson/*")
317
+ require file.read("workspace")
318
+ require file.read("workspace/*")
319
+ when field(o, "team", "") == ""
320
+ give []
321
+ give diagnose.facts(o)
322
+
323
+ export task obj_analyze(o)
324
+ require db(".lampson/teams.db")
325
+ require net
326
+ require time
327
+ require env("LAMPSON_*")
328
+ require secret("LAMPSON_*")
329
+ require file(".lampson")
330
+ require file(".lampson/*")
331
+ require file.read("workspace")
332
+ require file.read("workspace/*")
333
+ when field(o, "team", "") == ""
334
+ give {"ok": false, "error": "only team objectives"}
335
+ let r be diagnose.analysis(o)
336
+ when r["ok"]
337
+ teams.log("team:" + o["team"], "lampson", "diagnosed", "O-" + text(o["id"]), r["summary"])
338
+ give r
339
+
340
+ export task obj_act(o, body)
341
+ require db(".lampson/teams.db")
342
+ require time
343
+ require file(".lampson")
344
+ require file(".lampson/*")
345
+ require file.read("workspace")
346
+ require file.read("workspace/*")
347
+ when field(o, "team", "") == ""
348
+ give {"ok": false, "error": "only team objectives"}
349
+ let kind be text(field(body, "kind", ""))
350
+ when kind == "message"
351
+ let ok be teams.person_message(o["team"], lower(text(field(body, "agent", ""))), text(field(body, "text", "")))
352
+ give when ok then {"ok": true} otherwise {"ok": false, "error": "no seat '" + text(field(body, "agent", "")) + "' in this team"}
353
+ when kind == "task"
354
+ let ok be teams.person_move("team:" + o["team"], floor(number(field(body, "task", 0))), text(field(body, "status", "")))
355
+ give when ok then {"ok": true} otherwise {"ok": false, "error": "no such task or status"}
356
+ give {"ok": false, "error": "kind must be message or task"}
357
+
358
+ -- borrar un equipo: {id, agents?}. Se cancelan sus objetivos en curso y se borran sus rutinas (sin equipo no tienen a
359
+ -- quién darle el trabajo); con agents=true (lo que manda la pantalla), también los archivos de sus agentes, salvo el
360
+ -- que está en otro equipo: se crearon para este y sueltos solo confunden. Lo que hizo
361
+ -- queda: el historial de sus objetivos y sus ramas de git. → {ok, cancelled, routines, agents} / {ok: false, error}
362
+ export task delete_team(body)
363
+ require db(".lampson/teams.db")
364
+ require time
365
+ require exec
366
+ require env("LAMPSON_*")
367
+ require file(".lampson")
368
+ require file(".lampson/*")
369
+ require file("workspace")
370
+ require file("workspace/*")
371
+ let id be lower(text(field(body, "id", "")))
372
+ let team be teams.get(id)
373
+ when team == nothing
374
+ give {"ok": false, "error": "no team '" + id + "'"}
375
+ let cancelled be []
376
+ each o in teams.obj_list()
377
+ when o["team"] == id and contains(["active", "waiting", "paused"], o["status"])
378
+ teams.obj_cancel(o["id"], "person")
379
+ set cancelled to append(cancelled, "O-" + text(o["id"]))
380
+ let routines be []
381
+ each t in schedule.all()
382
+ let a be field(t, "action", nothing)
383
+ when a != nothing and type_of(a) == "map" and field(a, "type", "") == "objective" and field(a, "team", "") == id
384
+ schedule.remove(t["id"])
385
+ set routines to append(routines, t["id"])
386
+ let others be []
387
+ each t in teams.all()
388
+ when t["id"] != id
389
+ each m in t["members"]
390
+ set others to append(others, m["agent"])
391
+ teams.log("team:" + id, "person", "team deleted", "", text(length(cancelled)) + " objectives cancelled, " + text(length(routines)) + " routines removed")
392
+ -- que un equipo nuevo con el mismo nombre arranque de cero: tablero y registro archivados, conversaciones olvidadas,
393
+ -- y la copia de git de cada asiento propio retirada (su trabajo sin mergear queda en una rama archive/…)
394
+ let archived be teams.archive(id)
395
+ let gone be []
396
+ let branches be []
397
+ each m in team["members"]
398
+ runtime.forget_thread(m["agent"], "team:" + id)
399
+ when not contains(others, m["agent"])
400
+ let w be worktree.retire(id, m["agent"])
401
+ when starts_with(w["branch"], "archive/")
402
+ set branches to append(branches, w["branch"])
403
+ when field(body, "agents", false) == true
404
+ let path be runtime.PROJECT_DIR + "/" + m["agent"] + runtime.SUFFIX
405
+ when file_exists(path)
406
+ delete_file(path)
407
+ set gone to append(gone, m["agent"])
408
+ teams.forget_spend(m["agent"])
409
+ delete_file(teams.DIR + "/" + id + ".team.json")
410
+ give {"ok": true, "cancelled": cancelled, "routines": routines, "agents": gone, "archived": archived, "branches": branches}
411
+
241
412
  export task save_team(body)
242
413
  require db(".lampson/teams.db")
243
414
  require time
@@ -286,7 +457,7 @@ export task save_team(body)
286
457
  give {"ok": false, "error": "agent '" + m["agent"] + "' has no file yet — give it a personality to create it"}
287
458
  each f in files
288
459
  write_file(f["path"], json_encode(f["doc"]))
289
- let raw be {"id": team["id"], "description": team["description"], "members": apply(team["members"], (m) => {"agent": m["agent"], "role": m["role"], "reports_to": m["reports_to"]}), "talks": team["talks"], "round_minutes": team["round_minutes"], "budget_daily_tokens": team["budget_daily_tokens"], "worktrees": team["worktrees"]}
460
+ let raw be {"id": team["id"], "name": team["name"], "description": team["description"], "members": apply(team["members"], (m) => when m["daily_tokens"] > 0 then {"agent": m["agent"], "role": m["role"], "reports_to": m["reports_to"], "daily_tokens": m["daily_tokens"]} otherwise {"agent": m["agent"], "role": m["role"], "reports_to": m["reports_to"]}), "talks": team["talks"], "round_minutes": team["round_minutes"], "budget_daily_tokens": team["budget_daily_tokens"], "worktrees": team["worktrees"]}
290
461
  write_file(teams.DIR + "/" + team["id"] + ".team.json", json_encode(raw))
291
462
  teams.log("team:" + team["id"], "person", "team saved", "", join(apply(team["members"], (m) => m["agent"] + " (" + m["role"] + ")"), ", "))
292
463
  give {"ok": true, "error": ""}
@@ -0,0 +1,142 @@
1
+ -- lib/diagnose.syn — ¿por qué está trabado un objetivo de equipo? (la pantalla «Revisar qué pasa»)
2
+ --
3
+ -- Dos niveles:
4
+ -- * facts(o): lo que se ve sin IA, sacado del tablero, el registro y la traza de cada asiento — quién está
5
+ -- bloqueado y por qué, quién contestó en su respuesta final (que nadie lee), quién se quedó sin pasos, si el
6
+ -- equipo cree que alguien no tiene presupuesto cuando sí lo tiene, hace cuánto no se mueve nada
7
+ -- * analysis(o): el mismo expediente al modelo configurado, que devuelve qué pasó y qué hacer, con acciones de una
8
+ -- lista cerrada (escribirle a un asiento, mover una tarea) que la persona aplica con un botón
9
+ -- (Visto 2026-10-18 con un modelo flojo: el Dev respondió «voy avanzando» en su respuesta final, nadie lo leyó, el
10
+ -- CEO creyó que estaba sin presupuesto y le pidió a la persona esperar a mañana: todo quedó bloqueado.)
11
+ use "./teams.syn" as teams
12
+ use "./trace.syn" as trace
13
+ use "./mailbox.syn" as mailbox
14
+ use "./runtime.syn" as runtime
15
+ use "./provider.syn" as provider
16
+
17
+ task field(m, k, fallback)
18
+ when contains(m, k) and m[k] != nothing
19
+ give m[k]
20
+ give fallback
21
+
22
+ -- el último turno de una sesión, leído de su traza: {calls: [nombres], said, stopped, at}
23
+ export task last_turn(sid)
24
+ require file(".lampson")
25
+ require file(".lampson/*")
26
+ let out be {"calls": [], "said": "", "stopped": "", "trigger": ""}
27
+ when sid == ""
28
+ give out
29
+ let lines be split(trace.tail(sid, 160), "\n")
30
+ let start be -1
31
+ let i be 0
32
+ each line in lines
33
+ when contains(line, "s USER ")
34
+ set start to i
35
+ set i to i + 1
36
+ when start < 0
37
+ give out
38
+ let k be 0
39
+ each line in lines
40
+ when k >= start
41
+ let body be regex_replace(line, "^\\S+ \\+\\s*[0-9.]+s\\s+", "")
42
+ let kind be split(body, " ")[0]
43
+ let txt be trim(slice(body, length(kind), length(body)))
44
+ when kind == "USER"
45
+ set out["trigger"] to slice(regex_replace(txt, "^\\[[^\\]]*\\]\\s*", ""), 0, 160)
46
+ when kind == "CALL"
47
+ set out["calls"] to append(out["calls"], split(txt, " ")[0])
48
+ when kind == "SAY"
49
+ set out["said"] to slice(replace(txt, " ⏎ ", "\n"), 0, 700)
50
+ when kind == "END"
51
+ let parts be split(txt, " · ")
52
+ set out["stopped"] to trim(parts[length(parts) - 1])
53
+ set k to k + 1
54
+ give out
55
+
56
+ -- lo que se ve sin IA. → [{kind, agent, task, text}] (kind: quiet, blocked, waits, unsent, cut, budget_belief, over)
57
+ export task facts(o)
58
+ require db(".lampson/teams.db")
59
+ require time
60
+ require file(".lampson")
61
+ require file(".lampson/*")
62
+ require file.read("workspace")
63
+ require file.read("workspace/*")
64
+ let out be []
65
+ let tm be teams.get(o["team"])
66
+ when tm == nothing
67
+ give out
68
+ let scope be "team:" + tm["id"]
69
+ let ts be where(teams.tasks(scope), (t) => field(t, "objective", 0) == o["id"])
70
+ let busy be where(tm["members"], (m) => mailbox.working(m["agent"], scope))
71
+ let quiet be teams.quiet_for(scope)
72
+ when length(busy) == 0 and quiet >= 300 and o["status"] == "active"
73
+ set out to append(out, {"kind": "quiet", "agent": "", "task": 0, "text": "nobody is working and nothing has moved for " + text(floor(quiet / 60)) + " min"})
74
+ let left be when o["budget_tokens"] > 0 then o["budget_tokens"] - o["spent"] otherwise 1
75
+ each t in ts
76
+ when t["status"] == "blocked"
77
+ set out to append(out, {"kind": "blocked", "agent": t["owner"], "task": t["id"], "text": "#" + text(t["id"]) + " is blocked: " + slice(t["notes"], 0, 240)})
78
+ -- el equipo cree que alguien se quedó sin presupuesto, pero con el objetivo con presupuesto sigue pudiendo
79
+ when left > 0 and matches(lower(t["notes"]), ".*(cap|presupuesto|budget|tokens|sin servicio|fuera de servicio).*")
80
+ set out to append(out, {"kind": "budget_belief", "agent": t["owner"], "task": t["id"], "text": "#" + text(t["id"]) + " waits for " + t["owner"] + " to have budget, but while this objective has budget left (" + text(left) + " tokens) every seat keeps getting turns, even past its daily cap"})
81
+ when t["status"] == "todo"
82
+ each d in json_decode(field(t, "depends", "[]"))
83
+ let x be teams.task_get(scope, floor(number(d)))
84
+ when x != nothing and x["status"] == "blocked"
85
+ set out to append(out, {"kind": "waits", "agent": t["owner"], "task": t["id"], "text": "#" + text(t["id"]) + " waits for #" + text(x["id"]) + ", which is blocked"})
86
+ each m in tm["members"]
87
+ let sid be teams.seat_session_of(o["id"], m["agent"])
88
+ let lt be last_turn(sid)
89
+ let mine be where(ts, (t) => t["owner"] == m["agent"] and t["status"] != "done")
90
+ when lt["said"] != "" and not contains(lt["calls"], "send") and lt["stopped"] == "done" and length(mine) > 0 and length(trim(lt["said"])) > 80
91
+ set out to append(out, {"kind": "unsent", "agent": m["agent"], "task": mine[0]["id"], "text": m["agent"] + " answered in its final reply, which nobody reads (it didn't `send` it): «" + slice(lt["said"], 0, 400) + "»"})
92
+ when lt["stopped"] == "max_steps" or lt["stopped"] == "budget"
93
+ set out to append(out, {"kind": "cut", "agent": m["agent"], "task": when length(mine) > 0 then mine[0]["id"] otherwise 0, "text": m["agent"] + "'s last turn was cut (" + lt["stopped"] + ")" + (when lt["said"] != "" then ": «" + slice(lt["said"], 0, 300) + "»" otherwise "")})
94
+ give out
95
+
96
+ -- el expediente para el modelo: el pedido, el equipo, el tablero, lo último del registro, el último turno de cada uno
97
+ task dossier(o, fs)
98
+ require db(".lampson/teams.db")
99
+ require time
100
+ require file(".lampson")
101
+ require file(".lampson/*")
102
+ require file.read("workspace")
103
+ require file.read("workspace/*")
104
+ let tm be teams.get(o["team"])
105
+ let scope be "team:" + tm["id"]
106
+ let ts be where(teams.tasks(scope), (t) => field(t, "objective", 0) == o["id"])
107
+ let seats be []
108
+ each m in tm["members"]
109
+ let lt be last_turn(teams.seat_session_of(o["id"], m["agent"]))
110
+ set seats to append(seats, "- " + m["agent"] + " (" + m["role"] + (when m["reports_to"] != "" then ", reports to " + m["reports_to"] otherwise ", lead") + ")" + (when mailbox.working(m["agent"], scope) then " — WORKING NOW" otherwise "") + " · today " + text(teams.spent_today(m["agent"])) + " of " + text(teams.cap_of(tm, m["agent"])) + " tokens" + "\n last turn: woken by «" + lt["trigger"] + "» · tools: " + (when length(lt["calls"]) == 0 then "none" otherwise join(lt["calls"], ", ")) + " · ended: " + lt["stopped"] + (when lt["said"] != "" then "\n its final reply (nobody reads it): «" + slice(lt["said"], 0, 500) + "»" otherwise ""))
111
+ let rows be teams.ledger(scope, 0, 400)
112
+ let mine be where(rows, (r) => r["at"] >= o["created_at"] - 2)
113
+ let lg be slice(mine, max(0, length(mine) - 40), length(mine))
114
+ give "OBJECTIVE O-" + text(o["id"]) + " [" + o["status"] + "] spent " + text(o["spent"]) + " of " + text(o["budget_tokens"]) + " tokens\n" + o["text"] + "\n\nSEATS\n" + join(seats, "\n") + "\n\nBOARD\n" + join(apply(ts, (t) => "#" + text(t["id"]) + " [" + t["status"] + "] " + t["title"] + " — " + t["owner"] + (when t["depends"] != "[]" then " · depends on " + t["depends"] otherwise "") + (when t["notes"] != "" then "\n notes: " + slice(t["notes"], 0, 300) otherwise "")), "\n") + "\n\nLAST RECORD ENTRIES\n" + join(apply(lg, (r) => format_time(r["at"], "%H:%M") + " " + r["actor"] + " " + r["kind"] + (when r["ref"] != "" then " " + r["ref"] otherwise "") + (when r["text"] != "" then ": " + slice(r["text"], 0, 260) otherwise "")), "\n") + "\n\nWHAT LAMPSON ALREADY SEES\n" + join(apply(fs, (f) => "- " + f["text"]), "\n") + "\n\nHOW THE TEAM RUNTIME WORKS\n- A seat only gets a turn when a message reaches it (`send`), when the lead's objective round comes, or when Lampson continues a turn that was cut. A seat's final reply is NOT delivered to anyone.\n- The daily cap does NOT stop a seat while the objective still has budget.\n- The person can send a message to any seat, and move tasks on the board."
115
+
116
+ -- el análisis con el modelo configurado. → {ok, summary, actions: [{kind: message|task, agent?, text?, task?, status?, why}]}
117
+ export task analysis(o)
118
+ require db(".lampson/teams.db")
119
+ require net
120
+ require time
121
+ require env("LAMPSON_*")
122
+ require secret("LAMPSON_*")
123
+ require file(".lampson")
124
+ require file(".lampson/*")
125
+ require file.read("workspace")
126
+ require file.read("workspace/*")
127
+ let fs be facts(o)
128
+ let cfg be provider.config()
129
+ let brief be "You are diagnosing why a team of AI agents is stuck on an objective. Read the dossier and answer ONLY with JSON, no prose around it:\n{\"summary\": \"<3 to 6 short sentences, in the same language as the objective text, for the person who owns the team: what happened, why it is stuck, what to do>\", \"actions\": [{\"kind\": \"message\", \"agent\": \"<seat id>\", \"text\": \"<the message the person sends that seat, in the objective's language, concrete: what is true, what to do now, who to tell>\", \"why\": \"<one line>\"}, {\"kind\": \"task\", \"task\": <id>, \"status\": \"todo|doing|review|done|blocked\", \"why\": \"<one line>\"}]}\nAt most 3 actions, the smallest set that gets the work moving again. Prefer messaging the seat that has to act. Don't invent facts that aren't in the dossier.\nA message action is sent BY the person TO that seat, as the person's instruction to the team: never write it as a summary or a question for the person. If the team is waiting for a decision only the person can make (an approval, a choice), don't propose a message or a task move for it: say in the summary what they have to decide and where (the approval waiting for them, or the objective's question). Move a task only when that move lets someone start real work; never to «reflect» who has the ball.\n\n" + dossier(o, fs)
130
+ let r be provider.chat_retry(cfg, [{"role": "system", "content": "You are a precise operations analyst. You answer with JSON only."}, {"role": "user", "content": brief}], [], 2)
131
+ when r["error"] != nothing
132
+ give {"ok": false, "error": text(r["error"]), "facts": fs}
133
+ let raw be text(r["text"])
134
+ let found be regex_find_all(raw, "(?s)\\{.*\\}")
135
+ when length(found) == 0
136
+ give {"ok": true, "summary": trim(raw), "actions": [], "facts": fs, "model": cfg["model"]}
137
+ try
138
+ let j be json_decode(found[0])
139
+ let acts be where(field(j, "actions", []), (x) => type_of(x) == "map" and (field(x, "kind", "") == "message" or field(x, "kind", "") == "task"))
140
+ give {"ok": true, "summary": text(field(j, "summary", "")), "actions": slice(acts, 0, 3), "facts": fs, "model": cfg["model"]}
141
+ recover err
142
+ give {"ok": true, "summary": trim(raw), "actions": [], "facts": fs, "model": cfg["model"]}
package/lib/loop.syn CHANGED
@@ -324,6 +324,12 @@ task execute(tc, opts, on_event)
324
324
  when verdict["decision"] == "deny"
325
325
  emit(on_event, "tool_denied", {"call": tc, "reason": verdict["reason"]}, tag)
326
326
  give "DENIED by policy (" + verdict["reason"] + "). Do not retry this exact action; explain or propose an alternative."
327
+ -- equipos: un asiento que no es el líder no le pregunta a la persona (lib/runtime.syn → escalate_to = su jefe). Lo
328
+ -- que necesita aprobación sube por la cadena: su jefe lo resuelve, o lo lleva hasta el líder, que es quien pregunta
329
+ let boss be when contains(opts, "escalate_to") and opts["escalate_to"] != nothing then text(opts["escalate_to"]) otherwise ""
330
+ when boss != "" and verdict["decision"] == "ask"
331
+ emit(on_event, "tool_denied", {"call": tc, "reason": "needs approval — goes up to " + boss + " (" + verdict["reason"] + ")"}, tag)
332
+ give "NOT RUN: this needs approval (" + verdict["reason"] + "), and in a team approvals go up the chain of command — you don't ask the person. Ask your boss " + boss + " with `send`: say exactly what you want to run and why. They will do it, find another way, or take it up to the lead, who is the only one who asks the person."
327
333
  when verdict["decision"] == "ask"
328
334
  let approved be false
329
335
  let expired be false
@@ -431,6 +437,14 @@ export task run_turn(cfg, messages, opts, on_event)
431
437
  set nudged to true
432
438
  set msgs to noted["msgs"]
433
439
  emit(on_event, "inbox", "presupuesto de tokens al 80% (" + text(spent) + "/" + text(floor(budget)) + "): el harness le pidió al modelo que cierre", tag)
440
+ -- pocos pasos antes del límite, un aviso (una vez): que deje las cosas en orden antes de que se corte — guardar
441
+ -- lo hecho y, en un equipo, contar dónde quedó (visto 2026-10-18: el Dev llegó a 25 pasos a mitad de una tarea,
442
+ -- sin commit ni aviso, y el equipo quedó esperándolo)
443
+ when max_steps > 8 and steps == max_steps - 3
444
+ let wrap be append_to_last_tool(msgs, "[SYSTEM NOTICE — 3 tool calls left in this turn] Finish the step you are on and leave your work in order: save/commit what you have, and if you are in a team, update the board and `send` your status (what is done, what is left). If the work isn't finished, you get a new turn to continue where you left off.")
445
+ when wrap["ok"]
446
+ set msgs to wrap["msgs"]
447
+ emit(on_event, "inbox", "quedan 3 pasos en este turno: el harness le pidió que deje todo en orden", tag)
434
448
  let over_budget be spent >= budget * 0.95
435
449
  let last_step be steps == max_steps or over_budget
436
450
  let cat be when last_step then [] otherwise catalog
package/lib/plugins.syn CHANGED
@@ -14,8 +14,10 @@
14
14
  -- "instructions": "INSTRUCTIONS.md" (opcional: cómo usar sus tools — texto, o un .md de su carpeta;
15
15
  -- sin el campo, INSTRUCTIONS.md si existe. Va al prompt de cada
16
16
  -- agente que tenga alguna de sus tools: el plugin trae su proceso)
17
- -- "channel": {"agent": "tienda"}} (opcional: un CANAL — lib/channels.syn. Sus acciones `receive` y
17
+ -- "channel": {"agent": "tienda"}, (opcional: un CANAL — lib/channels.syn. Sus acciones `receive` y
18
18
  -- `send` no son tools del modelo, así que un canal puede no tener tools)
19
+ -- "example": true} (opcional: una plantilla para copiar — plugins/example-hello. Funciona
20
+ -- igual, pero las UIs no la muestran entre los plugins para usar)
19
21
  --
20
22
  -- Cómo corre (patrón "safe runner" de la doc 22-sandbox): cada llamada es UN proceso hijo que termina.
21
23
  -- kind=syn → `synsema run --cap-set stdout,time,env=PLUGIN_*[,caps] <entry>`: el techo lo fija el
@@ -116,7 +118,7 @@ task read_manifest(dir, name, scope, legacy)
116
118
  set instr to trim(ifile)
117
119
  when length(instr) > MAX_INSTRUCTIONS
118
120
  set instr to slice(instr, 0, MAX_INSTRUCTIONS)
119
- give {"ok": true, "name": name, "scope": scope, "legacy": is_legacy, "plugin": {"instructions": instr,"name": name, "scope": scope, "dir": dir + "/" + name, "kind": kind, "legacy": is_legacy, "description": when contains(doc, "description") then text(doc["description"]) otherwise "", "entry": when contains(doc, "entry") then text(doc["entry"]) otherwise "", "command": when contains(doc, "command") then text(doc["command"]) otherwise "", "caps": when contains(doc, "caps") then text(doc["caps"]) otherwise "", "timeout": when contains(doc, "timeout") then floor(number(doc["timeout"])) otherwise DEFAULT_TIMEOUT, "tools": tools, "channel": channel, "config": config}}
121
+ give {"ok": true, "name": name, "scope": scope, "legacy": is_legacy, "plugin": {"instructions": instr,"name": name, "scope": scope, "dir": dir + "/" + name, "kind": kind, "legacy": is_legacy, "description": when contains(doc, "description") then text(doc["description"]) otherwise "", "entry": when contains(doc, "entry") then text(doc["entry"]) otherwise "", "command": when contains(doc, "command") then text(doc["command"]) otherwise "", "caps": when contains(doc, "caps") then text(doc["caps"]) otherwise "", "timeout": when contains(doc, "timeout") then floor(number(doc["timeout"])) otherwise DEFAULT_TIMEOUT, "tools": tools, "channel": channel, "config": config, "example": contains(doc, "example") and doc["example"] == true}}
120
122
 
121
123
  task scan(dir, scope, legacy)
122
124
  let out be []
@@ -168,7 +170,7 @@ export task all()
168
170
  set l["error"] to nothing
169
171
  set out to append(out, l)
170
172
  otherwise
171
- set out to append(out, {"name": n, "scope": r["scope"], "dir": "", "kind": "?", "legacy": r["legacy"], "description": "", "entry": "", "command": "", "caps": "", "timeout": 0, "tools": [], "channel": nothing, "config": [], "instructions": "", "enabled": false, "error": r["error"]})
173
+ set out to append(out, {"name": n, "scope": r["scope"], "dir": "", "kind": "?", "legacy": r["legacy"], "description": "", "entry": "", "command": "", "caps": "", "timeout": 0, "tools": [], "channel": nothing, "config": [], "instructions": "", "enabled": false, "error": r["error"], "example": false})
172
174
  give out
173
175
 
174
176
  export task enabled()
@@ -491,5 +493,5 @@ export task summary()
491
493
  require env("LAMPSON_*")
492
494
  let out be []
493
495
  each l in all()
494
- set out to append(out, {"name": l["name"], "scope": l["scope"], "kind": l["kind"], "legacy": l["legacy"], "description": l["description"], "enabled": l["enabled"], "error": l["error"], "caps": when l["kind"] == "syn" and l["error"] == nothing then ceiling_of(l) otherwise "", "command": when l["kind"] == "exec" then l["command"] otherwise "", "tools": apply(l["tools"], (t) => t["name"]), "tool_specs": l["tools"], "dir": l["dir"], "channel": l["channel"] != nothing})
496
+ set out to append(out, {"name": l["name"], "scope": l["scope"], "kind": l["kind"], "legacy": l["legacy"], "description": l["description"], "enabled": l["enabled"], "error": l["error"], "caps": when l["kind"] == "syn" and l["error"] == nothing then ceiling_of(l) otherwise "", "command": when l["kind"] == "exec" then l["command"] otherwise "", "tools": apply(l["tools"], (t) => t["name"]), "tool_specs": l["tools"], "dir": l["dir"], "channel": l["channel"] != nothing, "example": l["example"]})
495
497
  give out