diff --git a/pkg/arvo/lib/stdio.hoon b/pkg/arvo/lib/stdio.hoon index 4164263be..1c8a840a1 100644 --- a/pkg/arvo/lib/stdio.hoon +++ b/pkg/arvo/lib/stdio.hoon @@ -62,6 +62,25 @@ :: :: ---- :: +:: Scry from the namespace. +:: +:: Direct scrys are impossible in a tapp, so this routes around that. +:: +++ scry + |* result-type=mold + |= =path + =/ m (async ,result-type) + ;< ~ bind:m (send-raw-card %scry path) + |= =async-input + :^ ~ ~ ~ + ?~ in.async-input + [%wait ~] + ?. ?=(%scry-result -.sign.u.in.async-input) + [%fail %expected-scry-result >got=-.sign< ~] + [%done (result-type result.sign.u.in.async-input)] +:: +:: ---- +:: :: Outgoing HTTP requests :: ++ send-request diff --git a/pkg/arvo/lib/tapp.hoon b/pkg/arvo/lib/tapp.hoon index b91cbb150..54ac02a8e 100644 --- a/pkg/arvo/lib/tapp.hoon +++ b/pkg/arvo/lib/tapp.hoon @@ -428,6 +428,9 @@ |= =async-input:async-lib ^- (quip move _this-tapp) =/ m tapp-async + =| moves=(list move) + =| scrys=(list path) + |- ^- (quip move _this-tapp) ?~ active ~| %no-active-async ~| ?~ in.async-input @@ -442,14 +445,27 @@ %& p.out %| [[~ [%fail contracts.u.active %crash p.out]] u.active] == + =. moves (weld moves (skip moves.r |=(=move =(%scry -.q.move)))) + =. scrys + %+ weld scrys + ^- (list path) + %+ murn moves.r + |= =move + ^- (unit path) + ?. ?=(%scry -.q.move) + ~ + `path.q.move + ?^ scrys + =/ scry-result .^(* i.scrys) + $(scrys t.scrys, in.async-input `[i.scrys %scry-result scry-result]) => .(active `(unit eval-form:eval:tapp-async)`active) :: TMI - =^ moves=(list move) this-tapp + =^ final-moves=(list move) this-tapp ?- -.eval-result.r %next `this-tapp %fail (fail-async [contracts err]:eval-result.r) %done (done-async [contracts value]:eval-result.r) == - [(weld moves.r moves) this-tapp] + [(weld moves final-moves) this-tapp] :: :: Fails currently-running async :: diff --git a/pkg/arvo/sur/tapp.hoon b/pkg/arvo/sur/tapp.hoon index c9eaff021..20569e4f8 100644 --- a/pkg/arvo/sur/tapp.hoon +++ b/pkg/arvo/sur/tapp.hoon @@ -4,7 +4,8 @@ :: Possible async calls :: +$ card - $% [%wait wire @da] + $% [%scry =path] + [%wait wire @da] [%rest wire @da] [%poke wire dock poke-data] [%peer wire dock path] @@ -24,7 +25,8 @@ :: Possible async responses :: +$ sign - $% [%wake error=(unit tang)] + $% [%scry-result result=*] + [%wake error=(unit tang)] [%coup =dock error=(unit tang)] [%quit =dock =path] [%reap =dock =path error=(unit tang)]