lampson 0.5.1 → 0.5.3

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 (84) hide show
  1. package/README.md +2 -0
  2. package/chat.syn +17 -12
  3. package/cli.syn +8 -1
  4. package/hub.tpl.syn +4 -4
  5. package/lampson.ps1 +2 -2
  6. package/lampson.sh +7 -4
  7. package/lib/agents.syn +35 -27
  8. package/lib/api.syn +37 -35
  9. package/lib/apikeys.syn +8 -8
  10. package/lib/approvals.syn +11 -7
  11. package/lib/apptools.syn +27 -24
  12. package/lib/channels.syn +38 -36
  13. package/lib/computer.syn +20 -20
  14. package/lib/diagnose.syn +9 -7
  15. package/lib/fs.syn +11 -11
  16. package/lib/judge.syn +4 -4
  17. package/lib/loop.syn +46 -21
  18. package/lib/lsp.syn +13 -13
  19. package/lib/mailbox.syn +34 -24
  20. package/lib/mcp.syn +25 -17
  21. package/lib/mcp_server.syn +34 -26
  22. package/lib/permission.syn +3 -1
  23. package/lib/plugins.syn +48 -40
  24. package/lib/prompt.syn +5 -5
  25. package/lib/provider.syn +25 -11
  26. package/lib/remotetools.syn +3 -1
  27. package/lib/runtime.syn +112 -85
  28. package/lib/sched_run.syn +19 -13
  29. package/lib/schedule.syn +25 -23
  30. package/lib/session.syn +6 -6
  31. package/lib/settings.syn +10 -10
  32. package/lib/skills.syn +9 -9
  33. package/lib/teamrun.syn +75 -28
  34. package/lib/teams.syn +190 -115
  35. package/lib/term.syn +2 -2
  36. package/lib/tools/bash.syn +2 -2
  37. package/lib/tools/common.syn +3 -3
  38. package/lib/tools/edit.syn +1 -1
  39. package/lib/tools/fetch.syn +7 -3
  40. package/lib/tools/find.syn +1 -1
  41. package/lib/tools/grep.syn +2 -2
  42. package/lib/tools/ls.syn +1 -1
  43. package/lib/tools/memo.syn +7 -7
  44. package/lib/tools/proc.syn +10 -10
  45. package/lib/tools/process.syn +1 -1
  46. package/lib/tools/read.syn +2 -2
  47. package/lib/tools/todo.syn +3 -3
  48. package/lib/tools/write.syn +1 -1
  49. package/lib/tools.syn +17 -15
  50. package/lib/trace.syn +5 -5
  51. package/lib/tree.syn +3 -3
  52. package/lib/update.syn +6 -0
  53. package/lib/workspaces.syn +25 -25
  54. package/lib/worktree.syn +323 -24
  55. package/package.json +2 -2
  56. package/plugins/chatwoot/plugin.syn +2 -0
  57. package/plugins/orders/plugin.json +1 -1
  58. package/plugins/orders/plugin.syn +1 -1
  59. package/plugins/telegram/plugin.syn +2 -0
  60. package/public/css/inbox.css +100 -0
  61. package/public/css/mobile.css +0 -13
  62. package/public/css/panel.css +21 -0
  63. package/public/css/teams.css +20 -52
  64. package/public/hub.html +3 -0
  65. package/public/index.html +3 -0
  66. package/public/js/config.js +3 -3
  67. package/public/js/devices.js +1 -1
  68. package/public/js/hub.js +3 -2
  69. package/public/js/inbox.js +234 -0
  70. package/public/js/navtabs.js +1 -6
  71. package/public/js/objlive.js +11 -3
  72. package/public/js/panel.js +12 -6
  73. package/public/js/teams-home.js +3 -33
  74. package/public/js/teams.js +35 -114
  75. package/public/js/workspaces.js +1 -1
  76. package/public/plugins-home.html +3 -0
  77. package/public/tasks-home.html +3 -0
  78. package/public/teams-home.html +3 -1
  79. package/public/teams.html +3 -2
  80. package/run.syn +17 -12
  81. package/sdk/index.d.ts +1 -1
  82. package/sdk/index.js +51 -8
  83. package/skills/synsema/SKILL.md +3 -3
  84. package/web.syn +10 -7
