lampson 0.2.10 → 0.3.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.
@@ -0,0 +1,235 @@
1
+ -- lib/mcp_server.syn — Lampson COMO servidor MCP (spec/engine.md, fase 3): `lampson mcp serve`
2
+ --
3
+ -- Lo inverso de lib/mcp.syn (que es el CLIENTE): acá Claude Desktop, Cursor u otro agente usan los agentes de
4
+ -- Lampson como tools. Dos transportes, el mismo manejo (handle):
5
+ -- stdio `lampson mcp serve`: JSON-RPC 2.0, un mensaje por línea en stdin, respuestas por stdout (nada más puede
6
+ -- escribir en stdout mientras sirve). El cliente y Lampson en la MISMA máquina.
7
+ -- HTTP POST /w/<slug>/v1/mcp (web.syn, "Streamable HTTP" de MCP, respuestas JSON) con la API key de la API /v1:
8
+ -- desde cualquier lado, con la URL pública de Lampson (--domain, túnel, LAMPSON_PUBLIC_URL). Cada key ve
9
+ -- solo sus agentes; los mensajes pasan por el buzón (lib/mailbox.syn: dos agentes de afuera escribiendo a
10
+ -- la vez en la misma conversación no se pisan).
11
+ --
12
+ -- Tools:
13
+ -- ask(message, agent?, thread?) un mensaje a un agente; mismo thread = misma conversación. Sin thread se crea uno
14
+ -- y se devuelve, para seguir la conversación en la próxima llamada.
15
+ -- agents() los agentes disponibles (con LAMPSON_MCP_AGENTS, solo esos)
16
+ -- history(thread, agent?, limit?) los últimos mensajes (persona/agente) de una conversación — para retomarla
17
+ -- sin haber guardado nada del lado del cliente
18
+ -- Permisos: sin humano delante → el modo del agente, y si no dice, strict (lo peligroso se deniega y el agente lo
19
+ -- informa en su respuesta).
20
+
21
+ use "./runtime.syn" as runtime
22
+ use "./session.syn" as session
23
+
24
+ export let PROTOCOL be "2025-06-18"
25
+ export let SUPPORTED be ["2025-06-18", "2025-03-26", "2024-11-05"]
26
+
27
+ -- los agentes que este servidor ofrece: LAMPSON_MCP_AGENTS ("tienda,plan") o todos los elegibles
28
+ export task offered()
29
+ require env("LAMPSON_*")
30
+ require file.read("workspace")
31
+ require file.read("workspace/*")
32
+ require file.read("agents")
33
+ require file.read("agents/*")
34
+ let want be where(apply((x) => lower(trim(x)), split(env("LAMPSON_MCP_AGENTS", ""), ",")), (x) => x != "")
35
+ when length(want) == 0
36
+ give runtime.names()
37
+ give where(runtime.names(), (n) => contains(want, n))
38
+
39
+ export task tools_list(agents_list)
40
+ let ask_props be {"message": {"type": "string", "description": "What to ask or tell the agent, in plain words."}, "thread": {"type": "string", "description": "Conversation id. Pass the thread returned by a previous ask to continue that conversation; omit it to start a new one."}}
41
+ when length(agents_list) > 1
42
+ set ask_props["agent"] to {"type": "string", "enum": agents_list, "description": "Which Lampson agent answers (see the agents tool). Default: " + agents_list[0] + "."}
43
+ give [
44
+ {"name": "ask", "description": "Send a message to a Lampson agent working in the user's project and get its answer. The agent can use its own tools (read files, run checks…) within its permissions. Same thread = same conversation.", "inputSchema": {"type": "object", "properties": ask_props, "required": ["message"]}},
45
+ {"name": "agents", "description": "List the Lampson agents this server offers, with what each one is for.", "inputSchema": {"type": "object", "properties": {}}},
46
+ {"name": "history", "description": "The last messages of a conversation with a Lampson agent (who said what), to pick it up where it was left.", "inputSchema": {"type": "object", "properties": {"thread": {"type": "string", "description": "The conversation's thread (the one ask returned)."}, "agent": {"type": "string", "description": "Which agent (default: " + agents_list[0] + ")."}, "limit": {"type": "number", "description": "How many messages, newest last (default 20, max 100)."}}, "required": ["thread"]}}
47
+ ]
48
+
49
+ task reply(id, result)
50
+ print(json_encode({"jsonrpc": "2.0", "id": id, "result": result}))
51
+ flush()
52
+
53
+ task reply_error(id, code, msg)
54
+ print(json_encode({"jsonrpc": "2.0", "id": id, "error": {"code": code, "message": msg}}))
55
+ flush()
56
+
57
+ task text_result(t, structured, is_error)
58
+ give {"content": [{"type": "text", "text": t}], "structuredContent": structured, "isError": is_error}
59
+
60
+ -- tools/call → resultado MCP (no se llama `call`: taparía al builtin call() que invoca deliver_fn)
61
+ export task run_tool(name, args, agents_list, deliver_fn)
62
+ require net
63
+ require exec
64
+ require time
65
+ require random
66
+ require file(".lampson")
67
+ require file(".lampson/*")
68
+ require file("workspace")
69
+ require file("workspace/*")
70
+ require file.read("skills")
71
+ require file.read("skills/*")
72
+ require file.read("plugins")
73
+ require file.read("plugins/*")
74
+ require file.read("agents")
75
+ require file.read("agents/*")
76
+ require file.read("memory")
77
+ require file.read("memory/*")
78
+ require env("LAMPSON_*")
79
+ require env("OS")
80
+ require secret("LAMPSON_*")
81
+ when name == "agents"
82
+ let rows be apply((n) => {"id": n, "description": runtime.get(n)["description"]}, agents_list)
83
+ let lines be apply((r) => "- " + r["id"] + (when r["description"] != "" then ": " + r["description"] otherwise ""), rows)
84
+ give text_result(join(lines, "\n"), {"agents": rows}, false)
85
+ when name == "history"
86
+ let hth be when contains(args, "thread") and args["thread"] != nothing then text(args["thread"]) otherwise ""
87
+ let hag be when contains(args, "agent") and args["agent"] != nothing and text(args["agent"]) != "" then lower(text(args["agent"])) otherwise agents_list[0]
88
+ when hth == ""
89
+ give text_result("thread is required", {}, true)
90
+ when not contains(agents_list, hag)
91
+ give text_result("no agent named '" + hag + "' here · available: " + join(agents_list, ", "), {}, true)
92
+ let lim be when contains(args, "limit") and args["limit"] != nothing then floor(number(args["limit"])) otherwise 20
93
+ when lim < 1 or lim > 100
94
+ set lim to 20
95
+ let sid be runtime.thread_session(hag, hth)
96
+ when sid == ""
97
+ give text_result("no conversation with " + hag + " in thread '" + hth + "' yet", {"agent": hag, "thread": hth, "messages": []}, false)
98
+ let msgs be []
99
+ each m in session.load(sid)["messages"]
100
+ when (m["role"] == "user" or m["role"] == "assistant") and type_of(m["content"]) == "text" and trim(m["content"]) != "" and not starts_with(m["content"], "[harness]")
101
+ set msgs to append(msgs, {"role": when m["role"] == "user" then "user" otherwise "agent", "text": m["content"]})
102
+ let tail be when length(msgs) > lim then slice(msgs, length(msgs) - lim, length(msgs)) otherwise msgs
103
+ let lines be apply((m) => (when m["role"] == "user" then "USER: " otherwise "AGENT: ") + m["text"], tail)
104
+ give text_result(join(lines, "\n\n"), {"agent": hag, "thread": hth, "session": sid, "messages": tail}, false)
105
+ when name != "ask"
106
+ give text_result("unknown tool '" + text(name) + "'", {}, true)
107
+ let msg be when contains(args, "message") then text(args["message"]) otherwise ""
108
+ when trim(msg) == ""
109
+ give text_result("message is required", {}, true)
110
+ let agent be when contains(args, "agent") and args["agent"] != nothing and text(args["agent"]) != "" then lower(text(args["agent"])) otherwise agents_list[0]
111
+ when not contains(agents_list, agent)
112
+ give text_result("no agent named '" + agent + "' here · available: " + join(agents_list, ", "), {}, true)
113
+ let thread be when contains(args, "thread") and args["thread"] != nothing then text(args["thread"]) otherwise ""
114
+ when thread == ""
115
+ set thread to "mcp:" + slice(token(16), 0, 10)
116
+ let spec be runtime.get(agent)
117
+ let mode be when spec["permission"] != "" then "" otherwise "strict"
118
+ let r be nothing
119
+ try
120
+ set r to call(deliver_fn, {"sobre": {"to": agent, "thread": thread, "session": "", "from": {"id": "", "name": "", "kind": "agent"}, "text": msg, "images": [], "channel": "mcp", "meta": {}}, "mode": mode})
121
+ recover err
122
+ give text_result("error: " + text(err), {"agent": agent, "thread": thread}, true)
123
+ let failed be starts_with(r["stopped"], "error")
124
+ let body be when failed then r["stopped"] otherwise r["text"]
125
+ let footer be "\n\n[lampson · agent " + agent + " · thread " + thread + " — pass this thread to continue the conversation]"
126
+ give text_result(body + footer, {"agent": agent, "thread": thread, "session": r["session"], "text": r["text"], "steps": r["steps"], "stopped": r["stopped"]}, failed)
127
+
128
+ -- un mensaje JSON-RPC → la respuesta (map), o nothing si era una notificación (no se responde)
129
+ export task handle(req, agents_list, deliver_fn)
130
+ require net
131
+ require exec
132
+ require time
133
+ require random
134
+ require file(".lampson")
135
+ require file(".lampson/*")
136
+ require file("workspace")
137
+ require file("workspace/*")
138
+ require file.read("skills")
139
+ require file.read("skills/*")
140
+ require file.read("plugins")
141
+ require file.read("plugins/*")
142
+ require file.read("agents")
143
+ require file.read("agents/*")
144
+ require file.read("memory")
145
+ require file.read("memory/*")
146
+ require env("LAMPSON_*")
147
+ require env("OS")
148
+ require secret("LAMPSON_*")
149
+ when req == nothing or type_of(req) != "map"
150
+ give {"jsonrpc": "2.0", "id": nothing, "error": {"code": -32600, "message": "invalid request"}}
151
+ let id be when contains(req, "id") then req["id"] otherwise nothing
152
+ let method be when contains(req, "method") then text(req["method"]) otherwise ""
153
+ let params be when contains(req, "params") and req["params"] != nothing then req["params"] otherwise {}
154
+ when id == nothing
155
+ give nothing
156
+ when method == "initialize"
157
+ -- la versión que pide el cliente si la hablamos; si no, la nuestra (el cliente decide si sigue)
158
+ let asked be when contains(params, "protocolVersion") then text(params["protocolVersion"]) otherwise PROTOCOL
159
+ let v be when contains(SUPPORTED, asked) then asked otherwise PROTOCOL
160
+ give {"jsonrpc": "2.0", "id": id, "result": {"protocolVersion": v, "capabilities": {"tools": {"listChanged": false}}, "serverInfo": {"name": "lampson", "version": "0.2"}, "instructions": "Lampson agents. Use `agents` to see who is available and `ask` to talk to one; keep the returned thread to continue a conversation."}}
161
+ when method == "ping"
162
+ give {"jsonrpc": "2.0", "id": id, "result": {}}
163
+ when method == "tools/list"
164
+ give {"jsonrpc": "2.0", "id": id, "result": {"tools": tools_list(agents_list)}}
165
+ when method == "tools/call"
166
+ let args be when contains(params, "arguments") and params["arguments"] != nothing then params["arguments"] otherwise {}
167
+ give {"jsonrpc": "2.0", "id": id, "result": run_tool(text(params["name"]), args, agents_list, deliver_fn)}
168
+ give {"jsonrpc": "2.0", "id": id, "error": {"code": -32601, "message": "method not found: " + method}}
169
+
170
+ -- stdio: el turno directo (un solo cliente, un proceso)
171
+ export task deliver_direct(sobre, mode)
172
+ require net
173
+ require exec
174
+ require time
175
+ require random
176
+ require file(".lampson")
177
+ require file(".lampson/*")
178
+ require file("workspace")
179
+ require file("workspace/*")
180
+ require file.read("skills")
181
+ require file.read("skills/*")
182
+ require file.read("plugins")
183
+ require file.read("plugins/*")
184
+ require file.read("agents")
185
+ require file.read("agents/*")
186
+ require file.read("memory")
187
+ require file.read("memory/*")
188
+ require env("LAMPSON_*")
189
+ require env("OS")
190
+ require secret("LAMPSON_*")
191
+ give runtime.deliver(sobre, {"mode": mode, "ask_fn": nothing})
192
+
193
+ -- el loop stdio: hasta EOF
194
+ export task serve()
195
+ require stdin
196
+ require net
197
+ require exec
198
+ require time
199
+ require random
200
+ require file(".lampson")
201
+ require file(".lampson/*")
202
+ require file("workspace")
203
+ require file("workspace/*")
204
+ require file.read("skills")
205
+ require file.read("skills/*")
206
+ require file.read("plugins")
207
+ require file.read("plugins/*")
208
+ require file.read("agents")
209
+ require file.read("agents/*")
210
+ require file.read("memory")
211
+ require file.read("memory/*")
212
+ require env("LAMPSON_*")
213
+ require env("OS")
214
+ require secret("LAMPSON_*")
215
+ let agents_list be offered()
216
+ when length(agents_list) == 0
217
+ give false
218
+ let line be read_line("")
219
+ while line != nothing
220
+ when trim(line) != ""
221
+ let req be nothing
222
+ let bad be false
223
+ try
224
+ set req to json_decode(line)
225
+ recover err
226
+ set bad to true
227
+ when bad
228
+ reply_error(nothing, -32700, "parse error")
229
+ otherwise
230
+ let resp be handle(req, agents_list, deliver_direct)
231
+ when resp != nothing
232
+ print(json_encode(resp))
233
+ flush()
234
+ set line to read_line("")
235
+ give true
package/lib/plugins.syn CHANGED
@@ -8,7 +8,11 @@
8
8
  -- "command": "python plugin.py" (kind=exec: cualquier ejecutable — js, py, sh…)
