Commit Graph

549 Commits

Author SHA1 Message Date
Philip Monk
f3626e17e6
auto: support multiline tab completion 2019-10-31 20:54:00 -07:00
Philip Monk
e4a89b072c
auto: don't look in context of non-gold cores 2019-10-31 16:38:47 -07:00
Philip Monk
8e66d84c83
easy-print: don't crash if type-check crashes
also don't render all the types if there's more than 10.
2019-10-31 15:53:43 -07:00
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
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
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
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
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
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
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
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
Isaac Visintainer
0a5fcf8210 publish: auto-resubscribe on quit, crash on failed subscription 2019-10-22 10:18:34 -07:00
Isaac Visintainer
aed15a13b9 publish: added permission logic to %serve and import flows 2019-10-22 10:18:25 -07:00
Jared Tobin
bdfc270b2f
gall: fix bug in +ap-peek
fc7901d2 refactored much of +ap-peek, but introduced a bug in the
process.  The relevant diff from that commit is as follows:

  -        =/  =path  [ren tyl]
  -        =/  =vase  !>((slag p.u.cug path))
  -        (ap-slam q.u.cug p.arm vase)
  +        =/  index  p.u.maybe-arm
  +        =/  term  q.u.maybe-arm
  +        =/  =vase
  +          =/  =path  [term tyl]
  +          =/  raw  (slag index path)
  +          !>  raw
  +        (ap-slam term p.arm vase)

Note that [ren tyl] was replaced with [term tyl], where 'term' and 'ren'
are not equal.  This commit merely rights that wrong.
2019-10-22 15:22:30 +08:00
Jared Tobin
71b27b0300
Merge branch 'pretty-userspace' (#1847)
* pretty-userspace:
  pills
  hoon: moves new pretty-printer back into userspace

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-22 10:12:05 +08:00
Jared Tobin
4ee03d4e6a
Merge branch 'chat-cli-join-prompt' (#1851)
* chat-cli-join-prompt:
  chat-cli: update prompt on ;join

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-21 08:28:16 +08:00
Jared Tobin
7be86ebd4f
Merge branch 'philip/ames-fix' (#1840)
* philip/ames-fix:
  ames: better stack traces
  ames: don't crash

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-21 08:26:21 +08:00
Fang
9ed582b9c4
claz: do invite file reading in +read-invites
Ensures we read out the invite file in a consistent way
2019-10-18 16:15:11 +02:00
Fang
10b2643a50
chat-cli: update prompt on ;join
Fixes #1841.
2019-10-18 15:04:34 +02:00
Joe Bryan
fa01bfb0a5 hoon: moves new pretty-printer back into userspace 2019-10-17 17:52:45 -07:00
Fang
f0a4bd0369
claz: ignore empty lines in invites file 2019-10-18 02:10:39 +02:00
Philip Monk
be212ad54b
ames: better stack traces 2019-10-17 16:52:35 -07:00
Philip Monk
f835ef5a70
ames: don't crash 2019-10-17 12:33:35 -07:00
Philip Monk
95471d0a39
azimuth-tracker: fix |watch generator 2019-10-17 10:37:09 -07:00
Jared Tobin
c6b4317aa9
Merge branch 'spec-better' (#1836)
* spec-better:
  updates solid pill
  arvo: improves move type specialization (by spec'ing incrementally)

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-17 09:32:46 +04:00
Joe Bryan
f6b41754cc arvo: improves move type specialization (by spec'ing incrementally) 2019-10-16 17:30:33 -07:00
Fang
bead92656c
publish: remove unused %disconnect card
It wasn't being used, and wasn't correct in the first place.

(You really want [%publish wire binding:eyre] here.)
2019-10-16 23:41:08 +02:00
Jared Tobin
70ed0d6e98
Merge branch 'philip/jael-fix' (#1827)
* philip/jael-fix:
  jael: retrieve first sponsor instead of last

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-16 10:06:09 +04:00
Jared Tobin
1f8826a8ed
Merge branch 'la-tiscol-fix'
* la-tiscol-fix:
  chat: changed a =: to a =. to fix message storage bug

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-16 09:43:40 +04:00
Jared Tobin
3e44e5155e
Merge branch 'claz-checks' (#1822)
* claz-checks:
  claz: group state check arms together
  claz: factor asserts out of callsites
  claz: check pool sizes when inviting
  claz: check planet availability for %invites
  claz: print proper error messages

Signed-off-by: Jared Tobin <jared@tlon.io>
2019-10-16 09:41:31 +04:00
Philip Monk
6b8d75a88c
jael: retrieve first sponsor instead of last 2019-10-15 18:04:34 -07:00
Logan Allen
2871a964ba chat: changed a =: to a =. to fix message storage bug 2019-10-15 16:16:02 -07:00
Jared Tobin
a5e3ca92b4
tests: disable %ames test-send
This test depends on the ames protocol version, and so should probably
be rewritten.  It's currently holding up a breach, so it's most
expedient to just disable it for the time being.
2019-10-15 23:23:57 +04:00
Jared Tobin
f0a0c66afd
ames: bump protocol version
A last-minute adjustment to the v0.9.0 release to ensure that ships in
the next era don't become haunted by ghosts of the past one.
2019-10-15 22:32:55 +04:00
Jared Tobin
4613264047
release: v0.9.0
Updates URBIT_VERSION, Landscape builds, and all pills.
2019-10-15 14:50:05 +04:00
Fang
a0145ff3db
claz: group state check arms together
In both core and flow. +run-checks sets the stage for future command
legitimacy checks.
2019-10-14 21:54:32 +02:00
Fang
8b37f5fe33
claz: factor asserts out of callsites
We now do them in the relevant functions instead, since we always want
to hard-fail on unexpected/erroneous responses.
2019-10-14 21:52:57 +02:00
Fang
a5564f2860
claz: check pool sizes when inviting 2019-10-14 20:19:17 +02:00
Fang
4a4b592afc
claz: check planet availability for %invites 2019-10-14 17:19:34 +02:00