package/lib/diagnose.syn CHANGED
@@ -22,7 +22,7 @@ task field(m, k, fallback)
22
22
  -- el último turno de una sesión, leído de su traza: {calls: [nombres], said, stopped, at}
23
23
  export task last_turn(sid)
24
24
  require file(".lampson")
25
- require file(".lampson/*")
25
+ require file(".lampson/**")
26
26
  let out be {"calls": [], "said": "", "stopped": "", "trigger": ""}
27
27
  when sid == ""
28
28
  give out
@@ -58,9 +58,9 @@ export task facts(o)
58
58
  require db(".lampson/teams.db")
59
59
  require time
60
60
  require file(".lampson")
61
- require file(".lampson/*")
61
+ require file(".lampson/**")
62
62
  require file.read("workspace")
63
- require file.read("workspace/*")
63
+ require file.read("workspace/**")
64
64
  let out be []
65
65
  let tm be teams.get(o["team"])
66
66
  when tm == nothing
@@ -98,9 +98,9 @@ task dossier(o, fs)
98
98
  require db(".lampson/teams.db")
99
99
  require time
100
100
  require file(".lampson")
101
- require file(".lampson/*")
101
+ require file(".lampson/**")
102
102
  require file.read("workspace")
103
- require file.read("workspace/*")
103
+ require file.read("workspace/**")
104
104
  let tm be teams.get(o["team"])
105
105
  let scope be "team:" + tm["id"]
106
106
  let ts be where(teams.tasks(scope), (t) => field(t, "objective", 0) == o["id"])
@@ -117,13 +117,15 @@ task dossier(o, fs)
117
117
  export task analysis(o)
118
118
  require db(".lampson/teams.db")
119
119
  require net
120
+ require net("0.0.0.0/0")
121
+ require net("::/0")
120
122
  require time
121
123
  require env("LAMPSON_*")
122
124
  require secret("LAMPSON_*")
123
125
  require file(".lampson")
124
- require file(".lampson/*")
126
+ require file(".lampson/**")
125
127
  require file.read("workspace")
126
- require file.read("workspace/*")
128
+ require file.read("workspace/**")
127
129
  let fs be facts(o)
128
130
  let cfg be provider.config()
129
131
  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)
package/lib/fs.syn CHANGED
@@ -34,7 +34,7 @@ task sh(cmd)
34
34
  -- path del navegador → {rel (como lo ve el modelo, "." = raíz), real ("workspace/…"), info}
35
35
  task target(path)
36
36
  require file.read("workspace")
37
- require file.read("workspace/*")
37
+ require file.read("workspace/**")
38
38
  let real be c.ws(path)
39
39
  give {"rel": c.unws(real), "real": real, "info": file_info(real)}
40
40
 
@@ -65,7 +65,7 @@ task must_exist(t)
65
65
 
66
66
  task must_not_exist(rel)
67
67
  require file.read("workspace")
68
- require file.read("workspace/*")
68
+ require file.read("workspace/**")
69
69
  when file_exists(c.ROOT + "/" + rel)
70
70
  raise("\"" + rel + "\" already exists")
71
71
 
@@ -86,7 +86,7 @@ export task mkdir(dir, name)
86
86
  require env("LAMPSON_*")
87
87
  require env("OS")
88
88
  require file("workspace")
89
- require file("workspace/*")
89
+ require file("workspace/**")
90
90
  let t be target(dir)
91
91
  let rel be join_rel(t["rel"], check_name(name))
92
92
  must_not_exist(rel)
@@ -95,7 +95,7 @@ export task mkdir(dir, name)
95
95
 
96
96
  export task create(dir, name, content)
97
97
  require file("workspace")
98
- require file("workspace/*")
98
+ require file("workspace/**")
99
99
  let t be target(dir)
100
100
  let rel be join_rel(t["rel"], check_name(name))
101
101
  must_not_exist(rel)
@@ -107,7 +107,7 @@ export task create(dir, name, content)
107
107
  -- servidor no guarda estado por archivo.
108
108
  export task write(path, content)
109
109
  require file("workspace")
110
- require file("workspace/*")
110
+ require file("workspace/**")
111
111
  let t be target(path)
112
112
  must_exist(t)
113
113
  when t["info"]["is_dir"]
@@ -121,7 +121,7 @@ export task rename(path, name)
121
121
  require env("LAMPSON_*")
122
122
  require env("OS")