9
9
  -- "caps": "file.read=workspace/*" (kind=syn, opcional: techo EXTRA sobre stdout,time,env=PLUGIN_*)
10
10
  -- "timeout": 60,
11
- -- "tools": [{"name", "description", "parameters": {JSON Schema}, "readonly": false}]}
11
+ -- "tools": [{"name", "description", "parameters": {JSON Schema}, "readonly": false}],
12
+ -- "config": ["CHATWOOT_TOKEN", …] (opcional: el hijo recibe PLUGIN_<X> = LAMPSON_<X> del .env/entorno;
13
+ -- así un plugin syn con techo env=PLUGIN_* también tiene sus secretos)
14
+ -- "channel": {"agent": "tienda"}} (opcional: un CANAL — lib/channels.syn. Sus acciones `receive` y
15
+ -- `send` no son tools del modelo, así que un canal puede no tener tools)
12
16
  --
13
17
  -- Cómo corre (patrón "safe runner" de la doc 22-sandbox): cada llamada es UN proceso hijo que termina.
14
18
  -- kind=syn → `synsema run --cap-set stdout,time,env=PLUGIN_*[,caps] <entry>`: el techo lo fija el
@@ -78,14 +82,27 @@ task read_manifest(dir, name, scope, legacy)
78
82
  give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "kind=syn needs \"entry\" (the .syn file)"}
