Commit Graph

15827 Commits

Author SHA1 Message Date
Philip Monk
9487481128
dojo, drum: change %tab sole-effect to use tanks
It should be general-purpose for tab-completing things in other apps,
types are inappropriate.
2019-10-31 15:14:41 -07:00
Philip Monk
ee63e122ea
dojo, auto: move insert-magic logic to lib/auto
This changes the entry-points in lib/auto so that clients never have to
handle magic-spoon.  You can specify either a tape of code with a
position index or a preparsed hoon (presumably you ran +insert-magic
before parsing).
2019-10-31 14:56:54 -07:00
Philip Monk
4482997a16
dojo, drum: give tab completion as true output
This stops slogging the tab completion and intead adds a +sole-effect
for tab completion output.  This is morally correct, and it lets dojo
clients show tab completions how they want.  For example, web dojo could
implement this as a drop-down box.

Another advantage is that this puts the rendering logic in drum, which
knows the width of the terminal.  Thus, we can make sure each match
takes no more than one line by truncating with ellipses.  If there's
only one match and it's already fully typed, then we display the whole
type.
2019-10-31 14:36:14 -07:00
Philip Monk
4d0e77a6b2
dojo: add a better function printer
It's useful to know what a function takes and produces, so this changes the autocomplete type prettyprinter to emphasize those.  This also gives a nice syntax for molds.  Examples:

```
-----
add  {a/@ b/@} -> @
~zod:dojo> add
-----
term  * -> @tas
~zod:dojo> term
-----
sign-transaction  {tx/{nonce/@ud gas-price/@ud gas/@ud to/@ux value/@ud data/@ux chain-id/@ux} pk/@} -> @ux
~zod:dojo> sign-transaction🔑ethereum
-----
wind  {a/(* -> *) b/(* -> *)} -> * -> ?({$give p/*} {$pass p// q/*} {$slip p/*})
~zod:dojo> wind
```
2019-10-31 13:56:20 -07:00
Fang
848805e007
eth: move eth-watcher's request-rpc into ethio lib
Once this is more fully featured, /app/claz could be refactored with it.
2019-10-31 15:54:56 +01:00
Philip Monk
76b917f426
dojo: add tab completion
This is initial support for type-aware tab completion.  When you hit tab, it tries to complete the word you're in the middle of using a face or arm in the subject at that point in the code.  It also shows all possible matches and their associated types.  It's nearly instantaneous.  Notes:

- It advances to the longest common prefix, so if you hit tab on `ab` and the only possible results are `abcde` and `abcdz`, then it'll write `abcd` and print both out (with their types).

- If there are fewer than ten matches, it prints the type along with the face.  Printing types is too slow to use all the time, but with 10 it's essentially instantaneous.

- The match closest in the subject to you (i.e. smallest axis number) is displayed lowest (closest to your focus).

Examples below, where `<TAB>` represents me hitting tab while my cursor is at that position (the line with the `<TAB>` is not preserved in the actual output).

```
~zod:dojo> eth<TAB>
-----
ethereum        #t/<11.qcl {<3.ltb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141> <21.yeb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141>}>
ethereum-types  #t/<3.ltb 27.ipf 7.ecf 36.uek 92.bjk 247.ows 51.mvt 126.xjf 41.mac 1.ane $141>
~zod:dojo> ethereum
~zod:dojo> |=  zong=@ud  z<TAB>
-----
zing  #t/<1.dqs {* <126.xjf 41.mac 1.ane $141>}>
zap   #t/<1.iot {tub/{p/{p/@ud q/@ud} q/""} <1.rff {daf/@t <247.ows 51.mvt 126.xjf 41.mac 1.ane $141>}>}>
zuse  #t/$309
zong  #t/@ud
~zod:dojo> |=  zong=@ud  zo<TAB>
-----
zong  #t/@ud
~zod:dojo> |=  zong=@ud  zong
~zod:dojo> <TAB>
hoon-version
trel
quip
pole
unit
qual
lone
... about 600 more lines ...
unity
html
zuse
eny
now
our
~zod:dojo>
```

Functionally, this is in a state where I'd be comfortable shipping it.  It doesn't interfere with anything if you don't press tab, and it's perfectly OTA-able.  I do think its output is a little verbose, but that can be tuned over time as people try it and determine what feels good in practice.