123
123
  require file("workspace")
124
- require file("workspace/*")
124
+ require file("workspace/**")
125
125
  let t be target(path)
126
126
  must_exist(t)
127
127
  when t["rel"] == "."
@@ -143,7 +143,7 @@ export task move(path, to_dir)
143
143
  require env("LAMPSON_*")
144
144
  require env("OS")
145
145
  require file("workspace")
146
- require file("workspace/*")
146
+ require file("workspace/**")
147
147
  let t be target(path)
148
148
  must_exist(t)
149
149
  when t["rel"] == "."
@@ -162,7 +162,7 @@ export task move(path, to_dir)
162
162
  -- "b.ts" en `dir` → "b copy.ts", "b copy 2.ts"…; carpetas y dotfiles: "sub copy", ".env copy"
163
163
  task copy_name(dir, base)
164
164
  require file.read("workspace")
165
- require file.read("workspace/*")
165
+ require file.read("workspace/**")
166
166
  let stem be base
167
167
  let ext be ""
168
168
  let parts be split(base, ".")
@@ -182,7 +182,7 @@ export task copy(path, to_dir)
182
182
  require env("LAMPSON_*")
183
183
  require env("OS")
184
184
  require file("workspace")
185
- require file("workspace/*")
185
+ require file("workspace/**")
186
186
  let t be target(path)
187
187
  must_exist(t)
188
188
  when t["rel"] == "."
@@ -203,7 +203,7 @@ export task remove(path)
203
203
  require env("LAMPSON_*")
204
204
  require env("OS")
205
205
  require file("workspace")
206
- require file("workspace/*")
206
+ require file("workspace/**")
207
207
  let t be target(path)
208
208
  must_exist(t)
209
209
  when t["rel"] == "."
@@ -219,7 +219,7 @@ export task apply(b)
219
219
  require env("LAMPSON_*")
220
220
  require env("OS")
221
221
  require file("workspace")
222
- require file("workspace/*")
222
+ require file("workspace/**")
223
223
  let op be when contains(b, "op") then lower(text(b["op"])) otherwise ""
224
224
  let path be when contains(b, "path") then text(b["path"]) otherwise "."
225
225
  let name be when contains(b, "name") then b["name"] otherwise nothing
package/lib/judge.syn CHANGED
@@ -30,14 +30,14 @@ export task norm_mode(v)
30
30
  -- el modo configurado (config.json / .env), esté vivo o no en este proceso
31
31
  export task mode()
32
32
  require file.read(".lampson")
33
- require file.read(".lampson/*")
33
+ require file.read(".lampson/**")
34
34
  require env("LAMPSON_*")
35
35
  give norm_mode(settings.judge_setting()["mode"])
36
36
 
37
37
  -- encendido en la configuración Y con un proveedor vivo en este proceso: la compuerta de quien lo use
38
38
  export task on()
39
39
  require file.read(".lampson")
40
- require file.read(".lampson/*")
40
+ require file.read(".lampson/**")
41
41
  require env("LAMPSON_*")
42
42
  when mode() == "off"
43
43
  give false
@@ -46,7 +46,7 @@ export task on()
46
46
  -- {mode, model_setting, has_key, live, provider_model, restart, from_env}: lo que ven la UI y /judge
47
47
  export task status()
48
48
  require file.read(".lampson")
49
- require file.read(".lampson/*")
49
+ require file.read(".lampson/**")
50
50
  require env("LAMPSON_*")
51
51
  let js be settings.judge_setting()
52
52
  let m be norm_mode(js["mode"])
@@ -65,7 +65,7 @@ export task status()
65
65
  -- guardar el modo (y opcionalmente el modelo / la key de TypeSafe) → {ok, error}
66
66
  export task configure(m, model, key)
67
67
  require file(".lampson")
68
- require file(".lampson/*")
68
+ require file(".lampson/**")
69
69
  require env("LAMPSON_*")
70
70
  let nm be lower(trim(text(m)))
71
71
  when not contains(MODES, nm) and nm != "typesafe" and nm != "local"
package/lib/loop.syn CHANGED
@@ -119,7 +119,7 @@ task safe_id(id, step)
119
119
  -- cabeza + cola, el resto a disco
120
120
  export task spill(name, id, out)
121
121
  require file(".lampson")
