Merge remote-tracking branches 'ohaitch/no-talk-stack-traces', 'galenwp/rage-factor', 'galenwp/sur', 'galenwp/hello', 'galenwp/talk-exo' and 'ohaitch/say-code'

Simple ~& of stack traces, not talk routing
Remove code to other repositories
Rename dojo 'arc' to 'sur'
+hello 'world' now forwards
Talk frontend bugfixes
+code as a %say
This commit is contained in:
Raymond Pasco 2016-04-05 15:15:01 -04:00
16 changed files with 47 additions and 575 deletions

View File

@ -18,7 +18,7 @@
$: say/sole-share :: command-line state
dir/beam :: active path
poy/(unit dojo-project) :: working
{lib/(list hoof) arc/(list hoof)} :: lib+sur
{lib/(list hoof) sur/(list hoof)} :: lib+sur
var/(map term cage) :: variable state
old/(set term) :: used TLVs
buf/tape :: multiline buffer
@ -154,7 +154,7 @@
::
;~ pfix fas
;~ pose
(dp-variable (cold %arc hep) ;~(pfix gap dp-hooves))
(dp-variable (cold %sur hep) ;~(pfix gap dp-hooves))
(dp-variable (cold %lib lus) ;~(pfix gap dp-hooves))
==
==
@ -428,7 +428,7 @@
?+ p.mad .
$?($eny $now $our) !!
$lib .(lib ~)
$arc .(arc ~)
$sur .(sur ~)
$dir .(dir [[our.hid %home ud+0] /])
==
=+ cay=(~(got by rez) p.q.mad)
@ -442,7 +442,7 @@
$now ~|(%time-is-immutable !!)
$our ~|(%self-is-immutable !!)
$lib .(lib ((dy-cast (list hoof) !>(*(list hoof))) q.cay))
$arc .(arc ((dy-cast (list hoof) !>(*(list hoof))) q.cay))
$sur .(sur ((dy-cast (list hoof) !>(*(list hoof))) q.cay))
$dir =+ ^= pax ^- path
=+ pax=((dy-cast path !>(*path)) q.cay)
?: ?=($~ pax) ~[(scot %p our.hid) %home '0']
@ -754,7 +754,7 @@
=- ?~(too - [%cast u.too -])
:+ %ride gen
:- [%$ dy-twig-head]
[%plan he-beam blob+** [zuse arc lib ~ ~]]
[%plan he-beam blob+** [zuse sur lib ~ ~]]
::
++ dy-step :: advance project
|= nex/@ud

View File

