Conversation
…into ja/hoon-eval
Co-authored-by: fang <git@fang.io>
Co-authored-by: fang <git@fang.io>
|
@Fang- said the slop is fine. Since this has to wait for the back-end to update before the client, let's hold for now. |
Fang-
left a comment
There was a problem hiding this comment.
fang said the slop is fine
Yeah but I haven't reviewed your changes yet. (;
| :: handle both CLI [~ cord] and HTTP cord | ||
| =+ !<(arg-data=?(~ [~ cord]) arg) | ||
| =/ input=cord | ||
| ?~ arg-data '' | ||
| +.arg-data |
There was a problem hiding this comment.
I don't think the !< is right? Isn't it always going to be [~ cord]? The empty string default doesn't make sense anyway, that'll syntax error.
| :: handle both CLI [~ cord] and HTTP cord | |
| =+ !<(arg-data=?(~ [~ cord]) arg) | |
| =/ input=cord | |
| ?~ arg-data '' | |
| +.arg-data | |
| :: unpack arg with leading ~ | |
| :: | |
| =+ !<([~ input=cord] arg) |
| :: /sur/eval.hoon | ||
| :: | ||
| |% | ||
| +$ eval-output (each cord cord) | ||
| -- |
There was a problem hiding this comment.
Coin-toss on whether it makes sense to have a file for this one definition lol. Fine as-is, but it is funny.
| ?- -.toon | ||
| %0 | ||
| =/ result=tape | ||
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) |
There was a problem hiding this comment.
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | |
| (of-wall:format (wash [0 80] (sell type.p.minted p.toon))) |
I guess I should also give a heads-up that the outer +of-walls throughout the file will append trailing newlines. If that's objectionable you'll want to (zing (join "\0a" the-walls)) instead, to only insert newlines in between the lines.
| %0 | ||
| =/ result=tape | ||
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | ||
| [%& (crip result)] |
There was a problem hiding this comment.
Kingside or queenside formatting for ?-, take your pick. (For %2 too.)
| %0 | |
| =/ result=tape | |
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | |
| [%& (crip result)] | |
| %0 | |
| =/ result=tape | |
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | |
| [%& (crip result)] | |
| :: |
| %0 | |
| =/ result=tape | |
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | |
| [%& (crip result)] | |
| %0 =/ result=tape | |
| (of-wall:format (~(win re (sell type.p.minted p.toon)) 0 80)) | |
| [%& (crip result)] |
| ?- -.eval-output | ||
| %& (pairs:enjs:format ~[['status' s+'ok'] ['output' s+p.eval-output]]) | ||
| %| (pairs:enjs:format ~[['status' s+'error'] ['output' s+p.eval-output]]) | ||
| == |
There was a problem hiding this comment.
Previous implementation was fine structurally, just needed to swap out the status value.
| ?- -.eval-output | |
| %& (pairs:enjs:format ~[['status' s+'ok'] ['output' s+p.eval-output]]) | |
| %| (pairs:enjs:format ~[['status' s+'error'] ['output' s+p.eval-output]]) | |
| == | |
| %- pairs:enjs:format | |
| :~ ['status' ?-(-.eval-output %& s+'ok', %| s+'error')] | |
| ['output' s+p.eval-output] | |
| == |
This PR resurrects the inline Hoon evaluation feature from the old Landscape (pkg/landscape in urbit/urbit) and adapts it for the modern environment.
This is feature-flagged for now and will require a lockstep update to both the back-end and the client.
Original PR made by @wca4a's Clawdbot implementation in #5428
Plan here: https://gist.github.com/wca4a/4274ee015c5de2ca320a5c67da92cf4d
Changes
Ship-side (Hoon)
/ted/eval.hoon- Spider thread that evaluates Hoon code in a sandboxed environment/sur/eval.hoon- Structures for eval input/output/mar/eval/input.hoonand/mar/eval/output.hoon- Marks for JSON serializationUI (TypeScript/React)
evalApi.ts- API function to call the eval threadBareChatInput/index.tsx- Added eval mode state and handlingMessageInputBase.tsx- Added eval mode toggle button (Code icon)How it works
/ted/evalspider threadSecurity Model
[our now eny ..zuse]in the subject.^) is disabled - returns crash if attemptedmulefor double-virtualization to catch crashesScreenshots / videos