122
- require file(".lampson/*")
122
+ require file(".lampson/**")
123
123
  -- read y fetch se recortan solas (fetch: cabeza+cola con el texto completo ya en .lampson/spill)
124
124
  when name == "read" or name == "fetch" or length(out) <= SPILL_CAP
125
125
  give out
@@ -222,6 +222,8 @@ export task estimate_tokens(messages)
222
222
  -- resume todo menos el system y los últimos `keep_last` mensajes en un único mensaje user.
223
223
  export task compact(cfg, messages, keep_last)
224
224
  require net
225
+ require net("0.0.0.0/0")
226
+ require net("::/0")
225
227
  require time
226
228
  let n be length(messages)
227
229
  when n <= keep_last + 2
@@ -317,26 +319,36 @@ task execute(tc, opts, on_event)
317
319
  let verdict be permission.evaluate(name, args, when forced == "auto" then "yolo" otherwise opts["permission_mode"])
318
320
  when forced == "ask" and verdict["decision"] == "allow"
319
321
  set verdict to {"decision": "ask", "reason": "this agent asks before every " + name + " call"}
320
- -- equipos (lib/worktree.syn): el agente trabaja en SU copia; tocar la historia compartida (merge a main, push…)
321
- -- lo aprueba siempre la persona, en cualquier modo (salvo lo prohibido, que sigue prohibido)
322
+ -- equipos con git (lib/worktree.syn, la regla del asiento): una organización. En SU copia el asiento tiene
323
+ -- autonomía total, sin preguntar; la persona es el directorio y aprueba solo el borde: integrar a la rama principal
324
+ -- (una vez por objetivo) y el push. Lo que no es de su puesto no corre, con un mensaje que dice por qué. Lo prohibido
325
+ -- sigue prohibido; un asiento strict sigue sin hacer lo peligroso; una tool con approve: ask sigue preguntando.
322
326
  let wroot be when contains(opts, "root") and opts["root"] != nothing then text(opts["root"]) otherwise ""
323
- when wroot != "" and name == "bash" and verdict["decision"] != "deny"
324
- let shared be worktree.touches_shared(when contains(args, "command") then args["command"] otherwise "")
325
- when shared != ""
326
- set verdict to {"decision": "ask", "reason": "touches the shared history (" + shared + ") — the person approves · agent " + (when contains(opts, "agent_id") then text(opts["agent_id"]) otherwise "?")}
327
+ let seat be when wroot != "" and contains(opts, "seat") then opts["seat"] otherwise nothing
328
+ let grant be false
329
+ when seat != nothing and (name == "bash" or name == "process" or contains(worktree.FILE_TOOLS, name)) and not starts_with(verdict["reason"], "hardline")
330
+ let me be seat
331
+ set me["integration_ok"] to worktree.integration_ok(seat)
332
+ let sv be when name == "bash" or name == "process" then worktree.seat_bash(when contains(args, "command") and args["command"] != nothing then args["command"] otherwise "", me) otherwise worktree.seat_file(name, args, me)
333
+ when sv["decision"] != "allow"
334
+ set verdict to sv
335
+ set grant to sv["grant"]
336
+ otherwise when forced != "ask" and not (opts["permission_mode"] == "strict" and verdict["decision"] == "deny")
337
+ set verdict to sv
327
338
  when verdict["decision"] == "deny"
328
339
  emit(on_event, "tool_denied", {"call": tc, "reason": verdict["reason"]}, tag)
340
+ when contains(verdict, "note") and verdict["note"] != ""
341
+ give verdict["note"]
329
342
  give "DENIED by policy (" + verdict["reason"] + "). Do not retry this exact action; explain or propose an alternative."
330
- -- equipos: un asiento que no es el líder no le pregunta a la persona (lib/runtime.syn → escalate_to = su jefe). Lo
331
- -- que necesita aprobación sube por la cadena: su jefe lo resuelve, o lo lleva hasta el líder, que es quien pregunta
332
- let boss be when contains(opts, "escalate_to") and opts["escalate_to"] != nothing then text(opts["escalate_to"]) otherwise ""
333
- when boss != "" and verdict["decision"] == "ask"
334
- emit(on_event, "tool_denied", {"call": tc, "reason": "needs approval — goes up to " + boss + " (" + verdict["reason"] + ")"}, tag)
335
- 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."
343
+ -- en un equipo, lo que de verdad necesita aprobación va directo a la persona, con quién lo pide (antes subía de jefe
344
+ -- en jefe por mensajes: ningún agente puede aprobar, y cada salto costaba un turno)
345
+ when verdict["decision"] == "ask" and contains(opts, "scope") and starts_with(text(opts["scope"]), "team:")
346
+ set verdict["reason"] to verdict["reason"] + " · agent " + (when contains(opts, "agent_id") then text(opts["agent_id"]) otherwise "?")
336
347
  when verdict["decision"] == "ask"