@ -1,282 +0,0 @@
:: Three ways we interactg with this app
:: 1. .^(%gx /=gh=/endpoint)
:: 2. [%peer [our %gh] /endpoint]
:: 3. :gh &gh-poke %post /gists json-data
:: This is a driver for the Github API v3.
::
:: You can interact with this in a few different ways:
::
:: - .^(%gx /=gh=/read{/endpoint}) or subscribe to
:: /scry/x/read{/endpoint} for authenticated reads.
::
:: - subscribe to /scry/x/listen/{owner}/{repo}/{events...}
:: for webhook-powered event notifications. For event list,
:: see https://developer.github.com/webhooks/.
::
:: See the%github app for example usage.
::
/? 314
/- rfc, gmail-label, gmail-message
/+ http
::::
/= rfctext /: /%/rfc /txt/
::
// /%/split
::/- gmail
:: /ape/gh/split.hoon defines ++split, which splits a request
:: at the end of the longest possible endpoint.
::
=> |% :: => only used for indentation
++ move (pair bone card)
++ subscription-result
$% {$arch arch}
{$json json}
{$null $~}
{$inbox (list {message-id/@t thread-id/@t})}
{$message from/@t subject/@t}
==
++ card
$% {$diff subscription-result}
{$hiss wire {$~ $~} $httr {$hiss hiss}}
==
++ easy-ot |*({key/@t parser/fist:jo} =+(jo (ot [key parser] ~)))
++ ofis-google :: XX broken
=- |=(a/cord (rash a fel))
=< fel=(cook |~(a/@ `@t`(swap 3 a)) (bass 64 .))
=- (cook welp ;~(plug (plus siw) (stun 0^2 (cold %0 tis))))
^= siw
;~ pose
(cook |=(a/@ (sub a 'A')) (shim 'A' 'Z'))
(cook |=(a/@ (sub a 'G')) (shim 'a' 'z'))
(cook |=(a/@ (add a 4)) (shim '0' '9'))
(cold 62 (just '-'))
(cold 63 (just '_'))
==
--
::
|_ $: hid/bowl count/@
web-hooks/(map @t {id/@t listeners/(set bone)})
received-ids/(list @t)
==
:: We can't actually give the response to pretty much anything
:: without blocking, so we just block unconditionally.
::
++ prep ~& 'prep' _`. ::
::
++ peek
|= {ren/@tas pax/path}
^- (unit (unit (pair mark *)))
~
::
++ peer-scry
|= pax/path
^- {(list move) _+>.$}
?> ?=({care ^} pax) :: assert %u
=> (help i.pax i.t.pax t.t.pax)
=> scry
%= make-move
count +(count)
==
::
++ poke-gmail-req
|= $: method/meth endpoint/path quy/quay
mes/message:rfc
:: label-req:gmail-label
==
^- {(list move) _+>.$}
?> ?=(valid-get-endpoint endpoint)
:_ +>.$ :_ ~
^- move
:* ost.hid %hiss /poke/[method] `~ %httr %hiss
^- purl
:+ [& ~ [%& /com/googleapis/www]]
[~ gmail+v1+users+me+`valid-get-endpoint`endpoint]
`quay`[[%alt %json] ~]
::
:+ method `math`(malt ~[content-type+['application/json']~])
=+ hoon-json-object=(joba %raw s+(message-to-rfc822:rfc mes))
=+ request-body=(tact (pojo hoon-json-object))
(some request-body)
::(some (pojo label-req-to-json:gmail-label label-req:gmail-label ~)) XX
==
::
:: HTTP response. We make sure the response is good, then
:: produce the result (as JSON) to whoever sent the request.
::
++ sigh-httr
|= {wir/wire res/httr}
^- {(list move) _+>.$}
:: ~& wir+wir
?. ?=({care @ @ @ *} wir)
:: pokes don't return anything
~& poke+res
[~ +>.$]
=+ arg=(path (cue (slav %uv i.t.t.wir)))
:: ~& ittwir+i.t.t.wir
:_ +>.$ :_ ~
:+ ost.hid %diff
?+ i.wir null+~
$x
?~ r.res
json+(jobe err+s+%empty-response code+(jone p.res) ~)
=+ jon=(rush q.u.r.res apex:poja)
?~ jon
json+(jobe err+s+%bad-json code+(jone p.res) body+s+q.u.r.res ~)
?. =(2 (div p.res 100))
json+(jobe err+s+%request-rejected code+(jone p.res) msg+u.jon ~)
::
:: Once we know we have good data, we drill into the JSON
:: to find the specific piece of data referred to by 'arg'
::
|- ^- subscription-result
?~ arg
=+ switch=t.t.t.t.wir
?+ switch [%json `json`u.jon]
{$messages $~}
=+ new-mezes=((ot messages+(ar (ot id+so 'threadId'^so ~)) ~):jo u.jon)
::%+ turn new-mezes
::|= id
::?< ?=($~ new-mezes)
::=. received-ids [new-mezes received-ids]
::~& received-ids
::=. received
[%inbox (need new-mezes)]
::
{$messages @t $~}
::
:: =+ body-parser==+(jo (ot body+(ot data+(cu ofis-google so) ~) ~)) :: (ok /body/data so):jo
:: ~& %.(u.jon (om (om |=(a/json (some -.a))):jo))
:: ~& %.(u.jon (ot headers+(cu milt (ar (ot name+so value+so ~))) ~))
=+ ^- $: headers/{from/@t subject/@t}
::body-text/wain
==
~| u.jon
=- (need (reparse u.jon))
^= reparse
=+ jo
=+ ^= from-and-subject
|= a/(map @t @t) ^- {@t @t}
[(~(got by a) 'From') (~(got by a) 'Subject')]
=+ ^= text-body
|= a/(list {@t @t}) ^- wain
%- lore
%- ofis-google
(~(got by (~(gas by *(map @t @t)) a)) 'text/plain')
%+ easy-ot %payload
%- ot :~
headers+(cu from-and-subject (cu ~(gas by *(map @t @t)) (ar (ot name+so value+so ~))))
:: parts+(cu text-body (ar (ot 'mimeType'^so body+(ot data+so ~) ~)))
==
:: =+ parsed-headers==+(jo ((ot payload+(easy-ot 'headers' (ar some)) ~) u.jon)) ::
:: =+ parsed-message==+(jo ((ot payload+(easy-ot 'parts' (ar body-parser)) ~) u.jon)) ::
::~& [headers body-text]
::=+ body==+(jo ((ot body+(easy-ot 'body' (easy-ot 'data' so))) parsed-message))
[%message headers]
==
=+ dir=((om:jo some) u.jon)
?~ dir json+(jobe err+s+%no-children ~)
=+ new-jon=(~(get by u.dir) i.arg)
`subscription-result`$(arg t.arg, u.jon ?~(new-jon ~ u.new-jon))
:: redo with next argument
::
$y
?~ r.res
~& [err+s+%empty-response code+(jone p.res)]
arch+*arch
=+ jon=(rush q.u.r.res apex:poja)
?~ jon
~& [err+s+%bad-json code+(jone p.res) body+s+q.u.r.res]
arch+*arch
?. =(2 (div p.res 100))
~& [err+s+%request-rejected code+(jone p.res) msg+u.jon]
arch+*arch
::
:: Once we know we have good data, we drill into the JSON
:: to find the specific piece of data referred to by 'arg'
::
|- ^- subscription-result
=+ dir=((om:jo some) u.jon)
?~ dir
[%arch `(shax (jam u.jon)) ~]
?~ arg
[%arch `(shax (jam u.jon)) (~(run by u.dir) $~)]
=+ new-jon=(~(get by u.dir) i.arg)
$(arg t.arg, u.jon ?~(new-jon ~ u.new-jon))
==
++ sigh
|= a/*
~& a+a
:_ +>.$ ~
::
++ help
|= {ren/care style/@tas pax/path}
=^ query pax
=+ xap=(flop pax)
?~ xap [~ ~]
=+ query=(rush i.xap ;~(pfix wut yquy:urlp))
?~ query [~ pax]
[u.query (flop t.xap)]
=^ arg pax ~|(pax [+ -]:(split pax))
~| [pax=pax arg=arg query=query]
=| mow/(list move)
|%
:: Resolve core
::
++ make-move
^- {(list move) _+>.$}
[(flop mow) +>.$]
::
++ endpoint-to-purl
|= endpoint/path
^- purl
%+ scan
"https://www.googleapis.com/gmail/v1/users/me{<`path`endpoint>}"
auri:epur
:: Send an HTTP req
++ send-http
|= hiz/hiss
^+ +>
=+ wir=`wire`[ren (scot %ud count) (scot %uv (jam arg)) style pax]
=+ new-move=[ost.hid %hiss wir `~ %httr [%hiss hiz]]
+>.$(mow [new-move mow])
::
++ scry
^+ .
?+ style ~|(%invalid-style !!)
$read read
:: $listen listen
==
:: Standard GET request
++ read (send-http (endpoint-to-purl pax) %get ~ ~)
:: Subscription request
:: ++ listen
:: ^+ .
:: =+ events=?>(?=([@ @ *] pax) t.t.pax)
:: |- ^+ +>.$
:: ?~ events
:: +>.$
:: ?: (~(has by web-hooks) i.events) :: if hook exists
:: =. +>.$ (update-hook i.events)
:: $(events t.events)
:: =. +>.$ (create-hook i.events)
:: $(events t.events)
::
--
--

View File

@ -1,6 +0,0 @@
From: urbit-test@gmail.com
To: jhenry.ault@gmail.com
Subject: As basic as it gets
This is the plain text body of the message. Note the blank line
between the header information and the body of the message.

View File

@ -1,71 +0,0 @@
!:
|%
:: Splits a path into the endpoint prefix and the remainder,
:: which is assumed to be a path within the JSON object. We
:: choose the longest legal endpoint prefix.
::
++ split
|= pax/path
:: =- ~& [%pax pax - (valid-endpoint pax)] -
=+ l=(lent pax)
|- ^- {path path}
?: ?=(valid-get-endpoint (scag l pax))
[(scag l pax) (slag l pax)]
?~ l
~& %bad-endpoint
~|(%bad-endpoint !!)
$(l (dec l))
::
:: These are all the github GET endpoints, sorted with
:: `env LC_ALL=C sort`
::
:: end-points include required query parameters
++ valid-get-endpoint
$? {$drafts id/@t $~}
{$drafts $~}
{$history $~}
{$labels id/@t $~}
{$labels $~}
{$messages id/@t $attachments id/@t $~}
{$messages id/@t $~}
{$messages $~}
{$profile $~}
{$threads id/@t $~}
{$threads $~}
==
++ vaild-post-endpoint
$? {$drafts $send $~}
{$drafts $~}
{$messages id/@t $modify $~}
{$messages id/@t $trash $~}
{$messages id/@t $untrash $~}
{$messages $import $~}
{$messages $send $~}
{$messages $~}
{$labels $~}
{$threads id/@t $trash $~}
{$threads id/@t $untrash $~}
{$threads id/@t $modify}
{$stop $~}
{$watch $~}
==
++ valid-delete-endpoint
$? {$drafts id/@t $~}
{$labels id/@t $~}
{$messages id/@t $~}
{$thread id/@t $~}
==
++ valid-put-endpoint
$? {$drafts id/@t $~}
{$labels id/@t $~}
==
++ valid-patch-endpoint
$? {$labels id/@t $~}
==
--
::

View File

@ -1,90 +0,0 @@
::
:::: /hoon/change/gen
::
/? 310
::
::::
!:
:- %say
|= *
:- %noun
=- %+ turn -
|= {a/@tas b/@tas}
?: |
^- @ta
%- crip
;: weld
"s/\\$"
(trip a)
"/"
"?($"
(trip a)
" $"
(trip b)
")"
"/g"
==
?: |
^- @ta
%- crip
;: weld
"s/%"
(trip a)
"/"
"%"
(trip b)
"/g"
==
?: &
^- @ta
%- crip
;: weld
"s/\\?(\\$"
(trip a)
" \\$"
(trip b)
")/$"
(trip b)
"/g"
==
!!
^- (list (pair @tas @tas))
:~ [%flap %claw] :: used in ames
[%slug %shoe]
[%rack %bank]
[%gate %lamb]
[%lock %gill]
:: [%lamp %gate] reused
[%bud %scon]
[%qua %conq]
[%dub %cons]
[%tri %cont] :: collides with %trip
[%ray %conl]
[%all %conp]
[%cold %bunt] :: parser jet
[%quid %calq]
[%quip %calt]
[%with %open]
:: [%kick %nock] reused; used in ames
[%live %poll] :: also a hint
[%show %dump] :: used in %ames
:: [%fate %show] reused
[%germ %ddup] :: also a hint
[%type %peep]
[%fly %fix]
[%ram %rev] :: also %ramp
[%eat %sip]
[%has %pin]
[%saw %nip]
[%dig %ifcl] :: %digitalocean in ape/cloud
[%nay %deny]
[%aye %sure]
[%deal %deft] :: used in all vanes
[%dab %ifat]
[%non %ifno] :: also %none
[%fit %fits] :: also %fitz
[%nock %code] :: reused
==

View File

@ -1,17 +1,14 @@
::
:::: /hoon/code/gen
::
/- sole
=+ sole
:- %ask
:- %say
|= $: {now/@da eny/@uvI bec/beak}
$~
$~
==
^- (sole-result)
%+ sole-yo
:- %leaf
%+ slag 1
%+ scow %p
.^(@p %a /(scot %p p.bec)/code/(scot %da now)/(scot %p p.bec))
sole-no
:- %tang
:_ ~
:- %leaf
%+ slag 1
%+ scow %p
.^(@p %a /(scot %p p.bec)/code/(scot %da now)/(scot %p p.bec))

View File

@ -1,18 +0,0 @@
::
:::: /hoon/list/gmail/gen
::
/? 310
::
::::
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
arg/$@($~ {number/@u $~})
$~
==
?~ arg $(arg [5 ~])
:- %noun
%+ turn (scag number.arg .^((list {@t @t}) %gx /=gmail=/read/messages))
|= {message-id/@t thread-id/@t}
=+ .^({from/@t subject/@t} %gx /=gmail=/read/messages/[message-id])
[from=from (trip subject)]

View File

@ -1,14 +0,0 @@
::
:::: /hoon/send/gmail/gen
::
/? 310
/- rfc
:- %say
|= {^ {to/tape subject/tape $~} _from="urbit-test@gmail.com"}
:- %gmail-req
:^ %post /messages/'send' ~['uploadType'^'simple']
^- message:rfc
=+ parse-adr=;~((glue pat) (cook crip (star ;~(less pat next))) (cook crip (star next)))
:+ (scan from parse-adr)
(scan to parse-adr)
[(crip subject) '']

View File

@ -8,4 +8,4 @@
:- %say
|= {^ {{txt/@tas $~} $~}}
:- %noun
(crip (weld "hello, " (flop (trip txt))))
(crip (weld "hello, " (trip txt)))

View File

@ -1,12 +0,0 @@
::
:::: /hoon/invite/hood/gen
::
/? 310
::
::::
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
{{who/@p myl/@t $~} $~}
==
[%helm-invite who myl]

View File

@ -1,6 +0,0 @@
::
:::: /hoon/make/gen
::
/? 310
:- %say
|=({^ arg/(list @) foo/_`@`1 bar/_`@`2} noun+[arg foo bar])

View File

@ -475,7 +475,10 @@
++ se-talk
|= tac/(list tank)
^+ +>
(se-emit 0 %poke /drum/talk [our %talk] (said:talk our %drum now eny tac))
:: XX talk should be usable for stack traces, see urbit#584 which this change
:: closed for the problems there
((slog (flop tac)) +>)
::(se-emit 0 %poke /drum/talk [our %talk] (said:talk our %drum now eny tac))
::
++ se-text :: return text
|= txt/tape

View File

@ -1,8 +0,0 @@
/- rfc, gmail-label
|_ {method/meth endpoint/path query/quay mes/?(message:rfc label-req:gmail-label)} :: jon=(unit json)]
++ grab
|%
++ noun {method/meth endpoint/path query/quay mes/?(message:rfc label-req:gmail-label)}:: jon=(unit json)]
--
--

View File

@ -1,34 +0,0 @@
:: This structure is the hoon equivalent of the labels resource used by the
:: gmail api
|%
++ label-list-visibility
$? $'labelHide' :: Do not show the label in the label list
$'labelShow' :: Show the label in the label list. (Default)
$'labelShowIfUnread' :: Show the label if any unread msgs w/that label.
==
++ message-list-visibility
$? $hide :: Do not show the label in the message list.
$show :: Show the label in the message list. (Default)
==
--
|%
:: label request is the body of the post request you send to gmail to create
:: a labels resource
++ label-req {llv/label-list-visibility mlv/message-list-visibility name/@t}
:: the label resource returned by gmail in response to your successful request
++ label *
++ label-req-to-json
|= label-req
%- jobe :^
['name' `json`s+name]
['labelListVisibility' `json`s+(crip (sifo `cord`llv))]
['messageListVisibility' `json`s+(crip (sifo `cord`mlv))]
~
--

View File

@ -1 +0,0 @@
{to/@p subj/@t body/wain}

View File

@ -6,22 +6,20 @@ div.input.valid-false {
color: #FF0808;
border-color: #FF0808; }
div.meta {
display: inline-block; }
div.grams {
.grams {
list-style-type: none;
padding: 0;
margin-top: -1.875rem; }
.grams .meta {
display: inline-block; }
div.meta label {
background-color: #B1B7BD;
.grams .meta label {
margin-right: 0.9375rem;
height: 0.9375rem;
width: 0.9375rem;
text-align: center; }
div.meta label:before {
.grams .meta label:before {
content: attr(data-glyph);
color: #fff;
font-family: 'scp';
@ -30,24 +28,24 @@ div.meta label:before {
line-height: 1rem;
vertical-align: middle; }
div.meta label,
div.meta h2,
div.meta h3 {
.grams .meta label,
.grams .meta h2,
.grams .meta h3 {
display: inline-block; }
div.meta h2,
div.meta h3 {
.grams .meta h2,
.grams .meta h3 {
font-family: 'scp';
font-size: .8rem;
font-weight: 400;
margin-top: 0;
padding-top: 0; }
div.meta h3 {
.grams .meta h3 {
margin-left: 2rem;
line-height: 1rem; }
div.meta .time {
.grams .meta .time {
padding-right: 2rem; }
div.gram.first:first-of-type {
@ -71,8 +69,11 @@ div.gram.same:hover div.meta {
.exp {
font-family: 'scp';
font-size: .9rem;
max-height: 2rem; }
font-size: .9rem; }
.exp .speech {
white-space: nowrap;
max-width: 100%;
overflow-x: scroll; }
.exp .speech > span {
color: #fff;
background-color: #000;
@ -89,6 +90,19 @@ div.gram.same:hover div.meta {
background-color: #000;
color: #fff; }
.comment .speech a.btn {
background-color: transparent;
color: #B1B7BD;
font-size: .9rem;
border: 0;
border-bottom: 3px solid #b1b7bd;
text-transform: none;
text-decoration: none;
padding: 0;
line-height: 1rem;
margin: 1rem 0 2rem 0;
letter-spacing: 0; }
.gram pre {
background-color: transparent; }