Merge branch 'develop' into shadow-types

This commit is contained in:
Alex Shelkovnykov 2024-02-29 02:34:24 -05:00
commit de4cc1577a
82 changed files with 3480 additions and 1167 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:feaae0eece54db3e92122263706c283674af581d14ffde8a29fb24e1873a35b1
size 6453015
oid sha256:c2ab6607450382e0ec80c7264dad2c72d69672eaf861eb1c24cde5a76921c6a3
size 9972490

View File

@ -3,7 +3,7 @@
flake-utils.url = "github:numtide/flake-utils";
tools = {
flake = false;
url = "github:urbit/tools";
url = "github:urbit/tools/d454e2482c3d4820d37db6d5625a6d40db975864";
};
};

View File

@ -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

View File

@ -85,7 +85,7 @@
=^ cards state
?+ mark ~|([%aqua-bad-mark mark] !!)
%aqua-events (poke-aqua-events:ac !<((list aqua-event) vase))
%pill (poke-pill:ac !<(pill vase))
%pill (poke-pill:ac !<(pill vase))
%noun (poke-noun:ac !<(* vase))
%azimuth-action (poke-azimuth-action:ac !<(azimuth-action vase))
==
@ -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

View File

@ -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
::
@ -773,7 +793,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 +1058,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 +1088,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

View File

