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.
- package/README.md +2 -0
- package/chat.syn +17 -12
- package/cli.syn +8 -1
- package/hub.tpl.syn +4 -4
- package/lampson.ps1 +2 -2
- package/lampson.sh +7 -4
- package/lib/agents.syn +35 -27
- package/lib/api.syn +37 -35
- package/lib/apikeys.syn +8 -8
- package/lib/approvals.syn +11 -7
- package/lib/apptools.syn +27 -24
- package/lib/channels.syn +38 -36
- package/lib/computer.syn +20 -20
- package/lib/diagnose.syn +9 -7
- package/lib/fs.syn +11 -11
- package/lib/judge.syn +4 -4
- package/lib/loop.syn +46 -21
- package/lib/lsp.syn +13 -13
- package/lib/mailbox.syn +34 -24
- package/lib/mcp.syn +25 -17
- package/lib/mcp_server.syn +34 -26
- package/lib/permission.syn +3 -1
- package/lib/plugins.syn +48 -40
- package/lib/prompt.syn +5 -5
- package/lib/provider.syn +25 -11
- package/lib/remotetools.syn +3 -1
- package/lib/runtime.syn +112 -85
- package/lib/sched_run.syn +19 -13
- package/lib/schedule.syn +25 -23
- package/lib/session.syn +6 -6
- package/lib/settings.syn +10 -10
- package/lib/skills.syn +9 -9
- package/lib/teamrun.syn +75 -28
- package/lib/teams.syn +190 -115
- package/lib/term.syn +2 -2
- package/lib/tools/bash.syn +2 -2
- package/lib/tools/common.syn +3 -3
- package/lib/tools/edit.syn +1 -1
- package/lib/tools/fetch.syn +7 -3
- package/lib/tools/find.syn +1 -1
- package/lib/tools/grep.syn +2 -2
- package/lib/tools/ls.syn +1 -1
- package/lib/tools/memo.syn +7 -7
- package/lib/tools/proc.syn +10 -10
- package/lib/tools/process.syn +1 -1
- package/lib/tools/read.syn +2 -2
- package/lib/tools/todo.syn +3 -3
- package/lib/tools/write.syn +1 -1
- package/lib/tools.syn +17 -15
- package/lib/trace.syn +5 -5
- package/lib/tree.syn +3 -3
- package/lib/update.syn +6 -0
- package/lib/workspaces.syn +25 -25
- package/lib/worktree.syn +323 -24
- package/package.json +2 -2
- package/plugins/chatwoot/plugin.syn +2 -0
- package/plugins/orders/plugin.json +1 -1
- package/plugins/orders/plugin.syn +1 -1
- package/plugins/telegram/plugin.syn +2 -0
- package/public/css/inbox.css +100 -0
- package/public/css/mobile.css +0 -13
- package/public/css/panel.css +21 -0
- package/public/css/teams.css +20 -52
- package/public/hub.html +3 -0
- package/public/index.html +3 -0
- package/public/js/config.js +3 -3
- package/public/js/devices.js +1 -1
- package/public/js/hub.js +3 -2
- package/public/js/inbox.js +234 -0
- package/public/js/navtabs.js +1 -6
- package/public/js/objlive.js +11 -3
- package/public/js/panel.js +12 -6
- package/public/js/teams-home.js +3 -33
- package/public/js/teams.js +35 -114
- package/public/js/workspaces.js +1 -1
- package/public/plugins-home.html +3 -0
- package/public/tasks-home.html +3 -0
- package/public/teams-home.html +3 -1
- package/public/teams.html +3 -2
- package/run.syn +17 -12
- package/sdk/index.d.ts +1 -1
- package/sdk/index.js +51 -8
- package/skills/synsema/SKILL.md +3 -3
- package/web.syn +10 -7
package/lib/workspaces.syn
CHANGED
|
@@ -92,7 +92,7 @@ export task migrate_ports()
|
|
|
92
92
|
require env("LAMPSON_*")
|
|
93
93
|
require env("OS")
|
|
94
94
|
require file(".lampson")
|
|
95
|
-
require file(".lampson
|
|
95
|
+
require file(".lampson/**")
|
|
96
96
|
require file.read("hub.tpl.syn")
|
|
97
97
|
require file("hub.syn")
|
|
98
98
|
let doc be load_reg()
|
|
@@ -115,7 +115,7 @@ export task migrate_ports()
|
|
|
115
115
|
|
|
116
116
|
export task all()
|
|
117
117
|
require file(".lampson")
|
|
118
|
-
require file(".lampson
|
|
118
|
+
require file(".lampson/**")
|
|
119
119
|
let doc be load_reg()
|
|
120
120
|
let out be []
|
|
121
121
|
each k in sort_by(keys(doc["workspaces"]), (x) => 0 - doc["workspaces"][x]["last_used"])
|
|
@@ -124,7 +124,7 @@ export task all()
|
|
|
124
124
|
|
|
125
125
|
export task get(slug)
|
|
126
126
|
require file(".lampson")
|
|
127
|
-
require file(".lampson
|
|
127
|
+
require file(".lampson/**")
|
|
128
128
|
let doc be load_reg()
|
|
129
129
|
when contains(doc["workspaces"], slug)
|
|
130
130
|
give doc["workspaces"][slug]
|
|
@@ -132,7 +132,7 @@ export task get(slug)
|
|
|
132
132
|
|
|
133
133
|
export task by_path(path)
|
|
134
134
|
require file(".lampson")
|
|
135
|
-
require file(".lampson
|
|
135
|
+
require file(".lampson/**")
|
|
136
136
|
let n be norm(path)
|
|
137
137
|
each w in all()
|
|
138
138
|
when norm(w["path"]) == n
|
|
@@ -141,7 +141,7 @@ export task by_path(path)
|
|
|
141
141
|
|
|
142
142
|
export task put(w)
|
|
143
143
|
require file(".lampson")
|
|
144
|
-
require file(".lampson
|
|
144
|
+
require file(".lampson/**")
|
|
145
145
|
require time
|
|
146
146
|
let doc be load_reg()
|
|
147
147
|
set doc["workspaces"][w["slug"]] to w
|
|
@@ -150,7 +150,7 @@ export task put(w)
|
|
|
150
150
|
|
|
151
151
|
export task touch(slug)
|
|
152
152
|
require file(".lampson")
|
|
153
|
-
require file(".lampson
|
|
153
|
+
require file(".lampson/**")
|
|
154
154
|
require time
|
|
155
155
|
let w be get(slug)
|
|
156
156
|
when w == nothing
|
|
@@ -212,7 +212,7 @@ export task prepare(w)
|
|
|
212
212
|
require env("LAMPSON_*")
|
|
213
213
|
require env("OS")
|
|
214
214
|
require file(".lampson")
|
|
215
|
-
require file(".lampson
|
|
215
|
+
require file(".lampson/**")
|
|
216
216
|
require file.read("web.syn")
|
|
217
217
|
require file.read("chat.syn")
|
|
218
218
|
require file.read("run.syn")
|
|
@@ -299,7 +299,7 @@ export task ensure(path)
|
|
|
299
299
|
require env("LAMPSON_*")
|
|
300
300
|
require env("OS")
|
|
301
301
|
require file(".lampson")
|
|
302
|
-
require file(".lampson
|
|
302
|
+
require file(".lampson/**")
|
|
303
303
|
require file.read("web.syn")
|
|
304
304
|
require file.read("chat.syn")
|
|
305
305
|
require file.read("run.syn")
|
|
@@ -333,7 +333,7 @@ export task remove(slug)
|
|
|
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.read("hub.tpl.syn")
|
|
338
338
|
require file("hub.syn")
|
|
339
339
|
require net("127.0.0.1")
|
|
@@ -374,7 +374,7 @@ task hub_routes(w)
|
|
|
374
374
|
-- reescribe hub.syn desde la plantilla si cambió (bajo --watch, el hub se reinicia solo)
|
|
375
375
|
export task regen_hub()
|
|
376
376
|
require file(".lampson")
|
|
377
|
-
require file(".lampson
|
|
377
|
+
require file(".lampson/**")
|
|
378
378
|
require file.read("hub.tpl.syn")
|
|
379
379
|
require file("hub.syn")
|
|
380
380
|
let tpl be read_file(HUB_TEMPLATE)
|
|
@@ -420,7 +420,7 @@ export task start_ws(w)
|
|
|
420
420
|
require env("LAMPSON_*")
|
|
421
421
|
require env("OS")
|
|
422
422
|
require file(".lampson")
|
|
423
|
-
require file(".lampson
|
|
423
|
+
require file(".lampson/**")
|
|
424
424
|
require file.read("web.syn")
|
|
425
425
|
require file.read("chat.syn")
|
|
426
426
|
require file.read("run.syn")
|
|
@@ -483,7 +483,7 @@ export task pause_ws(w)
|
|
|
483
483
|
require env("OS")
|
|
484
484
|
require net("127.0.0.1")
|
|
485
485
|
require file(".lampson")
|
|
486
|
-
require file(".lampson
|
|
486
|
+
require file(".lampson/**")
|
|
487
487
|
set w["paused"] to true
|
|
488
488
|
put(w)
|
|
489
489
|
stop_ws(w)
|
|
@@ -559,7 +559,7 @@ export task start_hub()
|
|
|
559
559
|
require env("LAMPSON_*")
|
|
560
560
|
require env("OS")
|
|
561
561
|
require file(".lampson")
|
|
562
|
-
require file(".lampson
|
|
562
|
+
require file(".lampson/**")
|
|
563
563
|
require file.read("hub.tpl.syn")
|
|
564
564
|
require file("hub.syn")
|
|
565
565
|
regen_hub()
|
|
@@ -623,7 +623,7 @@ task edge_port()
|
|
|
623
623
|
|
|
624
624
|
export task domain_cfg()
|
|
625
625
|
require file.read(".lampson")
|
|
626
|
-
require file.read(".lampson
|
|
626
|
+
require file.read(".lampson/**")
|
|
627
627
|
try
|
|
628
628
|
when file_exists(DOMAIN_FILE)
|
|
629
629
|
let d be json_decode(read_file(DOMAIN_FILE))
|
|
@@ -640,7 +640,7 @@ export task valid_domain(d)
|
|
|
640
640
|
-- guarda el dominio; el email (contacto de Let's Encrypt) se pide la primera vez y después se recuerda
|
|
641
641
|
export task set_domain(domain, email)
|
|
642
642
|
require file(".lampson")
|
|
643
|
-
require file(".lampson
|
|
643
|
+
require file(".lampson/**")
|
|
644
644
|
require env("LAMPSON_*")
|
|
645
645
|
let d be lower(trim(text(domain)))
|
|
646
646
|
set d to regex_replace(d, "^https?://", "")
|
|
@@ -660,7 +660,7 @@ export task set_domain(domain, email)
|
|
|
660
660
|
|
|
661
661
|
export task clear_domain()
|
|
662
662
|
require file(".lampson")
|
|
663
|
-
require file(".lampson
|
|
663
|
+
require file(".lampson/**")
|
|
664
664
|
require env("LAMPSON_*")
|
|
665
665
|
let prev be domain_cfg()
|
|
666
666
|
write_file(DOMAIN_FILE, "{}")
|
|
@@ -680,7 +680,7 @@ export task start_edge()
|
|
|
680
680
|
require env("LAMPSON_*")
|
|
681
681
|
require env("OS")
|
|
682
682
|
require file(".lampson")
|
|
683
|
-
require file(".lampson
|
|
683
|
+
require file(".lampson/**")
|
|
684
684
|
let cfg be domain_cfg()
|
|
685
685
|
when cfg == nothing
|
|
686
686
|
give false
|
|
@@ -715,7 +715,7 @@ export task keep_edge()
|
|
|
715
715
|
require env("LAMPSON_*")
|
|
716
716
|
require env("OS")
|
|
717
717
|
require file(".lampson")
|
|
718
|
-
require file(".lampson
|
|
718
|
+
require file(".lampson/**")
|
|
719
719
|
when domain_cfg() == nothing or edge_alive()
|
|
720
720
|
give false
|
|
721
721
|
let last be 0
|
|
@@ -730,7 +730,7 @@ export task keep_edge()
|
|
|
730
730
|
-- últimas líneas del log del edge (para diagnosticar desde la CLI)
|
|
731
731
|
export task edge_log(n)
|
|
732
732
|
require file.read(".lampson")
|
|
733
|
-
require file.read(".lampson
|
|
733
|
+
require file.read(".lampson/**")
|
|
734
734
|
try
|
|
735
735
|
let lines be where(split(replace(read_file(".lampson/edge.log"), "\r", ""), "\n"), (l) => trim(l) != "")
|
|
736
736
|
give slice(lines, max(0, length(lines) - n), length(lines))
|
|
@@ -740,7 +740,7 @@ export task edge_log(n)
|
|
|
740
740
|
-- ---------- política y supervisor (tick del hub) ----------
|
|
741
741
|
export task idle_hours()
|
|
742
742
|
require file.read(".lampson")
|
|
743
|
-
require file.read(".lampson
|
|
743
|
+
require file.read(".lampson/**")
|
|
744
744
|
require env("LAMPSON_*")
|
|
745
745
|
let doc be settings.load()
|
|
746
746
|
when contains(doc, "idle_hours")
|
|
@@ -751,7 +751,7 @@ export task idle_hours()
|
|
|
751
751
|
-- ¿debe estar vivo? always | auto (usado hace < idle_hours, o con tareas encendidas) | off
|
|
752
752
|
export task should_live(w, hc)
|
|
753
753
|
require file.read(".lampson")
|
|
754
|
-
require file.read(".lampson
|
|
754
|
+
require file.read(".lampson/**")
|
|
755
755
|
require env("LAMPSON_*")
|
|
756
756
|
require time
|
|
757
757
|
-- apagado a mano («■ apagar» en el hub): gana sobre la política y sobre las tareas programadas hasta que
|
|
@@ -881,7 +881,7 @@ export task plugins_of(w)
|
|
|
881
881
|
-- /w/<nombre> sin el hash: el slug completo si un solo workspace se llama así (si no, nothing)
|
|
882
882
|
export task resolve_slug(name)
|
|
883
883
|
require file(".lampson")
|
|
884
|
-
require file(".lampson
|
|
884
|
+
require file(".lampson/**")
|
|
885
885
|
when get(name) != nothing
|
|
886
886
|
give name
|
|
887
887
|
let hits be where(all(), (w) => starts_with(w["slug"], lower(name) + "-") and length(w["slug"]) == length(name) + 9)
|
|
@@ -925,7 +925,7 @@ export task tick()
|
|
|
925
925
|
require env("OS")
|
|
926
926
|
require net("127.0.0.1")
|
|
927
927
|
require file(".lampson")
|
|
928
|
-
require file(".lampson
|
|
928
|
+
require file(".lampson/**")
|
|
929
929
|
require file.read("web.syn")
|
|
930
930
|
require file.read("chat.syn")
|
|
931
931
|
require file.read("run.syn")
|
|
@@ -962,7 +962,7 @@ export task summary()
|
|
|
962
962
|
require env("OS")
|
|
963
963
|
require net("127.0.0.1")
|
|
964
964
|
require file(".lampson")
|
|
965
|
-
require file(".lampson
|
|
965
|
+
require file(".lampson/**")
|
|
966
966
|
let out be []
|
|
967
967
|
let list be all()
|
|
968
968
|
let hcs be health_all(list)
|
|
@@ -983,7 +983,7 @@ export task summary_cached(max_age)
|
|
|
983
983
|
require env("OS")
|
|
984
984
|
require net("127.0.0.1")
|
|
985
985
|
require file(".lampson")
|
|
986
|
-
require file(".lampson
|
|
986
|
+
require file(".lampson/**")
|
|
987
987
|
try
|
|
988
988
|
observe "hub:summary_at" as at
|
|
989
989
|
observe "hub:summary" as cached
|
package/lib/worktree.syn
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
-- quién hizo cada commit. La copia principal (la de la persona, con main) no se toca.
|
|
7
7
|
-- * .lampson/ queda en .git/info/exclude (exclusión local: no cambia ningún archivo del repo)
|
|
8
8
|
-- * lib/loop.syn traduce: las tools de archivos y bash del agente operan en su copia; para él es la raíz
|
|
9
|
-
-- *
|
|
9
|
+
-- * la regla del asiento (abajo): autonomía total en su copia; integrar a main y el push los aprueba la persona
|
|
10
10
|
use "./tools/common.syn" as c
|
|
11
11
|
|
|
12
12
|
export let DIR be ".lampson/worktrees"
|
|
@@ -16,7 +16,7 @@ task git(args, cwd)
|
|
|
16
16
|
require exec
|
|
17
17
|
require time
|
|
18
18
|
require file("workspace")
|
|
19
|
-
require file("workspace
|
|
19
|
+
require file("workspace/**")
|
|
20
20
|
try
|
|
21
21
|
let r be run(G, args, 30, {"cwd": cwd})
|
|
22
22
|
give {"ok": r["exit_code"] == 0, "out": trim(r["stdout"] + "\n" + r["stderr"])}
|
|
@@ -28,7 +28,7 @@ export task is_repo()
|
|
|
28
28
|
require exec
|
|
29
29
|
require time
|
|
30
30
|
require file("workspace")
|
|
31
|
-
require file("workspace
|
|
31
|
+
require file("workspace/**")
|
|
32
32
|
give git(["rev-parse", "--verify", "HEAD"], c.ROOT)["ok"]
|
|
33
33
|
|
|
34
34
|
-- la copia de `agent` (la crea si falta). → {ok, root, branch, error}; root es relativa al workspace
|
|
@@ -36,7 +36,7 @@ export task ensure(team_id, agent, author)
|
|
|
36
36
|
require exec
|
|
37
37
|
require time
|
|
38
38
|
require file("workspace")
|
|
39
|
-
require file("workspace
|
|
39
|
+
require file("workspace/**")
|
|
40
40
|
let rel be DIR + "/" + agent
|
|
41
41
|
let branch be "team/" + team_id + "/" + agent
|
|
42
42
|
when not is_repo()
|
|
@@ -61,6 +61,40 @@ export task ensure(team_id, agent, author)
|
|
|
61
61
|
git(["config", "--worktree", "user.email", author["email"]], c.ROOT + "/" + rel)
|
|
62
62
|
give {"ok": true, "root": rel, "branch": branch, "error": ""}
|
|
63
63
|
|
|
64
|
+
-- la copia de un asiento, al día con la rama principal antes de su turno. Sin trabajo propio pendiente (nada suyo
|
|
65
|
+
-- que main no tenga, nada sin commitear) avanza sola a main; si tiene, se le avisa cuánto quedó atrás. (Visto en O-16:
|
|
66
|
+
-- las copias estaban 8 a 22 commits detrás, el CPO leyó un CHANGELOG de tres versiones atrás y propuso features que ya
|
|
67
|
+
-- estaban: un tercio del gasto en rehacerlo.) → {behind, ahead, moved, note} (note: lo que el agente tiene que saber)
|
|
68
|
+
export task sync(team_id, agent)
|
|
69
|
+
require exec
|
|
70
|
+
require time
|
|
71
|
+
require file("workspace")
|
|
72
|
+
require file("workspace/**")
|
|
73
|
+
let rel be DIR + "/" + agent
|
|
74
|
+
let branch be "team/" + team_id + "/" + agent
|
|
75
|
+
let out be {"behind": 0, "ahead": 0, "moved": false, "note": ""}
|
|
76
|
+
when not is_repo() or not git(["rev-parse", "--verify", "--quiet", "refs/heads/" + branch], c.ROOT)["ok"]
|
|
77
|
+
give out
|
|
78
|
+
let into be main_branch()
|
|
79
|
+
when into == branch or into == "HEAD"
|
|
80
|
+
give out
|
|
81
|
+
let bh be git(["rev-list", "--count", branch + ".." + into], c.ROOT)
|
|
82
|
+
let ah be git(["rev-list", "--count", into + ".." + branch], c.ROOT)
|
|
83
|
+
set out["behind"] to when bh["ok"] then int(bh["out"]) otherwise 0
|
|
84
|
+
set out["ahead"] to when ah["ok"] then int(ah["out"]) otherwise 0
|
|
85
|
+
when out["behind"] == 0
|
|
86
|
+
give out
|
|
87
|
+
let has_copy be file_exists(c.ROOT + "/" + rel + "/.git")
|
|
88
|
+
let dirty be when has_copy then git(["status", "--porcelain"], c.ROOT + "/" + rel)["out"] != "" otherwise false
|
|
89
|
+
when out["ahead"] == 0 and not dirty
|
|
90
|
+
let mv be when has_copy then git(["merge", "--ff-only", "-q", into], c.ROOT + "/" + rel) otherwise git(["branch", "-f", branch, into], c.ROOT)
|
|
91
|
+
when mv["ok"]
|
|
92
|
+
set out["moved"] to true
|
|
93
|
+
set out["note"] to "Lampson brought your copy up to date with " + into + " before this turn (" + text(out["behind"]) + " new commit" + (when out["behind"] == 1 then "" otherwise "s") + " integrated by the team)."
|
|
94
|
+
give out
|
|
95
|
+
set out["note"] to "Your branch is " + text(out["behind"]) + " commit" + (when out["behind"] == 1 then "" otherwise "s") + " behind " + into + " (the team integrated work since you branched)" + (when out["ahead"] > 0 then " and has " + text(out["ahead"]) + " of your own not in it" otherwise "") + (when dirty then ", with uncommitted changes" otherwise "") + ". Before you read or build on the project, bring " + into + " in: `git merge " + into + "` in your copy" + (when dirty then " (commit or stash first)" otherwise "") + "."
|
|
96
|
+
give out
|
|
97
|
+
|
|
64
98
|
-- el asiento de un equipo que se borra: su copia se va (lo que tenía sin commitear queda en un commit «wip»); su rama
|
|
65
99
|
-- se borra si ya está en la rama principal, y si no, se renombra a archive/<equipo>/<agente>-<fecha>: el trabajo no se
|
|
66
100
|
-- pierde, pero un equipo nuevo con el mismo nombre arranca de cero. → {copy, branch} (qué pasó con cada una)
|
|
@@ -68,7 +102,7 @@ export task retire(team_id, agent)
|
|
|
68
102
|
require exec
|
|
69
103
|
require time
|
|
70
104
|
require file("workspace")
|
|
71
|
-
require file("workspace
|
|
105
|
+
require file("workspace/**")
|
|
72
106
|
let rel be DIR + "/" + agent
|
|
73
107
|
let branch be "team/" + team_id + "/" + agent
|
|
74
108
|
let out be {"copy": "", "branch": ""}
|
|
@@ -95,7 +129,7 @@ export task main_branch()
|
|
|
95
129
|
require exec
|
|
96
130
|
require time
|
|
97
131
|
require file("workspace")
|
|
98
|
-
require file("workspace
|
|
132
|
+
require file("workspace/**")
|
|
99
133
|
let r be git(["rev-parse", "--abbrev-ref", "HEAD"], c.ROOT)
|
|
100
134
|
give when r["ok"] then r["out"] otherwise "main"
|
|
101
135
|
|
|
@@ -106,7 +140,7 @@ export task preview(command)
|
|
|
106
140
|
require exec
|
|
107
141
|
require time
|
|
108
142
|
require file("workspace")
|
|
109
|
-
require file("workspace
|
|
143
|
+
require file("workspace/**")
|
|
110
144
|
let cmd be " " + replace(text(command), "\n", " ") + " "
|
|
111
145
|
when not is_repo()
|
|
112
146
|
give nothing
|
|
@@ -156,7 +190,7 @@ task with_diff(o, a, b)
|
|
|
156
190
|
require exec
|
|
157
191
|
require time
|
|
158
192
|
require file("workspace")
|
|
159
|
-
require file("workspace
|
|
193
|
+
require file("workspace/**")
|
|
160
194
|
let out be o
|
|
161
195
|
let commits be []
|
|
162
196
|
let lg be git(["log", "--no-merges", "--format=%h%x09%an%x09%s", "-n", "12", a + ".." + b], c.ROOT)
|
|
@@ -179,35 +213,300 @@ task with_diff(o, a, b)
|
|
|
179
213
|
give out
|
|
180
214
|
|
|
181
215
|
-- las tools que operan en la copia del agente, y cómo se traducen sus args
|
|
182
|
-
export let FILE_TOOLS be ["read", "write", "edit", "ls", "find", "grep"]
|
|
216
|
+
export let FILE_TOOLS be ["read", "write", "edit", "ls", "find", "grep", "lsp"]
|
|
183
217
|
|
|
184
218
|
export task rooted(name, args, root)
|
|
185
219
|
let a be args
|
|
186
|
-
when name == "bash"
|
|
187
|
-
|
|
220
|
+
when name == "bash" or name == "process"
|
|
221
|
+
when contains(args, "command") and args["command"] != nothing and text(args["command"]) != ""
|
|
222
|
+
set a["command"] to "cd \"" + root + "\" && " + text(args["command"])
|
|
188
223
|
give a
|
|
189
224
|
let p be when contains(args, "path") and args["path"] != nothing then replace(text(args["path"]), "\\", "/") otherwise "."
|
|
190
225
|
while starts_with(p, "./")
|
|
191
226
|
set p to slice(p, 2, length(p))
|
|
192
227
|
when p == "." or p == ""
|
|
193
228
|
set a["path"] to root
|
|
194
|
-
otherwise when starts_with(p, root + "/") or p == root or starts_with(p, ".lampson/spill/")
|
|
229
|
+
otherwise when starts_with(p, root + "/") or p == root or starts_with(p, ".lampson/spill/") or absolute_path(p) != ""
|
|
195
230
|
set a["path"] to p
|
|
196
231
|
otherwise
|
|
197
232
|
set a["path"] to root + "/" + p
|
|
198
233
|
give a
|
|
199
234
|
|
|
200
|
-
--
|
|
201
|
-
--
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
235
|
+
-- ---------- la regla del asiento (equipos con git) ----------
|
|
236
|
+
-- Un equipo es una organización: cada asiento tiene TODAS las herramientas y autonomía total en su copia (su puesto) y
|
|
237
|
+
-- en las de la gente a su cargo (un jefe arregla lo de los suyos; el líder, lo de todos). La persona es el directorio:
|
|
238
|
+
-- aprueba solo lo que cruza el borde — tocar su copia del proyecto (integrar a main, una vez por objetivo) y cada push
|
|
239
|
+
-- — y nada sale del proyecto. bash no lo encierra el sistema operativo: acá se lee el comando como lo leería el shell
|
|
240
|
+
-- (sin el texto entre comillas ni los heredocs, siguiendo cada cd) y se frena lo que cae fuera de su puesto, con un
|
|
241
|
+
-- mensaje que dice que es una regla del equipo y no un error del comando (si no, el modelo cree que se equivocó de
|
|
242
|
+
-- sintaxis y prueba variantes o inventa la causa).
|
|
243
|
+
export let GIT_READ be ["log", "diff", "show", "status", "branch", "rev-parse", "merge-base", "ls-files", "ls-tree", "blame", "shortlog", "describe", "cat-file", "rev-list", "grep", "for-each-ref", "fetch", "tag", "reflog", "help", "version"]
|
|
244
|
+
-- comandos que solo miran: con ellos un asiento lee en todo el proyecto
|
|
245
|
+
export let READ_CMDS be ["cat", "head", "tail", "less", "more", "ls", "dir", "tree", "pwd", "echo", "printf", "grep", "egrep", "fgrep", "rg", "find", "wc", "diff", "cmp", "stat", "file", "du", "df", "sort", "uniq", "cut", "tr", "jq", "basename", "dirname", "realpath", "readlink", "which", "type", "test", "[", "true", "false", "sleep", "date", "env", "printenv", "nl", "od", "xxd", "md5sum", "sha1sum", "sha256sum", "column", "fold", "cd", "pushd", "popd", "exit"]
|
|
246
|
+
let RULE be "NOT RUN — your command is fine (this is not a syntax or tool error): it breaks a team rule. "
|
|
247
|
+
|
|
248
|
+
-- hasta dónde sube una ruta relativa desde la copia: «../dev» 1, «../../..» 3 (la copia principal), 4 o más sale del
|
|
249
|
+
-- proyecto. Un rango de git (main..HEAD) no es una ruta: los «..» tienen que estar sueltos o entre separadores.
|
|
250
|
+
export task climbs(cmd)
|
|
251
|
+
let most be 0
|
|
252
|
+
each m in regex_find_all(cmd, "(^|[\\s\"'=:(<>])((\\.\\.[\\\\/])*\\.\\.)([\\\\/]|$|[\\s\"';&|)])")
|
|
253
|
+
let n be length(split(m, "..")) - 1
|
|
254
|
+
when n > most
|
|
255
|
+
set most to n
|
|
256
|
+
give most
|
|
257
|
+
|
|
258
|
+
-- la primera ruta absoluta del comando ("" si no hay): /algo, C:\…, ~, $HOME. /dev/null y las URLs no cuentan.
|
|
259
|
+
export task absolute_path(cmd)
|
|
260
|
+
let t be regex_replace(" " + lower(cmd) + " ", "/dev/(null|stdout|stderr)", " ")
|
|
261
|
+
set t to regex_replace(t, "[a-z][a-z0-9+.-]*://\\S*", " ")
|
|
262
|
+
let m be regex_find_all(t,"(^|[\\s\"'=<>(;&|])(/[a-z0-9_.~$-]|/\\s|[a-z]:[\\\\/]|~[\\\\/\\s]|\\$home\\b|\\$\\{home\\}|%userprofile%)")
|
|
263
|
+
give when length(m) == 0 then "" otherwise trim(regex_replace(m[0], "^[\\s\"'=<>(;&|]", ""))
|
|
264
|
+
|
|
265
|
+
-- el comando sin lo que es texto y no ruta: el cuerpo de un heredoc, y lo que va entre comillas con espacios (un
|
|
266
|
+
-- mensaje de commit, un patrón de grep, el código de un python -c: «PATCH /tasks/:id» no es una ruta). Entre comillas
|
|
267
|
+
-- sin espacios («"../dev"») sí puede ser una ruta y queda, sin las comillas. Los saltos de línea separan comandos.
|
|
268
|
+
export task plain(cmd)
|
|
269
|
+
let lines be split(replace(text(cmd), "\r", ""), "\n")
|
|
270
|
+
let kept be []
|
|
271
|
+
let endtag be ""
|
|
272
|
+
each l in lines
|
|
273
|
+
when endtag != ""
|
|
274
|
+
when trim(l) == endtag
|
|
275
|
+
set endtag to ""
|
|
276
|
+
otherwise
|
|
277
|
+
set kept to append(kept, l)
|
|
278
|
+
let h be regex_find_all(l, "(^|[^<])<<-?\\s*['\"]?[A-Za-z_][A-Za-z0-9_]*")
|
|
279
|
+
when length(h) > 0
|
|
280
|
+
set endtag to regex_replace(h[0], "^[^<]?<<-?\\s*['\"]?", "")
|
|
281
|
+
let s be join(kept, " ; ")
|
|
282
|
+
let out be ""
|
|
283
|
+
let i be 0
|
|
284
|
+
let n be length(s)
|
|
285
|
+
while i < n
|
|
286
|
+
let ch be slice(s, i, i + 1)
|
|
287
|
+
when ch == "'" or ch == "\""
|
|
288
|
+
let j be i + 1
|
|
289
|
+
let body be ""
|
|
290
|
+
while j < n and slice(s, j, j + 1) != ch
|
|
291
|
+
when ch == "\"" and slice(s, j, j + 1) == "\\" and j + 1 < n
|
|
292
|
+
set body to body + slice(s, j, j + 2)
|
|
293
|
+
set j to j + 2
|
|
294
|
+
otherwise
|
|
295
|
+
set body to body + slice(s, j, j + 1)
|
|
296
|
+
set j to j + 1
|
|
297
|
+
-- «tr '\n' ','»: un escape solo no es una ruta (con \ → / se leería «/n», absoluta); un patrón con |
|
|
298
|
+
-- tampoco («grep "x\|/done"»): ninguna ruta lleva |
|
|
299
|
+
set out to out + (when matches(body, ".*\\s.*") or body == "" or matches(body, "^(\\\\[a-z0-9]+)+$") or contains(body, "|") then " Q " otherwise body)
|
|
300
|
+
set i to j + 1
|
|
301
|
+
otherwise
|
|
302
|
+
set out to out + ch
|
|
303
|
+
set i to i + 1
|
|
304
|
+
give out
|
|
305
|
+
|
|
306
|
+
-- los comandos de una línea de shell (&&, ||, ; y |)
|
|
307
|
+
export task segments(cmd)
|
|
308
|
+
give where(apply(split(regex_replace(cmd, "&&|\\|\\||;|\\|", "\n"), "\n"), (s) => trim(s)), (s) => s != "")
|
|
309
|
+
|
|
310
|
+
-- el subcomando de git de un segmento ("git -C ../dev --no-pager diff x" → "diff"); "" si no es git
|
|
311
|
+
export task git_sub(seg)
|
|
312
|
+
let w be where(split(regex_replace(trim(seg), "\\s+", " "), " "), (x) => x != "")
|
|
313
|
+
when length(w) == 0 or w[0] != "git"
|
|
205
314
|
give ""
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
315
|
+
let i be 1
|
|
316
|
+
while i < length(w)
|
|
317
|
+
let t be w[i]
|
|
318
|
+
when t == "-c" or t == "-C" or t == "--git-dir" or t == "--work-tree"
|
|
319
|
+
set i to i + 2
|
|
320
|
+
otherwise when starts_with(t, "-")
|
|
321
|
+
set i to i + 1
|
|
322
|
+
otherwise
|
|
323
|
+
give t
|
|
213
324
|
give ""
|
|
325
|
+
|
|
326
|
+
-- una ruta desde un lugar del proyecto. Un lugar es la lista de carpetas desde la raíz de la copia principal ([] es la
|
|
327
|
+
-- raíz; [".lampson", "worktrees", "dev"] la copia de dev); si empieza con «..» quedó fuera del proyecto.
|
|
328
|
+
-- «@root» es la raíz del proyecto (así se reescribe su ruta absoluta).
|
|
329
|
+
export task walk(start, p)
|
|
330
|
+
let out be start
|
|
331
|
+
let q be replace(p, "\\", "/")
|
|
332
|
+
when starts_with(q, "@root")
|
|
333
|
+
set out to []
|
|
334
|
+
set q to slice(q, 5, length(q))
|
|
335
|
+
each part in split(q, "/")
|
|
336
|
+
when part == ".."
|
|
337
|
+
when length(out) > 0 and out[length(out) - 1] != ".."
|
|
338
|
+
set out to slice(out, 0, length(out) - 1)
|
|
339
|
+
otherwise
|
|
340
|
+
set out to append(out, "..")
|
|
341
|
+
otherwise when part != "" and part != "."
|
|
342
|
+
set out to append(out, part)
|
|
343
|
+
give out
|
|
344
|
+
|
|
345
|
+
-- qué es un lugar: {kind: mine | peer | lampson | main | outside, agent}
|
|
346
|
+
export task zone(loc, me)
|
|
347
|
+
when length(loc) > 0 and loc[0] == ".."
|
|
348
|
+
give {"kind": "outside", "agent": ""}
|
|
349
|
+
when length(loc) >= 3 and loc[0] == ".lampson" and loc[1] == "worktrees"
|
|
350
|
+
give {"kind": when loc[2] == lower(me["agent"]) then "mine" otherwise "peer", "agent": loc[2]}
|
|
351
|
+
when length(loc) > 0 and loc[0] == ".lampson"
|
|
352
|
+
give {"kind": "lampson", "agent": ""}
|
|
353
|
+
give {"kind": "main", "agent": ""}
|
|
354
|
+
|
|
355
|
+
-- ¿la palabra es una ruta? (tiene separadores o es «..»/«.»); un rango de git (main..HEAD) o una URL no
|
|
356
|
+
task pathish(w)
|
|
357
|
+
when w == ".." or w == "." or starts_with(w, "@root")
|
|
358
|
+
give true
|
|
359
|
+
when contains(w, "://") or not (contains(w, "/") or contains(w, "\\"))
|
|
360
|
+
give false
|
|
361
|
+
give true
|
|
362
|
+
|
|
363
|
+
-- los que dependen de un asiento, directa o indirectamente (me.below lo arma runtime.syn con teams.below)
|
|
364
|
+
task below(me)
|
|
365
|
+
give when contains(me, "below") and me["below"] != nothing then apply(me["below"], (x) => lower(text(x))) otherwise []
|
|
366
|
+
|
|
367
|
+
task seat_deny(why, note)
|
|
368
|
+
give {"decision": "deny", "reason": "team rule: " + why, "note": RULE + note, "grant": false}
|
|
369
|
+
|
|
370
|
+
-- ¿puede cambiar algo en ese lugar? → nothing (sí) o el veredicto (deny / ask para integrar)
|
|
371
|
+
task may_change(z, me, what)
|
|
372
|
+
let mine be "team/" + lower(me["team"]) + "/" + lower(me["agent"])
|
|
373
|
+
when z["kind"] == "mine"
|
|
374
|
+
give nothing
|
|
375
|
+
when z["kind"] == "peer"
|
|
376
|
+
when me["lead"] or contains(below(me), z["agent"])
|
|
377
|
+
give nothing
|
|
378
|
+
give seat_deny("not your copy", "`" + what + "` would change " + z["agent"] + "'s copy (../" + z["agent"] + "), and " + z["agent"] + " does not work under you. Read it as much as you want; to change it, bring their branch into your copy (git merge team/" + lower(me["team"]) + "/" + z["agent"] + "), or tell " + z["agent"] + " what to fix with `send`.")
|
|
379
|
+
when z["kind"] == "main"
|
|
380
|
+
when not me["lead"] and length(below(me)) == 0
|
|
381
|
+
give seat_deny("the person's copy", "`" + what + "` would change the main checkout (../../..), the person's own copy. Whoever leads or reviews integrates into it. Commit on your branch (" + mine + ") and `send` " + (when me["boss"] != "" then me["boss"] otherwise "your lead") + " that it is ready.")
|
|
382
|
+
when me["integration_ok"]
|
|
383
|
+
give nothing
|
|
384
|
+
give {"decision": "ask", "reason": "works in the person's own copy of the project (" + me["main"] + ": integrating, fixing, tagging) — the person approves once per objective: after that, this objective doesn't ask again", "note": "", "grant": true}
|
|
385
|
+
when z["kind"] == "lampson"
|
|
386
|
+
give seat_deny("Lampson's folder", "`" + what + "` would change Lampson's own folder (.lampson). The copies are ../<agent> and the main checkout is ../../..")
|
|
387
|
+
give seat_deny("outside the project", "`" + what + "` points outside the project, and nobody in a team works outside the project. Bash starts in your copy; use paths relative to it (other copies: ../<agent>, the main checkout: ../../..).")
|
|
388
|
+
|
|
389
|
+
-- qué hace un asiento con un comando de bash. me = {agent, team, lead (bool), below (los que dependen de él), boss,
|
|
390
|
+
-- main (rama principal), home (ruta absoluta del proyecto, opcional), integration_ok (bool: la persona ya aprobó
|
|
391
|
+
-- trabajar en su copia en este objetivo)} → {decision: allow|ask|deny, reason, note (lo que lee el modelo si no corre),
|
|
392
|
+
-- grant (aprobarlo vale para el resto del objetivo)}
|
|
393
|
+
export task seat_bash(command, me)
|
|
394
|
+
let mine be "team/" + lower(me["team"]) + "/" + lower(me["agent"])
|
|
395
|
+
let cmd be " " + lower(replace(plain(command), "\\", "/")) + " "
|
|
396
|
+
let home be when contains(me, "home") and me["home"] != nothing then lower(replace(text(me["home"]), "\\", "/")) otherwise ""
|
|
397
|
+
when home != ""
|
|
398
|
+
set home to regex_replace(home, "/+$", "")
|
|
399
|
+
set cmd to replace(cmd, home, "@root")
|
|
400
|
+
-- git bash escribe C:/x como /c/x
|
|
401
|
+
when matches(home, "^[a-z]:/.*")
|
|
402
|
+
set cmd to replace(cmd, "/" + slice(home, 0, 1) + slice(home, 2, length(home)), "@root")
|
|
403
|
+
let abs be absolute_path(regex_replace(cmd, "@root\\S*", " "))
|
|
404
|
+
when abs != ""
|
|
405
|
+
give seat_deny("outside the project", "Your working copy is your workplace: bash starts there and relative paths are relative to it. This command names an absolute path outside the project (" + abs + "), and nobody in a team works outside the project. Use paths relative to your copy (other copies: ../<agent>, the main checkout: ../../..).")
|
|
406
|
+
when matches(cmd, ".*\\bgit\\b.*\\bpush\\b.*")
|
|
407
|
+
when not me["lead"]
|
|
408
|
+
give seat_deny("push is the lead's", "Only the lead pushes, with the person's approval. Commit on your branch (" + mine + ") and `send` " + (when me["boss"] != "" then me["boss"] otherwise "your lead") + " that it is ready.")
|
|
409
|
+
give {"decision": "ask", "reason": "git push — leaves this machine (the person approves each push)", "note": "", "grant": false}
|
|
410
|
+
-- desde su copia, .lampson/worktrees/… no existe: lo nombra quien cree estar en la raíz del proyecto
|
|
411
|
+
when contains(regex_replace(cmd, "@root\\S*", " "), ".lampson/worktrees")
|
|
412
|
+
give seat_deny("wrong path", "You are already inside your own copy (bash starts there), so `.lampson/worktrees/…` does not exist from here. The other copies are ../<agent> and the main checkout is ../../..")
|
|
413
|
+
-- cada segmento desde donde lo dejó el cd anterior: «cd ../../.. && git merge x» trabaja en la copia principal
|
|
414
|
+
let here be [".lampson", "worktrees", lower(me["agent"])]
|
|
415
|
+
let pending be nothing
|
|
416
|
+
each s in segments(cmd)
|
|
417
|
+
let w be where(split(regex_replace(s, "\\s+", " "), " "), (x) => x != "")
|
|
418
|
+
-- X=1 cmd: el comando es el que sigue a las variables
|
|
419
|
+
while length(w) > 0 and matches(w[0], "^[a-z_][a-z0-9_]*=.*")
|
|
420
|
+
set w to slice(w, 1, length(w))
|
|
421
|
+
when length(w) > 0
|
|
422
|
+
let cmd0 be w[0]
|
|
423
|
+
when cmd0 == "cd" or cmd0 == "pushd"
|
|
424
|
+
let dest be when length(w) > 1 then w[1] otherwise "~"
|
|
425
|
+
when dest == "~" or starts_with(dest, "$home")
|
|
426
|
+
give seat_deny("outside the project", "`cd` alone goes to your home folder, outside the project. Bash starts in your copy; use paths relative to it.")
|
|
427
|
+
when dest != "-" and not starts_with(dest, "$")
|
|
428
|
+
set here to walk(here, dest)
|
|
429
|
+
when zone(here, me)["kind"] == "outside"
|
|
430
|
+
give seat_deny("outside the project", "`" + s + "` leaves the project. Bash starts in your copy; the other copies are ../<agent> and the main checkout is ../../.. — nothing above it.")
|
|
431
|
+
otherwise
|
|
432
|
+
-- dónde actúa: donde está parado y cada ruta que nombra
|
|
433
|
+
let places be [here]
|
|
434
|
+
each x in slice(w, 1, length(w))
|
|
435
|
+
let vx be regex_replace(regex_replace(x, "^-[a-z-]*=", ""), "^[0-9]*[<>]+&?", "")
|
|
436
|
+
when pathish(vx)
|
|
437
|
+
set places to append(places, walk(here, vx))
|
|
438
|
+
let sub be git_sub(s)
|
|
439
|
+
let redirect be contains(regex_replace(s, "[0-9]*>&[0-9-]+|&?[0-9]*>>?\\s*/dev/(null|stdout|stderr)", " "), ">")
|
|
440
|
+
let reads be not redirect and ((cmd0 == "git" and contains(GIT_READ, sub) and not matches(" " + s + " ", ".*\\s-(d|D|f|m|M|-delete|-force)\\s.*")) or (cmd0 != "git" and contains(READ_CMDS, cmd0) and not (cmd0 == "find" and matches(s, ".*-(delete|exec|execdir|ok)\\b.*"))) or (cmd0 == "sed" and not matches(s, ".*\\s-[a-z]*i.*")))
|
|
441
|
+
each loc in places
|
|
442
|
+
let z be zone(loc, me)
|
|
443
|
+
when z["kind"] == "outside"
|
|
444
|
+
give seat_deny("outside the project", "`" + s + "` points outside the project, and nobody in a team works outside the project. Use paths relative to your copy (other copies: ../<agent>, the main checkout: ../../..).")
|
|
445
|
+
when not reads
|
|
446
|
+
let vc be may_change(z, me, s)
|
|
447
|
+
when vc != nothing
|
|
448
|
+
when vc["decision"] == "deny"
|
|
449
|
+
give vc
|
|
450
|
+
set pending to vc
|
|
451
|
+
-- ramas: mover o borrar la de alguien que no depende de vos, no; la principal es integrar
|
|
452
|
+
when (sub == "update-ref" or sub == "branch") and not reads
|
|
453
|
+
each b in regex_find_all(s, "team/[a-z0-9._-]+/[a-z0-9._-]+")
|
|
454
|
+
let owner be split(b, "/")[2]
|
|
455
|
+
when b != mine and not me["lead"] and not contains(below(me), owner)
|
|
456
|
+
give seat_deny("not your branch", "`" + b + "` is " + owner + "'s branch, and " + owner + " does not work under you. You move or delete your own branches (" + mine + ") and those of whoever works under you.")
|
|
457
|
+
when matches(" " + s + " ", ".*[\\s/]" + lower(me["main"]) + "\\s.*")
|
|
458
|
+
let vb be may_change({"kind": "main", "agent": ""}, me, s)
|
|
459
|
+
when vb != nothing
|
|
460
|
+
when vb["decision"] == "deny"
|
|
461
|
+
give vb
|
|
462
|
+
set pending to vb
|
|
463
|
+
when pending != nothing
|
|
464
|
+
give pending
|
|
465
|
+
give {"decision": "allow", "reason": "within your seat", "note": "", "grant": false}
|
|
466
|
+
|
|
467
|
+
-- las tools de archivos de un asiento: leer en todo el proyecto; cambiar donde puede cambiar bash
|
|
468
|
+
export task seat_file(name, args, me)
|
|
469
|
+
when name != "write" and name != "edit"
|
|
470
|
+
give {"decision": "allow", "reason": "reading", "note": "", "grant": false}
|
|
471
|
+
let p be when contains(args, "path") and args["path"] != nothing then replace(text(args["path"]), "\\", "/") otherwise "."
|
|
472
|
+
let home be when contains(me, "home") and me["home"] != nothing then regex_replace(replace(text(me["home"]), "\\", "/"), "/+$", "") otherwise ""
|
|
473
|
+
when home != "" and starts_with(lower(p), lower(home))
|
|
474
|
+
set p to "@root" + slice(p, length(home), length(p))
|
|
475
|
+
when absolute_path(p) != "" and not starts_with(p, "@root")
|
|
476
|
+
give seat_deny("outside the project", "`" + text(args["path"]) + "` is outside the project. Paths are relative to your copy (other copies: ../<agent>, the main checkout: ../../..).")
|
|
477
|
+
let v be may_change(zone(walk([".lampson", "worktrees", lower(me["agent"])], p), me), me, name + " " + text(args["path"]))
|
|
478
|
+
when v != nothing
|
|
479
|
+
give v
|
|
480
|
+
give {"decision": "allow", "reason": "within your seat", "note": "", "grant": false}
|
|
481
|
+
|
|
482
|
+
-- integrar a la rama principal: la persona lo aprueba una vez por objetivo (me.objective); sin objetivo, cada vez.
|
|
483
|
+
-- En un archivo y no en state_*: la regla corre también en la terminal y en los tests, no solo en serve
|
|
484
|
+
export let GRANTS_FILE be ".lampson/team-integrations.json"
|
|
485
|
+
|
|
486
|
+
task grants()
|
|
487
|
+
require file(".lampson")
|
|
488
|
+
require file(".lampson/**")
|
|
489
|
+
try
|
|
490
|
+
let g be json_decode(read_file(GRANTS_FILE))
|
|
491
|
+
give when type_of(g) == "map" then g otherwise {}
|
|
492
|
+
recover err
|
|
493
|
+
give {}
|
|
494
|
+
|
|
495
|
+
task grant_key(me)
|
|
496
|
+
give me["team"] + ":" + text(me["objective"])
|
|
497
|
+
|
|
498
|
+
export task integration_ok(me)
|
|
499
|
+
require file(".lampson")
|
|
500
|
+
require file(".lampson/**")
|
|
501
|
+
when not contains(me, "objective") or me["objective"] == 0
|
|
502
|
+
give false
|
|
503
|
+
give contains(grants(), grant_key(me))
|
|
504
|
+
|
|
505
|
+
export task grant_integration(me)
|
|
506
|
+
require file(".lampson")
|
|
507
|
+
require file(".lampson/**")
|
|
508
|
+
require time
|
|
509
|
+
when contains(me, "objective") and me["objective"] != 0
|
|
510
|
+
let g be grants()
|
|
511
|
+
set g[grant_key(me)] to now()
|
|
512
|
+
write_file(GRANTS_FILE, json_encode(g))
|