337
348
  let approved be false
338
349
  let expired be false
339
350
  let waited_min be 0
351
+ let once be false
340
352
  when opts["ask_fn"] != nothing
341
353
  let ans be call(opts["ask_fn"], {"name": name, "args": args, "why": verdict["reason"]})
342
354
  -- la cola de aprobaciones (lib/mailbox.syn) dice además si nadie respondió; la terminal y el chat dan un bool
@@ -344,6 +356,7 @@ task execute(tc, opts, on_event)
344
356
  set approved to ans["approved"] == true
345
357
  set expired to ans["expired"] == true
346
358
  set waited_min to ans["minutes"]
359
+ set once to contains(ans, "once") and ans["once"] == true
347
360
  otherwise
348
361
  set approved to ans == true
349
362
  when not approved and expired
@@ -352,9 +365,13 @@ task execute(tc, opts, on_event)
352
365
  when not approved
353
366
  emit(on_event, "tool_denied", {"call": tc, "reason": "user declined (" + verdict["reason"] + ")"}, tag)
354
367
  give "DENIED by the user (" + verdict["reason"] + "). Do not retry this exact action; ask the user or propose an alternative."
368
+ -- la persona aprobó integrar este objetivo: los merges siguientes del mismo objetivo ya no preguntan
369
+ -- (salvo que haya dicho «solo esta vez»)
370
+ when grant and not once
371
+ worktree.grant_integration(seat)
355
372
  emit(on_event, "busy", {"label": permission.describe_call(name, args), "kind": "tool", "name": name}, tag)
356
373
  -- su copia: las tools de archivos y bash operan ahí; los paths que ve el modelo son relativos a ella
357
- when wroot != "" and (name == "bash" or contains(worktree.FILE_TOOLS, name))
374
+ when wroot != "" and (name == "bash" or name == "process" or contains(worktree.FILE_TOOLS, name))
358
375
  set args to worktree.rooted(name, args, wroot)
359
376
  let out be ""
360
377
  try
@@ -391,10 +408,12 @@ task execute(tc, opts, on_event)
391
408
 
392
409
  export task run_turn(cfg, messages, opts, on_event)
393
410
  require net
411
+ require net("0.0.0.0/0")
412
+ require net("::/0")
394
413
  require time
395
414
  require env("LAMPSON_*")
396
415
  require file(".lampson")
397
- require file(".lampson/*")
416
+ require file(".lampson/**")
398
417
  let msgs be messages
399
418
  let steps be 0
400
419
  let spent be 0
@@ -460,12 +479,11 @@ export task run_turn(cfg, messages, opts, on_event)
460
479
  emit(on_event, "inbox", "quedan 3 pasos en este turno: el harness le pidió que deje todo en orden", tag)
461
480
  let over_budget be spent >= budget * 0.95
462
481
  let last_step be steps == max_steps or over_budget
463
- let cat be when last_step then [] otherwise catalog
464
482
  when last_step
465
483
  let why be when over_budget then "Token budget for this turn is exhausted (" + text(spent) + " of " + text(floor(budget)) + " tokens)" otherwise "Step limit reached for this turn (" + text(max_steps) + " tool calls)"
466
484
  set msgs to append(msgs, {"role": "user", "content": "[harness] " + why + ". Do NOT call tools now. Reply with a short status: what you completed, what is verified, and exactly what remains to do next. The user can say 'continue' to resume."})
467
485
  emit(on_event, "busy", {"label": "pensando", "kind": "llm"}, tag)
468
- let r be provider.chat_retry(cfg, msgs, cat, 3)
486
+ let r be provider.chat_retry(cfg, msgs, catalog, 3)
469
487
  emit(on_event, "idle", nothing, tag)
470
488
  when r["error"] != nothing
471
489
  emit(on_event, "error", r["error"], tag)
