nothumanallowed 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/ui.mjs +14 -1
- package/src/constants.mjs +1 -1
- package/src/services/web-ui.mjs +46 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "NotHumanAllowed — 38 AI agents, 53 tools. Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, GitHub, Notion, Slack, voice chat, 28 languages. Zero-dependency CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/commands/ui.mjs
CHANGED
|
@@ -1780,7 +1780,20 @@ export async function cmdUI(args) {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
const conv = loadConversation(convId);
|
|
1782
1782
|
if (conv) {
|
|
1783
|
-
|
|
1783
|
+
if (body.isRetry) {
|
|
1784
|
+
// Retry: find the user node and add a new sibling response (fork)
|
|
1785
|
+
const activePath = getHistory(conv);
|
|
1786
|
+
// Find the last user message that matches
|
|
1787
|
+
const userNodes = activePath.filter(m => m.role === 'user' && m.content === msg);
|
|
1788
|
+
const userNode = userNodes[userNodes.length - 1];
|
|
1789
|
+
if (userNode && userNode.id) {
|
|
1790
|
+
addRetryResponse(conv, userNode.id, persistedResponse);
|
|
1791
|
+
} else {
|
|
1792
|
+
addMessages(conv, msg, persistedResponse);
|
|
1793
|
+
}
|
|
1794
|
+
} else {
|
|
1795
|
+
addMessages(conv, msg, persistedResponse);
|
|
1796
|
+
}
|
|
1784
1797
|
}
|
|
1785
1798
|
} catch {}
|
|
1786
1799
|
}
|
package/src/constants.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
7
|
|
|
8
|
-
export const VERSION = '11.0.
|
|
8
|
+
export const VERSION = '11.0.1';
|
|
9
9
|
export const BASE_URL = 'https://nothumanallowed.com/cli';
|
|
10
10
|
export const API_BASE = 'https://nothumanallowed.com/api/v1';
|
|
11
11
|
|
package/src/services/web-ui.mjs
CHANGED
|
@@ -726,34 +726,58 @@ function copyMsg(i){
|
|
|
726
726
|
}
|
|
727
727
|
function retryMsg(i){
|
|
728
728
|
if(i<1||chatHistory[i].role!=='assistant')return;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
// Fork: create a new branch via API
|
|
739
|
-
chatHistory[i].content='Generating alternative...';
|
|
729
|
+
if(chatStreaming)return;
|
|
730
|
+
var userMsg=chatHistory[i-1];
|
|
731
|
+
if(!userMsg||userMsg.role!=='user')return;
|
|
732
|
+
|
|
733
|
+
// Keep the old response — just re-stream a new one
|
|
734
|
+
// The old response stays in the tree as a sibling branch
|
|
735
|
+
chatHistory[i]={role:'assistant',content:'Generating alternative...'};
|
|
740
736
|
renderMessages();
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
})
|
|
737
|
+
|
|
738
|
+
// Stream a new response for the same user message
|
|
739
|
+
chatStreaming=true;
|
|
740
|
+
chatAbortController=new AbortController();
|
|
741
|
+
var streamIdx=i;
|
|
742
|
+
var allHistory=chatHistory.slice(0,i-1).map(function(m){return{role:m.role,content:(m.content||'')};});
|
|
743
|
+
var payload={message:userMsg.content,history:allHistory,conversationId:activeConvId,isRetry:true};
|
|
744
|
+
|
|
745
|
+
fetch(API+'/api/chat/stream',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload),signal:chatAbortController.signal}).then(function(response){
|
|
746
|
+
if(!response.ok||!response.body){chatHistory[streamIdx].content='Error: retry failed';endStreaming();renderMessages();return;}
|
|
747
|
+
var reader=response.body.getReader();var decoder=new TextDecoder();var buffer='';var currentEvent='';
|
|
748
|
+
function pump(){
|
|
749
|
+
reader.read().then(function(result){
|
|
750
|
+
if(result.done){endStreaming();renderMessages();return;}
|
|
751
|
+
buffer+=decoder.decode(result.value,{stream:true});
|
|
752
|
+
var lines=buffer.split('\\n');buffer=lines.pop()||'';
|
|
753
|
+
for(var li=0;li<lines.length;li++){
|
|
754
|
+
var line=lines[li];
|
|
755
|
+
if(line.startsWith('event: ')){currentEvent=line.slice(7).trim();continue;}
|
|
756
|
+
if(!line.startsWith('data: '))continue;
|
|
757
|
+
try{
|
|
758
|
+
var data=JSON.parse(line.slice(6));
|
|
759
|
+
if(currentEvent==='token'&&data.content){
|
|
760
|
+
if(chatHistory[streamIdx].content==='Generating alternative...')chatHistory[streamIdx].content='';
|
|
761
|
+
chatHistory[streamIdx].content+=data.content;
|
|
762
|
+
var el=document.getElementById('chatMessages');
|
|
763
|
+
if(el){var msgs=el.querySelectorAll('.msg');var last=msgs[streamIdx];if(last){var bub=last.querySelector('.msg__bubble');if(bub)bub.textContent=chatHistory[streamIdx].content;}el.scrollTop=el.scrollHeight;}
|
|
764
|
+
}
|
|
765
|
+
if(currentEvent==='tool_synthesis'){chatHistory[streamIdx].content='';renderMessages();}
|
|
766
|
+
if(currentEvent==='done'){endStreaming();if(data.content)chatHistory[streamIdx].content=data.content;renderMessages();loadConvList();}
|
|
767
|
+
if(currentEvent==='error'){endStreaming();chatHistory[streamIdx].content='Error: '+(data.message||'Unknown');renderMessages();}
|
|
768
|
+
}catch(e){}
|
|
769
|
+
}
|
|
770
|
+
pump();
|
|
771
|
+
}).catch(function(e){endStreaming();if(e.name!=='AbortError'){chatHistory[streamIdx].content='Error: '+e.message;renderMessages();}});
|
|
772
|
+
}
|
|
773
|
+
pump();
|
|
774
|
+
}).catch(function(e){endStreaming();chatHistory[streamIdx].content='Error: '+e.message;renderMessages();});
|
|
750
775
|
}
|
|
751
776
|
function editMsg(i){
|
|
752
777
|
if(chatHistory[i].role!=='user')return;
|
|
753
778
|
var inp=document.getElementById('chatInput');if(!inp)return;
|
|
754
779
|
inp.value=chatHistory[i].content;inp.focus();
|
|
755
|
-
//
|
|
756
|
-
// Truncate history to before this message for the new branch
|
|
780
|
+
// Truncate to before this message — new message creates a branch
|
|
757
781
|
chatHistory=chatHistory.slice(0,i);
|
|
758
782
|
renderMessages();
|
|
759
783
|
}
|