79
83
  when kind == "exec" and not contains(doc, "command")
80
84
  give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "kind=exec needs \"command\""}
81
- when not contains(doc, "tools") or length(doc["tools"]) == 0
85
+ -- canal (lib/channels.syn): {"agent": "<id>"} — el agente que atiende si nadie dice otro
86
+ let channel be nothing
87
+ when contains(doc, "channel") and doc["channel"] != nothing
88
+ when type_of(doc["channel"]) != "map"
89
+ give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "channel must be an object, e.g. {\"agent\": \"support\"}"}
90
+ set channel to {"agent": when contains(doc["channel"], "agent") and doc["channel"]["agent"] != nothing then lower(text(doc["channel"]["agent"])) otherwise "", "typing": contains(doc["channel"], "typing") and doc["channel"]["typing"] == true, "poll": contains(doc["channel"], "poll") and doc["channel"]["poll"] == true}
91
+ let config be []
92
+ when contains(doc, "config") and doc["config"] != nothing
93
+ each ck in doc["config"]
94
+ when not matches(text(ck), "[A-Z][A-Z0-9_]{0,40}")
95
+ give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "config names are UPPER_SNAKE (got '" + text(ck) + "')"}
96
+ set config to append(config, text(ck))
97
+ let raw_tools be when contains(doc, "tools") and doc["tools"] != nothing then doc["tools"] otherwise []
98
+ when length(raw_tools) == 0 and channel == nothing
82
99
  give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "no tools declared"}
