@theihtisham/agent-shadow-brain 7.1.4 → 7.22.0
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/CHANGELOG.md +478 -462
- package/README.md +97 -24
- package/dist/brain/auto-update.js +1 -1
- package/dist/brain/auto-update.js.map +1 -1
- package/dist/brain/brain-portability.js +1 -1
- package/dist/brain/brain-portability.js.map +1 -1
- package/dist/brain/client-integrations.js +1 -1
- package/dist/brain/client-integrations.js.map +1 -1
- package/dist/brain/context-assembly.d.ts +10 -0
- package/dist/brain/context-assembly.d.ts.map +1 -1
- package/dist/brain/context-assembly.js +15 -6
- package/dist/brain/context-assembly.js.map +1 -1
- package/dist/brain/context-efficiency.d.ts +48 -0
- package/dist/brain/context-efficiency.d.ts.map +1 -0
- package/dist/brain/context-efficiency.js +34 -0
- package/dist/brain/context-efficiency.js.map +1 -0
- package/dist/brain/context-request.d.ts +1 -1
- package/dist/brain/context-request.d.ts.map +1 -1
- package/dist/brain/context-request.js +4 -2
- package/dist/brain/context-request.js.map +1 -1
- package/dist/brain/context-retrieval.d.ts +1 -1
- package/dist/brain/context-retrieval.d.ts.map +1 -1
- package/dist/brain/context-retrieval.js +2 -1
- package/dist/brain/context-retrieval.js.map +1 -1
- package/dist/brain/feature-settings.d.ts +5 -0
- package/dist/brain/feature-settings.d.ts.map +1 -1
- package/dist/brain/feature-settings.js +8 -2
- package/dist/brain/feature-settings.js.map +1 -1
- package/dist/brain/global-brain.d.ts +1 -1
- package/dist/brain/global-brain.d.ts.map +1 -1
- package/dist/brain/global-brain.js +1 -0
- package/dist/brain/global-brain.js.map +1 -1
- package/dist/brain/managed-project-skills.d.ts +48 -0
- package/dist/brain/managed-project-skills.d.ts.map +1 -0
- package/dist/brain/managed-project-skills.js +230 -0
- package/dist/brain/managed-project-skills.js.map +1 -0
- package/dist/brain/mcp-presence.d.ts +50 -0
- package/dist/brain/mcp-presence.d.ts.map +1 -0
- package/dist/brain/mcp-presence.js +214 -0
- package/dist/brain/mcp-presence.js.map +1 -0
- package/dist/brain/mcp-server.d.ts +12 -0
- package/dist/brain/mcp-server.d.ts.map +1 -1
- package/dist/brain/mcp-server.js +177 -31
- package/dist/brain/mcp-server.js.map +1 -1
- package/dist/brain/mcp-stdio.d.ts +1 -1
- package/dist/brain/mcp-stdio.d.ts.map +1 -1
- package/dist/brain/mcp-stdio.js +19 -1
- package/dist/brain/mcp-stdio.js.map +1 -1
- package/dist/brain/memory-annotations.d.ts +2 -0
- package/dist/brain/memory-annotations.d.ts.map +1 -1
- package/dist/brain/memory-annotations.js +13 -0
- package/dist/brain/memory-annotations.js.map +1 -1
- package/dist/brain/memory-inspection.d.ts +1 -0
- package/dist/brain/memory-inspection.d.ts.map +1 -1
- package/dist/brain/memory-inspection.js +1 -1
- package/dist/brain/memory-inspection.js.map +1 -1
- package/dist/brain/memory-mcp-content.d.ts +4 -2
- package/dist/brain/memory-mcp-content.d.ts.map +1 -1
- package/dist/brain/memory-mcp-content.js +20 -16
- package/dist/brain/memory-mcp-content.js.map +1 -1
- package/dist/brain/model-registry.d.ts +4 -5
- package/dist/brain/model-registry.d.ts.map +1 -1
- package/dist/brain/model-registry.js +22 -207
- package/dist/brain/model-registry.js.map +1 -1
- package/dist/brain/model-usage.d.ts +66 -0
- package/dist/brain/model-usage.d.ts.map +1 -0
- package/dist/brain/model-usage.js +246 -0
- package/dist/brain/model-usage.js.map +1 -0
- package/dist/brain/native-codex.d.ts +105 -0
- package/dist/brain/native-codex.d.ts.map +1 -0
- package/dist/brain/native-codex.js +292 -0
- package/dist/brain/native-codex.js.map +1 -0
- package/dist/brain/native-session-import.d.ts +56 -0
- package/dist/brain/native-session-import.d.ts.map +1 -0
- package/dist/brain/native-session-import.js +307 -0
- package/dist/brain/native-session-import.js.map +1 -0
- package/dist/brain/orchestrator.js +1 -1
- package/dist/brain/orchestrator.js.map +1 -1
- package/dist/brain/project-feedback.d.ts +1 -1
- package/dist/brain/project-feedback.d.ts.map +1 -1
- package/dist/brain/project-feedback.js +19 -8
- package/dist/brain/project-feedback.js.map +1 -1
- package/dist/brain/project-hub-contract.d.ts +6 -0
- package/dist/brain/project-hub-contract.d.ts.map +1 -1
- package/dist/brain/project-hub-contract.js +2 -1
- package/dist/brain/project-hub-contract.js.map +1 -1
- package/dist/brain/project-hub-mcp.d.ts +14 -0
- package/dist/brain/project-hub-mcp.d.ts.map +1 -1
- package/dist/brain/project-hub-mcp.js +6 -1
- package/dist/brain/project-hub-mcp.js.map +1 -1
- package/dist/brain/project-hub-store.d.ts +14 -2
- package/dist/brain/project-hub-store.d.ts.map +1 -1
- package/dist/brain/project-hub-store.js +70 -2
- package/dist/brain/project-hub-store.js.map +1 -1
- package/dist/brain/project-hub.d.ts +5 -0
- package/dist/brain/project-hub.d.ts.map +1 -1
- package/dist/brain/project-hub.js +23 -1
- package/dist/brain/project-hub.js.map +1 -1
- package/dist/brain/project-kit.d.ts +10 -0
- package/dist/brain/project-kit.d.ts.map +1 -1
- package/dist/brain/project-kit.js +80 -16
- package/dist/brain/project-kit.js.map +1 -1
- package/dist/brain/project-policy-delivery.d.ts +8 -0
- package/dist/brain/project-policy-delivery.d.ts.map +1 -0
- package/dist/brain/project-policy-delivery.js +38 -0
- package/dist/brain/project-policy-delivery.js.map +1 -0
- package/dist/brain/project-policy.d.ts +88 -0
- package/dist/brain/project-policy.d.ts.map +1 -0
- package/dist/brain/project-policy.js +267 -0
- package/dist/brain/project-policy.js.map +1 -0
- package/dist/brain/project-session-contract.d.ts +180 -0
- package/dist/brain/project-session-contract.d.ts.map +1 -0
- package/dist/brain/project-session-contract.js +50 -0
- package/dist/brain/project-session-contract.js.map +1 -0
- package/dist/brain/project-session-mcp.d.ts +145 -0
- package/dist/brain/project-session-mcp.d.ts.map +1 -0
- package/dist/brain/project-session-mcp.js +58 -0
- package/dist/brain/project-session-mcp.js.map +1 -0
- package/dist/brain/project-sessions.d.ts +97 -0
- package/dist/brain/project-sessions.d.ts.map +1 -0
- package/dist/brain/project-sessions.js +223 -0
- package/dist/brain/project-sessions.js.map +1 -0
- package/dist/brain/project-source-contract.d.ts +109 -0
- package/dist/brain/project-source-contract.d.ts.map +1 -0
- package/dist/brain/project-source-contract.js +2 -0
- package/dist/brain/project-source-contract.js.map +1 -0
- package/dist/brain/project-source-intake.d.ts +26 -0
- package/dist/brain/project-source-intake.d.ts.map +1 -0
- package/dist/brain/project-source-intake.js +457 -0
- package/dist/brain/project-source-intake.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/context-cli.d.ts.map +1 -1
- package/dist/context-cli.js +9 -3
- package/dist/context-cli.js.map +1 -1
- package/dist/dashboard/brain-hub-actions.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-actions.js +232 -135
- package/dist/dashboard/brain-hub-actions.js.map +1 -1
- package/dist/dashboard/brain-hub-agent-dock.d.ts +2 -0
- package/dist/dashboard/brain-hub-agent-dock.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-agent-dock.js +255 -0
- package/dist/dashboard/brain-hub-agent-dock.js.map +1 -0
- package/dist/dashboard/brain-hub-brand-icons.d.ts +2 -0
- package/dist/dashboard/brain-hub-brand-icons.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-brand-icons.js +9 -0
- package/dist/dashboard/brain-hub-brand-icons.js.map +1 -0
- package/dist/dashboard/brain-hub-client.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-client.js +433 -333
- package/dist/dashboard/brain-hub-client.js.map +1 -1
- package/dist/dashboard/brain-hub-context.d.ts +2 -0
- package/dist/dashboard/brain-hub-context.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-context.js +37 -0
- package/dist/dashboard/brain-hub-context.js.map +1 -0
- package/dist/dashboard/brain-hub-controls.d.ts +2 -0
- package/dist/dashboard/brain-hub-controls.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-controls.js +63 -0
- package/dist/dashboard/brain-hub-controls.js.map +1 -0
- package/dist/dashboard/brain-hub-exchanges.d.ts +2 -0
- package/dist/dashboard/brain-hub-exchanges.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-exchanges.js +82 -0
- package/dist/dashboard/brain-hub-exchanges.js.map +1 -0
- package/dist/dashboard/brain-hub-graph.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-graph.js +236 -74
- package/dist/dashboard/brain-hub-graph.js.map +1 -1
- package/dist/dashboard/brain-hub-html.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-html.js +56 -1
- package/dist/dashboard/brain-hub-html.js.map +1 -1
- package/dist/dashboard/brain-hub-knowledge.d.ts +2 -0
- package/dist/dashboard/brain-hub-knowledge.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-knowledge.js +33 -0
- package/dist/dashboard/brain-hub-knowledge.js.map +1 -0
- package/dist/dashboard/brain-hub-live.d.ts +2 -0
- package/dist/dashboard/brain-hub-live.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-live.js +151 -0
- package/dist/dashboard/brain-hub-live.js.map +1 -0
- package/dist/dashboard/brain-hub-managed-skills.d.ts +2 -0
- package/dist/dashboard/brain-hub-managed-skills.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-managed-skills.js +20 -0
- package/dist/dashboard/brain-hub-managed-skills.js.map +1 -0
- package/dist/dashboard/brain-hub-native.d.ts +2 -0
- package/dist/dashboard/brain-hub-native.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-native.js +44 -0
- package/dist/dashboard/brain-hub-native.js.map +1 -0
- package/dist/dashboard/brain-hub-project-views.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-project-views.js +78 -77
- package/dist/dashboard/brain-hub-project-views.js.map +1 -1
- package/dist/dashboard/brain-hub-sessions.d.ts +2 -0
- package/dist/dashboard/brain-hub-sessions.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-sessions.js +40 -0
- package/dist/dashboard/brain-hub-sessions.js.map +1 -0
- package/dist/dashboard/brain-hub-usage.d.ts +2 -0
- package/dist/dashboard/brain-hub-usage.d.ts.map +1 -0
- package/dist/dashboard/brain-hub-usage.js +28 -0
- package/dist/dashboard/brain-hub-usage.js.map +1 -0
- package/dist/dashboard/brain-hub-views.d.ts.map +1 -1
- package/dist/dashboard/brain-hub-views.js +151 -146
- package/dist/dashboard/brain-hub-views.js.map +1 -1
- package/dist/dashboard/live-workspace-html.js +1039 -1039
- package/dist/dashboard/managed-project-skills-api.d.ts +29 -0
- package/dist/dashboard/managed-project-skills-api.d.ts.map +1 -0
- package/dist/dashboard/managed-project-skills-api.js +28 -0
- package/dist/dashboard/managed-project-skills-api.js.map +1 -0
- package/dist/dashboard/native-codex-api.d.ts +83 -0
- package/dist/dashboard/native-codex-api.d.ts.map +1 -0
- package/dist/dashboard/native-codex-api.js +91 -0
- package/dist/dashboard/native-codex-api.js.map +1 -0
- package/dist/dashboard/project-file-watch.d.ts +46 -0
- package/dist/dashboard/project-file-watch.d.ts.map +1 -0
- package/dist/dashboard/project-file-watch.js +221 -0
- package/dist/dashboard/project-file-watch.js.map +1 -0
- package/dist/dashboard/project-live-stream.d.ts +33 -0
- package/dist/dashboard/project-live-stream.d.ts.map +1 -0
- package/dist/dashboard/project-live-stream.js +233 -0
- package/dist/dashboard/project-live-stream.js.map +1 -0
- package/dist/dashboard/project-policy-api.d.ts +37 -0
- package/dist/dashboard/project-policy-api.d.ts.map +1 -0
- package/dist/dashboard/project-policy-api.js +31 -0
- package/dist/dashboard/project-policy-api.js.map +1 -0
- package/dist/dashboard/project-session-api.d.ts +28 -0
- package/dist/dashboard/project-session-api.d.ts.map +1 -0
- package/dist/dashboard/project-session-api.js +84 -0
- package/dist/dashboard/project-session-api.js.map +1 -0
- package/dist/dashboard/project-source-api.d.ts +11 -0
- package/dist/dashboard/project-source-api.d.ts.map +1 -0
- package/dist/dashboard/project-source-api.js +67 -0
- package/dist/dashboard/project-source-api.js.map +1 -0
- package/dist/dashboard/project-workspace.d.ts.map +1 -1
- package/dist/dashboard/project-workspace.js +18 -0
- package/dist/dashboard/project-workspace.js.map +1 -1
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +64 -25
- package/dist/dashboard/server.js.map +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts +1 -1
- package/dist/dashboard/v6-dashboard-html.d.ts.map +1 -1
- package/dist/dashboard/v6-dashboard-html.js +4261 -4309
- package/dist/dashboard/v6-dashboard-html.js.map +1 -1
- package/dist/dashboard/workspace-api.d.ts.map +1 -1
- package/dist/dashboard/workspace-api.js +105 -23
- package/dist/dashboard/workspace-api.js.map +1 -1
- package/dist/dashboard/workspace-status.d.ts +3 -0
- package/dist/dashboard/workspace-status.d.ts.map +1 -1
- package/dist/dashboard/workspace-status.js +4 -3
- package/dist/dashboard/workspace-status.js.map +1 -1
- package/dist/project-cli.js +1 -1
- package/dist/project-cli.js.map +1 -1
- package/docs/BRAND_ASSETS.md +36 -0
- package/docs/FEATURES_AND_LIMITS.md +29 -24
- package/docs/INTEGRATIONS.md +4 -2
- package/docs/LEARNING.md +1 -1
- package/docs/PROJECT_KIT.md +6 -1
- package/docs/QUICKSTART.md +62 -44
- package/docs/README.md +36 -33
- package/docs/SESSIONS.md +77 -0
- package/docs/SOURCE_INTAKE.md +33 -0
- package/docs/STATS.md +21 -21
- package/docs/VISUAL_GUIDE_v7.22.0.md +73 -0
- package/docs/WORKFLOW_INTEGRATION.md +3 -1
- package/docs/WORKSPACE.md +63 -37
- package/docs/assets/7.22.0-agent-dock-mobile.png +0 -0
- package/docs/assets/7.22.0-agent-dock.gif +0 -0
- package/docs/assets/7.22.0-agent-dock.png +0 -0
- package/docs/assets/7.22.0-hub-exchange.png +0 -0
- package/docs/assets/7.22.0-hub-exchanges.gif +0 -0
- package/docs/assets/7.22.0-hub-graph.png +0 -0
- package/docs/assets/7.22.0-hub-mobile-empty.png +0 -0
- package/docs/assets/7.22.0-managed-skills.png +0 -0
- package/docs/assets/7.22.0-plain-evidence.png +0 -0
- package/docs/assets/7.22.0-project-controls.png +0 -0
- package/docs/assets/7.22.0-sessions.png +0 -0
- package/docs/assets/7.22.0-teach-brain.png +0 -0
- package/docs/launch/RELEASE_ACCEPTANCE_v7.22.0.md +48 -0
- package/docs/launch/RELEASE_NOTES_v7.22.0.md +53 -0
- package/docs/launch/RESEARCH_AND_PLAN_v7.22.0.md +672 -0
- package/package.json +135 -130
- package/skills/shadow-workflow/SKILL.md +2 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export const BRAIN_HUB_LIVE = String.raw `
|
|
2
|
+
const liveStream={source:null,status:'connecting',cursor:null,instance:null,replaying:false,ready:false,notice:null,areas:new Set(),
|
|
3
|
+
timer:0,files:null,fileError:null,fileEpoch:0,inventoryTimer:0,seen:new Map(),filePulse:null};
|
|
4
|
+
const streamAreas=['telemetry','graph','hub','sources','sessions','usage','features','feedback','policy','presence'];
|
|
5
|
+
function streamBadge(){
|
|
6
|
+
const badge=$('stream-health');
|
|
7
|
+
if(!badge||!local)return;
|
|
8
|
+
const state=liveStream.status;
|
|
9
|
+
badge.hidden=false;
|
|
10
|
+
badge.className='chip '+(state==='live'?'green':state==='fallback'?'amber':'');
|
|
11
|
+
badge.textContent=state==='live'?'Live stream':state==='fallback'?'Polling fallback':state==='off'?'Live updates off':'Connecting stream';
|
|
12
|
+
}
|
|
13
|
+
function queueLive(areas){
|
|
14
|
+
for(const area of areas)if(streamAreas.includes(area))liveStream.areas.add(area);
|
|
15
|
+
if(liveStream.timer||!liveStream.areas.size)return;
|
|
16
|
+
liveStream.timer=setTimeout(()=>{
|
|
17
|
+
liveStream.timer=0;
|
|
18
|
+
if(document.hidden)return;
|
|
19
|
+
if(polling||state.pending){queueLive([]);return;}
|
|
20
|
+
const areas=new Set(liveStream.areas);
|
|
21
|
+
liveStream.areas.clear();
|
|
22
|
+
void refresh(false,areas);
|
|
23
|
+
},55);
|
|
24
|
+
}
|
|
25
|
+
function clearLiveFiles(){
|
|
26
|
+
liveStream.files=null;liveStream.fileError=null;liveStream.filePulse=null;liveStream.seen.clear();liveStream.fileEpoch++;
|
|
27
|
+
updateLiveFilePanel();updateLiveFilePulse();
|
|
28
|
+
}
|
|
29
|
+
function stopProjectStream(){
|
|
30
|
+
liveStream.source?.close();liveStream.source=null;
|
|
31
|
+
liveStream.ready=false;liveStream.replaying=false;
|
|
32
|
+
clearTimeout(liveStream.timer);liveStream.timer=0;clearTimeout(liveStream.inventoryTimer);liveStream.inventoryTimer=0;
|
|
33
|
+
liveStream.areas.clear();
|
|
34
|
+
}
|
|
35
|
+
function syncProjectStream(){
|
|
36
|
+
if(!local||document.hidden||!state.server?.capabilities?.liveStream)return;
|
|
37
|
+
if(state.features?.features?.liveActivity===false){
|
|
38
|
+
stopProjectStream();clearLiveFiles();liveStream.cursor=null;liveStream.status='off';streamBadge();return;
|
|
39
|
+
}
|
|
40
|
+
if(liveStream.source)return;
|
|
41
|
+
if(typeof EventSource!=='function'){liveStream.status='fallback';streamBadge();return;}
|
|
42
|
+
liveStream.status='connecting';streamBadge();
|
|
43
|
+
const previous=liveStream.cursor;
|
|
44
|
+
liveStream.replaying=!!previous;
|
|
45
|
+
const source=new EventSource('/api/workspace/stream'+(previous?'?'+new URLSearchParams({cursor:previous}):''));
|
|
46
|
+
liveStream.source=source;
|
|
47
|
+
function handle(message){
|
|
48
|
+
if(liveStream.source!==source)return;
|
|
49
|
+
let data;
|
|
50
|
+
try{data=JSON.parse(message.data);}catch{return;}
|
|
51
|
+
if(!data||typeof data.serverInstanceId!=='string'||!Number.isSafeInteger(data.sequence)||data.kind!==message.type)return;
|
|
52
|
+
if(liveStream.instance&&liveStream.instance!==data.serverInstanceId)clearLiveFiles();
|
|
53
|
+
liveStream.instance=data.serverInstanceId;
|
|
54
|
+
liveStream.cursor=message.lastEventId;
|
|
55
|
+
if(data.kind==='disabled'){
|
|
56
|
+
stopProjectStream();clearLiveFiles();liveStream.cursor=null;liveStream.status='off';streamBadge();
|
|
57
|
+
void refresh(true);return;
|
|
58
|
+
}
|
|
59
|
+
if(data.kind==='reset'){
|
|
60
|
+
liveStream.notice='Live history changed. The workspace refreshed its current snapshot.';
|
|
61
|
+
clearLiveFiles();return;
|
|
62
|
+
}
|
|
63
|
+
if(data.kind==='ready'){
|
|
64
|
+
const reconnect=liveStream.replaying||liveStream.ready;
|
|
65
|
+
liveStream.status='live';liveStream.ready=true;liveStream.replaying=false;
|
|
66
|
+
if(!pollAgain)clearTimeout(timer);
|
|
67
|
+
streamBadge();
|
|
68
|
+
if(reconnect){state.suppressLivePulse=true;void refresh(true);}
|
|
69
|
+
else queueLive(streamAreas);
|
|
70
|
+
if(data.watch?.status!=='off')void readLiveFiles();
|
|
71
|
+
renderChrome();return;
|
|
72
|
+
}
|
|
73
|
+
if(data.kind==='change'){if(liveStream.ready&&!liveStream.replaying)queueLive(arr(data.areas));return;}
|
|
74
|
+
if(data.kind==='watch'){void readLiveFiles();return;}
|
|
75
|
+
if(data.kind==='file'&&typeof data.path==='string'&&data.path.length<=320){
|
|
76
|
+
if(liveStream.seen.has(data.sequence))return;
|
|
77
|
+
liveStream.seen.set(data.sequence,data);
|
|
78
|
+
if(liveStream.seen.size>50)liveStream.seen.delete(liveStream.seen.keys().next().value);
|
|
79
|
+
if(liveStream.ready&&!liveStream.replaying&&state.view==='overview'){
|
|
80
|
+
liveStream.filePulse=data;updateLiveFilePulse(!reduced.matches&&!state.motionPaused&&!state.replayId);
|
|
81
|
+
}
|
|
82
|
+
updateLiveFilePanel();
|
|
83
|
+
clearTimeout(liveStream.inventoryTimer);
|
|
84
|
+
liveStream.inventoryTimer=setTimeout(()=>void readLiveFiles(),240);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
for(const kind of ['ready','change','file','watch','reset','disabled'])source.addEventListener(kind,handle);
|
|
88
|
+
source.addEventListener('error',()=>{
|
|
89
|
+
if(liveStream.source!==source)return;
|
|
90
|
+
liveStream.status='fallback';liveStream.replaying=true;streamBadge();
|
|
91
|
+
if(!polling)void refresh();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
async function readLiveFiles(){
|
|
95
|
+
if(!local||document.hidden||state.features?.features?.liveActivity===false)return;
|
|
96
|
+
const id=++liveStream.fileEpoch;
|
|
97
|
+
try{
|
|
98
|
+
const files=await api('project-files');
|
|
99
|
+
if(id!==liveStream.fileEpoch)return;
|
|
100
|
+
if(liveStream.instance&&liveStream.instance!==files.serverInstanceId)liveStream.seen.clear();
|
|
101
|
+
liveStream.files=files;liveStream.fileError=null;
|
|
102
|
+
if(!files.enabled||files.watch?.status==='off'){liveStream.filePulse=null;liveStream.seen.clear();updateLiveFilePulse();}
|
|
103
|
+
for(const event of arr(files.events))if(!liveStream.seen.has(event.sequence))liveStream.seen.set(event.sequence,event);
|
|
104
|
+
const sequences=[...liveStream.seen.keys()].sort((a,b)=>a-b).slice(0,-50);
|
|
105
|
+
for(const sequence of sequences)liveStream.seen.delete(sequence);
|
|
106
|
+
}catch(failure){if(id===liveStream.fileEpoch)liveStream.fileError=failure.message;}
|
|
107
|
+
updateLiveFilePanel();
|
|
108
|
+
}
|
|
109
|
+
function liveFileBody(){
|
|
110
|
+
const fileFeature=state.features?.features?.projectFileActivity??liveStream.files?.enabled;
|
|
111
|
+
if(!fileFeature)return empty('Project file activity is off','Enable it in Setup to observe safe relative paths in this project.',view('setup','Open Setup'));
|
|
112
|
+
if(liveStream.status==='off')return empty('Live updates are off','Enable live dashboard activity in Setup.',view('setup','Open Setup'));
|
|
113
|
+
if(state.features?.features?.activityRecording===false)return empty('Activity recording is off','Enable activity recording in Setup to observe file changes.',view('setup','Open Setup'));
|
|
114
|
+
const watch=liveStream.files?.watch;
|
|
115
|
+
const known=arr(liveStream.files?.items);
|
|
116
|
+
const summary=watch?.status==='limited'?'Watch coverage is limited. Some paths may be omitted.':
|
|
117
|
+
watch?.status==='watching'?fmt(watch.directories)+' watched directories':watch?.status==='off'?'Waiting for a live subscription.':'Opening the selected project.';
|
|
118
|
+
const received=[...liveStream.seen.values()].sort((a,b)=>b.sequence-a.sequence).slice(0,24);
|
|
119
|
+
const entries=received.map(event=>'<li class="item"><div class="row"><strong class="mono">'+esc(event.path)+'</strong><time class="small mono muted" datetime="'+esc(event.timestamp)+'">'+esc(time(event.timestamp))+'</time></div><small class="muted">'+
|
|
120
|
+
esc(event.operation==='entry'?(event.exists?'Directory entry changed':'Removed or renamed'):'Change notification')+
|
|
121
|
+
' · Unknown actor'+(event.count>1?' · '+fmt(event.count)+' grouped notifications':'')+'</small></li>').join('');
|
|
122
|
+
const mostRecent=received[0]?' · Last observed '+time(received[0].timestamp):'';
|
|
123
|
+
return '<div class="panel-body stack"><p class="small muted">'+esc(liveStream.fileError??(summary+mostRecent))+'</p>'+
|
|
124
|
+
(entries?list(entries,'aria-label="Observed project file changes"'):'<p class="small muted">No eligible changes have been observed.</p>')+
|
|
125
|
+
(known.length?'<details><summary>Project paths · '+fmt(known.length)+(watch?.inventoryLimited?' shown':'')+'</summary>'+list(known.map(item=>'<li class="item small mono">'+esc(item.path)+(item.entry==='directory'?'/':'')+'</li>').join(''))+'</details>':'')+'</div>';
|
|
126
|
+
}
|
|
127
|
+
function liveFilePanel(){
|
|
128
|
+
return '<section class="panel" aria-label="Project file activity"><div class="panel-head"><h2>Project file activity</h2></div><div id="project-file-body">'+liveFileBody()+'</div></section>';
|
|
129
|
+
}
|
|
130
|
+
function updateLiveFilePanel(){
|
|
131
|
+
const region=$('project-file-body');
|
|
132
|
+
if(!region)return;
|
|
133
|
+
const markup=liveFileBody();
|
|
134
|
+
if(region.dataset.markup===markup)return;
|
|
135
|
+
const expanded=region.querySelector('details')?.open;
|
|
136
|
+
const focused=region.querySelector('summary:focus');
|
|
137
|
+
region.dataset.markup=markup;region.innerHTML=markup;
|
|
138
|
+
const details=region.querySelector('details');
|
|
139
|
+
if(details&&expanded)details.open=true;
|
|
140
|
+
if(focused)details?.querySelector('summary')?.focus({preventScroll:true});
|
|
141
|
+
}
|
|
142
|
+
function updateLiveFilePulse(animate=false){
|
|
143
|
+
const label=$('project-file-pulse');
|
|
144
|
+
if(!label)return;
|
|
145
|
+
label.hidden=!liveStream.filePulse;
|
|
146
|
+
label.textContent=liveStream.filePulse?'Observed file change · '+liveStream.filePulse.path:'';
|
|
147
|
+
label.classList.remove('file-fresh');
|
|
148
|
+
if(animate&&!label.hidden)requestAnimationFrame(()=>{if(label.isConnected)label.classList.add('file-fresh');});
|
|
149
|
+
}
|
|
150
|
+
`;
|
|
151
|
+
//# sourceMappingURL=brain-hub-live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-live.js","sourceRoot":"","sources":["../../src/dashboard/brain-hub-live.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqJvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-managed-skills.d.ts","sourceRoot":"","sources":["../../src/dashboard/brain-hub-managed-skills.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,QAkBpC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const BRAIN_HUB_MANAGED_SKILLS = String.raw `
|
|
2
|
+
function managedSkillControls(){
|
|
3
|
+
if(!local)return '';
|
|
4
|
+
const inventory=state.managedSkills;
|
|
5
|
+
const listBody=arr(inventory?.skills).length?list(arr(inventory.skills).map(item=>{
|
|
6
|
+
const choices=item.pendingAction?[item.pendingAction]:item.state==='enabled'?['disable','remove']:item.state==='disabled'?['enable','remove']:[];
|
|
7
|
+
const buttons=choices.map(kind=>action('managed-skill-preview','Preview '+kind,'quiet','data-kind="'+esc(kind)+'" data-id="'+esc(item.id)+'" '+(state.pending?'disabled':''))).join('');
|
|
8
|
+
return '<li class="item"><div class="row"><strong>'+esc(item.name)+'</strong>'+chip(item.state,item.state==='enabled'?'green':item.state==='disabled'?'':'amber')+'</div><small class="mono muted">'+esc(item.relativePath)+'</small><p class="small muted">'+esc(arr(item.targets).map(hostName).join(' · '))+'</p>'+(item.reason?'<p class="small amber">'+esc(item.reason)+'</p>':'')+(buttons?'<div class="actions">'+buttons+'</div>':'')+'</li>';
|
|
9
|
+
}).join('')):empty('No managed project skills','Skills applied through Project Kit appear here.',view('knowledge','Open Knowledge'));
|
|
10
|
+
const plan=state.managedSkillPlan;
|
|
11
|
+
const pending=plan?'<div class="panel-body stack"><div class="row"><h3>'+esc('Review '+plan.action)+'</h3>'+action('managed-skill-cancel','Cancel','quiet')+'</div>'+arr(plan.effects).map(effect=>'<p>'+esc(effect)+'</p>').join('')+
|
|
12
|
+
list(arr(plan.exactPaths).map(value=>'<li class="item mono small">'+esc(value)+'</li>').join(''))+
|
|
13
|
+
arr(plan.conflicts).map(value=>'<p class="small amber">'+esc(value)+'</p>').join('')+'<small class="muted">'+esc(plan.hostRefreshNote)+'</small>'+
|
|
14
|
+
(!arr(plan.conflicts).length?'<div class="actions">'+action('managed-skill-apply',plan.action==='remove'?'Remove verified skill':'Apply '+plan.action,plan.action==='remove'?'danger':'primary',state.pending?'disabled':'')+'</div>':'')+'</div>':'';
|
|
15
|
+
return panel('Managed project skills',(error('managedSkills','managed skills')||(!inventory?empty('Loading managed skills','Checking Project Kit receipts.'):listBody))+
|
|
16
|
+
(inventory?.invalidReceipts?'<p class="panel-body small amber">'+esc(inventory.invalidReceipts)+' ownership receipts could not be verified.</p>':'')+pending+
|
|
17
|
+
'<p class="panel-body small muted">Controls apply to skills generated by Project Kit in this workspace. Other skills and supporting files stay untouched.</p>');
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
//# sourceMappingURL=brain-hub-managed-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-managed-skills.js","sourceRoot":"","sources":["../../src/dashboard/brain-hub-managed-skills.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;CAkBjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-native.d.ts","sourceRoot":"","sources":["../../src/dashboard/brain-hub-native.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,QA0C5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const BRAIN_HUB_NATIVE = String.raw `
|
|
2
|
+
let nativeTimer=0,nativeBusy=false,nativeRequestEpoch=0,nativeReload=false;
|
|
3
|
+
function invalidateNativeRequest(){nativeRequestEpoch++;clearTimeout(nativeTimer);}
|
|
4
|
+
async function refreshNativeChats(manual=false){
|
|
5
|
+
if(document.hidden||state.view!=='sessions')return;
|
|
6
|
+
if(nativeBusy){nativeReload ||= manual;return;}
|
|
7
|
+
clearTimeout(nativeTimer);nativeBusy=true;
|
|
8
|
+
const epoch=state.dataEpoch,requestEpoch=nativeRequestEpoch;
|
|
9
|
+
const current=()=>epoch===state.dataEpoch&&requestEpoch===nativeRequestEpoch;
|
|
10
|
+
try{
|
|
11
|
+
const connection=await api('sessions/codex/status');
|
|
12
|
+
if(!current())return;
|
|
13
|
+
state.nativeConnection=connection;
|
|
14
|
+
if(connection.connected){
|
|
15
|
+
const query=new URLSearchParams({archived:String(!!state.nativeArchived),...(state.nativeListCursor?{cursor:state.nativeListCursor}:{})});
|
|
16
|
+
const result=await api('sessions/codex/threads?'+query,{timeoutMs:15000});
|
|
17
|
+
if(!current())return;
|
|
18
|
+
const selected=state.nativeThread?.thread;
|
|
19
|
+
state.nativeThreads=result;
|
|
20
|
+
const latest=arr(result.threads).find(item=>item.id===selected?.id);
|
|
21
|
+
if(selected&&latest&&(manual||latest.updatedAt!==selected.updatedAt)){
|
|
22
|
+
const page=await api('sessions/codex/threads/'+encodeURIComponent(selected.id)+(state.nativeThreadCursor?'?cursor='+encodeURIComponent(state.nativeThreadCursor):''),{timeoutMs:15000});
|
|
23
|
+
if(!current())return;
|
|
24
|
+
state.nativeThread=page;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
delete state.errors.native;
|
|
28
|
+
}catch(failure){if(current())state.errors.native=failure.message;}
|
|
29
|
+
finally{
|
|
30
|
+
nativeBusy=false;
|
|
31
|
+
if(nativeReload){nativeReload=false;void refreshNativeChats(true);}
|
|
32
|
+
else if(current()&&state.view==='sessions'){render(true);if(state.nativeConnection?.connected)nativeTimer=setTimeout(()=>void refreshNativeChats(),10000);}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function nativeHistoryPanel(){
|
|
36
|
+
const connection=state.nativeConnection,threads=arr(state.nativeThreads?.threads),selected=state.nativeThread;
|
|
37
|
+
const actions=connection?.connected?action('native-refresh','Refresh original chats')+action('native-disconnect','Disconnect Codex'):action('native-connect','Connect installed Codex','primary');
|
|
38
|
+
const listMarkup=threads.length?list(threads.map(thread=>'<li><button class="entry" type="button" data-native-thread="'+esc(thread.id)+'"><strong>'+esc(thread.name??'Original title unavailable')+'</strong><small class="mono muted">'+esc(thread.id)+'</small><small>'+esc(isoTime(thread.updatedAt))+'</small></button></li>').join('')):empty(connection?.connected?'No conversations in this project':'Native history is disconnected',connection?.connected?'This list is scoped to the selected project directory. Check archived conversations if needed.':'Connect explicitly to read names and selected history through the installed Codex app-server.');
|
|
39
|
+
const preview=selected?'<div class="panel-body stack"><h3>'+esc(selected.thread.name??'Original title unavailable')+'</h3><dl class="facts">'+fact('Original conversation ID',selected.thread.id)+fact('Session group ID',selected.thread.sessionId??'Not supplied')+fact('Original workspace',selected.thread.cwd)+fact('History API runtime state',selected.thread.status?.type??'unknown')+fact('Observed',isoTime(selected.observedAt))+'</dl><p class="small muted">This separate app-server’s runtime state does not establish whether a desktop chat is working. Names are supplied by Codex; preview text is never substituted for a missing title.</p>'+list(arr(selected.messages).map(message=>'<li class="item"><strong>'+esc(message.role)+'</strong><p class="preserve">'+esc(message.text)+'</p><small class="mono muted">'+esc(message.locator)+'</small></li>').join(''))+'<p class="small muted">'+arr(selected.messages).length+' visible messages in this page. '+fmt(selected.omitted)+' non-text or unsupported items omitted. '+(selected.nextCursor?'Earlier history is available.':'No earlier page reported.')+'</p><div class="actions">'+action('native-import','Save this history page','primary')+(selected.nextCursor?action('native-earlier','Earlier history','','data-cursor="'+esc(selected.nextCursor)+'"'):'')+'</div><p class="small muted">Saving creates an immutable project snapshot of this page. It does not automatically approve the chat as project knowledge or resume a model.</p></div>':empty('Choose an original conversation','Inspect its exact title and visible history before saving a shared snapshot.');
|
|
40
|
+
const exports='<div class="panel-body"><form class="form" data-form="native-export"><label>Original tool<select name="tool"><option value="codex">Codex rollout / indexed export</option><option value="claude-code">Claude Code SDK / JSONL export</option><option value="opencode">OpenCode session export</option><option value="deepseek-harness">DeepSeek Harness canonical export</option></select></label><label>Native export file<input type="file" name="export" accept=".json,.jsonl,.ndjson,.zip" required></label><p class="small muted">Up to 2 MiB. DeepSeek ZIP imports read only the supported session record, never its attachments. Original names are kept when the export contains them; missing names stay unavailable.</p>'+submit('Import native history')+'</form></div>';
|
|
41
|
+
return panel('Original tool history','<div class="panel-body stack"><div class="actions">'+actions+chip(connection?.connected?'Read-only Codex API':'Explicit connection required',connection?.connected?'green':'amber')+'</div><p class="small muted">Connected lists refresh every 10 seconds while this view is open. History is read on selection or when the selected conversation’s timestamp changes. No model is started. The connection expires after 15 minutes.</p>'+error('native','native history')+(connection?.connected?'<div class="actions">'+action('native-archive',state.nativeArchived?'Show current chats':'Show archived chats')+(state.nativeThreads?.nextCursor?action('native-next','Next conversations','','data-cursor="'+esc(state.nativeThreads.nextCursor)+'"'):'')+(state.nativeListCursor?action('native-first','First conversations'):'')+'</div>':'')+'</div><div class="two"><div>'+listMarkup+'</div>'+preview+'</div><details><summary class="panel-body">Import an export from another supported tool</summary>'+exports+'</details>');
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
//# sourceMappingURL=brain-hub-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-native.js","sourceRoot":"","sources":["../../src/dashboard/brain-hub-native.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-hub-project-views.d.ts","sourceRoot":"","sources":["../../src/dashboard/brain-hub-project-views.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brain-hub-project-views.d.ts","sourceRoot":"","sources":["../../src/dashboard/brain-hub-project-views.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,QA6EnC,CAAC"}
|
|
@@ -1,79 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
if(!
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
if(!
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
(
|
|
74
|
-
'
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
import { BRAIN_HUB_KNOWLEDGE } from './brain-hub-knowledge.js';
|
|
2
|
+
export const BRAIN_HUB_PROJECT_VIEWS = String.raw `
|
|
3
|
+
${BRAIN_HUB_KNOWLEDGE}
|
|
4
|
+
function projectRequired(title,description){
|
|
5
|
+
return heading(title,description)+panel('Project workspace required','<div class="panel-body stack"><p class="muted">Open a project-local workspace from its directory to access its documents, work room and learning history.</p><pre>shadow-brain project workspace .</pre>'+action('copy-project-command','Copy launch command')+'</div>');
|
|
6
|
+
}
|
|
7
|
+
function projectHubError(title){
|
|
8
|
+
return panel(title,error('hub','project hub')||empty('Reading project hub','The project-local store is loading.'));
|
|
9
|
+
}
|
|
10
|
+
function skillPanel(){
|
|
11
|
+
const input=state.skillInput??{};
|
|
12
|
+
const form='<form class="form" data-form="skill"><label>Project requirement<textarea name="requirement" rows="3" maxlength="3000" required>'+esc(input.requirement)+'</textarea></label><div class="form-grid"><label>Host target<select name="target">'+['codex','claude-code','opencode','deepseek-harness','portable'].map(target=>'<option value="'+target+'" '+(target===input.target?'selected':'')+'>'+esc(hostName(target))+'</option>').join('')+'</select></label><label>Skill name<input name="name" maxlength="64" value="'+esc(input.name)+'" placeholder="optional-skill-name"></label></div><label>Approved project knowledge<textarea name="knowledge" rows="2" maxlength="4000">'+esc(input.knowledge)+'</textarea></label>'+submit('Preview project skill')+'</form>';
|
|
13
|
+
const plan=state.skill;
|
|
14
|
+
const files=arr(plan?.files);
|
|
15
|
+
const result=plan?'<div class="receipt"><div class="row"><strong>'+esc(plan.name??'Applied skill')+'</strong>'+chip(plan.applied?'Applied':'Preview ready',plan.applied?'green':'cyan')+'</div>'+files.map(file=>'<details><summary>'+esc(file.relativePath)+' · '+esc(file.status)+'</summary>'+(file.content?'<pre>'+esc(file.content)+'</pre>':'')+(file.reason?'<p class="small amber">'+esc(file.reason)+'</p>':'')+'</details>').join('')+arr(plan.warnings).map(warning=>'<p class="small amber">'+esc(warning)+'</p>').join('')+(!plan.applied&&!files.some(file=>file.status==='conflict')?action('apply-skill','Apply reviewed plan','primary'):'')+'</div>':'';
|
|
16
|
+
return panel('Project skill','<div class="panel-body stack">'+form+result+'</div>');
|
|
17
|
+
}
|
|
18
|
+
function docPageMarkup(){
|
|
19
|
+
const record=state.documents;
|
|
20
|
+
if(!record)return empty('Select a document','Choose an uploaded PDF to see its extracted page text and citation.');
|
|
21
|
+
const doc=record.document,pages=arr(record.pages);
|
|
22
|
+
const page=pages.find(item=>item.page===state.docPage);
|
|
23
|
+
const prev=pages.findLast(item=>item.page<state.docPage),next=pages.find(item=>item.page>state.docPage);
|
|
24
|
+
return '<div class="panel-body stack"><div class="row"><div><h3>'+esc(doc.name)+'</h3><p class="small muted">'+fmt(doc.pageCount)+' pages · '+esc(doc.parser??'Parser unavailable')+'</p></div>'+chip(doc.status,doc.status==='ready'?'green':'amber')+'</div>'+
|
|
25
|
+
(doc.error?'<p class="small amber">'+esc(doc.error)+'</p>':'')+'<details><summary>Document fingerprint</summary><pre>'+esc(doc.sha256)+'</pre></details>'+
|
|
26
|
+
(page?'<div class="actions">'+btn('Previous page','data-page="'+(prev?.page??'')+'" '+(prev?'':'disabled'))+btn('Next page','data-page="'+(next?.page??'')+'" '+(next?'':'disabled'))+chip('Page '+page.page)+chip(page.status,page.status==='approved'?'green':'amber')+'</div>'+(page.truncated?'<p class="small amber">Extraction reached the text limit. Approval stores only the excerpt shown here.</p>':'')+'<pre>'+esc(page.text||'This page has no extracted text. OCR is unavailable in this workspace.')+'</pre>'+(page.citation?'<p class="small mono cyan">'+esc(typeof page.citation==='string'?page.citation:JSON.stringify(page.citation))+'</p>':'')+
|
|
27
|
+
(page.status==='pending'&&page.text?'<div class="actions">'+action('review-page','Approve page','primary','data-decision="approve"')+action('review-page','Reject page','','data-decision="reject"')+'</div>':'')+(page.memoryId?action('open-memory','Inspect approved memory','','data-memory="'+esc(page.memoryId)+'"'):''):'')+'</div>';
|
|
28
|
+
}
|
|
29
|
+
function knowledgePage(){
|
|
30
|
+
if(!local)return projectRequired('Knowledge intake','Review sources and commit project-local knowledge.');
|
|
31
|
+
const docs=arr(state.hub?.documents);
|
|
32
|
+
const queue=docs.length?list(docs.map(doc=>'<li><button class="entry" type="button" data-document="'+esc(doc.id)+'" aria-pressed="'+(doc.id===state.documents?.document?.id)+'"><strong>'+esc(doc.name)+'</strong><small class="muted">'+esc(doc.status)+' · '+fmt(doc.pageCount)+' pages</small></button></li>').join(''),'class="list section-list"'):empty('No PDFs uploaded','Choose a local PDF to extract and review its pages.');
|
|
33
|
+
const pdfEnabled=state.server?.capabilities?.pdf!==false;
|
|
34
|
+
const pdf=state.hub?queue+(pdfEnabled?'<div class="panel-body"><form class="form" data-form="upload"><label>PDF source<input name="pdf" type="file" accept="application/pdf,.pdf" required></label><p class="small muted">'+(state.hub.limits?.pdfBytes?fmt(state.hub.limits.pdfBytes/1024)+' KiB maximum. ':'')+'Review extracted text before adding it to memory.</p>'+submit('Upload PDF')+'</form></div>':''):error('hub','document queue')||empty('Loading document queue','Reading project-local document records.');
|
|
35
|
+
const profile=state.profile;
|
|
36
|
+
const project=profile?'<div class="panel-body stack"><dl class="facts">'+fact('Stack',arr(profile.stack).join(' · ')||'No markers found')+fact('Package managers',arr(profile.packageManagers).join(' · ')||'No markers found')+'</dl>'+arr(profile.warnings).map(text=>'<p class="small amber">'+esc(text)+'</p>').join('')+(arr(profile.evidence).length?'<details><summary>Observed project evidence</summary>'+list(profile.evidence.map(item=>'<li class="item mono small">'+esc(item.path)+' · '+esc(arr(item.signals).join(', '))+'</li>').join(''))+'</details>':'')+'</div>':error('profile','project profile')||empty('Reading project profile','Inspecting bounded project-local markers.');
|
|
37
|
+
return heading('Knowledge for this project','Save ordinary notes and facts for your connected agents to recall.',view('context','Try a question'))+evidencePanel()+'<div class="two">'+teachPanel()+panel('Saved notes and review',sourceReview())+'</div><div class="two" style="margin-top:10px">'+panel('Saved sources',sourceLibrary())+panel('Observed project profile',project)+'</div><details class="panel-body" '+(state.documents?'open':'')+'><summary>Optional: PDF library and page review</summary><div class="two" style="margin-top:10px">'+panel('PDF library',pdf)+panel('Page review',docPageMarkup())+'</div></details>'+skillPanel();
|
|
38
|
+
}
|
|
39
|
+
function roomAction(kind,label,id,extra=''){return btn(label,'data-room-action="'+kind+'" data-id="'+esc(id)+'" '+extra);}
|
|
40
|
+
function operator(actor){return actor?.kind==='user'&&actor.id==='Operator';}
|
|
41
|
+
function roomPage(){
|
|
42
|
+
if(!local)return projectRequired('Shared work room','Exchange proposals, tasks, artifacts and outcomes in a project-local room.');
|
|
43
|
+
if(!state.hub)return heading('Shared work room','Coordinate proposals, artifacts and outcomes.')+projectHubError('Rooms');
|
|
44
|
+
const rooms=arr(state.hub.rooms),current=state.room;
|
|
45
|
+
const roster=(rooms.length?list(rooms.map(room=>'<li><button class="entry" type="button" data-room="'+esc(room.id)+'" aria-pressed="'+(room.id===current?.room?.id)+'"><strong>'+esc(room.goal)+'</strong><small class="muted">'+esc(isoTime(room.createdAt))+'</small></button></li>').join(''),'class="list section-list"'):empty('No work rooms','Create a room for a shared project goal.'))+
|
|
46
|
+
'<div class="panel-body"><form class="form" data-form="room"><label>Room goal<textarea name="goal" rows="2" maxlength="400" required></textarea></label>'+submit('Create room')+'</form></div>';
|
|
47
|
+
if(!current)return heading('Shared work room','Coordinate proposals, artifacts and outcomes.')+'<div class="two">'+panel('Project rooms',roster)+panel('Discussion',empty('No room selected','Choose a project room or create a room for this task.'))+'</div>';
|
|
48
|
+
const messages=arr(current.messages);
|
|
49
|
+
const messageForm='<div class="panel-body"><form class="form" data-form="message"><div class="form-grid"><label>Message type<select name="type">'+['proposal','critique','question','answer','decision','handoff','status'].map(type=>'<option>'+type+'</option>').join('')+'</select></label><label>Reply to<select name="replyTo"><option value="">No reply</option>'+messages.map(message=>'<option value="'+esc(message.id)+'">'+esc(message.type+' · '+message.text.slice(0,60))+'</option>').join('')+'</select></label></div><label>Message<textarea name="text" rows="2" maxlength="3000" required></textarea></label>'+submit('Post message')+'</form></div>';
|
|
50
|
+
const discussion='<div class="panel-body"><h3>'+esc(current.room.goal)+'</h3><p class="small muted mono">'+esc(current.room.id)+'</p></div>'+list(messages.map(message=>'<li class="item"><div class="row"><span>'+chip(message.type,'cyan')+' <strong>'+esc(hostName(message.author?.id))+'</strong></span><time class="small muted mono">'+esc(time(message.createdAt))+'</time></div><p>'+esc(message.text)+'</p>'+(message.replyTo?'<small class="muted">Reply to '+esc(message.replyTo)+'</small>':'')+(!operator(message.author)?'<div class="actions">'+roomAction('ack-message','Acknowledge message',message.id)+'</div>':'')+'</li>').join(''),'class="list section-list"')+messageForm;
|
|
51
|
+
const tasks=arr(current.tasks), artifacts=arr(current.artifacts),outcomes=arr(current.outcomes);
|
|
52
|
+
const taskList=list(tasks.map(task=>'<li class="item"><div class="row"><strong>'+esc(task.title)+'</strong>'+chip(task.status,task.status==='completed'?'green':'')+'</div><small class="muted">'+esc(task.owner?'Owner '+hostName(task.owner.id)+(task.leaseUntil?' · lease '+isoTime(task.leaseUntil):''):'Unclaimed')+'</small><div class="actions">'+(task.status==='open'?roomAction('claim','Claim',task.id,'data-revision="'+esc(task.revision)+'"'):task.status==='claimed'&&operator(task.owner)?roomAction('renew','Renew',task.id,'data-revision="'+esc(task.revision)+'"')+roomAction('release','Release',task.id,'data-revision="'+esc(task.revision)+'"'):'')+'</div></li>').join(''));
|
|
53
|
+
const taskForm='<div class="panel-body"><form class="form" data-form="task"><label>Task title<input name="title" maxlength="240" required></label>'+submit('Add task')+'</form></div>';
|
|
54
|
+
const artifactsMarkup=artifacts.length?list(artifacts.map(item=>'<li class="item"><div class="row"><strong>'+esc(item.path)+'</strong>'+chip(item.status)+'</div><small class="muted mono">'+esc(item.sha256)+'</small><div class="actions"><a class="btn" href="/api/workspace/hub/rooms/'+encodeURIComponent(current.room.id)+'/artifacts/'+encodeURIComponent(item.id)+'">Download</a>'+(item.status==='submitted'&&tasks.some(task=>task.id===item.taskId&&task.artifactId===item.id&&task.status==='claimed')?roomAction('accept','Accept artifact',item.id):'')+(!operator(item.author)?roomAction('ack-artifact','Acknowledge',item.id,'data-sha256="'+esc(item.sha256)+'"'):'')+'</div></li>').join('')):'';
|
|
55
|
+
const taskOptions=tasks.map(item=>'<option value="'+esc(item.id)+'">'+esc(item.title)+'</option>').join('');
|
|
56
|
+
const claimed=tasks.filter(item=>item.status==='claimed'&&operator(item.owner));
|
|
57
|
+
const artifactForm=claimed.length?'<div class="panel-body"><form class="form" data-form="artifact"><label>Claimed task<select name="taskId">'+claimed.map(item=>'<option value="'+esc(item.id)+'">'+esc(item.title)+'</option>').join('')+'</select></label><label>Project-relative artifact path<input name="path" maxlength="400" required></label>'+submit('Attach artifact')+'</form></div>':'';
|
|
58
|
+
const outcomeForm=tasks.length?'<div class="panel-body"><form class="form" data-form="outcome"><label>Task<select name="taskId">'+taskOptions+'</select></label><label>Artifact<select name="artifactId"><option value="">No artifact</option>'+artifacts.map(item=>'<option value="'+esc(item.id)+'">'+esc(item.path)+'</option>').join('')+'</select></label><label>Result<select name="result"><option>pass</option><option>fail</option><option>partial</option></select></label><label>Acceptance check<input name="check" maxlength="240" required></label><label>Evidence<textarea name="evidence" maxlength="3000" rows="2" required></textarea></label>'+submit('Record outcome')+'</form></div>':'';
|
|
59
|
+
const outcomeRows=list(outcomes.map(item=>'<li class="item"><div class="row"><strong>'+esc(item.check)+'</strong>'+chip(item.result,item.result==='pass'?'green':'amber')+'</div><p class="small muted">'+esc(item.evidence)+'</p><small class="muted">'+esc(item.provenance)+'</small>'+btn('Propose lesson','data-lesson-from="'+esc(item.id)+'"','quiet')+'</li>').join(''));
|
|
60
|
+
const acks=arr(current.acknowledgements);
|
|
61
|
+
const right='<div class="panel-head"><h2>Tasks</h2>'+chip(tasks.length)+'</div>'+taskList+taskForm+'<div class="panel-head"><h2>Artifacts and outcomes</h2>'+chip(artifacts.length+outcomes.length)+'</div>'+artifactsMarkup+artifactForm+outcomeRows+outcomeForm+
|
|
62
|
+
(acks.length?'<details class="panel-body"><summary>'+acks.length+' acknowledgements</summary>'+list(acks.map(item=>'<li class="item small">'+esc(hostName(item.author?.id))+' · '+esc(item.targetType)+' · <span class="mono">'+esc(item.targetId)+'</span></li>').join(''))+'</details>':'');
|
|
63
|
+
return heading('Shared work room','Coordinate proposals, artifacts and outcomes.',action('refresh-room','Refresh room'))+'<div class="three">'+panel('Project rooms',roster)+panel('Discussion',discussion,chip(messages.length))+'<section class="panel">'+right+'</section></div>';
|
|
64
|
+
}
|
|
65
|
+
function lessonAction(kind,label,id){return btn(label,'data-lesson-action="'+kind+'" data-id="'+esc(id)+'"');}
|
|
66
|
+
function learningPage(){
|
|
67
|
+
if(!local)return projectRequired('Memory and learning','Evaluate source-backed lessons and review their recorded outcomes.');
|
|
68
|
+
if(!state.hub)return heading('Memory and learning','Evaluate project lessons against observed outcomes.')+projectHubError('Lessons');
|
|
69
|
+
const lessons=arr(state.hub.lessons);
|
|
70
|
+
const outcomes=arr(state.room?.outcomes);
|
|
71
|
+
const lessonForm=outcomes.length?'<div class="panel-body"><form class="form" data-form="lesson"><label>Recorded outcome<select name="outcomeId">'+outcomes.map(item=>'<option value="'+esc(item.id)+'" '+(state.lessonFrom===item.id?'selected':'')+'>'+esc(item.check)+'</option>').join('')+'</select></label><label>Lesson title<input name="title" maxlength="150" required></label><label>Lesson and scope<textarea name="text" rows="3" maxlength="4000" required></textarea></label>'+submit('Record lesson candidate')+'</form></div>':empty('No room outcome selected','Open a work room with a recorded outcome to propose a lesson.',view('room','Open collaboration'));
|
|
72
|
+
const rows=lessons.length?list(lessons.map(lesson=>'<li class="item"><div class="row"><h3>'+esc(lesson.title)+'</h3>'+chip(lesson.status,lesson.status==='promoted'?'green':'amber')+'</div><p>'+esc(lesson.text)+'</p><small class="muted mono">Outcome '+esc(lesson.outcomeId)+'</small>'+
|
|
73
|
+
(lesson.evaluation?'<dl class="facts">'+fact('Baseline',lesson.evaluation.baseline?'Pass':'Fail')+fact('Candidate',lesson.evaluation.candidate?'Pass':'Fail')+fact('Control',lesson.evaluation.control?'Pass':'Fail')+fact('Evidence',lesson.evaluation.evidence)+fact('Provenance',lesson.evaluation.provenance)+'</dl>':'')+
|
|
74
|
+
(['candidate','evaluated'].includes(lesson.status)&&!lesson.memoryId?'<details><summary>'+esc(lesson.evaluation?'Update operator-reported comparison':'Record operator-reported comparison')+'</summary><form class="form" data-form="evaluate" data-id="'+esc(lesson.id)+'"><p class="small muted">Report the results of checks you ran outside this workspace.</p><label class="check"><input type="checkbox" name="baseline" '+(lesson.evaluation?.baseline?'checked':'')+'> Baseline passed</label><label class="check"><input type="checkbox" name="candidate" '+(lesson.evaluation?.candidate?'checked':'')+'> Candidate passed</label><label class="check"><input type="checkbox" name="control" '+(lesson.evaluation?.control?'checked':'')+'> Safety controls passed</label><label>Evaluation evidence<textarea name="evidence" maxlength="4000" rows="2" required>'+esc(lesson.evaluation?.evidence)+'</textarea></label>'+submit('Record evaluation')+'</form></details>':'')+
|
|
75
|
+
'<div class="actions">'+(lesson.status==='evaluated'&&lesson.evaluation&&!lesson.evaluation.baseline&&lesson.evaluation.candidate&&lesson.evaluation.control?lessonAction('promote','Promote lesson',lesson.id):lesson.status==='promoted'?lessonAction('rollback','Roll back lesson',lesson.id):'')+(lesson.memoryId?action('open-memory','Inspect lesson memory','','data-memory="'+esc(lesson.memoryId)+'"'):'')+'</div></li>').join('')):empty('No candidate lessons','Record a work-room outcome to create a candidate for review.');
|
|
76
|
+
const feedback=state.feedback;
|
|
77
|
+
return heading('Memory and learning','Save useful knowledge, test it on a task, and correct what does not help.')+panel('How learning works','<div class="panel-body"><ol><li>Add and approve knowledge in this project.</li><li>Use a context pack in your agent and check the result.</li><li>Mark memories useful, irrelevant, or incorrect.</li><li>For repeatable improvements, record a work-room outcome, compare a lesson, and promote or roll it back.</li></ol><p class="small muted">The system adapts stored memory and retrieval. It does not train the connected model or verify an outcome you report.</p></div>')+panel('Learn from your feedback',feedbackControls())+'<div class="two">'+panel('Propose a lesson',lessonForm)+panel('Lesson history',rows,chip(lessons.length))+'</div>';
|
|
78
|
+
}
|
|
78
79
|
`;
|
|
79
80
|
//# sourceMappingURL=brain-hub-project-views.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-hub-project-views.js","sourceRoot":"","sources":["../../src/dashboard/brain-hub-project-views.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"brain-hub-project-views.js","sourceRoot":"","sources":["../../src/dashboard/brain-hub-project-views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAA;EAC/C,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4EpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brain-hub-sessions.d.ts","sourceRoot":"","sources":["../../src/dashboard/brain-hub-sessions.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,QAqC9B,CAAC"}
|