@ -31750,7 +31750,6 @@
global$2[key] = "esm";
}
}
//# sourceMappingURL=react-router.js.map
/**
* The public API for a <Router> that uses HTML5 history.
@ -32055,7 +32054,6 @@
style: propTypes.object
});
}
//# sourceMappingURL=react-router-dom.js.map
var classnames = createCommonjsModule(function (module) {
/*!
@ -49271,6 +49269,7 @@
this.clayCommits(data, state);
//
this.eyreBindings(data, state);
this.eyreCache(data, state);
this.eyreConnections(data, state);
this.eyreAuthentication(data, state);
this.eyreChannels(data, state);
@ -49404,6 +49403,13 @@
}
}
eyreCache(obj, state) {
const data = lodash.get(obj, 'eyreCache', false);
if (data) {
state.cache = data;
}
}
eyreConnections(obj, state) {
const data = lodash.get(obj, 'eyreConnections', false);
if (data) {
@ -49436,6 +49442,7 @@
timers: [],
commits: [],
bindings: [],
cache: [],
connections: [],
authentication: {
sessions: [],
@ -55399,6 +55406,13 @@
);
}
getCache() {
this.getJson('/eyre/cache',
this.wrapLocal('eyreCache'),
this.showStatus('error fetching eyre cache')
);
}
getConnections() {
this.getJson('/eyre/connections',
this.wrapLocal('eyreConnections'),
@ -55420,6 +55434,11 @@
);
}
clearCache(url) {
return this.action("dbug", "json", { 'clear-eyre-cache': { url: url } })
.then(this.getCache.bind(this));
}
// local
sidebarToggle() {
@ -55468,7 +55487,7 @@
let subscription = new Subscription();
const _jsxFileName = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/skeleton.js";
const _jsxFileName = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/skeleton.js";
class SidebarItem extends react_1 {
render() {
const { props } = this;
@ -55544,7 +55563,7 @@
}
}
const _jsxFileName$1 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/message-screen.js";
const _jsxFileName$1 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/message-screen.js";
class MessageScreen extends react_1 {
render() {
return (
@ -64082,7 +64101,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
ob
);
const _jsxFileName$2 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/searchable-list.js";
const _jsxFileName$2 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/searchable-list.js";
class SearchableList extends react_1 {
// expected props:
// items: [{key: 'some key', jsx: <w/e>}, ...]
@ -64126,12 +64145,15 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
return (react.createElement('div', { style: {position: 'relative', border: '1px solid grey', padding: '4px'}, __self: this, __source: {fileName: _jsxFileName$2, lineNumber: 43}}
, props.children
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 45}}, searchBar, " (" , items.length, ")")
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 46}}, items.length === 0 ? 'none' : items)
, react.createElement('details', { open: (props.open === undefined) ? true : props.open, __self: this, __source: {fileName: _jsxFileName$2, lineNumber: 46}}
, react.createElement('summary', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 47}}, items.length, " items" )
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$2, lineNumber: 48}}, items.length === 0 ? 'none' : items)
)
));
}
}
const _jsxFileName$3 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/subscriptions.js";
const _jsxFileName$3 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/subscriptions.js";
class Subscriptions extends react_1 {
constructor(props) {
super(props);
@ -64195,7 +64217,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$4 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/summary.js";
const _jsxFileName$4 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/summary.js";
class Summary extends react_1 {
// expected props:
// id: 'id'
@ -64231,7 +64253,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$5 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/apps.js";
const _jsxFileName$5 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/apps.js";
class Apps extends react_1 {
constructor(props) {
@ -64351,7 +64373,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$6 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/spider.js";
const _jsxFileName$6 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/spider.js";
class Spider extends react_1 {
constructor(props) {
@ -64406,7 +64428,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$7 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/ames.js";
const _jsxFileName$7 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/ames.js";
class Ames extends react_1 {
constructor(props) {
@ -64833,7 +64855,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$8 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/behn.js";
const _jsxFileName$8 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/behn.js";
class Behn extends react_1 {
constructor(props) {
@ -64896,7 +64918,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
Orientation["Horizontal"] = "horizontal";
Orientation["HorizontalReverse"] = "horizontal-reverse";
})(Orientation = exports.Orientation || (exports.Orientation = {}));
//# sourceMappingURL=orientation.js.map
});
unwrapExports(orientation);
@ -65048,7 +65070,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
return Math.atan2(alphaY, alphaX);
}
//# sourceMappingURL=utils.js.map
});
unwrapExports(utils);
@ -65235,7 +65257,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
return template;
}
exports.getTemplate = getTemplate;
//# sourceMappingURL=template.js.map
});
unwrapExports(template);
@ -65274,7 +65296,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.Tag = Tag;
//# sourceMappingURL=tag.js.map
});
unwrapExports(tag);
@ -65428,7 +65450,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.Commit = Commit;
//# sourceMappingURL=commit.js.map
});
unwrapExports(commit);
@ -65580,7 +65602,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
function isBranchMergeOptions(options) {
return typeof options === "object" && !(options instanceof BranchUserApi);
}
//# sourceMappingURL=branch-user-api.js.map
});
unwrapExports(branchUserApi);
@ -65624,7 +65646,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
});
}
exports.createDeletedBranch = createDeletedBranch;
//# sourceMappingURL=branch.js.map
});
unwrapExports(branch);
@ -65639,7 +65661,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
Mode["Compact"] = "compact";
})(Mode || (Mode = {}));
exports.Mode = Mode;
//# sourceMappingURL=mode.js.map
});
unwrapExports(mode);
@ -65685,7 +65707,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
array.forEach((value) => set.add(value));
return Array.from(set);
}
//# sourceMappingURL=regular.js.map
});
unwrapExports(regular);
@ -65717,7 +65739,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.CompactGraphRows = CompactGraphRows;
//# sourceMappingURL=compact.js.map
});
unwrapExports(compact);
@ -65735,7 +65757,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
: new regular.RegularGraphRows(commits);
}
exports.createGraphRows = createGraphRows;
//# sourceMappingURL=index.js.map
});
unwrapExports(graphRows);
@ -65771,7 +65793,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.BranchesOrder = BranchesOrder;
//# sourceMappingURL=branches-order.js.map
});
unwrapExports(branchesOrder);
@ -65850,7 +65872,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.Refs = Refs;
//# sourceMappingURL=refs.js.map
});
unwrapExports(refs);
@ -66081,7 +66103,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
.join(" ");
}
exports.toSvgPath = toSvgPath;
//# sourceMappingURL=branches-paths.js.map
});
unwrapExports(branchesPaths);
@ -66259,7 +66281,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.GitgraphUserApi = GitgraphUserApi;
//# sourceMappingURL=gitgraph-user-api.js.map
});
unwrapExports(gitgraphUserApi);
@ -66531,7 +66553,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
exports.GitgraphCore = GitgraphCore;
//# sourceMappingURL=gitgraph.js.map
});
unwrapExports(gitgraph);
@ -66565,7 +66587,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
exports.toSvgPath = branchesPaths.toSvgPath;
exports.arrowSvgPath = utils.arrowSvgPath;
//# sourceMappingURL=index.js.map
});
unwrapExports(lib);
@ -66621,7 +66643,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
BranchLabel.paddingY = 5;
return BranchLabel;
}(react_1));
//# sourceMappingURL=BranchLabel.js.map
var __extends$1 = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
@ -66675,7 +66696,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
Tooltip.padding = 10;
return Tooltip;
}(react_1));
//# sourceMappingURL=Tooltip.js.map
var Dot = function (_a) {
var commit = _a.commit, onMouseOver = _a.onMouseOver, onMouseOut = _a.onMouseOut;
@ -66709,7 +66729,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
react_3("use", { xlinkHref: "#" + commit.hash, clipPath: "url(#clip-" + commit.hash + ")", stroke: commit.style.dot.strokeColor, strokeWidth: commit.style.dot.strokeWidth && commit.style.dot.strokeWidth * 2 }),
commit.dotText && (react_3("text", { alignmentBaseline: "central", textAnchor: "middle", x: commit.style.dot.size, y: commit.style.dot.size, style: { font: commit.style.dot.font } }, commit.dotText)))));
};
//# sourceMappingURL=Dot.js.map
var TAG_PADDING_X = 10;
var TAG_PADDING_Y = 5;
@ -66743,7 +66762,6 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
react_3("path", { d: path, fill: tag.style.bgColor, stroke: tag.style.strokeColor }),
react_3("text", { ref: $text, fill: tag.style.color, style: { font: tag.style.font }, alignmentBaseline: "middle", dominantBaseline: "middle", x: offset + TAG_PADDING_X, y: 0 }, tag.name)));
}
//# sourceMappingURL=Tag.js.map
var __extends$2 = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
@ -67064,9 +67082,8 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
var transform = target.getAttribute("transform") || "translate(0, 0)";
target.setAttribute("transform", transform.replace(/translate\(([\d\.]+),/, "translate(" + x + ","));
}
//# sourceMappingURL=Gitgraph.js.map
const _jsxFileName$9 = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/clay.js";
const _jsxFileName$9 = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/clay.js";
class Clay extends react_1 {
constructor(props) {
super(props);
@ -67206,7 +67223,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$a = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/views/eyre.js";
const _jsxFileName$a = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/views/eyre.js";
class Eyre extends react_1 {
constructor(props) {
@ -67214,6 +67231,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
this.state = {};
this.loadBindings = this.loadBindings.bind(this);
this.loadCache = this.loadCache.bind(this);
this.loadConnections = this.loadConnections.bind(this);
this.loadAuthenticationState = this.loadAuthenticationState.bind(this);
this.loadChannels = this.loadChannels.bind(this);
@ -67222,6 +67240,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
componentDidMount() {
const { props } = this;
if (props.bindings.length === 0) this.loadBindings();
if (props.cache.length === 0) this.loadCache();
if (props.connections.length == 0) this.loadConnections();
if (props.authentication.sessions.length == 0) this.loadAuthenticationState();
if (props.channels.length == 0) this.loadChannels();
@ -67235,6 +67254,14 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
api.getBindings();
}
loadCache() {
api.getCache();
}
clearCache(url) {
api.clearCache(url);
}
loadConnections() {
api.getConnections();
}
@ -67252,41 +67279,71 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
const { props, state } = this;
const bindingItems = props.bindings.map(binding => {
return {key: binding.location + ' ' + binding.action, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 54}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 55}}
return {key: binding.location + ' ' + binding.action, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 64}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 65}}
, binding.location
)
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 58}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '50%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 68}}
, binding.action
)
))};
});
const cacheItems = props.cache.map(entry => {
return {key: entry.url + ' ' + (entry.val ? 'LIVE' : 'CLEARED'), jsx: (react.createElement('div', { class: "flex", style: { marginBottom: '3px' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 75}}
, react.createElement('div', { style: { width: '45%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 76}}
, entry.url
)
, react.createElement('div', { style: { width: '5%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 79}}, "(v"
, entry.aeon, ")"
)
, !entry.val ? 'cleared' :
react.createElement('div', { style: { width: '50%', position: 'relative' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 83}}
, react.createElement('div', { style: { display: 'inline-block', width: '10%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 84}}
, entry.val.auth ? 'auth' : 'free'
)
, react.createElement('div', { style: { display: 'inline-block', width: '10%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 87}}
, entry.val.payload.status
)
, react.createElement('div', { style: { display: 'inline-block', width: '50%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 90}}
, entry.val.payload.headers.reduce((o, h) => (o ? o+'; ': '') + h.key + '=' + h.value, '')
)
, react.createElement('div', { style: { display: 'inline-block', width: '25%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 93}}
, entry.val.payload.data ? entry.val.payload.data.toLocaleString('de-DE')+' bytes' : 'no data'
)
, react.createElement('div', { style: { display: 'inline-block', width: '5%' }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 96}}
, react.createElement('button', { onClick: () => { this.clearCache(entry.url); }, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 97}}, "clear")
)
)
))};
});
const connectionItems = props.connections.map(c => {
return {key: c.duct + ' ' + c.action, jsx: (
react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 66}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 66}}
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 67}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 68}}, "duct")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 69}}, c.duct)
react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}}
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 107}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 108}}, "duct")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 109}}, c.duct)
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 71}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 72}}, "binding")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 73}}, c.action)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 111}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 112}}, "binding")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 113}}, c.action)
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 75}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 76}}, "request")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 77}}, "from "
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 115}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 116}}, "request")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 117}}, "from "
, c.request.source, ","
, c.request.authenticated ? ' ' : ' un', "authenticated and"
, c.request.secure ? ' ' : ' in', "secure"
)
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 83}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 84}}, "response")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 85}}, "sent "
, c.response.sent, " bytes." , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 86}})
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 123}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 124}}, "response")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 125}}, "sent "
, c.response.sent, " bytes." , react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 126}})
, !c.response.header ? null : react.createElement(react.Fragment, null, "status "
, c.response.header['status-code'], react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 88}})
, c.response.header['status-code'], react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 128}})
, c.response.header.headers.reduce((a, b) => a + b + ', ', '')
)
)
@ -67298,49 +67355,49 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
const channelItems = props.channels.map(c => {
const summary = (react.createElement(react.Fragment, null
, c.session
, react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 100}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 100}}
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 101}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 102}}, "identity")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 103}}, c['identity'])
, react.createElement('table', { style: {borderBottom: '1px solid black'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 140}}, react.createElement('tbody', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 140}}
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 141}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 142}}, "identity")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 143}}, c['identity'])
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 105}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 106}}, "connected?")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 107}}, c.connected
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 145}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 146}}, "connected?")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 147}}, c.connected
? 'connected'
: 'disconnected, expires ' + msToDa(c.expiry)
)
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 112}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 113}}, "next-id")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 114}}, c['next-id'])
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 152}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 153}}, "next-id")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 154}}, c['next-id'])
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 116}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 117}}, "last-ack")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 118}}, msToDa(c['last-ack']))
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 156}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 157}}, "last-ack")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 158}}, msToDa(c['last-ack']))
)
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 120}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 121}}, "unacked")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 122}}, c.unacked.reduce((a, b) => a + b + ', ', ''))
, react.createElement('tr', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 160}}
, react.createElement('td', { class: "inter", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 161}}, "unacked")
, react.createElement('td', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 162}}, c.unacked.reduce((a, b) => a + b + ', ', ''))
)
))
));
const subscriptionItems = c.subscriptions.map(s => {
//NOTE jsx sorta copied from /components/subscriptions
return {key: `${s.id} ${s.ship} ${s.app} ${s.path}`, jsx: (
react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 129}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 130}}
react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 169}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 170}}
, s.id
)
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 133}}, "~"
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 173}}, "~"
, s.ship
)
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '20%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 136}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '20%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 176}}
, s.app
)
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '35%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 139}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '35%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 179}}
, s.path
)
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 142}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '15%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 182}}
, s.unacked
)
)
@ -67350,51 +67407,51 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
react.createElement(Summary, { summary: summary, details: (
react.createElement(SearchableList, {
placeholder: "id, ship, app, path" ,
items: subscriptionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 150}}
items: subscriptionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 190}}
)
), __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 149}} )
), __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 189}} )
)};
});
//TODO also make sure column headings get rendered
const sessionItems = props.authentication.sessions.map(s => {
return ({key: s.identity, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 160}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '5em'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 161}}
return ({key: s.identity, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 200}}
, react.createElement('div', { class: "flex-auto", style: {maxWidth: '5em'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 201}}
, s.cookie.slice(0,6), "…"
)
, react.createElement('div', { class: "flex-auto", style: {width: '40%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 164}}, "~"
, react.createElement('div', { class: "flex-auto", style: {width: '40%'}, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 204}}, "~"
, s.identity
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 167}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 207}}
, msToDa(s.expiry)
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 170}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 210}}
, s.channels, " channel(s)"
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 173}}
, react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 174}}
, react.createElement('input', { type: "hidden", name: "sid", value: s.cookie, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 175}} )
, react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 176}}, "kick")
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 213}}
, react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 214}}
, react.createElement('input', { type: "hidden", name: "sid", value: s.cookie, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 215}} )
, react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 216}}, "kick")
)
)
))});
});
const visitingItems = props.authentication.visiting.map(v => {
return ({key: '~'+v.who+':'+v.nonce, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 183}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 184}}, "~"
return ({key: '~'+v.who+':'+v.nonce, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 223}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 224}}, "~"
, v.who
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 187}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 227}}
, v.nonce
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 190}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 230}}
, v.goal ? 'pending, will return to '+v.goal :
react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 192}}, "logged in since "
react.createElement('form', { method: "post", action: "/~/logout?redirect=/~debug/eyre", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 232}}, "logged in since "
, msToDa(v.made)
, react.createElement('input', { type: "hidden", name: "host", value: '~'+v.who, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 194}} )
, react.createElement('input', { type: "hidden", name: "sid", value: v.nonce, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 195}} )
, react.createElement('button', { type: "submit", name: "eauth", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 196}}, "log out" )
, react.createElement('input', { type: "hidden", name: "host", value: '~'+v.who, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 234}} )
, react.createElement('input', { type: "hidden", name: "sid", value: v.nonce, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 235}} )
, react.createElement('button', { type: "submit", name: "eauth", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 236}}, "log out" )
)
)
@ -67402,25 +67459,25 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
});
const visitorsItems = props.authentication.visitors.map(v => {
return ({key: v.nonce+':~'+v.ship, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 204}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 205}}
return ({key: v.nonce+':~'+v.ship, jsx: (react.createElement('div', { class: "flex", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 244}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 245}}
, v.nonce
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 208}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 248}}
, v.duct
)
, v.sesh ? react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 211}}, "session: " , v.sesh.slice(0,6), "…") :
, v.sesh ? react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 251}}, "session: " , v.sesh.slice(0,6), "…") :
react.createElement(react.Fragment, null
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 213}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 253}}
, v.pend ? 'request pending' : 'no pending request'
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 216}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 256}}
, v.ship
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 219}}, "redirect: "
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 259}}, "redirect: "
, v.last
)
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 222}}
, react.createElement('div', { class: "flex-auto", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 262}}
, v.toke ? 'token received' : 'no token yet'
)
)
@ -67428,44 +67485,52 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
});
return (react.createElement(react.Fragment, null
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 230}}, "Bindings")
, react.createElement(SearchableList, { placeholder: "binding", items: bindingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 231}}
, react.createElement('button', { onClick: this.loadBindings, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 232}}, "refresh")
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 270}}, "Bindings")
, react.createElement(SearchableList, { placeholder: "binding", items: bindingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 271}}
, react.createElement('button', { onClick: this.loadBindings, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 272}}, "refresh")
)
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 235}}, "Connections")
, react.createElement(SearchableList, { placeholder: "duct, binding" , items: connectionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 236}}
, react.createElement('button', { onClick: this.loadConnections, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 237}}, "refresh")
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 275}}, "Cache")
, props.cache.reduce((sum, entry) => {
return sum + (entry.val && entry.val.payload.data || 0);
}, 0).toLocaleString('de-DE'), " bytes in cache"
, react.createElement(SearchableList, { placeholder: "cache url, LIVE vs CLEARED" , items: cacheItems, open: false, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 279}}
, react.createElement('button', { onClick: this.loadCache, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 280}}, "refresh")
)
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 240}}, "Channels")
, react.createElement(SearchableList, { placeholder: "session id" , items: channelItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 241}}
, react.createElement('button', { onClick: this.loadChannels, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 242}}, "refresh")
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 283}}, "Connections")
, react.createElement(SearchableList, { placeholder: "duct, binding" , items: connectionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 284}}
, react.createElement('button', { onClick: this.loadConnections, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 285}}, "refresh")
)
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 245}}, "Authentication")
, react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 246}}
, react.createElement('button', { type: "submit", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 247}}, "logout self" )
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 288}}, "Channels")
, react.createElement(SearchableList, { placeholder: "session id" , items: channelItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 289}}
, react.createElement('button', { onClick: this.loadChannels, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 290}}, "refresh")
)
, react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 249}}
, react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 250}}, "logout all selves" )
, react.createElement('h4', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 293}}, "Authentication")
, react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 294}}
, react.createElement('button', { type: "submit", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 295}}, "logout self" )
)
, react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 252}})
, react.createElement('button', { onClick: this.loadAuthenticationState, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 253}}, "refresh")
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 254}}, "Sessions")
, react.createElement(SearchableList, { placeholder: "identity", items: sessionItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 255}}
, react.createElement('form', { method: "post", action: "/~/logout", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 297}}
, react.createElement('button', { type: "submit", name: "all", __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 298}}, "logout all selves" )
)
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 257}}, "Outgoing eauth" )
, react.createElement(SearchableList, { placeholder: "host", items: visitingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 258}}
, react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 300}})
, react.createElement('button', { onClick: this.loadAuthenticationState, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 301}}, "refresh")
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 302}}, "Sessions")
, react.createElement(SearchableList, { placeholder: "identity", items: sessionItems, open: false, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 303}}
)
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 260}}, "Incoming eauth" )
, react.createElement(SearchableList, { placeholder: "visitor", items: visitorsItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 261}}
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 305}}, "Outgoing eauth" )
, react.createElement(SearchableList, { placeholder: "host", items: visitingItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 306}}
)
, react.createElement('h3', {__self: this, __source: {fileName: _jsxFileName$a, lineNumber: 308}}, "Incoming eauth" )
, react.createElement(SearchableList, { placeholder: "visitor", items: visitorsItems, __self: this, __source: {fileName: _jsxFileName$a, lineNumber: 309}}
)
));
}
}
const _jsxFileName$b = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/js/components/root.js";
const _jsxFileName$b = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/js/components/root.js";
class Root extends react_1 {
constructor(props) {
super(props);
@ -67550,6 +67615,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
react.createElement(Skeleton, { status: state.status, selected: "eyre", __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 100}}
, react.createElement(Eyre, {
bindings: state.bindings,
cache: state.cache,
connections: state.connections,
authentication: state.authentication,
channels: state.channels,
@ -67565,7 +67631,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
}
}
const _jsxFileName$c = "/Users/jose/urbit/urbit/pkg/interface/dbug/src/index.js";
const _jsxFileName$c = "/Users/plfn/repos/urbit/urbit/pkg/interface/dbug/src/index.js";
api$1.setAuthTokens({
ship: window.ship
});

View File

@ -807,7 +807,7 @@
::
++ dy-run-generator
!.
|= [cay=cage cig=dojo-config]
|= [cay=cage cig=dojo-config =desk]
^+ +>+>
?. (~(nest ut [%cell [%atom %$ ~] %noun]) | p.q.cay)
:: naked generator; takes one argument
@ -850,7 +850,7 @@
|. ^- vase
=/ gat=vase (slot 3 q.cay)
=/ som=vase (slot 6 gat)
=/ ven=vase !>([now=now.hid eny=eny.hid bec=he-beak])
=/ ven=vase !>([now=now.hid eny=eny.hid bec=he-beak(q.dir desk)])
=/ poz=vase (dy-sore p.cig)
=/ kev=vase
=/ kuv=(unit vase) (slew 7 som)
@ -990,7 +990,7 @@
%te (dy-wool-poke p.bil q.bil)
%ex (dy-mere p.bil)
%dv (dy-sing hand+q.bil %a p.bil (snoc q.bil %hoon))
%ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil)
%ge (dy-run-generator (dy-cage p.p.p.bil) q.p.bil desk.q.p.p.bil)
%sa
=/ has-mark .?((get-fit:clay he-beak %mar p.bil))
?. has-mark

View File

@ -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

View File

@ -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

View File

@ -36,21 +36,23 @@
[%http until=@da]
[%waiting until=@da]
==
+$ state-1
$: %1
+$ state-2
$: %2
ships=(set ship)
nonce=@ud
$= plan
$~ [%nat ~]
$% [%nat ~]
[%pub ip=(unit @t)]
[%off ~]
[%one ~]
==
==
--
::
%- agent:dbug
::
=| state=state-1
=| state=state-2
=> |%
:: Bind for the the writer monad on (quip effect state)
::
@ -73,6 +75,7 @@
:: and sponsorship changes
::
++ ships
=| force=_|
|%
++ rind (^rind card state)
++ kick
@ -88,8 +91,8 @@
:: 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)
=/ 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]
@ -102,7 +105,7 @@
::
:: Kick even if ships weren't added or removed
::
(kick-pings our now new-ships)
(kick-pings our now new-ships force)
::
:: Kick whenever we get a response. We really care about
:: breaches and sponsorship changes.
@ -115,24 +118,28 @@
^- (quip card _state)
[[%pass /jael/delay %arvo %b %wait now]~ state]
::
++ take-delay kick
++ take-delay %*(kick ships force %.y)
--
::
:: Starts pinging a new set of `ships`.
::
++ kick-pings
|= [our=@p now=@da ships=(set ship)]
|= [our=@p now=@da ships=(set ship) force=?]
^- (quip card _state)
=: nonce.state +(nonce.state)
ships.state ships
==
::
?: ?=(%nat -.plan.state)
(kick:nat our)
(kick:pub our now)
?: force (kick:nat our)
?- -.plan.state
%off `state
%nat (kick:nat our)
%one (kick:one our)
%pub (kick:pub our now)
==
::
:: Subsystem for pinging our sponsors when we might be behind a NAT
::
:: XX no longer true if using STUN-enabled vere 2.XX
:: 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
@ -270,6 +277,26 @@
::
(set-timer now)
--
:: Subsystem for formally acknowledging a change in our IP:PORT
::
:: If our sponsor sends a STUN response, with an IP different than what
:: we had previously cached, we formally acknowledge this change by
:: sending one %poke to every ship in the sponsorship chain.
::
++ one
?> ?=(%one -.plan.state)
|%
++ kick
|= our=@p
^- (quip card _state)
:_ state
%- ~(rep in ships.state)
|= [=ship cards=(list card)]
?: =(our ship) cards
=/ wire /one/(scot %uw nonce.state)/ping/(scot %p ship)
:_ cards ^- card
[%pass wire %agent [ship %ping] %poke %noun !>(~)]
--
--
%+ verb |
^- agent:gall
@ -291,18 +318,33 @@
|^
=/ old !<(state-any old-vase)
=? old ?=(%0 -.old) (state-0-to-1 old)
?> ?=(%1 -.old)
=? old ?=(%1 -.old) (state-1-to-2 old)
?> ?=(%2 -.old)
=. state old
=^ cards state (kick:ships our.bowl now.bowl)
[cards this]
::
+$ state-any $%(state-0 state-1)
+$ state-0 [%0 ships=(map ship [=rift =ship-state])]
+$ state-any $%(state-0 state-1 state-2)
+$ 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-0-to-1
|= old=state-0
^- state-1
[%1 ~ 0 %nat ~]
::
++ state-1-to-2
|= old=state-1
^- state-2
old(- %2)
--
:: +on-poke: positively acknowledge pokes
::
@ -312,7 +354,37 @@
`this
::
=^ cards state
?: =(q.vase %kick) :: NB: ames calls this on %born
?: ?=([%kick ?] q.vase)
:: NB: ames calls this on %born (with fail=%.n) and after not hearing STUN
:: responses for more than ~s5 (with fail=%.y)
::
:: if %ping was turned off (due to a successfull STUN) but we failed
:: to get a STUN response in time switch to %nat and start a ~s25 timer
::
:: if the %kick has fail=%.n (e.g. for every %born), the plan will remain
:: unchanged, but we will innitiate a new round of %poke pings with
:: increasing nonce.
::
:: if we get repeated [%stun fail=&], but we are already in either %nat
:: or %pub, do nothing, since there are already timers in place to %ping
:: repeatedly.
::
=/ stun-failed=? &(?=([%off ~] plan.state) =(+.q.vase %.y))
?: &(?=([%off ~] plan.state) =(+.q.vase %.n))
:: ignore restarts if we were already STUNning, if ip:port changed
:: %once will trigger one formal %ping
::
`state
=? plan.state stun-failed
[%nat ~]
?: &(!stun-failed =(+.q.vase %.y))
`state
(kick:ships our.bowl now.bowl)
?: =(q.vase %stop) :: NB: ames calls this on [%stun fail=%.n]
=. plan.state [%off ~]
(kick:ships our.bowl now.bowl)
?: &(=(q.vase %once) =(%off -.plan.state)) :: NB: ames calls this on %once
=. plan.state [%one ~]
(kick:ships our.bowl now.bowl)
?: =(q.vase %nat)
=. plan.state [%nat ~]
@ -345,6 +417,12 @@
?. ?=(%pub -.plan.state) `state
?. ?=(%poke-ack -.sign) `state
(take-pings:pub wire p.sign)
::
[%one *]
?. ?=(%one -.plan.state) `state
?: ?=(%poke-ack -.sign) `state
:: XX handle error?
`state
==
[cards this]
:: +on-arvo: handle timer firing

View File

@ -491,7 +491,8 @@
%+ 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)
:: wire ship path
scrying.s :: (~(put ju scrying.s) tid [&2 +>+>+>]:card)
s
:_ cards
^- ^card

View File

@ -2,7 +2,7 @@
!:
|%
+$ card card:agent:gall
+$ test ?(%agents %marks %generators)
+$ test ?(%agents %marks %generators %threads)
+$ state
$: app=(set path)
app-ok=?
@ -10,6 +10,8 @@
mar-ok=?
gen=(set path)
gen-ok=?
ted=(set path)
ted-ok=?
==
--
=, format
@ -29,9 +31,10 @@
|^
=+ !<(=test vase)
?- test
%marks test-marks
%agents test-agents
%marks test-marks
%agents test-agents
%generators test-generators
%threads test-threads
==
::
++ test-marks
@ -100,6 +103,25 @@
gen.state (~(put in gen.state) i.paz)
==
::
++ 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 q.byk.bowl ~ %sing %a da+now.bowl i.paz]
%_ $
paz t.paz
fex [sing fex]
ted.state (~(put in ted.state) i.paz)
==
++ now-beak %_(byk.bowl r [%da now.bowl])
--
++ on-watch on-watch:def
@ -150,6 +172,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
--

View 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]

View File

@ -0,0 +1,6 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[auto=? ~]
~
==
kiln-global-automerge+auto

View File

@ -0,0 +1,6 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[old=dock new=dock ~]
~
==
kiln-jump-opt+[old new &]

View 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)

View File

@ -0,0 +1,6 @@
:- %say
|= $: [now=@da eny=@uvJ bec=beak]
[old=dock new=dock ~]
~
==
kiln-jump-opt+[old new |]

View 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
View 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
View 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>}"

View File

@ -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)
==

View File

@ -77,6 +77,7 @@
:: +hunt: door used for refining the type while searching for doccords
::
++ hunt
=| gil=(set type)
|_ [topics=(lest term) sut=type]
+* this .
::
@ -255,7 +256,8 @@
^- (unit item)
?> ?=([%face *] sut)
:: TODO: handle tune case
?> ?=(term p.sut)
?. ?=(term p.sut)
return-item:this(sut q.sut)
=* compiled-against return-item:this(sut q.sut)
`[%face (trip p.sut) *what compiled-against]
::
@ -318,7 +320,14 @@
[%face *] return-face
[%fork *] return-fork
[%hint *] return-hint
[%hold *] return-item:this(sut (~(play ut p.sut) q.sut))
[%hold *]
?: (~(has in gil) sut)
~
=< return-item
%= this
gil (~(put in gil) sut)
sut (~(play ut p.sut) q.sut)
==
==
::
++ return-hint-core

View File

@ -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)
--
--

View File

@ -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 %syncs ~] ``noun+!>(zyn)
[%x %kiln %sources ~] ``noun+!>(sources)
[%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
%main
?> ?=(%mere +<.sign-arvo)
=< tada
?: ?=(%| -.p.sign-arvo)
=+ "kiln: merge into {here} failed, waiting for next revision"
%- (slog leaf/- p.p.sign-arvo)

View File

@ -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]

View File

@ -0,0 +1 @@
../../../base-dev/mar/kiln/approve-merge.hoon

View File

@ -0,0 +1 @@
../../../base-dev/mar/kiln/jump-ask.hoon

View File

@ -0,0 +1 @@
../../../base-dev/mar/kiln/jump-opt.hoon

1
pkg/arvo/mar/kiln/jump.hoon Symbolic link
View File

@ -0,0 +1 @@
../../../base-dev/mar/kiln/jump.hoon

View File

@ -0,0 +1 @@
../../../base-dev/mar/kiln/sync-update.hoon

View File

@ -1 +1 @@
[%zuse 412]
[%zuse 411]

View File

@ -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)
==

View File

@ -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
@ -3254,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
@ -7148,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]
@ -7220,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
@ -7257,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))
==
==
==
@ -7269,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
@ -8306,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]))
@ -8783,7 +8794,7 @@
++ fish
|= =axis
^- nock
?@ skin [%1 &]
?@ skin $(skin spec+[[%like [skin]~ ~] [%base %noun]])
?- -.skin
::
%base
@ -8813,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)
@ -8824,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
@ -8856,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
@ -8869,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
@ -8879,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
@ -8901,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
@ -8912,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
@ -8927,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
@ -8959,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
@ -8997,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
==
--
@ -9242,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)
--
::
@ -9476,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]
@ -9694,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))
@ -9975,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)
@ -10177,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)
@ -13111,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

View File

@ -772,6 +772,7 @@
:: %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
::
@ -803,10 +804,13 @@
[%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)
@ -828,6 +832,7 @@
:: %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,6 +841,7 @@
:: System and Lifecycle Gifts
::
:: %turf: domain report, relayed from jael
:: %saxo: our sponsor list report
::
+$ gift
$% [%boon payload=*]
@ -843,10 +849,14 @@
[%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)
@ -904,6 +914,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 +929,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 +957,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
@ -993,7 +1020,9 @@
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
@ -1033,6 +1062,7 @@
closing=(set bone)
corked=(set bone)
keens=(map path keen-state)
=chain
==
+$ keen-state
$+ keen-state
@ -1157,7 +1187,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
@ -2728,17 +2758,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,10 +2791,30 @@
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])
+$ 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)
== ==
::
+$ bowl :: standard app state
$+ gall-agent-bowl ::
$: $: our=ship :: host
@ -2764,9 +2824,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
@ -2794,6 +2852,7 @@
:: TODO: add more flags?
::
+$ verb ?(%odd)
+$ coop spur
::
:: +agent: app core
::
@ -2813,6 +2872,12 @@
[%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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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]
==
::
@ -5934,6 +5940,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)

View File

@ -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

View File

@ -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 ?.(authenticated ~ [~ ~]) /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
@ -1261,9 +1308,15 @@
::
=? endpoint.auth.state ?=(^ host)
%- (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 +1551,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 +1762,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 +2752,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 +2788,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
@ -2915,6 +2968,7 @@
=* session-id session-id.u.connection-state
=* sessions sessions.auth.state
=* inbound inbound-request.u.connection-state
=* headers headers.response-header.http-event
::
?. (~(has by sessions) session-id)
:: if the session has expired since the request was opened,
@ -2925,9 +2979,14 @@
|= =session
session(expiry-time (add now session-timeout))
=- response-header.http-event(headers -)
%^ set-header:http 'set-cookie'
(session-cookie-string session-id &)
headers.response-header.http-event
=/ cookie=(pair @t @t)
['set-cookie' (session-cookie-string session-id &)]
|-
?~ headers
[cookie ~]
?: &(=(key.i.headers p.cookie) =(value.i.headers q.cookie))
headers
[i.headers $(headers t.headers)]
::
=* connection u.connection-state
::
@ -3033,6 +3092,7 @@
::
?: ?| ?=([%'~' *] path.binding) :: eyre
?=([%'~_~' *] path.binding) :: runtime
?=([%'_~_' *] path.binding) :: scries
==
[| bindings.state]
[& (insert-binding [binding duct action] bindings.state)]
@ -3188,6 +3248,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])]
@ -3233,6 +3299,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 =~
::
@ -3390,6 +3519,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]
@ -3999,14 +4130,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
@ -4026,21 +4187,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) [~ ~]
@ -4050,22 +4196,19 @@
(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)
::
::
%host
%- (lift (lift |=(a=hart:eyre [%hart !>(a)])))
^- (unit (unit hart:eyre))

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -1065,7 +1065,7 @@
::
:: XX review for security, stability, cases other than now
::
?. =(lot [%$ %da now]) ~
?. &(=(lot [%$ %da now]) =([~ ~] lyc)) ~
::
?: &(?=(%x ren) =(tyl //whey))
=/ maz=(list mass)

View File

@ -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] !!)

View File

@ -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 ~

View File

@ -4,7 +4,7 @@
=> ..lull
~% %zuse ..part ~
|%
++ zuse %412
++ zuse %411
:: :: ::
:::: :: :: (2) engines
:: :: ::
@ -4780,7 +4780,7 @@
=+ spa=;~(pose comt whit)
%+ knee *manx |. ~+
%+ ifix
[;~(plug (punt decl) (star spa)) (star spa)]
[;~(plug (more spa decl) (star spa)) (star spa)]
;~ pose
%+ sear |=([a=marx b=marl c=mane] ?.(=(c n.a) ~ (some [a b])))
;~(plug head many tail)
@ -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
::

View File

@ -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

View File

@ -14,20 +14,24 @@
|= [who=@p way=wire %blit blits=(list blit:dill)]
^- (list card:agent:gall)
=/ last-line
%+ roll blits
|= [b=blit:dill line=tape]
?- -.b
%put (tape p.b)
%klr (tape (zing (turn p.b tail)))
%nel ~& "{<who>}: {line}" ""
%hop line
%bel line
%clr ""
%sag ~& [%save-jamfile-to p.b] line
%sav ~& [%save-file-to p.b] line
%url ~& [%activate-url p.b] line
%wyp ""
==
|^ (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
%clr ""
%sag ~& [%save-jamfile-to p.b] line
%sav ~& [%save-file-to p.b] line
%url ~& [%activate-url p.b] line
%wyp ""
==
--
~? !=(~ last-line) last-line
~
--

View 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))

View File

@ -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)

View File

@ -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)

View File

@ -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
View 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 ~)
--

View File

@ -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

View File

@ -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

View File

@ -62,15 +62,26 @@
::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
::

View File

@ -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

View 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
--

View 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
--

View 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
--

View 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
--

View 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
--

View File

@ -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)]
==
--

View File

@ -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
::
@ -102,7 +131,7 @@
:: +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=?
@ -140,7 +169,7 @@
~
?~ 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)

View File

@ -201,6 +201,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 +229,11 @@ class UrbitApi {
);
}
clearCache(url) {
return this.action("dbug", "json", { 'clear-eyre-cache': { url: url } })
.then(this.getCache.bind(this));
}
// local
sidebarToggle() {

View File

@ -100,6 +100,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}

View File

@ -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>
<div>{items.length === 0 ? 'none' : items}</div>
<details open={(props.open === undefined) ? true : props.open}>
<summary>{items.length} items</summary>
<div>{items.length === 0 ? 'none' : items}</div>
</details>
</div>);
}
}

View File

@ -23,6 +23,7 @@ export class LocalReducer {
this.clayCommits(data, state);
//
this.eyreBindings(data, state);
this.eyreCache(data, state);
this.eyreConnections(data, state);
this.eyreAuthentication(data, state);
this.eyreChannels(data, state);
@ -156,6 +157,13 @@ export class LocalReducer {
}
}
eyreCache(obj, state) {
const data = _.get(obj, 'eyreCache', false);
if (data) {
state.cache = data;
}
}
eyreConnections(obj, state) {
const data = _.get(obj, 'eyreConnections', false);
if (data) {

View File

@ -11,6 +11,7 @@ class Store {
timers: [],
commits: [],
bindings: [],
cache: [],
connections: [],
authentication: {
sessions: [],

View File

@ -12,6 +12,7 @@ export class Eyre extends Component {
this.state = {};
this.loadBindings = this.loadBindings.bind(this);
this.loadCache = this.loadCache.bind(this);
this.loadConnections = this.loadConnections.bind(this);
this.loadAuthenticationState = this.loadAuthenticationState.bind(this);
this.loadChannels = this.loadChannels.bind(this);
@ -20,6 +21,7 @@ export class Eyre extends Component {
componentDidMount() {
const { props } = this;
if (props.bindings.length === 0) this.loadBindings();
if (props.cache.length === 0) this.loadCache();
if (props.connections.length == 0) this.loadConnections();
if (props.authentication.sessions.length == 0) this.loadAuthenticationState();
if (props.channels.length == 0) this.loadChannels();
@ -34,6 +36,14 @@ export class Eyre extends Component {
api.getBindings();
}
loadCache() {
api.getCache();
}
clearCache(url) {
api.clearCache(url);
}
loadConnections() {
api.getConnections();
}
@ -61,6 +71,36 @@ export class Eyre extends Component {
</div>)};
});
const cacheItems = props.cache.map(entry => {
return {key: entry.url + ' ' + (entry.val ? 'LIVE' : 'CLEARED'), jsx: (<div class="flex" style={{ marginBottom: '3px' }}>
<div style={{ width: '45%' }}>
{entry.url}
</div>
<div style={{ width: '5%' }}>
(v{entry.aeon})
</div>
{ !entry.val ? 'cleared' :
<div style={{ width: '50%', position: 'relative' }}>
<div style={{ display: 'inline-block', width: '10%' }}>
{entry.val.auth ? 'auth' : 'free'}
</div>
<div style={{ display: 'inline-block', width: '10%' }}>
{entry.val.payload.status}
</div>
<div style={{ display: 'inline-block', width: '50%' }}>
{entry.val.payload.headers.reduce((o, h) => (o ? o+'; ': '') + h.key + '=' + h.value, '')}
</div>
<div style={{ display: 'inline-block', width: '25%' }}>
{entry.val.payload.data ? entry.val.payload.data.toLocaleString('de-DE')+' bytes' : 'no data'}
</div>
<div style={{ display: 'inline-block', width: '5%' }}>
<button onClick={() => { this.clearCache(entry.url) }}>clear</button>
</div>
</div>
}
</div>)};
})
const connectionItems = props.connections.map(c => {
return {key: c.duct + ' ' + c.action, jsx: (
<table style={{borderBottom: '1px solid black'}}><tbody>
@ -232,6 +272,14 @@ export class Eyre extends Component {
<button onClick={this.loadBindings}>refresh</button>
</SearchableList>
<h4>Cache</h4>
{props.cache.reduce((sum, entry) => {
return sum + (entry.val && entry.val.payload.data || 0);
}, 0).toLocaleString('de-DE')} bytes in cache
<SearchableList placeholder="cache url, LIVE vs CLEARED" items={cacheItems} open={false}>
<button onClick={this.loadCache}>refresh</button>
</SearchableList>
<h4>Connections</h4>
<SearchableList placeholder="duct, binding" items={connectionItems}>
<button onClick={this.loadConnections}>refresh</button>
@ -252,7 +300,7 @@ export class Eyre extends Component {
<br/>
<button onClick={this.loadAuthenticationState}>refresh</button>
<h3>Sessions</h3>
<SearchableList placeholder="identity" items={sessionItems}>
<SearchableList placeholder="identity" items={sessionItems} open={false}>
</SearchableList>
<h3>Outgoing eauth</h3>
<SearchableList placeholder="host" items={visitingItems}>

View File

@ -88,7 +88,7 @@
-.old %6
::
update-logs.old
%- ~(rut by update-logs.old)
%- ~(urn by update-logs.old)
|= [=resource:store =update-log:store]
^- update-log:store
?: =(our.bowl entity.resource)

74
tests/app/tend.hoon Normal file
View File

@ -0,0 +1,74 @@
/+ verb, default-agent, dbug
|%
+$ state-0 [%0 ~]
+$ card card:agent:gall
+$ coop coop:gall
+$ action
$% [%tend =coop =path =page]
[%germ =coop]
[%snip =coop]
[%keen =ship case=@ud =path]
==
--
::
=| state-0
=* state -
%+ verb |
%- agent:dbug
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card:agent:gall _this)
[~ this]
::
++ on-save !>([%0 ~])
++ on-load
|= old=vase
^- (quip card:agent:gall _this)
[~ this(state [%0 ~])]
::
++ on-poke
|= [=mark =vase]
~| mark/mark
?> =(%noun mark)
=+ ;;(=action q.vase)
:_ this
?: ?=(%keen -.action)
=/ =path
%+ welp /g/x/(scot %ud case.action)/[dap.bowl]//1
path.action
[%pass /keen %keen & ship.action path]~
[%pass /foo action]~
++ on-peek
|= =path
^- (unit (unit cage))
~& peek-path/path
~& eny/eny.bowl
?. ?=([%c *] path)
[~ ~]
``noun+!>(&)
++ on-watch on-watch:def
++ on-arvo
|= [=wire syn=sign-arvo]
^- (quip card _this)
?: =(/keen wire)
?: ?=([%ames %near *] syn)
?. ?=([~ ~ *] dat.syn)
~& no-item/dat.syn
`this
=/ =path /(scot %p our.bowl)/[q.byk.bowl]/(scot %da now.bowl)/[p.u.u.dat.syn]
=+ .^ =dais:clay %cb
path
==
:_ this
[%pass /flog %arvo %d %flog %text (noah ;;(vale.dais q.u.u.dat.syn))]~
`this
`this
::
++ on-leave on-leave:def
++ on-agent on-agent:def
++ on-fail on-fail:def
--

13
tests/bug/wtcl-crash.hoon Normal file
View File

@ -0,0 +1,13 @@
:: miscompilation: crashing conditional expression compiled out
::
/+ *test
|%
::
++ test-wtcl-cond-crash
%- expect-fail
|. %. %foo
|= sam=$@(?(%foo %bar) [%baz @])
^- [%baz @]
?> ?=(%baz -.sam)
sam
--

View File

@ -3,6 +3,7 @@
/+ *test, v=test-ames-gall
/* kelvin %hoon /sys/kelvin
=> |%
++ dbug `?`|
++ kelvin-roof
^- roof
::
@ -55,7 +56,7 @@
=/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path)
=/ future-path=path /c/x/5/kids/sys/kelvin
=/ future-behn=wire (weld /fine/behn/wake/~bud future-path)
=/ =task:ames [%keen ~bud scry-path]
=/ =task:ames [%keen ~ ~bud scry-path]
::
=/ request=shot:ames
:* [sndr=~nec rcvr=~bud]
@ -65,7 +66,7 @@
origin=~
content=(etch-request-content ~nec (weld /~bud/1/1 scry-path) 1)
==
~& > 'poke requester %ames with a %keen task'
~? > dbug 'poke requester %ames with a %keen task'
=^ t1 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
@ -76,7 +77,7 @@
==
==
::
~& > 'poke requester %ames with a second %keen task'
~? > dbug 'poke requester %ames with a second %keen task'
:- t1 |. :- %|
=^ t2 ames.nec
%: ames-check-call:v ames.nec
@ -92,14 +93,14 @@
?~ keen=(~(get by keens.peer) scry-path)
~
listeners:u.keen
~& > 'checks two listeners for the requested scry path'
~? > dbug 'checks two listeners for the requested scry path'
=/ t3=tang
%+ expect-eq
!>((sy ~[~[/keen-duct-1] ~[/keen-duct-2]]))
!>(listeners)
::
:- t3 |. :- %|
~& > 'gives a remote scry response to listeners'
~? > dbug 'gives a remote scry response to listeners'
=/ [sig=@ux meows=(list @ux)]
%: ames-scry-hunk:v ames.bud
[~1111.1.2 0xbeef.dead kelvin-roof]
@ -143,18 +144,18 @@
origin=~
content=(etch-request-content ~nec (weld /~bud/1/1 future-path) 1)
==
~& > 'poke requester %ames with a %keen task for a future case'
~? > dbug 'poke requester %ames with a %keen task for a future case'
=^ t5 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
[~[/keen-duct-3] %keen ~bud future-path]
[~[/keen-duct-3] %keen ~ ~bud future-path]
:~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]]
[~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01]
==
==
::
:- t5 |. :- %|
~& > 'cancel %keen task, from requester'
~? > dbug 'cancel %keen task, from requester'
=^ t6 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
@ -163,26 +164,26 @@
==
::
:- t6 |. :- %|
~& > 'poke requester %ames with a new %keen task for a future case'
~? > dbug 'poke requester %ames with a new %keen task for a future case'
=^ t7 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
[~[/keen-duct-4] %keen ~bud future-path]
[~[/keen-duct-4] %keen ~ ~bud future-path]
:~ [~[//unix] [%give %send [%& ~bud] (etch-shot:ames request)]]
[~[//unix] %pass future-behn %b %wait ~1111.1.1..00.00.01]
==
==
::
:- t7 |. :- %|
~& > 'poke requester %ames with a second %keen task for a future case'
~? > dbug 'poke requester %ames with a second %keen task for a future case'
=^ t8 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
[~[/keen-duct-5] %keen ~bud future-path]
[~[/keen-duct-5] %keen ~ ~bud future-path]
~
==
:- t8 |. :- %|
~& > 'cancel scry for all listeners (%wham)'
~? > dbug 'cancel scry for all listeners (%wham)'
=^ t9 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
@ -199,7 +200,7 @@
?~ keen=(~(get by keens.peer) scry-path)
~
listeners:u.keen
~& > 'checks no more listeners'
~? > dbug 'checks no more listeners'
(expect-eq !>(~) !>(listeners))
::
++ test-fine-misordered
@ -213,7 +214,7 @@
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
=/ scry-path=path /g/x/0/dap//some/data/atom
=/ fine-behn-wire=wire (weld /fine/behn/wake/~bud scry-path)
=/ =task:ames [%keen ~bud scry-path]
=/ =task:ames [%keen ~ ~bud scry-path]
::
=/ requests=(list shot:ames)
%+ turn (gulf 1 3)
@ -229,7 +230,7 @@
=+ ^= [req1 req2 req3]
?> ?=([^ ^ ^ *] requests)
[i i.t i.t.t]:requests
~& > 'poke requester %ames with a %keen task'
~? > dbug 'poke requester %ames with a %keen task'
=^ t1 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
@ -265,7 +266,7 @@
[[~bud [1 sig]] ~ ~]
::
:- t1 |. :- %|
~& > 'hear first response fragment'
~? > dbug 'hear first response fragment'
=^ t2 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.2 0xbeef.dead *roof]
@ -282,7 +283,7 @@
==
::
:- t2 |. :- %|
~& > 'hear third response fragment'
~? > dbug 'hear third response fragment'
=^ t3 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.2 0xbeef.dead *roof]
@ -294,7 +295,7 @@
~
==
:- t3 |. :- %&
~& > 'hear second response fragment'
~? > dbug 'hear second response fragment'
=^ t4 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.3 0xbeef.dead *roof]

View File

@ -2,6 +2,7 @@
::
/+ *test, v=test-ames-gall
|%
++ dbug `?`|
++ test-watch
%- run-chain
|. :- %|
@ -12,7 +13,7 @@
::=^ * ames.bud
:: (ames-call:v ames.bud ~[/none] [%spew ~[%msg %snd %rcv %odd]] *roof)
:: poke %sub to tell it to subscribe
~& > 'poke %sub to tell it to subscribe'
~? > dbug 'poke %sub to tell it to subscribe'
=/ =task:gall [%deal [~nec ~nec /] %sub %poke watch+!>(~bud)]
=^ t1 gall.nec
%: gall-check-call:v gall.nec
@ -26,7 +27,7 @@
==
:- t1 |. :- %|
:: handle gall passing the %watch to itself, which passes to ames
~& > 'handle gall passing the %watch to itself, which passes to ames'
~? > dbug 'handle gall passing the %watch to itself, which passes to ames'
=^ t2 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.1 0xdead.beef *roof]
@ -40,7 +41,7 @@
==
:- t2 |. :- %|
:: subscriber ames handles %plea from gall, gives a packet to vere
~& > 'subscriber ames handles %plea from gall, gives a packet to vere'
~? > dbug 'subscriber ames handles %plea from gall, gives a packet to vere'
=^ t3 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.1 0xdead.beef *roof]
@ -60,7 +61,7 @@
==
:- t3 |. :- %|
:: publisher ames hears %watch, passes to gall
~& > 'publisher ames hears %watch, passes to gall'
~? > dbug 'publisher ames hears %watch, passes to gall'
=^ t4 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.2 0xbeef.dead *roof]
@ -77,7 +78,7 @@
==
:- t4 |. :- %|
:: publisher gall hears %watch from ames, passes to itself
~& > 'publisher gall hears %watch from ames, passes to itself'
~? > dbug 'publisher gall hears %watch from ames, passes to itself'
=^ t5 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
@ -91,7 +92,7 @@
==
:- t5 |. :- %|
:: publisher gall runs %pub with %watch, gives ack to itself
~& > 'publisher gall runs %pub with %watch, gives ack to itself'
~? > dbug 'publisher gall runs %pub with %watch, gives ack to itself'
=^ t6 gall.bud
%: gall-check-call:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
@ -103,7 +104,7 @@
==
:- t6 |. :- %|
:: gall gives ack to ames
~& > 'gall gives ack to ames'
~? > dbug 'gall gives ack to ames'
=^ t7 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.2 0xbeef.dead *roof]
@ -114,7 +115,7 @@
==
:- t7 |. :- %|
:: publisher ames hears ack from gall, sends over the network
~& > 'publisher ames hears ack from gall, sends over the network'
~? > dbug 'publisher ames hears ack from gall, sends over the network'
=^ t8 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.2 0xbeef.dead *roof]
@ -128,7 +129,7 @@
==
:- t8 |. :- %|
:: subscriber ames hears watch-ack packet, gives to gall
~& > 'subscriber ames hears watch-ack packet, gives to gall'
~? > dbug 'subscriber ames hears watch-ack packet, gives to gall'
=^ t9 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.3 0xdead.beef *roof]
@ -148,7 +149,7 @@
==
:- t9 |. :- %|
:: gall gives %done to itself
~& > 'gall gives %done to itself'
~? > dbug 'gall gives %done to itself'
=^ t10 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.3 0xdead.beef *roof]
@ -161,7 +162,7 @@
==
:- t10 |. :- %|
:: gall gives watch-ack to itself
~& > 'gall gives watch-ack to itself'
~? > dbug 'gall gives watch-ack to itself'
=^ t11 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.3 0xdead.beef *roof]
@ -172,7 +173,7 @@
==
:- t11 |. :- %|
:: start the clog and kick process; give clog to publisher gall
~& > 'start the clog and kick process; give clog to publisher gall'
~? > dbug 'start the clog and kick process; give clog to publisher gall'
=^ t12 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.4 0xbeef.dead *roof]
@ -184,7 +185,7 @@
==
:- t12 |. :- %|
:: gall gives %kick %boon to ames
~& > 'gall gives %kick %boon to ames'
~? > dbug 'gall gives %kick %boon to ames'
=^ t13 gall.bud
%: gall-check-take:v gall.bud
[~1111.1.4 0xbeef.dead *roof]
@ -195,7 +196,7 @@
==
:- t13 |. :- %|
:: ames gives kick over the network
~& > 'ames gives kick over the network'
~? > dbug 'ames gives kick over the network'
=^ t14 ames.bud
%: ames-check-take:v ames.bud
[~1111.1.4 0xbeef.dead *roof]
@ -211,7 +212,7 @@
==
:- t14 |. :- %|
:: subscriber ames receives kick, gives to gall and gives ack to unix
~& > 'subscriber ames receives kick, gives to gall and gives ack to unix'
~? > dbug 'subscriber ames receives kick, gives to gall and gives ack to unix'
=^ t15 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
@ -233,7 +234,7 @@
==
:- t15 |. :- %|
:: subscriber gall receives kick %boon from ames, gives to self
~& > 'subscriber gall receives kick %boon from ames, gives to self'
~? > dbug 'subscriber gall receives kick %boon from ames, gives to self'
=^ t16 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.5 0xdead.beef *roof]
@ -247,7 +248,7 @@
==
==
:: subscriber gall receives %kick from itself
~& > 'subscriber gall receives %kick from itself'
~? > dbug 'subscriber gall receives %kick from itself'
=^ t17 gall.nec
%: gall-check-take:v gall.nec
[~1111.1.5 0xdead.beef *roof]
@ -261,7 +262,7 @@
==
:- t17 |. :- %|
:: gall receives %deal %watch from itself, passes to ames
~& > 'gall receives %deal %watch from itself, passes to ames'
~? > dbug 'gall receives %deal %watch from itself, passes to ames'
=^ t18 gall.nec
%: gall-check-call:v gall.nec
[~1111.1.5 0xdead.beef *roof]
@ -273,7 +274,7 @@
==
:- t18 |. :- %|
:: subscriber ames sends new %watch
~& > 'subscriber ames sends new %watch'
~? > dbug 'subscriber ames sends new %watch'
=^ t19 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
@ -292,7 +293,7 @@
==
:- t19 |. :- %|
:: subscriber ames sends %cork
~& > 'subscriber ames sends %cork'
~? > dbug 'subscriber ames sends %cork'
=^ t20 ames.nec
%: ames-check-call:v ames.nec
[~1111.1.5 0xdead.beef *roof]
@ -310,7 +311,7 @@
==
==
:: publisher ames hears %kick ack
~& > 'publisher ames hears %kick ack'
~? > dbug 'publisher ames hears %kick ack'
:- t20 |. :- %|
=^ t21 ames.bud
%: ames-check-call:v ames.bud
@ -324,7 +325,7 @@
==
==
:: publisher ames hears new %watch
~& > 'publisher ames hears new %watch'
~? > dbug 'publisher ames hears new %watch'
:- t21 |. :- %|
=^ t22 ames.bud
%: ames-check-call:v ames.bud
@ -339,7 +340,7 @@
==
==
:: publisher gall hears new %watch, passes to self
~& > 'publisher gall hears new %watch, passes to self'
~? > dbug 'publisher gall hears new %watch, passes to self'
:- t22 |. :- %|
=^ t23 gall.bud
%: gall-check-call:v gall.bud
@ -351,7 +352,7 @@
==
==
:: publisher gall runs :pub's +on-watch, gives ack to self
~& > 'publisher gall runs :pub\'s +on-watch, gives ack to self'
~? > dbug 'publisher gall runs :pub\'s +on-watch, gives ack to self'
:- t23 |. :- %|
=^ t24 gall.bud
%: gall-check-call:v gall.bud
@ -363,7 +364,7 @@
==
==
:: publisher gall hears %watch-ack, gives to ames
~& > 'publisher gall hears %watch-ack, gives to ames'
~? > dbug 'publisher gall hears %watch-ack, gives to ames'
:- t24 |. :- %|
=^ t25 gall.bud
%: gall-check-take:v gall.bud
@ -374,7 +375,7 @@
==
==
:: publisher ames hears done from gall, sends over the network
~& > 'publisher ames hears done from gall, sends over the network'
~? > dbug 'publisher ames hears done from gall, sends over the network'
:- t25 |. :- %|
=^ t26 ames.bud
%: ames-check-take:v ames.bud
@ -388,7 +389,7 @@
== ==
==
:: publisher ames hears %cork, passes to itself
~& > 'publisher ames hears %cork, passes to itself'
~? > dbug 'publisher ames hears %cork, passes to itself'
:- t26 |. :- %|
=^ t27 ames.bud
%: ames-check-call:v ames.bud
@ -403,7 +404,7 @@
==
:- t27 |. :- %|
:: publisher ames hear cork plea from self, give %done to self
~& > 'publisher ames hear cork plea from self, give %done to self'
~? > dbug 'publisher ames hear cork plea from self, give %done to self'
=^ t28 ames.bud
%: ames-check-call:v ames.bud
[~1111.1.8 0xbeef.dead *roof]
@ -413,7 +414,7 @@
==
==
:: publisher ames hears cork done from self, sends ack and $cork to self
~& > 'publisher ames hears cork done from self, sends ack and $cork to self'
~? > dbug 'publisher ames hears cork done from self, sends ack and $cork to self'
:- t28 |. :- %|
=^ t29 ames.bud
%: ames-check-take:v ames.bud
@ -428,7 +429,7 @@
== ==
==
:: subscriber ames hears %watch-ack, gives to gall
~& > 'subscriber ames hears %watch-ack, gives to gall'
~? > dbug 'subscriber ames hears %watch-ack, gives to gall'
:- t29 |. :- %|
=^ t30 ames.nec
%: ames-check-call:v ames.nec
@ -447,7 +448,7 @@
==
==
:: subscriber gall hears new %watch-ack from ames, gives to self
~& > 'subscriber gall hears new %watch-ack from ames, gives to self'
~? > dbug 'subscriber gall hears new %watch-ack from ames, gives to self'
:- t30 |. :- %|
=^ t31 gall.nec
%: gall-check-take:v gall.nec
@ -464,7 +465,7 @@
==
==
:: subscriber gall hears new %watch-ack from self, tells :sub
~& > 'subscriber gall hears new %watch-ack from self, tells :sub'
~? > dbug 'subscriber gall hears new %watch-ack from self, tells :sub'
:- t31 |. :- %|
=^ t32 gall.nec
%: gall-check-take:v gall.nec
@ -475,7 +476,7 @@
~
==
:: subscriber ames hears %cork ack, sends $kill to self
~& > 'subscriber ames hears %cork ack, sends $kill to self'
~? > dbug 'subscriber ames hears %cork ack, sends $kill to self'
:- t32 |. :- %|
=^ t33 ames.nec
%: ames-check-call:v ames.nec
@ -493,7 +494,7 @@
==
==
:: subscriber ames hears $kill from self, deletes the flow
~& > 'subscriber ames hears $kill from self, deletes the flow'
~? > dbug 'subscriber ames hears $kill from self, deletes the flow'
:- t33 |. :- %|
=^ t34 ames.nec
%: ames-check-call:v ames.nec

23
tests/sys/hoon/func.hoon Normal file
View File

@ -0,0 +1,23 @@
:: Tests for currying gates and ++corl
::
/+ *test
|%
++ test-func
;: weld
%+ expect-eq
!> `(list)`~[0 1 2]
!> ((curr oust `(list)`~[0 1 2]))
%+ expect-eq
!> `@`6
!> ((curr roll add) (gulf 1 3))
%+ expect-eq
!> `@`6
!> ((cury roll (gulf 1 3)) add)
:: check that ++corl strips face from b's subject
::
%+ expect-eq
!> `@`15
!> ((corl same (cury roll (gulf 1 5))) add)
==
::
--

View File

@ -211,6 +211,82 @@
::
==
::
:: input chosen as follows:
::
:: > =|(i=@ud |-(?.(=(32 (met 3 (shax i))) i $(i +(i)))))
:: 507
:: > =/(i=@ud 508 |-(?.(=(32 (met 3 (shax i))) i $(i +(i)))))
:: 653
::
++ test-shas-smol
^- tang
;: weld
%+ expect-eq
!> 0x5e64.27b4.df50.8044.0556.ea06.d5b7.cc22.35db.d62a.ebeb.6bc5.cfb8.
26de.2e31.6920
!> `@ux`(shas %foo 0)
::
%+ expect-eq
!> 0xecb1.6c06.c8e6.9572.7202.a8f6.cbd8.7b3c.a1ab.4670.2b31.2b36.dabd.
4bcb.ebf2.bc4f
!> `@ux`(shas %foo 1)
::
%+ expect-eq
!> 0x9a02.666a.9860.0575.8996.2929.cbf5.863b.392e.7692.f95b.d591.6508.
0e76.5cca.149f
!> `@ux`(shas %foo 506)
::
%+ expect-eq
!> 0xe0d6.a881.1621.f8fc.deb5.8794.e059.6937.8b74.03d3.d6c7.d140.ced4.
3ec2.d935.bbc4
!> `@ux`(shas %foo 507)
::
%+ expect-eq
!> 0xf184.dab8.34ff.dd4c.6a57.7f49.ac3f.c6d5.4e41.e9e7.30cd.c665.8c51.
d2ae.3989.439a
!> `@ux`(shas %foo 652)
::
%+ expect-eq
!> 0xd7ed.4f04.146d.db1a.604b.6b8e.61a2.83a5.d4dc.7efc.c9e1.5bc6.45ba.
7363.b297.0691
!> `@ux`(shas %foo 653)
==
::
++ test-shas-long
^- tang
;: weld
::
%+ expect-eq
!> 0x1f88.2572.f898.a8b6.75c6.c660.6315.19a6.dacc.2934.0caa.ee11.b338.
1588.1a5d.aee8
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 0)
::
%+ expect-eq
!> 0x3f91.8587.1fe4.480a.1cad.0a4f.6feb.e73f.3313.bf21.4dc6.e059.3b72.
1227.47ea.70f5
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 1)
::
%+ expect-eq
!> 0xfe84.9453.f7f7.2637.25da.8327.e71f.c4c1.baaf.dec5.e790.0d06.83aa.
61b2.5e52.5330
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 506)
::
%+ expect-eq
!> 0xacd3.eaec.97cc.b5db.4b4f.b055.ad97.7e29.b767.2434.b7de.6193.6616.
6852.174a.cb4e
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 507)
::
%+ expect-eq
!> 0x911e.59e5.065a.6693.63de.e265.abab.514a.ca11.519b.236c.ebf8.d162.
7d16.02e7.0782
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 652)
::
%+ expect-eq
!> 0x3912.6b8d.98e1.528a.c9f6.a6ae.1dbe.d496.448e.d5fd.5dda.daaa.e7e8.
f01f.06ba.09db
!> `@ux`(shas %foobarbazbud-abcdefghijklmnopqrstuvwxyz 653)
==
::
++ test-shax
=/ a ''
=/ b 'abc'

View File

@ -177,14 +177,14 @@
:: in both maps are the same as before, and that both returned
:: maps are correct
::
=/ splits-a=[(map) (map)] (~(bif by m-des) [99 99])
=/ splits-b=[(map) (map)] (~(bif by m-des) [6 12])
=/ splits-a=[(map) (map)] (~(bif by m-des) 99)
=/ splits-b=[(map) (map)] (~(bif by m-des) 6)
;: weld
:: Checks with empty map
::
%+ expect-eq
!> [~ ~]
!> (~(bif by m-nul) [1 2])
!> (~(bif by m-nul) 1)
:: Checks bifurcating by non-existing element
::
%+ expect-eq
@ -594,12 +594,12 @@
::
%+ expect-eq
!> ~
!> (~(rut by m-nul) add)
!> (~(urn by m-nul) add)
:: Checks success
::
%+ expect-eq
!> (my ~[[1 3] [2 6] [3 9] [4 12] [5 15] [6 18] [7 21]])
!> (~(rut by m-asc) add)
!> (~(urn by m-asc) add)
==
::
:: Test listify pairs

41
tests/sys/hoon/nest.hoon Normal file
View File

@ -0,0 +1,41 @@
/+ *test
|%
++ test-fitz
;: weld
%+ expect-eq
!> %.y
!> (fitz ~. ~.tas)
::
%+ expect-eq
!> %.y
!> (fitz ~.ud ~.)
::
%+ expect-eq
!> %.n
!> (fitz ~.p ~.q)
::
%+ expect-eq
!> %.n
!> (fitz ~.ux ~.ud)
::
%+ expect-eq
!> %.y
!> (fitz ~.tas ~.ta)
::
%+ expect-eq
!> %.n
!> (fitz 'uvD' 'uvE')
::
%+ expect-eq
!> %.y
!> (fitz 'uvE' 'uvD')
::
%+ expect-eq
!> %.n
!> (fitz 'AD' 'CB')
::
%+ expect-eq
!> %.n
!> (fitz 'AC' 'CB')
==
--

View File

@ -442,7 +442,7 @@
%+ expect-eq
!> =- [~[//unix] %pass /qos %d %flog %text -]
"; {<our-comet>} is your neighbor"
!> (snag 0 `(list move:ames)`moves7)
!> (snag 1 `(list move:ames)`moves7)
::
%+ expect-eq
!> [~[/g/talk] %give %boon post]
@ -473,11 +473,11 @@
;: weld
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet>} is your neighbor"]
!> (snag 0 `(list move:ames)`moves4)
!> (snag 1 `(list move:ames)`moves4)
::
%+ expect-eq
!> [~[//unix] %pass /qos %d %flog %text "; {<our-comet2>} is your neighbor"]
!> (snag 0 `(list move:ames)`moves7)
!> (snag 1 `(list move:ames)`moves7)
::
%+ expect-eq
!> [~[/g/talk] %give %boon [%post 'first1!!']]
@ -539,7 +539,7 @@
++ test-fine-request
^- tang
=/ want=path /c/z/1/kids/sys
=^ moves1 nec (call nec ~[/g/talk] %keen ~bud want)
=^ moves1 nec (call nec ~[/g/talk] %keen ~ ~bud want)
=/ req=hoot:ames
%+ snag 0
%+ murn ;;((list move:ames) moves1)
@ -697,4 +697,24 @@
!> [~[/g/talk] %give %boon [%post '¡hola!']]
!> (snag 0 `(list move:ames)`moves7)
==
::
++ test-plug ^- tang
=^ moves nec
(call nec ~[/g/talk] %plug /foo)
=/ expected-key
3.782.450.905.364.316.746.465.724.430.826.633.339.627.682.402.565.789.971.442.035.627.125.517.743.962.901.817.756.764.395.497.041.697.150.935.487.420.935.470.530.023.121.462.879.251.503.082.973.208.842.762
%- zing
:-
%+ expect-eq !>(moves)
!> ^- (list move:ames)
:~ [~[/g/talk] %give %stub 1 expected-key]
==
=^ moves2 bud
(call bud ~[/g/talk] %keen `[1 expected-key] ~nec /foo/bar)
:_ ~
%+ expect-eq !>(moves2)
!> ^- (list move:ames)
:~ [~[/g/talk] [%pass /fine/shut/1 [%a [%keen sec=~ ship=~nec path=/a/x/1//fine/shut/1/0v1.vvaek.7boon.0tp04.21q1h.be1i0.494an.qimof.e2fku.ern01]]]]
==
::
--

View File

@ -1313,7 +1313,7 @@
|= =time
%+ ex ~[/http-blah]
=. time (sub time (mod time ~h1))
[%pass wire %a %keen ~sampel /e/x/(scot %da time)//eauth/url]
[%pass wire %a %keen ~ ~sampel /e/x/(scot %da time)//eauth/url]
::
++ ex-yawn
|= =time

View File

@ -1,46 +1,33 @@
/+ *test
/= gall-raw /sys/vane/gall
::
=/ gall-gate (gall-raw ~nec)
=/ nec (gall-raw ~nec)
::
|%
++ time ~1111.1.1
:: +test-init: test %init
::
++ test-init
^- tang
::
=/ time ~1111.1.1
::
=/ call-args
=/ =duct ~[/init]
=/ =task:gall [%init ~]
[duct task]
::
=/ expected-moves=(list move:gall-gate) ~
::
=/ res
(gall-call gall-gate time *roof call-args expected-moves)
::
-.res
=^ moves nec
(gall-call nec time *roof call-args)
(expect-eq !>(moves) !>(*(list move:nec)))
:: +gall-call: have %gall run a +task and assert it produces expected-moves
::
++ gall-call
|= $: gall-gate=_gall-gate
|= $: nec=_nec
now=@da
scry=roof
call-args=[=duct wrapped-task=(hobo task:gall)]
expected-moves=(list move:gall-gate)
==
=/ gall-core (gall-gate now=now eny=`@`0xdead.beef scry=scry)
::
=/ res
=/ =type -:!>(*task:gall)
(call:gall-core duct.call-args dud=~ wrapped-task.call-args)
::
=/ output=tang
%+ expect-eq
!> expected-moves
!> -.res
::
[output +.res]
=/ gall-core (nec now=now eny=`@`0xdead.beef scry=scry)
(call:gall-core duct.call-args dud=~ wrapped-task.call-args)
--

71
tests/tend.hoon Normal file
View File

@ -0,0 +1,71 @@
/+ verb, default-agent, dbug
|%
+$ state-0 [%0 ~]
+$ card card:agent:gall
+$ coop coop:gall
+$ action
$% [%tend =coop =path =page]
[%germ =coop]
[%snip =coop]
[%keen case=@ud =path]
==
--
::
=| state-0
=* state -
%+ verb |
%- agent:dbug
^- agent:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card:agent:gall _this)
[~ this]
::
++ on-save !>([%0 ~])
++ on-load
|= old=vase
^- (quip card:agent:gall _this)
[~ this(state [%0 ~])]
::
++ on-poke
|= [=mark =vase]
~| mark/mark
?> =(%noun mark)
=+ ;;(=action q.vase)
:_ this
?: ?=(%keen -.action)
=/ =path
%+ welp /g/x/(scot %ud case.action)
path.action
[%pass /keen %keen & ?:(=(our.bowl ~met) ~hex ~met) path]~
[%pass /foo action]~
++ on-peek
|= =path
^- (unit (unit cage))
~& peek-path/path
~& eny/eny.bowl
?. ?=([%c *] path)
[~ ~]
``noun+!>(&)
++ on-watch on-watch:def
++ on-arvo
|= [=wire syn=sign-arvo]
^- (quip card _this)
~& syn
?: =(/keen wire)
?: ?=([%ames %near *] syn)
?. ?=([~ ~ *] dat.syn)
~& no-item/dat.syn
`this
~& ;;([@tas @tas] q.u.u.dat.syn)
`this
`this
`this
::
++ on-leave on-leave:def
++ on-agent on-agent:def
++ on-fail on-fail:def
--