gpt-5.6-sol agent harness in 17 lines PHP

tosh1 pts0 comments

smol/smol.php at main · smol-env/smol · GitHub

//blob/show" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Uh oh!

There was an error while loading. Please reload this page.

smol-env

smol

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star<br>78

FilesExpand file tree

main

/smol.php

Copy path

Blame<br>More file actions

Blame<br>More file actions

Latest commit

History<br>History<br>History

17 lines (17 loc) · 889 Bytes

main

/smol.php

Copy path

Top

File metadata and controls<br>Code

Blame

17 lines (17 loc) · 889 Bytes

Raw<br>Copy raw file<br>Download raw file

Open symbols panelEdit and raw actions

10<br>11<br>12<br>13<br>14<br>15<br>16<br>17

$u=$argv[1];$x=[];$k=bin2hex(random_bytes(16));

while(fwrite(STDOUT,"> ")&&($s=fgets(STDIN))!==false){

if(!strlen(trim($s)))continue;

$x[]=["role"=>"user","content"=>rtrim($s,"\r\n")];

while(1){

$b=json_encode(["model"=>"gpt-5.6-sol","input"=>$x,"tools"=>[["type"=>"custom","name"=>"sh"]]]);

$r=json_decode(file_get_contents($u,0,stream_context_create(["http"=>[

"method"=>"POST","header"=>"Content-Type: application/json\r\nsession_id: $k","content"=>$b

]])),1);$o=$r["output"];array_push($x,...$o);$c=0;

foreach($o as $i)if($i["type"]=="custom_tool_call"){

$c=1;$q=[];exec("/bin/sh -c ".escapeshellarg($i["input"])." 2>&1",$q,$n);

$x[]=["type"=>"custom_tool_call_output","call_id"=>$i["call_id"],"output"=>"exit $n\n".implode("\n",$q)];

if(!$c){$i=end($o);printf("%s\n[%05.2f%%]\n",$i["content"][0]["text"],$r["usage"]["total_tokens"]/10500);break;}

You can’t perform that action at this time.

smol file content type reload lines

Related Articles