@@ -478,7 +496,14 @@ export task run_turn(cfg, messages, opts, on_event)
478
496
  set spent to spent + provider.cost_tokens(r["usage"])
479
497
  emit(on_event, "usage", {"step": steps, "usage": r["usage"], "total": usage}, tag)
480
498
  let clean_text be strip_raw_tool_calls(r["text"])
481
- let assistant be {"role": "assistant", "content": clean_text, "tool_calls": r["tool_calls"]}
499
+ -- el último paso manda el MISMO catálogo: los tools van primero en el prefijo y cambiarlos tira el caché
500
+ -- de prompt entero justo cuando el contexto es más grande (tool_choice "none" en Anthropic igual pierde el
501
+ -- de mensajes, que es lo grande; deepseek-harness también repite el prefijo idéntico). Si llama tools igual, no corren
502
+ let calls be r["tool_calls"]
503
+ when last_step and length(calls) > 0
504
+ emit(on_event, "inbox", "último paso: el modelo pidió " + text(length(calls)) + " tool(s) igual; no se ejecutan", tag)
505
+ set calls to []
506
+ let assistant be {"role": "assistant", "content": clean_text, "tool_calls": calls}
482
507
  -- razonamiento del paso (solo lo trae el wire para los presets glm): va en el mensaje para
483
508
  -- devolvérselo al modelo en el paso siguiente (thinking conservado, ver provider.chat_openai)
484
509
  when contains(r, "reasoning")
@@ -491,7 +516,7 @@ export task run_turn(cfg, messages, opts, on_event)
491
516
  -- nuevos, esa respuesta ya está vieja (visto 2026-10-16: «soy Lucía» llegó a mitad de turno y salió «decime
492
517
  -- tu nombre»). Se descarta el borrador, entran los mensajes y el modelo responde de nuevo — un paso más.
493
518
  let late be nothing
494
- when length(r["tool_calls"]) == 0 and not last_step and contains(opts, "inbox_final") and opts["inbox_final"] == true and opts["inbox_fn"] != nothing
519
+ when length(calls) == 0 and not last_step and contains(opts, "inbox_final") and opts["inbox_final"] == true and opts["inbox_fn"] != nothing
495
520
  set late to call(opts["inbox_fn"], {"step": steps, "tag": tag})
496
521
  when late != nothing and length(late["messages"]) > 0
497
522
  set msgs to slice(msgs, 0, length(msgs) - 1)
@@ -499,10 +524,10 @@ export task run_turn(cfg, messages, opts, on_event)
499
524
  each m in late["messages"]
500
525
  emit(on_event, "inbox", m, tag)
501
526
  set msgs to append(msgs, {"role": "user", "content": m})
502
- otherwise when length(r["tool_calls"]) == 0
527
+ otherwise when length(calls) == 0
503
528
  set final_text to clean_text
504
529
  give {"messages": msgs, "text": final_text, "steps": steps, "usage": usage, "stopped": when over_budget then "budget" otherwise (when last_step then "max_steps" otherwise "done")}
505
- each tc in r["tool_calls"]
530
+ each tc in calls
506
531
  emit(on_event, "tool_call", tc, tag)
507
532
  -- repetición: misma tool + mismos args (JSON canónico); 3 y 5 → recordatorio en el resultado; 8 → rechazo
508
533
  let sig be tc["name"] + " " + canon(tc["args"])
package/lib/lsp.syn CHANGED
@@ -70,9 +70,9 @@ task read_config(path, scope)
70
70
  -- servers configurados: proyecto pisa a global por nombre. LAMPSON_LSP_CONFIG = un archivo extra (tests).
71
71
  export task servers()
72
72
  require file(".lampson")
73
- require file(".lampson/*")
73
+ require file(".lampson/**")
74
74
  require file("workspace")
75
- require file("workspace/*")
75
+ require file("workspace/**")
76
76
  require env("LAMPSON_*")
77
77
  let by_name be {}
78
78
  each s in read_config(GLOBAL_CONFIG, "global")
@@ -133,9 +133,9 @@ task ext_of(path)
133
133
  -- server para un archivo (por extensión) o nothing
134
134
  export task server_for(path)
135
135
  require file(".lampson")
136
- require file(".lampson/*")
136
+ require file(".lampson/**")
137
137
  require file("workspace")