Additional notes:

- There are plenty of similar systems for other languages, but my most direct inspiration is Idris's editor tools.  This is implemented for the dojo, but I actually want it in my editor, which is why the meat is all defind in a library.  I've only tested on dojo one-liners, so I don't know the performance on large blocks of code.

- The default type printer isn't great for this use case.  In particular,
	- Cores should not print anything about their context
  - The `#t/` should go away
  - If it looks like a gate, we should print its return value
  - Maybe special handling for molds, but if the above is done, then for example `bone` is  `* -> @ud`.

- The worst part about our wing ordering is that it really screws up tab completion.  You want to do `point.owner-address` instead of `owner-address.point` because that lets you type `point.ow<TAB>`.  I weakly prefer reading it how we do it now, but it's really not great.  You could do an (dojo-specific?) alternate syntax of `point;owner-address`; this is a simple transformation.

- Regardless of the above, this should handle the case where we're in the middle of defining a wing; it doesn't right now.

- When a variable is shadowed, we show both of them.  We should probably show the shadowed one with a `^`.

- We probably shouldn't print out hundreds of results.  Maybe just the closest 50 with ellipses.

- This gets you any face in your subject, regardless of whether its type is reasonable.  We could limit that some by copying the `gol` logic in mint, so that if the pseudo-backward-inference engine happens to know what type it should be, you can filter the tab results according to if they nest in that type.  This would be "strongly type-aware".
2019-10-30 23:19:25 -07:00
Jared Tobin
f53d3f3143
Merge branch 'acme-dns-notifications' (#1894)
* acme-dns-notifications:
  dns: clear request from state on %coup error
  Revert "moves :dns scry for ames domains in :dns|auto generator"
  dns: sends notifications directly to %dill (and adds tapp support)
  acme: sends notifications directly to %dill

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-31 14:06:57 +08:00
Jared Tobin
7ceff5be8b
vere: update patch version (0.9.1 -> 0.9.2) [ci skip] 2019-10-31 14:05:15 +08:00
Joe Bryan
d353484033 dns: clear request from state on %coup error 2019-10-30 15:17:45 -07:00
Joe Bryan
79b7f55f0a Revert "moves :dns scry for ames domains in :dns|auto generator"
This reverts commit 9c1616802e.
2019-10-30 15:14:59 -07:00
Joe Bryan
aba3ea8055 dns: sends notifications directly to %dill (and adds tapp support) 2019-10-30 15:14:54 -07:00
Logan Allen
c660a79332 apps: remove %hall and %talk 2019-10-30 13:52:19 -07:00
Joe Bryan
fe8a7f0a33 acme: sends notifications directly to %dill 2019-10-30 13:30:51 -07:00
Fang
a020f184ef
gaze: make compile for latest eth-watcher
Untested. This remains old code that could do with a tapp makeover.
2019-10-30 20:32:08 +01:00
Fang
522f598770
drum: start eth-watcher on boot
Alongside the azimuth-tracker that depends on it.
2019-10-30 20:18:56 +01:00
Fang
e16f1d64b5
azimuth-tracker: remove deprecated generator 2019-10-30 20:18:56 +01:00
Fang
188867b73f
eth: implement azimuth-tracker using eth-watcher
Re-implements the behavior of the previous azimuth-tracker as an app
that pokes and peers eth-watcher. Should have maintained identical
outward semantics to the original.
2019-10-30 20:18:49 +01:00
Fang
555eae6e25
eth-watcher: ensure logs always sent oldest-first
For easier "this happened, then that happened" on the client side.
2019-10-30 18:44:52 +01:00
Fang
e0b564f72f
eth-watcher: allow peers to unconfigured watchdogs
We simply respond with an empty history. This allows applications to
safely subscribe prior to a watchdog's creation.
2019-10-30 16:48:51 +01:00
Fang
603a3ae32b
eth-watcher: saner %watch behavior
When configuring a watchdog on a path that already exists, we now
"overwrite" it, meaning we throw away all history and trawl the node
for logs again.
If the only config change is the url, however, we silently modify it,
and simply use it "from this point onward".

This matches the behavior of the original azimuth-tracker.
2019-10-30 16:46:37 +01:00
Fang
e8d52e9b58
eth-watcher: implement %clear poke
We don't need to bother un-setting any timers or other subscriptions,
because those all happen on the app-wide level, instead of per watchdog.
2019-10-30 16:35:12 +01:00
Fang
c3ac547b3b
eth-watcher: store logs in state to implement peer
In order to give an initial response to incoming subscriptions (without
resorting to retrieving that data from chain again) we now store event
log history in state.

Instead of discarding pending-logs entirely after sending out updates,
we add them to the watchdog's history.
Just like pending-logs, we remove from the head during a rewind (though
not before exhausting the pending-logs).
2019-10-30 00:37:12 +01:00
Fang
277f2955c3
eth-watcher: move types into /sur file 2019-10-29 21:13:28 +01:00
Fang
4e9ece6cea
eth-watcher: properly tag out-peer-data 2019-10-29 19:14:21 +01:00
Fang
6437d860fe
eth-watcher: single update timer loop
Kicks the update timer on application start, then sets a new timer
whenever it's awoken. This aims to ensure eth-watcher never stops
looking for updates periodically.
2019-10-29 19:13:16 +01:00
Fang
67b4c9975e
eth-watcher: implement /block peek
/block/some-path allows you to get the next block that will be checked
for updates for the watcher at /some-path. Useful for uptime checking.
2019-10-29 19:11:36 +01:00
Jared Tobin
e77237d1a1
Revert "chat-hook: use sender's timestamp"
This reverts commit 22ddb712ff, which I
merged prematurely.  See later commentary in #1889.

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-29 15:20:28 +08:00
Jared Tobin
2a386d6c47
Merge branch 'chat-hook-when' (#1889)
* chat-hook-when:
  chat-hook: use sender's timestamp

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-28 04:20:10 +08:00
Fang
22ddb712ff
chat-hook: use sender's timestamp
No longer overwrite messages' timestamp on-receive, instead keeping whatever
timestamp was set by the sender.

This behavior matches that of the late Hall.
2019-10-27 13:43:26 +01:00
Jared Tobin
1f614c9fc3
Merge branch 'ohAitch/patch-1' (#1887)
* ohAitch/patch-1:
  eyre: fix wire=path terminology

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-26 17:57:14 +08:00
Jared Tobin
e313716b7f
Merge branch 'publish-fixes' (#1886)
* publish-fixes:
  publish: correctly set title and body when navigating with next/prev

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-26 17:55:32 +08:00
Jared Tobin
db85bccf84
Merge branch 'jt/release-pills' (#1877)
* jt/release-pills:
  build: add ropsten-pills target to Makefile
  build: add Ropsten derivations for arvo and pills
  vere: change default bootstrap pill URI

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-26 17:53:59 +08:00
Anton Dyudin
78d10f30cd
eyre: fix wire=path terminology 2019-10-25 16:04:29 -07:00
Isaac Visintainer
16364de935 publish: correctly set title and body when navigating with next/prev 2019-10-25 15:29:51 -07:00
Fang
cda68b90b9
eth: turn azimuth-tracker into eth-watcher
Uses the logic existing in azimuth-tracker to implement a new
eth-watcher, which can look at Ethereum nodes for _any_ events, as
opposed to exclusively a subset of the Azimuth contract's events.

Azimuth-tracker will be reimplemented as a dependent of this in
forthcoming commits.
2019-10-25 19:25:31 +02:00
Fang
7bc17357ba
eth: remove old eth-watcher files
These were deprecated in favor of azimuth-tracker in #1320.

(Azimuth-tracker, however, isn't a general-purpose Ethereum log watcher
tool. Commits to transform it into a more broadly useful tool are
forthcoming.)
2019-10-25 13:08:27 +02:00
Jared Tobin
7f124db8d9
Merge branch 'philip/jael-ames-full' (#1882)
* philip/jael-ames-full:
  jael: provide edge-triggered breach notification

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-25 14:05:01 +08:00
Jared Tobin
7add660077
Merge branch 'la-chat-sidebar' (#1885)
* la-chat-sidebar:
  chat-ui: fix image previews from url types
  chat-js: make clicking a url message open in a new tab
  chat-js: fix chat sorting and selection in sidebar

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-25 10:23:30 +08:00
Logan Allen
e06acb87be chat-ui: fix image previews from url types 2019-10-24 14:31:40 -07:00
Logan Allen
c8cca2f261 chat-js: make clicking a url message open in a new tab 2019-10-24 14:12:26 -07:00
Logan Allen
29fc32d11b chat-js: fix chat sorting and selection in sidebar 2019-10-24 14:04:48 -07:00
Philip Monk
9ddc04143a
jael: provide edge-triggered breach notification
Until now, clients of Jael have had to store the first-seen rift if they
want to reliably detect breaches.  Otherwise, they would get a false
positive if they heard an old message about a breach (eg if you kick
azimuth-tracker).  Clay and Gall did this correctly, but Ames did not.

Jael already maintains this state, so I added a notification to the
existing subscription that happens whenever it notices a breach (a diff
or full where the new rift is greater than the old one).

Because this is an issue on the live network, I wrote state adapters
for Gall and Clay.  The Gall one just removes the rift from our state,
but the Clay one is much more involved because we have to upgrade
instances of the clad monad that are possibly in progress.
Specifically, since more input is possible than before, we must wrap any
in-progress instances of the monad in a function that handles the
potential new input from Jael.  This temporarily preservers a copy of
the old kernel, but only until the current commit/merge/update has
completed.

The real solution for Clay is to factor out those IO-heavy instances to
userspace tapp/async/imp/threads, and if an upgrade happens in the
middle, you should simply restart them.

Fixes #1852
2019-10-23 21:40:34 -07:00
Jared Tobin
432a321e0c
build: add ropsten-pills target to Makefile
Adds a script for creating Ropsten pills, then adds it to the Makefile
under the 'ropsten-pills' target.
2019-10-24 10:03:52 +08:00
Jared Tobin
0bdced981e
build: add Ropsten derivations for arvo and pills
Arvo testnets typically use Ropsten's deploy of the Azimuth contract
instead of mainnet's.  This commit adds an 'arvo-ropsten' derivation for
Arvo as specialised to Ropsten.

In addition to using a different Azimuth address in %zuse, this also
configures %ames and :acme appropriately for running an alternate
network on Ropsten.  %ames has its protocol version incremented, and
:acme uses the Let's Encrypt staging API.

Included here are derivations for creating brass and ivory pills using
arvo-ropsten, to boot.
2019-10-24 10:03:52 +08:00
Jared Tobin
536e56d675
vere: change default bootstrap pill URI
Vere will attempt to download a pill from https://bootstrap.urbit.org if
not given one explicitly.  These pill filenames have traditionally had
the format:

  urbit-$URBIT_VERSION.pill

but this is inconsistent with the manner in which versions are referred
to elsewhere.  For example, release binaries are packaged in tarballs
with the names:

  urbit-linux64-v$URBIT_VERSION.tgz
  urbit-darwin-v$URBIT_VERSION.tgz

Note the 'v' prepended to URBIT_VERSION.

From v0.9.2 forward it is expected that bootstrap pills will also use
the 'v' prefix, i.e.

  urbit-v$URBIT_VERSION.pill

so this commit makes the appropriate change in the daemon.
2019-10-24 09:42:30 +08:00
Jared Tobin
03dd035ebb
Merge branch 'chat-cli-code-style' (#1880)
* chat-cli-code-style:
  chat-cli: minor code style fixes

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-24 09:31:17 +08:00
Fang
544d636701
chat-cli: minor code style fixes 2019-10-23 20:40:58 +02:00
Jared Tobin
150efffbd2
Merge branch 'jt/gall-ap-scry-fix' (#1868)
* jt/gall-ap-scry-fix:
  gall: fix bug in +ap-peek

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-23 08:36:36 +08:00
Jared Tobin
3fddf99260
Merge branch 'claz-invites-newline' (#1846)
* claz-invites-newline:
  claz: do invite file reading in +read-invites
  claz: ignore empty lines in invites file

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-23 08:36:07 +08:00
Jared Tobin
095a0a155a
Merge branch 'publish-fixes' (#1865)
* publish-fixes:
  publish: auto-resubscribe on quit, crash on failed subscription
  publish: added permission logic to %serve and import flows

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-23 08:35:01 +08:00