83
100
  let tools be []
84
- each t in doc["tools"]
101
+ each t in raw_tools
85
102
  when not contains(t, "name") or not valid_tool_name(t["name"])
86
103
  give {"ok": false, "name": name, "scope": scope, "legacy": is_legacy, "error": "a tool has no valid name"}
87
104
  set tools to append(tools, {"name": text(t["name"]), "description": when contains(t, "description") then text(t["description"]) otherwise "", "parameters": when contains(t, "parameters") then t["parameters"] otherwise {"type": "object", "properties": {}}, "readonly": contains(t, "readonly") and t["readonly"] == true})
88
- give {"ok": true, "name": name, "scope": scope, "legacy": is_legacy, "plugin": {"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}}
105
+ give {"ok": true, "name": name, "scope": scope, "legacy": is_legacy, "plugin": {"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}}
89
106
 
90
107
  task scan(dir, scope, legacy)
91
108
  let out be []
@@ -137,7 +154,7 @@ export task all()
137
154
  set l["error"] to nothing
138
155
  set out to append(out, l)
139
156
  otherwise
140
- set out to append(out, {"name": n, "scope": r["scope"], "dir": "", "kind": "?", "legacy": r["legacy"], "description": "", "entry": "", "command": "", "caps": "", "timeout": 0, "tools": [], "enabled": false, "error": r["error"]})
157
+ 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": [], "enabled": false, "error": r["error"]})
141
158
  give out
142
159
 
143
160
  export task enabled()
@@ -288,11 +305,27 @@ export task call(full_name, args)
288
305
  let tl be where(l["tools"], (t) => t["name"] == parts["tool"])
289
306
  when length(tl) == 0
290
307
  give "ERROR: plugin '" + l["name"] + "' has no tool '" + parts["tool"] + "'"
308
+ give invoke(l, parts["tool"], args)
309
+
310
+ -- corre UNA acción de un plugin encendido como proceso hijo: una tool del modelo, o `receive`/`send` de un canal
311
+ export task invoke(l, tool, args)
312
+ require exec
313
+ require time
314
+ require file(".lampson")
315
+ require file(".lampson/*")
316
+ require file.read("plugins")
317
+ require file.read("plugins/*")
318
+ require file("workspace")
319
+ require file("workspace/*")
320
+ require env("LAMPSON_*")
291
321
  -- PLUGIN_DIR relativa a la raíz de lampson (cwd del hijo para kind=syn); PLUGIN_WORKSPACE = la ruta real del
292
322
  -- proyecto (lampson.ps1 la exporta; sin ella, la junction). LAMP_* = los nombres viejos, por compat.
293
323
  let tool_args be json_encode(when args == nothing then {} otherwise args)
294
324
  let ws be env("LAMPSON_WORKSPACE", c.ROOT)
295
- let envs be {"PLUGIN_TOOL": parts["tool"], "PLUGIN_ARGS": tool_args, "PLUGIN_DIR": l["dir"], "PLUGIN_WORKSPACE": ws, "LAMP_TOOL": parts["tool"], "LAMP_ARGS": tool_args, "LAMP_DIR": l["dir"], "LAMP_WORKSPACE": ws}
325
+ let envs be {"PLUGIN_TOOL": tool, "PLUGIN_ARGS": tool_args, "PLUGIN_DIR": l["dir"], "PLUGIN_WORKSPACE": ws, "LAMP_TOOL": tool, "LAMP_ARGS": tool_args, "LAMP_DIR": l["dir"], "LAMP_WORKSPACE": ws}
326
+ -- "config": PLUGIN_<X> = LAMPSON_<X> (secretos y ajustes del plugin, desde el .env de lampson)
327
+ each ck in l["config"]
328
+ set envs["PLUGIN_" + ck] to env("LAMPSON_" + ck, "")
296
329
  when l["kind"] == "syn"
297
330
  -- techo del manifiesto: el código del plugin no puede pedir más de lo que el humano aprobó
298
331
  give c.truncate(run_child(env("LAMPSON_SYNSEMA", "synsema"), ["run", "--cap-set", ceiling_of(l), l["dir"] + "/" + l["entry"]], ".", envs, l["timeout"]), c.MAX_OUTPUT)
@@ -311,6 +344,28 @@ export task call(full_name, args)
311
344
  set resolved to append(resolved, tok)
312
345
  give c.truncate(run_child(resolved[0], slice(resolved, 1, length(resolved)), c.ROOT, envs, l["timeout"]), c.MAX_OUTPUT)
313
346
 
347
+ -- los canales encendidos (plugins con "channel"), y uno por nombre
348
+ export task channels()
349
+ require file(".lampson")
350
+ require file(".lampson/*")
351
+ require file.read("plugins")
352
+ require file.read("plugins/*")
353
+ require file("workspace")
354
+ require file("workspace/*")
355
+ require env("LAMPSON_*")
356
+ give where(enabled(), (l) => l["channel"] != nothing)
357
+
358
+ export task channel(name)
359
+ require file(".lampson")
360
+ require file(".lampson/*")
361
+ require file.read("plugins")
362
+ require file.read("plugins/*")
363
+ require file("workspace")
364
+ require file("workspace/*")
365
+ require env("LAMPSON_*")
366
+ let found be where(channels(), (l) => l["name"] == name)
367
+ give when length(found) == 0 then nothing otherwise found[0]
368
+
314
369
  -- crear un plugin DEL PROYECTO (workspace/.lampson/plugins/<name>/): escribe plugin.json + el código, revalida el
315
370
  -- manifiesto y, si es syn, corre `synsema check` sobre el entry. Como cordis_define en dsh: define y valida,
316
371
  -- NO ejecuta ni enciende — encender sigue siendo del humano (set_enabled tras ask).
@@ -404,5 +459,5 @@ export task summary()
404
459
  require env("LAMPSON_*")
405
460
  let out be []
406
461
  each l in all()
407
- 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"]})
462
+ 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})
408
463
  give out