138
- require file("workspace/*")
138
+ require file("workspace/**")
139
139
  require env("LAMPSON_*")
140
140
  let ext be ext_of(path)
141
141
  each s in servers()
@@ -151,7 +151,7 @@ agent LspSup
151
151
  require env("LAMPSON_*")
152
152
  require env("OS")
153
153
  require file("workspace")
154
- require file("workspace/*")
154
+ require file("workspace/**")
155
155
  let key be "lsp:" + name
156
156
  let args be json_decode(args_json)
157
157
  let envs be json_decode(env_json)
@@ -333,9 +333,9 @@ export task query(op, path, line, character)
333
333
  require env("LAMPSON_*")
334
334
  require env("OS")
335
335
  require file(".lampson")
336
- require file(".lampson/*")
336
+ require file(".lampson/**")
337
337
  require file("workspace")
338
- require file("workspace/*")
338
+ require file("workspace/**")
339
339
  let found be server_for(path)
340
340
  when found == nothing
341
341
  let have be apply(servers(), (s) => s["name"] + " (" + join(keys(s["languages"]), " ") + ")")
@@ -444,9 +444,9 @@ task config_path(scope)
444
444
  -- {".x": "xlang"}, scope) uno propio
445
445
  export task add_server(name, command_line, languages, scope)
446
446
  require file(".lampson")
447
- require file(".lampson/*")
447
+ require file(".lampson/**")
448
448
  require file("workspace")
449
- require file("workspace/*")
449
+ require file("workspace/**")
450
450
  require env("LAMPSON_*")
451
451
  when not valid_name(name)
452
452
  raise("invalid server name (letters, digits, - or _)")
@@ -475,9 +475,9 @@ export task add_server(name, command_line, languages, scope)
475
475
 
476
476
  export task remove_server(name)
477
477
  require file(".lampson")
478
- require file(".lampson/*")
478
+ require file(".lampson/**")
479
479
  require file("workspace")
480
- require file("workspace/*")
480
+ require file("workspace/**")
481
481
  require env("LAMPSON_*")
482
482
  let removed be false
483
483
  each path in [GLOBAL_CONFIG, PROJECT_CONFIG]
@@ -501,9 +501,9 @@ export task remove_server(name)
501
501
  -- resumen para UI/terminal
502
502
  export task summary()
503
503
  require file(".lampson")
504
- require file(".lampson/*")
504
+ require file(".lampson/**")
505
505
  require file("workspace")
506
- require file("workspace/*")
506
+ require file("workspace/**")
507
507
  require env("LAMPSON_*")
508
508
  let out be []
509
509
  each s in servers()
package/lib/mailbox.syn CHANGED
@@ -156,7 +156,7 @@ task job_path(id)
156
156
 
157
157
  export task job(id)
158
158
  require file.read(".lampson")
159
- require file.read(".lampson/*")
159
+ require file.read(".lampson/**")
160
160
  when not matches(id, "m[0-9a-zA-Z_-]{4,40}")
161
161
  give nothing
162
162
  try
@@ -166,16 +166,18 @@ export task job(id)
166
166
 
167
167
  export task save_job(j)
168
168
  require file(".lampson")
169
- require file(".lampson/*")
169
+ require file(".lampson/**")
170
170
  write_file(job_path(j["job"]), json_encode(j))
171
171
 
172
172
  -- firma: con el secreto de la key que pidió la callback (apikeys, desde 2026-10-18) y si no tiene, el global de
173
173
  -- antes. X-Lampson-Key dice cuál: la app verifica con el secreto de esa key (Lampson.verifySignature del SDK)
174
174
  task post_callback(url, payload, key_id)
175
175
  require net
176
+ require net("0.0.0.0/0")
177
+ require net("::/0")
176
178
  require env("LAMPSON_*")
177
179
  require file.read(".lampson")
178
- require file.read(".lampson/*")
180
+ require file.read(".lampson/**")
179
181
  let body be json_encode(payload)
180
182
  let headers be {"Content-Type": "application/json", "User-Agent": "lampson"}
181
183
  let sec be when key_id != "" then apikeys.signing_secret(key_id) otherwise ""
@@ -203,9 +205,11 @@ export task approve_queue(name, args, why)
203
205
  require time
204
206
  require random
205
207
  require net
