mirror of
https://github.com/urbit/shrub.git
synced 2024-08-17 08:00:39 +03:00
Merge remote-tracking branch 'upstream/master' into dev-summit
This commit is contained in:
commit
e0009aada1
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:feaae0eece54db3e92122263706c283674af581d14ffde8a29fb24e1873a35b1
|
||||
size 6453015
|
||||
oid sha256:c2ab6607450382e0ec80c7264dad2c72d69672eaf861eb1c24cde5a76921c6a3
|
||||
size 9972490
|
||||
|
@ -3,7 +3,7 @@
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
tools = {
|
||||
flake = false;
|
||||
url = "github:urbit/tools";
|
||||
url = "github:urbit/tools/d454e2482c3d4820d37db6d5625a6d40db975864";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -28,17 +28,6 @@ let
|
||||
--
|
||||
|
||||
'';
|
||||
testThread = dojoCommand:
|
||||
pkgs.writeTextFile {
|
||||
name = "${dojoCommand}.hoon";
|
||||
text = ''
|
||||
${poke}
|
||||
=/ m (strand ,vase)
|
||||
;< [=ship =desk =case] bind:m get-beak
|
||||
;< ok=? bind:m (poke [ship %dojo] %lens-command !>([%$ [%dojo '${dojoCommand}'] [%stdout ~]]))
|
||||
(pure:m !>(ok))
|
||||
'';
|
||||
};
|
||||
appThread = generator: app:
|
||||
pkgs.writeTextFile {
|
||||
name = ":${app}|${generator}.hoon";
|
||||
@ -87,11 +76,12 @@ in pkgs.stdenvNoCC.mkDerivation {
|
||||
|
||||
sleep 2
|
||||
|
||||
${click} -k -p -i ${testThread "-test %/tests ~"} ./pier
|
||||
${click} -c ./pier "[0 %fyrd [%base %test %noun %noun 0]]"
|
||||
|
||||
${click} -k -p -i ${pokeApp "%agents" "noun" "test"} ./pier
|
||||
${click} -k -p -i ${pokeApp "%generators" "noun" "test"} ./pier
|
||||
${click} -k -p -i ${pokeApp "%marks" "noun" "test"} ./pier
|
||||
${click} -k -p -i ${pokeApp "%threads" "noun" "test"} ./pier
|
||||
|
||||
${click} -k -p -i ${appThread "mass" "hood"} ./pier
|
||||
sleep 2
|
||||
@ -112,7 +102,7 @@ in pkgs.stdenvNoCC.mkDerivation {
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
if egrep "((FAILED|CRASHED|Failed)|warn:)" $out >/dev/null; then
|
||||
if egrep "((FAILED|CRASHED|Failed|\[0 %avow 0 %noun 1\])|warn:)" $out >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
@ -663,34 +663,55 @@
|
||||
(pe ~bud) :: XX why ~bud? need an example
|
||||
::
|
||||
%read
|
||||
?~ pier=(~(get by ships.piers) from.ae)
|
||||
(pe from.ae)
|
||||
?~ pier=(~(get by ships.piers) ship.from.ae)
|
||||
(pe ship.from.ae)
|
||||
=/ cash (~(get by namespace.u.pier) path.ae)
|
||||
|-
|
||||
?^ cash
|
||||
?: (gth num.ae (lent u.cash))
|
||||
(pe from.ae)
|
||||
(pe ship.from.ae)
|
||||
::TODO depends on /ted/aqua/ames behavior in a weird indirect way
|
||||
=/ for=@p `@`(tail for.ae) ::NOTE moons & comets not supported
|
||||
=; task=task-arvo
|
||||
^$(ae [%event for /a/aqua/fine-response task], thus this)
|
||||
:+ %hear `lane:ames`[%| `@`from.ae]
|
||||
=/ for=@p `@`(tail lane.for.ae) ::NOTE moons & comets not supported
|
||||
%- push-events:(pe for)
|
||||
%- flop =< events
|
||||
%+ roll u.cash
|
||||
|= [=yowl:ames i=@ud events=(list unix-event)]
|
||||
:- +(i)
|
||||
:_ events
|
||||
:- /a/aqua/fine-response/[(scot %ud i)]
|
||||
^- task-arvo
|
||||
:+ %hear `lane:ames`[%| `@`ship.from.ae]
|
||||
^- blob:ames
|
||||
=/ =shot:ames
|
||||
::NOTE dec is important! so dumb!!
|
||||
(sift-shot:ames `@`(snag (dec num.ae) u.cash))
|
||||
::TODO runtime needs to update rcvr field also
|
||||
::NOTE rcvr life is allowed to be wrong
|
||||
(etch-shot:ames shot(sndr from.ae, rcvr for))
|
||||
%- etch-shot:ames
|
||||
:* [sndr=ship.from.ae rcvr=for]
|
||||
req=| sam=|
|
||||
sndr-tick=life.from.ae
|
||||
rcvr-tick=life.for.ae
|
||||
origin=~
|
||||
content=`@ux`yowl
|
||||
==
|
||||
::
|
||||
=/ pacs=(unit (list yowl:ames))
|
||||
=/ =path [%fine %hunk (scot %ud num.ae) '512' path.ae]
|
||||
%+ biff
|
||||
(peek-once:(pe from.ae) %ax %$ [%fine %message path.ae])
|
||||
(peek-once:(pe ship.from.ae) %ax %$ path)
|
||||
(soft (list yowl:ames))
|
||||
?~ pacs (pe from.ae)
|
||||
?~ pacs (pe ship.from.ae)
|
||||
=. u.pacs
|
||||
:: add request to each response packet payload
|
||||
::
|
||||
=+ pat=(spat path.ae)
|
||||
=+ wid=(met 3 pat)
|
||||
%- flop =< blobs
|
||||
%+ roll u.pacs
|
||||
|= [=yowl:ames num=_1 blobs=(list @ux)]
|
||||
:- +(num)
|
||||
:_ blobs
|
||||
(can 3 4^num 2^wid wid^`@`pat (met 3 yowl)^yowl ~)
|
||||
=. namespace.u.pier
|
||||
(~(put by namespace.u.pier) path.ae u.pacs)
|
||||
=. ships.piers
|
||||
(~(put by ships.piers) from.ae u.pier)
|
||||
(~(put by ships.piers) ship.from.ae u.pier)
|
||||
$(cash pacs, thus this)
|
||||
::
|
||||
%event
|
||||
|
@ -42,8 +42,8 @@
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
?> =(our src):bowl
|
||||
?: ?=(%noun mark)
|
||||
?> (team:title [our src]:bowl)
|
||||
=/ code !<((unit @t) vase)
|
||||
=/ msg=tape
|
||||
?~ code
|
||||
@ -55,6 +55,13 @@
|
||||
"""
|
||||
%- (slog leaf+msg ~)
|
||||
[~ this(passcode code)]
|
||||
?: ?=(%json mark)
|
||||
=/ jon=json !<(json vase)
|
||||
=, dejs:format
|
||||
=/ cmd
|
||||
((of clear-eyre-cache+(ot url+so ~) ~) jon)
|
||||
?> ?=(%clear-eyre-cache -.cmd)
|
||||
[[%pass /cmd %arvo %e %set-response +.cmd ~]~ this]
|
||||
?. ?=(%handle-http-request mark)
|
||||
(on-poke:def mark vase)
|
||||
=+ !<([eyre-id=@ta =inbound-request:eyre] vase)
|
||||
@ -315,6 +322,19 @@
|
||||
:~ 'location'^s+(cat 3 (fall site '*') (spat path))
|
||||
'action'^(render-action:v-eyre action)
|
||||
==
|
||||
::
|
||||
:: /eyre/cache.json
|
||||
::
|
||||
[%eyre %cache ~]
|
||||
%- some
|
||||
:- %a
|
||||
%+ turn (sort ~(tap by cache:v-eyre) aor)
|
||||
|= [url=@t aeon=@ud val=(unit cache-entry:eyre)]
|
||||
%- pairs
|
||||
:~ 'url'^s+url
|
||||
'aeon'^(numb aeon)
|
||||
'val'^?~(val ~ (render-cache-entry:v-eyre u.val))
|
||||
==
|
||||
::
|
||||
:: /eyre/connections.json
|
||||
::
|
||||
@ -566,7 +586,6 @@
|
||||
%- pairs
|
||||
:~ 'messages'^(numb (lent messages))
|
||||
'packets'^(numb ~(wyt in packets))
|
||||
'heeds'^(set-array heeds from-duct)
|
||||
'keens'^(set-array ~(key by keens) path)
|
||||
==
|
||||
::
|
||||
@ -630,7 +649,6 @@
|
||||
:: }, ...],
|
||||
:: closing: [bone, ..., bone],
|
||||
:: corked: [bone, ..., bone],
|
||||
:: heeds: [['/paths', ...] ...]
|
||||
:: scries:
|
||||
:: -> { =path
|
||||
:: keen-state: {
|
||||
@ -757,8 +775,6 @@
|
||||
'closing'^(set-array closing numb)
|
||||
::
|
||||
'corked'^(set-array corked numb)
|
||||
::
|
||||
'heeds'^(set-array heeds from-duct)
|
||||
::
|
||||
'scries'^(scries ~(tap by keens))
|
||||
==
|
||||
@ -773,7 +789,7 @@
|
||||
'next'^(numb next)
|
||||
::
|
||||
:- 'unsent-messages' :: as byte sizes
|
||||
(set-array unsent-messages (cork (cury met 3) numb))
|
||||
(set-array unsent-messages (cork jam (cork (cury met 3) numb)))
|
||||
::
|
||||
'unsent-fragments'^(numb (lent unsent-fragments)) :: as lent
|
||||
::
|
||||
@ -1038,6 +1054,9 @@
|
||||
++ bindings
|
||||
(scry ,(list [=binding =duct =action]) %e %bindings ~)
|
||||
::
|
||||
++ cache
|
||||
(scry ,(map url=@t [aeon=@ud (unit cache-entry)]) %e %cache ~)
|
||||
::
|
||||
++ connections
|
||||
(scry ,(map duct outstanding-connection) %e %connections ~)
|
||||
::
|
||||
@ -1065,6 +1084,27 @@
|
||||
%gen :((cury cat 3) '+' (spat [desk path]:generator.action))
|
||||
%app (cat 3 ':' app.action)
|
||||
==
|
||||
::
|
||||
++ render-cache-entry
|
||||
|= cache-entry
|
||||
^- json
|
||||
%- pairs:enjs:format
|
||||
:~ 'auth'^b+auth
|
||||
'payload'^(render-simple-payload simple-payload.body)
|
||||
==
|
||||
::
|
||||
++ render-simple-payload
|
||||
|= simple-payload:http
|
||||
^- json
|
||||
=, enjs:format
|
||||
%- pairs
|
||||
:~ 'status'^(numb status-code.response-header)
|
||||
'data'^?~(data ~ (numb p.u.data))
|
||||
::
|
||||
:+ 'headers' %a
|
||||
%+ turn headers.response-header
|
||||
|=([k=@t v=@t] (pairs 'key'^s+k 'value'^s+v ~))
|
||||
==
|
||||
--
|
||||
::
|
||||
:: helpers
|
||||
|
1
pkg/arvo/app/debug/FileSystemWritableFileStream.js
Normal file
1
pkg/arvo/app/debug/FileSystemWritableFileStream.js
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
BIN
pkg/arvo/app/debug/index.css
Normal file
BIN
pkg/arvo/app/debug/index.css
Normal file
Binary file not shown.
@ -1,20 +1,16 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Debug Dashboard</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<link rel="stylesheet" href="/~debug/css/index.css" />
|
||||
<link rel="icon" type="image/png" href="/~launch/img/Favicon.png">
|
||||
<style type="text/css" src="/src/index.css"></style>
|
||||
<script type="module" crossorigin src="/~debug/index.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/~debug/index.css">
|
||||
</head>
|
||||
|
||||
<body class="w-100 h-100">
|
||||
<div id="root" class="w-100 h-100">
|
||||
</div>
|
||||
<script src="/~debug/js/channel.js"></script>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/~debug/channel.js"></script>
|
||||
<script src="/~debug/js/session.js"></script>
|
||||
<script src="/~debug/js/index.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
125
pkg/arvo/app/debug/index.js
Normal file
125
pkg/arvo/app/debug/index.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1
pkg/arvo/app/debug/memory.js
Normal file
1
pkg/arvo/app/debug/memory.js
Normal file
@ -0,0 +1 @@
|
||||
import{errors as c,isChunkObject as y}from"./util.js";import"./index.js";let n=globalThis.File,p=globalThis.Blob;const m=o=>{n=o},g=o=>{p=o},{INVALID:z,GONE:s,MISMATCH:w,MOD_ERR:E,SYNTAX:l,DISALLOWED:O}=c;class D{constructor(e,i){this.fileHandle=e,this.file=i?e.file:new n([],e.file.name,e.file),this.size=i?e.file.size:0,this.position=0}async write(e){if(!this.fileHandle.file)throw new DOMException(...s);let i=this.file;if(y(e)){if(e.type==="write"){if(typeof e.position=="number"&&e.position>=0&&(this.position=e.position,this.size<e.position&&(this.file=new n([this.file,new ArrayBuffer(e.position-this.size)],this.file.name,this.file))),!("data"in e))throw new DOMException(...l("write requires a data argument"));e=e.data}else if(e.type==="seek")if(Number.isInteger(e.position)&&e.position>=0){if(this.size<e.position)throw new DOMException(...z);this.position=e.position;return}else throw new DOMException(...l("seek requires a position argument"));else if(e.type==="truncate")if(Number.isInteger(e.size)&&e.size>=0){i=e.size<this.size?new n([i.slice(0,e.size)],i.name,i):new n([i,new Uint8Array(e.size-this.size)],i.name,i),this.size=i.size,this.position>i.size&&(this.position=i.size),this.file=i;return}else throw new DOMException(...l("truncate requires a size argument"))}e=new p([e]);let t=this.file;const a=t.slice(0,this.position),d=t.slice(this.position+e.size);let r=this.position-a.size;r<0&&(r=0),t=new n([a,new Uint8Array(r),e,d],t.name),this.size=t.size,this.position+=e.size,this.file=t}async close(){if(!this.fileHandle.file)throw new DOMException(...s);this.fileHandle.file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this.kind="file",this.deleted=!1,this.file=i,this.name=e,this.writable=t}async getFile(){if(this.deleted||this.file===null)throw new DOMException(...s);return this.file}async createWritable(e){if(!this.writable)throw new DOMException(...O);if(this.deleted)throw new DOMException(...s);return new D(this,!!(e!=null&&e.keepExistingData))}async isSameEntry(e){return this===e}destroy(){this.deleted=!0,this.file=null}}class h{constructor(e,i=!0){this.kind="directory",this.deleted=!1,this._entries={},this.name=e,this.writable=i}async*entries(){if(this.deleted)throw new DOMException(...s);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i={}){if(this.deleted)throw new DOMException(...s);const t=this._entries[e];if(t){if(t instanceof f)throw new DOMException(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new DOMException(...s)}}async getFileHandle(e,i={}){const t=this._entries[e];if(t){if(t instanceof f)return t;throw new DOMException(...w)}else{if(i.create)return this._entries[e]=new f(e);throw new DOMException(...s)}}async removeEntry(e,i={}){const t=this._entries[e];if(!t)throw new DOMException(...s);t.destroy(i.recursive),delete this._entries[e]}destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new DOMException(...E);i.destroy(e)}this._entries={},this.deleted=!0}}const M=new h(""),u=()=>M;export{f as FileHandle,h as FolderHandle,u as default,g as setBlobImpl,m as setFileImpl};
|
7
pkg/arvo/app/debug/util.js
Normal file
7
pkg/arvo/app/debug/util.js
Normal file
@ -0,0 +1,7 @@
|
||||
function __vite__mapDeps(indexes) {
|
||||
if (!__vite__mapDeps.viteFileDeps) {
|
||||
__vite__mapDeps.viteFileDeps = ["memory.js","index.js","index.css"]
|
||||
}
|
||||
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
|
||||
}
|
||||
import{_ as l}from"./index.js";const E={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:e=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${e}`,"SyntaxError"],ABORT:["The operation was aborted","AbortError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},y=e=>typeof e=="object"&&typeof e.type<"u";async function v(e){var o,r,a;const{FolderHandle:t,FileHandle:u}=await l(()=>import("./memory.js"),__vite__mapDeps([0,1,2])),{FileSystemDirectoryHandle:m}=await l(()=>import("./index.js").then(n=>n.a),__vite__mapDeps([1,2])),p=(r=(o=e[0].webkitRelativePath)===null||o===void 0?void 0:o.split("/",1)[0])!==null&&r!==void 0?r:"",_=new t(p,!1);for(let n=0;n<e.length;n++){const i=e[n],d=!((a=i.webkitRelativePath)===null||a===void 0)&&a.length?i.webkitRelativePath.split("/"):["",i.name];d.shift();const f=d.pop(),w=d.reduce((c,s)=>(c._entries[s]||(c._entries[s]=new t(s,!1)),c._entries[s]),_);w._entries[f]=new u(i.name,i,!1)}return new m(_)}async function b(e){const{FileHandle:o}=await l(()=>import("./memory.js"),__vite__mapDeps([0,1,2])),{FileSystemFileHandle:r}=await l(()=>import("./index.js").then(t=>t.F),__vite__mapDeps([1,2]));return Array.from(e).map(t=>new r(new o(t.name,t,!1)))}export{E as errors,y as isChunkObject,v as makeDirHandleFromFileList,b as makeFileHandlesFromFileList};
|
@ -168,7 +168,7 @@
|
||||
::
|
||||
;~ pfix tis
|
||||
;~ pose
|
||||
(parse-variable (jest %dir) ;~(pfix ace :(stag 0 %ex parse-rood)))
|
||||
(parse-variable (cold %dir (jest 'dir ')) :(stag 0 %ex parse-rood))
|
||||
(parse-variable sym ;~(pfix ace parse-source))
|
||||
==
|
||||
==
|
||||
|
@ -5,7 +5,6 @@
|
||||
:: keep relevant mark conversions in cache for performance
|
||||
::
|
||||
/$ blit-to-json %blit %json
|
||||
/$ json-to-blit %json %blit
|
||||
/$ json-to-task %json %herm-task
|
||||
::
|
||||
=, jael
|
||||
|
@ -2,8 +2,8 @@
|
||||
/+ drum=hood-drum, helm=hood-helm, kiln=hood-kiln
|
||||
|%
|
||||
+$ state
|
||||
$~ [%26 *state:drum *state:helm *state:kiln]
|
||||
$>(%26 any-state)
|
||||
$~ [%27 *state:drum *state:helm *state:kiln]
|
||||
$>(%27 any-state)
|
||||
::
|
||||
+$ any-state
|
||||
$% [ver=?(%1 %2 %3 %4 %5 %6) lac=(map @tas fin-any-state)]
|
||||
@ -27,6 +27,7 @@
|
||||
[%24 drum=state-4:drum helm=state-2:helm kiln=state-10:kiln]
|
||||
[%25 drum=state-5:drum helm=state-2:helm kiln=state-10:kiln]
|
||||
[%26 drum=state-6:drum helm=state-2:helm kiln=state-10:kiln]
|
||||
[%27 drum=state-6:drum helm=state-2:helm kiln=state-11:kiln]
|
||||
==
|
||||
+$ any-state-tuple
|
||||
$: drum=any-state:drum
|
||||
|
@ -20,256 +20,41 @@
|
||||
::
|
||||
++ nat-timeout ~s25
|
||||
::
|
||||
:: How often to check our IP when we know we're not behind a NAT.
|
||||
::
|
||||
++ ip-timeout ~m5
|
||||
::
|
||||
:: Chosen because it's run by Cloudflare, and others I tried were
|
||||
:: inconsistently slow.
|
||||
::
|
||||
++ ip-reflector 'https://icanhazip.com'
|
||||
::
|
||||
+$ card card:agent:gall
|
||||
+$ ship-state
|
||||
$% [%idle ~]
|
||||
[%poking ~]
|
||||
[%http until=@da]
|
||||
[%waiting until=@da]
|
||||
==
|
||||
+$ state-1
|
||||
$: %1
|
||||
ships=(set ship)
|
||||
nonce=@ud
|
||||
$= plan
|
||||
$~ [%nat ~]
|
||||
$% [%nat ~]
|
||||
[%pub ip=(unit @t)]
|
||||
==
|
||||
::
|
||||
+$ state-3
|
||||
$: %3
|
||||
mode=?(%formal %informal)
|
||||
pokes=@ud
|
||||
timer=(unit [=wire date=@da])
|
||||
galaxy=@p
|
||||
==
|
||||
--
|
||||
::
|
||||
%- agent:dbug
|
||||
::
|
||||
=| state=state-1
|
||||
=| state=state-3
|
||||
=> |%
|
||||
:: Bind for the the writer monad on (quip effect state)
|
||||
++ galaxy-for
|
||||
|= [=ship =bowl:gall]
|
||||
^- @p
|
||||
=/ next (sein:title our.bowl now.bowl ship)
|
||||
?: ?=(%czar (clan:title next))
|
||||
next
|
||||
$(ship next)
|
||||
::
|
||||
++ rind
|
||||
|* [effect=mold state=*]
|
||||
|* state-type=mold
|
||||
|= $: m-b=(quip effect state-type)
|
||||
fun=$-(state-type (quip effect state-type))
|
||||
==
|
||||
^- (quip effect state-type)
|
||||
=^ effects-1=(list effect) state m-b
|
||||
=^ effects-2=(list effect) state (fun state)
|
||||
[(weld effects-1 effects-2) state]
|
||||
++ wait-card
|
||||
|= [=wire now=@da]
|
||||
^- card
|
||||
[%pass wire %arvo %b %wait (add nat-timeout now)]
|
||||
::
|
||||
++ once
|
||||
|= =cord
|
||||
=(cord (scot %uw nonce.state))
|
||||
::
|
||||
:: Subsystem to keep track of which ships to ping across breaches
|
||||
:: and sponsorship changes
|
||||
::
|
||||
++ ships
|
||||
|%
|
||||
++ rind (^rind card state)
|
||||
++ kick
|
||||
|= [our=@p now=@da]
|
||||
++ ping
|
||||
|= [=ship force=?]
|
||||
^- (quip card _state)
|
||||
:: ?: =(%czar (clan:title our))
|
||||
:: `state
|
||||
::
|
||||
:: NB: !! This includes our own ship, and for moons, this is
|
||||
:: what has caused Jael to fetch our own rift from our parent.
|
||||
:: This role may be taken by Ames's subscription to
|
||||
:: %public-keys, but this must be tested before changing the
|
||||
:: behavior here.
|
||||
::
|
||||
=/ new-ships (~(gas in *(set ship)) (saxo:title our now our))
|
||||
=/ removed (~(dif in ships.state) new-ships)
|
||||
=/ added (~(dif in new-ships) ships.state)
|
||||
;< new-state=_state rind
|
||||
?~ removed `state
|
||||
[[%pass /jael %arvo %j %nuke removed]~ state]
|
||||
=. state new-state
|
||||
::
|
||||
;< new-state=_state rind
|
||||
?~ added `state
|
||||
[[%pass /jael %arvo %j %public-keys added]~ state]
|
||||
=. state new-state
|
||||
::
|
||||
:: Kick even if ships weren't added or removed
|
||||
::
|
||||
(kick-pings our now new-ships)
|
||||
::
|
||||
:: Kick whenever we get a response. We really care about
|
||||
:: breaches and sponsorship changes.
|
||||
::
|
||||
:: Delay until next event in case of breach, so that ames can
|
||||
:: clear its state.
|
||||
::
|
||||
++ take-jael
|
||||
|= now=@da
|
||||
^- (quip card _state)
|
||||
[[%pass /jael/delay %arvo %b %wait now]~ state]
|
||||
::
|
||||
++ take-delay kick
|
||||
--
|
||||
::
|
||||
:: Starts pinging a new set of `ships`.
|
||||
::
|
||||
++ kick-pings
|
||||
|= [our=@p now=@da ships=(set ship)]
|
||||
^- (quip card _state)
|
||||
=: nonce.state +(nonce.state)
|
||||
ships.state ships
|
||||
==
|
||||
::
|
||||
?: ?=(%nat -.plan.state)
|
||||
(kick:nat our)
|
||||
(kick:pub our now)
|
||||
::
|
||||
:: Subsystem for pinging our sponsors when we might be behind a NAT
|
||||
::
|
||||
:: Ping each ship every 25 seconds to keep the pinhole open.
|
||||
:: This is expensive, but if you don't do it and you are behind a
|
||||
:: NAT, you will stop receiving packets from other ships except
|
||||
:: during the 30 seconds following each packet you send.
|
||||
::
|
||||
++ nat
|
||||
?> ?=(%nat -.plan.state)
|
||||
|%
|
||||
++ rind (^rind card state)
|
||||
++ kick
|
||||
|= our=@p
|
||||
^- (quip card _state)
|
||||
=/ ships ~(tap in ships.state)
|
||||
|- ^- (quip card _state)
|
||||
?~ ships `state
|
||||
?: =(our i.ships) $(ships t.ships)
|
||||
;< new-state=_state rind (send-ping i.ships)
|
||||
=. state new-state
|
||||
$(ships t.ships)
|
||||
::
|
||||
++ send-ping
|
||||
|= =ship
|
||||
^- (quip card _state)
|
||||
:_ state
|
||||
=/ wire /nat/(scot %uw nonce.state)/ping/(scot %p ship)
|
||||
[%pass wire %agent [ship %ping] %poke %noun !>(~)]~
|
||||
::
|
||||
++ take-ping
|
||||
|= [now=@da =wire error=(unit tang)]
|
||||
^- (quip card _state)
|
||||
?. ?=([%nat @ %ping @ ~] wire) `state
|
||||
?. (once i.t.wire) `state
|
||||
=/ ship (slav %p i.t.t.t.wire)
|
||||
%- (slog ?~(error ~ ['ping: got nack' >ship< u.error]))
|
||||
:_ state
|
||||
=/ wire /nat/(scot %uw nonce.state)/wait/(scot %p ship)
|
||||
[%pass wire %arvo %b %wait (add nat-timeout now)]~
|
||||
::
|
||||
++ take-wait
|
||||
|= =wire
|
||||
^- (quip card _state)
|
||||
?. ?=([%nat @ %wait @ ~] wire) `state
|
||||
?. (once i.t.wire) `state
|
||||
=/ ship (slav %p i.t.t.t.wire)
|
||||
(send-ping ship)
|
||||
--
|
||||
::
|
||||
:: Subsystem for pinging our sponsors when we know we're not behind a NAT
|
||||
::
|
||||
:: Check our IP address every minute, and only if it changes,
|
||||
:: ping all our sponsors.
|
||||
::
|
||||
++ pub
|
||||
?> ?=(%pub -.plan.state)
|
||||
|%
|
||||
++ rind (^rind card state)
|
||||
++ kick
|
||||
|= [our=@p now=@da]
|
||||
^- (quip card _state)
|
||||
;< new-state=_state rind (send-pings our)
|
||||
=. state new-state
|
||||
::
|
||||
;< new-state=_state rind check-ip
|
||||
=. state new-state
|
||||
::
|
||||
(set-timer now)
|
||||
::
|
||||
++ send-pings
|
||||
|= our=@p
|
||||
^- (quip card _state)
|
||||
:_ state
|
||||
%+ murn ~(tap in ships.state)
|
||||
|= =ship
|
||||
?: =(our ship)
|
||||
~
|
||||
=/ wire /pub/(scot %uw nonce.state)/ping/(scot %p ship)
|
||||
`u=[%pass wire %agent [ship %ping] %poke %noun !>(~)]
|
||||
::
|
||||
++ take-pings
|
||||
|= [=wire error=(unit tang)]
|
||||
^- (quip card _state)
|
||||
?. ?=([%pub @ %ping @ ~] wire) `state
|
||||
?. (once i.t.wire) `state
|
||||
=/ ship (slav %p i.t.t.t.wire)
|
||||
%- (slog ?~(error ~ ['ping: got nack' >ship< u.error]))
|
||||
`state
|
||||
::
|
||||
++ check-ip
|
||||
^- (quip card _state)
|
||||
:_ state
|
||||
=/ wire /pub/(scot %uw nonce.state)/ip
|
||||
=/ =request:http [%'GET' ip-reflector ~ ~]
|
||||
[%pass wire %arvo %i %request request *outbound-config:iris]~
|
||||
::
|
||||
++ take-ip
|
||||
|= [our=@p =wire resp=client-response:iris]
|
||||
^- (quip card _state)
|
||||
?. ?=([%pub @ %ip ~] wire) `state
|
||||
?. (once i.t.wire) `state
|
||||
::
|
||||
?. ?=(%finished -.resp) `state :: will retry in a minute
|
||||
?. ?=(%200 status-code.response-header.resp)
|
||||
=* s status-code.response-header.resp
|
||||
%- (slog leaf+"ping: ip check failed: {<s>}" ~)
|
||||
`state
|
||||
::
|
||||
?~ full-file.resp
|
||||
%- (slog 'ping: ip check body empty' ~)
|
||||
`state
|
||||
::
|
||||
=* body q.data.u.full-file.resp
|
||||
?~ body
|
||||
%- (slog 'ping: ip check body empty' ~)
|
||||
`state
|
||||
::
|
||||
=/ ip (end [3 (dec (met 3 body))] body)
|
||||
?: =(ip.plan.state `ip) `state
|
||||
::
|
||||
=. ip.plan.state `ip
|
||||
(send-pings our)
|
||||
::
|
||||
++ set-timer
|
||||
|= now=@da
|
||||
^- (quip card _state)
|
||||
=/ =wire /pub/(scot %uw nonce.state)/wait
|
||||
[[%pass wire %arvo %b %wait (add ip-timeout now)]~ state]
|
||||
::
|
||||
++ take-wait
|
||||
|= [our=@p now=@da =wire]
|
||||
^- (quip card _state)
|
||||
?. ?=([%pub @ %wait ~] wire) `state
|
||||
?. (once i.t.wire) `state
|
||||
;< new-state=_state rind check-ip
|
||||
=. state new-state
|
||||
::
|
||||
(set-timer now)
|
||||
--
|
||||
?: &(!force (gth pokes.state 0) =(ship galaxy.state))
|
||||
[~ state]
|
||||
:_ state(pokes +(pokes.state), galaxy ship)
|
||||
[%pass /ping %agent [ship %ping] %poke %noun !>(~)]~
|
||||
--
|
||||
%+ verb |
|
||||
^- agent:gall
|
||||
@ -281,28 +66,73 @@
|
||||
::
|
||||
++ on-init
|
||||
^- [(list card) _this]
|
||||
=. plan.state [%nat ~]
|
||||
=^ cards state (kick:ships our.bowl now.bowl)
|
||||
[cards this]
|
||||
=. mode.state %formal
|
||||
=. pokes.state 0
|
||||
=. galaxy.state (galaxy-for our.bowl bowl)
|
||||
[~ this]
|
||||
::
|
||||
++ on-save !>(state)
|
||||
++ on-load
|
||||
|= old-vase=vase
|
||||
|^
|
||||
=/ old !<(state-any old-vase)
|
||||
=? old ?=(%0 -.old) (state-0-to-1 old)
|
||||
?> ?=(%1 -.old)
|
||||
=? old ?=(%1 -.old) (state-1-to-2 old)
|
||||
=? old ?=(%2 -.old) (state-2-to-3 old)
|
||||
?> ?=(%3 -.old)
|
||||
=. state old
|
||||
=^ cards state (kick:ships our.bowl now.bowl)
|
||||
[cards this]
|
||||
[~ this]
|
||||
::
|
||||
+$ state-any $%(state-0 state-1)
|
||||
+$ ship-state
|
||||
$% [%idle ~]
|
||||
[%poking ~]
|
||||
[%http until=@da]
|
||||
[%waiting until=@da]
|
||||
==
|
||||
+$ state-any $%(state-0 state-1 state-2 state-3)
|
||||
+$ state-0 [%0 ships=(map ship [=rift =ship-state])]
|
||||
+$ state-1
|
||||
$: %1
|
||||
ships=(set ship)
|
||||
nonce=@ud
|
||||
$= plan
|
||||
$~ [%nat ~]
|
||||
$% [%nat ~]
|
||||
[%pub ip=(unit @t)]
|
||||
== ==
|
||||
+$ state-2
|
||||
$: %2
|
||||
ships=(set ship)
|
||||
nonce=@ud
|
||||
$= plan
|
||||
$~ [%nat ~]
|
||||
$% [%nat ~]
|
||||
[%pub ip=(unit @t)]
|
||||
[%off ~]
|
||||
[%one ~]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ state-0-to-1
|
||||
|= old=state-0
|
||||
^- state-1
|
||||
[%1 ~ 0 %nat ~]
|
||||
::
|
||||
++ state-1-to-2
|
||||
|= old=state-1
|
||||
^- state-2
|
||||
old(- %2)
|
||||
::
|
||||
++ state-2-to-3
|
||||
|= old=state-2
|
||||
^- state-3
|
||||
:* %3 %formal 0 ~
|
||||
=/ galaxy=(list @p)
|
||||
%+ skim ~(tap in ships.old)
|
||||
|=(p=@p ?=(%czar (clan:title p)))
|
||||
?: =(1 (lent galaxy))
|
||||
-.galaxy
|
||||
(head (flop (^saxo:title our.bowl)))
|
||||
==
|
||||
--
|
||||
:: +on-poke: positively acknowledge pokes
|
||||
::
|
||||
@ -311,20 +141,21 @@
|
||||
?. =(our src):bowl :: don't crash, this is where pings are handled
|
||||
`this
|
||||
::
|
||||
?: ?=(%czar (clan:title our.bowl))
|
||||
`this
|
||||
::
|
||||
=^ cards state
|
||||
?: =(q.vase %kick) :: NB: ames calls this on %born
|
||||
(kick:ships our.bowl now.bowl)
|
||||
?: =(q.vase %nat)
|
||||
=. plan.state [%nat ~]
|
||||
(kick:ships our.bowl now.bowl)
|
||||
?: =(q.vase %no-nat)
|
||||
=. plan.state [%pub ~]
|
||||
(kick:ships our.bowl now.bowl)
|
||||
?: ?=([%kick ?] q.vase)
|
||||
=? mode.state =(+.q.vase %.y)
|
||||
%formal
|
||||
(ping (galaxy-for our.bowl bowl) %.n)
|
||||
::
|
||||
?: |(=(q.vase %once) =(q.vase %stop)) :: NB: ames calls this on %once
|
||||
=. mode.state %informal
|
||||
(ping (galaxy-for our.bowl bowl) %.y)
|
||||
`state
|
||||
[cards this]
|
||||
::
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
@ -334,19 +165,18 @@
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- [(list card) _this]
|
||||
=^ cards state
|
||||
?+ wire `state
|
||||
[%nat *]
|
||||
?. ?=(%nat -.plan.state) `state
|
||||
?. ?=(%poke-ack -.sign) `state
|
||||
(take-ping:nat now.bowl wire p.sign)
|
||||
::
|
||||
[%pub *]
|
||||
?. ?=(%pub -.plan.state) `state
|
||||
?. ?=(%poke-ack -.sign) `state
|
||||
(take-pings:pub wire p.sign)
|
||||
==
|
||||
[cards this]
|
||||
?. ?=([%ping *] wire)
|
||||
`this
|
||||
?. ?=(%poke-ack -.sign)
|
||||
`this
|
||||
=. pokes.state (dec pokes.state)
|
||||
?. =(pokes.state 0)
|
||||
`this
|
||||
?. |(?=(%formal mode.state) ?=(^ p.sign))
|
||||
`this
|
||||
=/ wir /wait
|
||||
=. timer.state `[wir now.bowl]
|
||||
[[(wait-card wir now.bowl)]~ this]
|
||||
:: +on-arvo: handle timer firing
|
||||
::
|
||||
++ on-arvo
|
||||
@ -354,36 +184,22 @@
|
||||
^- [(list card) _this]
|
||||
=^ cards state
|
||||
?+ wire `state
|
||||
[%jael %delay ~]
|
||||
[%wait *]
|
||||
?: ?=(%czar (clan:title our.bowl))
|
||||
`state
|
||||
?. ?=(%formal mode.state) `state
|
||||
?> ?=(%wake +<.sign-arvo)
|
||||
?^ error.sign-arvo
|
||||
%- (slog 'ping: strange jael wake fail!' u.error.sign-arvo)
|
||||
%- (slog 'ping: strange wake fail!' u.error.sign-arvo)
|
||||
`state
|
||||
(take-delay:ships our.bowl now.bowl)
|
||||
=. timer.state ~
|
||||
(ping (galaxy-for our.bowl bowl) %.n)
|
||||
::
|
||||
[%jael ~]
|
||||
?> ?=(%public-keys +<.sign-arvo)
|
||||
(take-jael:ships now.bowl)
|
||||
::
|
||||
[%nat *]
|
||||
?. ?=(%nat -.plan.state) `state
|
||||
?> ?=(%wake +<.sign-arvo)
|
||||
?^ error.sign-arvo
|
||||
%- (slog 'ping: strange nat wake fail!' u.error.sign-arvo)
|
||||
`state
|
||||
(take-wait:nat wire)
|
||||
::
|
||||
[%pub @ %ip *]
|
||||
?. ?=(%pub -.plan.state) `state
|
||||
?> ?=(%http-response +<.sign-arvo)
|
||||
(take-ip:pub our.bowl wire client-response.sign-arvo)
|
||||
::
|
||||
[%pub @ %wait *]
|
||||
?. ?=(%pub -.plan.state) `state
|
||||
?> ?=(%wake +<.sign-arvo)
|
||||
(take-wait:pub our.bowl now.bowl wire)
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ on-save !>(state)
|
||||
++ on-fail on-fail:def
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
--
|
||||
|
@ -14,7 +14,7 @@
|
||||
$: starting=(map yarn [=trying =vase])
|
||||
running=(axal thread-form)
|
||||
tid=(map tid yarn)
|
||||
serving=(map tid [(unit @ta) =mark =desk])
|
||||
serving=(map tid [(unit [rid=@ta take=?(%json %noun)]) =mark =desk])
|
||||
scrying=(jug tid [=wire =ship =path])
|
||||
==
|
||||
::
|
||||
@ -26,10 +26,20 @@
|
||||
clean-slate-3
|
||||
clean-slate-4
|
||||
clean-slate-5
|
||||
clean-slate-6
|
||||
clean-slate
|
||||
==
|
||||
::
|
||||
+$ clean-slate
|
||||
$: %7
|
||||
starting=(map yarn [=trying =vase])
|
||||
running=(list yarn)
|
||||
tid=(map tid yarn)
|
||||
serving=(map tid [(unit [rid=@ta take=?(%json %noun)]) =mark =desk])
|
||||
scrying=(jug tid [wire ship path])
|
||||
==
|
||||
::
|
||||
+$ clean-slate-6
|
||||
$: %6
|
||||
starting=(map yarn [=trying =vase])
|
||||
running=(list yarn)
|
||||
@ -121,7 +131,8 @@
|
||||
=. any (old-to-4 any)
|
||||
=. any (old-to-5 any)
|
||||
=. any (old-to-6 any)
|
||||
?> ?=(%6 -.any)
|
||||
=. any (old-to-7 any)
|
||||
?> ?=(%7 -.any)
|
||||
::
|
||||
=. tid.state tid.any
|
||||
=/ yarns=(list yarn)
|
||||
@ -148,8 +159,8 @@
|
||||
++ old-to-2
|
||||
|= old=clean-slate-any
|
||||
^- (quip card clean-slate-any)
|
||||
?> ?=(?(%1 %2 %3 %4 %5 %6) -.old)
|
||||
?: ?=(?(%2 %3 %4 %5 %6) -.old)
|
||||
?> ?=(?(%1 %2 %3 %4 %5 %6 %7) -.old)
|
||||
?: ?=(?(%2 %3 %4 %5 %6 %7) -.old)
|
||||
`old
|
||||
:- ~[bind-eyre:sc]
|
||||
:* %2
|
||||
@ -162,8 +173,8 @@
|
||||
++ old-to-3
|
||||
|= old=clean-slate-any
|
||||
^- clean-slate-any
|
||||
?> ?=(?(%2 %3 %4 %5 %6) -.old)
|
||||
?: ?=(?(%3 %4 %5 %6) -.old)
|
||||
?> ?=(?(%2 %3 %4 %5 %6 %7) -.old)
|
||||
?: ?=(?(%3 %4 %5 %6 %7) -.old)
|
||||
old
|
||||
:* %3
|
||||
starting.old
|
||||
@ -175,8 +186,8 @@
|
||||
++ old-to-4
|
||||
|= old=clean-slate-any
|
||||
^- clean-slate-any
|
||||
?> ?=(?(%3 %4 %5 %6) -.old)
|
||||
?: ?=(?(%4 %5 %6) -.old)
|
||||
?> ?=(?(%3 %4 %5 %6 %7) -.old)
|
||||
?: ?=(?(%4 %5 %6 %7) -.old)
|
||||
old
|
||||
:* %4
|
||||
starting.old
|
||||
@ -188,15 +199,15 @@
|
||||
++ old-to-5
|
||||
|= old=clean-slate-any
|
||||
^- clean-slate-any
|
||||
?> ?=(?(%4 %5 %6) -.old)
|
||||
?: ?=(?(%5 %6) -.old) old
|
||||
?> ?=(?(%4 %5 %6 %7) -.old)
|
||||
?: ?=(?(%5 %6 %7) -.old) old
|
||||
[%5 +.old(serving [serving.old ~])]
|
||||
::
|
||||
++ old-to-6
|
||||
|= old=clean-slate-any
|
||||
^- clean-slate
|
||||
?> ?=(?(%5 %6) -.old)
|
||||
?: ?=(%6 -.old) old
|
||||
^- clean-slate-any
|
||||
?> ?=(?(%5 %6 %7) -.old)
|
||||
?: ?=(?(%6 %7) -.old) old
|
||||
:- %6
|
||||
%= +.old
|
||||
scrying
|
||||
@ -208,6 +219,16 @@
|
||||
::
|
||||
[/keen ship path]~
|
||||
==
|
||||
::
|
||||
++ old-to-7
|
||||
|= old=clean-slate-any
|
||||
^- clean-slate-any
|
||||
?> ?=(?(%6 %7) -.old)
|
||||
?: ?=(%7 -.old) old
|
||||
=- old(- %7, serving -)
|
||||
%- ~(run by serving.old)
|
||||
|= [request=(unit @ta) =mark =desk]
|
||||
[(bind request (late %json)) mark desk]
|
||||
--
|
||||
::
|
||||
++ on-poke
|
||||
@ -309,15 +330,36 @@
|
||||
=* input-mark i.t.t.site.url
|
||||
=* thread i.t.t.t.site.url
|
||||
=* output-mark i.t.t.t.t.site.url
|
||||
=/ =tid (new-thread-id thread)
|
||||
=. serving.state
|
||||
(~(put by serving.state) tid [`eyre-id output-mark desk])
|
||||
:: TODO: speed this up somehow. we spend about 15ms in this arm alone
|
||||
::
|
||||
=/ tube (convert-tube %json input-mark desk bowl)
|
||||
?> ?=(^ body.request.inbound-request)
|
||||
=/ test=$-(@t ?(%json %noun))
|
||||
|= head=@t
|
||||
=; type=(unit @t)
|
||||
?:(=(`'application/x-urb-jam' type) %noun %json)
|
||||
%+ bind
|
||||
(get-header:http head header-list.request.inbound-request)
|
||||
:(cork trip cass crip)
|
||||
=/ give (test 'content-type')
|
||||
=/ take (test 'accept')
|
||||
::
|
||||
=/ =tid (new-thread-id thread)
|
||||
=. serving.state
|
||||
(~(put by serving.state) tid [`[eyre-id take] output-mark desk])
|
||||
::
|
||||
=/ input=vase
|
||||
%+ slop !>(~)
|
||||
?- give
|
||||
%json
|
||||
=/ tube (convert-tube %json input-mark desk bowl)
|
||||
=/ body=json (need (de:json:html q.u.body.request.inbound-request))
|
||||
=/ input=vase (slop !>(~) (tube !>(body)))
|
||||
(tube !>(body))
|
||||
::
|
||||
%noun
|
||||
=/ tube (convert-tube %noun input-mark desk bowl)
|
||||
=/ body=noun (cue q.u.body.request.inbound-request)
|
||||
(tube !>(body))
|
||||
==
|
||||
=/ boc bec
|
||||
=/ =start-args:spider [~ `tid boc(q desk, r da+now.bowl) thread input]
|
||||
(handle-start-thread start-args)
|
||||
@ -490,8 +532,9 @@
|
||||
^- [(list card) _state]
|
||||
%+ roll cards.r
|
||||
|= [=card cards=(list card) s=_state]
|
||||
:_ =? scrying.s ?=([%pass ^ %arvo %a %keen @ *] card)
|
||||
(~(put ju scrying.s) tid [&2 &6 |6]:card)
|
||||
:_ =? scrying.s ?=([%pass ^ %arvo %a %keen ?(~ ^) @ *] card)
|
||||
:: &2=wire &7=ship 7|=path
|
||||
(~(put ju scrying.s) tid [&2 &7 |7]:card)
|
||||
s
|
||||
:_ cards
|
||||
^- ^card
|
||||
@ -549,18 +592,25 @@
|
||||
=- (fall - `state)
|
||||
%+ bind
|
||||
(~(get by serving.state) tid)
|
||||
|= [eyre-id=(unit @ta) output=mark =desk]
|
||||
|= [request=(unit [rid=@ta take=?(%json %noun)]) output=mark =desk]
|
||||
:_ state(serving (~(del by serving.state) tid))
|
||||
?~ eyre-id
|
||||
?~ request
|
||||
~
|
||||
%+ give-simple-payload:app:server u.eyre-id
|
||||
%+ give-simple-payload:app:server rid.u.request
|
||||
^- simple-payload:http
|
||||
?. ?=(http-error:spider term)
|
||||
%- (slog tang)
|
||||
?- take.u.request
|
||||
%json
|
||||
=/ tube (convert-tube %tang %json desk bowl)
|
||||
:- [500 [['content-type' 'application/json'] ~]]
|
||||
=- `(as-octs:mimes:html (en:json:html -))
|
||||
o/(malt `(list [key=@t json])`[term+s/term tang+!<(json (tube !>(tang))) ~])
|
||||
::
|
||||
%noun
|
||||
:- [500 [['content-type' 'application/x-urb-jam'] ~]]
|
||||
`(as-octs:mimes:html (jam [term tang]))
|
||||
==
|
||||
:_ ~ :_ ~
|
||||
?- term
|
||||
%bad-request 400
|
||||
@ -587,13 +637,22 @@
|
||||
=- (fall - `state)
|
||||
%+ bind
|
||||
(~(get by serving.state) tid)
|
||||
|= [eyre-id=(unit @ta) output=mark =desk]
|
||||
?~ eyre-id
|
||||
|= [request=(unit [rid=@ta take=?(%json %noun)]) output=mark =desk]
|
||||
?~ request
|
||||
`state
|
||||
?- take.u.request
|
||||
%json
|
||||
=/ tube (convert-tube output %json desk bowl)
|
||||
:_ state(serving (~(del by serving.state) tid))
|
||||
%+ give-simple-payload:app:server u.eyre-id
|
||||
%+ give-simple-payload:app:server rid.u.request
|
||||
(json-response:gen:server !<(json (tube vase)))
|
||||
::
|
||||
%noun
|
||||
:_ state(serving (~(del by serving.state) tid))
|
||||
%+ give-simple-payload:app:server rid.u.request
|
||||
:- [200 ['content-type' 'application/x-urb-jam']~]
|
||||
`(as-octs:mimes:html (jam q.vase))
|
||||
==
|
||||
::
|
||||
++ thread-done
|
||||
|= [=yarn =vase silent=?]
|
||||
@ -680,7 +739,7 @@
|
||||
::
|
||||
++ clean-state
|
||||
!> ^- clean-slate
|
||||
6+state(running (turn ~(tap of running.state) head))
|
||||
7+state(running (turn ~(tap of running.state) head))
|
||||
::
|
||||
++ convert-tube
|
||||
|= [from=mark to=mark =desk =bowl:gall]
|
||||
|
@ -2,7 +2,8 @@
|
||||
!:
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ test ?(%agents %marks %generators)
|
||||
+$ command $@(=test [=desk =test])
|
||||
+$ test ?(%agents %marks %generators %threads)
|
||||
+$ state
|
||||
$: app=(set path)
|
||||
app-ok=?
|
||||
@ -10,9 +11,10 @@
|
||||
mar-ok=?
|
||||
gen=(set path)
|
||||
gen-ok=?
|
||||
ted=(set path)
|
||||
ted-ok=?
|
||||
==
|
||||
--
|
||||
=, format
|
||||
^- agent:gall
|
||||
=| =state
|
||||
|_ =bowl:gall
|
||||
@ -26,12 +28,16 @@
|
||||
|= [=mark =vase]
|
||||
^- [(list card) _this]
|
||||
?> (team:title [our src]:bowl)
|
||||
=+ !<(cmd=command vase)
|
||||
=? cmd ?=(@ cmd)
|
||||
[q.byk.bowl test.cmd]
|
||||
?> ?=(^ cmd)
|
||||
|^
|
||||
=+ !<(=test vase)
|
||||
?- test
|
||||
?- test.cmd
|
||||
%marks test-marks
|
||||
%agents test-agents
|
||||
%generators test-generators
|
||||
%threads test-threads
|
||||
==
|
||||
::
|
||||
++ test-marks
|
||||
@ -51,7 +57,7 @@
|
||||
|=(c=@tD `@tD`?:(=('/' c) '-' c))
|
||||
=/ sing=card
|
||||
:+ %pass /build/mar/[mak]
|
||||
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %b da+now.bowl /[mak]]
|
||||
[%arvo %c %warp our.bowl desk.cmd ~ %sing %b da+now.bowl /[mak]]
|
||||
%_ $
|
||||
paz t.paz
|
||||
fex [sing fex]
|
||||
@ -73,7 +79,7 @@
|
||||
$(daz t.daz)
|
||||
=/ sing=card
|
||||
:+ %pass /build/app/[i.daz]
|
||||
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl dap-pax]
|
||||
[%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl dap-pax]
|
||||
%_ $
|
||||
daz t.daz
|
||||
fex [sing fex]
|
||||
@ -93,14 +99,33 @@
|
||||
$(paz t.paz)
|
||||
=/ sing=card
|
||||
:+ %pass build+i.paz
|
||||
[%arvo %c %warp our.bowl q.byk.bowl ~ %sing %a da+now.bowl i.paz]
|
||||
[%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl i.paz]
|
||||
%_ $
|
||||
paz t.paz
|
||||
fex [sing fex]
|
||||
gen.state (~(put in gen.state) i.paz)
|
||||
==
|
||||
::
|
||||
++ now-beak %_(byk.bowl r [%da now.bowl])
|
||||
++ test-threads
|
||||
=| fex=(list card)
|
||||
^+ [fex this]
|
||||
?> =(~ ted.state)
|
||||
=. ted-ok.state %.y
|
||||
=+ .^(paz=(list path) ct+(en-beam now-beak /ted))
|
||||
|- ^+ [fex this]
|
||||
?~ paz [(flop fex) this]
|
||||
=/ xap=path (flop i.paz)
|
||||
?. ?=([%hoon *] xap)
|
||||
$(paz t.paz)
|
||||
=/ sing=card
|
||||
:+ %pass build+i.paz
|
||||
[%arvo %c %warp our.bowl desk.cmd ~ %sing %a da+now.bowl i.paz]
|
||||
%_ $
|
||||
paz t.paz
|
||||
fex [sing fex]
|
||||
ted.state (~(put in ted.state) i.paz)
|
||||
==
|
||||
++ now-beak [our.bowl desk.cmd da+now.bowl]
|
||||
--
|
||||
++ on-watch on-watch:def
|
||||
++ on-leave on-leave:def
|
||||
@ -150,6 +175,15 @@
|
||||
~? =(~ gen.state)
|
||||
?:(gen-ok.state %all-generators-built %some-generators-failed)
|
||||
[~ this]
|
||||
::
|
||||
[%ted *]
|
||||
=/ ok ?=(^ p.sign-arvo)
|
||||
%- (report path ok)
|
||||
=? ted-ok.state !ok %.n
|
||||
=. ted.state (~(del in ted.state) path)
|
||||
~? =(~ ted.state)
|
||||
?:(ted-ok.state %all-threads-built %some-threads-failed)
|
||||
[~ this]
|
||||
==
|
||||
++ on-fail on-fail:def
|
||||
--
|
||||
|
161
pkg/arvo/app/verb-logger.hoon
Normal file
161
pkg/arvo/app/verb-logger.hoon
Normal file
@ -0,0 +1,161 @@
|
||||
:: verb-logger: serializes verb-plus events to unix-side json
|
||||
::
|
||||
:: watches specified agents for "verb plus" events, buffers those, and
|
||||
:: periodically (+write-interval) flushes them out to unix, under the
|
||||
:: .urb/put/verb-logger/[agent] directory of the pier.
|
||||
::
|
||||
/+ verb, dbug, verb-json
|
||||
::
|
||||
|%
|
||||
+$ state-0
|
||||
$: %0
|
||||
events=(jar dude:gall event-plus:verb)
|
||||
==
|
||||
::
|
||||
+$ card card:agent:gall
|
||||
::
|
||||
++ write-interval ~h1
|
||||
::
|
||||
++ write-events
|
||||
|= [our=ship =dude:gall events=(list event-plus:verb)]
|
||||
^- (list card)
|
||||
?: =(~ events) ~ ::NOTE tmi
|
||||
=/ first=event-plus:verb
|
||||
(rear events)
|
||||
=/ pax=path
|
||||
/verb-logger/[dude]/(crip (a-co:co (unm:chrono:userlib now.first)))/json
|
||||
=/ vex=@
|
||||
(en:json:html (events:enjs our dude events))
|
||||
[%pass /write/[dude] %agent [our %hood] %poke %drum-put !>([pax vex])]~
|
||||
::
|
||||
++ ingest-event
|
||||
|= $: our=ship
|
||||
events=(jar dude:gall event-plus:verb)
|
||||
[=dude:gall event=event-plus:verb]
|
||||
==
|
||||
^- (quip card _events)
|
||||
?~ ves=(~(get ja events) dude)
|
||||
:- ~
|
||||
(~(put by events) dude [event ~])
|
||||
?: .= (sub now.i.ves (mod now.i.ves write-interval))
|
||||
(sub now.event (mod now.event write-interval))
|
||||
:- ~
|
||||
(~(put by events) dude [event ves])
|
||||
:- (write-events our dude ves)
|
||||
(~(put by events) dude [event ~])
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
++ events
|
||||
|= [our=@p =dude:gall events=(list event-plus:verb)] :: latest-first
|
||||
=/ first=event-plus:verb (rear events)
|
||||
%- pairs
|
||||
:~ 'ship'^s+(scot %p our)
|
||||
'dude'^s+dude
|
||||
'from'^(time now.first)
|
||||
::
|
||||
:- 'events'
|
||||
:- %a
|
||||
%+ roll events ::NOTE we +roll to +turn & +flop simultaneously
|
||||
|= [event=event-plus:verb out=(list json)]
|
||||
[(event:enjs:verb-json event) out]
|
||||
==
|
||||
--
|
||||
--
|
||||
::
|
||||
=| state-0
|
||||
=* state -
|
||||
::
|
||||
%+ verb |
|
||||
%- agent:dbug
|
||||
|_ =bowl:gall
|
||||
+* this .
|
||||
::
|
||||
++ on-init
|
||||
^- (quip card _this)
|
||||
[~ this]
|
||||
::
|
||||
++ on-save
|
||||
!>(state)
|
||||
::
|
||||
++ on-load
|
||||
|= ole=vase
|
||||
^- (quip card _this)
|
||||
[~ this(state !<(state-0 ole))]
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
^- (quip card _this)
|
||||
?> =(%noun mark)
|
||||
?+ q.vase !!
|
||||
[%watch =dude:gall]
|
||||
=* dude dude.q.vase
|
||||
:_ this
|
||||
[%pass /log/[dude] %agent [our.bowl dude] %watch /verb/events-plus]~
|
||||
::
|
||||
[%leave =dude:gall]
|
||||
=* dude dude.q.vase
|
||||
:- :- [%pass /log/[dude] %agent [our.bowl dude] %leave ~]
|
||||
(write-events our.bowl dude (~(get ja events) dude))
|
||||
this(events (~(del by events) dude))
|
||||
::
|
||||
[%flush =dude:gall]
|
||||
|-
|
||||
=* dude dude.q.vase
|
||||
?. =(%$ dude)
|
||||
:- (write-events our.bowl dude (~(get ja events) dude))
|
||||
this(events (~(del by events) dude))
|
||||
=| cards=(list card)
|
||||
=/ dudes=(list dude:gall) ~(tap in ~(key by events))
|
||||
|- ^- (quip card _this)
|
||||
?~ dudes [cards this]
|
||||
=^ caz this ^$(dude.q.vase i.dudes)
|
||||
=. cards (weld cards caz)
|
||||
$(dudes t.dudes)
|
||||
==
|
||||
::
|
||||
++ on-agent
|
||||
|= [=wire =sign:agent:gall]
|
||||
^- (quip card _this)
|
||||
~| wire
|
||||
?+ wire !!
|
||||
[%write @ ~]
|
||||
=* dude i.t.wire
|
||||
?> ?=(%poke-ack -.sign)
|
||||
?~ p.sign [~ this]
|
||||
%. [~ this]
|
||||
%- %*(. slog pri 3)
|
||||
[(cat 3 'verb-logger: lost export for %' dude) u.p.sign]
|
||||
::
|
||||
[%log @ ~]
|
||||
=* dude i.t.wire
|
||||
?- -.sign
|
||||
%poke-ack !!
|
||||
%kick =- [[-]~ this]
|
||||
[%pass /log/[dude] %agent [our.bowl dude] %watch /verb/events-plus]
|
||||
%watch-ack ?~ p.sign [~ this]
|
||||
%. [~ this]
|
||||
%- %*(. slog pri 2)
|
||||
[(cat 3 'verb-logger: failed verb watch for %' dude) u.p.sign]
|
||||
%fact ?> =(%verb-event-plus p.cage.sign)
|
||||
=^ caz events
|
||||
%- ingest-event
|
||||
[our.bowl events dude !<(event-plus:verb q.cage.sign)]
|
||||
[caz this]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
^- (quip card _this)
|
||||
%. [~ this]
|
||||
%- %*(. slog pri 3)
|
||||
:_ tang
|
||||
(cat 3 'verb-logger: dropping the ball: ' term)
|
||||
::
|
||||
++ on-watch |=(* !!)
|
||||
++ on-leave |=(* !!)
|
||||
++ on-arvo |=(* !!)
|
||||
++ on-peek |=(* ~)
|
||||
--
|
16
pkg/arvo/gen/commit-event.hoon
Normal file
16
pkg/arvo/gen/commit-event.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
:: make a unix commit event
|
||||
::
|
||||
:: call as > .event/jam +commit-event /path/to/file
|
||||
:: to be used with ./urbit-binary -I event.jam pier
|
||||
::
|
||||
:: XX expand with arbitrary user-defined events?
|
||||
:: XX only supports files in which +noun:grab in the mark file returns a @t
|
||||
:: (e.g. hoon files)
|
||||
::
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] [=path ~] ~]
|
||||
:- %noun
|
||||
?~ beam=(de-beam path)
|
||||
~|(%path-not-beam !!)
|
||||
=+ .^(file=@t %cx path)
|
||||
[/c/sync %info desk=q.u.beam & [s.u.beam %ins %mime !>([/ (as-octs:mimes:html file)])]~]
|
6
pkg/arvo/gen/hood/approve-merge.hoon
Normal file
6
pkg/arvo/gen/hood/approve-merge.hoon
Normal file
@ -0,0 +1,6 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[syd=desk her=ship sud=desk approve=? ~]
|
||||
~
|
||||
==
|
||||
kiln-approve-merge+[[syd her sud] approve]
|
@ -2,16 +2,36 @@
|
||||
::
|
||||
:::: /hoon/cp/hood/gen
|
||||
::
|
||||
:: XX clay discards the type, so %noun is used
|
||||
:: copy by lobe should be used, if implemented
|
||||
::
|
||||
/? 310
|
||||
:- %say
|
||||
=, space:userlib
|
||||
|= [^ [input=path output=path ~] ~]
|
||||
|= [^ [input=path output=path ~] r=_|]
|
||||
:- %kiln-info
|
||||
^- [mez=tape tor=(unit toro:clay)]
|
||||
?. r
|
||||
?. =(-:(flop input) -:(flop output))
|
||||
["Can't move to a different mark" ~]
|
||||
=+ dir=.^(arch %cy input)
|
||||
?~ fil.dir
|
||||
?~ =<(fil .^(arch %cy input))
|
||||
~& "No such file:"
|
||||
[<input> ~]
|
||||
:- "copied"
|
||||
`(foal output -:(flop input) [%atom %t ~] .^(* %cx input)) :: XX type
|
||||
`(foal output -:(flop input) [%noun .^(* %cx input)])
|
||||
?~ in-beam=(de-beam input) ["bad input path" ~]
|
||||
?~ =<(dir .^(arch %cy input)) ["input path isn't a directory" ~]
|
||||
?~ out-beam=(de-beam output) ["bad output path" ~]
|
||||
=/ in-beak=beak [p q r]:u.in-beam
|
||||
=/ out-beak=beak [p q r]:u.out-beam
|
||||
=/ =soba:clay
|
||||
%+ murn .^((list path) %ct input)
|
||||
|= pax=path
|
||||
?: =(1 (sub (lent pax) (lent s.u.in-beam))) ~
|
||||
=/ =cage
|
||||
:- -:(flop pax)
|
||||
[%noun .^(* %cx (en-beam in-beak pax))]
|
||||
=/ =spur (weld s.u.out-beam (slag (lent s.u.in-beam) pax))
|
||||
`[spur (feel (en-beam out-beak spur) cage)]
|
||||
?~ soba ["nothing to copy" ~]
|
||||
["copied" `[q.out-beak [%& soba]]]
|
||||
|
6
pkg/arvo/gen/hood/global-automerge.hoon
Normal file
6
pkg/arvo/gen/hood/global-automerge.hoon
Normal file
@ -0,0 +1,6 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[auto=? ~]
|
||||
~
|
||||
==
|
||||
kiln-global-automerge+auto
|
6
pkg/arvo/gen/hood/jump/approve.hoon
Normal file
6
pkg/arvo/gen/hood/jump/approve.hoon
Normal file
@ -0,0 +1,6 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[old=dock new=dock ~]
|
||||
~
|
||||
==
|
||||
kiln-jump-opt+[old new &]
|
16
pkg/arvo/gen/hood/jump/propose.hoon
Normal file
16
pkg/arvo/gen/hood/jump/propose.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
/+ *generators
|
||||
:- %ask
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[syd=desk her=ship sud=desk ~]
|
||||
hard=_|
|
||||
==
|
||||
?: hard (produce %kiln-jump-propose syd her sud)
|
||||
=/ msg
|
||||
leaf+"Are you sure you want to tell subscribers to get ".
|
||||
"updates for {<syd>} from {<her>}/{(trip sud)}?"
|
||||
%+ print msg
|
||||
%+ prompt [%& %prompt "(y/N) "]
|
||||
|= in=tape
|
||||
?. |(=("y" in) =("Y" in) =("yes" in))
|
||||
no-product
|
||||
(produce %kiln-jump-propose syd her sud)
|
6
pkg/arvo/gen/hood/jump/reject.hoon
Normal file
6
pkg/arvo/gen/hood/jump/reject.hoon
Normal file
@ -0,0 +1,6 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[old=dock new=dock ~]
|
||||
~
|
||||
==
|
||||
kiln-jump-opt+[old new |]
|
@ -24,6 +24,14 @@
|
||||
?^ arg
|
||||
mon.arg
|
||||
(add our (lsh 5 (end 5 (shaz eny))))
|
||||
=/ ryf=(unit rift)
|
||||
.^((unit rift) %j /(scot %p p.bec)/ryft/(scot %da now)/(scot %p mon))
|
||||
?^ ryf
|
||||
%. ~
|
||||
%- slog
|
||||
:~ leaf+"can't create {(scow %p mon)}, it already exists."
|
||||
'use |moon-breach and/or |moon-cycle-keys instead.'
|
||||
==
|
||||
=/ seg=ship (sein:title our now mon)
|
||||
?. =(our seg)
|
||||
%- %- slog :_ ~
|
||||
|
6
pkg/arvo/gen/hood/sync-automerge.hoon
Normal file
6
pkg/arvo/gen/hood/sync-automerge.hoon
Normal file
@ -0,0 +1,6 @@
|
||||
:- %say
|
||||
|= $: [now=@da eny=@uvJ bec=beak]
|
||||
[syd=desk her=ship sud=desk auto=(unit ?) ~]
|
||||
~
|
||||
==
|
||||
kiln-sync-automerge+[[syd her sud] auto]
|
16
pkg/arvo/gen/jumps.hoon
Normal file
16
pkg/arvo/gen/jumps.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
/- h=hood
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
|
||||
:- %tang
|
||||
^- tang
|
||||
=+ .^ hop=jump:h
|
||||
%gx
|
||||
(scot %p p.bec)
|
||||
%hood
|
||||
(scot %da now)
|
||||
/kiln/jumps/noun
|
||||
==
|
||||
?> ?=(%all -.hop)
|
||||
%+ turn ~(tap by all.hop)
|
||||
|= [old=dock new=dock]
|
||||
leaf+"{<p.old>}/{(trip q.old)} -> {<p.new>}/{(trip q.new)}"
|
16
pkg/arvo/gen/updates.hoon
Normal file
16
pkg/arvo/gen/updates.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
/- h=hood
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] ~ ~]
|
||||
:- %tang
|
||||
^- tang
|
||||
=+ .^ upd=sync-update:h
|
||||
%gx
|
||||
(scot %p p.bec)
|
||||
%hood
|
||||
(scot %da now)
|
||||
/kiln/pending/noun
|
||||
==
|
||||
?> ?=(%pending -.upd)
|
||||
%+ turn ~(tap in pending.upd)
|
||||
|= [sync-record:h rev=@ud]
|
||||
leaf+"{<syd>} <- {<her>}/{(trip sud)}/{<rev>}"
|
@ -2,6 +2,6 @@
|
||||
:- %say
|
||||
|= [[now=@da eny=@uvJ bec=beak] [syd=desk ~] verb=_&]
|
||||
:* %tang
|
||||
leaf+"Notice: +vat is deprecated. use +vats which now takes one or more desks as arguments. e.g. '+vats %base %garden'"
|
||||
leaf+"Notice: +vat is deprecated. use +vats which now takes one or more desks as arguments. e.g. '+vats %base %landscape'"
|
||||
(report-vat (report-prep p.bec now) p.bec now syd verb)
|
||||
==
|
||||
|
@ -17,12 +17,4 @@
|
||||
[filt=@tas verb=_|]
|
||||
==
|
||||
:- %tang ^- tang
|
||||
?. &(=(~ deks) =(%$ filt))
|
||||
(report-vats p.bec now deks filt verb)
|
||||
%- zing
|
||||
%+ turn
|
||||
%+ sort
|
||||
=/ sed .^((set desk) %cd /(scot %p p.bec)//(scot %da now))
|
||||
(sort ~(tap in sed) |=([a=@ b=@] !(aor a b)))
|
||||
|=([a=desk b=desk] ?|(=(a %kids) =(b %base)))
|
||||
|=(syd=desk (report-vat (report-prep p.bec now) p.bec now syd verb))
|
||||
|
@ -1070,8 +1070,9 @@
|
||||
++ wrd :: next or current word
|
||||
|= a=(list @)
|
||||
=| i=@ud
|
||||
?~ a i
|
||||
|- ^- @ud
|
||||
?: |(?=(~ a) (alnm i.a)) i
|
||||
?: |(?=(~ t.a) (alnm i.a)) i
|
||||
$(i +(i), a t.a)
|
||||
--
|
||||
--
|
||||
|
@ -5,7 +5,8 @@
|
||||
=, format
|
||||
=* dude dude:gall
|
||||
|%
|
||||
+$ state state-10
|
||||
+$ state state-11
|
||||
+$ state-11 [%11 pith-11]
|
||||
+$ state-10 [%10 pith-10]
|
||||
+$ state-9 [%9 pith-9]
|
||||
+$ state-8 [%8 pith-9]
|
||||
@ -19,7 +20,8 @@
|
||||
+$ state-0 [%0 pith-0]
|
||||
+$ any-state
|
||||
$~ *state
|
||||
$% state-10
|
||||
$% state-11
|
||||
state-10
|
||||
state-9
|
||||
state-8
|
||||
state-7
|
||||
@ -32,10 +34,32 @@
|
||||
state-0
|
||||
==
|
||||
::
|
||||
+$ pith-11
|
||||
$: rem=(map desk per-desk)
|
||||
nyz=@ud
|
||||
zyn=(map sync-record sync-state)
|
||||
:: requests from publishers to switch sync source
|
||||
hop=(map dock dock)
|
||||
:: toggle global update auto-merge
|
||||
mer=?
|
||||
::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term]
|
||||
:: map desk to the currently ongoing fuse request
|
||||
:: and the latest version numbers for beaks to
|
||||
fus=(map desk per-fuse)
|
||||
:: used for fuses - every time we get a fuse we
|
||||
:: bump this. used when calculating hashes to
|
||||
:: ensure they're unique even when the same
|
||||
:: request is made multiple times.
|
||||
hxs=(map desk @ud)
|
||||
==
|
||||
::
|
||||
+$ sync-state-10 [nun=@ta kid=(unit desk) let=@ud]
|
||||
::
|
||||
+$ pith-10
|
||||
$: rem=(map desk per-desk)
|
||||
nyz=@ud
|
||||
zyn=(map kiln-sync sync-state)
|
||||
zyn=(map sync-record sync-state-10)
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term]
|
||||
:: map desk to the currently ongoing fuse request
|
||||
:: and the latest version numbers for beaks to
|
||||
@ -50,7 +74,7 @@
|
||||
+$ pith-9
|
||||
$: wef=(unit weft)
|
||||
rem=(map desk per-desk)
|
||||
syn=(map kiln-sync let=@ud)
|
||||
syn=(map sync-record let=@ud)
|
||||
ark=(map desk arak-9)
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term]
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -78,7 +102,7 @@
|
||||
+$ pith-7
|
||||
$: wef=(unit weft)
|
||||
rem=(map desk per-desk)
|
||||
syn=(map kiln-sync let=@ud)
|
||||
syn=(map sync-record let=@ud)
|
||||
ark=(map desk arak-7)
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term]
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -121,7 +145,7 @@
|
||||
+$ pith-6
|
||||
$: wef=(unit weft)
|
||||
rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ark=(map desk arak-6) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -139,7 +163,7 @@
|
||||
::
|
||||
+$ pith-5
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ark=(map desk arak-6) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -154,7 +178,7 @@
|
||||
::
|
||||
+$ pith-4 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ark=(map desk arak-4) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -175,7 +199,7 @@
|
||||
==
|
||||
+$ pith-3 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ark=(map desk arak-3) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
:: map desk to the currently ongoing fuse request
|
||||
@ -201,7 +225,7 @@
|
||||
::
|
||||
+$ pith-2 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ota=(unit [=ship =desk =aeon]) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
fus=(map desk per-fuse)
|
||||
@ -209,13 +233,13 @@
|
||||
== ::
|
||||
+$ pith-1 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
ota=(unit [=ship =desk =aeon]) ::
|
||||
commit-timer=[way=wire nex=@da tim=@dr mon=term] ::
|
||||
== ::
|
||||
+$ pith-0 ::
|
||||
$: rem=(map desk per-desk) ::
|
||||
syn=(map kiln-sync let=@ud) ::
|
||||
syn=(map sync-record let=@ud) ::
|
||||
autoload-on=? ::
|
||||
cur-hoon=@uvI ::
|
||||
cur-arvo=@uvI ::
|
||||
@ -245,16 +269,6 @@
|
||||
pot=term ::
|
||||
==
|
||||
+$ kiln-unmount $@(term [knot path]) ::
|
||||
+$ kiln-sync ::
|
||||
$: syd=desk :: local desk
|
||||
her=ship :: foreign ship
|
||||
sud=desk :: foreign desk
|
||||
==
|
||||
+$ kiln-unsync ::
|
||||
$: syd=desk :: local desk
|
||||
her=ship :: foreign ship
|
||||
sud=desk :: foreign desk
|
||||
==
|
||||
+$ kiln-merge ::
|
||||
$@ ~
|
||||
$: syd=desk ::
|
||||
@ -285,7 +299,6 @@
|
||||
+$ kiln-fuse-list (unit desk)
|
||||
--
|
||||
|= [bowl:gall state]
|
||||
?> =(src our)
|
||||
=| moz=(list card:agent:gall)
|
||||
|%
|
||||
++ kiln .
|
||||
@ -440,7 +453,7 @@
|
||||
=^ cards-9=(list card:agent:gall) old
|
||||
?. ?=(%9 -.old)
|
||||
`old
|
||||
=/ syn=(set kiln-sync)
|
||||
=/ syn=(set sync-record)
|
||||
%- ~(gas in ~(key by syn.old))
|
||||
%+ murn ~(tap by ark.old)
|
||||
|= [=desk =arak-9]
|
||||
@ -468,8 +481,8 @@
|
||||
[%pass /kiln/load-zest %arvo %c %zest desk zest]
|
||||
::
|
||||
%+ turn ~(tap in syn)
|
||||
|= k=kiln-sync
|
||||
[%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(k)]
|
||||
|= r=sync-record
|
||||
[%pass /kiln/load-sync %agent [our %hood] %poke %kiln-sync !>(r)]
|
||||
::
|
||||
=/ ks ~(tap in syn)
|
||||
|- ^- (list card:agent:gall)
|
||||
@ -483,7 +496,17 @@
|
||||
$(ks t.ks)
|
||||
==
|
||||
::
|
||||
?> ?=(%10 -.old)
|
||||
=? old ?=(%10 -.old)
|
||||
%= old
|
||||
- %11
|
||||
|4 [hop=~ mer=& |4.old]
|
||||
zyn %- ~(run by zyn.old)
|
||||
|= sync-state-10
|
||||
^- sync-state
|
||||
[nun kid let ~ ~ |]
|
||||
==
|
||||
::
|
||||
?> ?=(%11 -.old)
|
||||
=. state old
|
||||
abet:(emil cards-9)
|
||||
::
|
||||
@ -499,18 +522,31 @@
|
||||
=/ ver (mergebase-hashes our %base now (~(got by sources) %base))
|
||||
``noun+!>(?~(ver 0v0 i.ver))
|
||||
::
|
||||
[%x %kiln %jumps ~] ``kiln-jump+!>([%all hop])
|
||||
[%x %kiln %syncs ~] ``noun+!>(zyn)
|
||||
[%x %kiln %sources ~] ``noun+!>(sources)
|
||||
[%x %kiln %automerge ~] ``loob+!>(mer)
|
||||
[%x %kiln %pikes ~]
|
||||
=+ .^(=rock:tire %cx /(scot %p our)//(scot %da now)/tire)
|
||||
:^ ~ ~ %kiln-pikes
|
||||
!> ^- pikes
|
||||
%- ~(rut by rock)
|
||||
%- ~(urn by rock)
|
||||
|= [=desk =zest wic=(set weft)]
|
||||
^- pike
|
||||
=+ .^(hash=@uv %cz /(scot %p our)/[desk]/(scot %da now))
|
||||
=/ sync (~(get by sources) desk)
|
||||
[sync hash zest wic]
|
||||
::
|
||||
[%x %kiln %pending ~]
|
||||
:^ ~ ~ %kiln-sync-update
|
||||
!> ^- sync-update
|
||||
:- %pending
|
||||
%- ~(gas by *(set [sync-record @ud]))
|
||||
^- (list [sync-record @ud])
|
||||
%+ murn ~(tap by zyn)
|
||||
|= [sync-record sync-state]
|
||||
?~ hav ~
|
||||
(some [syd her sud] u.hav)
|
||||
==
|
||||
::
|
||||
:: +get-germ: select merge strategy into local desk
|
||||
@ -528,12 +564,15 @@
|
||||
::
|
||||
++ poke
|
||||
|= [=mark =vase]
|
||||
?> |(=(src our) =(%kiln-jump-ask mark))
|
||||
?+ mark ~|([%poke-kiln-bad-mark mark] !!)
|
||||
%kiln-approve-merge =;(f (f !<(_+<.f vase)) poke-approve-merge)
|
||||
%kiln-autocommit =;(f (f !<(_+<.f vase)) poke-autocommit)
|
||||
%kiln-bump =;(f (f !<(_+<.f vase)) poke-bump)
|
||||
%kiln-cancel =;(f (f !<(_+<.f vase)) poke-cancel)
|
||||
%kiln-cancel-autocommit =;(f (f !<(_+<.f vase)) poke-cancel-autocommit)
|
||||
%kiln-commit =;(f (f !<(_+<.f vase)) poke-commit)
|
||||
%kiln-sync-automerge =;(f (f !<(_+<.f vase)) poke-sync-automerge)
|
||||
%kiln-fuse =;(f (f !<(_+<.f vase)) poke-fuse)
|
||||
%kiln-fuse-list =;(f (f !<(_+<.f vase)) poke-fuse-list)
|
||||
%kiln-gall-sear =;(f (f !<(_+<.f vase)) poke-gall-sear)
|
||||
@ -543,12 +582,16 @@
|
||||
%kiln-label =;(f (f !<(_+<.f vase)) poke-label)
|
||||
%kiln-merge =;(f (f !<(_+<.f vase)) poke-merge)
|
||||
%kiln-mount =;(f (f !<(_+<.f vase)) poke-mount)
|
||||
%kiln-jump-ask =;(f (f !<(_+<.f vase)) poke-jump-ask)
|
||||
%kiln-jump-opt =;(f (f !<(_+<.f vase)) poke-jump-opt)
|
||||
%kiln-jump-propose =;(f (f !<(_+<.f vase)) poke-jump-propose)
|
||||
%kiln-nuke =;(f (f !<(_+<.f vase)) poke-nuke)
|
||||
%kiln-pause =;(f (f !<(_+<.f vase)) poke-pause)
|
||||
%kiln-permission =;(f (f !<(_+<.f vase)) poke-permission)
|
||||
%kiln-revive =;(f (f !<(_+<.f vase)) poke-revive)
|
||||
%kiln-rein =;(f (f !<(_+<.f vase)) poke-rein)
|
||||
%kiln-rm =;(f (f !<(_+<.f vase)) poke-rm)
|
||||
%kiln-global-automerge =;(f (f !<(_+<.f vase)) poke-global-automerge)
|
||||
%kiln-schedule =;(f (f !<(_+<.f vase)) poke-schedule)
|
||||
%kiln-suspend =;(f (f !<(_+<.f vase)) poke-suspend)
|
||||
%kiln-suspend-many =;(f (f !<(_+<.f vase)) poke-suspend-many)
|
||||
@ -559,6 +602,19 @@
|
||||
%kiln-unsync =;(f (f !<(_+<.f vase)) poke-unsync)
|
||||
==
|
||||
::
|
||||
++ poke-approve-merge
|
||||
|= [sync-record approve=?]
|
||||
?~ got=(~(get by zyn) syd her sud)
|
||||
=+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {<syd>}"
|
||||
((slog leaf+msg ~) abet)
|
||||
?~ hav.u.got
|
||||
=+ msg="kiln: no updates from {(scow %p her)}/{(trip sud)} for {<syd>}"
|
||||
((slog leaf+msg ~) abet)
|
||||
=< abet
|
||||
?. approve
|
||||
abet:drop:(sync syd her sud)
|
||||
abet:(merg /main syd):(sync syd her sud)
|
||||
::
|
||||
++ poke-autocommit
|
||||
|= [mon=kiln-commit auto=?]
|
||||
=< abet
|
||||
@ -679,6 +735,23 @@
|
||||
|= =ship
|
||||
abet:(emit %pass /kiln %arvo %g %sear ship)
|
||||
::
|
||||
++ poke-global-automerge
|
||||
|= auto=?
|
||||
=. mer auto
|
||||
?. mer abet
|
||||
=/ zyns=(list [sync-record sync-state]) ~(tap by zyn)
|
||||
=< abet
|
||||
|-
|
||||
?~ zyns ..abet
|
||||
?. ?& ?=(^ hav.i.zyns)
|
||||
!?=([~ %.n] nit.i.zyns)
|
||||
==
|
||||
$(zyns t.zyns)
|
||||
%= $
|
||||
zyns t.zyns
|
||||
..abet abet:(merg /main syd):(sync -.i.zyns)
|
||||
==
|
||||
::
|
||||
++ poke-info
|
||||
|= [mez=tape tor=(unit toro)]
|
||||
?~ tor
|
||||
@ -692,17 +765,20 @@
|
||||
?~ got=(~(get by rock) loc)
|
||||
%dead
|
||||
zest.u.got
|
||||
=. zyn
|
||||
=. ..abet
|
||||
?~ got=(~(get by sources) loc)
|
||||
zyn
|
||||
(~(del by zyn) loc u.got)
|
||||
..abet
|
||||
?: =([her rem] u.got)
|
||||
..abet
|
||||
=. ..abet abet:drop:(sync loc u.got)
|
||||
..abet(zyn (~(del by zyn) loc u.got))
|
||||
=? ..abet ?=(%dead zest)
|
||||
(emit %pass /kiln/install %arvo %c %zest loc ?:(=(our her) %live %held))
|
||||
?: (~(has by zyn) loc her rem)
|
||||
abet:(spam (render "already syncing" loc her rem ~) ~)
|
||||
?: =([our loc] [her rem])
|
||||
abet
|
||||
=/ sun (sync loc her rem)
|
||||
=/ sun okay:(sync loc her rem)
|
||||
~> %slog.(fmt "beginning install into {here:sun}")
|
||||
=< abet:abet:init
|
||||
?: =(%base loc)
|
||||
@ -710,7 +786,7 @@
|
||||
sun
|
||||
::
|
||||
++ poke-kids
|
||||
|= [hos=kiln-sync nex=(unit desk)]
|
||||
|= [hos=sync-record nex=(unit desk)]
|
||||
abet:abet:(apex:(sync hos) nex)
|
||||
::
|
||||
++ poke-label
|
||||
@ -731,6 +807,84 @@
|
||||
abet:(spam leaf+- ~)
|
||||
abet:(emit %pass /mount %arvo %c [%mont pot u.bem])
|
||||
::
|
||||
++ poke-jump-propose
|
||||
|= [syd=desk her=ship sud=desk]
|
||||
?: =([our syd] [her sud])
|
||||
abet
|
||||
=/ let=@ud ud:.^(cass:clay %cw /(scot %p our)/[syd]/(scot %da now))
|
||||
=/ subs=(set [@p rave:clay])
|
||||
.^((set [@p rave:clay]) %cx /(scot %p our)//(scot %da now)/cult/[syd])
|
||||
=/ ships=(set @p)
|
||||
%+ roll ~(tap in subs)
|
||||
|= [[=ship =rave:clay] ships=(set @p)]
|
||||
?: =(our ship) ships
|
||||
?. ?=([%sing %w [%ud @] ~] rave) ships
|
||||
?. =(+(let) p.case.mood.rave) ships
|
||||
(~(put in ships) ship)
|
||||
=< abet
|
||||
%- emil
|
||||
%+ turn ~(tap in ships)
|
||||
|= =ship
|
||||
:* %pass /kiln/jump-propose %agent [ship %hood]
|
||||
%poke %kiln-jump-ask !>([[our syd] [her sud]])
|
||||
==
|
||||
::
|
||||
++ poke-jump-ask
|
||||
|= [old=dock new=dock]
|
||||
?> |(=(src p.old) =(src our))
|
||||
?: =(old new)
|
||||
?~ had=(~(get by hop) old)
|
||||
abet
|
||||
=. hop (~(del by hop) old)
|
||||
abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old u.had]))
|
||||
?~ (skim ~(tap by sources) |=(sync-record =(old [her sud])))
|
||||
~> %slog.(fmt "no syncs from {(scow %p p.old)}/{(trip q.old)}")
|
||||
abet
|
||||
=. hop (~(put by hop) old new)
|
||||
abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%add old new]))
|
||||
::
|
||||
++ poke-jump-opt
|
||||
|= [old=dock new=dock yea=?]
|
||||
?~ got=(~(get by hop) old)
|
||||
~> %slog.(fmt "no jump request for {(scow %p p.old)}/{(trip q.old)}")
|
||||
abet
|
||||
?. =(new u.got)
|
||||
=/ txt-old "{(scow %p p.old)}/{(trip q.old)}"
|
||||
=/ txt-new "{(scow %p p.new)}/{(trip q.new)}"
|
||||
~> %slog.(fmt "no jump request from {txt-old} to {txt-new}")
|
||||
abet
|
||||
?. yea
|
||||
=/ txt-old "{(scow %p p.old)}/{(trip q.old)}"
|
||||
=/ txt-new "{(scow %p p.new)}/{(trip q.new)}"
|
||||
~> %slog.(fmt "denied jump from {txt-old} to {txt-new}")
|
||||
=. hop (~(del by hop) old)
|
||||
abet:(emit %give %fact ~[/jumps] %kiln-jump !>([%nay old new]))
|
||||
=/ old-sources=(list sync-record)
|
||||
(skim ~(tap by sources) |=(sync-record =(old [her sud])))
|
||||
=/ new-sources=(list sync-record)
|
||||
(turn old-sources |=(sync-record [syd new]))
|
||||
=. ..abet
|
||||
(emit %give %fact ~[/jumps] %kiln-jump !>([%yea old new]))
|
||||
=. ..abet
|
||||
|-
|
||||
?~ old-sources
|
||||
..abet
|
||||
=. ..abet abet:drop:(sync i.old-sources)
|
||||
=. zyn (~(del by zyn) i.old-sources)
|
||||
$(old-sources t.old-sources, ..abet ..abet)
|
||||
=. hop (~(del by hop) old)
|
||||
=< abet
|
||||
|- ^+ ..abet
|
||||
?~ new-sources ..abet
|
||||
%= $
|
||||
new-sources t.new-sources
|
||||
..abet =/ sun (sync i.new-sources)
|
||||
=< abet:init
|
||||
?: =(%base syd.i.new-sources)
|
||||
(apex:sun `%kids)
|
||||
sun
|
||||
==
|
||||
::
|
||||
++ poke-nuke
|
||||
|= [=term desk=?]
|
||||
=< abet
|
||||
@ -801,11 +955,28 @@
|
||||
|=(=desk [%pass /kiln/suspend %arvo %c %zest desk %dead])
|
||||
::
|
||||
++ poke-sync
|
||||
|= hos=kiln-sync
|
||||
?: (~(has by zyn) hos)
|
||||
abet:(spam (render "already syncing" [sud her syd ~]:hos) ~)
|
||||
~> %slog.(fmt "beginning sync into {<syd.hos>} from {<her.hos>}/{<sud.hos>}")
|
||||
abet:abet:init:(sync hos)
|
||||
|= sync-record
|
||||
?: (~(has by zyn) sud her syd)
|
||||
abet:(spam (render "already syncing" [sud her syd ~]) ~)
|
||||
=. ..abet
|
||||
?~ got=(~(get by sources) syd)
|
||||
..abet
|
||||
=. ..abet abet:drop:(sync syd u.got)
|
||||
..abet(zyn (~(del by zyn) syd u.got))
|
||||
~> %slog.(fmt "beginning sync into {<syd>} from {<her>}/{<sud>}")
|
||||
abet:abet:init:(sync syd her sud)
|
||||
::
|
||||
++ poke-sync-automerge
|
||||
|= [sync-record auto=(unit ?)]
|
||||
?~ got=(~(get by zyn) syd her sud)
|
||||
=+ msg="kiln: no syncs from {(scow %p her)}/{(trip sud)} to {<syd>}"
|
||||
((slog leaf+msg ~) abet)
|
||||
=. zyn (~(put by zyn) [syd her sud] u.got(nit auto))
|
||||
?~ hav.u.got
|
||||
abet
|
||||
?. |(?=([~ %.y] auto) &(mer ?=(~ auto)))
|
||||
abet
|
||||
abet:abet:(merg /main syd):(sync [syd her sud])
|
||||
::
|
||||
++ poke-syncs :: print sync config
|
||||
|= ~
|
||||
@ -813,7 +984,7 @@
|
||||
?: =(0 ~(wyt by zyn))
|
||||
[%leaf "no syncs configured"]~
|
||||
%+ turn ~(tap by zyn)
|
||||
|= [kiln-sync sync-state]
|
||||
|= [sync-record sync-state]
|
||||
(render "sync configured" sud her syd kid)
|
||||
::
|
||||
++ poke-uninstall
|
||||
@ -841,9 +1012,10 @@
|
||||
:: Don't need to cancel anything because new syncs will get a new nonce
|
||||
::
|
||||
++ poke-unsync
|
||||
|= hus=kiln-unsync
|
||||
|= hus=sync-record
|
||||
?~ got=(~(get by zyn) hus)
|
||||
abet:(spam (render "not syncing" [sud her syd ~]:hus) ~)
|
||||
=. ..abet abet:drop:(sync hus)
|
||||
=. zyn (~(del by zyn) hus)
|
||||
abet:(spam (render "cancelling sync" sud.hus her.hus syd.hus kid.u.got) ~)
|
||||
:: +peer: handle %watch
|
||||
@ -851,10 +1023,26 @@
|
||||
++ peer
|
||||
|= =path
|
||||
?> (team:title our src)
|
||||
?: =(0 1) abet :: avoid mint-vain
|
||||
?+ path ~|(kiln-path/path !!)
|
||||
[%vats ~]
|
||||
(mean leaf+"kiln: old subscription to /kiln/vats failed" ~)
|
||||
::
|
||||
[%jumps ~]
|
||||
abet:(emit %give %fact ~ %kiln-jump !>([%all hop]))
|
||||
::
|
||||
[%updates ~]
|
||||
=< abet
|
||||
%- emit
|
||||
:^ %give %fact ~
|
||||
:- %kiln-sync-update
|
||||
!> ^- sync-update
|
||||
:- %pending
|
||||
%- ~(gas by *(set [sync-record @ud]))
|
||||
^- (list [sync-record @ud])
|
||||
%+ murn ~(tap by zyn)
|
||||
|= [sync-record sync-state]
|
||||
?~ hav ~
|
||||
(some [syd her sud] u.hav)
|
||||
==
|
||||
::
|
||||
++ take-agent
|
||||
@ -864,6 +1052,8 @@
|
||||
~? ?=(^ p.sign) [%kiln-poke-nack u.p.sign]
|
||||
abet
|
||||
~|([%kiln-bad-take-agent wire -.sign] !!)
|
||||
::
|
||||
[%change-publisher ~] abet
|
||||
::
|
||||
[%fancy *]
|
||||
?> ?=(%poke-ack -.sign)
|
||||
@ -1078,15 +1268,30 @@
|
||||
abet:abet:(take:(sync syd her sud) t.t.t.wire sign-arvo)
|
||||
::
|
||||
++ sync
|
||||
|= kiln-sync
|
||||
|= sync-record
|
||||
=/ got (~(get by zyn) syd her sud)
|
||||
=+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud])
|
||||
=+ `sync-state`(fall got [(scot %uv nyz) ~ *@ud ~ ~ |])
|
||||
=? nyz ?=(~ got) +(nyz)
|
||||
|%
|
||||
++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let))
|
||||
++ abet ..sync(zyn (~(put by zyn) [syd her sud] nun kid let nit hav yea))
|
||||
++ apex |=(nex=(unit desk) ..abet(kid nex))
|
||||
++ emit |=(card:agent:gall ..abet(kiln (^emit +<)))
|
||||
++ emil |=((list card:agent:gall) ..abet(kiln (^emil +<)))
|
||||
++ okay ..abet(yea &)
|
||||
++ gain
|
||||
=. hav `(dec let)
|
||||
=/ upd=sync-update [%new [syd her sud] (dec let)]
|
||||
(emit %give %fact ~[/update] %kiln-sync-update !>(upd))
|
||||
++ drop
|
||||
=? ..abet ?=(^ hav)
|
||||
=/ upd=sync-update [%drop [syd her sud] u.hav]
|
||||
(emit %give %fact ~[/updates] %kiln-sync-update !>(upd))
|
||||
..abet(hav ~, yea |)
|
||||
++ tada
|
||||
=? ..abet ?=(^ hav)
|
||||
=/ upd=sync-update [%done [syd her sud] u.hav]
|
||||
(emit %give %fact ~[/updates] %kiln-sync-update !>(upd))
|
||||
..abet(hav ~, yea |)
|
||||
++ here "{<syd>} from {<her>}/{<sud>}"
|
||||
++ ware
|
||||
|= =wire
|
||||
@ -1101,7 +1306,6 @@
|
||||
%merg desk her sud
|
||||
ud+(dec let) (get-germ desk)
|
||||
==
|
||||
::
|
||||
:: (re)Start a sync from scratch by finding what version the source
|
||||
:: desk is at
|
||||
::
|
||||
@ -1129,8 +1333,8 @@
|
||||
?> ?=(^ riot)
|
||||
:: The syncs may have changed, so get the latest
|
||||
::
|
||||
;< zyx=(map kiln-sync sync-state) bind:m
|
||||
(scry:strandio (map kiln-sync sync-state) /gx/hood/kiln/syncs/noun)
|
||||
;< zyx=(map sync-record sync-state) bind:m
|
||||
(scry:strandio (map sync-record sync-state) /gx/hood/kiln/syncs/noun)
|
||||
?. (~(has by zyx) syd her sud)
|
||||
(pure:m !>(%done))
|
||||
~> %slog.(fmt "downloading update for {here}")
|
||||
@ -1175,6 +1379,7 @@
|
||||
?: ?=(%| -.p.sign-arvo)
|
||||
:: ~> %slog.(fmt "download failed into {here}; retrying sync")
|
||||
:: %- (slog p.p.sign-arvo)
|
||||
=. ..abet drop
|
||||
init
|
||||
::
|
||||
~> %slog.(fmt "finished downloading update for {here}")
|
||||
@ -1182,7 +1387,7 @@
|
||||
:: If nothing changed, just ensure %kids is up-to-date and advance
|
||||
::
|
||||
?. (get-remote-diff our syd now [her sud (dec let)])
|
||||
=< next
|
||||
=< next:drop
|
||||
?~ kid
|
||||
~> %slog.(fmt "remote is identical to {here}, skipping")
|
||||
..abet
|
||||
@ -1191,15 +1396,22 @@
|
||||
..abet
|
||||
~> %slog.(fmt "remote is identical to {here}, merging into {<u.kid>}")
|
||||
(merg /kids u.kid)
|
||||
:: wait for approval if can't automerge & signal available update
|
||||
::
|
||||
?. |(=(our her) yea =([~ &] nit) &(=(~ nit) mer))
|
||||
=. ..abet gain
|
||||
next
|
||||
:: Else start merging, but also immediately start listening to
|
||||
:: the next revision. Now, all errors should no-op -- we're
|
||||
:: already waiting for the next revision.
|
||||
::
|
||||
=. yea |
|
||||
=. ..abet (merg /main syd)
|
||||
next
|
||||
::
|
||||
%main
|
||||
?> ?=(%mere +<.sign-arvo)
|
||||
=< tada
|
||||
?: ?=(%| -.p.sign-arvo)
|
||||
=+ "kiln: merge into {here} failed, waiting for next revision"
|
||||
%- (slog leaf/- p.p.sign-arvo)
|
||||
|
@ -213,7 +213,7 @@
|
||||
=< q
|
||||
%- need %- need
|
||||
%- scry:(ames-gate now eny roof)
|
||||
[~ / %x [[our %$ da+now] /peers/(scot %p her)]]
|
||||
[[~ ~] / %x [[our %$ da+now] /peers/(scot %p her)]]
|
||||
::
|
||||
++ gall-scry-nonce
|
||||
|= $: =gall-gate
|
||||
@ -227,7 +227,7 @@
|
||||
=< q
|
||||
%- need %- need
|
||||
%- scry:(gall-gate now eny roof)
|
||||
[~ / %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]]
|
||||
[[~ ~] / %n [[our dude da+now] [%$ (scot %p ship.sub) [term wire]:sub]]]
|
||||
::
|
||||
++ load-agent
|
||||
|= [=ship =gall-gate =dude:gall =agent:gall]
|
||||
|
1
pkg/arvo/lib/verb
Symbolic link
1
pkg/arvo/lib/verb
Symbolic link
@ -0,0 +1 @@
|
||||
../../base-dev/lib/verb
|
1
pkg/arvo/mar/kiln/approve-merge.hoon
Symbolic link
1
pkg/arvo/mar/kiln/approve-merge.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../base-dev/mar/kiln/approve-merge.hoon
|
1
pkg/arvo/mar/kiln/jump-ask.hoon
Symbolic link
1
pkg/arvo/mar/kiln/jump-ask.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../base-dev/mar/kiln/jump-ask.hoon
|
1
pkg/arvo/mar/kiln/jump-opt.hoon
Symbolic link
1
pkg/arvo/mar/kiln/jump-opt.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../base-dev/mar/kiln/jump-opt.hoon
|
1
pkg/arvo/mar/kiln/jump.hoon
Symbolic link
1
pkg/arvo/mar/kiln/jump.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../base-dev/mar/kiln/jump.hoon
|
1
pkg/arvo/mar/kiln/sync-update.hoon
Symbolic link
1
pkg/arvo/mar/kiln/sync-update.hoon
Symbolic link
@ -0,0 +1 @@
|
||||
../../../base-dev/mar/kiln/sync-update.hoon
|
1
pkg/arvo/mar/verb
Symbolic link
1
pkg/arvo/mar/verb
Symbolic link
@ -0,0 +1 @@
|
||||
../../base-dev/mar/verb
|
@ -1 +1 @@
|
||||
[%zuse 412]
|
||||
[%zuse 411]
|
||||
|
@ -352,7 +352,9 @@
|
||||
?~ dat=(rof lyc pov u.mon) ~
|
||||
?~ u.dat [~ ~]
|
||||
=* vax q.u.u.dat
|
||||
?. ?& ?=(^ ref)
|
||||
?. => [ref=ref vax=p=p.vax hoon-version=hoon-version wa=wa worm=worm]
|
||||
~> %memo./arvo/look :: with memoization
|
||||
?& ?=(^ ref)
|
||||
=(hoon-version -.ref)
|
||||
-:(~(nets wa *worm) +.ref p.vax)
|
||||
==
|
||||
|
@ -2,11 +2,11 @@
|
||||
:::: /sys/hoon ::
|
||||
:: ::
|
||||
=< ride
|
||||
=> %139 =>
|
||||
=> %138 =>
|
||||
:: ::
|
||||
:::: 0: version stub ::
|
||||
:: ::
|
||||
~% %k.139 ~ ~ ::
|
||||
~% %k.138 ~ ~ ::
|
||||
|%
|
||||
++ hoon-version +
|
||||
-- =>
|
||||
@ -217,6 +217,7 @@
|
||||
:: computes the axis of {b} within axis {a}.
|
||||
|= [a=@ b=@]
|
||||
?< =(0 a)
|
||||
?< =(0 b)
|
||||
:: a composed axis
|
||||
^- @
|
||||
?- b
|
||||
@ -1394,23 +1395,19 @@
|
||||
::
|
||||
++ bif :: splits a by b
|
||||
~/ %bif
|
||||
|* [b=* c=*]
|
||||
^+ [l=a r=a]
|
||||
=< +
|
||||
|- ^+ a
|
||||
|* b=*
|
||||
|- ^+ [l=a r=a]
|
||||
?~ a
|
||||
[[b c] ~ ~]
|
||||
[~ ~]
|
||||
?: =(b p.n.a)
|
||||
?: =(c q.n.a)
|
||||
a
|
||||
a(n [b c])
|
||||
+.a
|
||||
?: (gor b p.n.a)
|
||||
=+ d=$(a l.a)
|
||||
?> ?=(^ d)
|
||||
d(r a(l r.d))
|
||||
[l.d a(l r.d)]
|
||||
=+ d=$(a r.a)
|
||||
?> ?=(^ d)
|
||||
d(l a(r l.d))
|
||||
[a(r l.d) r.d]
|
||||
::
|
||||
++ del :: delete at key b
|
||||
~/ %del
|
||||
@ -1435,7 +1432,7 @@
|
||||
|- ^+ a
|
||||
?~ b
|
||||
a
|
||||
=+ c=(bif p.n.b q.n.b)
|
||||
=+ c=(bif p.n.b)
|
||||
?> ?=(^ c)
|
||||
=+ d=$(a l.c, b l.b)
|
||||
=+ e=$(a r.c, b r.b)
|
||||
@ -1592,12 +1589,6 @@
|
||||
?~ a a
|
||||
[n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
|
||||
::
|
||||
++ rut :: apply gate to nodes
|
||||
|* b=gate
|
||||
|-
|
||||
?~ a a
|
||||
[n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
|
||||
::
|
||||
++ tap :: listify pairs
|
||||
=< $
|
||||
~/ %tap
|
||||
@ -1687,6 +1678,19 @@
|
||||
|* [b=* c=*]
|
||||
=+ d=(get b)
|
||||
(~(put by a) b [c d])
|
||||
::
|
||||
++ zip :: listify jar
|
||||
=< $
|
||||
~/ %zip
|
||||
=+ b=`(list _?>(?=([[* ^] *] a) [p=p q=i.q]:n.a))`~
|
||||
|. ^+ b
|
||||
?~ a b
|
||||
%= $
|
||||
a r.a
|
||||
b |- ^+ b
|
||||
?~ q.n.a ^$(a l.a)
|
||||
[[p i.q]:n.a $(q.n.a t.q.n.a)]
|
||||
==
|
||||
--
|
||||
++ ju :: jug engine
|
||||
=| a=(tree (pair * (tree))) :: (jug)
|
||||
@ -1791,6 +1795,12 @@
|
||||
[b ~ ~]
|
||||
bal(l.a $(a l.a))
|
||||
::
|
||||
++ run :: apply gate to values
|
||||
|* b=gate
|
||||
|-
|
||||
?~ a a
|
||||
[n=(b n.a) l=$(a l.a) r=$(a r.a)]
|
||||
::
|
||||
++ tap :: adds list to end
|
||||
=+ b=`(list _?>(?=(^ a) n.a))`~
|
||||
|- ^+ b
|
||||
@ -1877,17 +1887,17 @@
|
||||
++ corl :: compose backwards
|
||||
|* [a=$-(* *) b=$-(* *)]
|
||||
=< +:|.((a (b))) :: type check
|
||||
|* c=_+<.b
|
||||
|* c=_,.+<.b
|
||||
(a (b c))
|
||||
::
|
||||
++ cury :: curry left
|
||||
|* [a=$-(^ *) b=*]
|
||||
|* c=_+<+.a
|
||||
|* c=_,.+<+.a
|
||||
(a b c)
|
||||
::
|
||||
++ curr :: curry right
|
||||
|* [a=$-(^ *) c=*]
|
||||
|* b=_+<+.a
|
||||
|* b=_,.+<-.a
|
||||
(a b c)
|
||||
::
|
||||
++ fore |*(a=$-(* *) |*(b=$-(* *) (pair a b))) :: pair before
|
||||
@ -2043,6 +2053,7 @@
|
||||
+$ tang (list tank) :: bottom-first error
|
||||
:: ::
|
||||
+$ iota :: typed path segment
|
||||
$+ iota
|
||||
$~ [%n ~]
|
||||
$@ @tas
|
||||
$% [%ub @ub] [%uc @uc] [%ud @ud] [%ui @ui]
|
||||
@ -2067,6 +2078,7 @@
|
||||
:: flat-mid, open, close
|
||||
::
|
||||
+$ tank
|
||||
$+ tank
|
||||
$~ leaf/~
|
||||
$@ cord
|
||||
$% [%leaf p=tape]
|
||||
@ -3252,7 +3264,8 @@
|
||||
++ shas :: salted hash
|
||||
~/ %shas
|
||||
|= [sal=@ ruz=@]
|
||||
(shax (mix sal (shax ruz)))
|
||||
=/ len (max 32 (met 3 sal))
|
||||
(shay len (mix sal (shax ruz)))
|
||||
::
|
||||
++ shax :: sha-256
|
||||
~/ %shax
|
||||
@ -6381,6 +6394,7 @@
|
||||
==
|
||||
-- ::
|
||||
+$ hoon :: hoon AST
|
||||
$+ hoon
|
||||
$~ [%zpzp ~] ::
|
||||
$^ [p=hoon q=hoon] ::
|
||||
$% ::
|
||||
@ -6534,7 +6548,8 @@
|
||||
[%know p=stud] :: global standard
|
||||
[%made p=term q=(unit (list wing))] :: structure
|
||||
== ::
|
||||
+$ type $~ %noun ::
|
||||
+$ type $+ type
|
||||
$~ %noun ::
|
||||
$@ $? %noun :: any nouns
|
||||
%void :: no noun
|
||||
== ::
|
||||
@ -7144,7 +7159,10 @@
|
||||
:: 5a: compiler utilities
|
||||
+| %compiler-utilities
|
||||
::
|
||||
++ bool `type`(fork [%atom %f `0] [%atom %f `1] ~) :: make loobean
|
||||
++ bool :: make loobean
|
||||
^- type
|
||||
(fork [%atom %f `%.y] [%atom %f `%.n] ~)
|
||||
::
|
||||
++ cell :: make %cell type
|
||||
~/ %cell
|
||||
|= [hed=type tal=type]
|
||||
@ -7216,11 +7234,10 @@
|
||||
~/ %cond
|
||||
|= [pex=nock yom=nock woq=nock]
|
||||
^- nock
|
||||
?- pex
|
||||
[%1 %0] yom
|
||||
[%1 %1] woq
|
||||
* [%6 pex yom woq]
|
||||
==
|
||||
?: =([%1 &] pex) yom
|
||||
?: =([%1 |] pex) woq
|
||||
?: =([%0 0] pex) pex
|
||||
[%6 pex yom woq]
|
||||
::
|
||||
++ cons :: make formula cell
|
||||
~/ %cons
|
||||
@ -7253,10 +7270,10 @@
|
||||
=(0 p.wux)
|
||||
&(!=(0 p.wux) (lte p.wux p.yoz))
|
||||
==
|
||||
|- ?| =(%$ p.yoz)
|
||||
=(%$ p.wux)
|
||||
?& =((end 3 p.yoz) (end 3 p.wux))
|
||||
$(p.yoz (rsh 3 p.yoz), p.wux (rsh 3 p.wux))
|
||||
|- ?| =(%$ q.yoz)
|
||||
=(%$ q.wux)
|
||||
?& =((end 3 q.yoz) (end 3 q.wux))
|
||||
$(q.yoz (rsh 3 q.yoz), q.wux (rsh 3 q.wux))
|
||||
==
|
||||
==
|
||||
==
|
||||
@ -7265,43 +7282,44 @@
|
||||
~/ %flan
|
||||
|= [bos=nock nif=nock]
|
||||
^- nock
|
||||
?: =(bos nif) bos
|
||||
?: =([%0 0] bos) nif
|
||||
?: =([%0 0] nif) bos
|
||||
?- bos
|
||||
[%1 %1] bos
|
||||
[%1 %0] nif
|
||||
*
|
||||
?- nif
|
||||
[%1 %1] nif
|
||||
[%1 %0] bos
|
||||
* [%6 bos nif [%1 1]]
|
||||
?: ?| =(bos nif)
|
||||
=([%1 |] bos)
|
||||
=([%1 &] nif)
|
||||
=([%0 0] bos)
|
||||
==
|
||||
bos
|
||||
?: ?| =([%1 &] bos)
|
||||
=([%1 |] nif)
|
||||
=([%0 0] nif)
|
||||
==
|
||||
nif
|
||||
[%6 bos nif [%1 |]]
|
||||
::
|
||||
++ flip :: loobean negation
|
||||
~/ %flip
|
||||
|= dyr=nock
|
||||
^- nock
|
||||
?: =([%1 &] dyr) [%1 |]
|
||||
?: =([%1 |] dyr) [%1 &]
|
||||
?: =([%0 0] dyr) dyr
|
||||
[%6 dyr [%1 1] [%1 0]]
|
||||
[%6 dyr [%1 |] %1 &]
|
||||
::
|
||||
++ flor :: loobean |
|
||||
~/ %flor
|
||||
|= [bos=nock nif=nock]
|
||||
^- nock
|
||||
?: =(bos nif) bos
|
||||
?: =([%0 0] bos) nif
|
||||
?: =([%0 0] nif) bos
|
||||
?- bos
|
||||
[%1 %1] nif
|
||||
[%1 %0] bos
|
||||
*
|
||||
?- nif
|
||||
[%1 %1] bos
|
||||
[%1 %0] nif
|
||||
* [%6 bos [%1 0] nif]
|
||||
?: ?| =(bos nif)
|
||||
=([%1 &] bos)
|
||||
=([%1 |] nif)
|
||||
=([%0 0] bos)
|
||||
==
|
||||
bos
|
||||
?: ?| =([%1 |] bos)
|
||||
=([%1 &] nif)
|
||||
=([%0 0] nif)
|
||||
==
|
||||
nif
|
||||
[%6 bos [%1 &] nif]
|
||||
::
|
||||
++ hike
|
||||
~/ %hike
|
||||
@ -8302,9 +8320,6 @@
|
||||
::
|
||||
[%limb @]
|
||||
`p.gen
|
||||
::
|
||||
:: [%rock *]
|
||||
:: [%spec %leaf q.gen q.gen]
|
||||
::
|
||||
[%note [%help *] *]
|
||||
(bind $(gen q.gen) |=(=skin [%help p.p.gen skin]))
|
||||
@ -8779,7 +8794,7 @@
|
||||
++ fish
|
||||
|= =axis
|
||||
^- nock
|
||||
?@ skin [%1 &]
|
||||
?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]])
|
||||
?- -.skin
|
||||
::
|
||||
%base
|
||||
@ -8809,8 +8824,8 @@
|
||||
[%1 &]
|
||||
[%3 %0 axis]
|
||||
%+ flan
|
||||
$(ref (peek(sut ref) %free 2), skin skin.skin)
|
||||
$(ref (peek(sut ref) %free 3), skin ^skin.skin)
|
||||
$(ref (peek(sut ref) %free 2), axis (peg axis 2), skin skin.skin)
|
||||
$(ref (peek(sut ref) %free 3), axis (peg axis 3), skin ^skin.skin)
|
||||
::
|
||||
%leaf
|
||||
?: (~(nest ut [%atom %$ `atom.skin]) | ref)
|
||||
@ -8820,16 +8835,21 @@
|
||||
%dbug $(skin skin.skin)
|
||||
%help $(skin skin.skin)
|
||||
%name $(skin skin.skin)
|
||||
%over $(skin skin.skin)
|
||||
%spec $(skin skin.skin)
|
||||
%wash [%1 1]
|
||||
%over ::NOTE might need to guard with +feel, crashing is too strict
|
||||
=+ ~| %oops-guess-you-needed-feel-after-all
|
||||
fid=(fend %read wing.skin)
|
||||
$(sut p.fid, axis (peg axis q.fid), skin skin.skin)
|
||||
%spec =/ hit (~(play ut sut) ~(example ax spec.skin))
|
||||
?> (~(nest ut hit) & ref)
|
||||
$(skin skin.skin)
|
||||
%wash [%1 &]
|
||||
==
|
||||
::
|
||||
:: +gain: make a $type by restricting .ref to .skin
|
||||
::
|
||||
++ gain
|
||||
|- ^- type
|
||||
?@ skin [%face skin ref]
|
||||
?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]])
|
||||
?- -.skin
|
||||
::
|
||||
%base
|
||||
@ -8852,7 +8872,7 @@
|
||||
q.ref
|
||||
[%cell *] %void
|
||||
[%core *] %void
|
||||
[%face *] (face p.ref $(ref q.ref))
|
||||
[%face *] $(ref q.ref)
|
||||
[%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type))))
|
||||
[%hint *] (hint p.ref $(ref q.ref))
|
||||
[%hold *] ?: (~(has in gil) ref) %void
|
||||
@ -8865,7 +8885,9 @@
|
||||
|- ^- type
|
||||
?- ref
|
||||
%void %void
|
||||
%noun [%cell %noun %noun]
|
||||
%noun =+ ^$(skin skin.skin)
|
||||
?: =(%void -) %void
|
||||
(cell - ^$(skin ^skin.skin))
|
||||
[%atom *] %void
|
||||
[%cell *] =+ ^$(skin skin.skin, ref p.ref)
|
||||
?: =(%void -) %void
|
||||
@ -8875,7 +8897,7 @@
|
||||
?. =(%noun ^skin.skin)
|
||||
(cell - ^$(skin ^skin.skin, ref %noun))
|
||||
[%core - q.ref]
|
||||
[%face *] (face p.ref $(ref q.ref))
|
||||
[%face *] $(ref q.ref)
|
||||
[%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type))))
|
||||
[%hint *] (hint p.ref $(ref q.ref))
|
||||
[%hold *] ?: (~(has in gil) ref) %void
|
||||
@ -8897,7 +8919,7 @@
|
||||
`atom.skin
|
||||
[%cell *] %void
|
||||
[%core *] %void
|
||||
[%face *] (face p.ref $(ref q.ref))
|
||||
[%face *] $(ref q.ref)
|
||||
[%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type))))
|
||||
[%hint *] (hint p.ref $(ref q.ref))
|
||||
[%hold *] ?: (~(has in gil) ref) %void
|
||||
@ -8908,10 +8930,9 @@
|
||||
%help (hint [sut %help help.skin] $(skin skin.skin))
|
||||
%name (face term.skin $(skin skin.skin))
|
||||
%over $(skin skin.skin, sut (~(play ut sut) %wing wing.skin))
|
||||
%spec =/ yon $(skin skin.skin)
|
||||
=/ hit (~(play ut sut) ~(example ax spec.skin))
|
||||
?> (~(nest ut hit) & yon)
|
||||
hit
|
||||
%spec =/ hit (~(play ut sut) ~(example ax spec.skin))
|
||||
?> (~(nest ut hit) & $(skin skin.skin))
|
||||
(~(fuse ut ref) hit)
|
||||
%wash =- $(ref (~(play ut ref) -))
|
||||
:- %wing
|
||||
|- ^- wing
|
||||
@ -8923,13 +8944,13 @@
|
||||
::
|
||||
++ lose
|
||||
|- ^- type
|
||||
?@ skin [%face skin ref]
|
||||
?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]])
|
||||
?- -.skin
|
||||
::
|
||||
%base
|
||||
?- base.skin
|
||||
%cell $(skin [%cell [%base %noun] [%base %noun]])
|
||||
%flag $(skin [%base %atom %f])
|
||||
%flag $(ref $(skin [%leaf %f &]), skin [%leaf %f |])
|
||||
%null $(skin [%leaf %n ~])
|
||||
%void ref
|
||||
%noun %void
|
||||
@ -8955,17 +8976,19 @@
|
||||
|- ^- type
|
||||
?- ref
|
||||
%void %void
|
||||
%noun [%atom %$ ~]
|
||||
%noun ?. =([%cell [%base %noun] [%base %noun]] skin)
|
||||
ref
|
||||
[%atom %$ ~]
|
||||
[%atom *] ref
|
||||
[%cell *] =+ ^$(skin skin.skin, ref p.ref)
|
||||
?: =(%void -) %void
|
||||
(cell - ^$(skin ^skin.skin, ref q.ref))
|
||||
[%cell *] =/ lef ^$(skin skin.skin, ref p.ref)
|
||||
=/ rig ^$(skin ^skin.skin, ref q.ref)
|
||||
(fork (cell lef rig) (cell lef q.ref) (cell p.ref rig) ~)
|
||||
[%core *] =+ ^$(skin skin.skin, ref p.ref)
|
||||
?: =(%void -) %void
|
||||
?. =(%noun ^skin.skin)
|
||||
(cell - ^$(skin ^skin.skin, ref %noun))
|
||||
[%core - q.ref]
|
||||
[%face *] (face p.ref $(ref q.ref))
|
||||
[%face *] $(ref q.ref)
|
||||
[%fork *] (fork (turn ~(tap in p.ref) |=(=type ^$(ref type))))
|
||||
[%hint *] (hint p.ref $(ref q.ref))
|
||||
[%hold *] ?: (~(has in gil) ref) %void
|
||||
@ -8993,8 +9016,11 @@
|
||||
%dbug $(skin skin.skin)
|
||||
%help $(skin skin.skin)
|
||||
%name $(skin skin.skin)
|
||||
%over $(skin skin.skin)
|
||||
%spec $(skin skin.skin)
|
||||
%over ::TODO if we guard in +fish (+feel), we have to guard again here
|
||||
$(skin skin.skin, sut (~(play ut sut) %wing wing.skin))
|
||||
%spec =/ hit (~(play ut sut) ~(example ax spec.skin))
|
||||
?> (~(nest ut hit) & $(skin skin.skin))
|
||||
(~(crop ut ref) hit)
|
||||
%wash ref
|
||||
==
|
||||
--
|
||||
@ -9238,21 +9264,21 @@
|
||||
::
|
||||
++ mint
|
||||
|= gol=type
|
||||
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
|
||||
^- (pair type nock)
|
||||
=+ lug=(find %read hyp)
|
||||
?: ?=(%| -.lug) ~>(%mean.'hoon' ?>(?=(~ rig) p.lug))
|
||||
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
|
||||
(ergo p.lug rig)
|
||||
::
|
||||
++ mull
|
||||
|= [gol=type dox=type]
|
||||
^- [type type]
|
||||
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
|
||||
^- (pair type type)
|
||||
=+ lug=[p=(find %read hyp) q=(find(sut dox) %read hyp)]
|
||||
?: ?=(%| -.p.lug)
|
||||
?> &(?=(%| -.q.lug) ?=(~ rig))
|
||||
[p.p.p.lug p.p.q.lug]
|
||||
?> ?=(%& -.q.lug)
|
||||
=- ?>(?|(!vet (nest(sut gol) & p.-)) -)
|
||||
(endo [p.p.lug p.q.lug] dox rig)
|
||||
--
|
||||
::
|
||||
@ -9472,6 +9498,14 @@
|
||||
== ==
|
||||
(fond way hyp)
|
||||
::
|
||||
++ fend
|
||||
|= [way=vial hyp=wing]
|
||||
^- (pair type axis)
|
||||
=+ fid=(find way hyp)
|
||||
~> %mean.'fend-fragment'
|
||||
?> &(?=(%& -.fid) ?=(%& -.q.p.fid))
|
||||
[p.q.p.fid (tend p.p.fid)]
|
||||
::
|
||||
++ fund
|
||||
~/ %fund
|
||||
|= [way=vial gen=hoon]
|
||||
@ -9690,14 +9724,13 @@
|
||||
?: ?=([%wtts *] gen)
|
||||
(cool how q.gen (play ~(example ax p.gen)))
|
||||
?: ?=([%wthx *] gen)
|
||||
=+ (play %wing q.gen)
|
||||
~> %slog.[0 [%leaf "chipping"]]
|
||||
?: how
|
||||
=- ~> %slog.[0 (dunk(sut +<) 'chip: gain: ref')]
|
||||
~> %slog.[0 (dunk(sut -) 'chip: gain: gain')]
|
||||
-
|
||||
~(gain ar - p.gen)
|
||||
~(lose ar - p.gen)
|
||||
=+ fid=(find %both q.gen)
|
||||
?- -.fid
|
||||
%| sut
|
||||
%& =< q
|
||||
%+ take p.p.fid
|
||||
|=(a=type ?:(how ~(gain ar a p.gen) ~(lose ar a p.gen)))
|
||||
==
|
||||
?: ?&(how ?=([%wtpm *] gen))
|
||||
|-(?~(p.gen sut $(p.gen t.p.gen, sut ^$(gen i.p.gen))))
|
||||
?: ?&(!how ?=([%wtbr *] gen))
|
||||
@ -9971,22 +10004,27 @@
|
||||
::
|
||||
[%wtcl *]
|
||||
=+ nor=$(gen p.gen, gol bool)
|
||||
=+ fex=(gain p.gen)
|
||||
=+ wux=(lose p.gen)
|
||||
=+ ^= duy
|
||||
?: =(%void fex)
|
||||
?:(=(%void wux) [%0 0] [%1 1])
|
||||
?:(=(%void wux) [%1 0] q.nor)
|
||||
=+ [fex=(gain p.gen) wux=(lose p.gen)]
|
||||
::
|
||||
:: if either branch is impossible, eliminate it
|
||||
:: (placing the conditional in a dynamic hint to preserve crashes)
|
||||
::
|
||||
=+ ^= [ned duy]
|
||||
?- -
|
||||
[%void %void] |+[%0 0]
|
||||
[%void *] &+[%1 |]
|
||||
[* %void] &+[%1 &]
|
||||
* |+q.nor
|
||||
==
|
||||
=+ hiq=$(sut fex, gen q.gen)
|
||||
=+ ran=$(sut wux, gen r.gen)
|
||||
[(fork p.hiq p.ran ~) (cond duy q.hiq q.ran)]
|
||||
=+ fol=(cond duy q.hiq q.ran)
|
||||
[(fork p.hiq p.ran ~) ?.(ned fol [%11 [%toss q.nor] fol])]
|
||||
::
|
||||
[%wthx *]
|
||||
:- (nice bool)
|
||||
=+ fid=(find %read [[%& 1] q.gen])
|
||||
~> %mean.'mint-fragment'
|
||||
?> &(?=(%& -.fid) ?=(%& -.q.p.fid))
|
||||
(~(fish ar `type`p.q.p.fid `skin`p.gen) (tend p.p.fid))
|
||||
=+ fid=(fend %read [[%& 1] q.gen])
|
||||
(~(fish ar `type`p.fid `skin`p.gen) q.fid)
|
||||
::
|
||||
[%fits *]
|
||||
:- (nice bool)
|
||||
@ -10173,12 +10211,8 @@
|
||||
::
|
||||
[%wthx *]
|
||||
~> %mean.'mull-bonk-x'
|
||||
=+ :- =+ (find %read [[%& 1] q.gen])
|
||||
?> &(?=(%& -.-) ?=(%& -.q.p.-))
|
||||
new=[type=p.q.p.- axis=(tend p.p.-)]
|
||||
=+ (find(sut dox) %read [%& 1] q.gen)
|
||||
?> &(?=(%& -.-) ?=(%& -.q.p.-))
|
||||
old=[type=p.q.p.- axis=(tend p.p.-)]
|
||||
=+ :- new=[type=p axis=q]:(fend %read [[%& 1] q.gen])
|
||||
old=[type=p axis=q]:(fend(sut dox) %read [[%& 1] q.gen])
|
||||
?> =(axis.old axis.new)
|
||||
?> (nest(sut type.old) & type.new)
|
||||
(beth bool)
|
||||
@ -13107,6 +13141,12 @@
|
||||
|= [%cnhp a=hoon b=spec]
|
||||
[%make a b ~]
|
||||
(rune hep %cnhp exqd)
|
||||
::
|
||||
:- '.'
|
||||
%+ cook
|
||||
|= [%cndt a=spec b=hoon]
|
||||
[%make b a ~]
|
||||
(rune dot %cndt exqc)
|
||||
::
|
||||
:- ':'
|
||||
%+ cook
|
||||
|
@ -765,13 +765,12 @@
|
||||
::
|
||||
:: %hear: packet from unix
|
||||
:: %dear: lane from unix
|
||||
:: %heed: track peer's responsiveness; gives %clog if slow
|
||||
:: %jilt: stop tracking peer's responsiveness
|
||||
:: %cork: request to delete message flow
|
||||
:: %tame: request to delete route for ship
|
||||
:: %kroc: request to delete specific message flows, from their bones
|
||||
:: %plea: request to send message
|
||||
:: %deep: deferred calls to %ames, from itself
|
||||
:: %stun: STUN response (or failure), from unix
|
||||
::
|
||||
:: Remote Scry Tasks
|
||||
::
|
||||
@ -796,17 +795,18 @@
|
||||
$+ ames-task
|
||||
$% [%hear =lane =blob]
|
||||
[%dear =ship =lane]
|
||||
[%heed =ship]
|
||||
[%jilt =ship]
|
||||
[%cork =ship]
|
||||
[%tame =ship]
|
||||
[%kroc bones=(list [ship bone])]
|
||||
$>(%plea vane-task)
|
||||
[%deep =deep]
|
||||
[%stun =stun]
|
||||
::
|
||||
[%keen spar]
|
||||
[%keen sec=(unit [idx=@ key=@]) spar]
|
||||
[%chum spar]
|
||||
[%yawn spar]
|
||||
[%wham spar]
|
||||
[%plug =path]
|
||||
::
|
||||
$>(%born vane-task)
|
||||
$>(%init vane-task)
|
||||
@ -824,10 +824,12 @@
|
||||
:: Messaging Gifts
|
||||
::
|
||||
:: %boon: response message from remote ship
|
||||
:: %noon: boon with duct for clog tracking
|
||||
:: %clog: notify vane that %boon's to peer are backing up locally
|
||||
:: %done: notify vane that peer (n)acked our message
|
||||
:: %lost: notify vane that we crashed on %boon
|
||||
:: %send: packet to unix
|
||||
:: %nail: lanes to unix
|
||||
::
|
||||
:: Remote Scry Gifts
|
||||
::
|
||||
@ -836,17 +838,22 @@
|
||||
:: System and Lifecycle Gifts
|
||||
::
|
||||
:: %turf: domain report, relayed from jael
|
||||
:: %saxo: our sponsor list report
|
||||
::
|
||||
+$ gift
|
||||
$% [%boon payload=*]
|
||||
[%clog =ship]
|
||||
[%noon id=* payload=*]
|
||||
[%done error=(unit error)]
|
||||
[%lost ~]
|
||||
[%send =lane =blob]
|
||||
[%nail =ship lanes=(list lane)]
|
||||
::
|
||||
[%stub num=@ud key=@]
|
||||
[%near spar dat=(unit (unit page))]
|
||||
[%tune spar roar=(unit roar)]
|
||||
::
|
||||
[%turf turfs=(list turf)]
|
||||
[%saxo sponsors=(list ship)]
|
||||
==
|
||||
::
|
||||
:::: :: (1a2)
|
||||
@ -884,7 +891,7 @@
|
||||
+$ address @uxaddress
|
||||
:: $verb: verbosity flag for ames
|
||||
::
|
||||
+$ verb ?(%snd %rcv %odd %msg %ges %for %rot %kay %fin)
|
||||
+$ verb ?(%snd %rcv %odd %msg %ges %for %rot %kay %fin %sun)
|
||||
:: $blob: raw atom to or from unix, representing a packet
|
||||
::
|
||||
+$ blob @uxblob
|
||||
@ -904,6 +911,12 @@
|
||||
:: payload: semantic message contents
|
||||
::
|
||||
+$ plea [vane=@tas =path payload=*]
|
||||
::
|
||||
+$ message
|
||||
$% [%plea plea]
|
||||
[%boon payload=*]
|
||||
[%naxplanation =message-num =error]
|
||||
==
|
||||
:: $spar: pair of $ship and $path
|
||||
::
|
||||
:: Instead of fully qualifying a scry path, ames infers rift and
|
||||
@ -913,12 +926,21 @@
|
||||
:: $deep: deferred %ames call, from self, to keep +abet cores pure
|
||||
::
|
||||
+$ deep
|
||||
$% [%nack =ship =nack=bone =message-blob]
|
||||
$% [%nack =ship =nack=bone =message]
|
||||
[%sink =ship =target=bone naxplanation=[=message-num =error]]
|
||||
[%drop =ship =nack=bone =message-num]
|
||||
[%cork =ship =bone]
|
||||
[%kill =ship =bone]
|
||||
==
|
||||
:: $stun: STUN notifications, from unix
|
||||
::
|
||||
:: .lane is the latest cached lane in vere, from the point of view of .ship
|
||||
::
|
||||
+$ stun
|
||||
$% [%stop =ship =lane] :: succesful STUN response, stop %ping app
|
||||
[%fail =ship =lane] :: failure to STUN, re-enable %ping app
|
||||
[%once =ship =lane] :: new lane discovered, notify ping %app
|
||||
==
|
||||
:: +| %atomics
|
||||
::
|
||||
+$ bone @udbone
|
||||
@ -932,10 +954,12 @@
|
||||
:: $hoot: request packet payload
|
||||
:: $yowl: serialized response packet payload
|
||||
:: $hunk: a slice of $yowl fragments
|
||||
:: $lock: keys for remote scry
|
||||
::
|
||||
+$ hoot @uxhoot
|
||||
+$ yowl @uxyowl
|
||||
+$ hunk [lop=@ len=@]
|
||||
+$ lock [idx=@ key=@]
|
||||
::
|
||||
:: +| %kinetics
|
||||
:: $dyad: pair of sender and receiver ships
|
||||
@ -985,15 +1009,15 @@
|
||||
::
|
||||
:: messages: pleas local vanes have asked us to send
|
||||
:: packets: packets we've tried to send
|
||||
:: heeds: local tracking requests; passed through into $peer-state
|
||||
::
|
||||
+$ alien-agenda
|
||||
$+ alien-agenda
|
||||
$: messages=(list [=duct =plea])
|
||||
packets=(set =blob)
|
||||
heeds=(set duct)
|
||||
keens=(jug path duct)
|
||||
chums=(jug path duct)
|
||||
==
|
||||
+$ chain ((mop ,@ ,[key=@ =path]) lte)
|
||||
:: $peer-state: state for a peer with known life and keys
|
||||
::
|
||||
:: route: transport-layer destination for packets to peer
|
||||
@ -1011,7 +1035,6 @@
|
||||
:: information completes the packet+nack-trace, we remove the
|
||||
:: entry and emit a nack to the local vane that asked us to send
|
||||
:: the message.
|
||||
:: heeds: listeners for %clog notifications
|
||||
:: closing: bones closed on the sender side
|
||||
:: corked: bones closed on both sender and receiver
|
||||
::
|
||||
@ -1029,10 +1052,10 @@
|
||||
snd=(map bone message-pump-state)
|
||||
rcv=(map bone message-sink-state)
|
||||
nax=(set [=bone =message-num])
|
||||
heeds=(set duct)
|
||||
closing=(set bone)
|
||||
corked=(set bone)
|
||||
keens=(map path keen-state)
|
||||
=chain
|
||||
==
|
||||
+$ keen-state
|
||||
$+ keen-state
|
||||
@ -1157,7 +1180,7 @@
|
||||
$+ message-pump-state
|
||||
$: current=_`message-num`1
|
||||
next=_`message-num`1
|
||||
unsent-messages=(qeu message-blob)
|
||||
unsent-messages=(qeu message)
|
||||
unsent-fragments=(list static-fragment)
|
||||
queued-message-acks=(map message-num ack)
|
||||
=packet-pump-state
|
||||
@ -2703,13 +2726,15 @@
|
||||
|%
|
||||
+$ gift :: outgoing result
|
||||
$% [%boon payload=*] :: ames response
|
||||
[%noon id=* payload=*]
|
||||
[%done error=(unit error:ames)] :: ames message (n)ack
|
||||
[%flub ~] :: not ready to handle plea
|
||||
[%unto p=unto] ::
|
||||
== ::
|
||||
+$ task :: incoming request
|
||||
$~ [%vega ~] ::
|
||||
$% [%deal p=sack q=term r=deal] :: full transmission
|
||||
$% [%clog id=*] :: clog notification
|
||||
[%deal p=sack q=term r=deal] :: full transmission
|
||||
[%sear =ship] :: clear pending queues
|
||||
[%jolt =desk =dude] :: (re)start agent
|
||||
[%idle =dude] :: suspend agent
|
||||
@ -2728,17 +2753,27 @@
|
||||
+$ boat (map [=wire =ship =term] [acked=? =path]) :: outgoing subs
|
||||
+$ boar (map [=wire =ship =term] nonce=@) :: and their nonces
|
||||
::
|
||||
+$ path-state
|
||||
+$ fans ((mop @ud (pair @da (each page @uvI))) lte)
|
||||
+$ plot
|
||||
$: bob=(unit @ud)
|
||||
fan=((mop @ud (pair @da (each page @uvI))) lte)
|
||||
fan=fans
|
||||
==
|
||||
+$ stats :: statistics
|
||||
$: change=@ud :: processed move count
|
||||
eny=@uvJ :: entropy
|
||||
time=@da :: current event time
|
||||
==
|
||||
+$ hutch [rev=@ud idx=@ud key=@]
|
||||
::
|
||||
+$ farm
|
||||
$+ farm
|
||||
$~ [%plot ~ ~]
|
||||
$% [%coop p=hutch q=(map path plot)]
|
||||
[%plot p=(unit plot) q=(map @ta farm)]
|
||||
==
|
||||
::
|
||||
+$ egg :: migratory agent state
|
||||
$% [%nuke sky=(map spur @ud)] :: see /sys/gall $yoke
|
||||
$% [%nuke sky=(map spur @ud) cop=(map coop hutch)] :: see /sys/gall $yoke
|
||||
$: %live
|
||||
control-duct=duct
|
||||
run-nonce=@t
|
||||
@ -2751,11 +2786,32 @@
|
||||
old-state=[%| vase]
|
||||
=beak
|
||||
marks=(map duct mark)
|
||||
sky=(map spur path-state)
|
||||
sky=farm
|
||||
ken=(jug spar:ames wire)
|
||||
pen=(jug spar:ames wire)
|
||||
gem=(jug coop [path page])
|
||||
== ==
|
||||
+$ egg-any $%([%15 egg-15] [%16 egg])
|
||||
+$ egg-15
|
||||
$% [%nuke sky=(map spur @ud)]
|
||||
$: %live
|
||||
control-duct=duct
|
||||
run-nonce=@t
|
||||
sub-nonce=@
|
||||
=stats
|
||||
=bitt
|
||||
=boat
|
||||
=boar
|
||||
code=~
|
||||
old-state=[%| vase]
|
||||
=beak
|
||||
marks=(map duct mark)
|
||||
sky=(map spur plot)
|
||||
ken=(jug spar:ames wire)
|
||||
== ==
|
||||
+$ egg-any $%([%15 egg])
|
||||
::
|
||||
+$ bowl :: standard app state
|
||||
$+ gall-agent-bowl ::
|
||||
$: $: our=ship :: host
|
||||
src=ship :: guest
|
||||
dap=term :: agent
|
||||
@ -2763,9 +2819,7 @@
|
||||
== ::
|
||||
$: wex=boat :: outgoing subs
|
||||
sup=bitt :: incoming subs
|
||||
$= sky :: scry bindings
|
||||
%+ map path ::
|
||||
((mop @ud (pair @da (each page @uvI))) lte) ::
|
||||
sky=(map path fans) :: scry bindings
|
||||
== ::
|
||||
$: act=@ud :: change number
|
||||
eny=@uvJ :: entropy
|
||||
@ -2793,6 +2847,7 @@
|
||||
:: TODO: add more flags?
|
||||
::
|
||||
+$ verb ?(%odd)
|
||||
+$ coop spur
|
||||
::
|
||||
:: +agent: app core
|
||||
::
|
||||
@ -2800,8 +2855,11 @@
|
||||
=< form
|
||||
|%
|
||||
+$ step (quip card form)
|
||||
+$ card (wind note gift)
|
||||
+$ card
|
||||
$+ gall-agent-card
|
||||
(wind note gift)
|
||||
+$ note
|
||||
$+ gall-agent-note
|
||||
$% [%agent [=ship name=term] =task]
|
||||
[%arvo note-arvo]
|
||||
[%pyre =tang]
|
||||
@ -2809,8 +2867,15 @@
|
||||
[%grow =spur =page]
|
||||
[%tomb =case =spur]
|
||||
[%cull =case =spur]
|
||||
::
|
||||
[%tend =coop =path =page]
|
||||
[%germ =coop]
|
||||
[%snip =coop]
|
||||
::
|
||||
[%keen secret=? spar:ames]
|
||||
==
|
||||
+$ task
|
||||
$+ gall-agent-task
|
||||
$% [%watch =path]
|
||||
[%watch-as =mark =path]
|
||||
[%leave ~]
|
||||
@ -2818,12 +2883,14 @@
|
||||
[%poke-as =mark =cage]
|
||||
==
|
||||
+$ gift
|
||||
$+ gall-agent-gift
|
||||
$% [%fact paths=(list path) =cage]
|
||||
[%kick paths=(list path) ship=(unit ship)]
|
||||
[%watch-ack p=(unit tang)]
|
||||
[%poke-ack p=(unit tang)]
|
||||
==
|
||||
+$ sign
|
||||
$+ gall-agent-sign
|
||||
$% [%poke-ack p=(unit tang)]
|
||||
[%watch-ack p=(unit tang)]
|
||||
[%fact =cage]
|
||||
@ -3264,14 +3331,19 @@
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ input
|
||||
$+ input
|
||||
$% [%poke =cage]
|
||||
[%sign =wire =sign-arvo]
|
||||
[%agent =wire =sign:agent:gall]
|
||||
[%watch =path]
|
||||
==
|
||||
+$ strand-input [=bowl in=(unit input)]
|
||||
+$ error (pair term $+(tang tang))
|
||||
+$ strand-input
|
||||
$+ strand-input
|
||||
[=bowl in=(unit input)]
|
||||
+$ tid @tatid
|
||||
+$ bowl
|
||||
$+ strand-bowl
|
||||
$: our=ship
|
||||
src=ship
|
||||
tid=tid
|
||||
@ -3299,27 +3371,29 @@
|
||||
::
|
||||
++ strand-output-raw
|
||||
|* a=mold
|
||||
$+ strand-output-raw
|
||||
$~ [~ %done *a]
|
||||
$: cards=(list card)
|
||||
$= next
|
||||
$% [%wait ~]
|
||||
[%skip ~]
|
||||
[%cont self=(strand-form-raw a)]
|
||||
[%fail err=(pair term tang)]
|
||||
[%fail err=error]
|
||||
[%done value=a]
|
||||
==
|
||||
==
|
||||
::
|
||||
++ strand-form-raw
|
||||
|* a=mold
|
||||
$+ strand-form-raw
|
||||
$-(strand-input (strand-output-raw a))
|
||||
::
|
||||
:: Abort strand computation with error message
|
||||
::
|
||||
++ strand-fail
|
||||
|= err=(pair term tang)
|
||||
|= =error
|
||||
|= strand-input
|
||||
[~ %fail err]
|
||||
[~ %fail error]
|
||||
::
|
||||
:: Asynchronous transcaction monad.
|
||||
::
|
||||
@ -3332,11 +3406,11 @@
|
||||
++ strand
|
||||
|* a=mold
|
||||
|%
|
||||
++ output (strand-output-raw a)
|
||||
++ output $+(output (strand-output-raw a))
|
||||
::
|
||||
:: Type of an strand computation.
|
||||
::
|
||||
++ form (strand-form-raw a)
|
||||
++ form $+(form (strand-form-raw a))
|
||||
::
|
||||
:: Monadic pure. Identity computation for bind.
|
||||
::
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -243,11 +243,12 @@
|
||||
=* lot=coin $/r.bem
|
||||
=* tyl s.bem
|
||||
::
|
||||
:: only respond for the local identity, %$ desk, current timestamp
|
||||
:: only respond for the local identity, %$ desk, current timestamp, root gang
|
||||
::
|
||||
?. ?& =(&+our why)
|
||||
=([%$ %da now] lot)
|
||||
=(%$ syd)
|
||||
=([~ ~] lyc)
|
||||
==
|
||||
~
|
||||
:: /bx//whey (list mass) memory usage labels
|
||||
|
@ -729,11 +729,7 @@
|
||||
::
|
||||
%- (trace 1 |.("make cast {<a>} -> {<b>}"))
|
||||
=^ old=vase nub (build-fit %mar a)
|
||||
?: =/ ram (mule |.((slap old !,(*hoon grow))))
|
||||
?: ?=(%| -.ram) %.n
|
||||
=/ lab (mule |.((slob b p.p.ram)))
|
||||
?: ?=(%| -.lab) %.n
|
||||
p.lab
|
||||
?: (has-arm %grow b old)
|
||||
:: +grow core has .b arm; use that
|
||||
::
|
||||
%+ gain-leak cast+a^b
|
||||
@ -749,8 +745,9 @@
|
||||
:: try direct +grab
|
||||
::
|
||||
=^ new=vase nub (build-fit %mar b)
|
||||
=/ arm=? (has-arm %grab a new)
|
||||
=/ rab (mule |.((slap new tsgl/[limb/a limb/%grab])))
|
||||
?: &(?=(%& -.rab) ?=(^ q.p.rab))
|
||||
?: &(arm ?=(%& -.rab) ?=(^ q.p.rab))
|
||||
%+ gain-leak cast+a^b
|
||||
|= nob=state
|
||||
%- (trace 4 |.("{<a>} -> {<b>}: +{(trip a)}:grab:{(trip b)}"))
|
||||
@ -759,11 +756,11 @@
|
||||
:: try +jump
|
||||
::
|
||||
=/ jum (mule |.((slap old tsgl/[limb/b limb/%jump])))
|
||||
?: ?=(%& -.jum)
|
||||
?: &((has-arm %jump a old) ?=(%& -.jum))
|
||||
=/ via !<(mark p.jum)
|
||||
%- (trace 4 |.("{<a>} -> {<b>}: via {<via>} per +jump:{(trip a)}"))
|
||||
(compose-casts a via b)
|
||||
?: ?=(%& -.rab)
|
||||
?: &(arm ?=(%& -.rab))
|
||||
=/ via !<(mark p.rab)
|
||||
%- (trace 4 |.("{<a>} -> {<b>}: via {<via>} per +grab:{(trip b)}"))
|
||||
(compose-casts a via b)
|
||||
@ -787,6 +784,15 @@
|
||||
%+ slap
|
||||
(with-faces uno+uno dos+dos ~)
|
||||
!,(*hoon |=(_+<.uno (dos (uno +<))))
|
||||
::
|
||||
++ has-arm
|
||||
|= [arm=@tas =mark core=vase]
|
||||
^- ?
|
||||
=/ rib (mule |.((slap core [%wing ~[arm]])))
|
||||
?: ?=(%| -.rib) %.n
|
||||
=/ lab (mule |.((slob mark p.p.rib)))
|
||||
?: ?=(%| -.lab) %.n
|
||||
p.lab
|
||||
:: +build-tube: produce a $tube mark conversion gate from .a to .b
|
||||
::
|
||||
++ build-tube
|
||||
@ -1518,7 +1524,7 @@
|
||||
[%c care (scot case) desk path]
|
||||
:- [time path]
|
||||
%- emil
|
||||
:~ [hen %pass wire %a %keen ship path]
|
||||
:~ [hen %pass wire %a %keen ~ ship path]
|
||||
[hen %pass wire %b %wait time]
|
||||
==
|
||||
::
|
||||
@ -4642,10 +4648,12 @@
|
||||
$(desks t.desks)
|
||||
=^ res den (aver:den ~ %x da+now /desk/bill)
|
||||
=. ruf +:abet:den
|
||||
?. ?=([~ ~ *] res)
|
||||
=/ bill
|
||||
?. ?=([~ ~ *] res) *bill
|
||||
~|([%building-bill i.desks] !<(bill q.u.u.res))
|
||||
?~ rid=(override bill ren.dom.den)
|
||||
%- (trace 2 |.("{<i.desks>} has no dudes"))
|
||||
$(desks t.desks)
|
||||
=/ bill ~| [%building-bill i.desks] !<(bill q.u.u.res)
|
||||
=/ rid (override bill ren.dom.den)
|
||||
%- %+ trace 2 |.
|
||||
"{<i.desks>} has bill {<bill>} and rein {<ren.dom.den>}, so {<rid>}"
|
||||
=^ sats ..abet $(desks t.desks)
|
||||
@ -4668,22 +4676,9 @@
|
||||
:: +override: apply rein to bill
|
||||
::
|
||||
++ override
|
||||
|= [duz=bill ren=(map dude:gall ?)]
|
||||
^- bill
|
||||
=. duz
|
||||
%+ skip duz
|
||||
|= =dude:gall
|
||||
=(`| (~(get by ren) dude))
|
||||
::
|
||||
=/ dus (sy duz)
|
||||
=. duz
|
||||
%+ weld duz
|
||||
%+ murn ~(tap by ren)
|
||||
|= [=dude:gall on=?]
|
||||
?: &(?=(%& on) !(~(has in dus) dude))
|
||||
`u=dude
|
||||
~
|
||||
duz
|
||||
|= [duz=bill ren=(map dude:gall ?)] ^- bill
|
||||
=/ out=bill (skip duz ~(has by ren))
|
||||
(~(rep by ren) |=([[d=dude:gall r=?] =_out] ?.(r out [d out])))
|
||||
:: +apply-precedence: resolve conflicts between $bill's
|
||||
::
|
||||
:: policy is to crash if multiple desks are trying to run the same
|
||||
@ -5934,6 +5929,7 @@
|
||||
::
|
||||
=/ for=(unit ship) ?~(lyc ~ ?~(u.lyc ~ `n.u.lyc))
|
||||
?: &(=(our his) ?=(?(%d %x) ren) =(%$ syd) =([%da now] u.luk))
|
||||
?. =([~ ~] lyc) ~
|
||||
?- ren
|
||||
%d (read-buc-d tyl)
|
||||
%x (read-buc-x tyl)
|
||||
|
@ -146,7 +146,7 @@
|
||||
++ sponsor
|
||||
^- ship
|
||||
=/ dat=(unit (unit cage))
|
||||
(rof `[our ~ ~] /dill j/[[our sein/da/now] /(scot %p our)])
|
||||
(rof [~ ~] /dill j/[[our sein/da/now] /(scot %p our)])
|
||||
;;(ship q.q:(need (need dat)))
|
||||
::
|
||||
++ init :: initialize
|
||||
@ -490,11 +490,12 @@
|
||||
?. ?=(%& -.why) ~
|
||||
=* his p.why
|
||||
::
|
||||
:: only respond for the local identity, %$ desk, current timestamp
|
||||
:: only respond for the local identity, %$ desk, current timestamp, root gang
|
||||
::
|
||||
?. ?& =(&+our why)
|
||||
=([%$ %da now] lot)
|
||||
=(%$ syd)
|
||||
=([~ ~] lyc)
|
||||
==
|
||||
~
|
||||
:: /%x//whey (list mass) memory usage labels
|
||||
|
@ -798,14 +798,15 @@
|
||||
=* headers header-list.request
|
||||
:: for requests from localhost, respect the "forwarded" header
|
||||
::
|
||||
=/ [secure=? =^address]
|
||||
=* same [secure address]
|
||||
=/ [secure=? host=(unit @t) =^address]
|
||||
=/ host=(unit @t) (get-header:http 'host' headers)
|
||||
=* same [secure host address]
|
||||
?. =([%ipv4 .127.0.0.1] address) same
|
||||
?~ forwards=(forwarded-params headers) same
|
||||
:- (fall (forwarded-secure u.forwards) secure)
|
||||
:+ (fall (forwarded-secure u.forwards) secure)
|
||||
(clap (forwarded-host u.forwards) host head)
|
||||
(fall (forwarded-for u.forwards) address)
|
||||
::
|
||||
=/ host (get-header:http 'host' headers)
|
||||
=/ [=action suburl=@t]
|
||||
(get-action-for-binding host url.request)
|
||||
::
|
||||
@ -898,22 +899,32 @@
|
||||
=- (fall - '*')
|
||||
(get-header:http 'access-control-request-headers' headers)
|
||||
==
|
||||
:: handle requests to the cache
|
||||
:: handle HTTP scries
|
||||
::
|
||||
=/ entry (~(get by cache.state) url.request)
|
||||
?: &(?=(^ entry) ?=(%'GET' method.request))
|
||||
(handle-cache-req authenticated request val.u.entry)
|
||||
:: TODO: ideally this would look more like:
|
||||
::
|
||||
:: ?^ p=(parse-http-scry url.request)
|
||||
:: (handle-http-scry authenticated p request)
|
||||
::
|
||||
?: =('/_~_/' (end [3 5] url.request))
|
||||
(handle-http-scry authenticated request)
|
||||
:: handle requests to the cache, if a non-empty entry exists
|
||||
::
|
||||
=/ cached=(unit [aeon=@ud val=(unit cache-entry)])
|
||||
(~(get by cache.state) url.request)
|
||||
?: &(?=([~ @ ^] cached) ?=(%'GET' method.request))
|
||||
(handle-cache-req authenticated request u.val.u.cached)
|
||||
::
|
||||
?- -.action
|
||||
%gen
|
||||
=/ bek=beak [our desk.generator.action da+now]
|
||||
=/ sup=spur path.generator.action
|
||||
=/ ski (rof ~ /eyre %ca bek sup)
|
||||
=/ ski (rof [~ ~] /eyre %ca bek sup)
|
||||
=/ cag=cage (need (need ski))
|
||||
?> =(%vase p.cag)
|
||||
=/ gat=vase !<(vase q.cag)
|
||||
=/ res=toon
|
||||
%- mock :_ (look rof ~ /eyre)
|
||||
%- mock :_ (look rof [~ ~] /eyre)
|
||||
:_ [%9 2 %0 1] |.
|
||||
%+ slam
|
||||
%+ slam gat
|
||||
@ -1003,16 +1014,52 @@
|
||||
=/ nom=@p
|
||||
?+(-.identity who.identity %ours our)
|
||||
(as-octs:mimes:html (scot %p nom))
|
||||
:: +handle-http-scry: respond with scry result
|
||||
::
|
||||
++ handle-http-scry
|
||||
|= [authenticated=? =request:http]
|
||||
|^ ^- (quip move server-state)
|
||||
?. authenticated (error-response 403 ~)
|
||||
?. =(%'GET' method.request)
|
||||
(error-response 405 "may only GET scries")
|
||||
=/ req (parse-request-line url.request)
|
||||
=/ fqp (fully-qualified site.req)
|
||||
=/ mym (scry-mime now rof ext.req site.req)
|
||||
?: ?=(%| -.mym) (error-response 500 p.mym)
|
||||
=* mime p.mym
|
||||
%- handle-response
|
||||
:* %start
|
||||
:- status-code=200
|
||||
^= headers
|
||||
:~ ['content-type' (rsh 3 (spat p.mime))]
|
||||
['content-length' (crip (format-ud-as-integer p.q.mime))]
|
||||
['cache-control' ?:(fqp 'max-age=31536000' 'no-cache')]
|
||||
==
|
||||
data=[~ q.mime]
|
||||
complete=%.y
|
||||
==
|
||||
::
|
||||
++ fully-qualified
|
||||
|= a=path
|
||||
^- ?
|
||||
?. ?=([%'_~_' @ @ @ *] a) %.n
|
||||
=/ vez (vang | (en-beam [our %base da+now] ~))
|
||||
?= [~ [^ ^ ^ *]] (rush (spat t.t.a) ;~(pfix fas gash:vez))
|
||||
::
|
||||
++ error-response
|
||||
|= [status=@ud =tape]
|
||||
^- (quip move server-state)
|
||||
%^ return-static-data-on-duct status 'text/html'
|
||||
(error-page status authenticated url.request tape)
|
||||
--
|
||||
:: +handle-cache-req: respond with cached value, 404 or 500
|
||||
::
|
||||
++ handle-cache-req
|
||||
|= [authenticated=? =request:http entry=(unit cache-entry)]
|
||||
|= [authenticated=? =request:http entry=cache-entry]
|
||||
|^ ^- (quip move server-state)
|
||||
?~ entry
|
||||
(error-response 404 "cache entry for that binding was deleted")
|
||||
?: &(auth.u.entry !authenticated)
|
||||
?: &(auth.entry !authenticated)
|
||||
(error-response 403 ~)
|
||||
=* body body.u.entry
|
||||
=* body body.entry
|
||||
?- -.body
|
||||
%payload
|
||||
%- handle-response
|
||||
@ -1090,7 +1137,7 @@
|
||||
++ do-scry
|
||||
|= [care=term =desk =path]
|
||||
^- (unit (unit cage))
|
||||
(rof ~ /eyre care [our desk da+now] path)
|
||||
(rof [~ ~] /eyre care [our desk da+now] path)
|
||||
::
|
||||
++ error-response
|
||||
|= [status=@ud =tape]
|
||||
@ -1105,7 +1152,7 @@
|
||||
^- (quip move server-state)
|
||||
:: if the agent isn't running, we synchronously serve a 503
|
||||
::
|
||||
?. !<(? q:(need (need (rof ~ /eyre %gu [our app da+now] /$))))
|
||||
?. !<(? q:(need (need (rof [~ ~] /eyre %gu [our app da+now] /$))))
|
||||
%^ return-static-data-on-duct 503 'text/html'
|
||||
%: error-page
|
||||
503
|
||||
@ -1259,11 +1306,23 @@
|
||||
o(session-id session.fex)
|
||||
:: store the hostname used for this login, later reuse it for eauth
|
||||
::
|
||||
=? endpoint.auth.state ?=(^ host)
|
||||
=? endpoint.auth.state
|
||||
:: avoid overwriting public domains with localhost
|
||||
::
|
||||
?& ?=(^ host)
|
||||
?| ?=(~ auth.endpoint.auth.state)
|
||||
!=('localhost' (fall (rush u.host host-sans-port) ''))
|
||||
== ==
|
||||
%- (trace 2 |.("eauth: storing endpoint at {(trip u.host)}"))
|
||||
:+ user.endpoint.auth.state
|
||||
=/ new-auth=(unit @t)
|
||||
`(cat 3 ?:(secure 'https://' 'http://') u.host)
|
||||
now
|
||||
=, endpoint.auth.state
|
||||
:+ user new-auth
|
||||
:: only update the timestamp if the derived endpoint visibly changed.
|
||||
:: that is, it's not hidden behind a user-provided hardcoded url,
|
||||
:: and the new value is different from the old.)
|
||||
::
|
||||
?:(|(?=(^ user) =(new-auth auth)) time now)
|
||||
::
|
||||
=; out=[moves=(list move) server-state]
|
||||
out(moves [give-session-tokens :(weld moz moves.fex moves.out)])
|
||||
@ -1498,7 +1557,7 @@
|
||||
++ code
|
||||
^- @ta
|
||||
=/ res=(unit (unit cage))
|
||||
(rof ~ /eyre %j [our %code da+now] /(scot %p our))
|
||||
(rof [~ ~] /eyre %j [our %code da+now] /(scot %p our))
|
||||
(rsh 3 (scot %p ;;(@ q.q:(need (need res)))))
|
||||
:: +session-cookie-string: compose session cookie
|
||||
::
|
||||
@ -1709,7 +1768,7 @@
|
||||
=/ =wire /eauth/keen/(scot %p ship)/(scot %uv nonce)
|
||||
=. time (sub time (mod time ~h1))
|
||||
=/ =spar:ames [ship /e/x/(scot %da time)//eauth/url]
|
||||
[duct %pass wire %a ?-(kind %keen keen+spar, %yawn yawn+spar)]
|
||||
[duct %pass wire %a ?-(kind %keen keen+[~ spar], %yawn yawn+spar)]
|
||||
::
|
||||
++ send-boon
|
||||
|= boon=eauth-boon
|
||||
@ -2699,7 +2758,7 @@
|
||||
?~ sub
|
||||
((trace 0 |.("no subscription for request-id {(scow %ud request-id)}")) ~)
|
||||
=/ des=(unit (unit cage))
|
||||
(rof ~ /eyre %gd [our app.u.sub da+now] /$)
|
||||
(rof [~ ~] /eyre %gd [our app.u.sub da+now] /$)
|
||||
?. ?=([~ ~ *] des)
|
||||
((trace 0 |.("no desk for app {<app.u.sub>}")) ~)
|
||||
`!<(=desk q.u.u.des)
|
||||
@ -2735,7 +2794,7 @@
|
||||
=* have=mark mark.event
|
||||
=/ convert=(unit vase)
|
||||
=/ cag=(unit (unit cage))
|
||||
(rof ~ /eyre %cf [our desk.event da+now] /[have]/json)
|
||||
(rof [~ ~] /eyre %cf [our desk.event da+now] /[have]/json)
|
||||
?. ?=([~ ~ *] cag) ~
|
||||
`q.u.u.cag
|
||||
?~ convert
|
||||
@ -3039,6 +3098,7 @@
|
||||
::
|
||||
?: ?| ?=([%'~' *] path.binding) :: eyre
|
||||
?=([%'~_~' *] path.binding) :: runtime
|
||||
?=([%'_~_' *] path.binding) :: scries
|
||||
==
|
||||
[| bindings.state]
|
||||
[& (insert-binding [binding duct action] bindings.state)]
|
||||
@ -3194,6 +3254,12 @@
|
||||
%https `&
|
||||
==
|
||||
::
|
||||
++ forwarded-host
|
||||
|= forwards=(list (map @t @t))
|
||||
^- (unit @t)
|
||||
?. ?=(^ forwards) ~
|
||||
(~(get by i.forwards) 'host')
|
||||
::
|
||||
++ parse-request-line
|
||||
|= url=@t
|
||||
^- [[ext=(unit @ta) site=(list @t)] args=(list [key=@t value=@t])]
|
||||
@ -3239,6 +3305,69 @@
|
||||
:: need to issue a %leave after we've forgotten the identity with
|
||||
:: which the subscription was opened.
|
||||
/(scot %p ship)/[app]/(scot %p from)
|
||||
::
|
||||
++ scry-mime
|
||||
|= [now=@da rof=roof ext=(unit @ta) pax=path]
|
||||
|^ ^- (each mime tape)
|
||||
:: parse
|
||||
::
|
||||
=/ u=(unit [view=term bem=beam])
|
||||
?. ?=([@ @ @ @ *] pax) ~
|
||||
?~ view=(slaw %tas i.t.pax) ~
|
||||
?~ path=(expand-path t.t.pax) ~
|
||||
?~ beam=(de-beam u.path) ~
|
||||
`[u.view u.beam]
|
||||
?~ u [%| "invalid scry path"]
|
||||
:: perform scry
|
||||
::
|
||||
?~ res=(rof [~ ~] /eyre u.u) [%| "failed scry"]
|
||||
?~ u.res [%| "no scry result"]
|
||||
=* mark p.u.u.res
|
||||
=* vase q.u.u.res
|
||||
:: convert to mime via ext
|
||||
::
|
||||
=/ dysk (conversion-desk u.u)
|
||||
?: ?=(%| -.dysk) [%| p.dysk]
|
||||
=/ ext (fall ext %mime)
|
||||
=/ mym (convert vase mark ext p.dysk)
|
||||
?: ?=(%| -.mym) [%| p.mym]
|
||||
=/ mym (convert p.mym ext %mime p.dysk)
|
||||
?: ?=(%| -.mym) [%| p.mym]
|
||||
[%& !<(mime p.mym)]
|
||||
::
|
||||
++ expand-path
|
||||
|= a=path
|
||||
^- (unit path)
|
||||
=/ vez (vang | (en-beam [our %base da+now] ~))
|
||||
(rush (spat a) (sear plex:vez (stag %clsg ;~(pfix fas poor:vez))))
|
||||
::
|
||||
++ conversion-desk
|
||||
|= [view=term =beam]
|
||||
^- (each desk tape)
|
||||
?: =(%$ q.beam) [%& %base]
|
||||
?+ (end 3 view) [%& %base]
|
||||
%c
|
||||
[%& q.beam]
|
||||
%g
|
||||
=/ res (rof [~ ~] /eyre %gd [our q.beam da+now] /$)
|
||||
?. ?=([~ ~ *] res)
|
||||
[%| "no desk for app {<q.beam>}"]
|
||||
[%& !<(=desk q.u.u.res)]
|
||||
==
|
||||
::
|
||||
++ convert
|
||||
|= [=vase from=mark to=mark =desk]
|
||||
^- (each ^vase tape)
|
||||
?: =(from to) [%& vase]
|
||||
=/ tub (rof [~ ~] /eyre %cc [our desk da+now] /[from]/[to])
|
||||
?. ?=([~ ~ %tube *] tub)
|
||||
[%| "no tube from {(trip from)} to {(trip to)}"]
|
||||
=/ tube !<(tube:clay q.u.u.tub)
|
||||
=/ res (mule |.((tube vase)))
|
||||
?: ?=(%| -.res)
|
||||
[%| "failed tube from {(trip from)} to {(trip to)}"]
|
||||
[%& +.res]
|
||||
--
|
||||
--
|
||||
:: end the =~
|
||||
::
|
||||
@ -3396,6 +3525,8 @@
|
||||
$(moves [mov moves], siz t.siz)
|
||||
::
|
||||
?: ?=(%eauth-host -.task)
|
||||
?: =(user.endpoint.auth.server-state.ax host.task)
|
||||
[~ http-server-gate]
|
||||
=. user.endpoint.auth.server-state.ax host.task
|
||||
=. time.endpoint.auth.server-state.ax now
|
||||
[~ http-server-gate]
|
||||
@ -4005,14 +4136,44 @@
|
||||
[~ ~]
|
||||
?. =(our who)
|
||||
?. =([%da now] p.lot)
|
||||
[~ ~]
|
||||
~
|
||||
~& [%r %scry-foreign-host who]
|
||||
~
|
||||
::
|
||||
?: ?=([%eauth %url ~] tyl)
|
||||
?. &(?=(%x ren) ?=(%$ syd)) ~
|
||||
=* endpoint endpoint.auth.server-state.ax
|
||||
?. ?=(%da -.p.lot) [~ ~]
|
||||
:: we cannot answer for something prior to the last set time,
|
||||
:: or something beyond the present moment.
|
||||
::
|
||||
?: ?| (lth q.p.lot time.endpoint)
|
||||
(gth q.p.lot now)
|
||||
==
|
||||
~
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (unit @t)
|
||||
=< eauth-url:eauth:authentication
|
||||
(per-server-event [eny *duct now rof] server-state.ax)
|
||||
::
|
||||
?: ?=([%cache @ @ ~] tyl)
|
||||
?. &(?=(%x ren) ?=(%$ syd)) ~
|
||||
=, server-state.ax
|
||||
?~ aeon=(slaw %ud i.t.tyl) [~ ~]
|
||||
?~ url=(slaw %t i.t.t.tyl) [~ ~]
|
||||
?~ entry=(~(get by cache) u.url) ~
|
||||
?. =(u.aeon aeon.u.entry) ~
|
||||
?~ val=val.u.entry ~
|
||||
?: &(auth.u.val !=([~ ~] lyc)) ~
|
||||
``noun+!>(u.val)
|
||||
:: private endpoints
|
||||
?. ?=([~ ~] lyc) ~
|
||||
?: &(?=(%x ren) ?=(%$ syd))
|
||||
=, server-state.ax
|
||||
?+ tyl [~ ~]
|
||||
?+ tyl ~
|
||||
[%$ %whey ~] =- ``mass+!>(`(list mass)`-)
|
||||
:~ bindings+&+bindings.server-state.ax
|
||||
cache+&+cache.server-state.ax
|
||||
auth+&+auth.server-state.ax
|
||||
connections+&+connections.server-state.ax
|
||||
channels+&+channel-state.server-state.ax
|
||||
@ -4032,21 +4193,6 @@
|
||||
%approved ``noun+!>((~(has in approved.cors-registry) u.origin))
|
||||
%rejected ``noun+!>((~(has in rejected.cors-registry) u.origin))
|
||||
==
|
||||
::
|
||||
[%eauth %url ~]
|
||||
=* endpoint endpoint.auth.server-state.ax
|
||||
?. ?=(%da -.p.lot) [~ ~]
|
||||
:: we cannot answer for something prior to the last set time,
|
||||
:: or something beyond the present moment.
|
||||
::
|
||||
?: ?| (lth q.p.lot time.endpoint)
|
||||
(gth q.p.lot now)
|
||||
==
|
||||
~
|
||||
:^ ~ ~ %noun
|
||||
!> ^- (unit @t)
|
||||
=< eauth-url:eauth:authentication
|
||||
(per-server-event [eny *duct now rof] server-state.ax)
|
||||
::
|
||||
[%authenticated %cookie @ ~]
|
||||
?~ cookies=(slaw %t i.t.t.tyl) [~ ~]
|
||||
@ -4056,18 +4202,15 @@
|
||||
(per-server-event [eny *duct now rof] server-state.ax)
|
||||
%*(. *request:http header-list ['cookie' u.cookies]~)
|
||||
::
|
||||
[%cache @ @ ~]
|
||||
?~ aeon=(slaw %ud i.t.tyl) [~ ~]
|
||||
?~ url=(slaw %t i.t.t.tyl) [~ ~]
|
||||
?~ entry=(~(get by cache) u.url) [~ ~]
|
||||
?. =(u.aeon aeon.u.entry) [~ ~]
|
||||
?~ val=val.u.entry [~ ~]
|
||||
``noun+!>(u.val)
|
||||
[%'_~_' *]
|
||||
=/ mym (scry-mime now rof (deft:de-purl:html tyl))
|
||||
?: ?=(%| -.mym) [~ ~]
|
||||
``noun+!>(p.mym)
|
||||
==
|
||||
?. ?=(%$ ren)
|
||||
[~ ~]
|
||||
?+ syd [~ ~]
|
||||
?. ?=(%$ ren) ~
|
||||
?+ syd ~
|
||||
%bindings ``noun+!>(bindings.server-state.ax)
|
||||
%cache ``noun+!>(cache.server-state.ax)
|
||||
%connections ``noun+!>(connections.server-state.ax)
|
||||
%authentication-state ``noun+!>(auth.server-state.ax)
|
||||
%channel-state ``noun+!>(channel-state.server-state.ax)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -395,7 +395,7 @@
|
||||
::
|
||||
?. ?=(%& -.why) ~
|
||||
=* his p.why
|
||||
?: &(?=(%x ren) =(tyl //whey))
|
||||
?: &(?=(%x ren) =(tyl //whey) =([~ ~] lyc))
|
||||
=/ maz=(list mass)
|
||||
:~ nex+&+next-id.state.ax
|
||||
outbound+&+outbound-duct.state.ax
|
||||
|
@ -654,7 +654,10 @@
|
||||
++ public-keys-give
|
||||
|= [yen=(set duct) =public-keys-result]
|
||||
|^
|
||||
=+ yez=(sort ~(tap in yen) sorter)
|
||||
=/ yaz %+ skid ~(tap in yen)
|
||||
|= d=duct
|
||||
&(?=([[%ames @ @ *] *] d) !=(%public-keys i.t.i.d))
|
||||
=/ yez (weld p.yaz (sort q.yaz sorter))
|
||||
|- ^+ this-su
|
||||
?~ yez this-su
|
||||
=* d i.yez
|
||||
@ -667,7 +670,9 @@
|
||||
$(yez t.yez)
|
||||
::
|
||||
:: We want to notify Ames, then Clay, then Gall. This happens to
|
||||
:: be alphabetical, but this is mostly a coincidence.
|
||||
:: be alphabetical, but this is mostly a coincidence. We also have
|
||||
:: to notify Gall the vane before we notify any Gall agents, so we
|
||||
:: can kiss the coincidence goodbye.
|
||||
::
|
||||
++ sorter
|
||||
|= [a=duct b=duct]
|
||||
@ -675,6 +680,8 @@
|
||||
|
|
||||
?. ?=([[@ *] *] b)
|
||||
&
|
||||
?: &(?=([[%gall *] *] a) ?=([[%gall *] *] b))
|
||||
?=([%gall %sys *] i.a)
|
||||
(lth (end 3 i.i.a) (end 3 i.i.b))
|
||||
--
|
||||
::
|
||||
@ -1065,7 +1072,7 @@
|
||||
::
|
||||
:: XX review for security, stability, cases other than now
|
||||
::
|
||||
?. =(lot [%$ %da now]) ~
|
||||
?. &(=(lot [%$ %da now]) =([~ ~] lyc)) ~
|
||||
::
|
||||
?: &(?=(%x ren) =(tyl //whey))
|
||||
=/ maz=(list mass)
|
||||
|
@ -72,7 +72,7 @@
|
||||
++ get-dais
|
||||
|= [=beak =mark rof=roof]
|
||||
^- dais:clay
|
||||
?~ ret=(rof ~ /khan %cb beak /[mark])
|
||||
?~ ret=(rof [~ ~] /khan %cb beak /[mark])
|
||||
~|(mark-unknown+mark !!)
|
||||
?~ u.ret
|
||||
~|(mark-invalid+mark !!)
|
||||
@ -82,7 +82,7 @@
|
||||
++ get-tube
|
||||
|= [=beak =mark =out=mark rof=roof]
|
||||
^- tube:clay
|
||||
?~ ret=(rof ~ /khan %cc beak /[mark]/[out-mark])
|
||||
?~ ret=(rof [~ ~] /khan %cc beak /[mark]/[out-mark])
|
||||
~|(tube-unknown+[mark out-mark] !!)
|
||||
?~ u.ret
|
||||
~|(tube-invalid+[mark out-mark] !!)
|
||||
|
@ -88,11 +88,12 @@
|
||||
|= [lyc=gang pov=path car=term bem=beam]
|
||||
^- (unit (unit cage))
|
||||
|^
|
||||
:: only respond for the local identity, current timestamp
|
||||
:: only respond for the local identity, current timestamp, root gang
|
||||
::
|
||||
?. ?& =(our p.bem)
|
||||
=(%$ q.bem)
|
||||
=([%da now] r.bem)
|
||||
=([~ ~] lyc)
|
||||
==
|
||||
~
|
||||
?+ car ~
|
||||
|
@ -4,7 +4,7 @@
|
||||
=> ..lull
|
||||
~% %zuse ..part ~
|
||||
|%
|
||||
++ zuse %412
|
||||
++ zuse %411
|
||||
:: :: ::
|
||||
:::: :: :: (2) engines
|
||||
:: :: ::
|
||||
@ -5256,7 +5256,7 @@
|
||||
|= [rof=roof pov=path our=ship now=@da who=ship]
|
||||
;; ship
|
||||
=< q.q %- need %- need
|
||||
(rof ~ pov %j `beam`[[our %sein %da now] /(scot %p who)])
|
||||
(rof [~ ~] pov %j `beam`[[our %sein %da now] /(scot %p who)])
|
||||
--
|
||||
:: middle core: stateless queries for default numeric sponsorship
|
||||
::
|
||||
|
@ -26,11 +26,13 @@
|
||||
^- (list card:agent:gall)
|
||||
=/ rcvr=ship (lane-to-ship lan)
|
||||
=/ hear-lane (ship-to-lane sndr)
|
||||
=/ [ames=? =packet] (decode-packet pac)
|
||||
?: &(!ames !resp==(& (cut 0 [2 1] pac)))
|
||||
=/ [=peep =purr] (decode-request-info `@ux`(rsh 3^64 content.packet))
|
||||
=/ =shot (sift-shot pac)
|
||||
?: &(!sam.shot req.shot) :: is fine request
|
||||
=/ [%0 =peep] (sift-wail `@ux`content.shot)
|
||||
%+ emit-aqua-events our
|
||||
[%read [rcvr path.peep] [hear-lane num.peep]]~
|
||||
:_ ~
|
||||
:- %read
|
||||
[[[rcvr rcvr-tick.shot] path.peep] [hear-lane sndr-tick.shot] num.peep]
|
||||
%+ emit-aqua-events our
|
||||
[%event rcvr /a/newt/0v1n.2m9vh %hear hear-lane pac]~
|
||||
:: +lane-to-ship: decode a ship from an aqua lane
|
||||
|
@ -14,11 +14,14 @@
|
||||
|= [who=@p way=wire %blit blits=(list blit:dill)]
|
||||
^- (list card:agent:gall)
|
||||
=/ last-line
|
||||
%+ roll blits
|
||||
|^ (roll blits ha-blit)
|
||||
::
|
||||
++ ha-blit
|
||||
|= [b=blit:dill line=tape]
|
||||
?- -.b
|
||||
%put (tape p.b)
|
||||
%klr (tape (zing (turn p.b tail)))
|
||||
%mor `tape`(roll p.b ha-blit)
|
||||
%nel ~& "{<who>}: {line}" ""
|
||||
%hop line
|
||||
%bel line
|
||||
@ -28,6 +31,7 @@
|
||||
%url ~& [%activate-url p.b] line
|
||||
%wyp ""
|
||||
==
|
||||
--
|
||||
~? !=(~ last-line) last-line
|
||||
~
|
||||
--
|
||||
|
27
pkg/arvo/ted/keen-shut.hoon
Normal file
27
pkg/arvo/ted/keen-shut.hoon
Normal file
@ -0,0 +1,27 @@
|
||||
/- spider
|
||||
/+ strandio
|
||||
=, strand=strand:spider
|
||||
^- thread:spider
|
||||
|= arg=vase
|
||||
=/ m (strand ,vase)
|
||||
^- form:m
|
||||
=+ !<([~ =spar:ames] arg)
|
||||
;< ~ bind:m
|
||||
(keen-shut:strandio /keen spar)
|
||||
;< [* dat=(unit (unit page))] bind:m
|
||||
(take-near:strandio /keen)
|
||||
?~ dat
|
||||
~& mysterious/~
|
||||
(pure:m !>(~))
|
||||
?~ u.dat
|
||||
~& non-existent/~
|
||||
(pure:m !>(~))
|
||||
::
|
||||
;< =bowl:spider bind:m get-bowl:strandio
|
||||
=+ .^ =dais:clay %cb
|
||||
/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[p.u.u.dat]
|
||||
==
|
||||
=/ res (mule |.((vale.dais q.u.u.dat)))
|
||||
?. ?=(%| -.res)
|
||||
(pure:m p.res)
|
||||
~|(%keen-mark-fail (mean leaf+"-keen: ames vale fail {<mark>}" p.res))
|
@ -1,67 +0,0 @@
|
||||
/- spider
|
||||
/+ *ph-io
|
||||
=>
|
||||
|%
|
||||
++ wait-for-agent-start
|
||||
|= [=ship agent=term]
|
||||
=/ m (strand:spider ,~)
|
||||
^- form:m
|
||||
=* loop $
|
||||
;< [her=^ship =unix-effect] bind:m take-unix-effect
|
||||
?: (is-dojo-output:util ship her unix-effect "activated app base/{(trip agent)}")
|
||||
(pure:m ~)
|
||||
loop
|
||||
::
|
||||
++ start-agent
|
||||
|= [=ship agent=term]
|
||||
=/ m (strand:spider ,~)
|
||||
^- form:m
|
||||
=* loop $
|
||||
;< ~ bind:m (dojo ship "|start {<agent>}")
|
||||
;< ~ bind:m (wait-for-agent-start ship agent)
|
||||
(pure:m ~)
|
||||
::
|
||||
++ wait-for-goad
|
||||
|= =ship
|
||||
=/ m (strand:spider ,~)
|
||||
^- form:m
|
||||
=* loop $
|
||||
;< [her=^ship =unix-effect] bind:m take-unix-effect
|
||||
?: (is-dojo-output:util ship her unix-effect "p=%hood q=%bump")
|
||||
(pure:m ~)
|
||||
loop
|
||||
::
|
||||
++ start-group-agents
|
||||
|= =ship
|
||||
=/ m (strand:spider ,~)
|
||||
^- form:m
|
||||
;< ~ bind:m (start-agent ship %group-store)
|
||||
(pure:m ~)
|
||||
--
|
||||
=, strand=strand:spider
|
||||
^- thread:spider
|
||||
|= args=vase
|
||||
=/ m (strand ,vase)
|
||||
;< ~ bind:m start-azimuth
|
||||
;< ~ bind:m (spawn ~bud)
|
||||
;< ~ bind:m (spawn ~marbud)
|
||||
;< ~ bind:m (spawn ~zod)
|
||||
;< ~ bind:m (spawn ~marzod)
|
||||
;< ~ bind:m (init-ship ~bud |)
|
||||
;< ~ bind:m (init-ship ~marbud |)
|
||||
;< ~ bind:m (wait-for-goad ~marbud)
|
||||
;< ~ bind:m (init-ship ~zod |)
|
||||
;< ~ bind:m (init-ship ~marzod |)
|
||||
;< ~ bind:m (wait-for-goad ~marzod)
|
||||
;< ~ bind:m (start-group-agents ~marbud)
|
||||
;< ~ bind:m (start-group-agents ~marzod)
|
||||
;< ~ bind:m (dojo ~marbud ":group-store|create 'test-group'")
|
||||
;< ~ bind:m (wait-for-output ~marbud ">=")
|
||||
;< ~ bind:m (sleep ~s1)
|
||||
;< ~ bind:m (breach-and-hear ~marzod ~marbud)
|
||||
;< ~ bind:m (init-ship ~marzod |)
|
||||
;< ~ bind:m (wait-for-goad ~marzod)
|
||||
;< ~ bind:m (start-group-agents ~marzod)
|
||||
;< ~ bind:m (sleep ~s3)
|
||||
;< ~ bind:m end
|
||||
(pure:m *vase)
|
@ -7,7 +7,7 @@
|
||||
;< ~ bind:m start-simple
|
||||
;< ~ bind:m (init-ship ~bud &)
|
||||
;< ~ bind:m (init-ship ~dev &)
|
||||
;< ~ bind:m (dojo ~bud "-keen /cx/~dev/kids/1/desk/bill")
|
||||
;< ~ bind:m (wait-for-output ~bud "[ ~")
|
||||
;< ~ bind:m (dojo ~bud "-keen ~dev /c/x/1/kids/sys/kelvin")
|
||||
;< ~ bind:m (wait-for-output ~bud "kal=[lal=%zuse num={(scow %ud zuse)}]")
|
||||
;< ~ bind:m end
|
||||
(pure:m *vase)
|
||||
|
@ -1,66 +0,0 @@
|
||||
/- spider
|
||||
/+ io=ph-io, *strandio
|
||||
=>
|
||||
=, io
|
||||
|%
|
||||
++ strand strand:spider
|
||||
++ start-agents
|
||||
|= =ship
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m (dojo ship "|start %graph-store")
|
||||
;< ~ bind:m (dojo ship "|start %graph-push-hook")
|
||||
;< ~ bind:m (dojo ship "|start %graph-pull-hook")
|
||||
;< ~ bind:m (dojo ship "|start %group-store")
|
||||
;< ~ bind:m (dojo ship "|start %group-push-hook")
|
||||
;< ~ bind:m (dojo ship "|start %group-pull-hook")
|
||||
;< ~ bind:m (dojo ship "|start %metadata-store")
|
||||
;< ~ bind:m (dojo ship "|start %metadata-hook")
|
||||
;< ~ bind:m (sleep `@dr`300)
|
||||
(pure:m ~)
|
||||
::
|
||||
++ make-link
|
||||
|= [title=@t url=@t]
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m (dojo ~bud ":graph-store|add-post [~bud %test] ~[[%text '{(trip title)}'] [%url '{(trip url)}']]")
|
||||
(pure:m ~)
|
||||
--
|
||||
|
||||
^- thread:spider
|
||||
|= vase
|
||||
=/ m (strand ,vase)
|
||||
;< ~ bind:m start-azimuth
|
||||
;< ~ bind:m (spawn ~bud)
|
||||
;< ~ bind:m (spawn ~dev)
|
||||
;< ~ bind:m (init-ship ~bud |)
|
||||
;< ~ bind:m (init-ship ~dev |)
|
||||
;< ~ bind:m (start-agents ~bud)
|
||||
;< ~ bind:m (start-agents ~dev)
|
||||
;< ~ bind:m (send-hi ~bud ~dev)
|
||||
;< ~ bind:m (dojo ~bud "-graph-create [%create [~bud %test] 'test' '' `%graph-validator-link [%policy [%open ~ ~]] 'link']")
|
||||
;< ~ bind:m (sleep ~s5)
|
||||
;< ~ bind:m (dojo ~dev "-graph-join [%join [~bud %test] ~bud]")
|
||||
;< ~ bind:m (sleep ~s5)
|
||||
;< ~ bind:m (send-hi ~bud ~dev)
|
||||
;< ~ bind:m (poke-our %aqua noun+!>([%pause-events ~[~dev]]))
|
||||
;< ~ bind:m (make-link 'one' 'one')
|
||||
;< ~ bind:m (make-link 'two' 'one')
|
||||
;< ~ bind:m (make-link 'thre' 'one')
|
||||
;< ~ bind:m (make-link 'four' 'one')
|
||||
;< ~ bind:m (make-link 'five' 'one')
|
||||
;< ~ bind:m (make-link 'six' 'one')
|
||||
;< ~ bind:m (make-link 'seven' 'one')
|
||||
;< ~ bind:m (sleep ~s40)
|
||||
:: five unacked events is sufficent to cause a clog, and by extension a
|
||||
:: %kick
|
||||
;< ~ bind:m (poke-our %aqua noun+!>([%unpause-events ~[~dev]]))
|
||||
;< ~ bind:m (sleep ~s10)
|
||||
;< ~ bind:m (make-link 'eight' 'one')
|
||||
;< ~ bind:m (make-link 'nine' 'one')
|
||||
;< ~ bind:m (sleep ~s10)
|
||||
;< ~ bind:m (dojo ~dev ":graph-pull-hook +dbug %bowl")
|
||||
;< ~ bind:m (dojo ~dev ":graph-store +dbug")
|
||||
;< ~ bind:m (dojo ~bud ":graph-push-hook +dbug %bowl")
|
||||
;< ~ bind:m (dojo ~bud ":graph-store +dbug")
|
||||
;< ~ bind:m end
|
||||
(pure:m *vase)
|
||||
::(pure:m *vase)
|
70
pkg/arvo/ted/ph/tend.hoon
Normal file
70
pkg/arvo/ted/ph/tend.hoon
Normal file
@ -0,0 +1,70 @@
|
||||
/- spider
|
||||
/+ *ph-io, strandio
|
||||
/* tend-agent %hoon /tests/app/tend/hoon
|
||||
=, strand=strand:spider
|
||||
=< all
|
||||
|%
|
||||
++ tend
|
||||
|= zuse=@ud
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m (dojo ~bud ":tend [%tend /foo /baz %kelvin %zuse {(scow %ud zuse)}]")
|
||||
;< ~ bind:m (sleep:strandio ~s2)
|
||||
;< ~ bind:m (dojo ~bud ":tend +dbug %bowl")
|
||||
(pure:m ~)
|
||||
::
|
||||
++ keen-wait-for-result
|
||||
|= [cas=@ud zuse=@ud]
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m (dojo ~dev ":tend [%keen ~bud {(scow %ud cas)} /tend//foo/baz]")
|
||||
;< ~ bind:m (wait-for-output ~dev "kal=[lal=%zuse num={(scow %ud zuse)}]")
|
||||
(pure:m ~)
|
||||
::
|
||||
++ setup
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m start-simple
|
||||
:: testing usual case
|
||||
;< ~ bind:m (init-ship ~bud &)
|
||||
;< ~ bind:m (init-ship ~dev &)
|
||||
;< ~ bind:m (dojo ~bud "|mount %base")
|
||||
;< ~ bind:m (dojo ~dev "|mount %base")
|
||||
;< ~ bind:m (copy-file ~bud /app/tend/hoon tend-agent)
|
||||
;< ~ bind:m (copy-file ~dev /app/tend/hoon tend-agent)
|
||||
;< ~ bind:m (dojo ~bud "|start %tend")
|
||||
;< ~ bind:m (dojo ~dev "|start %tend")
|
||||
(pure:m ~)
|
||||
::
|
||||
++ all
|
||||
^- thread:spider
|
||||
|= vase
|
||||
=/ m (strand ,vase)
|
||||
;< ~ bind:m test-normal
|
||||
;< ~ bind:m test-larval-ames
|
||||
(pure:m *vase)
|
||||
::
|
||||
++ test-larval-ames
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m setup
|
||||
;< ~ bind:m (dojo ~bud ":tend [%germ /foo]")
|
||||
;< ~ bind:m (sleep:strandio ~s2)
|
||||
;< ~ bind:m (tend zuse)
|
||||
;< ~ bind:m (keen-wait-for-result 0 zuse)
|
||||
=/ zuse (dec zuse)
|
||||
;< ~ bind:m (tend zuse)
|
||||
;< ~ bind:m (keen-wait-for-result 1 zuse)
|
||||
;< ~ bind:m end
|
||||
(pure:m ~)
|
||||
::
|
||||
++ test-normal
|
||||
=/ m (strand ,~)
|
||||
;< ~ bind:m setup
|
||||
;< ~ bind:m (send-hi ~bud ~dev) :: make sure both ames have metamorphosed
|
||||
;< ~ bind:m (dojo ~bud ":tend [%germ /foo]")
|
||||
;< ~ bind:m (sleep:strandio ~s2)
|
||||
;< ~ bind:m (tend zuse)
|
||||
;< ~ bind:m (keen-wait-for-result 0 zuse)
|
||||
=/ zuse (dec zuse)
|
||||
;< ~ bind:m (tend zuse)
|
||||
;< ~ bind:m (keen-wait-for-result 1 zuse)
|
||||
;< ~ bind:m end
|
||||
(pure:m ~)
|
||||
--
|
@ -103,6 +103,8 @@
|
||||
::
|
||||
?~ q.arg
|
||||
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
||||
?~ +.q.arg
|
||||
~[/(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/tests]
|
||||
:: else cast path to ~[path] if needed
|
||||
::
|
||||
?@ +<.q.arg
|
||||
|
@ -256,6 +256,14 @@
|
||||
;< ~ bind:m (send-events (insert-files:util her desk [pax warped] ~))
|
||||
(pure:m warped)
|
||||
::
|
||||
++ copy-file
|
||||
=/ m (strand ,~)
|
||||
|= [her=ship pax=path file=@t]
|
||||
^- form:m
|
||||
;< ~ bind:m
|
||||
(send-events (insert-files:util her %base [pax file] ~))
|
||||
(sleep ~s1)
|
||||
::
|
||||
:: Check /sur/aquarium/hoon on the given has the given contents.
|
||||
::
|
||||
++ check-file-touched
|
||||
|
@ -62,16 +62,27 @@
|
||||
::TODO should be rename -dill-output
|
||||
++ is-dojo-output
|
||||
|= [who=ship her=ship uf=unix-effect what=tape]
|
||||
|^
|
||||
?& =(who her)
|
||||
?=(%blit -.q.uf)
|
||||
::
|
||||
%+ lien p.q.uf
|
||||
|= =blit:dill
|
||||
?. ?=(%put -.blit)
|
||||
|
|
||||
!=(~ (find what p.blit))
|
||||
(lien p.q.uf handle-blit)
|
||||
==
|
||||
::
|
||||
++ handle-blit
|
||||
|= =blit:dill
|
||||
^- ?
|
||||
?: ?=(%mor -.blit)
|
||||
(lien p.blit handle-blit)
|
||||
?+ -.blit |
|
||||
%put !=(~ (find what p.blit))
|
||||
::
|
||||
%klr
|
||||
%+ lien p.blit
|
||||
|= [* q=(list @c)]
|
||||
!=(~ (find what q))
|
||||
==
|
||||
--
|
||||
::
|
||||
:: Test is successful if +is-dojo-output
|
||||
::
|
||||
++ expect-dojo-output
|
||||
|
@ -197,6 +197,20 @@
|
||||
`[%done +>.sign-arvo.u.in.tin]
|
||||
==
|
||||
::
|
||||
++ take-near
|
||||
|= =wire
|
||||
=/ m (strand ,[spar:ames (unit (unit page))])
|
||||
^- form:m
|
||||
|= tin=strand-input:strand
|
||||
?+ in.tin `[%skip ~]
|
||||
~ `[%wait ~]
|
||||
::
|
||||
[~ %sign * %ames %near ^ *]
|
||||
?. =(wire wire.u.in.tin)
|
||||
`[%skip ~]
|
||||
`[%done +>.sign-arvo.u.in.tin]
|
||||
==
|
||||
::
|
||||
++ take-poke-ack
|
||||
|= =wire
|
||||
=/ m (strand ,~)
|
||||
@ -335,7 +349,13 @@
|
||||
|= [=wire =spar:ames]
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
(send-raw-card %pass wire %arvo %a %keen spar)
|
||||
(send-raw-card %pass wire %arvo %a %keen ~ spar)
|
||||
::
|
||||
++ keen-shut
|
||||
|= [=wire =spar:ames]
|
||||
=/ m (strand ,~)
|
||||
^- form:m
|
||||
(send-raw-card %pass wire %keen & spar)
|
||||
::
|
||||
++ sleep
|
||||
|= for=@dr
|
||||
|
@ -1,6 +1,6 @@
|
||||
:: Print what your agent is doing.
|
||||
::
|
||||
/- verb
|
||||
/- *verb
|
||||
::
|
||||
|= [loud=? =agent:gall]
|
||||
=| bowl-print=_|
|
||||
@ -14,7 +14,10 @@
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-init"))
|
||||
=^ cards agent on-init:ag
|
||||
[[(emit-event %on-init ~) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-init ~)
|
||||
(emit-event-plus bowl [%on-init ~] cards)
|
||||
::
|
||||
++ on-save
|
||||
^- vase
|
||||
@ -26,7 +29,10 @@
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-load"))
|
||||
=^ cards agent (on-load:ag old-state)
|
||||
[[(emit-event %on-load ~) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-load ~)
|
||||
(emit-event-plus bowl [%on-load ~] cards)
|
||||
::
|
||||
++ on-poke
|
||||
|= [=mark =vase]
|
||||
@ -38,17 +44,23 @@
|
||||
%bowl `this(bowl-print !bowl-print)
|
||||
==
|
||||
=^ cards agent (on-poke:ag mark vase)
|
||||
[[(emit-event %on-poke mark) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-poke mark)
|
||||
(emit-event-plus bowl [%on-poke mark (mug q.vase)] cards)
|
||||
::
|
||||
++ on-watch
|
||||
|= =path
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-watch on path {<path>}"))
|
||||
=^ cards agent
|
||||
?: ?=([%verb %events ~] path)
|
||||
?: ?=([%verb ?(%events %events-plus) ~] path)
|
||||
[~ agent]
|
||||
(on-watch:ag path)
|
||||
[[(emit-event %on-watch path) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-watch path)
|
||||
(emit-event-plus bowl [%on-watch path] cards)
|
||||
::
|
||||
++ on-leave
|
||||
|= =path
|
||||
@ -57,7 +69,10 @@
|
||||
?: ?=([%verb %event ~] path)
|
||||
[~ this]
|
||||
=^ cards agent (on-leave:ag path)
|
||||
[[(emit-event %on-leave path) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-leave path)
|
||||
(emit-event-plus bowl [%on-leave path] cards)
|
||||
::
|
||||
++ on-peek
|
||||
|= =path
|
||||
@ -70,7 +85,17 @@
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-agent on wire {<wire>}, {<-.sign>}"))
|
||||
=^ cards agent (on-agent:ag wire sign)
|
||||
[[(emit-event %on-agent wire -.sign) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-agent wire -.sign)
|
||||
=; =^sign
|
||||
(emit-event-plus bowl [%on-agent wire sign] cards)
|
||||
?- -.sign
|
||||
%poke-ack [%poke-ack ?=(~ p.sign)]
|
||||
%watch-ack [%watch-ack ?=(~ p.sign)]
|
||||
%kick [%kick ~]
|
||||
%fact [%fact p.cage.sign (mug q.q.cage.sign)]
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [=wire =sign-arvo]
|
||||
@ -78,14 +103,20 @@
|
||||
%- %+ print bowl |.
|
||||
"{<dap.bowl>}: on-arvo on wire {<wire>}, {<[- +<]:sign-arvo>}"
|
||||
=^ cards agent (on-arvo:ag wire sign-arvo)
|
||||
[[(emit-event %on-arvo wire [- +<]:sign-arvo) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-arvo wire [- +<]:sign-arvo)
|
||||
(emit-event-plus bowl [%on-arvo wire [- +<]:sign-arvo] cards)
|
||||
::
|
||||
++ on-fail
|
||||
|= [=term =tang]
|
||||
^- (quip card:agent:gall agent:gall)
|
||||
%- (print bowl |.("{<dap.bowl>}: on-fail with term {<term>}"))
|
||||
=^ cards agent (on-fail:ag term tang)
|
||||
[[(emit-event %on-fail term) cards] this]
|
||||
:_ this
|
||||
:_ :_ cards
|
||||
(emit-event %on-fail term)
|
||||
(emit-event-plus bowl [%on-fail term] cards)
|
||||
--
|
||||
::
|
||||
++ print
|
||||
@ -99,7 +130,53 @@
|
||||
same
|
||||
::
|
||||
++ emit-event
|
||||
|= =event:verb
|
||||
|= =event
|
||||
^- card:agent:gall
|
||||
[%give %fact ~[/verb/events] %verb-event !>(event)]
|
||||
::
|
||||
++ emit-event-plus
|
||||
|= [=bowl:gall =cause cards=(list card:agent:gall)]
|
||||
^- card:agent:gall
|
||||
=; event=event-plus
|
||||
[%give %fact ~[/verb/events-plus] %verb-event-plus !>(event)]
|
||||
=- [act.bowl now.bowl src.bowl sap.bowl cause -]
|
||||
%+ turn cards
|
||||
|= =card:agent:gall
|
||||
^- effect
|
||||
::TODO for %fact, %kick, could calculate how many ships affected
|
||||
?- card
|
||||
[%pass * %agent * ?(%poke %poke-as) *]
|
||||
=, q.card
|
||||
=/ =cage ?-(-.task.q.card %poke cage.task, %poke-as [mark.task q.cage.task])
|
||||
[%poke p.card [ship name] p.cage `@`(mug q.q.cage)]
|
||||
::
|
||||
[%pass * %agent * ?(%watch %watch-as) *]
|
||||
=, q.card
|
||||
=/ =path ?-(-.task.q.card %watch path.task, %watch-as path.task)
|
||||
[%watch p.card [ship name] path]
|
||||
::
|
||||
[%pass * %agent * %leave *]
|
||||
=, q.card
|
||||
[%leave p.card [ship name]]
|
||||
::
|
||||
[%give %fact *]
|
||||
=, p.card
|
||||
[%fact paths p.cage (mug q.q.cage)]
|
||||
::
|
||||
[%give %kick *]
|
||||
[%kick paths.p.card]
|
||||
::
|
||||
[%give ?(%poke-ack %watch-ack) *]
|
||||
~| %explicit-ack
|
||||
!! :: shouldn't be given explicitly
|
||||
::
|
||||
[%pass * %arvo *]
|
||||
[%arvo p.card -.q.card +<.q.card]
|
||||
::
|
||||
[%pass *]
|
||||
[%arvo p.card %$ -.q.card]
|
||||
::
|
||||
[%slip *]
|
||||
$(card [%pass //slip p.card])
|
||||
==
|
||||
--
|
||||
|
78
pkg/base-dev/lib/verb/json.hoon
Normal file
78
pkg/base-dev/lib/verb/json.hoon
Normal file
@ -0,0 +1,78 @@
|
||||
:: verb-json: conversions for verb events
|
||||
::
|
||||
/- verb
|
||||
::
|
||||
|%
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
++ event
|
||||
|= event-plus:verb
|
||||
%- pairs
|
||||
:~ 'act'^(numb act)
|
||||
'now'^(time now) :: ms timestamp, lossy-ness is fine here
|
||||
'src'^s+(scot %p src)
|
||||
'sap'^s+(spat sap)
|
||||
'kind'^s+-.cause
|
||||
'deets'^(^cause cause)
|
||||
'effects'^a+(turn effects effect)
|
||||
==
|
||||
::
|
||||
++ cause
|
||||
|= =cause:verb
|
||||
^- json
|
||||
?- -.cause
|
||||
%on-init b+&
|
||||
%on-load b+&
|
||||
%on-poke (pairs 'mark'^s+mark.cause 'mug'^(mug mug.cause) ~)
|
||||
%on-watch (path path.cause)
|
||||
%on-leave (path path.cause)
|
||||
%on-agent %- pairs
|
||||
:~ 'wire'^(path wire.cause)
|
||||
'sign'^s+-.sign.cause
|
||||
::
|
||||
:- 'deets'
|
||||
?- -.sign.cause
|
||||
%poke-ack b+ack.sign.cause
|
||||
%watch-ack b+ack.sign.cause
|
||||
%kick ~
|
||||
%fact %- pairs
|
||||
:~ 'mark'^s+mark.sign.cause
|
||||
'mug'^(mug mug.sign.cause)
|
||||
==
|
||||
==
|
||||
==
|
||||
%on-arvo %- pairs
|
||||
:~ 'wire'^(path wire.cause)
|
||||
'vane'^s+vane.cause
|
||||
'sign'^s+sign.cause
|
||||
==
|
||||
%on-fail s+term.cause
|
||||
==
|
||||
::
|
||||
++ effect
|
||||
|= effect:verb
|
||||
^- json
|
||||
%- pairs
|
||||
:- 'kind'^s++<-
|
||||
:_ ~
|
||||
:- 'deets'
|
||||
%- pairs
|
||||
^- (list [@t json])
|
||||
?- +<-
|
||||
%poke :~ 'wire'^(path wire)
|
||||
'gill'^(^gill gill)
|
||||
'mark'^s+mark
|
||||
'mug'^(^mug mug)
|
||||
==
|
||||
%watch ~['wire'^(^path wire) 'gill'^(^gill gill) 'path'^(^path path)]
|
||||
%leave ~['wire'^(path wire) 'gill'^(^gill gill)]
|
||||
%fact ~['paths'^a+(turn paths path) 'mark'^s+mark 'mug'^(^mug mug)]
|
||||
%kick ~['paths'^a+(turn paths path)]
|
||||
%arvo ~['wire'^(path wire) 'vane'^s+vane 'task'^s+task]
|
||||
==
|
||||
::
|
||||
++ gill |=(=gill:gall `json`s+(rap 3 (scot %p p.gill) '/' q.gill ~))
|
||||
++ mug |=(mug=@ux `json`s+(crip ((x-co:co 8) mug)))
|
||||
--
|
||||
--
|
22
pkg/base-dev/mar/kiln/approve-merge.hoon
Normal file
22
pkg/base-dev/mar/kiln/approve-merge.hoon
Normal file
@ -0,0 +1,22 @@
|
||||
::
|
||||
:::: /hoon/approve-merge/kiln/mar
|
||||
::
|
||||
/- h=hood
|
||||
|_ req=[sync-record:h approve=?]
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun req
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun ,[sync-record:h approve=?]
|
||||
++ json
|
||||
=, dejs:format
|
||||
%- ot
|
||||
:~ [%sync (ot syd+so her+(se %p) sud+so ~)]
|
||||
[%approve bo]
|
||||
==
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
16
pkg/base-dev/mar/kiln/jump-ask.hoon
Normal file
16
pkg/base-dev/mar/kiln/jump-ask.hoon
Normal file
@ -0,0 +1,16 @@
|
||||
::
|
||||
:::: /hoon/jump-ask/kiln/mar
|
||||
::
|
||||
/? 310
|
||||
|_ req=[old=dock new=dock]
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun req
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun ,[dock dock]
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
22
pkg/base-dev/mar/kiln/jump-opt.hoon
Normal file
22
pkg/base-dev/mar/kiln/jump-opt.hoon
Normal file
@ -0,0 +1,22 @@
|
||||
::
|
||||
:::: /hoon/jump-opt/kiln/mar
|
||||
::
|
||||
|_ req=[old=dock new=dock yea=?]
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun req
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun ,[dock dock ?]
|
||||
++ json
|
||||
=, dejs:format
|
||||
%- ot
|
||||
:~ [%old (ot ship+(se %p) desk+so ~)]
|
||||
[%new (ot ship+(se %p) desk+so ~)]
|
||||
[%yea bo]
|
||||
==
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
43
pkg/base-dev/mar/kiln/jump.hoon
Normal file
43
pkg/base-dev/mar/kiln/jump.hoon
Normal file
@ -0,0 +1,43 @@
|
||||
::
|
||||
:::: /hoon/jump/kiln/mar
|
||||
::
|
||||
/- h=hood
|
||||
|_ jum=jump:h
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun jum
|
||||
++ json
|
||||
=, enjs:format
|
||||
|^ ^- ^json
|
||||
?- -.jum
|
||||
%add
|
||||
%+ frond 'add'
|
||||
(pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~)
|
||||
::
|
||||
%yea
|
||||
%+ frond 'yea'
|
||||
(pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~)
|
||||
::
|
||||
%nay
|
||||
%+ frond 'nay'
|
||||
(pairs ['old' (en-dock old.jum)] ['new' (en-dock new.jum)] ~)
|
||||
::
|
||||
%all
|
||||
%+ frond 'all'
|
||||
:- %a
|
||||
%+ turn ~(tap by all.jum)
|
||||
|= [old=dock new=dock]
|
||||
(pairs ['old' (en-dock old)] ['new' (en-dock new)] ~)
|
||||
==
|
||||
++ en-dock
|
||||
|= =dock
|
||||
(pairs ['ship' s+(scot %p p.dock)] ['desk' s+q.dock] ~)
|
||||
--
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun jump:h
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
50
pkg/base-dev/mar/kiln/sync-update.hoon
Normal file
50
pkg/base-dev/mar/kiln/sync-update.hoon
Normal file
@ -0,0 +1,50 @@
|
||||
::
|
||||
:::: /hoon/sync-update/kiln/mar
|
||||
::
|
||||
/- h=hood
|
||||
|_ upd=sync-update:h
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun upd
|
||||
++ json
|
||||
=, enjs:format
|
||||
|^ ^- ^json
|
||||
?- -.upd
|
||||
%new
|
||||
%+ frond 'new'
|
||||
(pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~)
|
||||
::
|
||||
%done
|
||||
%+ frond 'done'
|
||||
(pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~)
|
||||
::
|
||||
%drop
|
||||
%+ frond 'drop'
|
||||
(pairs ['for' (en-sync-record for.upd)] ['rev' (numb rev.upd)] ~)
|
||||
::
|
||||
%pending
|
||||
%+ frond 'pending'
|
||||
:- %a
|
||||
%+ turn ~(tap by pending.upd)
|
||||
|= [for=sync-record:h rev=@ud]
|
||||
%- pairs
|
||||
:~ ['for' (en-sync-record for)]
|
||||
['rev' (numb rev)]
|
||||
==
|
||||
==
|
||||
++ en-sync-record
|
||||
|= sync-record:h
|
||||
%- pairs
|
||||
:~ ['syd' s+syd]
|
||||
['her' s+(scot %p her)]
|
||||
['sud' s+sud]
|
||||
==
|
||||
--
|
||||
--
|
||||
++ grab
|
||||
|%
|
||||
++ noun sync-update:h
|
||||
--
|
||||
++ grad %noun
|
||||
--
|
15
pkg/base-dev/mar/verb/event-plus.hoon
Normal file
15
pkg/base-dev/mar/verb/event-plus.hoon
Normal file
@ -0,0 +1,15 @@
|
||||
/- verb
|
||||
/+ verb-json
|
||||
|_ =event-plus:verb
|
||||
++ grad %noun
|
||||
++ grab
|
||||
|%
|
||||
++ noun event-plus:verb
|
||||
--
|
||||
::
|
||||
++ grow
|
||||
|%
|
||||
++ noun event-plus
|
||||
++ json (event:enjs:verb-json event-plus)
|
||||
--
|
||||
--
|
@ -41,7 +41,7 @@
|
||||
[%pause-events who=ship]
|
||||
[%snap-ships lab=term hers=(list ship)]
|
||||
[%restore-snap lab=term]
|
||||
[%read [from=ship =path] [for=lane:ames num=@ud]]
|
||||
[%read [from=[=ship life=@ubC] =path] for=[=lane:ames life=@ubC] num=@ud]
|
||||
[%event who=ship ue=unix-event]
|
||||
==
|
||||
::
|
||||
@ -82,5 +82,10 @@
|
||||
[%kill ~]
|
||||
[%init ~]
|
||||
[%request id=@ud request=request:http]
|
||||
[%turf p=(list turf)]
|
||||
:: XX effects seen after running :aqua [%swap-files ~]
|
||||
[%vega ~]
|
||||
[%set-config =http-config:eyre]
|
||||
[%sessions p=(set @t)]
|
||||
==
|
||||
--
|
||||
|
@ -10,12 +10,41 @@
|
||||
==
|
||||
::
|
||||
+$ pikes (map desk pike)
|
||||
:: $jump: changes to update source change requests
|
||||
::
|
||||
+$ jump
|
||||
$% [%all all=(map dock dock)] :: pending requests
|
||||
[%add old=dock new=dock] :: new request
|
||||
[%yea old=dock new=dock] :: approved
|
||||
[%nay old=dock new=dock] :: denied
|
||||
==
|
||||
:: $rung: reference to upstream commit
|
||||
::
|
||||
+$ rung [=aeon =weft]
|
||||
:: #sync-record: source and destination of a kiln sync
|
||||
::
|
||||
+$ sync-record ::
|
||||
$: syd=desk :: local desk
|
||||
her=ship :: foreign ship
|
||||
sud=desk :: foreign desk
|
||||
==
|
||||
::
|
||||
+$ sync-state ::
|
||||
$: nun=@ta :: nonce
|
||||
kid=(unit desk) :: has kids desk too?
|
||||
let=@ud :: next revision
|
||||
nit=(unit ?) :: automerge or default
|
||||
hav=(unit @ud) :: update available
|
||||
yea=? :: update approved
|
||||
==
|
||||
::
|
||||
+$ sync-update
|
||||
$% [%new for=sync-record rev=@ud]
|
||||
[%done for=sync-record rev=@ud]
|
||||
[%drop for=sync-record rev=@ud]
|
||||
[%pending pending=(set [for=sync-record rev=@ud])]
|
||||
==
|
||||
::
|
||||
+$ sync-state [nun=@ta kid=(unit desk) let=@ud]
|
||||
+$ sink (unit [her=@p sud=desk kid=(unit desk) let=@ud])
|
||||
:: +truncate-hash: get last 5 digits of hash and convert to tape
|
||||
::
|
||||
@ -30,7 +59,7 @@
|
||||
=/ ego (scot %p our)
|
||||
=/ wen (scot %da now)
|
||||
:* .^(rock:tire %cx /[ego]//[wen]/tire)
|
||||
.^(=cone %cx /[ego]//[wen]/domes)
|
||||
.^(cone %cx /[ego]//[wen]/domes)
|
||||
.^((map desk [ship desk]) %gx /[ego]/hood/[wen]/kiln/sources/noun)
|
||||
.^ (map [desk ship desk] sync-state) %gx
|
||||
/[ego]/hood/[wen]/kiln/syncs/noun
|
||||
@ -43,44 +72,73 @@
|
||||
^- tang
|
||||
=/ ego (scot %p our)
|
||||
=/ wen (scot %da now)
|
||||
=/ prep (report-prep our now)
|
||||
?~ filt
|
||||
=+ prep=[tyr cone sor zyn]=(report-prep our now)
|
||||
?: =(%$ filt)
|
||||
%- zing
|
||||
%+ turn (flop desks)
|
||||
|=(syd=@tas (report-vat prep our now syd verb))
|
||||
=/ deks
|
||||
?~ desks
|
||||
%+ sort
|
||||
(sort ~(tap by -.prep) |=([[a=@ *] b=@ *] !(aor a b)))
|
||||
|=([[a=@ *] [b=@ *]] ?|(=(a %kids) =(b %base)))
|
||||
%+ skip ~(tap by -.prep)
|
||||
|=([syd=@tas *] =(~ (find ~[syd] desks)))
|
||||
=. deks (skim deks |=([=desk *] ((sane %tas) desk)))
|
||||
?: =(filt %blocking)
|
||||
=/ base-wic
|
||||
%+ sort ~(tap by wic:(~(got by -.prep) %base))
|
||||
|=([[* a=@ud] [* b=@ud]] (gth a b))
|
||||
?~ base-wic ~[leaf+"%base already up-to-date"]
|
||||
=/ blockers=(list desk)
|
||||
%+ turn
|
||||
%+ skip ~(tap in -.prep)
|
||||
|= [* [zest=@tas wic=(set weft)]]
|
||||
?. =(zest %live) &
|
||||
(~(has in wic) i.base-wic)
|
||||
|=([syd=desk *] syd)
|
||||
?~ blockers ~[leaf+"No desks blocking upgrade, run |bump to apply"]
|
||||
:- [%rose [" %" "To unblock upgrade run |suspend %" ""] blockers]
|
||||
?^ desks
|
||||
(flop desks)
|
||||
%+ sort ~(tap in ~(key by tyr.prep))
|
||||
|= [a=desk b=desk]
|
||||
?: |(=(a %kids) =(b %base)) &
|
||||
?: |(=(a %base) =(b %kids)) |
|
||||
(aor b a)
|
||||
|=(syd=@tas (report-vat prep our now syd verb))
|
||||
=/ deks=(list [=desk =zest wic=(set weft)])
|
||||
?~ desks
|
||||
%+ sort ~(tap by tyr.prep)
|
||||
|= [[a=desk *] [b=desk *]]
|
||||
?: |(=(a %kids) =(b %base)) &
|
||||
?: |(=(a %base) =(b %kids)) |
|
||||
(aor b a)
|
||||
%+ murn (flop desks)
|
||||
|= des=desk
|
||||
^- (unit [=desk =zest wic=(set weft)])
|
||||
?~ got=(~(get by tyr.prep) des)
|
||||
~
|
||||
`[des u.got]
|
||||
?: =(filt %blocking)
|
||||
=/ base-weft=(unit weft)
|
||||
%- ~(rep in wic:(~(got by tyr.prep) %base))
|
||||
|= [=weft out=(unit weft)]
|
||||
?~ out
|
||||
`weft
|
||||
?: (lth num.weft num.u.out)
|
||||
out
|
||||
`weft
|
||||
?~ base-weft ~['%base already up-to-date']
|
||||
=/ blockers=(list desk)
|
||||
%+ sort
|
||||
^- (list desk)
|
||||
%+ murn deks
|
||||
|= [=desk =zest wic=(set weft)]
|
||||
^- (unit ^desk)
|
||||
?. =(%live zest)
|
||||
~
|
||||
?: (~(has in wic) u.base-weft)
|
||||
~
|
||||
`desk
|
||||
aor
|
||||
?~ blockers ~['No desks blocking upgrade']
|
||||
%- zing
|
||||
%+ turn (flop blockers)
|
||||
^- (list tang)
|
||||
:- :~ %+ rap 3
|
||||
:~ 'These desks are blocking upgrade to [%zuse '
|
||||
(scot %ud num.u.base-weft)
|
||||
']:'
|
||||
== ==
|
||||
%+ turn blockers
|
||||
|=(syd=desk (report-vat prep our now syd verb))
|
||||
::
|
||||
%- zing
|
||||
%+ turn
|
||||
?+ filt !!
|
||||
::
|
||||
%exists
|
||||
%+ skip deks
|
||||
|=([syd=desk *] =(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0))
|
||||
|= [syd=desk *]
|
||||
?~ got=(~(get by cone.prep) our syd)
|
||||
&
|
||||
=(0 let.u.got)
|
||||
::
|
||||
%running
|
||||
%+ skim deks
|
||||
@ -91,103 +149,143 @@
|
||||
|= [syd=@tas [zest=@tas *]]
|
||||
?| =(syd %kids)
|
||||
=(zest %live)
|
||||
=(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0)
|
||||
?~ got=(~(get by cone.prep) our syd)
|
||||
&
|
||||
=(0 let.u.got)
|
||||
==
|
||||
::
|
||||
%exists-not
|
||||
%+ skim deks
|
||||
|=([syd=desk *] =(ud:.^(cass %cw /[ego]/[syd]/[wen]) 0))
|
||||
|= [syd=desk *]
|
||||
?~ got=(~(get by cone.prep) our syd)
|
||||
|
|
||||
=(0 let.u.got)
|
||||
==
|
||||
|=([syd=desk *] (report-vat prep our now syd verb))
|
||||
:: +report-vat: report on a single desk installation
|
||||
::
|
||||
++ report-vat
|
||||
|= $: $: tyr=rock:tire =cone sor=(map desk [ship desk])
|
||||
|= $: $: tyr=rock:tire =cone sor=(map desk (pair ship desk))
|
||||
zyn=(map [desk ship desk] sync-state)
|
||||
==
|
||||
our=ship now=@da syd=desk verb=?
|
||||
==
|
||||
^- tang
|
||||
=- :: hack to force wrapped rendering
|
||||
::
|
||||
:: edg=6 empirically prevents dedent
|
||||
::
|
||||
%+ roll
|
||||
(~(win re -) [0 6])
|
||||
|=([a=tape b=(list @t)] [(crip a) b])
|
||||
::
|
||||
^- tank
|
||||
|^ ^- tang
|
||||
=/ ego (scot %p our)
|
||||
=/ wen (scot %da now)
|
||||
?. ((sane %tas) syd)
|
||||
leaf+"insane desk: {<syd>}"
|
||||
=+ .^(=cass %cw /[ego]/[syd]/[wen])
|
||||
?: =(ud.cass 0)
|
||||
leaf+"desk does not yet exist: {<syd>}"
|
||||
?: =(%kids syd)
|
||||
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
|
||||
leaf+"%kids %cz hash: {<hash>}"
|
||||
=/ kel-path
|
||||
/[ego]/[syd]/[wen]/sys/kelvin
|
||||
?. .^(? %cu kel-path)
|
||||
leaf+"bad desk: {<syd>}"
|
||||
=+ .^(=waft %cx kel-path)
|
||||
:+ %rose ["" "{<syd>}" "::"]
|
||||
^- tang
|
||||
~[(cat 3 'insane desk: %' syd)]
|
||||
?. (~(has by cone) our syd)
|
||||
~[(cat 3 'desk does not yet exist: %' syd)]
|
||||
=/ hash .^(@uv %cz /[ego]/[syd]/[wen])
|
||||
?: =(%kids syd)
|
||||
~[(cat 3 '%kids %cz hash: ' (scot %uv hash))]
|
||||
=/ kel-path /[ego]/[syd]/[wen]/sys/kelvin
|
||||
?. .^(? %cu kel-path)
|
||||
~[(cat 3 'bad desk: %' syd)]
|
||||
=+ .^(=waft %cx kel-path)
|
||||
^- tang
|
||||
=/ =sink
|
||||
?~ s=(~(get by sor) syd)
|
||||
~
|
||||
?~ z=(~(get by zyn) syd u.s)
|
||||
~
|
||||
`[-.u.s +.u.s +.u.z]
|
||||
`[p.u.s q.u.s [kid let]:u.z]
|
||||
=/ meb=(list @uv)
|
||||
?~ sink [hash]~
|
||||
(mergebase-hashes our syd now her.u.sink sud.u.sink)
|
||||
?~ sink ~[hash]
|
||||
%+ turn
|
||||
.^ (list tako) %cs
|
||||
/[ego]/[syd]/[wen]/base/(scot %p her.u.sink)/[sud.u.sink]
|
||||
==
|
||||
|=(=tako .^(@uv %cs /[ego]/[syd]/[wen]/hash/(scot %uv tako)))
|
||||
=/ dek (~(got by tyr) syd)
|
||||
=/ sat
|
||||
?- zest.dek
|
||||
%live "running"
|
||||
%dead "suspended"
|
||||
%held "suspended until next update"
|
||||
%live 'running'
|
||||
%dead 'suspended'
|
||||
%held 'suspended until next update'
|
||||
==
|
||||
=/ kul=tape
|
||||
%+ roll
|
||||
%+ sort
|
||||
~(tap in (waft-to-wefts:clay waft))
|
||||
|= [a=weft b=weft]
|
||||
?: =(lal.a lal.b)
|
||||
(lte num.a num.b)
|
||||
(lte lal.a lal.b)
|
||||
|= [=weft =tape]
|
||||
(welp " {<[lal num]:weft>}" tape)
|
||||
=/ kul=cord (print-wefts (waft-to-wefts waft))
|
||||
?. verb
|
||||
:~ leaf/"/sys/kelvin: {kul}"
|
||||
leaf/"%cz hash ends in: {(truncate-hash hash)}"
|
||||
leaf/"app status: {sat}"
|
||||
leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
|
||||
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
|
||||
:~ '::'
|
||||
(cat 3 ' pending updates: ' (print-wefts wic.dek))
|
||||
(cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink)))
|
||||
(cat 3 ' app status: ' sat)
|
||||
(cat 3 ' %cz hash ends in: ' (print-shorthash hash))
|
||||
(cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft)))
|
||||
(cat 3 '%' syd)
|
||||
==
|
||||
::
|
||||
=/ [on=(list [@tas ?]) of=(list [@tas ?])]
|
||||
=/ =dome (~(got by cone) our syd)
|
||||
(skid ~(tap by ren.dome) |=([* ?] +<+))
|
||||
:~ leaf/"/sys/kelvin: {kul}"
|
||||
leaf/"base hash: {?.(=(1 (lent meb)) <meb> <(head meb)>)}"
|
||||
leaf/"%cz hash: {<hash>}"
|
||||
=/ [on=(list @tas) of=(list @tas)]
|
||||
=/ [on=(list @tas) of=(list @tas)]
|
||||
%- ~(rep by ren:(~(got by cone) our syd))
|
||||
|= [[=dude:gall is-on=?] on=(list @tas) of=(list @tas)]
|
||||
?: is-on
|
||||
[[dude on] of]
|
||||
[on [dude of]]
|
||||
[(sort on aor) (sort of aor)]
|
||||
:~ '::'
|
||||
(cat 3 ' pending updates: ' (print-wefts wic.dek))
|
||||
%^ cat 3 ' kids desk: ' ?~ sink '~'
|
||||
?~ kid.u.sink '~'
|
||||
(cat 3 '%' u.kid.u.sink)
|
||||
(cat 3 ' source aeon: ' ?~(sink '~' (scot %ud let.u.sink)))
|
||||
(cat 3 ' source desk: ' ?~(sink '~' (cat 3 '%' sud.u.sink)))
|
||||
(cat 3 ' source ship: ' ?~(sink '~' (scot %p her.u.sink)))
|
||||
(cat 3 ' updates: ' ?~(sink 'local' 'remote'))
|
||||
%^ cat 3 ' publishing ship: ' ?~ got=(get-publisher our syd now)
|
||||
'~'
|
||||
(scot %p u.got)
|
||||
::
|
||||
leaf/"app status: {sat}"
|
||||
leaf/"force on: {<(sort (turn on head) aor)>}"
|
||||
leaf/"force off: {<(sort (turn of head) aor)>}"
|
||||
(cat 3 ' force off: ' (print-agents of))
|
||||
(cat 3 ' force on: ' (print-agents on))
|
||||
(cat 3 ' app status: ' sat)
|
||||
::
|
||||
leaf/"publishing ship: {?~(sink <~> <(get-publisher our syd now)>)}"
|
||||
leaf/"updates: {?~(sink "local" "remote")}"
|
||||
leaf/"source ship: {?~(sink <~> <her.u.sink>)}"
|
||||
leaf/"source desk: {?~(sink <~> <sud.u.sink>)}"
|
||||
leaf/"source aeon: {?~(sink <~> <let.u.sink>)}"
|
||||
leaf/"kids desk: {?~(sink <~> ?~(kid.u.sink <~> <u.kid.u.sink>))}"
|
||||
leaf/"pending updates: {<`(list [@tas @ud])`~(tap in wic.dek)>}"
|
||||
(cat 3 ' %cz hash: ' (scot %uv hash))
|
||||
(cat 3 ' base hash: ' (print-mergebases meb))
|
||||
(cat 3 ' /sys/kelvin: ' (print-wefts (waft-to-wefts waft)))
|
||||
(cat 3 '%' syd)
|
||||
==
|
||||
++ print-wefts
|
||||
|= wefts=(set weft)
|
||||
^- @t
|
||||
?: =(~ wefts)
|
||||
'~'
|
||||
%+ roll (sort ~(tap in wefts) aor)
|
||||
|= [=weft out=@t]
|
||||
?: =('' out)
|
||||
(rap 3 '[%' lal.weft ' ' (scot %ud num.weft) ']' ~)
|
||||
(rap 3 out ' [%' lal.weft ' ' (scot %ud num.weft) ']' ~)
|
||||
::
|
||||
++ print-shorthash
|
||||
|= hash=@uv
|
||||
^- @t
|
||||
(crip ((v-co:co 5) (end [0 25] hash)))
|
||||
::
|
||||
++ print-mergebases
|
||||
|= hashes=(list @uv)
|
||||
^- @t
|
||||
?~ hashes
|
||||
'~'
|
||||
?~ t.hashes
|
||||
(scot %uv i.hashes)
|
||||
%+ roll `(list @uv)`hashes
|
||||
|= [hash=@uv out=@t]
|
||||
?: =('' out)
|
||||
(print-shorthash hash)
|
||||
(rap 3 out ' ' (print-shorthash hash) ~)
|
||||
::
|
||||
++ print-agents
|
||||
|= agents=(list @tas)
|
||||
^- @t
|
||||
?~ agents
|
||||
'~'
|
||||
%+ roll `(list @tas)`agents
|
||||
|= [agent=@tas out=@tas]
|
||||
?: =('' out)
|
||||
(cat 3 '%' agent)
|
||||
(rap 3 out ' %' agent ~)
|
||||
--
|
||||
:: +report-kids: non-vat cz hash report for kids desk
|
||||
::
|
||||
++ report-kids
|
||||
@ -197,9 +295,9 @@
|
||||
=/ ego (scot %p our)
|
||||
=/ wen (scot %da now)
|
||||
?. (~(has in .^((set desk) %cd /[ego]//[wen])) syd)
|
||||
leaf/"no %kids desk"
|
||||
'no %kids desk'
|
||||
=+ .^(hash=@uv %cz /[ego]/[syd]/[wen])
|
||||
leaf/"%kids %cz hash: {<hash>}"
|
||||
(cat 3 '%kids %cz hash: ' (scot %uv hash))
|
||||
:: +read-bill-foreign: read /desk/bill from a foreign desk
|
||||
::
|
||||
++ read-bill-foreign
|
||||
@ -259,8 +357,8 @@
|
||||
=/ her (scot %p her)
|
||||
=/ ego (scot %p our)
|
||||
=/ wen (scot %da now)
|
||||
%+ turn .^((list tako) %cs ~[ego syd wen %base her sud])
|
||||
|=(=tako .^(@uv %cs ~[ego syd wen %hash (scot %uv tako)]))
|
||||
%+ turn .^((list tako) %cs /[ego]/[syd]/[wen]/base/[her]/[sud])
|
||||
|=(=tako .^(@uv %cs /[ego]/[syd]/[wen]/hash/(scot %uv tako)))
|
||||
::
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|
@ -9,4 +9,40 @@
|
||||
[%on-arvo =wire vane=term sign=term]
|
||||
[%on-fail =term]
|
||||
==
|
||||
::
|
||||
+$ event-plus
|
||||
$: act=@ud
|
||||
now=@da
|
||||
src=@p
|
||||
sap=path
|
||||
=cause
|
||||
effects=(list effect)
|
||||
==
|
||||
::
|
||||
+$ cause
|
||||
$% [%on-init ~]
|
||||
[%on-load ~]
|
||||
[%on-poke =mark mug=@ux]
|
||||
[%on-watch =path]
|
||||
[%on-leave =path]
|
||||
[%on-agent =wire =sign]
|
||||
[%on-arvo =wire vane=term sign=term]
|
||||
[%on-fail =term]
|
||||
==
|
||||
::
|
||||
+$ sign
|
||||
$% [%poke-ack ack=?]
|
||||
[%watch-ack ack=?]
|
||||
[%kick ~]
|
||||
[%fact =mark mug=@ux]
|
||||
==
|
||||
::
|
||||
+$ effect
|
||||
$% [%poke =wire =gill:gall =mark mug=@ux]
|
||||
[%watch =wire =gill:gall =path]
|
||||
[%leave =wire =gill:gall]
|
||||
[%fact paths=(list path) =mark mug=@ux]
|
||||
[%kick paths=(list path)]
|
||||
[%arvo =wire vane=term task=term]
|
||||
==
|
||||
--
|
@ -1,183 +0,0 @@
|
||||
var gulp = require('gulp');
|
||||
var cssimport = require('gulp-cssimport');
|
||||
var rollup = require('gulp-better-rollup');
|
||||
var cssnano = require('cssnano');
|
||||
var postcss = require('gulp-postcss');
|
||||
var sucrase = require('@sucrase/gulp-plugin');
|
||||
var minify = require('gulp-minify');
|
||||
var rename = require('gulp-rename');
|
||||
var del = require('del');
|
||||
|
||||
var resolve = require('rollup-plugin-node-resolve');
|
||||
var commonjs = require('rollup-plugin-commonjs');
|
||||
var rootImport = require('rollup-plugin-root-import');
|
||||
var globals = require('rollup-plugin-node-globals');
|
||||
|
||||
/***
|
||||
Main config options
|
||||
***/
|
||||
|
||||
var urbitrc = require('../urbitrc');
|
||||
|
||||
/***
|
||||
End main config options
|
||||
***/
|
||||
|
||||
gulp.task('css-bundle', function() {
|
||||
let plugins = [
|
||||
cssnano()
|
||||
];
|
||||
return gulp
|
||||
.src('src/index.css')
|
||||
.pipe(cssimport())
|
||||
.pipe(postcss(plugins))
|
||||
.pipe(gulp.dest('../../arvo/app/debug/css'));
|
||||
});
|
||||
|
||||
gulp.task('jsx-transform', function(cb) {
|
||||
return gulp.src('src/**/*.js')
|
||||
.pipe(sucrase({
|
||||
transforms: ['jsx']
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('tile-jsx-transform', function(cb) {
|
||||
return gulp.src('tile/**/*.js')
|
||||
.pipe(sucrase({
|
||||
transforms: ['jsx']
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('js-imports', function(cb) {
|
||||
return gulp.src('dist/index.js')
|
||||
.pipe(rollup({
|
||||
plugins: [
|
||||
commonjs({
|
||||
namedExports: {
|
||||
'node_modules/react/index.js': [ 'Component', 'createRef', 'createElement', 'useState', 'useRef', 'useEffect', 'Fragment' ],
|
||||
'node_modules/react-is/index.js': [ 'isValidElementType' ],
|
||||
}
|
||||
}),
|
||||
rootImport({
|
||||
root: `${__dirname}/dist/js`,
|
||||
useEntry: 'prepend',
|
||||
extensions: '.js'
|
||||
}),
|
||||
globals(),
|
||||
resolve()
|
||||
]
|
||||
}, 'umd'))
|
||||
.on('error', function(e){
|
||||
console.log(e);
|
||||
cb();
|
||||
})
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'))
|
||||
.on('end', cb);
|
||||
});
|
||||
|
||||
gulp.task('tile-js-imports', function(cb) {
|
||||
return gulp.src('dist/tile.js')
|
||||
.pipe(rollup({
|
||||
plugins: [
|
||||
commonjs({
|
||||
namedExports: {
|
||||
'node_modules/react/index.js': [ 'Component' ],
|
||||
}
|
||||
}),
|
||||
rootImport({
|
||||
root: `${__dirname}/dist/js`,
|
||||
useEntry: 'prepend',
|
||||
extensions: '.js'
|
||||
}),
|
||||
globals(),
|
||||
resolve()
|
||||
]
|
||||
}, 'umd'))
|
||||
.on('error', function(e){
|
||||
console.log(e);
|
||||
cb();
|
||||
})
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'))
|
||||
.on('end', cb);
|
||||
});
|
||||
|
||||
gulp.task('js-minify', function () {
|
||||
return gulp.src('../../arvo/app/debug/js/index.js')
|
||||
.pipe(minify())
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'));
|
||||
});
|
||||
|
||||
gulp.task('tile-js-minify', function () {
|
||||
return gulp.src('../../arvo/app/debug/js/tile.js')
|
||||
.pipe(minify())
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'));
|
||||
});
|
||||
|
||||
gulp.task('rename-index-min', function() {
|
||||
return gulp.src('../../arvo/app/debug/js/index-min.js')
|
||||
.pipe(rename('index.js'))
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'))
|
||||
});
|
||||
|
||||
gulp.task('rename-tile-min', function() {
|
||||
return gulp.src('../../arvo/app/debug/js/tile-min.js')
|
||||
.pipe(rename('tile.js'))
|
||||
.pipe(gulp.dest('../../arvo/app/debug/js/'))});
|
||||
|
||||
gulp.task('clean-min', function() {
|
||||
return del(['../../arvo/app/debug/js/index-min.js', '../../arvo/app/debug/js/tile-min.js'], {force: true})
|
||||
});
|
||||
|
||||
gulp.task('urbit-copy', function () {
|
||||
let ret = gulp.src('../../arvo/**/*');
|
||||
|
||||
urbitrc.URBIT_PIERS.forEach(function(pier) {
|
||||
ret = ret.pipe(gulp.dest(pier));
|
||||
});
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
gulp.task('js-bundle-dev', gulp.series('jsx-transform', 'js-imports'));
|
||||
gulp.task('tile-js-bundle-dev', gulp.series('tile-jsx-transform', 'tile-js-imports'));
|
||||
gulp.task('js-bundle-prod', gulp.series('jsx-transform', 'js-imports', 'js-minify'))
|
||||
gulp.task('tile-js-bundle-prod',
|
||||
gulp.series('tile-jsx-transform', 'tile-js-imports', 'tile-js-minify'));
|
||||
|
||||
gulp.task('bundle-dev',
|
||||
gulp.series(
|
||||
gulp.parallel(
|
||||
'css-bundle',
|
||||
'js-bundle-dev',
|
||||
'tile-js-bundle-dev'
|
||||
),
|
||||
'urbit-copy'
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task('bundle-prod',
|
||||
gulp.series(
|
||||
gulp.parallel(
|
||||
'css-bundle',
|
||||
'js-bundle-prod',
|
||||
'tile-js-bundle-prod',
|
||||
),
|
||||
'rename-index-min',
|
||||
'rename-tile-min',
|
||||
'clean-min',
|
||||
'urbit-copy'
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task('default', gulp.series('bundle-dev'));
|
||||
|
||||
gulp.task('watch', gulp.series('default', function() {
|
||||
gulp.watch('tile/**/*.js', gulp.parallel('tile-js-bundle-dev'));
|
||||
|
||||
gulp.watch('src/**/*.js', gulp.parallel('js-bundle-dev'));
|
||||
gulp.watch('src/**/*.css', gulp.parallel('css-bundle'));
|
||||
|
||||
gulp.watch('../../arvo/**/*', gulp.parallel('urbit-copy'));
|
||||
}));
|
15
pkg/interface/dbug/index.html
Normal file
15
pkg/interface/dbug/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Debug Dashboard</title>
|
||||
<style type="text/css" src="/src/index.css"></style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="/~debug/channel.js"></script>
|
||||
<script src="/~debug/js/session.js"></script>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
BIN
pkg/interface/dbug/package-lock.json
generated
BIN
pkg/interface/dbug/package-lock.json
generated
Binary file not shown.
@ -1,43 +1,32 @@
|
||||
{
|
||||
"name": "urbit-apps",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"name": "debug-dashboard",
|
||||
"private": true,
|
||||
"version": "2.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@sucrase/gulp-plugin": "^2.0.0",
|
||||
"cssnano": "^4.1.10",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-better-rollup": "^4.0.1",
|
||||
"gulp-cssimport": "^7.0.0",
|
||||
"gulp-minify": "^3.1.0",
|
||||
"gulp-postcss": "^8.0.0",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"moment": "^2.24.0",
|
||||
"rollup": "^1.6.0",
|
||||
"rollup-plugin-commonjs": "^9.2.0",
|
||||
"rollup-plugin-node-globals": "^1.4.0",
|
||||
"rollup-plugin-node-resolve": "^4.0.0",
|
||||
"rollup-plugin-root-import": "^0.2.3",
|
||||
"sucrase": "^3.8.0"
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gitgraph/react": "^1.5.4",
|
||||
"classnames": "^2.2.6",
|
||||
"del": "^5.1.0",
|
||||
"lodash": "^4.17.11",
|
||||
"mousetrap": "^1.6.3",
|
||||
"react": "^16.5.2",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-router-dom": "^5.0.0",
|
||||
"urbit-ob": "^5.0.0",
|
||||
"urbit-sigil-js": "^1.3.2"
|
||||
"@gitgraph/react": "^1.6.0",
|
||||
"file-system-access": "^1.0.4",
|
||||
"lodash": "^4.17.21",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"urbit-ob": "^5.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"natives": "1.1.3"
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.66",
|
||||
"@types/react-dom": "^18.2.22",
|
||||
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
||||
"@typescript-eslint/parser": "^7.2.0",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.6",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^5.2.0"
|
||||
}
|
||||
}
|
||||
|
292
pkg/interface/dbug/public/channel.js
Normal file
292
pkg/interface/dbug/public/channel.js
Normal file
@ -0,0 +1,292 @@
|
||||
class Channel {
|
||||
constructor() {
|
||||
this.init();
|
||||
this.deleteOnUnload();
|
||||
|
||||
// a way to handle channel errors
|
||||
//
|
||||
//
|
||||
this.onChannelError = (err) => {
|
||||
console.error('event source error: ', err);
|
||||
};
|
||||
this.onChannelOpen = (e) => {
|
||||
console.log('open', e);
|
||||
};
|
||||
}
|
||||
|
||||
init() {
|
||||
this.debounceInterval = 500;
|
||||
// unique identifier: current time and random number
|
||||
//
|
||||
this.uid =
|
||||
new Date().getTime().toString() +
|
||||
"-" +
|
||||
Math.random().toString(16).slice(-6);
|
||||
|
||||
this.requestId = 1;
|
||||
|
||||
// the currently connected EventSource
|
||||
//
|
||||
this.eventSource = null;
|
||||
|
||||
// the id of the last EventSource event we received
|
||||
//
|
||||
this.lastEventId = 0;
|
||||
|
||||
// this last event id acknowledgment sent to the server
|
||||
//
|
||||
this.lastAcknowledgedEventId = 0;
|
||||
|
||||
// a registry of requestId to successFunc/failureFunc
|
||||
//
|
||||
// These functions are registered during a +poke and are executed
|
||||
// in the onServerEvent()/onServerError() callbacks. Only one of
|
||||
// the functions will be called, and the outstanding poke will be
|
||||
// removed after calling the success or failure function.
|
||||
//
|
||||
|
||||
this.outstandingPokes = new Map();
|
||||
|
||||
// a registry of requestId to subscription functions.
|
||||
//
|
||||
// These functions are registered during a +subscribe and are
|
||||
// executed in the onServerEvent()/onServerError() callbacks. The
|
||||
// event function will be called whenever a new piece of data on this
|
||||
// subscription is available, which may be 0, 1, or many times. The
|
||||
// disconnect function may be called exactly once.
|
||||
//
|
||||
this.outstandingSubscriptions = new Map();
|
||||
|
||||
this.outstandingJSON = [];
|
||||
|
||||
this.debounceTimer = null;
|
||||
}
|
||||
|
||||
resetDebounceTimer() {
|
||||
if (this.debounceTimer) {
|
||||
clearTimeout(this.debounceTimer);
|
||||
this.debounceTimer = null;
|
||||
}
|
||||
this.debounceTimer = setTimeout(() => {
|
||||
this.sendJSONToChannel();
|
||||
}, this.debounceInterval)
|
||||
}
|
||||
|
||||
setOnChannelError(onError = (err) => {}) {
|
||||
this.onChannelError = onError;
|
||||
}
|
||||
|
||||
setOnChannelOpen(onOpen = (e) => {}) {
|
||||
this.onChannelOpen = onOpen;
|
||||
}
|
||||
|
||||
deleteOnUnload() {
|
||||
window.addEventListener("beforeunload", (event) => {
|
||||
this.delete();
|
||||
});
|
||||
}
|
||||
|
||||
clearQueue() {
|
||||
clearTimeout(this.debounceTimer);
|
||||
this.debounceTimer = null;
|
||||
this.sendJSONToChannel();
|
||||
}
|
||||
|
||||
// sends a poke to an app on an urbit ship
|
||||
//
|
||||
poke(ship, app, mark, json, successFunc, failureFunc) {
|
||||
let id = this.nextId();
|
||||
this.outstandingPokes.set(
|
||||
id,
|
||||
{
|
||||
success: successFunc,
|
||||
fail: failureFunc
|
||||
}
|
||||
);
|
||||
|
||||
const j = {
|
||||
id,
|
||||
action: "poke",
|
||||
ship,
|
||||
app,
|
||||
mark,
|
||||
json
|
||||
};
|
||||
|
||||
this.sendJSONToChannel(j);
|
||||
}
|
||||
|
||||
// subscribes to a path on an specific app and ship.
|
||||
//
|
||||
// Returns a subscription id, which is the same as the same internal id
|
||||
// passed to your Urbit.
|
||||
subscribe(
|
||||
ship,
|
||||
app,
|
||||
path,
|
||||
connectionErrFunc = () => {},
|
||||
eventFunc = () => {},
|
||||
quitFunc = () => {},
|
||||
subAckFunc = () => {},
|
||||
) {
|
||||
let id = this.nextId();
|
||||
this.outstandingSubscriptions.set(
|
||||
id,
|
||||
{
|
||||
err: connectionErrFunc,
|
||||
event: eventFunc,
|
||||
quit: quitFunc,
|
||||
subAck: subAckFunc
|
||||
}
|
||||
);
|
||||
|
||||
const json = {
|
||||
id,
|
||||
action: "subscribe",
|
||||
ship,
|
||||
app,
|
||||
path
|
||||
}
|
||||
|
||||
this.resetDebounceTimer();
|
||||
|
||||
this.outstandingJSON.push(json);
|
||||
return id;
|
||||
}
|
||||
|
||||
// quit the channel
|
||||
//
|
||||
delete() {
|
||||
let id = this.nextId();
|
||||
clearInterval(this.ackTimer);
|
||||
navigator.sendBeacon(this.channelURL(), JSON.stringify([{
|
||||
id,
|
||||
action: "delete"
|
||||
}]));
|
||||
if (this.eventSource) {
|
||||
this.eventSource.close();
|
||||
}
|
||||
}
|
||||
|
||||
// unsubscribe to a specific subscription
|
||||
//
|
||||
unsubscribe(subscription) {
|
||||
let id = this.nextId();
|
||||
this.sendJSONToChannel({
|
||||
id,
|
||||
action: "unsubscribe",
|
||||
subscription
|
||||
});
|
||||
}
|
||||
|
||||
// sends a JSON command command to the server.
|
||||
//
|
||||
sendJSONToChannel(j) {
|
||||
let req = new XMLHttpRequest();
|
||||
req.open("PUT", this.channelURL());
|
||||
req.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
if (this.lastEventId == this.lastAcknowledgedEventId) {
|
||||
if (j) {
|
||||
this.outstandingJSON.push(j);
|
||||
}
|
||||
|
||||
if (this.outstandingJSON.length > 0) {
|
||||
let x = JSON.stringify(this.outstandingJSON);
|
||||
req.send(x);
|
||||
}
|
||||
} else {
|
||||
// we add an acknowledgment to clear the server side queue
|
||||
//
|
||||
// The server side puts messages it sends us in a queue until we
|
||||
// acknowledge that we received it.
|
||||
//
|
||||
let payload = [
|
||||
...this.outstandingJSON,
|
||||
{action: "ack", "event-id": this.lastEventId}
|
||||
];
|
||||
if (j) {
|
||||
payload.push(j)
|
||||
}
|
||||
let x = JSON.stringify(payload);
|
||||
req.send(x);
|
||||
|
||||
this.lastAcknowledgedEventId = this.lastEventId;
|
||||
}
|
||||
this.outstandingJSON = [];
|
||||
|
||||
this.connectIfDisconnected();
|
||||
}
|
||||
|
||||
// connects to the EventSource if we are not currently connected
|
||||
//
|
||||
connectIfDisconnected() {
|
||||
if (this.eventSource) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.eventSource = new EventSource(this.channelURL(), {withCredentials:true});
|
||||
this.eventSource.onmessage = e => {
|
||||
this.lastEventId = parseInt(e.lastEventId, 10);
|
||||
|
||||
let obj = JSON.parse(e.data);
|
||||
let pokeFuncs = this.outstandingPokes.get(obj.id);
|
||||
let subFuncs = this.outstandingSubscriptions.get(obj.id);
|
||||
|
||||
if (obj.response == "poke" && !!pokeFuncs) {
|
||||
let funcs = pokeFuncs;
|
||||
if (obj.hasOwnProperty("ok")) {
|
||||
funcs["success"]();
|
||||
} else if (obj.hasOwnProperty("err")) {
|
||||
funcs["fail"](obj.err);
|
||||
} else {
|
||||
console.error("Invalid poke response: ", obj);
|
||||
}
|
||||
this.outstandingPokes.delete(obj.id);
|
||||
|
||||
} else if (obj.response == "subscribe" ||
|
||||
(obj.response == "poke" && !!subFuncs)) {
|
||||
let funcs = subFuncs;
|
||||
|
||||
if (obj.hasOwnProperty("err")) {
|
||||
funcs["err"](obj.err);
|
||||
this.outstandingSubscriptions.delete(obj.id);
|
||||
} else if (obj.hasOwnProperty("ok")) {
|
||||
funcs["subAck"](obj);
|
||||
}
|
||||
} else if (obj.response == "diff") {
|
||||
// ensure we ack before channel clogs
|
||||
if((this.lastEventId - this.lastAcknowledgedEventId) > 30) {
|
||||
this.clearQueue();
|
||||
}
|
||||
|
||||
let funcs = subFuncs;
|
||||
funcs["event"](obj.json);
|
||||
} else if (obj.response == "quit") {
|
||||
let funcs = subFuncs;
|
||||
funcs["quit"](obj);
|
||||
this.outstandingSubscriptions.delete(obj.id);
|
||||
} else {
|
||||
console.log("Unrecognized response: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
this.eventSource.onopen = this.onChannelOpen;
|
||||
|
||||
this.eventSource.onerror = e => {
|
||||
this.delete();
|
||||
this.init();
|
||||
this.onChannelError(e);
|
||||
}
|
||||
}
|
||||
|
||||
channelURL() {
|
||||
return "/~/channel/" + this.uid;
|
||||
}
|
||||
|
||||
nextId() {
|
||||
return this.requestId++;
|
||||
}
|
||||
}
|
||||
|
||||
window.channel = Channel;
|
@ -3,6 +3,7 @@ html, body {
|
||||
width: 100%;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
overflow: hidden;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
p, h1, h2, h3, h4, h5, h6, a, input, textarea, button {
|
||||
|
File diff suppressed because one or more lines are too long
73
pkg/interface/dbug/src/css/logs.css
Normal file
73
pkg/interface/dbug/src/css/logs.css
Normal file
@ -0,0 +1,73 @@
|
||||
#viewport {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
padding-top: 1em;
|
||||
border: 1px solid black;
|
||||
font-family: monospace;
|
||||
}
|
||||
#controls input {
|
||||
width: 100%;
|
||||
}
|
||||
.agent {
|
||||
position: relative;
|
||||
padding-left: 1em;
|
||||
width: calc(100% - 1em);
|
||||
border-top: 2px solid black;
|
||||
margin-top: 2em;
|
||||
}
|
||||
.cause {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 5em;
|
||||
border-top: 1px solid grey;
|
||||
}
|
||||
.legend {
|
||||
position: absolute;
|
||||
left: -1em;
|
||||
width: auto;
|
||||
height: auto;
|
||||
text-orientation: sideways;
|
||||
writing-mode: vertical-rl;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
.event {
|
||||
position: absolute;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
border-radius: 50%;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border: 1px dotted rgba(0,0,0,0);
|
||||
}
|
||||
.event.effects {
|
||||
border-style: solid;
|
||||
}
|
||||
.details {
|
||||
padding: 0.3em;
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0.75em;
|
||||
left: 0.75em;
|
||||
z-index: 2;
|
||||
min-width: 20em;
|
||||
display: none;
|
||||
overflow: visible;
|
||||
border: 1px solid black;
|
||||
background-color: white;
|
||||
}
|
||||
.event.right .details {
|
||||
left: initial;
|
||||
right: 0.75em;
|
||||
}
|
||||
.event:hover .details, .event.focus .details {
|
||||
display: block;
|
||||
}
|
||||
.event:hover, .event.focus {
|
||||
box-shadow: 0 0 10px 0 #f30;
|
||||
}
|
||||
.event details {
|
||||
padding-left: 1em;
|
||||
}
|
||||
.event details summary {
|
||||
position: relative;
|
||||
left: -1em;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
@import "css/indigo-static.css";
|
||||
@import "css/fonts.css";
|
||||
@import "css/custom.css";
|
||||
|
||||
@import "css/logs.css";
|
||||
|
@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { Root } from '/components/root';
|
||||
import { api } from '/api';
|
||||
import { store } from '/store';
|
||||
import { subscription } from "/subscription";
|
||||
|
||||
api.setAuthTokens({
|
||||
ship: window.ship
|
||||
});
|
||||
|
||||
window.urb = new window.channel();
|
||||
subscription.start();
|
||||
|
||||
ReactDOM.render((
|
||||
<Root />
|
||||
), document.querySelectorAll("#root")[0]);
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import _ from 'lodash';
|
||||
import { store } from '/store';
|
||||
import { store } from './store';
|
||||
import moment from 'moment';
|
||||
import { stringToTa } from './lib/util';
|
||||
|
||||
@ -72,6 +72,42 @@ class UrbitApi {
|
||||
);
|
||||
}
|
||||
|
||||
bindToVerbPlus(app) {
|
||||
return this.bind('/verb/events-plus', 'PUT', this.authTokens.ship, app,
|
||||
(result) => {
|
||||
result.data.app = app;
|
||||
store.handleEvent({ data: { local: { verbEventPlus: {
|
||||
gill: `~${this.authTokens.ship}/${app}`,
|
||||
log: result.data
|
||||
} } } });
|
||||
},
|
||||
() => {
|
||||
store.handleEvent({
|
||||
data: {
|
||||
local: {
|
||||
verbStatus: {
|
||||
app: app,
|
||||
msg: 'failed to establish verb+ connection to ' + app
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
() => {
|
||||
store.handleEvent({
|
||||
data: {
|
||||
local: {
|
||||
verbStatus: {
|
||||
app: app,
|
||||
msg: 'verb+ connection to ' + app + ' was dropped'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getJson(path, localTransform, onFail) {
|
||||
let source = '/~debug' + path + '.json';
|
||||
const query = window.location.href.split('?')[1];
|
||||
@ -201,6 +237,13 @@ class UrbitApi {
|
||||
);
|
||||
}
|
||||
|
||||
getCache() {
|
||||
this.getJson('/eyre/cache',
|
||||
this.wrapLocal('eyreCache'),
|
||||
this.showStatus('error fetching eyre cache')
|
||||
);
|
||||
}
|
||||
|
||||
getConnections() {
|
||||
this.getJson('/eyre/connections',
|
||||
this.wrapLocal('eyreConnections'),
|
||||
@ -222,6 +265,11 @@ class UrbitApi {
|
||||
);
|
||||
}
|
||||
|
||||
clearCache(url) {
|
||||
return this.action("dbug", "json", { 'clear-eyre-cache': { url: url } })
|
||||
.then(this.getCache.bind(this));
|
||||
}
|
||||
|
||||
// local
|
||||
|
||||
sidebarToggle() {
|
||||
|
@ -3,17 +3,18 @@ import { BrowserRouter, Switch, Route, Link } from "react-router-dom";
|
||||
import classnames from 'classnames';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { api } from '/api';
|
||||
import { subscription } from '/subscription';
|
||||
import { store } from '/store';
|
||||
import { Skeleton } from '/components/skeleton';
|
||||
import { MessageScreen } from '/components/message-screen';
|
||||
import { Apps } from '/views/apps';
|
||||
import { Spider } from '/views/spider';
|
||||
import { Ames } from '/views/ames';
|
||||
import { Behn } from '/views/behn';
|
||||
import { Clay } from '/views/clay';
|
||||
import { Eyre } from '/views/eyre';
|
||||
import { api } from '../api';
|
||||
import { subscription } from '../subscription';
|
||||
import { store } from '../store';
|
||||
import { Skeleton } from '../components/skeleton';
|
||||
import { MessageScreen } from '../components/message-screen';
|
||||
import { Apps } from '../views/apps';
|
||||
import { Logs } from '../views/logs';
|
||||
import { Spider } from '../views/spider';
|
||||
import { Ames } from '../views/ames';
|
||||
import { Behn } from '../views/behn';
|
||||
import { Clay } from '../views/clay';
|
||||
import { Eyre } from '../views/eyre';
|
||||
import { makeRoutePath } from '../lib/util';
|
||||
|
||||
export class Root extends Component {
|
||||
@ -54,6 +55,16 @@ export class Root extends Component {
|
||||
}}
|
||||
/>
|
||||
|
||||
<Route exact path={makeRoutePath('logs')}
|
||||
render={(props) => {
|
||||
return (
|
||||
<Skeleton status={state.status} selected="logs">
|
||||
<Logs logs={state.logs} {...props} />
|
||||
</Skeleton>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
<Route exact path={makeRoutePath('spider')}
|
||||
render={(props) => {
|
||||
return (
|
||||
@ -100,6 +111,7 @@ export class Root extends Component {
|
||||
<Skeleton status={state.status} selected="eyre">
|
||||
<Eyre
|
||||
bindings={state.bindings}
|
||||
cache={state.cache}
|
||||
connections={state.connections}
|
||||
authentication={state.authentication}
|
||||
channels={state.channels}
|
@ -43,7 +43,10 @@ export class SearchableList extends Component {
|
||||
return (<div style={{position: 'relative', border: '1px solid grey', padding: '4px'}}>
|
||||
{props.children}
|
||||
<div>{searchBar} ({items.length})</div>
|
||||
<details open={(props.open === undefined) ? true : props.open}>
|
||||
<summary>{items.length} items</summary>
|
||||
<div>{items.length === 0 ? 'none' : items}</div>
|
||||
</details>
|
||||
</div>);
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ export class Skeleton extends Component {
|
||||
|
||||
let items = [
|
||||
'apps',
|
||||
'logs',
|
||||
'spider',
|
||||
'ames',
|
||||
'behn',
|
@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import { SearchableList } from '../components/searchable-list';
|
||||
import { SearchableList } from './searchable-list';
|
||||
import { renderDuct } from '../lib/util';
|
||||
|
||||
export class Subscriptions extends Component {
|
||||
@ -65,4 +65,4 @@ export class Subscriptions extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default Links;
|
||||
export default Subscriptions;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user