208
+ require net("0.0.0.0/0")
209
+ require net("::/0")
206
210
  require env("LAMPSON_*")
207
211
  require file.read(".lampson")
208
- require file.read(".lampson/*")
212
+ require file.read(".lampson/**")
209
213
  -- tocar la historia compartida (merge a main desde la copia de un agente): la persona tiene 30 min, no 3
210
214
  let tmo be when contains(text(why), "shared history") then 1800 otherwise APPROVAL_TIMEOUT
211
215
  let id be approvals.open("api", permission.describe_call(name, args), why, tmo)
@@ -230,21 +234,23 @@ task user_msg(it)
230
234
  task run_batch(k, spec, items)
231
235
  require db(".lampson/teams.db")
232
236
  require net
237
+ require net("0.0.0.0/0")
238
+ require net("::/0")
233
239
  require exec
234
240
  require time
235
241
  require random
236
242
  require file(".lampson")
237
- require file(".lampson/*")
243
+ require file(".lampson/**")
238
244
  require file("workspace")
239
- require file("workspace/*")
245
+ require file("workspace/**")
240
246
  require file.read("skills")
241
- require file.read("skills/*")
247
+ require file.read("skills/**")
242
248
  require file.read("plugins")
243
- require file.read("plugins/*")
249
+ require file.read("plugins/**")
244
250
  require file.read("agents")
245
- require file.read("agents/*")
251
+ require file.read("agents/**")
246
252
  require file.read("memory")
247
- require file.read("memory/*")
253
+ require file.read("memory/**")
248
254
  require env("LAMPSON_*")
249
255
  require env("OS")
250
256
  require secret("LAMPSON_*")
@@ -372,21 +378,23 @@ task run_batch(k, spec, items)
372
378
  export task work(spec_json)
373
379
  require db(".lampson/teams.db")
374
380
  require net
381
+ require net("0.0.0.0/0")
382
+ require net("::/0")
375
383
  require exec
376
384
  require time
377
385
  require random
378
386
  require file(".lampson")
379
- require file(".lampson/*")
387
+ require file(".lampson/**")
380
388
  require file("workspace")
381
- require file("workspace/*")
389
+ require file("workspace/**")
382
390
  require file.read("skills")
383
- require file.read("skills/*")
391
+ require file.read("skills/**")
384
392
  require file.read("plugins")
385
- require file.read("plugins/*")
393
+ require file.read("plugins/**")
386
394
  require file.read("agents")
387
- require file.read("agents/*")
395
+ require file.read("agents/**")
388
396
  require file.read("memory")
389
- require file.read("memory/*")
397
+ require file.read("memory/**")
390
398
  require env("LAMPSON_*")
391
399
  require env("OS")
392
400
  require secret("LAMPSON_*")
@@ -408,22 +416,24 @@ export task work(spec_json)
408
416
  agent MailboxWorker
409
417
  require db(".lampson/teams.db")
410
418
  require net
419
+ require net("0.0.0.0/0")
420
+ require net("::/0")
411
421
  require sign("LAMPSON_TOOLS")
412
422
  require exec
413
423
  require time
414
424
  require random
415
425
  require file(".lampson")
416
- require file(".lampson/*")
426
+ require file(".lampson/**")
417
427
  require file("workspace")
418
- require file("workspace/*")
428
+ require file("workspace/**")
419
429
  require file.read("skills")
420
- require file.read("skills/*")
430
+ require file.read("skills/**")
421
431
  require file.read("plugins")
422
- require file.read("plugins/*")
432
+ require file.read("plugins/**")
423
433
  require file.read("agents")
424
- require file.read("agents/*")
434
+ require file.read("agents/**")
425
435
  require file("memory")
426
- require file("memory/*")
436
+ require file("memory/**")
427
437
  require env("LAMPSON_*")
428
438
  require env("OS")
429
439
  require secret("LAMPSON_*")
@@ -437,9 +447,9 @@ export task submit(sobre, opts)
437
447
  require time
438
448
  require random
439
449
  require file.read("workspace")
440
- require file.read("workspace/*")
450
+ require file.read("workspace/**")
441
451
  require file.read("agents")
442
- require file.read("agents/*")
452
+ require file.read("agents/**")
443
453
  let id be when contains(opts, "id") then opts["id"] otherwise new_id()
444
454
  let k be key_of(sobre, id)
445
455
  let sent be nothing